From 41e77a518597fb5a226ded942d50d72dd48abffd Mon Sep 17 00:00:00 2001 From: tth Date: Mon, 17 May 2021 22:38:56 +0200 Subject: [PATCH] Zzzzz.... --- Fonderie/crapulors.liste | 1 + Fonderie/single.c | 5 +++-- floatimg.h | 8 +++++--- funcs/Makefile | 5 ++++- funcs/equalize.c | 1 + funcs/plasmas.c | 1 + funcs/rampes.c | 1 + funcs/recurse.c | 3 +++ funcs/rotate.c | 1 + funcs/saturation.c | 3 ++- funcs/sfx0.c | 1 + funcs/sfx1.c | 1 + funcs/sfx2.c | 1 + funcs/sfx4.c | 42 ++++++++++++++++++++++++++++++++++++++++ funcs/utils.c | 1 + lib/contrast.c | 15 +++++++------- tools/fimgfx.c | 19 +++++++++++++----- 17 files changed, 90 insertions(+), 19 deletions(-) create mode 100644 funcs/sfx4.c diff --git a/Fonderie/crapulors.liste b/Fonderie/crapulors.liste index 3973cd3..496b847 100644 --- a/Fonderie/crapulors.liste +++ b/Fonderie/crapulors.liste @@ -27,6 +27,7 @@ 26 rndblks 1 1.0 27 shiftln0 1 1.0 28 qsortrgb 2 1.0 +29 triplemul 3 1.0 30 multidots 100 1.333 31 diagonal 1 1.0 32 vsglitch 1 1.0 diff --git a/Fonderie/single.c b/Fonderie/single.c index 0e7696a..e019416 100644 --- a/Fonderie/single.c +++ b/Fonderie/single.c @@ -1,5 +1,6 @@ /* - SINGLE + SINGLE PICZ PROCESSOR + experimental and/or testing code, do not use in production. @@ -8,6 +9,7 @@ #include #include #include +#include #include "../floatimg.h" @@ -98,7 +100,6 @@ fprintf(stderr, "%s : %s\n", __FILE__, title); fprintf(stderr, " nextpng %d\n", nextpng); fprintf(stderr, " counter %d\n", counter); fprintf(stderr, " chainfilter %d\n", chainfilter); - fprintf(stderr, " destination %s\n", destination); if (k) { diff --git a/floatimg.h b/floatimg.h index de54235..b50f8be 100644 --- a/floatimg.h +++ b/floatimg.h @@ -4,7 +4,7 @@ * http://la.buvette.org/photos/cumul */ -#define FIMG_VERSION 148 +#define FIMG_VERSION 150 /* * in memory descriptor @@ -26,7 +26,7 @@ typedef struct { */ typedef struct { char magic[8]; - int w, h, t; + int32_t w, h, t; } FimgFileHead; #define MAGIC_AREA51 0xA5EA0051 @@ -95,7 +95,6 @@ int fimg_mul_3(FloatImg *a, FloatImg *b, FloatImg *d); int fimg_minimum(FloatImg *a, FloatImg *b, FloatImg *d); int fimg_maximum(FloatImg *a, FloatImg *b, FloatImg *d); - /* funcs/filtrage.c */ typedef struct { @@ -124,6 +123,9 @@ int fimg_highlight_color(FloatImg *src, FloatImg *dst, int fimg_binarize(FloatImg *pimg, int notused); int fimg_trinarize(FloatImg *pimg, int notused); +/* module sfx4.c */ +int fimg_sfx_triplemul(FloatImg *s, FloatImg *d, int notused); + /* funcs/rotate.c module */ /* #coronamaison */ int fimg_rotate_90(FloatImg *src, FloatImg *dst, int notused); diff --git a/funcs/Makefile b/funcs/Makefile index 1b27ebb..5e2b2dd 100644 --- a/funcs/Makefile +++ b/funcs/Makefile @@ -7,7 +7,7 @@ COPT = -Wall -fpic -g -no-pie -DDEBUG_LEVEL=0 DEPS = ../floatimg.h Makefile OBJS = fimg-png.o fimg-tiff.o misc-plots.o filtrage.o utils.o \ - fimg-libpnm.o rampes.o sfx0.o sfx1.o sfx2.o \ + fimg-libpnm.o rampes.o sfx0.o sfx1.o sfx2.o sfx4.o \ geometry.o rotate.o fimg-openexr.o \ equalize.o fimg-fits.o saturation.o histogram.o \ hsv.o classif.o contour2x2.o qsortrgb.o exporter.o \ @@ -99,6 +99,9 @@ sfx1.o: sfx1.c $(DEPS) sfx2.o: sfx2.c $(DEPS) gcc $(COPT) -c $< +sfx4.o: sfx4.c $(DEPS) + gcc $(COPT) -c $< + contour2x2.o: contour2x2.c $(DEPS) gcc $(COPT) -c $< diff --git a/funcs/equalize.c b/funcs/equalize.c index 264856a..d95afa1 100644 --- a/funcs/equalize.c +++ b/funcs/equalize.c @@ -6,6 +6,7 @@ #include #include +#include #include "../floatimg.h" diff --git a/funcs/plasmas.c b/funcs/plasmas.c index ba4d97a..6c9aed1 100644 --- a/funcs/plasmas.c +++ b/funcs/plasmas.c @@ -7,6 +7,7 @@ #include #include +#include #include "../floatimg.h" diff --git a/funcs/rampes.c b/funcs/rampes.c index d207972..42f196e 100644 --- a/funcs/rampes.c +++ b/funcs/rampes.c @@ -4,6 +4,7 @@ */ #include +#include #include "../floatimg.h" diff --git a/funcs/recurse.c b/funcs/recurse.c index 6b17cf1..f0ee498 100644 --- a/funcs/recurse.c +++ b/funcs/recurse.c @@ -5,6 +5,7 @@ #include #include +#include #include "../floatimg.h" @@ -20,6 +21,8 @@ int fimg_recursion_proto(FloatImg *src, FloatImg *dst, int notused) fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, src, dst, notused); #endif +fprintf(stderr, "!!!!!! %s is a wip !!!!!\n", __func__); + return -1; } /* -------------------------------------------------------------------- */ diff --git a/funcs/rotate.c b/funcs/rotate.c index 77b4816..2ca1477 100644 --- a/funcs/rotate.c +++ b/funcs/rotate.c @@ -6,6 +6,7 @@ #include #include +#include #include "../floatimg.h" diff --git a/funcs/saturation.c b/funcs/saturation.c index 4aac814..8cd9d5c 100644 --- a/funcs/saturation.c +++ b/funcs/saturation.c @@ -3,6 +3,7 @@ */ #include +#include #include "../floatimg.h" @@ -99,7 +100,7 @@ coefs[0] = coefs[2] = coefs[4] = minima; foo = fimg_shift_to_zero(src, dst, coefs); if (foo) { - fprintf(stderr, "%s WTF?\n", __func__); + fprintf(stderr, "%s WTF? %d\n", __func__, foo); return foo; } diff --git a/funcs/sfx0.c b/funcs/sfx0.c index 7c46bd0..1de4c65 100644 --- a/funcs/sfx0.c +++ b/funcs/sfx0.c @@ -5,6 +5,7 @@ #include #include +#include #include "../floatimg.h" diff --git a/funcs/sfx1.c b/funcs/sfx1.c index c474123..1430668 100644 --- a/funcs/sfx1.c +++ b/funcs/sfx1.c @@ -6,6 +6,7 @@ #include #include +#include #include "../floatimg.h" diff --git a/funcs/sfx2.c b/funcs/sfx2.c index b05e2aa..3ca589c 100644 --- a/funcs/sfx2.c +++ b/funcs/sfx2.c @@ -5,6 +5,7 @@ #include #include +#include #include "../floatimg.h" diff --git a/funcs/sfx4.c b/funcs/sfx4.c new file mode 100644 index 0000000..13dbfd4 --- /dev/null +++ b/funcs/sfx4.c @@ -0,0 +1,42 @@ +/* + * FLOATIMG - a kluge from tTh + * --------------------------- + * + * some strange effects on floating pictures. + */ + + +#include +#include +#include + +#include "../floatimg.h" + +extern int verbosity; + +/* -------------------------------------------------------------- */ +int fimg_sfx_triplemul(FloatImg *src, FloatImg *dst, int notused) +{ +int x, y, foo; +float in[3], out[3]; + +#if DEBUG_LEVEL +fprintf(stderr, ">>> %s ( %p 0x%04x )\n", __func__, img, notused); +#endif + +for (y=0; yheight; y++) { + for (x=0; xwidth; x++) { + foo = fimg_get_rgb(src, x, y, in); + out[0] = in[1] * in[2]; + out[1] = in[0] * in[2]; + out[2] = in[0] * in[1]; + // fprintf(stderr, "%9f %9f %9f\n", out[0], out[1], out[2]); + foo = fimg_put_rgb(dst, x, y, out); + } + } + +return 0; +} +/* -------------------------------------------------------------- */ + +/* -------------------------------------------------------------- */ diff --git a/funcs/utils.c b/funcs/utils.c index cc8443f..2e3c945 100644 --- a/funcs/utils.c +++ b/funcs/utils.c @@ -4,6 +4,7 @@ #include #include +#include #include "../floatimg.h" diff --git a/lib/contrast.c b/lib/contrast.c index 7bc4644..be29806 100644 --- a/lib/contrast.c +++ b/lib/contrast.c @@ -1,5 +1,9 @@ /* * contrast.c - part of libfloatimg + * -------------------------------- + * + * you can see some use in 'tools/fimgfx.c', so you can thing + * about the 'maxval' parameter. C'est touchy :) */ #include @@ -34,7 +38,7 @@ int nbre, idx; double dval; if (s->type != FIMG_TYPE_RGB) { - fprintf(stderr, "%s : type %d invalide\n", + fprintf(stderr, "%s: type %d invalide\n", __func__, s->type); return -4; } @@ -42,13 +46,12 @@ if (s->type != FIMG_TYPE_RGB) { if (NULL==d) { d = s; } else { if (d->type != FIMG_TYPE_RGB) { - fprintf(stderr, "%s : dst type %d invalide\n", + fprintf(stderr, "%s: dst type %d invalide\n", __func__, d->type); return -4; } } - nbre = s->width * s->height; for (idx=0; idxwidth * s->height; for (idx=0; idxtype != FIMG_TYPE_RGB) { - fprintf(stderr, "%s : type %d invalide\n", + fprintf(stderr, "%s: type %d invalide\n", __func__, s->type); return -4; } @@ -118,7 +119,7 @@ if (s->type != FIMG_TYPE_RGB) { if (NULL==d) { d = s; } else { if (d->type != FIMG_TYPE_RGB) { - fprintf(stderr, "%s : dst type %d invalide\n", + fprintf(stderr, "%s: dst type %d invalide\n", __func__, d->type); return -4; } diff --git a/tools/fimgfx.c b/tools/fimgfx.c index 16899a4..f8fe055 100644 --- a/tools/fimgfx.c +++ b/tools/fimgfx.c @@ -1,5 +1,8 @@ /* FIMGFX + + * some functions here come from 'funcs/contrast.c' + * */ #include #include @@ -22,7 +25,7 @@ typedef struct { enum fxid { Fx_cos01=5, Fx_cos010, Fx_pow2, Fx_sqrt, Fx_gray0, Fx_halfsz0, Fx_rot90, Fx_cmixa, Fx_desat, Fx_ctr2x2, Fx_norm, - Fx_classtrial, Fx_mirror, Fx_shift0, + Fx_classtrial, Fx_mirror, Fx_shift0, Fx_trimul, Fx_xper, Fx_binarize, Fx_trinarize,Fx_hilight_R }; Fx fx_list[] = { @@ -39,6 +42,7 @@ Fx fx_list[] = { { "ctr2x2", Fx_ctr2x2, 0, 1 }, { "mirror", Fx_mirror, 0, 1 }, { "shift0", Fx_shift0, 0, 1 }, + { "trimul", Fx_trimul, 0, 1 }, // { "norm", Fx_norm, 0, 1 }, { "classtrial", Fx_classtrial, 0, 1 }, { "binarize", Fx_binarize, 0, 1 }, @@ -51,6 +55,7 @@ Fx fx_list[] = { static void list_of_effects(void) { Fx *fx; +/* this list must be on just ONE columns */ for (fx=fx_list; fx->name; fx++) { printf("%s\n", fx->name); } @@ -89,7 +94,7 @@ fprintf(stderr, ">>> %s ( %p %p %f )\n", __func__, S, D, kf); foo = fimg_classif_trial(S, D, kf, 0); if (foo) { - fprintf(stderr, "%s err %d classif_trial %p\n", __func__, + fprintf(stderr, "%s error %d classif_trial %p\n", __func__, foo, S); return -98; } @@ -102,7 +107,7 @@ static void help(int lvl) Fx *fx; int foo; -printf("-- fimg special effects -- %s %s --\n", __DATE__, __TIME__); +printf("-*- fimg special effects -*- %s %s -*-\n", __DATE__, __TIME__); puts("usage:"); puts("\tfimgfx [options] source.fimg resultat.fimg"); @@ -121,7 +126,7 @@ for (fx=fx_list; fx->name; fx++) { foo = 0; } } -puts(""); +puts("\n"); fimg_print_version(1); exit(0); } @@ -203,9 +208,13 @@ switch (action) { foo = fimg_mirror(&src, &dest, 0); break; case Fx_shift0: - fprintf(stderr, "Krkrk %d\n", action); + // fprintf(stderr, "Krkrk %d\n", action); foo = fimg_auto_shift_to_zero(&src, &dest); break; + case Fx_trimul: + fprintf(stderr, "trimul %d\n", action); + foo = fimg_sfx_triplemul(&src, &dest, 0); + break; case Fx_ctr2x2: foo = fimg_contour_2x2(&src, &dest, 0); break;