diff --git a/Fonderie/essai.sh b/Fonderie/essai.sh index 7bccafc3..36c163de 100755 --- a/Fonderie/essai.sh +++ b/Fonderie/essai.sh @@ -3,27 +3,29 @@ # ------------------------------------------------------------ -liste_filtres () +essai_filtres () { -FILTRES="5:6:13 15 2:2 5:9:8 4:25 8:13:13:7 10:1 25:25:25:25 13:14:13" +FILTRES=$(./t -L | awk 'NR>1 { print $1 }' | sort) rm /tmp/fstack*.png +SRC=$(ls -rt1 $HOME/Essais/FondageDePlomb/capture/* | tail -1) + for F in $FILTRES do - I="/tmp/fstack-"$F".png" - echo ; echo ==== $I - ./t -F $F - txt=$(printf "[%-10s]" $F) - convert foo.png -pointsize 24 -kerning 0 \ + echo ; echo ======== $I + ./t -v -i $SRC -F $F -o foo.png + txt=$(printf "( %-10s )" $F) + convert foo.png -pointsize 48 -kerning 0 \ -fill Gray80 -undercolor Gray20 \ -font Courier-Bold \ - -annotate +0+23 "$txt" \ + -annotate +10+50 "$txt" \ $I - done -convert -delay 100 /tmp/fstack*.png foo.gif + +echo ; echo "making gif89a..." +convert -delay 200 /tmp/fstack*.png foo.gif } # ------------------------------------------------------------ essai_single () @@ -46,6 +48,6 @@ ffmpeg -nostdin \ # ------------------------------------------------------------ # MAIN -essai_single +essai_filtres # ------------------------------------------------------------ diff --git a/Fonderie/sfx.c b/Fonderie/sfx.c index 1ee6e047..64c6c11e 100644 --- a/Fonderie/sfx.c +++ b/Fonderie/sfx.c @@ -20,6 +20,28 @@ */ extern int verbosity; +/* -------------------------------------------------------------- */ + +int incrustation_0(FloatImg *src, FloatImg *dst, int k) +{ +int x, y, x4, y4; +float rgb[3]; + +#if DEBUG_LEVEL +fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, src, dst, k); +#endif + +x4 = dst->width / 4, y4 = dst->height / 4; + +for (y=0; ywidth) + x; pimg->R[off] = fvals[0]; pimg->G[off] = fvals[1]; diff --git a/Fonderie/sfx.h b/Fonderie/sfx.h index 62617c01..c70a1966 100644 --- a/Fonderie/sfx.h +++ b/Fonderie/sfx.h @@ -3,6 +3,9 @@ * --------------------------------------------------- */ +int incrustation_0(FloatImg *src, FloatImg *dst, int k); + + int trinitron(FloatImg *pimg, int notused); int bouger_les_pixels(FloatImg *pimg, int kaboo); diff --git a/Fonderie/single.c b/Fonderie/single.c index e271537b..747d1021 100644 --- a/Fonderie/single.c +++ b/Fonderie/single.c @@ -81,48 +81,14 @@ nextpng++; return 0; } /* -------------------------------------------------------------- */ -/* - * test-only function ! - */ -int essayer_single(char *globpattern, char *destdir, int chain) +int single_print_state(char *title, int k) { -FloatImg image; -int idx, foo; +#if DEBUG_LEVEL +fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, title, k); +#endif -fprintf(stderr, ">>> %s ( '%s' '%s' %d )\n", __func__, - globpattern, destdir, chain); - -foo = fimg_create(&image, 640, 480, 3); -if (foo) { - fprintf(stderr, "erreur %d creation image\n", foo); - return foo; - } -fimg_vdeg_a(&image, (double)3.141592654); - -foo = single_init(0, destdir, "none"); -if (foo) { - fprintf(stderr, "erreur %d single_init\n", foo); - return foo; - } - -filterstack_list(chain, "essai du single"); - -for (idx=0; idx<666; idx++) { - - foo = filterstack_run(chain, &image, 0); - if (foo) { - fprintf(stderr, "%s: filterstack run --> %d\n", - __func__, foo); - return foo; - } - - foo = single_push_picture(&image); - if (foo) { - fprintf(stderr, "erreur %d push picture\n", foo); - return foo; - } - - } +fprintf(stderr, "nextpng %d\n", nextpng); +fprintf(stderr, "counter %d\n", counter); return -1; } diff --git a/Fonderie/single.h b/Fonderie/single.h index 6536b69f..1372e4b4 100644 --- a/Fonderie/single.h +++ b/Fonderie/single.h @@ -2,7 +2,6 @@ SINGLE experimental and/or testing code, do not use in production. - */ /* -------------------------------------------------------------- */ @@ -10,12 +9,8 @@ int single_init(int next, char *dest, char *sfxchain); int single_push_picture(FloatImg *pimg); +int single_print_state(char *title, int k); /* -------------------------------------------------------------- */ -/* - * test function - */ -int essayer_single(char *globpattern, char *destdir, int K); - /* -------------------------------------------------------------- */ diff --git a/Fonderie/t.c b/Fonderie/t.c index 3c27e6fb..0ba15d98 100644 --- a/Fonderie/t.c +++ b/Fonderie/t.c @@ -67,24 +67,90 @@ fimg_destroy(&image); return 0; } /* ----------------------------------------------------------- */ +/* + * test-only function ! + +foo = essayer_single("capture/???42.fimg", "/tmp/x8/", STK); +fprintf(stderr, "essayer single -> %d\n", foo); + + + */ +int essayer_single(char *globpattern, char *destdir, int chain) +{ +FloatImg image; +int idx, foo; + +fprintf(stderr, ">>> %s ( '%s' '%s' %d )\n", __func__, + globpattern, destdir, chain); + +foo = fimg_create(&image, 640, 480, 3); +if (foo) { + fprintf(stderr, "erreur %d creation image\n", foo); + return foo; + } +fimg_vdeg_a(&image, (double)3.141592654); + +foo = single_init(0, destdir, "none"); +if (foo) { + fprintf(stderr, "erreur %d single_init\n", foo); + return foo; + } + +filterstack_list(chain, "essai du single"); + +for (idx=0; idx<666; idx++) { + + foo = filterstack_run(chain, &image, 0); + if (foo) { + fprintf(stderr, "%s: filterstack run --> %d\n", + __func__, foo); + return foo; + } + + foo = single_push_picture(&image); + if (foo) { + fprintf(stderr, "erreur %d push picture\n", foo); + return foo; + } + + } + +return -1; +} +/* ----------------------------------------------------------- */ + int help(void) { puts("yolo!"); +puts("\t-F\tdefine:the:filter:chain"); puts("\t-L\tlist available filters"); +puts("\t-i\tinfile.fimg"); +puts("\t-o\tinfile.xxx"); + exit(0); } /* ----------------------------------------------------------- */ -void experiment(void) +int experiment(void) { int foo; +FloatImg image, dest; fprintf(stderr, "EXPERIMENT\n"); -foo = essayer_single("capture/???42.fimg", "/tmp/x8/", STK); +foo = fimg_create_from_dump("01137.fimg", &image); +if (foo) { + fprintf(stderr, "%s: err %d on create\n", __func__, foo); + return -1; + } -fprintf(stderr, "essayer single -> %d\n", foo); +foo = fimg_clone(&image, &dest, 1); +foo = fimg_copy_data(&image, &dest); + +incrustation_0(&image, &dest, 0); + +fimg_export_picture(&dest, "foo.png", 0); exit(0); /* back to real world */ } @@ -96,7 +162,7 @@ int foo; int opt, do_xper = 0; char *filterchain = "0"; char *infile = "mire.fimg"; -char *outfile = "out.png"; +char *outfile = PNG; char *outdir = "/tmp/x8/"; fprintf(stderr, "*** %s : compiled by tTh, %s %s\n", __FILE__, @@ -130,6 +196,7 @@ if (foo) { if (do_xper) { experiment(); + return 0; } foo = essai_filterstack(infile, outfile);