Compare commits

...

5 Commits

Author SHA1 Message Date
a587a66af8 removing some wtf code 2020-12-02 14:57:20 +01:00
22999a4e40 another build bug fixed 2020-12-01 15:28:15 +01:00
4053baf7fd trinarize on stage 2020-12-01 15:26:15 +01:00
78c8b16fa6 oups ! 2020-12-01 13:26:00 +01:00
11c457aa81 is trinarize ready ? 2020-12-01 13:10:27 +01:00
5 changed files with 54 additions and 23 deletions

View File

@ -13,8 +13,8 @@ all: fonderie interpolator t
# --------------------------------------------------------- # ---------------------------------------------------------
t: t.c Makefile glitches.o t: t.c Makefile glitches.o sfx.o
gcc ${COPT} $< glitches.o ${LIBS} -lz -o $@ gcc ${COPT} $< glitches.o sfx.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} Makefile interpolator: interpolator.c ${DEPS} ${OBJS} Makefile
gcc ${COPT} $< ${OBJS} ${LIBS} -lz -o $@ gcc ${COPT} $< ${OBJS} ${LIBS} -lz -o $@
# --------------------------------------------------------- # ---------------------------------------------------------

View File

@ -66,8 +66,7 @@ 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
@ -131,8 +130,10 @@ int nbre;
dst = &g_fifo.slots[g_fifo.next]; dst = &g_fifo.slots[g_fifo.next];
nbre = dst->width * dst->height * dst->type; nbre = dst->width * dst->height * sizeof(float);
memcpy(dst->R, src->R, nbre*sizeof(float)); memcpy(dst->R, src->R, nbre);
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,10 +60,9 @@ 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 infx, int outfx, int step, int blk)
{ {
int foo, idx, width, height; int foo, idx, width, height;
glob_t globbuf; glob_t globbuf;
@ -118,7 +117,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, BLANK, outfx, maxvalue, outdir); insert_blank(&input, blk, 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];
@ -145,7 +144,7 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
} }
fputs("\n", stderr); fputs("\n", stderr);
insert_blank(&input, BLANK*2, outfx, maxvalue, outdir); insert_blank(&input, blk, outfx, maxvalue, outdir);
/* /*
* PLEASE, FLUSH THE FIFO ! * PLEASE, FLUSH THE FIFO !
@ -186,14 +185,16 @@ 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, "ghI:O:s:T:vw:x:")) != -1) { while ((opt = getopt(argc, argv, "B: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();
@ -221,7 +222,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); out_effect, steps, blanks);
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,6 +55,7 @@ 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
@ -71,16 +72,31 @@ 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++) {
; // XXX fptr = pimg->R;
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];
} }
fprintf(stderr, "the function '%s' is not implemented\n", __func__); return 0;
exit(2);
return -1;
} }
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
int binarize(FloatImg *pimg, int notused) int binarize(FloatImg *pimg, int notused)

View File

@ -19,6 +19,9 @@ 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;
@ -42,11 +45,11 @@ fimg_printhead(&image);
srand(getpid()); srand(getpid());
debut = fimg_timer_set(TIMER); debut = fimg_timer_set(TIMER);
for (iter=0; iter<127; iter++) { for (iter=0; iter<16; iter++) {
fimg_vdeg_a(&image, LMAX); fimg_vdeg_a(&image, LMAX);
for (bloub=0; bloub<7; bloub++) { for (bloub=0; bloub<16; 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,
@ -54,12 +57,22 @@ for (iter=0; iter<127; iter++) {
if (foo) abort(); if (foo) abort();
} }
sprintf(buff, "/tmp/out%03d.png", iter); sprintf(buff, "/tmp/out_a%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, PNG); fprintf(stderr, "err %d saving to '%s'\n", foo, buff);
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);