From 8bbe639ad516adecf5d3712c11ace337a1d6f213 Mon Sep 17 00:00:00 2001 From: tonton th Date: Wed, 24 Feb 2021 12:11:59 +0100 Subject: [PATCH] + auto shift to zero --- floatimg.h | 5 ++++- funcs/saturation.c | 27 ++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/floatimg.h b/floatimg.h index 826ae7d..0a69737 100644 --- a/floatimg.h +++ b/floatimg.h @@ -3,7 +3,7 @@ * ugly code from tTh */ -#define FIMG_VERSION 119 +#define FIMG_VERSION 120 /* * in memory descriptor @@ -128,7 +128,10 @@ int fimg_power_2(FloatImg *s, FloatImg *d, double maxval); int fimg_cos_01(FloatImg *s, FloatImg *d, double maxval); int fimg_cos_010(FloatImg *s, FloatImg *d, double maxval); int fimg_mix_rgb_gray(FloatImg *img, float mix); + +/* funcs/saturation.c */ int fimg_shift_to_zero(FloatImg *s, FloatImg *d, float coefs[6]); +int fimg_auto_shift_to_zero(FloatImg *s, FloatImg *d); /* --> funcs/plasmas.c */ int fimg_prototype_plasma(FloatImg *img, double time, int type); diff --git a/funcs/saturation.c b/funcs/saturation.c index 8c53b16..5254463 100644 --- a/funcs/saturation.c +++ b/funcs/saturation.c @@ -70,5 +70,30 @@ for (idx=0; idxtype) { + fprintf(stderr, "%s: bad image type %d\n", __func__, src->type); + return -6; + } + +foo = fimg_get_minmax_rgb(src, coefs); +if (foo) { + fprintf(stderr, "%s: err %d get minmax\n", __func__, foo); + return foo; + } + +foo = fimg_shift_to_zero(src, dst, coefs); +if (foo) { + fprintf(stderr, "%s WTF?\n", __func__); + return foo; + } + +return 0; +} +/* -------------------------------------------------------------- */ +