From dcacb0773837df20bd14bd08fb4eab4718f8d459 Mon Sep 17 00:00:00 2001 From: le vieux Date: Sun, 15 Nov 2020 11:47:37 +0100 Subject: [PATCH] working on glitching methods --- Fonderie/crapulator.c | 3 +++ Fonderie/fonderie.c | 1 + Fonderie/glitches.c | 25 +++++++++++++++++-- Fonderie/glitches.h | 3 ++- Fonderie/interpolator.c | 54 ++++++++++++++++++++++++++--------------- 5 files changed, 63 insertions(+), 23 deletions(-) diff --git a/Fonderie/crapulator.c b/Fonderie/crapulator.c index 0a41bd1b..0dfd4a46 100644 --- a/Fonderie/crapulator.c +++ b/Fonderie/crapulator.c @@ -117,6 +117,9 @@ switch (idFx) { retval = trinarize(image, 0); break; /* --- WTF -- */ + case 25: + retval = vertical_singlitch(image, 250, fval, 18, 0); + break; default : fprintf(stderr, "%s : effect #%d invalid\n", __func__, idFx); diff --git a/Fonderie/fonderie.c b/Fonderie/fonderie.c index 4debfeed..a66c5a6e 100644 --- a/Fonderie/fonderie.c +++ b/Fonderie/fonderie.c @@ -10,6 +10,7 @@ #include #include "fonctions.h" +#include "glitches.h" #include "crapulator.h" int verbosity; diff --git a/Fonderie/glitches.c b/Fonderie/glitches.c index b7f90050..9fca56b0 100644 --- a/Fonderie/glitches.c +++ b/Fonderie/glitches.c @@ -113,10 +113,31 @@ int poke_a_random_pixel(FloatImg *picz, float fval, int kaboo) return -1; } /* -------------------------------------------------------------- */ -int vertical_singlitch(FloatImg *picz, float omega, float phi) +int vertical_singlitch(FloatImg *picz, int xpos, float fval, + float omega, float phi) { +int y, x, w, h; -return -1; +#if DEBUG_LEVEL +fprintf(stderr, ">>> %s ( %p %d %f %f )\n", __func__, picz, + xpos, omega, phi); +#endif + +h = picz->height; w = picz->width; +#define BB 12 +for (y=BB; yBB) && (xvalue > ((IdxValue *)pb)->value); } -int tentative_triage(glob_t *ptr_glob, IdxValue **ptr_idxval) +int tentative_triage(glob_t *ptr_glob, IdxValue **ptr_idxval, int method) { int idx, foo, nombre; float metrique; @@ -47,7 +47,8 @@ char *filename; IdxValue *idxvalues; #if DEBUG_LEVEL -fprintf(stderr, ">>> %s ( %p %p )\n", __func__, ptr_glob, ptr_idxval); +fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, ptr_glob, + ptr_idxval, method); #endif nombre = ptr_glob->gl_pathc; @@ -71,13 +72,16 @@ for (idx=0; idx %d\n\n", idx_values, foo); foo = fimg_fileinfos(globbuf.gl_pathv[0], iarray); @@ -151,10 +156,10 @@ for (idx=0; idx \n"); +if (3 != (argc-optind)) { + fprintf(stderr, "args: [options] \n"); exit(1); } -nbrsteps = atoi(argv[3]); - -#define EFFECT 7 -foo = interpolator(argv[1], argv[2], nbrsteps, EFFECT); +nbrsteps = atoi(argv[optind+2]); +foo = interpolator(argv[optind], argv[optind+1], nbrsteps, + inFx, outFx, sort); fprintf(stderr, "interpolator give a %d score\n", foo);