another bug in the wall

This commit is contained in:
tth
2021-04-02 04:16:26 +02:00
parent 97698bb66f
commit ad58bf521d
5 changed files with 37 additions and 48 deletions

View File

@@ -17,7 +17,7 @@
int verbosity;
/* -------------------------------------------------------------- */
int traite_une_image(FloatImg *image, int proc, int step, char *outd)
int traite_une_image(FloatImg *image, int step, char *outd)
{
static int numero;
int foo;
@@ -29,8 +29,9 @@ if (foo) {
fprintf(stderr, "%s: err %d on insert\n", __func__, foo);
return foo;
}
sprintf(ligne, "%s/%05d.png", outd, numero);
foo = export_fifo(ligne, proc, step);
foo = export_fifo(ligne, step);
if (foo) {
fprintf(stderr, "%s: err %d on export\n", __func__, foo);
return foo;
@@ -39,8 +40,7 @@ numero++; /* VERY IMPORTANT :) */
return 0;
}
/* -------------------------------------------------------------- */
int insert_blank(FloatImg *image, int nbre, int pproc,
float fval, char *outd)
int insert_blank(FloatImg *image, int nbre, float fval, char *outd)
{
int idx, foo;
int preloaded = 0;
@@ -69,12 +69,7 @@ for (idx=0; idx<nbre; idx++) {
if (preloaded) {
fimg_copy_data(&blank, image);
}
/* XXX
else {
fimg_hdeg_a(image, fval);
}
*/
if ((foo=traite_une_image(image, pproc, 1, outd))) {
if ((foo=traite_une_image(image, 1, outd))) {
fprintf(stderr, "%s : err %d from 'traite_une_image'\n",
__func__, foo);
break;
@@ -92,7 +87,7 @@ return 0;
/* -------------------------------------------------------------- */
int demarre_la_machine(char *pattern, char *outdir, int szfifo,
int infx, int outfx, int step, int blk)
int step, int blk)
{
int foo, idx, width, height;
glob_t globbuf;
@@ -142,7 +137,7 @@ foo = create_fifo(szfifo, width, height, FIMG_TYPE_RGB);
fprintf(stderr, "init fifo (%d slots) --> %d\n", szfifo, foo);
/* XXX inject a few strange pics in the fifo */
insert_blank(&input, blk, outfx, maxvalue, outdir);
insert_blank(&input, blk, maxvalue, outdir);
for (idx=0; idx<globbuf.gl_pathc; idx++) {
cptr = globbuf.gl_pathv[idx];
@@ -155,26 +150,23 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
}
/* fscking input filter here */
if (infx) {
foo = crapulator(&input, infx, maxvalue);
}
else {
foo = filterstack_run(0, &input, 0);
}
foo = filterstack_run(0, &input, 0);
if (foo) {
fprintf(stderr, "%s: input filter -> %d\n", __func__, foo);
exit(1);
}
foo = traite_une_image(&input, outfx, step, outdir);
foo = traite_une_image(&input, step, outdir);
if (foo) {
fprintf(stderr, "traitement %s -> %d WTF?\n", cptr, foo);
break;
}
fprintf(stderr, "\t%5d / %5d\r", idx, (int)globbuf.gl_pathc);
}
fputs("\n", stderr);
insert_blank(&input, blk, outfx, maxvalue, outdir);
insert_blank(&input, blk, maxvalue, outdir);
/*
* PLEASE, FLUSH THE FIFO !
@@ -213,8 +205,6 @@ int foo, opt;
int fifosize = 10;
char *in_pattern = "capture/?????.fimg";
char *out_dir = "p8";
// OBSOLETE int in_effect = 0;
// OBSOLETE int out_effect = 0;
int steps = 1;
int blanks = 20;
char *InFchain = "none";
@@ -245,10 +235,6 @@ while ((opt = getopt(argc, argv, "B:E:F:ghI:LO:s:T:vw:x:")) != -1) {
break;
case 'v': verbosity++;
break;
// OBSOLETE case 'w': in_effect = atoi(optarg);
// OBSOLETE break;
// OBSOLETE case 'x': out_effect = atoi(optarg);
// OBSOLETE break;
case 's': steps = atoi(optarg);
break;
}
@@ -278,8 +264,8 @@ if (verbosity) {
fprintf(stderr, ".\n");
}
foo = demarre_la_machine(in_pattern, out_dir, fifosize, 0,
0, steps, blanks);
foo = demarre_la_machine(in_pattern, out_dir, fifosize, steps, blanks);
fprintf(stderr, "retour du big-run de la machine -> %d\n", foo);
return 0;