From 423ab7f0eca3e74777b24f795fadf075c0066138 Mon Sep 17 00:00:00 2001 From: Tonton Th Date: Mon, 2 Nov 2020 22:20:54 +0100 Subject: [PATCH] refactoring fonderie, step 2 --- Fonderie/README.md | 13 +++++++++++++ Fonderie/crapulator.c | 6 +++--- Fonderie/fonderie.c | 20 +++++++++++++++----- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/Fonderie/README.md b/Fonderie/README.md index aefc9d8..ca7e8c1 100644 --- a/Fonderie/README.md +++ b/Fonderie/README.md @@ -7,3 +7,16 @@ de **films flous**. ## 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. + diff --git a/Fonderie/crapulator.c b/Fonderie/crapulator.c index 977ea99..dc5acfd 100644 --- a/Fonderie/crapulator.c +++ b/Fonderie/crapulator.c @@ -27,7 +27,7 @@ fprintf(stderr, ">>> %s ( %p %d %f )\n", __func__, if (666==count) { 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); } @@ -95,7 +95,7 @@ switch (idFx) { break; case 9: - retval = fimg_classif_trial(image, image, 0.42, 0); + retval = fimg_classif_trial(image, image, 0.37, 0); if (retval) { fprintf(stderr, "err %d in classif\n", retval); exit(1); @@ -109,7 +109,7 @@ switch (idFx) { } 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); } diff --git a/Fonderie/fonderie.c b/Fonderie/fonderie.c index 6c5a013..fa8e303 100644 --- a/Fonderie/fonderie.c +++ b/Fonderie/fonderie.c @@ -30,6 +30,10 @@ if (foo) { } sprintf(ligne, "p8/%05d.png", numero); +/* ^^^ + XXX hardcoded value ? wtf ? + */ + foo = export_fifo(ligne, proc, step); if (foo) { fprintf(stderr, "%s: err %d on export\n", __func__, foo); @@ -67,7 +71,7 @@ return 0; #define BLANK 40 int demarre_la_machine(char *pattern, char *outdir, int szfifo, - int outfx, int step) + int infx, int outfx, int step) { int foo, idx; glob_t globbuf; @@ -84,6 +88,8 @@ fprintf(stderr, "\tstep is %d\n", step); (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); else fprintf(stderr, "\tno out fx\n"); @@ -114,7 +120,7 @@ for (idx=0; idx %d\n", __func__, foo); exit(1); @@ -152,6 +158,7 @@ puts("\t-I\tinput glob pattern"); puts("\t-O\toutput directory"); puts("\t-T\tfifo size"); puts("\t-v\tincrease verbosity"); +puts("\t-w\tinput effect"); puts("\t-x\toutput effect"); exit(0); @@ -167,8 +174,8 @@ int in_effect = 0; int out_effect = 0; int steps = 1; -fprintf(stderr, "*** %s : compiled by tTh, %s %s\n", argv[0], - __DATE__, __TIME__); +fprintf(stderr, "*** %s :\n\tcompiled by tTh, %s %s\n\tpid %d\n", + argv[0], __DATE__, __TIME__, getpid()); fimg_print_version(2); 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; case 'v': verbosity++; break; + case 'w': in_effect = atoi(optarg); + break; case 'x': out_effect = atoi(optarg); break; 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); return 0;