working on singlepass

This commit is contained in:
tth 2021-04-18 11:55:59 +02:00
parent 34ab825670
commit 2b03f3f516
4 changed files with 24 additions and 13 deletions

View File

@ -20,20 +20,22 @@
/* /*
* singleton/private variables * singleton/private variables
*/ */
static int nextpng, counter; static int nextpng, counter;
static char *destination; static char *destination;
static int chainfilter; static int chainfilter;
/* and the classic global var */
extern int verbosity;
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
int single_init(int next, char *dest, int fxchain) int single_init(int next, char *dest, int fxchain, int outfmt)
{ {
int foo; int foo;
struct stat stbuf; struct stat stbuf;
#if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %d '%s' %d )\n", __func__, fprintf(stderr, ">>> %s ( %d '%s' %d %d )\n", __func__,
next, dest, fxchain); next, dest, fxchain, outfmt);
#endif #endif
nextpng = next; nextpng = next;

View File

@ -6,7 +6,7 @@
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
int single_init(int next, char *dest, int fxchain); int single_init(int next, char *dest, int fxchain, int outfmt);
int single_push_picture(FloatImg *pimg); int single_push_picture(FloatImg *pimg);
int single_print_state(char *title, int k); int single_print_state(char *title, int k);

View File

@ -23,7 +23,8 @@
int verbosity; int verbosity;
/* ----------------------------------------------------------- */ /* ----------------------------------------------------------- */
int run_the_singlepass(char *globber, char *destdir, int fchain) int run_the_singlepass(char *globber, char *destdir,
int fchain, int outfmt)
{ {
FloatImg image = { 0 }; FloatImg image = { 0 };
int idx, foo; int idx, foo;
@ -32,15 +33,15 @@ char *fname;
double elapsed; double elapsed;
#if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( '%s' '%s' %d )\n", __func__, fprintf(stderr, ">>> %s ( '%s' '%s' %d %d )\n", __func__,
globber, destdir, fchain); globber, destdir, fchain, outfmt);
#endif #endif
// filterstack_list(fchain, "Run the single pass"); // filterstack_list(fchain, "Run the single pass");
(void)fimg_timer_set(0); (void)fimg_timer_set(0);
foo = single_init(0, destdir, fchain); foo = single_init(0, destdir, fchain, outfmt);
if (foo) { if (foo) {
fprintf(stderr, "erreur %d single_init\n", foo); fprintf(stderr, "erreur %d single_init\n", foo);
return foo; return foo;
@ -106,8 +107,10 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
fprintf(stderr, "\n"); fprintf(stderr, "\n");
globfree(&globbuf);
fimg_destroy(&image); fimg_destroy(&image);
single_print_state("end of run :)", 0); single_print_state("end of run", 0);
elapsed = fimg_timer_get(0); elapsed = fimg_timer_get(0);
fprintf(stderr, "%s: %ld frames, elapsed %.3f s, %.3f fps\n", fprintf(stderr, "%s: %ld frames, elapsed %.3f s, %.3f fps\n",
@ -139,12 +142,18 @@ int foo, opt;
char *filterchain = "none"; char *filterchain = "none";
char *globbing = "./capture/?????.fimg"; char *globbing = "./capture/?????.fimg";
char *outdir = "./p8"; char *outdir = "./p8";
char *outtype = ".png";
int do_xper = 0; int do_xper = 0;
fprintf(stderr, "*** %s : compiled %s %s\n", __FILE__, fprintf(stderr, "*** %s : compiled %s %s\n", __FILE__,
__DATE__, __TIME__); __DATE__, __TIME__);
fimg_print_version(2); fimg_print_version(2);
if (argc < 2) {
fprintf(stderr, "\t/!\\ %s is option driven\n", argv[0]);
help();
}
while ((opt = getopt(argc, argv, "hF:g:LO:svx")) != -1) { while ((opt = getopt(argc, argv, "hF:g:LO:svx")) != -1) {
switch (opt) { switch (opt) {
case 'h': help(); break; case 'h': help(); break;
@ -179,11 +188,11 @@ if (verbosity) {
fprintf(stderr, "\tpid %d\n", getpid()); fprintf(stderr, "\tpid %d\n", getpid());
fprintf(stderr, "\tinput glob %s\n", globbing); fprintf(stderr, "\tinput glob %s\n", globbing);
fprintf(stderr, "\tfilter chain %s\n", filterchain); fprintf(stderr, "\tfilter chain %s\n", filterchain);
fprintf(stderr, "\tourput dir %s\n", outdir); fprintf(stderr, "\toutput dir %s\n", outdir);
fprintf(stderr, "\tdo xper %d\n", do_xper); fprintf(stderr, "\tdo xper %d\n", do_xper);
} }
foo = run_the_singlepass(globbing, outdir, FILTERS); foo = run_the_singlepass(globbing, outdir, FILTERS, -1);
fprintf(stderr, "\n\tRun the single pass --> %d\n", foo); fprintf(stderr, "\n\tRun the single pass --> %d\n", foo);
return 0; return 0;

View File

@ -89,7 +89,7 @@ fprintf(stderr, ">>> %s ( '%s' '%s' %d )\n", __func__,
filterstack_list(chain, "essai du single"); filterstack_list(chain, "essai du single");
foo = single_init(0, destdir, chain); foo = single_init(0, destdir, chain, -1);
if (foo) { if (foo) {
fprintf(stderr, "erreur %d single_init\n", foo); fprintf(stderr, "erreur %d single_init\n", foo);
return foo; return foo;