Compare commits

..

No commits in common. "e410b645146ebf62438866f47574da4b64c26f4d" and "b9d963dfa26f815460539106ea8a686bccb45367" have entirely different histories.

8 changed files with 25 additions and 104 deletions

View File

@ -51,7 +51,7 @@ float means[4]; /* four values : R G B A */
int foo; int foo;
#if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p )\n", __func__, pimg, where); fprintf(stderr, ">>> %s ( %p %f %d )\n", __func__, pimg, where, whot);
#endif #endif
foo = fimg_meanvalues(pimg, means); foo = fimg_meanvalues(pimg, means);

View File

@ -71,7 +71,7 @@ if (0 == globbuf.gl_pathc) {
for (idx=0; idx<globbuf.gl_pathc; idx++) { for (idx=0; idx<globbuf.gl_pathc; idx++) {
fname = globbuf.gl_pathv[idx]; /* alias of filename */ fname = globbuf.gl_pathv[idx]; /* alias of filename */
fprintf(stderr, " %6ld %s\r", (long)globbuf.gl_pathc-idx, fname); fprintf(stderr, " %6d %s\r", globbuf.gl_pathc-idx, fname);
if (0==image.width && 0==image.height) { if (0==image.width && 0==image.height) {
foo = fimg_create_from_dump(fname, &image); foo = fimg_create_from_dump(fname, &image);
@ -104,9 +104,9 @@ fimg_destroy(&image);
single_print_state("end of run :)", 0); single_print_state("end of run :)", 0);
elapsed = fimg_timer_get(0); elapsed = fimg_timer_get(0);
fprintf(stderr, "%s: %ld frames, elapsed %.3f s, %.3f fps\n", fprintf(stderr, "%s: %d frames, elapsed %.3f s, %.3f fps\n",
__func__, __func__,
(long)globbuf.gl_pathc, elapsed, globbuf.gl_pathc, elapsed,
(double)globbuf.gl_pathc/elapsed); (double)globbuf.gl_pathc/elapsed);
return 0; return 0;
@ -156,9 +156,6 @@ while ((opt = getopt(argc, argv, "hF:g:LO:svx")) != -1) {
case 'x': do_xper = 1; break; case 'x': do_xper = 1; break;
default:
fprintf(stderr, "%s ABEND\n", argv[0]);
exit(1);
} }
} }

View File

@ -299,7 +299,7 @@ Les deux premiers champs sont \textsl{obvious}.
Le troisième est le type d'image : pour le moment, il y en a % trois Le troisième est le type d'image : pour le moment, il y en a % trois
un certain nombre un certain nombre
qui sont définis\footnote{et plus ou moins bien gérés\dots} : qui sont définis\footnote{et plus ou moins bien gérés\dots} :
gris, rgb et rgba/rgbz\index{rgba}\index{rgbz}. gris, rgb et rgba\index{rgba}.
Les constantes adéquates sont dans \texttt{floatimg.h} Les constantes adéquates sont dans \texttt{floatimg.h}
\begin{lstlisting} \begin{lstlisting}
@ -443,7 +443,7 @@ $x$ et $y$ de la demande.
Quand au canal \textsl{alpha}\index{alpha}, il est pour le moment Quand au canal \textsl{alpha}\index{alpha}, il est pour le moment
superbement ignoré. Ceci dit, on vient de me faire remarquer qu'il superbement ignoré. Ceci dit, on vient de me faire remarquer qu'il
peut être utilisable aussi pour faire du peut être utilisable aussi pour faire du
\textsl{z-buffer}\index{z-buffer}\index{rgbz} \dots \textsl{z-buffer}\index{z-buffer} \dots
% ---------------------------------- % ----------------------------------
@ -477,7 +477,7 @@ int fimg_cos_010(FloatImg *s, FloatImg *d, double maxval);
Si vous souhaitez rajouter votre propre méthode de modification Si vous souhaitez rajouter votre propre méthode de modification
de contraste, il y a quelques explication en page \pageref{exemplefunc}. de contraste, il y a quelques explication en page \pageref{exemplefunc}.
Mais rien ne vous oblige à le faire. Sauf vos envies. Mais rien ne vous oblige à le faire.
\begin{figure}[h] \begin{figure}[h]
@ -627,9 +627,6 @@ int fimg_save_as_png(FloatImg *src, char *outname, int flags);
\end{lstlisting} \end{lstlisting}
Tous les flags doivent être à zéro. Sinon, ça foire parfois. Tous les flags doivent être à zéro. Sinon, ça foire parfois.
Et en fait (mars 2021) je ne suis pas très content de
\texttt{pnglite}, donc un de ces jours\footnote{Rendez-nous notre
Mixou !}, je prendrais cinq jours pour régler le souci.
\subsubsection{Vers TIFF}\index{TIFF} \subsubsection{Vers TIFF}\index{TIFF}

View File

@ -1,33 +0,0 @@
#!/bin/bash
#
# trying to run a maximum of ugly code
#
for trial in $(./t -l)
do
printf "============ %-10s ============\n" $trial
make t
error=$?
if [ 0 -ne $error ]
then
echo "make error is " $error
exit 1
fi
./t -v $trial
error=$?
if [ 0 -ne $error ]
then
echo "run error is " $error
exit 1
fi
printf "\t=== return code %d\n" $error
echo
sleep 10
done

View File

@ -61,16 +61,6 @@ while (pcmd->name) {
return -1; return -1;
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
void list_tests(void)
{
Command *pcmd = commands;
while (pcmd->name) {
printf("%s\n", pcmd->name);
pcmd++;
}
exit(0);
}
/* --------------------------------------------------------------------- */
void help(int k) void help(int k)
{ {
Command *pcmd; Command *pcmd;
@ -78,9 +68,7 @@ Command *pcmd;
fprintf(stderr, "usage:\n\t./t [options] command [filename]\n"); fprintf(stderr, "usage:\n\t./t [options] command [filename]\n");
fprintf(stderr, "options:\n"); fprintf(stderr, "options:\n");
fprintf(stderr, "\t-k 1.414\tset float value\n"); fprintf(stderr, "\t-o outfile\n");
fprintf(stderr, "\t-l\t\tlist tests\n");
fprintf(stderr, "\t-o \t\toutfile\n");
fprintf(stderr, "commands:\n"); fprintf(stderr, "commands:\n");
pcmd = commands; pcmd = commands;
@ -106,12 +94,10 @@ outfile = "out.pnm";
command = "none"; command = "none";
filename = "in.fimg"; filename = "in.fimg";
while ((opt = getopt(argc, argv, "hk:lo:p:v")) != -1) { while ((opt = getopt(argc, argv, "hk:o:p:v")) != -1) {
// fprintf(stderr, "opt = %c\n", opt);
switch(opt) { switch(opt) {
case 'h': help(0); break; case 'h': help(0); break;
case 'k': global_fvalue = atof(optarg); break; case 'k': global_fvalue = atof(optarg); break;
case 'l': list_tests(); break;
case 'o': outfile = optarg; break; case 'o': outfile = optarg; break;
case 'v': verbosity++; break; case 'v': verbosity++; break;
} }
@ -155,21 +141,19 @@ switch(opt) {
foo = essai_mire(filename, 0); foo = essai_mire(filename, 0);
break; break;
case Wfits: case Wfits:
foo = essai_ecriture_fits("out.fits"); foo = essai_ecriture_fits(filename);
break; break;
case Wpng: case Wpng:
foo = essai_ecriture_png("out.png"); foo = essai_ecriture_png(filename);
break; break;
case Wtiff: case Wtiff:
foo = essai_ecriture_tiff("out.tiff"); foo = essai_ecriture_tiff(filename);
break; break;
case Histo: case Histo:
foo = essai_histogramme(filename, 98765); foo = essai_histogramme(filename, 98765);
break; break;
case Hsv: case Hsv:
// not ready for primtime foo = fimg_essai_hsv(filename);
// foo = fimg_essai_hsv(filename);
foo = 0;
break; break;
case Classif: case Classif:
foo = essai_classif(filename, outfile, global_fvalue); foo = essai_classif(filename, outfile, global_fvalue);
@ -184,29 +168,23 @@ switch(opt) {
foo = essai_displacement(filename, outfile); foo = essai_displacement(filename, outfile);
break; break;
case ReadPNG: case ReadPNG:
// not ready for primetime foo = essai_lecture_png(filename, outfile, 0);
// foo = essai_lecture_png("in.png", outfile, 0);
foo = 0;
break; break;
case Plasmas: case Plasmas:
foo = essai_plasma(filename, outfile, 1, global_fvalue); foo = essai_plasma(filename, outfile, 1, global_fvalue);
fprintf(stderr, "we are all plasmafields\n"); fprintf(stderr, "we are all plasmafields\n");
break; break;
case Rotate:
fprintf(stderr, "rotate not implemented (%d)\n", rand());
foo = 0;
break;
default: default:
fprintf(stderr, "'%s' is a bad command\n", command); fprintf(stderr, "%s : bad command\n", command);
exit(1); exit(1);
} }
if (foo) { if (foo) {
fprintf(stderr, "******* Essai --> %d\n", foo); fprintf(stderr, "Essai ====> %d\n", foo);
} }
fprintf(stderr, "++++++++++++ end of '%s' pid %d\n", command, getpid()); fprintf(stderr, "+++++ end of %s pid %d\n", command, getpid());
return 0; return 0;
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */

View File

@ -231,7 +231,7 @@ if (foo) {
return foo; return foo;
} }
return 0; return -7;
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
/* essai de fichiers FITS (astronomie) */ /* essai de fichiers FITS (astronomie) */
@ -278,7 +278,7 @@ fprintf(stderr, "equalize compute --> %d\n", foo);
fimg_destroy(&src); fimg_destroy(&src);
return 0; return -1;
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
int essai_rotate(char *infile) int essai_rotate(char *infile)
@ -510,7 +510,6 @@ if (foo) {
return -6; return -6;
} }
fimg_destroy(&fimg);
return 0; return 0;
} }
@ -589,26 +588,16 @@ int foo;
fimg_create(&fimg, 640, 480, FIMG_TYPE_RGB); fimg_create(&fimg, 640, 480, FIMG_TYPE_RGB);
#define V ((double)3.141592654) foo = fimg_hdeg_a(&fimg, (double)3.141592654);
foo = fimg_hdeg_a(&fimg, V);
fprintf(stderr, "make h deg -> %d\n", foo); fprintf(stderr, "make h deg -> %d\n", foo);
foo = fimg_save_as_pnm(&fimg, "hdeg.pnm", 0); foo = fimg_save_as_pnm(&fimg, "hdeg.pnm", 0);
fprintf(stderr, "%s: save as pnm -> %d\n", __func__, foo); fprintf(stderr, "%s: save as pnm -> %d\n", __func__, foo);
foo = fimg_vdeg_a(&fimg, (double)3.141592654);
foo = fimg_vdeg_a(&fimg, V);
fprintf(stderr, "make h deg -> %d\n", foo); fprintf(stderr, "make h deg -> %d\n", foo);
foo = fimg_save_as_pnm(&fimg, "vdeg_a.pnm", 0); foo = fimg_save_as_pnm(&fimg, "vdeg.pnm", 0);
fprintf(stderr, "%s: save as pnm -> %d\n", __func__, foo); fprintf(stderr, "%s: save as pnm -> %d\n", __func__, foo);
foo = fimg_vdeg_a(&fimg, -V);
fprintf(stderr, "make h deg -> %d\n", foo);
foo = fimg_save_as_pnm(&fimg, "vdeg_b.pnm", 0);
fprintf(stderr, "%s: save as pnm -> %d\n", __func__, foo);
#undef V
return 0; return 0;
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
@ -647,14 +636,12 @@ fimg_draw_something(&fimg);
if (verbosity) { if (verbosity) {
foo = fimg_save_as_pnm(&fimg, "quux.pnm", 0); foo = fimg_save_as_pnm(&fimg, "quux.pnm", 0);
fprintf(stderr, "%s: saved as pnm -> %d\n", __func__, foo); fprintf(stderr, "%s: save as pnm -> %d\n", __func__, foo);
} }
foo = fimg_save_as_png(&fimg, fname, 0); foo = fimg_save_as_png(&fimg, fname, 0);
fprintf(stderr, "save as png -> %d\n", foo); fprintf(stderr, "save as png -> %d\n", foo);
fimg_destroy(&fimg);
return 0; return 0;
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */

View File

@ -167,10 +167,6 @@ if (NULL == fimg->R) {
free(fimg->R); free(fimg->R);
if (FIMG_TYPE_RGB==fimg->type) {
free(fimg->G);
free(fimg->B);
}
memset(fimg, 0, sizeof(FloatImg)); memset(fimg, 0, sizeof(FloatImg));
return 0; return 0;

View File

@ -35,6 +35,7 @@ else {
fp = stdout; /* XXX */ fp = stdout; /* XXX */
for (y=0; y<src->height; y+=steps) { for (y=0; y<src->height; y+=steps) {
for (x=0; x<src->width; x+=steps) { for (x=0; x<src->width; x+=steps) {
fimg_get_rgb(src, x, y, rgb); fimg_get_rgb(src, x, y, rgb);
fprintf(fp, "%d %d ", x, y); fprintf(fp, "%d %d ", x, y);
fprintf(fp, "%f %f %f\n", rgb[0], rgb[1], rgb[2]); fprintf(fp, "%f %f %f\n", rgb[0], rgb[1], rgb[2]);
@ -119,9 +120,7 @@ if (norm > 0.0) {
} }
foo = export_as_machinable(&fimg, dstname, steps, 0); foo = export_as_machinable(&fimg, dstname, steps, 0);
if (foo) {
fprintf(stderr,"%s: err %d on export\n", __func__, foo);
}
fimg_destroy(&fimg); fimg_destroy(&fimg);
return 0; return 0;