output dir option is NOW working (maybe)

This commit is contained in:
le vieux 2020-11-20 19:06:08 +01:00
parent ba945daa54
commit f61f428066
2 changed files with 14 additions and 11 deletions

View File

@ -17,7 +17,7 @@ int verbosity;
int convert_to_gray; int convert_to_gray;
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
int traite_une_image(FloatImg *image, int proc, int step) int traite_une_image(FloatImg *image, int proc, int step, char *outd)
{ {
static int numero; static int numero;
int foo; int foo;
@ -29,10 +29,7 @@ if (foo) {
fprintf(stderr, "%s: err %d on insert\n", __func__, foo); fprintf(stderr, "%s: err %d on insert\n", __func__, foo);
return foo; return foo;
} }
sprintf(ligne, "p8/%05d.png", numero); sprintf(ligne, "%s/%05d.png", outd, numero);
/* ^^^
XXX hardcoded value ? wtf ?
*/
foo = export_fifo(ligne, proc, step); foo = export_fifo(ligne, proc, step);
if (foo) { if (foo) {
fprintf(stderr, "%s: err %d on export\n", __func__, foo); fprintf(stderr, "%s: err %d on export\n", __func__, foo);
@ -42,7 +39,8 @@ numero++; /* VERY IMPORTANT :) */
return 0; return 0;
} }
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
int insert_blank(FloatImg *image, int nbre, int pproc, float fval) int insert_blank(FloatImg *image, int nbre, int pproc,
float fval, char *outd)
{ {
int idx, foo; int idx, foo;
@ -50,7 +48,7 @@ fimg_clear(image);
for (idx=0; idx<nbre; idx++) { for (idx=0; idx<nbre; idx++) {
fimg_vdeg_a(image, fval); fimg_vdeg_a(image, fval);
// brotche_rand48_b(image, drand48()*0.10, 1e5); // brotche_rand48_b(image, drand48()*0.10, 1e5);
if ((foo=traite_une_image(image, pproc, 1))) { if ((foo=traite_une_image(image, pproc, 1, outd))) {
fprintf(stderr, "%s : err %d from 'traite_une_image'\n", fprintf(stderr, "%s : err %d from 'traite_une_image'\n",
__func__, foo); __func__, foo);
break; break;
@ -115,7 +113,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); 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];
@ -133,7 +131,7 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
fprintf(stderr, "%s crapulator -> %d\n", __func__, foo); fprintf(stderr, "%s crapulator -> %d\n", __func__, foo);
exit(1); exit(1);
} }
foo = traite_une_image(&input, outfx, step); foo = traite_une_image(&input, outfx, step, outdir);
if (foo) { if (foo) {
fprintf(stderr, "traitement %s -> %d WTF?\n", cptr, foo); fprintf(stderr, "traitement %s -> %d WTF?\n", cptr, foo);
break; break;
@ -142,7 +140,7 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
} }
fputs("\n", stderr); fputs("\n", stderr);
insert_blank(&input, BLANK*2, outfx, maxvalue); insert_blank(&input, BLANK*2, outfx, maxvalue, outdir);
/* /*
* PLEASE, FLUSH THE FIFO ! * PLEASE, FLUSH THE FIFO !
@ -212,6 +210,11 @@ while ((opt = getopt(argc, argv, "ghI:O:s:T:vw:x:")) != -1) {
} }
} }
if (verbosity) {
fprintf(stderr, "input glob %s\n", in_pattern);
fprintf(stderr, "output dir %s\n", out_dir);
}
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);
fprintf(stderr, "retour du big-run de la machine -> %d\n", foo); fprintf(stderr, "retour du big-run de la machine -> %d\n", foo);

View File

@ -51,7 +51,7 @@ for (iter=0; iter<72; iter++) {
if (foo) abort(); if (foo) abort();
} }
sprintf(buff, "out%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, PNG); fprintf(stderr, "err %d saving to '%s'\n", foo, PNG);