This commit is contained in:
tTh 2024-11-15 11:35:39 +01:00
parent 97ad716bd2
commit b3da0e6ec0
5 changed files with 22 additions and 18 deletions

2
Lib/.gitignore vendored
View File

@ -3,4 +3,4 @@
*.gif
cflow.txt
reduce.map

View File

@ -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; x<TAILLE; x++) {
@ -112,7 +114,7 @@ for (x=0; x<img->width; x++) {
}
}
#if DEBUG_LEVEL
fprintf(stderr, " Map4bits: compte maximum = %ld\n", maxi);
fprintf(stderr, "%s: compte maximum = %ld\n", __func__, maxi);
#endif
/*

View File

@ -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;

View File

@ -4,6 +4,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "../tthimage.h"

View File

@ -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,6 +68,8 @@ 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",
@ -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);