working on big test proggy
This commit is contained in:
parent
e2b830b537
commit
ce04418ef1
@ -8,7 +8,7 @@ include ../Paramakes.mk
|
||||
|
||||
DEPS = ../tthimage.h ../Paramakes.mk Makefile
|
||||
|
||||
all: foo testtga
|
||||
all: foo testtga t_png testbmp
|
||||
|
||||
#-----------------------------------------------------------------
|
||||
|
||||
@ -178,6 +178,7 @@ OBJECTS = 7seg.o \
|
||||
warp0.o warp1.o warp2.o \
|
||||
zoom.o
|
||||
|
||||
# build the static library
|
||||
../libtthimage.a: $(OBJECTS)
|
||||
$(AR) rs $@ $?
|
||||
$(RANLIB) $@
|
||||
|
96
Lib/essais.c
96
Lib/essais.c
@ -834,23 +834,29 @@ return 42;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/* new 24 avril 2007, essais sur le module rgbmask.c */
|
||||
int
|
||||
Test_rgbmask(char *srcname)
|
||||
int Test_RGBmask(char *srcname)
|
||||
{
|
||||
Image_Desc *source, *image ;
|
||||
int foo;
|
||||
|
||||
fprintf(stderr, "=============== %s on %s ==============\n", __func__, srcname);
|
||||
|
||||
|
||||
source = Image_TGA_alloc_load(srcname);
|
||||
image = Image_clone(source, 0);
|
||||
|
||||
foo = Image_rgbmask_H(source, image, 0);
|
||||
Image_TGA_save("Pictures/aaaa-rgbmaskH.tga", image, 0);
|
||||
Image_TGA_save("aaaa-rgbmaskH.tga", image, 0);
|
||||
foo = Image_rgbmask_V(source, image, 0);
|
||||
Image_TGA_save("Pictures/aaaa-rgbmaskV.tga", image, 0);
|
||||
Image_TGA_save("aaaa-rgbmaskV.tga", image, 0);
|
||||
foo = Image_rgbmask_2(source, image, 0);
|
||||
Image_TGA_save("Pictures/aaaa-rgbmask2.tga", image, 0);
|
||||
Image_TGA_save("aaaa-rgbmask2.tga", image, 0);
|
||||
foo = Image_rgbmask_R(source, image, 0);
|
||||
Image_TGA_save("Pictures/aaaa-rgbmaskR.tga", image, 0);
|
||||
Image_TGA_save("aaaa-rgbmaskR.tga", image, 0);
|
||||
|
||||
Image_DeAllocate(source); free(source);
|
||||
Image_DeAllocate(image); free(image);
|
||||
|
||||
|
||||
return 42;
|
||||
}
|
||||
@ -1057,6 +1063,9 @@ int Essai_Televisions(char *nomsource, int k)
|
||||
Image_Desc *image, *resultat;
|
||||
int foo;
|
||||
|
||||
fprintf(stderr, "================ Televisions %s %d ========\n", nomsource, k);
|
||||
|
||||
|
||||
image = Image_TGA_alloc_load(nomsource);
|
||||
printf("%s : image loaded %p\n", __func__, image);
|
||||
resultat = Image_clone(image, 0);
|
||||
@ -1066,10 +1075,15 @@ 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);
|
||||
foo = Image_TV_pix_0(image, resultat, 7, 7, 0);
|
||||
printf("\tTV pix 0 -> %d\n", foo);
|
||||
Image_TGA_save("aaaa_tv_pix_0.tga", resultat, 0);
|
||||
|
||||
foo = Image_TV_cplus_v1(image, resultat, 7);
|
||||
printf("\tTV cplus v1 -> %d\n", foo);
|
||||
Image_TGA_save("aaaa_tv_cplusV1.tga", resultat, 0);
|
||||
|
||||
|
||||
Image_DeAllocate(image); free(image);
|
||||
Image_DeAllocate(resultat); free(resultat);
|
||||
|
||||
@ -1081,7 +1095,7 @@ int Test_Egalisations(char *nomsource, int k)
|
||||
Image_Desc *image, *deuxieme, *troisieme;
|
||||
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);
|
||||
printf("image loaded %p\n", image);
|
||||
@ -1096,14 +1110,16 @@ Image_egalise_RGB(image, troisieme, 0);
|
||||
|
||||
for (x=0; x<image->width; x++) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
else
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG_LEVEL > 2
|
||||
printf("%4d\r", x); fflush(stdout);
|
||||
@ -1120,30 +1136,30 @@ Image_DeAllocate(troisieme); free(troisieme);
|
||||
return 42;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int
|
||||
Test_Dithering(char *nomsource, int k)
|
||||
int Test_Dithering(char *nomsource, int k)
|
||||
{
|
||||
Image_Desc *source, *image, *deuxieme, *finale;
|
||||
Image_Rect rect;
|
||||
int foo;
|
||||
int foo, wf, hf;
|
||||
int x2, y2;
|
||||
RGBA ink, pap;
|
||||
|
||||
fprintf(stderr, "========== Dithering on %s (%d) =======\n", nomsource, k);
|
||||
fprintf(stderr, "============== Dithering on %s (%d) =======\n", nomsource, k);
|
||||
|
||||
source = Image_TGA_alloc_load(nomsource);
|
||||
if (NULL == source)
|
||||
{
|
||||
if (NULL == source) {
|
||||
fprintf(stderr, "%s:%s err load %s\n", __FILE__, __func__, nomsource);
|
||||
exit(5);
|
||||
}
|
||||
#if DEBUG_LEVEL
|
||||
Image_dump_descriptor(source, "just after load");
|
||||
#endif
|
||||
|
||||
/*
|
||||
* est-ce bien necessaire ?
|
||||
*/
|
||||
/* Image_egalise_RGB(source, source, 0); */
|
||||
|
||||
wf = source->width; hf = (source->height) * 4;
|
||||
x2 = source->width / 2; y2 = source->height / 2;
|
||||
rect.w = x2; rect.h = y2;
|
||||
rect.x = 0; rect.y = 0;
|
||||
@ -1151,24 +1167,22 @@ rect.x = 0; rect.y = 0;
|
||||
ink.r = 255, ink.g = 255, ink.b = 100; ink.a = 255;
|
||||
pap.r = 30, pap.g = 30, pap.b = 155; pap.a = 255;
|
||||
|
||||
finale = Image_alloc(source->width, (source->height)*3, 3);
|
||||
if (NULL == finale)
|
||||
{
|
||||
finale = Image_alloc(wf, hf, 3);
|
||||
if (NULL == finale) {
|
||||
fprintf(stderr, "%s:%s:%d err alloc image\n",
|
||||
__FILE__, __func__, __LINE__);
|
||||
exit(5);
|
||||
}
|
||||
printf("image finale allocated %p\n", finale);
|
||||
Image_clear(finale, 0, 200, 0);
|
||||
printf("image finale %dx%d allocated at %p\n", wf, hf, finale);
|
||||
|
||||
image = Image_MakeHalfSize(source, 0);
|
||||
if (NULL == image)
|
||||
{
|
||||
if (NULL == image) {
|
||||
fprintf(stderr, "%s:%s:%d err halfsize image\n",
|
||||
__FILE__, __func__, __LINE__);
|
||||
exit(5);
|
||||
}
|
||||
|
||||
printf("image Half -> %p\n", image);
|
||||
printf("%s: image Half at %p\n", __func__, image);
|
||||
|
||||
Image_DeAllocate(source); free(source);
|
||||
Image_copy_rect(image, &rect, finale, 0, 0);
|
||||
@ -1214,17 +1228,20 @@ Image_txt1_box_0(finale, "3x3 2", x2, y2*3, 4, &pap, &ink, 0);
|
||||
foo = Image_dither_bayer8x8rnd(image, deuxieme, 5000, 0);
|
||||
printf("retour Dither bayer8x8rnd = %d\n", foo);
|
||||
Image_copy_rect(deuxieme, &rect, finale, x2, y2*4);
|
||||
Image_txt1_box_0(finale, "bayer 8x8 rnd rgb", x2, y2*4, 4, &pap, &ink, 0);
|
||||
Image_txt1_box_0(finale, "bayer8xrnd rgb", x2, y2*4, 4, &pap, &ink, 0);
|
||||
|
||||
foo = Image_dither_bayer8x8rnd(image, deuxieme, 5000, 1);
|
||||
printf("retour Dither bayer8x8rnd = %d\n", foo);
|
||||
Image_copy_rect(deuxieme, &rect, finale, 0, y2*4);
|
||||
Image_txt1_box_0(finale, "bayer8x8rndgrey", 0, y2*4, 4, &pap, &ink, 0);
|
||||
|
||||
Image_TGA_save("Pictures/aaaa_dithering.tga", finale, 0);
|
||||
printf("++++++ test dither\n");
|
||||
Image_dump_descriptor(finale, "just before save");
|
||||
Image_TGA_save("aaaa_dithering.tga", finale, 0);
|
||||
Image_DeAllocate(image); free(image);
|
||||
Image_DeAllocate(deuxieme); free(deuxieme);
|
||||
Image_DeAllocate(finale); free(finale);
|
||||
printf("++++++ fin essais dither\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1243,8 +1260,7 @@ return -1;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/* new 21 juillet 2007 - ave St Exupery */
|
||||
int
|
||||
Test_Effects_A(char *nomsource, int flag)
|
||||
int Test_Effects_A(char *nomsource, int flag)
|
||||
{
|
||||
Image_Desc *source, *image, *deuxieme, *finale;
|
||||
int foo;
|
||||
@ -1253,8 +1269,7 @@ RGBA ink, pap;
|
||||
|
||||
printf("=== %s %s === %s === %d ===\n", __FILE__, __func__, nomsource, flag);
|
||||
|
||||
if (flag)
|
||||
{
|
||||
if (flag) {
|
||||
fprintf(stderr, "%s: flag is %d ?\n", __func__, flag);
|
||||
}
|
||||
|
||||
@ -1262,8 +1277,7 @@ ink.r = 255, ink.g = 255, ink.b = 100; ink.a = 255;
|
||||
pap.r = 30, pap.g = 30, pap.b = 155; pap.a = 255;
|
||||
|
||||
source = Image_TGA_alloc_load(nomsource);
|
||||
if (NULL==source)
|
||||
{
|
||||
if (NULL==source) {
|
||||
fprintf(stderr, "%s : il manque '%s'\n", __func__, nomsource);
|
||||
exit(1);
|
||||
}
|
||||
@ -1363,30 +1377,28 @@ int Test_des_filtres(char *srcname, int k)
|
||||
Image_Desc *src, *dst;
|
||||
int foo;
|
||||
|
||||
printf("======= LES FILTRES ===[ %s ]==[ %d ]====\n", srcname, k);
|
||||
printf("=============== LES FILTRES =====[ %s ]====[ %d ]====\n", srcname, k);
|
||||
|
||||
src = Image_TGA_alloc_load(srcname);
|
||||
if (NULL == src)
|
||||
{
|
||||
if (NULL == src) {
|
||||
fprintf(stderr, "%s can't load %s\n", __func__, srcname);
|
||||
return 666;
|
||||
}
|
||||
dst = Image_clone(src, 1);
|
||||
if (NULL == dst)
|
||||
{
|
||||
if (NULL == dst) {
|
||||
fprintf(stderr, "mem failure in %s\n", __func__);
|
||||
abort();
|
||||
}
|
||||
|
||||
foo = Image_lissage_3x3(src, dst);
|
||||
Image_TGA_save("Pictures/filtre-liss3x3.tga", dst, 0);
|
||||
Image_TGA_save("filtre-liss3x3.tga", dst, 0);
|
||||
if (foo) { fprintf(stderr, "%s: liss3x3 -> %d\n", __func__, foo); }
|
||||
foo = Image_filtre_Prewitt(src, dst, 5);
|
||||
Image_TGA_save("Pictures/filtre-prewitt-5.tga", dst, 0);
|
||||
Image_TGA_save("filtre-prewitt-5.tga", dst, 0);
|
||||
foo = Image_filtre_passe_haut(src, dst);
|
||||
Image_TGA_save("Pictures/filtre-passe-haut.tga", dst, 0);
|
||||
Image_TGA_save("filtre-passe-haut.tga", dst, 0);
|
||||
foo = Image_filtre_Sobel_4(src, dst, 0);
|
||||
Image_TGA_save("Pictures/filtre-sobel-4.tga", dst, 0);
|
||||
Image_TGA_save("filtre-sobel-4.tga", dst, 0);
|
||||
|
||||
Image_DeAllocate(src); free(src);
|
||||
Image_DeAllocate(dst); free(dst);
|
||||
|
@ -44,7 +44,7 @@ int Test_des_df3(char *txt, int k);
|
||||
int Test_vignettes(char *srcname, int k);
|
||||
|
||||
int Test_classif(char *srcname, int k);
|
||||
int Test_rgbmask(char *srcname);
|
||||
int Test_RGBmask(char *srcname);
|
||||
void Test_rgb2xyz(void);
|
||||
|
||||
int Essai_des_marquages(char *srcname, int nombre, char *texte);
|
||||
|
@ -127,9 +127,9 @@ fprintf(stderr, "%s : offsets = %d & %d\n", __func__, ox, oy);
|
||||
#endif
|
||||
Image_clear(dst, grey, grey, grey);
|
||||
|
||||
for (x=ox; x<xmax-ox; x+=w) {
|
||||
for (x=ox; x<(xmax-ox); x+=w) {
|
||||
zone.x = x + (w/2);
|
||||
for (y=oy; y<ymax-oy; y+=h) {
|
||||
for (y=oy; y<(ymax-oy); y+=h) {
|
||||
zone.y = y + (h/2);
|
||||
r = src->Rpix[y][x] & 0xfe;
|
||||
g = src->Gpix[y][x] & 0xfe;
|
||||
|
@ -53,11 +53,19 @@ else
|
||||
|
||||
Image_start_chrono("Essai", 0);
|
||||
|
||||
for (idx=0; idx<5; idx++) {
|
||||
for (idx=0; idx<1; 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);
|
||||
foo = Test_Dithering(fichier, 0);
|
||||
fprintf(stderr, " essai dithering -> %d\n", foo);
|
||||
foo = Test_des_filtres(fichier, 0);
|
||||
fprintf(stderr, " essai filtres -> %d\n", foo);
|
||||
foo = Test_RGBmask(fichier);
|
||||
fprintf(stderr, " essai rgb mask -> %d\n", foo);
|
||||
|
||||
fprintf(stderr, "********* %s: fin passe %d\n", argv[0], idx);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
Loading…
Reference in New Issue
Block a user