|
|
|
@ -41,13 +41,13 @@ numero++; /* VERY IMPORTANT :) */
@@ -41,13 +41,13 @@ numero++; /* VERY IMPORTANT :) */
|
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
/* -------------------------------------------------------------- */ |
|
|
|
|
int insert_blank(FloatImg *image, int nbre, int pproc) |
|
|
|
|
int insert_blank(FloatImg *image, int nbre, int pproc, float fval) |
|
|
|
|
{ |
|
|
|
|
int idx, foo; |
|
|
|
|
|
|
|
|
|
fimg_clear(image); |
|
|
|
|
for (idx=0; idx<nbre; idx++) { |
|
|
|
|
fimg_vdeg_a(image, 16.64); |
|
|
|
|
fimg_vdeg_a(image, fval); |
|
|
|
|
// 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", |
|
|
|
@ -61,7 +61,7 @@ puts("");
@@ -61,7 +61,7 @@ puts("");
|
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
/* -------------------------------------------------------------- */ |
|
|
|
|
#define BLANK 40 |
|
|
|
|
#define BLANK 30 |
|
|
|
|
|
|
|
|
|
int demarre_la_machine(char *pattern, char *outdir, int szfifo, |
|
|
|
|
int infx, int outfx, int step) |
|
|
|
@ -71,11 +71,12 @@ glob_t globbuf;
@@ -71,11 +71,12 @@ glob_t globbuf;
|
|
|
|
|
char *cptr; |
|
|
|
|
FloatImg input; |
|
|
|
|
double fin; |
|
|
|
|
float maxvalue; |
|
|
|
|
int datas[3]; |
|
|
|
|
|
|
|
|
|
#if DEBUG_LEVEL |
|
|
|
|
fprintf(stderr, ">>> %s ( '%s' -> '%s' %d )\n", __func__, |
|
|
|
|
pattern, outdir, szfifo); |
|
|
|
|
fprintf(stderr, ">>> %s ( '%s' -> '%s' %d eff:%d:%d)\n", __func__, |
|
|
|
|
pattern, outdir, szfifo, infx, outfx); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
if (1 != step) fprintf(stderr, "\tstep is %d\n", step); |
|
|
|
@ -94,21 +95,29 @@ fprintf(stderr, "glob '%s' -> %d, %ld files found\n", pattern, foo,
@@ -94,21 +95,29 @@ fprintf(stderr, "glob '%s' -> %d, %ld files found\n", pattern, foo,
|
|
|
|
|
|
|
|
|
|
/* get the size of the inputs images */ |
|
|
|
|
foo = fimg_fileinfos(globbuf.gl_pathv[0], datas); |
|
|
|
|
width = datas[0]; |
|
|
|
|
height = datas[1]; |
|
|
|
|
width = datas[0]; height = datas[1]; |
|
|
|
|
fprintf(stderr, "image size %dx%d\n", width, height); |
|
|
|
|
|
|
|
|
|
fimg_create(&input, width, height, 3); |
|
|
|
|
|
|
|
|
|
/* get the maximum value of the first pic */ |
|
|
|
|
foo = fimg_load_from_dump(globbuf.gl_pathv[0], &input); |
|
|
|
|
if (foo) { |
|
|
|
|
fprintf(stderr, "%s: err %d loading %s\n", |
|
|
|
|
__func__, foo, globbuf.gl_pathv[0]); |
|
|
|
|
exit(1); |
|
|
|
|
} |
|
|
|
|
maxvalue = fimg_get_maxvalue(&input); |
|
|
|
|
fprintf(stderr, "maxvalue %f\n", maxvalue); |
|
|
|
|
|
|
|
|
|
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); |
|
|
|
|
/* XXX inject a few strange pics in the fifo */ |
|
|
|
|
insert_blank(&input, BLANK, outfx, maxvalue); |
|
|
|
|
|
|
|
|
|
for (idx=0; idx<globbuf.gl_pathc; idx++) { |
|
|
|
|
|
|
|
|
|
cptr = globbuf.gl_pathv[idx]; |
|
|
|
|
|
|
|
|
|
/* first step : read the current grabed picz from disk,
|
|
|
|
|
and put it in our private buffer */ |
|
|
|
|
foo = fimg_load_from_dump(cptr, &input); |
|
|
|
@ -116,7 +125,6 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
@@ -116,7 +125,6 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
|
|
|
|
|
fprintf(stderr, "load #%d from dump -> %d\n", idx, foo); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* ========================= */ |
|
|
|
|
/* FSCKING INPUT FILTER HERE */ |
|
|
|
|
foo = crapulator(&input, infx, 0.42); |
|
|
|
@ -124,7 +132,6 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
@@ -124,7 +132,6 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
|
|
|
|
|
fprintf(stderr, "%s crapulator -> %d\n", __func__, foo); |
|
|
|
|
exit(1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
foo = traite_une_image(&input, outfx, step); |
|
|
|
|
if (foo) { |
|
|
|
|
fprintf(stderr, "traitement %s -> %d WTF?\n", cptr, foo); |
|
|
|
@ -132,10 +139,13 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
@@ -132,10 +139,13 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
|
|
|
|
|
} |
|
|
|
|
fprintf(stderr, "\t%5d\r", idx); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fputs("\n", stderr); |
|
|
|
|
|
|
|
|
|
insert_blank(&input, BLANK, outfx); |
|
|
|
|
insert_blank(&input, BLANK*2, outfx, maxvalue); |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* PLEASE, FLUSH THE FIFO ! |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
fin = fimg_timer_get(0); |
|
|
|
|
if (idx) { |
|
|
|
|