From b3da0e6ec0b662ad30254136b78be7f02612ecaf Mon Sep 17 00:00:00 2001 From: tTh Date: Fri, 15 Nov 2024 11:35:39 +0100 Subject: [PATCH] cosmetic --- Lib/.gitignore | 2 +- Lib/col4bits.c | 24 +++++++++++++----------- Lib/col_reduc.c | 5 +++-- Lib/recurse.c | 1 + Lib/testtga.c | 8 ++++---- 5 files changed, 22 insertions(+), 18 deletions(-) diff --git a/Lib/.gitignore b/Lib/.gitignore index ef7863c..9f6fc58 100644 --- a/Lib/.gitignore +++ b/Lib/.gitignore @@ -3,4 +3,4 @@ *.gif cflow.txt - +reduce.map diff --git a/Lib/col4bits.c b/Lib/col4bits.c index d180116..2eea43e 100644 --- a/Lib/col4bits.c +++ b/Lib/col4bits.c @@ -51,13 +51,13 @@ static int compare_teinte(struct elem *p1, struct elem *p2) { int r1, g1, b1, r2, b2, g2; -r1 = (( (p1->rgb) >>8)&0xf)<<4; -g1 = (( (p1->rgb) >>4)&0xf)<<4; -b1 = ( (p1->rgb) &0xf)<<4; +r1 = (( (p1->rgb) >>8)&0xf) <<4; +g1 = (( (p1->rgb) >>4)&0xf) <<4; +b1 = ( (p1->rgb) &0xf) <<4; -r2 = (( (p2->rgb) >>8)&0xf)<<4; -g2 = (( (p2->rgb) >>4)&0xf)<<4; -b2 = ( (p2->rgb) &0xf)<<4; +r2 = (( (p2->rgb) >>8)&0xf) <<4; +g2 = (( (p2->rgb) >>4)&0xf) <<4; +b2 = ( (p2->rgb) &0xf) <<4; /* printf("%8d %8d\n", p1->compte, p2->compte); return (p1->rgb - p2->rgb); */ @@ -66,7 +66,9 @@ return ( (r1+g1+b1) - (r2+g2+b2) ); } /*::------------------------------------------------------------------::*/ - +/* + * XXX please explain parameters usage ! + */ #define TAILLE (1<<12) int Image_calc_Map_4bits(Image_Desc *img, RGB_map *map, int nbre) { @@ -80,13 +82,13 @@ fprintf(stderr, " Calc map 4 bits: nbre = %d\n", nbre); #endif if ( (nbre<1) || (nbre>255) ) { - fprintf(stderr, "Calc map 4 bits: nbre %d out of range\n", nbre); + fprintf(stderr, "%s: nbre %d out of range\n", __func__, nbre); return BAD_COLOR_NUMBER; } surface = img->width * img->height; #if DEBUG_LEVEL -fprintf(stderr, " calc Map 4 bits: surface de l'image = %ld pixels\n", surface); +fprintf(stderr, "%s: surface de l'image = %ld pixels\n", __func__, surface); #endif for (x=0; xwidth; x++) { } } #if DEBUG_LEVEL -fprintf(stderr, " Map4bits: compte maximum = %ld\n", maxi); +fprintf(stderr, "%s: compte maximum = %ld\n", __func__, maxi); #endif /* @@ -123,7 +125,7 @@ qsort(elems, TAILLE, sizeof(struct elem), compare_compteur); /* * trier la palette, certe, mais dans quel ordre ? - * 28 Jan 2002: why ? + * 28 Jan 2002: why ? */ qsort(elems, nbre, sizeof(struct elem), compare_teinte); diff --git a/Lib/col_reduc.c b/Lib/col_reduc.c index 2b69589..e2f658a 100644 --- a/Lib/col_reduc.c +++ b/Lib/col_reduc.c @@ -8,6 +8,8 @@ #include "../tthimage.h" +#define DEBUG_LEVEL 1 + /*::------------------------------------------------------------------::*/ /* * ATTENTION: cette fonction sert à faire des essais, et ne doit @@ -16,8 +18,7 @@ * * n is the number of wanted colors */ -int -Image_essai_col_reduce(Image_Desc *src, Image_Desc *dst, int n, int t) +int Image_essai_col_reduce(Image_Desc *src, Image_Desc *dst, int n, int t) { RGB_map map; int foo; diff --git a/Lib/recurse.c b/Lib/recurse.c index 4159eba..bdc905f 100644 --- a/Lib/recurse.c +++ b/Lib/recurse.c @@ -4,6 +4,7 @@ */ #include +#include #include #include "../tthimage.h" diff --git a/Lib/testtga.c b/Lib/testtga.c index b534146..28fe0f8 100644 --- a/Lib/testtga.c +++ b/Lib/testtga.c @@ -53,7 +53,7 @@ else Image_start_chrono("Essai", 0); -for (idx=0; idx<3; idx++) { +for (idx=0; idx<10; idx++) { foo = Test_Egalisations(fichier, 0); fprintf(stderr, " essai egalisation -> %d\n", foo); foo = Essai_Televisions(fichier, 10); @@ -68,7 +68,9 @@ for (idx=0; idx<3; idx++) { fprintf(stderr, " essai classif -> %d\n", foo); foo = Test_des_warpings(fichier, 0); fprintf(stderr, " essai warping -> %d\n", foo); - + foo = Essai_color_2_map(fichier, idx); + fprintf(stderr, " essai col2map -> %d\n", foo); + fprintf(stderr, "\n*************** %s: fin passe %d ******\n\n", argv[0], idx); @@ -76,8 +78,6 @@ for (idx=0; idx<3; idx++) { #if 0 -foo = Essai_color_2_map(fichier, idx); -fprintf(stderr, " essai col2map -> %d\n", foo); foo = test_du_jpeg_reader("in.jpeg"); fprintf(stderr, " essai lecture jpeg -> %d\n", foo);