fonderie can now handle images of any size

This commit is contained in:
Tonton Th 2020-11-04 17:18:58 +01:00
parent e404781d98
commit 3859777c47

View File

@ -28,19 +28,16 @@ if (foo) {
fprintf(stderr, "%s: err %d on insert\n", __func__, foo);
return foo;
}
sprintf(ligne, "p8/%05d.png", numero);
/* ^^^
XXX hardcoded value ? wtf ?
*/
foo = export_fifo(ligne, proc, step);
if (foo) {
fprintf(stderr, "%s: err %d on export\n", __func__, foo);
return foo;
}
numero++; /* VERY IMPORTANT :) */
return 0;
}
/* -------------------------------------------------------------- */
@ -49,12 +46,9 @@ int insert_blank(FloatImg *image, int nbre, int pproc)
int idx, foo;
fimg_clear(image);
for (idx=0; idx<nbre; idx++) {
fimg_hdeg_a(image, 16.64);
brotche_rand48_b(image, drand48()*0.10, 1e5);
fimg_vdeg_a(image, 16.64);
// brotche_rand48_b(image, drand48()*0.10, 1e5);
if ((foo=traite_une_image(image, pproc, 1))) {
fprintf(stderr, "%s : err %d from 'traite_une_image'\n",
__func__, foo);
@ -62,7 +56,6 @@ for (idx=0; idx<nbre; idx++) {
}
printf("\t%c\r", "ABCDEF"[idx%6]); fflush(stdout);
}
puts("");
return 0;
@ -73,11 +66,12 @@ return 0;
int demarre_la_machine(char *pattern, char *outdir, int szfifo,
int infx, int outfx, int step)
{
int foo, idx;
int foo, idx, width, height;
glob_t globbuf;
char *cptr;
FloatImg input;
double fin;
int datas[3];
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( '%s' -> '%s' %d )\n", __func__,
@ -93,19 +87,24 @@ else fprintf(stderr, "\tno in fx\n");
if (outfx) fprintf(stderr, "\tout fx #%d\n", outfx);
else fprintf(stderr, "\tno out fx\n");
foo = create_fifo(szfifo, 640, 480, FIMG_TYPE_RGB);
fprintf(stderr, "init fifo (%d slots) --> %d\n", szfifo, foo);
fimg_create(&input, 640, 480, 3);
/* XXX inject a few stange pics in the fifo */
insert_blank(&input, BLANK, outfx);
memset(&globbuf, 0, sizeof(glob_t));
foo = glob(pattern, 0, NULL, &globbuf);
fprintf(stderr, "glob '%s' -> %d, %ld files found\n", pattern, foo,
globbuf.gl_pathc);
/* get the size of the inputs images */
foo = fimg_fileinfos(globbuf.gl_pathv[0], datas);
width = datas[0];
height = datas[1];
foo = create_fifo(szfifo, width, height, FIMG_TYPE_RGB);
fprintf(stderr, "init fifo (%d slots) --> %d\n", szfifo, foo);
fimg_create(&input, width, height, 3);
/* XXX inject a few stange pics in the fifo */
insert_blank(&input, BLANK, outfx);
for (idx=0; idx<globbuf.gl_pathc; idx++) {
cptr = globbuf.gl_pathv[idx];