From 47de778e60d852b9333709212c8a0d3e765fa9b1 Mon Sep 17 00:00:00 2001 From: tth Date: Fri, 7 Aug 2020 06:46:41 +0200 Subject: [PATCH] sorry again... --- funcs/saturation.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/funcs/saturation.c b/funcs/saturation.c index bb7f007..8c53b16 100644 --- a/funcs/saturation.c +++ b/funcs/saturation.c @@ -1,5 +1,5 @@ /* - * FloatImg library from tTh + * FloatImg library from tTh - ugly code inside */ #include @@ -12,7 +12,10 @@ extern int verbosity; /* -------------------------------------------------------------- */ - +/* + * parameter mix is between 0.0 and 1.0 but other + * values give sometime good vibrations. + */ int fimg_mix_rgb_gray(FloatImg *img, float mix) { int x, y, p; @@ -24,7 +27,8 @@ if (FIMG_TYPE_RGB != img->type) { } for (y=0; yheight; y++) { - p = y * img->width; + p = y * img->width; /* first pixel of the row */ + for (x=0; xwidth; x++) { gr = (img->R[p] + img->G[p] + img->R[p]) / 3.0; @@ -42,17 +46,21 @@ return 0; } /* -------------------------------------------------------------- */ +/* + * The third parameter was a six value array with min and max + * values maybe computed by the 'fimg_get_minmax_rgb' function. + */ int fimg_shift_to_zero(FloatImg *s, FloatImg *d, float coefs[6]) { int sz, idx; -sz = s->width * s->height; - if (FIMG_TYPE_RGB != s->type) { fprintf(stderr, "%s bad type\n", __func__); return -6; } +sz = s->width * s->height; + for (idx=0; idxR[idx] = s->R[idx] - coefs[0]; d->G[idx] = s->G[idx] - coefs[2];