forked from tTh/FloatImg
working on glitches
This commit is contained in:
parent
1334d96822
commit
fdc2544ad1
|
@ -64,6 +64,9 @@ tools/*.png
|
|||
tools/*.tiff
|
||||
|
||||
Fonderie/*.o
|
||||
Fonderie/*.png
|
||||
Fonderie/*.pnm
|
||||
Fonderie/fonderie
|
||||
Fonderie/interpolator
|
||||
Fonderie/t
|
||||
|
||||
|
|
|
@ -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 $@
|
||||
|
||||
# ---------------------------------------------------------
|
||||
|
||||
|
|
|
@ -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; y<h-BB; y++) {
|
||||
x = xpos; /* add sinus deviation here */
|
||||
|
||||
dy = (double)y * omega;
|
||||
|
||||
x = xpos + (int)(10.9*sin(dy+phi)); /* add sinus deviation */
|
||||
|
||||
/* compute bounding box */
|
||||
if ( (x>BB) && (x<w-BB) ) {
|
||||
/* an make the glitch */
|
||||
|
|
|
@ -167,7 +167,7 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
|
|||
coef = (float)step / (float)Nsteps;
|
||||
fimg_interpolate(pSecond, pFirst, &Out, coef);
|
||||
|
||||
/* here we can insert the output filter */
|
||||
/* here we can insert the OUTPUT filter */
|
||||
foo = crapulator(&Out, outfx, value);
|
||||
if (foo) {
|
||||
fprintf(stderr, "\nout fx %d crapulator failure %d\n",
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* test des trucs
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------- */
|
|
@ -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.
|
||||
|
||||
% ----------------------------------
|
||||
|
||||
|
|
Loading…
Reference in New Issue