From e0d154c37ef3eecef043540bac078fb097f5f344 Mon Sep 17 00:00:00 2001 From: Tonton Th Date: Thu, 5 Nov 2020 21:07:38 +0100 Subject: [PATCH] is fonderie ok ? --- Fonderie/Makefile | 2 +- Fonderie/README.md | 15 ++++++++------- Fonderie/crapulator.c | 8 ++++++-- Fonderie/fonderie.c | 44 ++++++++++++++++++++++++++----------------- Fonderie/sfx.c | 25 +++++++++++------------- README.md | 2 ++ 6 files changed, 55 insertions(+), 41 deletions(-) diff --git a/Fonderie/Makefile b/Fonderie/Makefile index 3b951fe9..ccf71eb7 100644 --- a/Fonderie/Makefile +++ b/Fonderie/Makefile @@ -1,6 +1,6 @@ -COPT = -g -pg -no-pie -Wall -DDEBUG_LEVEL=0 -Werror=parentheses +COPT = -g -no-pie -Wall -DDEBUG_LEVEL=0 -Werror=parentheses LIBS = -lfloatimg -lpnglite -lm OBJS = fonctions.o sfx.o crapulator.o DEPS = fonctions.h crapulator.h diff --git a/Fonderie/README.md b/Fonderie/README.md index 1aede326..3f91be4e 100644 --- a/Fonderie/README.md +++ b/Fonderie/README.md @@ -10,8 +10,8 @@ de **films flous**. 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 +Rassurez-vous, en général il est wrappable dans des scripts +écrits en Bash. Il est même possible un jour qu'ils puissent lire des paramètres dans `$(env)`. ``` @@ -45,16 +45,17 @@ GLOB=${GRABDIR}'/?????.fimg' ${FONDEUR} -v -T 40 -I "$GLOB" -w 10 -x 0 ``` + Ensuite il suffit d'encoder toutes les images générées dans `p8/` (répertoire de sortie par défaut avec une incantation de ffmpeg : ``` -ffmpeg -nostdin \ - -loglevel error \ - -y -r 30 -f image2 -i p8/%05d.png \ - -c:v libx264 -pix_fmt yuv420p \ - foo.mp4 +ffmpeg -nostdin \ + -loglevel error \ + -y -r 30 -f image2 -i p8/%05d.png \ + -c:v libx264 -pix_fmt yuv420p \ + foo.mp4 ``` ## crapulator.c diff --git a/Fonderie/crapulator.c b/Fonderie/crapulator.c index 75485f4e..c974dd13 100644 --- a/Fonderie/crapulator.c +++ b/Fonderie/crapulator.c @@ -55,8 +55,8 @@ return 0; */ int crapulator(FloatImg *image, int idFx, float fval) { -int retval, foo; -FloatImg imgtmp; +int retval; +// FloatImg imgtmp; static int count = 0; int flag_debug = 0; @@ -116,6 +116,10 @@ switch (idFx) { } break; + case 10: + retval = binarize(image, 0); + break; + default : fprintf(stderr, "%s : effect #%d invalid\n", __func__, idFx); diff --git a/Fonderie/fonderie.c b/Fonderie/fonderie.c index 7b1f137b..b4a7a227 100644 --- a/Fonderie/fonderie.c +++ b/Fonderie/fonderie.c @@ -41,13 +41,13 @@ numero++; /* VERY IMPORTANT :) */ return 0; } /* -------------------------------------------------------------- */ -int insert_blank(FloatImg *image, int nbre, int pproc) +int insert_blank(FloatImg *image, int nbre, int pproc, float fval) { int idx, foo; fimg_clear(image); for (idx=0; idx>> %s ( '%s' -> '%s' %d )\n", __func__, - pattern, outdir, szfifo); +fprintf(stderr, ">>> %s ( '%s' -> '%s' %d eff:%d:%d)\n", __func__, + pattern, outdir, szfifo, infx, outfx); #endif if (1 != step) fprintf(stderr, "\tstep is %d\n", step); @@ -94,21 +95,29 @@ fprintf(stderr, "glob '%s' -> %d, %ld files found\n", pattern, foo, /* get the size of the inputs images */ foo = fimg_fileinfos(globbuf.gl_pathv[0], datas); -width = datas[0]; -height = datas[1]; +width = datas[0]; height = datas[1]; +fprintf(stderr, "image size %dx%d\n", width, height); + +fimg_create(&input, width, height, 3); + +/* get the maximum value of the first pic */ +foo = fimg_load_from_dump(globbuf.gl_pathv[0], &input); +if (foo) { + fprintf(stderr, "%s: err %d loading %s\n", + __func__, foo, globbuf.gl_pathv[0]); + exit(1); + } +maxvalue = fimg_get_maxvalue(&input); +fprintf(stderr, "maxvalue %f\n", maxvalue); foo = create_fifo(szfifo, width, height, FIMG_TYPE_RGB); fprintf(stderr, "init fifo (%d slots) --> %d\n", szfifo, foo); -fimg_create(&input, width, height, 3); - -/* XXX inject a few stange pics in the fifo */ -insert_blank(&input, BLANK, outfx); +/* XXX inject a few strange pics in the fifo */ +insert_blank(&input, BLANK, outfx, maxvalue); for (idx=0; idx %d\n", idx, foo); continue; } - /* ========================= */ /* FSCKING INPUT FILTER HERE */ foo = crapulator(&input, infx, 0.42); @@ -124,7 +132,6 @@ for (idx=0; idx %d\n", __func__, foo); exit(1); } - foo = traite_une_image(&input, outfx, step); if (foo) { fprintf(stderr, "traitement %s -> %d WTF?\n", cptr, foo); @@ -132,10 +139,13 @@ for (idx=0; idx>> %s ( %p %d )\n", __func__, pimg, notused); @@ -34,19 +33,17 @@ mG = (mm[3] - mm[2]) / 2.0; mB = (mm[5] - mm[4]) / 2.0; if (verbosity > 1) - fprintf(stderr, "%s: %f %f %f\n", __func__, mR, mG, mB); + fprintf(stderr, "%s: %f %f %f\n", __func__, mR, mG, mB); -for (y=0; yheight; y++) { - for (x=0; xwidth; x++) { - fimg_get_rgb(pimg, x, y, rgb); - if (rgb[0] < mR) rgb[0] = mm[0]; - else rgb[0] = mm[1]; - if (rgb[1] < mG) rgb[1] = mm[2]; - else rgb[1] = mm[3]; - if (rgb[2] < mB) rgb[2] = mm[4]; - else rgb[2] = mm[5]; - fimg_put_rgb(pimg, x, y, rgb); - } +size = pimg->width * pimg->height; + +for (foo=0; fooR[foo] < mR) pimg->R[foo] = mm[0]; + else pimg->R[foo] = mm[1]; + if (pimg->G[foo] < mG) pimg->G[foo] = mm[2]; + else pimg->G[foo] = mm[3]; + if (pimg->B[foo] < mB) pimg->B[foo] = mm[4]; + else pimg->B[foo] = mm[5]; } return 0; diff --git a/README.md b/README.md index dfd29c23..01070f05 100644 --- a/README.md +++ b/README.md @@ -46,3 +46,5 @@ Certains outils externes sont aussi utiles : Encore trop légère, mais déja [présente](doc/). C'est à vous de compiler le [PDF](http://la.buvette.org/photos/cumul/the_floatimg_hack.pdf) + +Your mileage may vary...