From 9124ab6434110b11e021bd9b4d07ecfdab6b9f6e Mon Sep 17 00:00:00 2001 From: tth Date: Sun, 10 Oct 2021 09:46:27 +0200 Subject: [PATCH] adding killrgb experiments --- Fonderie/crapulator.c | 25 ++++++++++++++++++++++++- Fonderie/crapulors.liste | 1 + floatimg.h | 2 +- funcs/Makefile | 3 +++ funcs/killrgb.c | 11 +++++++---- 5 files changed, 36 insertions(+), 6 deletions(-) diff --git a/Fonderie/crapulator.c b/Fonderie/crapulator.c index 110ff957..c59519e0 100644 --- a/Fonderie/crapulator.c +++ b/Fonderie/crapulator.c @@ -152,6 +152,25 @@ fimg_destroy(&img); return retval; } /* -------------------------------------------------------------- */ +int run_killrgb_0(FloatImg *img, int k) +{ +FloatImg tmp; +int ret; + +// fprintf(stderr, "----> %s\n", __func__); + +memset(&tmp, 0, sizeof(FloatImg)); + +fimg_clone(img, &tmp, 0); +ret = fimg_killrgb_v(img, &tmp, k); +fimg_copy_data(&tmp, img); +fimg_destroy(&tmp); + +// fprintf(stderr, "%s ---->\n", __func__); + +return ret; +} +/* -------------------------------------------------------------- */ /* * This is the main filter engine used both for input and * output processing. It can be called by the filterstack @@ -319,6 +338,10 @@ switch (idFx) { retval = do_something(image, 3); break; + case CR_killrgb0: + retval = run_killrgb_0(image, 0); + break; + case CR_hilightr: retval = fimg_highlight_color(image, image, 'R', 1.717); break; @@ -358,7 +381,7 @@ void list_crapulors(char *texte) int idx; #define OUT stdout -fprintf(OUT, "______________. %s\n", texte); +if (NULL!=texte) fprintf(OUT, "______________. %s\n", texte); for (idx=0; CrapL[idx].id!=-1; idx++) { fprintf(OUT, " %-12s | %4d | %5d | %8.3f\n", CrapL[idx].name, diff --git a/Fonderie/crapulors.liste b/Fonderie/crapulors.liste index a66d743b..28ae509d 100644 --- a/Fonderie/crapulors.liste +++ b/Fonderie/crapulors.liste @@ -33,6 +33,7 @@ 32 vsglitch 1 1.0 33 crumphard 1 1.0 42 nothing 42 3.1415926 +43 killrgb0 1 9 45 hilightr 1 1.717 99 message 1 1.0 -1 end 1 1.0 diff --git a/floatimg.h b/floatimg.h index b8635362..2521ec29 100644 --- a/floatimg.h +++ b/floatimg.h @@ -4,7 +4,7 @@ * http://la.buvette.org/photos/cumul */ -#define FIMG_VERSION 154 +#define FIMG_VERSION 155 /* * in memory descriptor diff --git a/funcs/Makefile b/funcs/Makefile index 09e44b94..22528142 100644 --- a/funcs/Makefile +++ b/funcs/Makefile @@ -37,6 +37,9 @@ tests.o: tests.c tests.h $(DEPS) # ### +killrgb.o: killrgb.c $(DEPS) + gcc $(COPT) -c $< + recurse.o: recurse.c $(DEPS) gcc $(COPT) -c $< diff --git a/funcs/killrgb.c b/funcs/killrgb.c index 2c8e1bf8..f61c2854 100644 --- a/funcs/killrgb.c +++ b/funcs/killrgb.c @@ -17,17 +17,20 @@ int fimg_killrgb_v(FloatImg *src, FloatImg *dst, int k) { int foo, line, col; -int ir, ig, ib; +int ir; +#if DEBUG_LEVEL fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, - src, dst, k); + src, dst, k); +#endif fimg_clear(dst); -ir = ig = ib = 0; +ir = 0; for (line=0; lineheight; line++) { - for (col=0; colwidth; col+=3) { + // fprintf(stderr, "%s line %d\n", __func__, line); + for (col=0; col<(src->width-3); col+=3) { dst->R[ir ] = src->R[ir]; ir++; dst->G[ir+1] = src->G[ir]; ir++;