add televisions tests

This commit is contained in:
tTh 2024-08-10 17:48:52 +02:00
parent 4a3f107263
commit acb36a45b3
3 changed files with 46 additions and 21 deletions

View File

@ -145,7 +145,7 @@ Image_TGA_save("Pictures/aaaa-luminance-128.tga", dst, 0);
foo = Image_luminance(src, dst, 200); foo = Image_luminance(src, dst, 200);
Image_TGA_save("Pictures/aaaa-luminance-200.tga", dst, 0); Image_TGA_save("Pictures/aaaa-luminance-200.tga", dst, 0);
foo = Image_luminance(src, dst, 500); foo = Image_luminance(src, dst, 500);
if (foo) Image_print_error(__func__, foo); if (foo) Image_print_error((char *)__func__, foo);
Image_TGA_save("Pictures/aaaa-luminance-500.tga", dst, 0); Image_TGA_save("Pictures/aaaa-luminance-500.tga", dst, 0);
@ -471,7 +471,6 @@ int rotule, foo;
Image_Desc *origine, *imgtmp; Image_Desc *origine, *imgtmp;
char chaine[100]; char chaine[100];
int filtre[11]; int filtre[11];
int w3, h3;
Image_Rect rect; Image_Rect rect;
static int datas_sobel[] = static int datas_sobel[] =
@ -513,9 +512,6 @@ printf("image originale @ %p\n", origine);
imgtmp = Image_clone(origine, 1); imgtmp = Image_clone(origine, 1);
w3 = origine->width * 3;
h3 = origine->height * 3;
if (flags) memcpy(filtre, datas_prewitt, sizeof(filtre)); if (flags) memcpy(filtre, datas_prewitt, sizeof(filtre));
else memcpy(filtre, datas_sobel, sizeof(filtre)); else memcpy(filtre, datas_sobel, sizeof(filtre));
@ -1055,15 +1051,39 @@ Image_DeAllocate(finale); free(finale);
return 0; return 0;
} }
/*::------------------------------------------------------------------::*/ /*::------------------------------------------------------------------::*/
int /* new: Sat Aug 10 15:32:01 UTC 2024 */
Test_Egalisations(char *nomsource, int k) int Essai_Televisions(char *nomsource, int k)
{
Image_Desc *image, *resultat;
int foo;
image = Image_TGA_alloc_load(nomsource);
printf("%s : image loaded %p\n", __func__, image);
resultat = Image_clone(image, 0);
printf("%s : image cloned %p\n", __func__, resultat);
foo = Image_TV_old(image, resultat, 127, 127, 127);
printf("\tTV old -> %d\n", foo);
Image_TGA_save("aaaa_tv_old.tga", resultat, 0);
foo = Image_TV_pix_0(image, resultat, 16, 16, 127);
printf("\tTV pix 0 -> %d\n", foo);
Image_TGA_save("aaaa_tv_pix_0.tga", resultat, 0);
Image_DeAllocate(image); free(image);
Image_DeAllocate(resultat); free(resultat);
return FULL_NUCKED;
}
/*::------------------------------------------------------------------::*/
int Test_Egalisations(char *nomsource, int k)
{ {
Image_Desc *image, *deuxieme, *troisieme; Image_Desc *image, *deuxieme, *troisieme;
int x, y; int x, y;
fprintf(stderr, "============= Egalisations %s %d =====\n", nomsource, k); fprintf(stderr, "============= Egalisations %s %d =====\n", nomsource, k);
image= Image_TGA_alloc_load(nomsource); image = Image_TGA_alloc_load(nomsource);
printf("image loaded %p\n", image); printf("image loaded %p\n", image);
deuxieme = Image_clone(image, 0); deuxieme = Image_clone(image, 0);
@ -1074,16 +1094,13 @@ troisieme = Image_clone(image, 0);
printf("image 3 cloned %p\n", troisieme); printf("image 3 cloned %p\n", troisieme);
Image_egalise_RGB(image, troisieme, 0); Image_egalise_RGB(image, troisieme, 0);
for (x=0; x<image->width; x++) for (x=0; x<image->width; x++) {
{ if (x < image->width/3) {
if (x < image->width/3)
{
for (y=0; y<image->height; y++) for (y=0; y<image->height; y++)
Image_pixel_copy(image, x, y, troisieme, x, y); Image_pixel_copy(image, x, y, troisieme, x, y);
} }
else else
if (x > image->width/3*2) if (x > image->width/3*2) {
{
for (y=0; y<image->height; y++) for (y=0; y<image->height; y++)
Image_pixel_copy(deuxieme, x, y, troisieme, x, y); Image_pixel_copy(deuxieme, x, y, troisieme, x, y);
} }
@ -1095,7 +1112,7 @@ for (x=0; x<image->width; x++)
printf("saving resultat...\n"); printf("saving resultat...\n");
Image_marque_1(troisieme, "Egalisations", 0); Image_marque_1(troisieme, "Egalisations", 0);
Image_TGA_save("Pictures/aaaa_egal.tga", troisieme, 0); Image_TGA_save("aaaa_egal.tga", troisieme, 0);
Image_DeAllocate(image); free(image); Image_DeAllocate(image); free(image);
Image_DeAllocate(deuxieme); free(deuxieme); Image_DeAllocate(deuxieme); free(deuxieme);
Image_DeAllocate(troisieme); free(troisieme); Image_DeAllocate(troisieme); free(troisieme);

View File

@ -68,7 +68,7 @@ int Test_des_pixeliz(char *srcname, int flags);
int Essai_des_bitblt(char *srcname, int k); int Essai_des_bitblt(char *srcname, int k);
int Essai_des_gadgrect(char *srcname, int k); int Essai_des_gadgrect(char *srcname, int k);
int Essai_Television(char *source, int k); int Essai_Televisions(char *source, int k);
/* dans essais2;c */ /* dans essais2;c */
int Essai_des_big_chars(char *fname, int k); int Essai_des_big_chars(char *fname, int k);

View File

@ -22,7 +22,9 @@ int foo;
fprintf(stderr, ">>> %s ( '%s' ) \n", __func__, filename); fprintf(stderr, ">>> %s ( '%s' ) \n", __func__, filename);
#if 0
foo = try_to_read_a_jpeg_file(filename, &destimg); foo = try_to_read_a_jpeg_file(filename, &destimg);
#endif
return FULL_NUCKED; return FULL_NUCKED;
} }
@ -30,7 +32,7 @@ return FULL_NUCKED;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
char *fichier; char *fichier;
int foo; int foo, idx;
printf("\n========== TestTga %s %s ==========\n", __DATE__, __TIME__); printf("\n========== TestTga %s %s ==========\n", __DATE__, __TIME__);
Image_print_version(2); Image_print_version(2);
@ -39,8 +41,7 @@ Image_print_version(2);
Image_print_sizeof_structs("tth was here"); Image_print_sizeof_structs("tth was here");
#endif #endif
if (argc != 2) if (argc != 2) {
{
printf("no args, using the testfile\n"); printf("no args, using the testfile\n");
fichier = "wou.tga"; fichier = "wou.tga";
} }
@ -52,11 +53,17 @@ else
Image_start_chrono("Essai", 0); Image_start_chrono("Essai", 0);
for (idx=0; idx<5; idx++) {
foo = Test_Egalisations(fichier, 0);
fprintf(stderr, " essai egalisation -> %d\n", foo);
foo = Essai_Televisions(fichier, 10);
fprintf(stderr, " essai televisions -> %d\n", foo);
}
#if 0
foo = test_du_jpeg_reader("in.jpeg"); foo = test_du_jpeg_reader("in.jpeg");
fprintf(stderr, " essai lecture jpeg -> %d\n", foo); fprintf(stderr, " essai lecture jpeg -> %d\n", foo);
#if 0
foo = Test_Dithering(fichier, 17); foo = Test_Dithering(fichier, 17);
fprintf(stderr, "essai dithering -> %d\n", foo); fprintf(stderr, "essai dithering -> %d\n", foo);
@ -74,6 +81,7 @@ Test_des_warpings(fichier, 17);
foo = Essai_des_Combines(fichier, 17); foo = Essai_des_Combines(fichier, 17);
fprintf(stderr, "essai combine -> %d\n", foo); fprintf(stderr, "essai combine -> %d\n", foo);
foo = Test_Dithering(fichier, 17); foo = Test_Dithering(fichier, 17);
Essai_des_Contrastes(fichier, 0); Essai_des_Contrastes(fichier, 0);