From 538a8ffa8236cae2eaa9e09f04e2c7ac32ab5a8d Mon Sep 17 00:00:00 2001 From: le vieux Date: Mon, 9 Nov 2020 20:27:57 +0100 Subject: [PATCH] importing the Interpolator for R325 project --- .gitignore | 1 + Fonderie/Makefile | 9 ++- Fonderie/README.md | 7 ++- Fonderie/interpolator.c | 118 ++++++++++++++++++++++++++++++++++++++++ tools/cumulfimgs.c | 21 +++++-- tools/png2fimg.c | 11 +++- 6 files changed, 154 insertions(+), 13 deletions(-) create mode 100644 Fonderie/interpolator.c diff --git a/.gitignore b/.gitignore index ac86982..f2e1d89 100644 --- a/.gitignore +++ b/.gitignore @@ -65,4 +65,5 @@ tools/*.tiff Fonderie/*.o Fonderie/fonderie +Fonderie/interpolator diff --git a/Fonderie/Makefile b/Fonderie/Makefile index fabcc67..4a15b84 100644 --- a/Fonderie/Makefile +++ b/Fonderie/Makefile @@ -20,11 +20,10 @@ sfx.o: sfx.c ${DEPS} Makefile gcc ${COPT} -c $< # --------------------------------------------------------- +# +# another way... -TOTAR = *.c *.h Makefile \ - *.sh - - +interpolator: interpolator.c Makefile + gcc ${COPT} $< ${LIBS} -lz -o $@ # --------------------------------------------------------- - diff --git a/Fonderie/README.md b/Fonderie/README.md index 61acb8e..fccc702 100644 --- a/Fonderie/README.md +++ b/Fonderie/README.md @@ -1,11 +1,11 @@ -# Fonderie +# Fonderie et Interpolator Avec toutes ces fonctions disponibles et `grabvidseq`, nous savons faire des images **floues***. L'étape suivante, les plus pervers d'entre vous le savent déja, est celle de la création de **films flous**. -## fonderie +## Fonderie Le programme principal, utilisé à partir de la ligne de commande avec une foule d'options aux mnémoniques abscons. @@ -65,5 +65,8 @@ aussi bien en entrée qu'en sortie. Il est, à l'heure actuelle, assez rudimentaire, avec un paramétrage simpliste, et un manque criant de documentation... +## Interpolator + + **Use the source, Luke** diff --git a/Fonderie/interpolator.c b/Fonderie/interpolator.c new file mode 100644 index 0000000..d5b937d --- /dev/null +++ b/Fonderie/interpolator.c @@ -0,0 +1,118 @@ +/* + * INTERPOLATOR 2070 + * + * Don't use that software in real life ! + * + * imported in FloatImg Mon Nov 9 19:08:57 CET 2020 + * + */ +#include +#include +#include +#include +#include + +#include "../floatimg.h" + +// XXX #include "fonctions.h" + +int verbosity; + +/* -------------------------------------------------------------- */ +int interpolator(char *pattern, char *outdir, int Nsteps) +{ +FloatImg A, B, Out, *pFirst, *pSecond, *pTmp; +glob_t globbuf; +int foo, idx, ipng, w, h, step; +int iarray[3]; +char *cptr, line[200]; +float coef; + +fprintf(stderr, "\nfrom %s to %s with %d steps.\n", pattern, outdir, Nsteps); + +memset(&globbuf, 0, sizeof(glob_t)); +foo = glob(pattern, 0, NULL, &globbuf); +fprintf(stderr, "globbing '%s' -> %d, %ld files found\n", + pattern, foo, globbuf.gl_pathc); + +if (0 == globbuf.gl_pathc) { + fprintf(stderr, "%s : no file found, aborting\n", __func__); + return -1; + } + +foo = fimg_fileinfos(globbuf.gl_pathv[0], iarray); +w = iarray[0], h = iarray[1]; +fprintf(stderr, "\tfirst image size : %dx%d\n", w, h); + +fimg_create(&A, w, h, 3); pFirst = &A; +fimg_create(&B, w, h, 3); pSecond = &B; +fimg_create(&Out, w, h, 3); + +pTmp = NULL; + +ipng = 0; +for (idx=0; idx %d\n", idx, foo); + continue; + } + + for (step=0; step \n"); + exit(1); + } + +nbrsteps = atoi(argv[3]); + +foo = interpolator(argv[1], argv[2], nbrsteps); + +fprintf(stderr, "interpolator -> %d\n", foo); + +return 0; +} +/* -------------------------------------------------------------- */ diff --git a/tools/cumulfimgs.c b/tools/cumulfimgs.c index 51277cc..7b89c2f 100644 --- a/tools/cumulfimgs.c +++ b/tools/cumulfimgs.c @@ -56,6 +56,7 @@ int to_gray = 0; char *output_file = "out.fimg"; FloatImg accu, temp; int src_loaded = 0; +float vals[6]; g_width = g_height = 0; @@ -74,11 +75,9 @@ fprintf(stderr, "argc = %d, optind = %d\n", argc, optind); #endif for (idx=optind; idx %d\n", argv[idx],foo); @@ -98,12 +97,9 @@ for (idx=optind; idx FIMG + * + * Attention : certains fichiers PNG ne passent pas cette + * moulinette, mais le bug est dans la bibliotheque de + * fonctions 'libpnglite'. Une solution de remplacement + * devrait etre a l'etude un de ces jours... */ #include @@ -17,6 +22,10 @@ int main(int argc, char *argv[]) FloatImg fimg; int foo; + /* + * pas de traitement des options ? + */ + if (3 != argc) { fimg_print_version(1); fprintf(stderr, "usage:\n\t%s foo.png bar.fimg\n", argv[0]); @@ -31,7 +40,7 @@ if (foo) { exit(1); } -fimg_describe(&fimg, argv[2]); +if (verbosity) fimg_describe(&fimg, argv[2]); foo = fimg_dump_to_file(&fimg, argv[2], 0); fprintf(stderr, "save as fimg -> %d\n", foo);