From ccd324749ecd993c7c03abc6c6d1b9cfc4c9ead6 Mon Sep 17 00:00:00 2001 From: tTh Date: Sat, 8 Jan 2022 17:48:18 +0100 Subject: [PATCH] first external contrib --- .gitignore | 3 ++ README.md | 4 +++ contrib/Makefile | 7 ++++ contrib/README.md | 4 +++ contrib/fimg2povhf.c | 82 ++++++++++++++++++++++++++++++++++++++++++++ floatimg.h | 2 +- v4l2/funcs.c | 1 + 7 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 contrib/Makefile create mode 100644 contrib/README.md create mode 100644 contrib/fimg2povhf.c diff --git a/.gitignore b/.gitignore index b3ae175..d3d7532 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,8 @@ lib/*.gif *.a gmon.out +*.swp + *.pnm *.fimg essai @@ -88,4 +90,5 @@ experiment/muxplanes experiment/movepixels experiment/tcache +contrib/fimg2povhf diff --git a/README.md b/README.md index 1399245..e38f08b 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,10 @@ apt install libv4l2-dev apt install libcfitsio-dev apt install libnetpbm-dev ``` +Il est probable que j'en oublient. Ensuite, j'ai dans l'idée de construire +um met-packet à la sauce Debian pour installer facilement tout ce +qui sert à faire fonctionner ce kluge. Ensuite, j'irais voir du +coté de pkg-config. Certains outils externes sont aussi utiles : diff --git a/contrib/Makefile b/contrib/Makefile new file mode 100644 index 0000000..bbb489b --- /dev/null +++ b/contrib/Makefile @@ -0,0 +1,7 @@ + +DBGL = '-DDEBUG_LEVEL=1' + +fimg2povhf: fimg2povhf.c Makefile + gcc -Wall $(DBGL) $< -limage -lfloatimg -lm -o $@ + + diff --git a/contrib/README.md b/contrib/README.md new file mode 100644 index 0000000..e3bba64 --- /dev/null +++ b/contrib/README.md @@ -0,0 +1,4 @@ +# Contributions + +Need some external garbage, sorry. + diff --git a/contrib/fimg2povhf.c b/contrib/fimg2povhf.c new file mode 100644 index 0000000..d667a23 --- /dev/null +++ b/contrib/fimg2povhf.c @@ -0,0 +1,82 @@ +/* + * convertir une image flottante en champ d'altitude + * + * nouveau 64 ernest renan - 20220108 + */ + +#include +#include + +#include "tthimage.h" +#include "floatimg.h" + +int verbosity; + +/* ------------------------------------------------------------------ */ +int This_is_the_real_conversion(FloatImg *fimg, Image_Desc *hf, int k) +{ +FloatImg mixed; +int foo; +float minmax[6]; + + +#if DEBUG_LEVEL +fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, fimg, hf, k); +#endif + +foo = fimg_get_minmax_rgb(fimg, minmax); +fimg_print_minmax(minmax, "source"); + +return FULL_NUCKED; +} +/* ------------------------------------------------------------------ */ +int Convertir_Fimg_to_Povhf(char *fimgname, char *hfname, int k) +{ +FloatImg fimg; +Image_Desc *hf; +int wid, hei; +int foo; + +#if DEBUG_LEVEL +fprintf(stderr, ">>> %s ( %s %s %d )\n", __func__, fimgname, hfname, k); +#endif + +foo = fimg_create_from_dump(fimgname, &fimg); +fprintf(stderr, "load of %s --> %d\n", fimgname, foo); +if (foo) { + return foo; + } + +wid = fimg.width; hei = fimg.height; // nice alias +fprintf(stderr, "picture size %dx%d\n", wid, hei); + +hf = Image_alloc(wid, hei, IMAGE_RGB); +fprintf(stderr, "hf alloc -> %p\n", hf); +if (NULL == hf) { + return NULL_POINTER; + } + +foo = This_is_the_real_conversion(&fimg, hf, k); +fprintf(stderr, "real conversion -> %d\n", foo); + +return FULL_NUCKED; +} +/* ------------------------------------------------------------------ */ + +int main(int argc, char *argv[]) +{ +int foo; + +verbosity = 1; + +Image_print_version(3); +fimg_print_version(3); + + +foo = Convertir_Fimg_to_Povhf("foo.fimg", "out.tga", 0); +fprintf(stderr, "retour conversion was %d\n", foo); + +return 0; +} + +/* ------------------------------------------------------------------ */ diff --git a/floatimg.h b/floatimg.h index ac73fee..9450db2 100644 --- a/floatimg.h +++ b/floatimg.h @@ -4,7 +4,7 @@ * http://la.buvette.org/photos/cumul */ -#define FIMG_VERSION 164 +#define FIMG_VERSION 166 /* * in memory descriptor diff --git a/v4l2/funcs.c b/v4l2/funcs.c index a447452..9fe97e6 100644 --- a/v4l2/funcs.c +++ b/v4l2/funcs.c @@ -5,6 +5,7 @@ #include #include #include +#include #include /* low-level i/o */ #include