diff --git a/Fonderie/sfx.c b/Fonderie/sfx.c index 6cb0867..48025c7 100644 --- a/Fonderie/sfx.c +++ b/Fonderie/sfx.c @@ -21,6 +21,38 @@ */ extern int verbosity; +/* -------------------------------------------------------------- */ +/* + * nouveau Sun Jul 16 07:37:22 UTC 2023 + */ +int poke_sup_rb_g(FloatImg *src, FloatImg *dst) +{ +int idx, nbpix, foo; + +#if DEBUG_LEVEL +fprintf(stderr, ">>> %s ( %p %p )\n", __func__, src, dst); +#endif + +if ( (foo=fimg_images_not_compatible(src, dst)) ) + { + fprintf(stderr, "%s: no compat %d\n", __func__, foo); + return foo; + } + +nbpix = src->width * src->height; +fprintf(stderr, "%s work on %d pixels\n", __func__, nbpix); + +for (idx=0; idxR[idx] = src->R[idx]; + dst->B[idx] = src->B[idx]; + if (dst->R[idx] > dst->B[idx]) + dst->G[idx] = dst->R[idx]; + else + dst->G[idx] = dst->B[idx]; + } + +return 0; +} /* -------------------------------------------------------------- */ /* nouveau 14 mai 2022 rue Ernest Renan */ diff --git a/Fonderie/sfx.h b/Fonderie/sfx.h index 51d13f2..5378376 100644 --- a/Fonderie/sfx.h +++ b/Fonderie/sfx.h @@ -7,6 +7,7 @@ int graylevel2popcolors(FloatImg *src, FloatImg *dst, int k); int incrustation_vignette(FloatImg *src, FloatImg *dst, int k); +int poke_sup_rb_g(FloatImg *src, FloatImg *dst); int trinitron(FloatImg *pimg, int notused); diff --git a/Fonderie/t.c b/Fonderie/t.c index 275ca89..b845adb 100644 --- a/Fonderie/t.c +++ b/Fonderie/t.c @@ -40,7 +40,7 @@ double debut, fin; foo = fimg_create_from_dump(fIname, &image); if (foo) { - fprintf(stderr, "err %d create image\n", foo); + fprintf(stderr, "%s: err %d create from dump\n", __func__, foo); exit(1); } @@ -73,8 +73,6 @@ return 0; foo = essayer_single("capture/???42.fimg", "/tmp/x8/", STK); fprintf(stderr, "essayer single -> %d\n", foo); - - */ int essayer_single(char *globpattern, char *destdir, int chain) { @@ -161,14 +159,14 @@ puts("\t-s\tdo single test"); exit(0); } /* ----------------------------------------------------------- */ -int experiment(void) +int experiment(char *fname) { int foo; FloatImg image, dest; -fprintf(stderr, "--------- EXPERIMENT ------------\n"); +fprintf(stderr, "----- EXPERIMENT on '%s' -----\n", fname); -foo = fimg_create_from_dump("mire.fimg", &image); +foo = fimg_create_from_dump(fname, &image); if (foo) { fprintf(stderr, "%s: err %d on create_from_dump\n", __func__, foo); @@ -177,8 +175,8 @@ if (foo) { foo = fimg_clone(&image, &dest, 0); -foo = graylevel2popcolors(&image, &dest, 0); -fprintf(stderr, "POP COLOR- -> %d\n", foo); +foo = poke_sup_rb_g(&image, &dest); +fprintf(stderr, "poke sup rb g --> %d\n", foo); fimg_export_picture(&dest, "foo.png", 0); @@ -230,7 +228,7 @@ if (foo) { } if (do_xper) { - experiment(); + experiment(infile); return 0; } if (do_single) {