Compare commits

..

No commits in common. "a587a66af83e45a9a5b58aa4fc54c823b33632a5" and "e17232f29c5bbdf8efee50dfb688a710be7b1ea5" have entirely different histories.

5 changed files with 23 additions and 54 deletions

View File

@ -13,8 +13,8 @@ all: fonderie interpolator t
# --------------------------------------------------------- # ---------------------------------------------------------
t: t.c Makefile glitches.o sfx.o t: t.c Makefile glitches.o
gcc ${COPT} $< glitches.o sfx.o ${LIBS} -lz -o $@ gcc ${COPT} $< glitches.o ${LIBS} -lz -o $@
# --------------------------------------------------------- # ---------------------------------------------------------
@ -42,7 +42,7 @@ metriques.o: metriques.c metriques.h Makefile
glitches.o: glitches.c glitches.h Makefile glitches.o: glitches.c glitches.h Makefile
gcc ${COPT} -c $< gcc ${COPT} -c $<
interpolator: interpolator.c ${DEPS} ${OBJS} Makefile interpolator: interpolator.c ${DEPS} Makefile
gcc ${COPT} $< ${OBJS} ${LIBS} -lz -o $@ gcc ${COPT} $< ${OBJS} ${LIBS} -lz -o $@
# --------------------------------------------------------- # ---------------------------------------------------------

View File

