first external contrib

This commit is contained in:
tTh 2022-01-08 17:48:18 +01:00
parent ab9e4b0250
commit ccd324749e
7 changed files with 102 additions and 1 deletions

3
.gitignore vendored
View File

@ -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

View File

@ -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 :

7
contrib/Makefile Normal file
View File

@ -0,0 +1,7 @@
DBGL = '-DDEBUG_LEVEL=1'
fimg2povhf: fimg2povhf.c Makefile
gcc -Wall $(DBGL) $< -limage -lfloatimg -lm -o $@

4
contrib/README.md Normal file
View File

@ -0,0 +1,4 @@
# Contributions
Need some external garbage, sorry.

82
contrib/fimg2povhf.c Normal file
View File

@ -0,0 +1,82 @@
/*
* convertir une image flottante en champ d'altitude
*
* nouveau 64 ernest renan - 20220108
*/
#include <stdio.h>
#include <math.h>
#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;
}
/* ------------------------------------------------------------------ */

View File

@ -4,7 +4,7 @@
* http://la.buvette.org/photos/cumul
*/
#define FIMG_VERSION 164
#define FIMG_VERSION 166
/*
* in memory descriptor

View File

@ -5,6 +5,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <fcntl.h> /* low-level i/o */
#include <unistd.h>