From ad58bf521d7093e0afa1913e8aa454a74ab52d66 Mon Sep 17 00:00:00 2001 From: tth Date: Fri, 2 Apr 2021 04:16:26 +0200 Subject: [PATCH] another bug in the wall --- Fonderie/crapulator.c | 11 ++++++----- Fonderie/filterstack.c | 4 ++-- Fonderie/fonctions.c | 26 ++++++++++++++------------ Fonderie/fonctions.h | 2 +- Fonderie/fonderie.c | 42 ++++++++++++++---------------------------- 5 files changed, 37 insertions(+), 48 deletions(-) diff --git a/Fonderie/crapulator.c b/Fonderie/crapulator.c index ec837eab..9f5aa763 100644 --- a/Fonderie/crapulator.c +++ b/Fonderie/crapulator.c @@ -157,7 +157,7 @@ return retval; * processor. */ -#define DEBUG_THIS_CRAP 0 +#define DEBUG_THIS_CRAP 60 int crapulator(FloatImg *image, int idFx, float fval) { @@ -172,7 +172,7 @@ fprintf(stderr, ">>> %s ( %p %d %f )\n", __func__, #if DEBUG_THIS_CRAP static int count = 0; int flag_debug = 0; -if (666==count) { +if (DEBUG_THIS_CRAP==count) { flag_debug = 1; fprintf(stderr, "DEBUG PT 1 in %s:%d\n", __func__, __LINE__); fimg_save_as_png(image, "crap_before.png", 0); @@ -183,7 +183,8 @@ retval = 0; switch (idFx) { case CR_none: /* DO NOTHING */ - retval = 0; break; + retval = 0; + break; case CR_cos01: fimg_cos_01(image, image, @@ -328,8 +329,8 @@ typedef struct { int flags; } Crapulor; -/* Warning: overengeniring inside */ -#include "crapstr.h" /* generated file ! */ +/* Warning: overengeniring inside */ +#include "crapstr.h" /* generated file ! */ #define NBCRAP (sizeof(CrapL)/sizeof(Crapulor)) void list_crapulors(char *texte) diff --git a/Fonderie/filterstack.c b/Fonderie/filterstack.c index a0ca3dc2..37c34283 100644 --- a/Fonderie/filterstack.c +++ b/Fonderie/filterstack.c @@ -118,8 +118,8 @@ for (idx=0; idx 1) - fprintf(stderr, "run %d : effect %2d on %p\n", - idx, eff, target); + fprintf(stderr, "stack %d pass %d : effect %2d on %p\n", + numid, idx, eff, target); foo = crapulator(target, eff, fv); diff --git a/Fonderie/fonctions.c b/Fonderie/fonctions.c index 878f5286..51e13f70 100644 --- a/Fonderie/fonctions.c +++ b/Fonderie/fonctions.c @@ -51,11 +51,9 @@ else { pdest = destination; } fimg_clear(pdest); + for (idx=0; idxnbslots; idx += step) { - /*************************************** - * Here was the giant bootleneck * - ***************************************/ - // HERE -> foo = fimg_add_2(&(pfifo->slots[idx]), pdest); + foo = big_adder(&(pfifo->slots[idx]), pdest); if (foo) { @@ -64,6 +62,10 @@ for (idx=0; idxnbslots; idx += step) { } } +fprintf(stderr, "*** %s %s writing debug file ***\n", + __FILE__, __func__); +fimg_dump_to_file(&g_fifo.total, "debugB.fimg", 0); + return 0; } /* -------------------------------------------------------------- */ @@ -73,16 +75,13 @@ return 0; * - 16 bits PNM * - 8 bits PNG */ -int export_fifo(char *fname, int postproc, int step) +int export_fifo(char *fname, int step) { int foo, type; foo = faire_la_somme(&g_fifo, NULL, step); -if (postproc) - foo = crapulator(&g_fifo.total, postproc, 0.0); -else - foo = filterstack_run(1, &g_fifo.total, 0); +foo = filterstack_run(1, &g_fifo.total, 0); if (foo) { fprintf(stderr, "%s: ERR post process picture -> %d\n", __func__, foo); @@ -127,9 +126,11 @@ memcpy(dst->R, src->R, nbre); memcpy(dst->G, src->G, nbre); memcpy(dst->B, src->B, nbre); -g_fifo.next++, g_fifo.next %= g_fifo.nbslots; -// maybe we can write : -// (++fifo.next) %= fifo.nbslots; +fprintf(stderr, "*** %s %s writing debug file ***\n", + __FILE__, __func__); +fimg_dump_to_file(dst, "debugA.fimg", 0); + +g_fifo.next++; g_fifo.next %= g_fifo.nbslots; if (verbosity > 2) fprintf(stderr, "%s : next slot %d\n", __func__, g_fifo.next); @@ -158,6 +159,7 @@ for (idx=0; idx %d\n", szfifo, foo); /* XXX inject a few strange pics in the fifo */ -insert_blank(&input, blk, outfx, maxvalue, outdir); +insert_blank(&input, blk, maxvalue, outdir); for (idx=0; idx %d\n", __func__, foo); exit(1); } - foo = traite_une_image(&input, outfx, step, outdir); + foo = traite_une_image(&input, step, outdir); + if (foo) { fprintf(stderr, "traitement %s -> %d WTF?\n", cptr, foo); break; } fprintf(stderr, "\t%5d / %5d\r", idx, (int)globbuf.gl_pathc); } + fputs("\n", stderr); -insert_blank(&input, blk, outfx, maxvalue, outdir); +insert_blank(&input, blk, maxvalue, outdir); /* * PLEASE, FLUSH THE FIFO ! @@ -213,8 +205,6 @@ int foo, opt; int fifosize = 10; char *in_pattern = "capture/?????.fimg"; char *out_dir = "p8"; -// OBSOLETE int in_effect = 0; -// OBSOLETE int out_effect = 0; int steps = 1; int blanks = 20; char *InFchain = "none"; @@ -245,10 +235,6 @@ while ((opt = getopt(argc, argv, "B:E:F:ghI:LO:s:T:vw:x:")) != -1) { break; case 'v': verbosity++; break; -// OBSOLETE case 'w': in_effect = atoi(optarg); -// OBSOLETE break; -// OBSOLETE case 'x': out_effect = atoi(optarg); -// OBSOLETE break; case 's': steps = atoi(optarg); break; } @@ -278,8 +264,8 @@ if (verbosity) { fprintf(stderr, ".\n"); } -foo = demarre_la_machine(in_pattern, out_dir, fifosize, 0, - 0, steps, blanks); +foo = demarre_la_machine(in_pattern, out_dir, fifosize, steps, blanks); + fprintf(stderr, "retour du big-run de la machine -> %d\n", foo); return 0;