From fdc2544ad1beeedb33cc40b541cf8bc23ff5aa16 Mon Sep 17 00:00:00 2001 From: le vieux Date: Sun, 15 Nov 2020 21:31:02 +0100 Subject: [PATCH] working on glitches --- .gitignore | 3 ++ Fonderie/Makefile | 7 ++++- Fonderie/glitches.c | 9 ++++-- Fonderie/interpolator.c | 2 +- Fonderie/t.c | 65 +++++++++++++++++++++++++++++++++++++++ doc/the_floatimg_hack.tex | 8 +++++ 6 files changed, 90 insertions(+), 4 deletions(-) create mode 100644 Fonderie/t.c diff --git a/.gitignore b/.gitignore index f2e1d89..c4e2523 100644 --- a/.gitignore +++ b/.gitignore @@ -64,6 +64,9 @@ tools/*.png tools/*.tiff Fonderie/*.o +Fonderie/*.png +Fonderie/*.pnm Fonderie/fonderie Fonderie/interpolator +Fonderie/t diff --git a/Fonderie/Makefile b/Fonderie/Makefile index e72df85..39a7710 100644 --- a/Fonderie/Makefile +++ b/Fonderie/Makefile @@ -8,7 +8,12 @@ LIBS = ../libfloatimg.a -lpnglite -lm OBJS = fonctions.o sfx.o crapulator.o glitches.o metriques.o DEPS = fonctions.h crapulator.h metriques.h glitches.h -all: fonderie interpolator +all: fonderie interpolator t + +# --------------------------------------------------------- + +t: t.c Makefile glitches.o + gcc ${COPT} $< glitches.o ${LIBS} -lz -o $@ # --------------------------------------------------------- diff --git a/Fonderie/glitches.c b/Fonderie/glitches.c index 9fca56b..7640d3d 100644 --- a/Fonderie/glitches.c +++ b/Fonderie/glitches.c @@ -117,6 +117,7 @@ int vertical_singlitch(FloatImg *picz, int xpos, float fval, float omega, float phi) { int y, x, w, h; +double dy; #if DEBUG_LEVEL fprintf(stderr, ">>> %s ( %p %d %f %f )\n", __func__, picz, @@ -124,9 +125,13 @@ fprintf(stderr, ">>> %s ( %p %d %f %f )\n", __func__, picz, #endif h = picz->height; w = picz->width; -#define BB 12 +#define BB 10 for (y=BB; yBB) && (x +#include + +#include "../floatimg.h" +#include "glitches.h" + +/* ----------------------------------------------------------- */ + +int verbosity; + +#define PNG "out.png" +#define W 512 +#define H 256 +#define LMAX 233.333 +#define TIMER 1 + +int main(int argc, char *argv[]) +{ +int foo, iter, xloc, bloub; +FloatImg image; +char buff[1000]; +double debut, fin; +float omega; +verbosity = 1; + +fimg_print_version(1); + +foo = fimg_create(&image, W, H, FIMG_TYPE_RGB); +if (foo) { + fprintf(stderr, "err %d create image\n", foo); + exit(1); + } +fimg_vdeg_a(&image, LMAX); + +debut = fimg_timer_set(TIMER); + +for (iter=0; iter<64; iter++) { + + for (bloub=0; bloub<5; bloub++) { + xloc = rand() % W; + omega = (float)(0.1 + drand48()*0.8) * 0.5; + foo = vertical_singlitch(&image, xloc, LMAX, + omega, (float)iter); + if (foo) abort(); + } + + sprintf(buff, "out%03d.png", iter); + foo = fimg_save_as_png(&image, buff, 0); + if (foo) { + fprintf(stderr, "err %d saving to '%s'\n", foo, PNG); + exit(1); + } + } + +fin = fimg_timer_set(TIMER); +fprintf(stderr, "elapsed %f\n", fin-debut); + +return 0; +} + +/* ----------------------------------------------------------- */ diff --git a/doc/the_floatimg_hack.tex b/doc/the_floatimg_hack.tex index 313bb24..8fcfbe5 100644 --- a/doc/the_floatimg_hack.tex +++ b/doc/the_floatimg_hack.tex @@ -694,7 +694,15 @@ int fimg_killcolors_b(FloatImg *fimg, float fval); int fimg_colors_mixer_a(FloatImg *fimg, float fval); \end{lstlisting} +\subsection{Glitches}\index{glitch} +Un \textsl{glitch} peut-il être classé dans la catégorie des effets +spéciaux ou non ? \textsc{Hmha}, non. un fx est paramétrable +et surtout répétitif. Un glitch est quasiment souvbent un phénomène +aléatoire\index{drand48} et tout aussi paramétrable. + +J'ai commencé à étudier ces objets étranges quand j'ai commencé +sur l'interpolator\index{interpolator} à l'automne 2020. % ----------------------------------