diff --git a/Fonderie/crapulator.c b/Fonderie/crapulator.c index 0fd2eef8..05f27672 100644 --- a/Fonderie/crapulator.c +++ b/Fonderie/crapulator.c @@ -218,6 +218,10 @@ switch (idFx) { retval = random_blocks(image, 70); break; + case CR_shiftln0: + retval = multilines_shift_0(image, 11, 120); + break; + case CR_message: fprintf(stderr, "### message from pid %d, fv=%f ###\n", getpid(), fval); @@ -289,18 +293,15 @@ return "???"; /* -------------------------------------------------------------- */ int crap_number_from_name(char *name) { -int idx, foo, retval; +int idx, retval; #if DEBUG_LEVEL fprintf(stderr, ">>> %s ( '%s' )\n", __func__, name); #endif retval = -1; /* not found */ - for (idx=0; CrapL[idx].id!=-1; idx++) { - - foo = strcmp(CrapL[idx].name, name); - if (0 == foo) { + if (0 == strcmp(CrapL[idx].name, name)) { // fprintf(stderr, "found '%s' -> %d\n", name, // CrapL[idx].id); retval = CrapL[idx].id; diff --git a/Fonderie/crapulator.h b/Fonderie/crapulator.h index a7aa2d22..f07e56ed 100644 --- a/Fonderie/crapulator.h +++ b/Fonderie/crapulator.h @@ -2,18 +2,20 @@ * crapulator.h */ -/* - * some constants for effect numbers */ - /* * the main function */ int crapulator(FloatImg *image, int id_effect, float fparam); +/* + * naming system */ void list_crapulors(char *texte); - char *crap_name_from_number(int num); int crap_number_from_name(char *name); +/* + * this generated file contains the #define + * for symbolic name of effect ids. + */ #include "crapdef.h" diff --git a/Fonderie/crapulors.liste b/Fonderie/crapulors.liste index 5527bf7f..5df72fef 100644 --- a/Fonderie/crapulors.liste +++ b/Fonderie/crapulors.liste @@ -22,5 +22,6 @@ 24 bsombra 1 1.0 25 vsglitch 1 1.0 26 rndblks 1 1.0 +27 shiftln0 1 1.0 99 message 1 1.0 -1 end 1 1.0 diff --git a/Fonderie/filterstack.c b/Fonderie/filterstack.c index 69785b5a..1ac2baf7 100644 --- a/Fonderie/filterstack.c +++ b/Fonderie/filterstack.c @@ -208,6 +208,11 @@ for (;;) { value = crap_number_from_name(cptr); // fprintf(stderr, "%s: '%s' -> %d\n", __func__, // cptr, value); + if (value < 0) { + fprintf(stderr, "%s: '%s' not found\n", + __func__, cptr); + return -1; + } foo = filterstack_add(numid, value, 1, 1.0); continue; } diff --git a/Fonderie/glitches.c b/Fonderie/glitches.c index 3df039f1..6ed509b5 100644 --- a/Fonderie/glitches.c +++ b/Fonderie/glitches.c @@ -7,6 +7,7 @@ #include #include +#include #include #include "../floatimg.h" @@ -188,4 +189,48 @@ for (y=BB; y>> %s ( %p %d %d )\n", __func__, picz, step, nombre); +#endif + +buffline = alloca(picz->width * sizeof(float)); +if (NULL==buffline) { + fprintf(stderr, "%s: memory panic\n", __func__); + abort(); + } + +for (idx=0; idxheight; + + sptr = picz->R + (ypos * picz->width); + shifter(sptr, buffline, step, picz->width); + memcpy(sptr, buffline, picz->width*sizeof(float)); + + sptr = picz->G + (ypos * picz->width); + shifter(sptr, buffline, step, picz->width); + memcpy(sptr, buffline, picz->width*sizeof(float)); + + sptr = picz->B + (ypos * picz->width); + shifter(sptr, buffline, step, picz->width); + memcpy(sptr, buffline, picz->width*sizeof(float)); + } + +return 0; +} +/* -------------------------------------------------------------- */ diff --git a/Fonderie/glitches.h b/Fonderie/glitches.h index 845de141..965a5d95 100644 --- a/Fonderie/glitches.h +++ b/Fonderie/glitches.h @@ -12,5 +12,6 @@ int poke_a_random_pixel(FloatImg *picz, float fval, int kaboo); int vertical_singlitch(FloatImg *picz, int xpos, float fv, float omega, float phi); +int multilines_shift_0(FloatImg *picz, int step, int nombre); /* this is a wtf file */ diff --git a/Fonderie/interpolator.c b/Fonderie/interpolator.c index ede22772..838d842f 100644 --- a/Fonderie/interpolator.c +++ b/Fonderie/interpolator.c @@ -229,9 +229,6 @@ for (idx=0; idx