more work on the Fonderie

This commit is contained in:
tth
2021-05-11 10:36:55 +02:00
parent daeb4c72a7
commit cc79dd5152
10 changed files with 80 additions and 12 deletions

View File

@@ -15,6 +15,7 @@
#include "crapulator.h"
#include "filterstack.h"
#include "single.h"
#include "glitches.h"
/* ----------------------------------------------------------- */
@@ -23,11 +24,11 @@
int verbosity;
/* ----------------------------------------------------------- */
int run_the_singlepass(char *globber, char *destdir,
int run_the_singlepass(char *globber, char *destdir, int duplic,
int fchain, int outfmt)
{
FloatImg image = { 0 };
int idx, foo;
int idx, foo, loop;
glob_t globbuf;
char *fname;
double elapsed;
@@ -98,10 +99,17 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
return foo;
}
foo = single_push_picture(&image);
if (foo) {
fprintf(stderr, "error %d on push_picture\n", foo);
return foo;
/* HERE WE CAN REPEAT THE INSERT OF THE PICZ */
for (loop=0; loop<duplic; loop++) {
foo = single_push_picture(&image);
if (foo) {
fprintf(stderr, "error %d on push_picture\n", foo);
return foo;
}
if (loop) {
/* this is just a wip XXX */
microglitch(&image, loop);
}
}
}
@@ -129,6 +137,7 @@ puts("\t-F\tdefine:the:filter:chain");
puts("\t-g\tinput glob pattern");
puts("\t-L\tlist available filters");
puts("\t-O\t/output/directory (default ./p8)");
puts("\t-r N\trepetiiing factor");
// puts("\t-s\tdo single test");
puts("\t-v\tspit more messages");
@@ -144,6 +153,7 @@ char *globbing = "./capture/?????.fimg";
char *outdir = "./p8";
// char *outtype = ".png";
int do_xper = 0;
int repeat = 1;
fprintf(stderr, "*** %s : compiled %s %s\n", __FILE__,
__DATE__, __TIME__);
@@ -154,7 +164,7 @@ if (argc < 2) {
help();
}
while ((opt = getopt(argc, argv, "hF:g:LO:svx")) != -1) {
while ((opt = getopt(argc, argv, "hF:g:LO:r:svx")) != -1) {
switch (opt) {
case 'h': help(); break;
@@ -167,6 +177,8 @@ while ((opt = getopt(argc, argv, "hF:g:LO:svx")) != -1) {
case 'O': outdir = optarg; break;
case 'r': repeat = atoi(optarg); break;
case 'v': verbosity++; break;
case 'x': do_xper = 1; break;
@@ -178,6 +190,11 @@ while ((opt = getopt(argc, argv, "hF:g:LO:svx")) != -1) {
}
if (repeat < 1) {
fprintf(stderr, "%s: loop %d invalid\n", argv[0], repeat);
exit(2);
}
foo = parse_filter_chain(FILTERS, filterchain);
if (foo) {
fprintf(stderr, "err %d in parse_filter_chain\n", foo);
@@ -189,11 +206,13 @@ if (verbosity) {
fprintf(stderr, "\tinput glob %s\n", globbing);
fprintf(stderr, "\tfilter chain %s\n", filterchain);
fprintf(stderr, "\toutput dir %s\n", outdir);
fprintf(stderr, "\trepeat %d\n", repeat);
// fprintf(stderr, "\toutput type %s\n", outtype);
fprintf(stderr, "\tdo xper %d\n", do_xper);
}
foo = run_the_singlepass(globbing, outdir, FILTERS, FILE_TYPE_PNG);
foo = run_the_singlepass(globbing, outdir, repeat,
FILTERS, FILE_TYPE_PNG);
fprintf(stderr, "\n\tRun the single pass --> %d\n", foo);
return 0;