adding killrgb experiments

This commit is contained in:
tth 2021-10-10 09:46:27 +02:00
parent 23908cb746
commit 9124ab6434
5 changed files with 36 additions and 6 deletions

View File

@ -152,6 +152,25 @@ fimg_destroy(&img);
return retval; 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 * This is the main filter engine used both for input and
* output processing. It can be called by the filterstack * output processing. It can be called by the filterstack
@ -319,6 +338,10 @@ switch (idFx) {
retval = do_something(image, 3); retval = do_something(image, 3);
break; break;
case CR_killrgb0:
retval = run_killrgb_0(image, 0);
break;
case CR_hilightr: case CR_hilightr:
retval = fimg_highlight_color(image, image, 'R', 1.717); retval = fimg_highlight_color(image, image, 'R', 1.717);
break; break;
@ -358,7 +381,7 @@ void list_crapulors(char *texte)
int idx; int idx;
#define OUT stdout #define OUT stdout
fprintf(OUT, "______________. %s\n", texte); if (NULL!=texte) fprintf(OUT, "______________. %s\n", texte);
for (idx=0; CrapL[idx].id!=-1; idx++) { for (idx=0; CrapL[idx].id!=-1; idx++) {
fprintf(OUT, " %-12s | %4d | %5d | %8.3f\n", fprintf(OUT, " %-12s | %4d | %5d | %8.3f\n",
CrapL[idx].name, CrapL[idx].name,

View File

@ -33,6 +33,7 @@
32 vsglitch 1 1.0 32 vsglitch 1 1.0
33 crumphard 1 1.0 33 crumphard 1 1.0
42 nothing 42 3.1415926 42 nothing 42 3.1415926
43 killrgb0 1 9
45 hilightr 1 1.717 45 hilightr 1 1.717
99 message 1 1.0 99 message 1 1.0
-1 end 1 1.0 -1 end 1 1.0

View File

@ -4,7 +4,7 @@
* http://la.buvette.org/photos/cumul * http://la.buvette.org/photos/cumul
*/ */
#define FIMG_VERSION 154 #define FIMG_VERSION 155
/* /*
* in memory descriptor * in memory descriptor

View File

@ -37,6 +37,9 @@ tests.o: tests.c tests.h $(DEPS)
# ### # ###
killrgb.o: killrgb.c $(DEPS)
gcc $(COPT) -c $<
recurse.o: recurse.c $(DEPS) recurse.o: recurse.c $(DEPS)
gcc $(COPT) -c $< gcc $(COPT) -c $<

View File

@ -17,17 +17,20 @@
int fimg_killrgb_v(FloatImg *src, FloatImg *dst, int k) int fimg_killrgb_v(FloatImg *src, FloatImg *dst, int k)
{ {
int foo, line, col; int foo, line, col;
int ir, ig, ib; int ir;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__,
src, dst, k); src, dst, k);
#endif
fimg_clear(dst); fimg_clear(dst);
ir = ig = ib = 0; ir = 0;
for (line=0; line<src->height; line++) { for (line=0; line<src->height; line++) {
for (col=0; col<src->width; 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->R[ir ] = src->R[ir]; ir++;
dst->G[ir+1] = src->G[ir]; ir++; dst->G[ir+1] = src->G[ir]; ir++;