From b03e6740563e8fc0789f3029a47557fe37ce7c94 Mon Sep 17 00:00:00 2001 From: tonton th Date: Tue, 8 Dec 2020 15:51:07 +0100 Subject: [PATCH] more experiment... --- Fonderie/Makefile | 17 ++++++++--------- Fonderie/crapulator.c | 4 ++++ Fonderie/crapulator.h | 3 ++- Fonderie/essai.sh | 6 ++++-- Fonderie/filterstack.c | 5 +++-- Fonderie/glitches.c | 8 ++++++-- Fonderie/interpolator.c | 2 +- Fonderie/metriques.c | 6 ++++-- 8 files changed, 32 insertions(+), 19 deletions(-) diff --git a/Fonderie/Makefile b/Fonderie/Makefile index b2fe000b..789b3306 100644 --- a/Fonderie/Makefile +++ b/Fonderie/Makefile @@ -20,11 +20,18 @@ t: t.c Makefile ${OBJS} gcc ${COPT} $< ${OBJS} ${LIBS} -o $@ # --------------------------------------------------------- - +# +# fonderie: fonderie.c ${DEPS} ${OBJS} Makefile gcc ${COPT} $< ${OBJS} ${LIBS} -lz -o $@ +# another way to brotch some pics... +interpolator: interpolator.c ${DEPS} ${OBJS} Makefile + gcc ${COPT} $< ${OBJS} ${LIBS} -lz -o $@ + +# --------------------------------------------------------- + crapulator.o: crapulator.c ${DEPS} Makefile gcc ${COPT} -c $< @@ -37,18 +44,10 @@ sfx.o: sfx.c ${DEPS} Makefile filterstack.o: filterstack.c ${DEPS} Makefile gcc ${COPT} -c $< -# --------------------------------------------------------- -# -# another way to brotch some pics... -# - metriques.o: metriques.c metriques.h Makefile gcc ${COPT} -c $< glitches.o: glitches.c glitches.h Makefile gcc ${COPT} -c $< -interpolator: interpolator.c ${DEPS} ${OBJS} Makefile - gcc ${COPT} $< ${OBJS} ${LIBS} -lz -o $@ - # --------------------------------------------------------- diff --git a/Fonderie/crapulator.c b/Fonderie/crapulator.c index ac3b3ed6..71fd9dd9 100644 --- a/Fonderie/crapulator.c +++ b/Fonderie/crapulator.c @@ -172,6 +172,10 @@ switch (idFx) { case 14: retval = desaturate(image); break; + case 15: + retval = kill_a_few_lines(image, fval, + image->height/20); + break; /* here are the glitches */ case 24: /* experiment ! */ diff --git a/Fonderie/crapulator.h b/Fonderie/crapulator.h index 11cb2083..2ee3b2c1 100644 --- a/Fonderie/crapulator.h +++ b/Fonderie/crapulator.h @@ -10,4 +10,5 @@ int crapulator(FloatImg *image, int id_effect, float fparam); - +char *crap_name_from_number(int num); +int crap_number_from_name(char *name); diff --git a/Fonderie/essai.sh b/Fonderie/essai.sh index 91df6e44..0a36bbca 100755 --- a/Fonderie/essai.sh +++ b/Fonderie/essai.sh @@ -1,6 +1,6 @@ #!/bin/bash -FILTRES="5:6:13 2:2 5:9:8 4:25 8:13:13:7 10:1 25:25:25:25 13:14:13" +FILTRES="5:6:13 15 2:2 5:9:8 4:25 8:13:13:7 10:1 25:25:25:25 13:14:13" rm /tmp/fstack*.png @@ -8,7 +8,7 @@ for F in $FILTRES do I="/tmp/fstack-"$F".png" - echo ; echo $I + echo ; echo ==== $I ./t -F $F txt=$(printf "[%-10s]" $F) convert foo.png -pointsize 24 -kerning 0 \ @@ -19,4 +19,6 @@ do done +exit + convert -delay 100 /tmp/fstack*.png foo.gif diff --git a/Fonderie/filterstack.c b/Fonderie/filterstack.c index c7f382eb..11d6c47d 100644 --- a/Fonderie/filterstack.c +++ b/Fonderie/filterstack.c @@ -83,11 +83,12 @@ if (NULL==stack_slots) { fprintf(stderr, "------- %-20s --------\n", txt); fprintf(stderr, "stack at %p, size %d, current %d\n", stack_slots, nbre_filters, idx_slot); -fprintf(stderr, "idx fx# ival fval\n"); +fprintf(stderr, "idx fx# name ival fval\n"); for (idx=0; idx>> %s ( %p %d )\n", __func__, pvictime, bits); line = rand() % pvictime->height; -if (verbosity > 1) { +if (verbosity > 2) { fprintf(stderr, "%s: try to kill line %d\n", __func__, line); } @@ -52,9 +52,13 @@ int kill_a_few_lines(FloatImg *who, float fval, int number) { int idx, foo; +#if DEBUG_LEVEL +fprintf(stderr, ">>> %s ( %p %f %d )\n", __func__, who, fval, number); +#endif + /* Frag the pixels */ for (idx=0; idxwidth * pimg->height; for (idx=20; idx < size; idx+=42) { adder += (double)pimg->R[idx]; + nbre++; } -*where = (float)adder; +*where = (float)(adder/(nbre+1)); return 0; } /* -------------------------------------------------------------- */