@ -66,7 +66,8 @@ for (idx=0; idx<pfifo->nbslots; idx += step) {
return 0; return 0;
} }
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
/* called by 'fonderie.c' /* -------------------------------------------------------------- */
/*
* this func save the fifo content as * this func save the fifo content as
* - float FIMG * - float FIMG
* - 16 bits PNM * - 16 bits PNM
@ -130,10 +131,8 @@ int nbre;
dst = &g_fifo.slots[g_fifo.next]; dst = &g_fifo.slots[g_fifo.next];
nbre = dst->width * dst->height * sizeof(float); nbre = dst->width * dst->height * dst->type;
memcpy(dst->R, src->R, nbre); memcpy(dst->R, src->R, nbre*sizeof(float));
memcpy(dst->G, src->G, nbre);
memcpy(dst->B, src->B, nbre);
g_fifo.next++, g_fifo.next %= g_fifo.nbslots; g_fifo.next++, g_fifo.next %= g_fifo.nbslots;
// maybe we can write : // maybe we can write :

View File

@ -60,9 +60,10 @@ puts("");
return 0; return 0;
} }
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
#define BLANK 50
int demarre_la_machine(char *pattern, char *outdir, int szfifo, int demarre_la_machine(char *pattern, char *outdir, int szfifo,
int infx, int outfx, int step, int blk) int infx, int outfx, int step)
{ {
int foo, idx, width, height; int foo, idx, width, height;
glob_t globbuf; glob_t globbuf;
@ -117,7 +118,7 @@ foo = create_fifo(szfifo, width, height, FIMG_TYPE_RGB);
fprintf(stderr, "init fifo (%d slots) --> %d\n", szfifo, foo); fprintf(stderr, "init fifo (%d slots) --> %d\n", szfifo, foo);
/* XXX inject a few strange pics in the fifo */ /* XXX inject a few strange pics in the fifo */
insert_blank(&input, blk, outfx, maxvalue, outdir); insert_blank(&input, BLANK, outfx, maxvalue, outdir);
for (idx=0; idx<globbuf.gl_pathc; idx++) { for (idx=0; idx<globbuf.gl_pathc; idx++) {
cptr = globbuf.gl_pathv[idx]; cptr = globbuf.gl_pathv[idx];
@ -144,7 +145,7 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
} }
fputs("\n", stderr); fputs("\n", stderr);
insert_blank(&input, blk, outfx, maxvalue, outdir); insert_blank(&input, BLANK*2, outfx, maxvalue, outdir);
/* /*
* PLEASE, FLUSH THE FIFO ! * PLEASE, FLUSH THE FIFO !
@ -185,16 +186,14 @@ char *out_dir = "p8";
int in_effect = 0; int in_effect = 0;
int out_effect = 0; int out_effect = 0;
int steps = 1; int steps = 1;
int blanks = 20;
fprintf(stderr, "*** %s :\n\tcompiled by tTh, %s %s\n\tpid %d\n", fprintf(stderr, "*** %s :\n\tcompiled by tTh, %s %s\n\tpid %d\n",
argv[0], __DATE__, __TIME__, getpid()); argv[0], __DATE__, __TIME__, getpid());
fimg_print_version(2); fimg_print_version(2);
while ((opt = getopt(argc, argv, "B:ghI:O:s:T:vw:x:")) != -1) { while ((opt = getopt(argc, argv, "ghI:O:s:T:vw:x:")) != -1) {
switch(opt) { switch(opt) {
case 'B': blanks = atoi(optarg);
break;
case 'g': convert_to_gray = 1; case 'g': convert_to_gray = 1;
break; break;
case 'h': help(); case 'h': help();
@ -222,7 +221,7 @@ if (verbosity) {
} }
foo = demarre_la_machine(in_pattern, out_dir, fifosize, in_effect, foo = demarre_la_machine(in_pattern, out_dir, fifosize, in_effect,
out_effect, steps, blanks); out_effect, steps);
fprintf(stderr, "retour du big-run de la machine -> %d\n", foo); fprintf(stderr, "retour du big-run de la machine -> %d\n", foo);
return 0; return 0;

View File

@ -55,7 +55,6 @@ return 0;
int trinarize(FloatImg *pimg, int notused) int trinarize(FloatImg *pimg, int notused)
{ {
float mm[6], mRa, mGa, mBa, mRb, mGb, mBb; float mm[6], mRa, mGa, mBa, mRb, mGb, mBb;
float val, *fptr;
int foo, size; int foo, size;
#if DEBUG_LEVEL #if DEBUG_LEVEL
@ -72,31 +71,16 @@ mBb = (mm[5] - mm[4]) * 0.66666;
size = pimg->width * pimg->height; size = pimg->width * pimg->height;
#define VAL (255.0)
for (foo=0; foo<size; foo++) { for (foo=0; foo<size; foo++) {
fptr = pimg->R; ; // XXX
if (fptr[foo] < mRa || fptr[foo] > mRb)
fptr[foo] = 0.0;
else
fptr[foo] = mm[1];
fptr = pimg->G;
if (fptr[foo] < mGa || fptr[foo] > mGb)
fptr[foo] = 0.0;
else
fptr[foo] = mm[3];
fptr = pimg->B;
if (fptr[foo] < mBa || fptr[foo] > mBb)
fptr[foo] = 0.0;
else
fptr[foo] = mm[5];
} }
return 0; fprintf(stderr, "the function '%s' is not implemented\n", __func__);
exit(2);
return -1;
} }
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
int binarize(FloatImg *pimg, int notused) int binarize(FloatImg *pimg, int notused)

View File

@ -19,9 +19,6 @@ int verbosity;
#define LMAX 233.333 #define LMAX 233.333
#define TIMER 1 #define TIMER 1
int trinarize(FloatImg *pimg, int notused); // in sfx.c
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int foo, iter, xloc, bloub; int foo, iter, xloc, bloub;
@ -45,11 +42,11 @@ fimg_printhead(&image);
srand(getpid()); srand(getpid());
debut = fimg_timer_set(TIMER); debut = fimg_timer_set(TIMER);
for (iter=0; iter<16; iter++) { for (iter=0; iter<127; iter++) {
fimg_vdeg_a(&image, LMAX); fimg_vdeg_a(&image, LMAX);
for (bloub=0; bloub<16; bloub++) { for (bloub=0; bloub<7; bloub++) {
xloc = rand() % W; xloc = rand() % W;
omega = (float)(0.1 + drand48()*0.6) * 0.4; omega = (float)(0.1 + drand48()*0.6) * 0.4;
foo = vertical_singlitch(&image, xloc, LMAX, foo = vertical_singlitch(&image, xloc, LMAX,
@ -57,22 +54,12 @@ for (iter=0; iter<16; iter++) {
if (foo) abort(); if (foo) abort();
} }
sprintf(buff, "/tmp/out_a%03d.png", iter); sprintf(buff, "/tmp/out%03d.png", iter);
foo = fimg_save_as_png(&image, buff, 0); foo = fimg_save_as_png(&image, buff, 0);
if (foo) { if (foo) {
fprintf(stderr, "err %d saving to '%s'\n", foo, buff); fprintf(stderr, "err %d saving to '%s'\n", foo, PNG);
exit(1); exit(1);
} }
foo = trinarize(&image, 0); /* XXX */
sprintf(buff, "/tmp/out_b%03d.png", iter);
foo = fimg_save_as_png(&image, buff, 0);
if (foo) {
fprintf(stderr, "err %d saving to '%s'\n", foo, buff);
exit(1);
}
} }
fin = fimg_timer_set(TIMER); fin = fimg_timer_set(TIMER);