refactoring fonderie, step 2

This commit is contained in:
Tonton Th 2020-11-02 22:20:54 +01:00
parent 8cc7695d70
commit 423ab7f0ec
3 changed files with 31 additions and 8 deletions

View File

@ -7,3 +7,16 @@ de **films flous**.
## fonderie ## fonderie
Le programme principal, utilisé à partir de la ligne de commande
avec une foule d'options aux mnémoniques abscons.
Rassurez-vous, en général ils sont wrappables dans des scripts
shell. Il est même possible un jour qu'ils puissent lire des
paramètres dans `$(env)`.
## crapulator
C'est dans ce module qu'est codé le moteur de filtrage, utilisé
aussi bien en entrée qu'en sortie.

View File

@ -27,7 +27,7 @@ fprintf(stderr, ">>> %s ( %p %d %f )\n", __func__,
if (666==count) { if (666==count) {
flag_debug = 1; flag_debug = 1;
fprintf(stderr, "DEBUG POINT 1 in %s\n", __func__); fprintf(stderr, "DEBUG PT 1 in %s:%d\n", __func__, __LINE__);
fimg_save_as_png(image, "source.png", 0); fimg_save_as_png(image, "source.png", 0);
} }
@ -95,7 +95,7 @@ switch (idFx) {
break; break;
case 9: case 9:
retval = fimg_classif_trial(image, image, 0.42, 0); retval = fimg_classif_trial(image, image, 0.37, 0);
if (retval) { if (retval) {
fprintf(stderr, "err %d in classif\n", retval); fprintf(stderr, "err %d in classif\n", retval);
exit(1); exit(1);
@ -109,7 +109,7 @@ switch (idFx) {
} }
if (flag_debug) { if (flag_debug) {
fprintf(stderr, "DEBUG POINT 2 in %s\n", __func__); fprintf(stderr, "DEBUG PT 2 in %s:%d\n", __func__, __LINE__);
fimg_save_as_png(image, "after.png", 0); fimg_save_as_png(image, "after.png", 0);
} }

View File

@ -30,6 +30,10 @@ if (foo) {
} }
sprintf(ligne, "p8/%05d.png", numero); sprintf(ligne, "p8/%05d.png", numero);
/* ^^^
XXX hardcoded value ? wtf ?
*/
foo = export_fifo(ligne, proc, step); foo = export_fifo(ligne, proc, step);
if (foo) { if (foo) {
fprintf(stderr, "%s: err %d on export\n", __func__, foo); fprintf(stderr, "%s: err %d on export\n", __func__, foo);
@ -67,7 +71,7 @@ return 0;
#define BLANK 40 #define BLANK 40
int demarre_la_machine(char *pattern, char *outdir, int szfifo, int demarre_la_machine(char *pattern, char *outdir, int szfifo,
int outfx, int step) int infx, int outfx, int step)
{ {
int foo, idx; int foo, idx;
glob_t globbuf; glob_t globbuf;
@ -84,6 +88,8 @@ fprintf(stderr, "\tstep is %d\n", step);
(void)fimg_timer_set(0); (void)fimg_timer_set(0);
if (infx) fprintf(stderr, "\tin fx #%d\n", infx);
else fprintf(stderr, "\tno in fx\n");
if (outfx) fprintf(stderr, "\tout fx #%d\n", outfx); if (outfx) fprintf(stderr, "\tout fx #%d\n", outfx);
else fprintf(stderr, "\tno out fx\n"); else fprintf(stderr, "\tno out fx\n");
@ -114,7 +120,7 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
/* ========================= */ /* ========================= */
/* FSCKING INPUT FILTER HERE */ /* FSCKING INPUT FILTER HERE */
foo = crapulator(&input, 0, 0.42); foo = crapulator(&input, infx, 0.42);
if (foo) { if (foo) {
fprintf(stderr, "%s crapulator -> %d\n", __func__, foo); fprintf(stderr, "%s crapulator -> %d\n", __func__, foo);
exit(1); exit(1);
@ -152,6 +158,7 @@ puts("\t-I\tinput glob pattern");
puts("\t-O\toutput directory"); puts("\t-O\toutput directory");
puts("\t-T\tfifo size"); puts("\t-T\tfifo size");
puts("\t-v\tincrease verbosity"); puts("\t-v\tincrease verbosity");
puts("\t-w\tinput effect");
puts("\t-x\toutput effect"); puts("\t-x\toutput effect");
exit(0); exit(0);
@ -167,8 +174,8 @@ int in_effect = 0;
int out_effect = 0; int out_effect = 0;
int steps = 1; int steps = 1;
fprintf(stderr, "*** %s : compiled by tTh, %s %s\n", argv[0], fprintf(stderr, "*** %s :\n\tcompiled by tTh, %s %s\n\tpid %d\n",
__DATE__, __TIME__); argv[0], __DATE__, __TIME__, getpid());
fimg_print_version(2); fimg_print_version(2);
while ((opt = getopt(argc, argv, "ghI:O:s:T:vx:")) != -1) { while ((opt = getopt(argc, argv, "ghI:O:s:T:vx:")) != -1) {
@ -186,6 +193,8 @@ while ((opt = getopt(argc, argv, "ghI:O:s:T:vx:")) != -1) {
break; break;
case 'v': verbosity++; case 'v': verbosity++;
break; break;
case 'w': in_effect = atoi(optarg);
break;
case 'x': out_effect = atoi(optarg); case 'x': out_effect = atoi(optarg);
break; break;
case 's': steps = atoi(optarg); case 's': steps = atoi(optarg);
@ -193,7 +202,8 @@ while ((opt = getopt(argc, argv, "ghI:O:s:T:vx:")) != -1) {
} }
} }
foo = demarre_la_machine(in_pattern, out_dir, fifosize, out_effect, steps); foo = demarre_la_machine(in_pattern, out_dir, fifosize, in_effect,
out_effect, steps);
fprintf(stderr, "retour du big-run de la machine -> %d\n", foo); fprintf(stderr, "retour du big-run de la machine -> %d\n", foo);
return 0; return 0;