Compare commits
No commits in common. "fdc2544ad1beeedb33cc40b541cf8bc23ff5aa16" and "e1e32b1a99b886becb68e472f99974f0ce6a5224" have entirely different histories.
fdc2544ad1
...
e1e32b1a99
3
.gitignore
vendored
3
.gitignore
vendored
@ -64,9 +64,6 @@ tools/*.png
|
||||
tools/*.tiff
|
||||
|
||||
Fonderie/*.o
|
||||
Fonderie/*.png
|
||||
Fonderie/*.pnm
|
||||
Fonderie/fonderie
|
||||
Fonderie/interpolator
|
||||
Fonderie/t
|
||||
|
||||
|
@ -8,12 +8,7 @@ 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 t
|
||||
|
||||
# ---------------------------------------------------------
|
||||
|
||||
t: t.c Makefile glitches.o
|
||||
gcc ${COPT} $< glitches.o ${LIBS} -lz -o $@
|
||||
all: fonderie interpolator
|
||||
|
||||
# ---------------------------------------------------------
|
||||
|
||||
|
@ -117,9 +117,6 @@ 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);
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include <floatimg.h>
|
||||
|
||||
#include "fonctions.h"
|
||||
#include "glitches.h"
|
||||
#include "crapulator.h"
|
||||
|
||||
int verbosity;
|
||||
@ -126,8 +125,8 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
|
||||
fprintf(stderr, "load #%d from dump -> %d\n", idx, foo);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* fscking input filter here */
|
||||
/* ========================= */
|
||||
/* FSCKING INPUT FILTER HERE */
|
||||
foo = crapulator(&input, infx, 0.42);
|
||||
if (foo) {
|
||||
fprintf(stderr, "%s crapulator -> %d\n", __func__, foo);
|
||||
|
@ -113,36 +113,4 @@ int poke_a_random_pixel(FloatImg *picz, float fval, int kaboo)
|
||||
return -1;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
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,
|
||||
xpos, omega, phi);
|
||||
#endif
|
||||
|
||||
h = picz->height; w = picz->width;
|
||||
#define BB 10
|
||||
for (y=BB; y<h-BB; y++) {
|
||||
|
||||
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 */
|
||||
fimg_plot_rgb(picz, x, y, fval, fval, fval);
|
||||
if (rand() & 8)
|
||||
fimg_plot_rgb(picz, x-1, y, 0.0, 0.0, 0.0);
|
||||
if (rand() & 8)
|
||||
fimg_plot_rgb(picz, x+1, y, 0.0, 0.0, 0.0);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/* -------------------------------------------------------------- */
|
||||
|
||||
|
@ -9,7 +9,4 @@ int un_petit_flou_8x8(FloatImg *picture, int x, int y);
|
||||
int un_moyen_flou_8x8(FloatImg *picture, int x, int y);
|
||||
int poke_a_random_pixel(FloatImg *picz, float fval, int kaboo);
|
||||
|
||||
int vertical_singlitch(FloatImg *picz, int xpos, float fv, float omega,
|
||||
float phi);
|
||||
|
||||
/* this is a wtf file */
|
||||
|
@ -39,7 +39,7 @@ static int cmp_idxvalues(const void *pa, const void *pb)
|
||||
return ( ((IdxValue *)pa)->value > ((IdxValue *)pb)->value);
|
||||
}
|
||||
|
||||
int tentative_triage(glob_t *ptr_glob, IdxValue **ptr_idxval, int method)
|
||||
int tentative_triage(glob_t *ptr_glob, IdxValue **ptr_idxval)
|
||||
{
|
||||
int idx, foo, nombre;
|
||||
float metrique;
|
||||
@ -47,8 +47,7 @@ char *filename;
|
||||
IdxValue *idxvalues;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, ptr_glob,
|
||||
ptr_idxval, method);
|
||||
fprintf(stderr, ">>> %s ( %p %p )\n", __func__, ptr_glob, ptr_idxval);
|
||||
#endif
|
||||
|
||||
nombre = ptr_glob->gl_pathc;
|
||||
@ -72,16 +71,13 @@ for (idx=0; idx<nombre; idx++) {
|
||||
foo, filename);
|
||||
return -1;
|
||||
}
|
||||
if (verbosity)
|
||||
fprintf(stderr, "%5d %s %f\n", idx, filename, metrique);
|
||||
fprintf(stderr, "%5d %s %f\n", idx, filename, metrique);
|
||||
idxvalues[idx].idx = idx;
|
||||
idxvalues[idx].value = metrique;
|
||||
}
|
||||
|
||||
if (method) {
|
||||
/* and now, we can massage all our datas */
|
||||
qsort(idxvalues, nombre, sizeof(IdxValue), cmp_idxvalues);
|
||||
}
|
||||
/* and now, we can massage all our datas */
|
||||
qsort(idxvalues, nombre, sizeof(IdxValue), cmp_idxvalues);
|
||||
|
||||
for (idx=0; idx<nombre; idx++) {
|
||||
printf("%5d %9.6f %5d\n", idx,
|
||||
@ -96,8 +92,7 @@ return 0;
|
||||
/*
|
||||
* This is the mega working loop
|
||||
*/
|
||||
int interpolator(char *pattern, char *outdir, int Nsteps,
|
||||
int infx, int outfx, int sort)
|
||||
int interpolator(char *pattern, char *outdir, int Nsteps, int infx)
|
||||
{
|
||||
FloatImg A, B, Out, *pFirst, *pSecond;
|
||||
glob_t globbuf;
|
||||
@ -122,7 +117,7 @@ if (0 == globbuf.gl_pathc) {
|
||||
}
|
||||
|
||||
idx_values = NULL;
|
||||
foo = tentative_triage(&globbuf, &idx_values, sort);
|
||||
foo = tentative_triage(&globbuf, &idx_values);
|
||||
fprintf(stderr, "\tTRI of %p -> %d\n\n", idx_values, foo);
|
||||
|
||||
foo = fimg_fileinfos(globbuf.gl_pathv[0], iarray);
|
||||
@ -156,10 +151,10 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
|
||||
value = idx_values[idx].value;
|
||||
|
||||
/* here, we can insert the input filter */
|
||||
/* OK try it ... */
|
||||
/* OK try it ... */
|
||||
foo = crapulator(&B, infx, value/2.0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "in fx crapulator failure %d\n", foo);
|
||||
fprintf(stderr, "crapulator failure %d\n", foo);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -167,12 +162,10 @@ 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 */
|
||||
foo = crapulator(&Out, outfx, value);
|
||||
if (foo) {
|
||||
fprintf(stderr, "\nout fx %d crapulator failure %d\n",
|
||||
outfx, foo);
|
||||
exit(1);
|
||||
/* here we can insert the output filter */
|
||||
if (rand() & 0x55) {
|
||||
kill_a_few_lines(&Out, value/2.0, 5+(rand()%20));
|
||||
kill_a_few_lines(&Out, 0.0, 5+(rand()%20));
|
||||
}
|
||||
|
||||
sprintf(line, "%s/%05d.png", outdir, ipng);
|
||||
@ -217,36 +210,29 @@ int main (int argc, char *argv[])
|
||||
int foo;
|
||||
int nbrsteps = 9;
|
||||
int opt;
|
||||
int inFx = 0;
|
||||
int outFx = 0;
|
||||
int sort = 0;
|
||||
|
||||
fprintf(stderr, "*** %s : compiled by tTh, %s %s\n", __FILE__,
|
||||
__DATE__, __TIME__);
|
||||
fimg_print_version(2);
|
||||
|
||||
while ((opt = getopt(argc, argv, "hS:vw:x:")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "hv")) != -1) {
|
||||
switch(opt) {
|
||||
case 'h': help(); break;
|
||||
case 'S': sort = atoi(optarg); break;
|
||||
case 'v': verbosity++; break;
|
||||
case 'w': inFx = atoi(optarg); break;
|
||||
case 'x': outFx = atoi(optarg); break;
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, "%s : argc = %d, optind = %d\n", argv[0], argc, optind);
|
||||
#endif
|
||||
/* TO BE CONTINUED *****/
|
||||
|
||||
if (3 != (argc-optind)) {
|
||||
fprintf(stderr, "args: [options] <inglob> <outdir> <nbsteep>\n");
|
||||
if (4 != argc) {
|
||||
fprintf(stderr, "args: <in globpattern> <out dir> <nbrsteep>\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
nbrsteps = atoi(argv[optind+2]);
|
||||
foo = interpolator(argv[optind], argv[optind+1], nbrsteps,
|
||||
inFx, outFx, sort);
|
||||
nbrsteps = atoi(argv[3]);
|
||||
|
||||
#define EFFECT 7
|
||||
foo = interpolator(argv[1], argv[2], nbrsteps, EFFECT);
|
||||
|
||||
fprintf(stderr, "interpolator give a %d score\n", foo);
|
||||
|
||||
|
65
Fonderie/t.c
65
Fonderie/t.c
@ -1,65 +0,0 @@
|
||||
/*
|
||||
* 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,15 +694,7 @@ 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.
|
||||
|
||||
% ----------------------------------
|
||||
|
||||
|
@ -21,6 +21,7 @@ if (FIMG_TYPE_RGB != img->type) {
|
||||
fprintf(stderr, "%s bad type\n", __func__);
|
||||
return -6;
|
||||
}
|
||||
|
||||
for (x=0; x<img->width; x++)
|
||||
{
|
||||
value = (float)x / (float)img->width;
|
||||
@ -33,9 +34,6 @@ for (x=0; x<img->width; x++)
|
||||
return 0;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
/*
|
||||
* wtf ? ther's no way to have the black at the bottom ?
|
||||
*/
|
||||
int fimg_vdeg_a(FloatImg *img, double dcoef)
|
||||
{
|
||||
int x, y;
|
||||
@ -49,6 +47,7 @@ if (FIMG_TYPE_RGB != img->type) {
|
||||
fprintf(stderr, "%s bad type\n", __func__);
|
||||
return -6;
|
||||
}
|
||||
|
||||
for (y=0; y<img->height; y++)
|
||||
{
|
||||
value = (float)y / (float)img->height;
|
||||
|
@ -43,10 +43,7 @@ if (foo) {
|
||||
if (verbosity) fimg_describe(&fimg, argv[2]);
|
||||
|
||||
foo = fimg_dump_to_file(&fimg, argv[2], 0);
|
||||
if (foo) {
|
||||
fprintf(stderr, "save as '%s' -> err %d\n", argv[2], foo);
|
||||
exit(1);
|
||||
}
|
||||
fprintf(stderr, "save as fimg -> %d\n", foo);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user