From d369babbb3e7ece0701b0bbc0cb9e5a4df74ae02 Mon Sep 17 00:00:00 2001 From: tonton th Date: Fri, 18 Dec 2020 10:18:09 +0100 Subject: [PATCH] + upside-down --- Fonderie/crapulator.c | 4 +++ Fonderie/filterstack.c | 6 +++-- Fonderie/interpolator.c | 3 ++- Fonderie/sfx.c | 54 ++++++++++++++++++++++++++++++++++++++++- Fonderie/sfx.h | 1 + Fonderie/t.c | 4 +-- 6 files changed, 66 insertions(+), 6 deletions(-) diff --git a/Fonderie/crapulator.c b/Fonderie/crapulator.c index a7e5b51b..47cfca7b 100644 --- a/Fonderie/crapulator.c +++ b/Fonderie/crapulator.c @@ -183,6 +183,9 @@ switch (idFx) { case 17: retval = mirror_split(image, 0); break; + case 18: + retval = upside_down(image); + break; /* here are the glitches */ case 24: /* experiment ! */ @@ -217,6 +220,7 @@ switch (num) { case 0: return "none"; case 8: return "ctr2x2"; case 13: return "fltr3x3"; + case 18: return "updown"; } return "???"; diff --git a/Fonderie/filterstack.c b/Fonderie/filterstack.c index ee637687..2ea9fdc6 100644 --- a/Fonderie/filterstack.c +++ b/Fonderie/filterstack.c @@ -76,7 +76,7 @@ if (numid < 0 || numid > NUMBER_OF_STACK) { fprintf(stderr, "--- %2d -- %-20s --------\n", numid, txt); // fprintf(stderr, "stack at %p, size %d, current %d\n", // f_slots, nbre_filters, idx_slot); -fprintf(stderr, "idx fx# name ival fval\n"); +fprintf(stderr, "idx ___ fx# _ name ________ ival _ fval ___\n"); for (idx=0; idxwidth); + +rowpix = calloc(pimg->width, sizeof(float)); +if (NULL==rowpix) { + fprintf(stderr, "%s : memory full\n", __func__); + exit(1); + } + +wsz = pimg->width * sizeof(float); +fprintf(stderr, "%s: wsx = %d\n", __func__, wsz); + +for (ya=0; yaheight/2; ya++) { + + y2 = pimg->height - (ya+1); + Os = (pimg->width * ya); + Od = (pimg->width * y2); + + /* let's go, crash coredumping... */ + Ps = pimg->R + Os; + Pd = pimg->R + Od; + memcpy(rowpix, Ps, wsz); + memcpy(Ps, Pd, wsz); + memcpy(Pd, rowpix, wsz); + + Ps = pimg->G + Os; + Pd = pimg->G + Od; + memcpy(rowpix, Ps, wsz); + memcpy(Ps, Pd, wsz); + memcpy(Pd, rowpix, wsz); + + Ps = pimg->B + Os; + Pd = pimg->B + Od; + memcpy(rowpix, Ps, wsz); + memcpy(Ps, Pd, wsz); + memcpy(Pd, rowpix, wsz); + } + +free(rowpix); + +return 0; +} /* -------------------------------------------------------------- */ /* nouveau du 9 decembre 2020, en ecoutant le Fermion raconter du superbe portnawak */ @@ -113,7 +165,7 @@ return 0; int trinarize(FloatImg *pimg, int notused) { float mm[6], mRa, mGa, mBa, mRb, mGb, mBb; -float val, *fptr; +float *fptr; int foo, size; #if DEBUG_LEVEL diff --git a/Fonderie/sfx.h b/Fonderie/sfx.h index e54c911f..75666805 100644 --- a/Fonderie/sfx.h +++ b/Fonderie/sfx.h @@ -6,6 +6,7 @@ int bouger_les_pixels(FloatImg *pimg, int kaboo); int mirror_split(FloatImg *pimg, int kaboo); +int upside_down(FloatImg *pimg); int des_bords_sombres_a(FloatImg *pimg, int offset); diff --git a/Fonderie/t.c b/Fonderie/t.c index 352c7e20..974d1917 100644 --- a/Fonderie/t.c +++ b/Fonderie/t.c @@ -76,7 +76,7 @@ int main(int argc, char *argv[]) { int foo; int opt; -char *filterchain = "0"; +char *filterchain = "18"; fprintf(stderr, "*** %s : compiled by tTh, %s %s\n", __FILE__, __DATE__, __TIME__); @@ -100,7 +100,7 @@ if (foo) { exit(1); } -foo = essai_filterstack("mire.fimg"); +foo = essai_filterstack("01137.fimg"); if (foo) { fprintf(stderr, "err %d in essai_filterstack\n", foo); exit(1);