Compare commits

..

2 Commits

Author SHA1 Message Date
tth
3fce2b19c5 commit whitout testing :) 2021-02-22 14:44:02 +01:00
tth
568811eb90 + verbosity option 2021-02-22 14:22:41 +01:00
3 changed files with 51 additions and 17 deletions

View File

@ -120,10 +120,6 @@ int insert_picture(FloatImg *src)
FloatImg *dst; FloatImg *dst;
int nbre; int nbre;
/*
* this is the where we can insert the 'input filter'
*/
dst = &g_fifo.slots[g_fifo.next]; dst = &g_fifo.slots[g_fifo.next];
nbre = dst->width * dst->height * sizeof(float); nbre = dst->width * dst->height * sizeof(float);

View File

@ -43,20 +43,49 @@ int insert_blank(FloatImg *image, int nbre, int pproc,
float fval, char *outd) float fval, char *outd)
{ {
int idx, foo; int idx, foo;
int preloaded = 0;
FloatImg blank;
char *fname;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %d %d %f '%s' )\n", __func__,
image, nbre, pproc, fval, outd);
#endif
if (NULL != (fname=getenv("BLANK_FIMG"))) {
fprintf(stderr,"try to load %s\n", fname);
fimg_clone(image, &blank, 1);
foo = fimg_load_from_dump(fname, &blank);
if (foo) {
fprintf(stderr, "epic fail %d on %s\n", foo, fname);
exit(1);
}
if (verbosity) fimg_describe(&blank, "Blank pic");
preloaded = 1;
}
fimg_clear(image); fimg_clear(image);
for (idx=0; idx<nbre; idx++) { for (idx=0; idx<nbre; idx++) {
fimg_vdeg_a(image, fval); if (preloaded) {
// brotche_rand48_b(image, drand48()*0.10, 1e5); fimg_copy_data(&blank, image);
}
else {
fimg_hdeg_a(image, fval);
}
if ((foo=traite_une_image(image, pproc, 1, outd))) { 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;
} }
printf("\t%c\r", "ABCDEF"[idx%6]); fflush(stdout); printf("\t%c\r", "ABCDEFGH"[idx%8]); fflush(stdout);
} }
puts(""); puts("");
if (preloaded) {
fimg_destroy(&blank);
}
return 0; return 0;
} }
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */

View File

@ -16,33 +16,42 @@
int verbosity = 0; int verbosity = 0;
/* --------------------------------------------------------------------- */
void help(int k)
{
if (verbosity) fimg_print_version(k);
exit(0);
}
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
FloatImg fimg; FloatImg fimg;
int foo; int foo, opt;
/* while ((opt = getopt(argc, argv, "hv")) != -1) {
* pas de traitement des options ? switch(opt) {
*/ case 'v': verbosity++; break;
case 'h': help(1); exit(1);
}
}
if (3 != argc) { if (2 != argc-optind) {
fimg_print_version(1); fprintf(stderr, "error: %s need two filenames\n", argv[0]);
fprintf(stderr, "usage:\n\t%s foo.png bar.fimg\n", argv[0]);
exit(1); exit(1);
} }
memset(&fimg, 0, sizeof(FloatImg)); memset(&fimg, 0, sizeof(FloatImg));
foo = fimg_create_from_png(argv[1], &fimg); foo = fimg_create_from_png(argv[optind], &fimg);
if (foo) { if (foo) {
fprintf(stderr, "%s : err %d, abort.\n", argv[0], foo); fprintf(stderr, "%s : err %d, abort.\n", argv[0], foo);
exit(1); exit(1);
} }
if (verbosity) fimg_describe(&fimg, argv[2]); if (verbosity) fimg_describe(&fimg, argv[optind+1]);
foo = fimg_dump_to_file(&fimg, argv[2], 0); foo = fimg_dump_to_file(&fimg, argv[optind+1], 0);
if (foo) { if (foo) {
fprintf(stderr, "save as '%s' -> err %d\n", argv[2], foo); fprintf(stderr, "save as '%s' -> err %d\n", argv[2], foo);
exit(1); exit(1);