Compare commits

..

No commits in common. "75f36c0f6a25a5bc22400957513cf7e39eb94f07" and "fe51a2667402663cbccc0b45733ed182d6e9894c" have entirely different histories.

7 changed files with 21 additions and 69 deletions

View File

@ -9,7 +9,7 @@ des [films flous](Fonderie/).
Il y a une [description](http://la.buvette.org/photos/cumul/) bien plus Il y a une [description](http://la.buvette.org/photos/cumul/) bien plus
pas trop longue pour les curieux, et un début de longue pour les curieux, et un début de
[documentation](http://la.buvette.org/photos/cumul/the_floatimg_hack.pdf) [documentation](http://la.buvette.org/photos/cumul/the_floatimg_hack.pdf)
pour les codeurs. pour les codeurs.
Le service après-vente est (plus ou moins bien) assuré sur Le service après-vente est (plus ou moins bien) assuré sur
@ -51,4 +51,4 @@ Encore trop légère, mais déja [présente](doc/).
C'est à vous de compiler le C'est à vous de compiler le
[PDF](http://la.buvette.org/photos/cumul/the_floatimg_hack.pdf) [PDF](http://la.buvette.org/photos/cumul/the_floatimg_hack.pdf)
*Your mileage may vary...* Your mileage may vary...

View File

@ -3,7 +3,7 @@
* ugly code from tTh * ugly code from tTh
*/ */
#define FIMG_VERSION 117 #define FIMG_VERSION 116
/* /*
* in memory descriptor * in memory descriptor
@ -126,12 +126,11 @@ int fimg_square_root(FloatImg *s, FloatImg *d, double maxval);
int fimg_power_2(FloatImg *s, FloatImg *d, double maxval); int fimg_power_2(FloatImg *s, FloatImg *d, double maxval);
int fimg_cos_01(FloatImg *s, FloatImg *d, double maxval); int fimg_cos_01(FloatImg *s, FloatImg *d, double maxval);
int fimg_cos_010(FloatImg *s, FloatImg *d, double maxval); int fimg_cos_010(FloatImg *s, FloatImg *d, double maxval);
int fimg_mix_rgb_gray(FloatImg *img, float mix); int fimg_mix_rgb_gray(FloatImg *img, float mix);
int fimg_shift_to_zero(FloatImg *s, FloatImg *d, float coefs[6]); int fimg_shift_to_zero(FloatImg *s, FloatImg *d, float coefs[6]);
/* --> funcs/plasmas.c */
int fimg_prototype_plasma(FloatImg *img, char *txt, int type);
/* * * * experimental ! */ /* * * * experimental ! */
int fimg_classif_trial(FloatImg *src, FloatImg*dst, float fval, int notused); int fimg_classif_trial(FloatImg *src, FloatImg*dst, float fval, int notused);
int fimg_qsort_rgb_a(FloatImg *psrc, FloatImg *pdst, int notused); int fimg_qsort_rgb_a(FloatImg *psrc, FloatImg *pdst, int notused);

View File

@ -1,16 +1,19 @@
#--------------------------------------------------------------- #---------------------------------------------------------------
COPT = -Wall -fpic -g -no-pie -DDEBUG_LEVEL=1 COPT = -Wall -fpic -g -no-pie -DDEBUG_LEVEL=0
DEPS = ../floatimg.h Makefile DEPS = ../floatimg.h Makefile
OBJS = fimg-png.o fimg-tiff.o misc-plots.o filtrage.o utils.o \ OBJS = fimg-png.o fimg-tiff.o misc-plots.o filtrage.o utils.o \
fimg-libpnm.o rampes.o sfx0.o geometry.o rotate.o \ fimg-libpnm.o rampes.o sfx0.o geometry.o rotate.o \
equalize.o fimg-fits.o saturation.o histogram.o \ equalize.o fimg-fits.o saturation.o histogram.o \
hsv.o classif.o contour2x2.o qsortrgb.o exporter.o \ hsv.o classif.o contour2x2.o qsortrgb.o exporter.o \
displacement.o dithering.o plasmas.o displacement.o dithering.o
#--------------------------------------------------------------- #---------------------------------------------------------------
tests.o: tests.c tests.h $(DEPS)
gcc $(COPT) -c $<
t: t.c $(DEPS) ../libfloatimg.a tests.o t: t.c $(DEPS) ../libfloatimg.a tests.o
gcc $(COPT) $< \ gcc $(COPT) $< \
tests.o \ tests.o \
@ -20,11 +23,7 @@ t: t.c $(DEPS) ../libfloatimg.a tests.o
-ltiff \ -ltiff \
-lz -lm -o $@ -lz -lm -o $@
tests.o: tests.c tests.h $(DEPS)
gcc $(COPT) -c $<
#--------------------------------------------------------------- #---------------------------------------------------------------
# upper-level functions
../libfloatimg.a: $(OBJS) ../libfloatimg.a: $(OBJS)
$(AR) r $@ $? $(AR) r $@ $?
@ -68,8 +67,6 @@ equalize.o: equalize.c $(DEPS)
dithering.o: dithering.c $(DEPS) dithering.o: dithering.c $(DEPS)
gcc $(COPT) -c $< gcc $(COPT) -c $<
plasmas.o: plasmas.c $(DEPS)
gcc $(COPT) -c $<
sfx0.o: sfx0.c $(DEPS) sfx0.o: sfx0.c $(DEPS)
gcc $(COPT) -c $< gcc $(COPT) -c $<

View File

@ -21,7 +21,7 @@ float global_fvalue;
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
enum nCmd { Equalize=1, Rotate, Sfx0, F3x3, MIRE, Wfits, Wpng, Wtiff, enum nCmd { Equalize=1, Rotate, Sfx0, F3x3, MIRE, Wfits, Wpng, Wtiff,
Histo, Hsv, Classif, Ctr2x2, Qsortrgb, Histo, Hsv, Classif, Ctr2x2, Qsortrgb,
Displace, ReadPNG, Plasmas }; Displace, ReadPNG };
typedef struct { typedef struct {
char *name; char *name;
int Cmd; int Cmd;
@ -43,7 +43,6 @@ Command commands[] = {
{ "qsortrgb", Qsortrgb }, { "qsortrgb", Qsortrgb },
{ "displace", Displace }, { "displace", Displace },
{ "readpng", ReadPNG }, { "readpng", ReadPNG },
{ "plasma", Plasmas },
{ NULL, 0 } { NULL, 0 }
} ; } ;
@ -65,7 +64,7 @@ void help(int k)
{ {
Command *pcmd; 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-o outfile\n"); fprintf(stderr, "\t-o outfile\n");
@ -90,9 +89,8 @@ fprintf(stderr, "++++++++ test des fonctions pid=%d\n", getpid());
fprintf(stderr, "++++++++ compiled "__DATE__" at " __TIME__ "\n"); fprintf(stderr, "++++++++ compiled "__DATE__" at " __TIME__ "\n");
global_fvalue = 1.0; global_fvalue = 1.0;
outfile = "out.pnm"; outfile = "out.pnm";
command = "none"; command = "none";
filename = "in.fimg";
while ((opt = getopt(argc, argv, "hk:o:p:v")) != -1) { while ((opt = getopt(argc, argv, "hk:o:p:v")) != -1) {
switch(opt) { switch(opt) {
@ -105,22 +103,17 @@ while ((opt = getopt(argc, argv, "hk:o:p:v")) != -1) {
// fprintf(stderr, "argc %d optind %d\n", argc, optind); // fprintf(stderr, "argc %d optind %d\n", argc, optind);
switch (argc-optind) { filename = NULL;
case 1: /* only command */ if (2 != argc-optind) {
command = argv[optind]; fprintf(stderr, "%s: bad command line\n", argv[0]);
break; help(1);
case 2:
command = argv[optind];
filename = argv[optind+1];
break;
default:
fprintf(stderr, "%s: bad command line ?\n", argv[0]);
help(1);
break;
} }
command = argv[optind];
filename = argv[optind+1];
if (verbosity) { if (verbosity) {
fprintf(stderr, "++++++++ %s : running command '%s' on '%s'\n", fprintf(stderr, "%s : running command '%s' on '%s'\n",
argv[0], command, filename); argv[0], command, filename);
fprintf(stderr, "global fvalue : %f\n", global_fvalue); fprintf(stderr, "global fvalue : %f\n", global_fvalue);
} }
@ -170,10 +163,6 @@ switch(opt) {
case ReadPNG: case ReadPNG:
foo = essai_lecture_png(filename, outfile, 0); foo = essai_lecture_png(filename, outfile, 0);
break; break;
case Plasmas:
foo = essai_plasma(filename, outfile, 1, 13.37);
fprintf(stderr, "we are all plasmafields\n");
break;
default: default:
fprintf(stderr, "%s : bad command\n", command); fprintf(stderr, "%s : bad command\n", command);
exit(1); exit(1);

View File

@ -16,35 +16,6 @@
extern int verbosity; extern int verbosity;
/* --------------------------------------------------------------------- */
int essai_plasma(char *infile, char *outfile, int ikoef, float fkoef)
{
FloatImg src, dst;
int foo;
fprintf(stderr, ">>> %s ( '%s' '%s' %d %g )\n", __func__,
infile, outfile, ikoef, fkoef);
/* if infile is loadable, use it for background */
foo = fimg_create_from_dump(infile, &src);
if (foo) {
fprintf(stderr, "%s: error loading '%s'\n", __func__, infile);
return foo;
}
fprintf(stderr, "'%s' loaded\n", infile);
fimg_printhead(&src);
fimg_clone(&src, &dst, 1);
foo = fimg_export_picture(&dst, outfile, 0);
if (foo) {
fprintf(stderr, "%s : err %d saving result\n", __func__, foo);
return foo;
}
return -1;
}
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
/* nouveau 24 octobre 2020, pendant le masque-flamme coronavidique */ /* nouveau 24 octobre 2020, pendant le masque-flamme coronavidique */

View File

@ -3,8 +3,6 @@
see also: t.c & tests.c see also: t.c & tests.c
*/ */
int essai_plasma(char *infile, char *outfile, int ikoef, float fkoef);
int essai_displacement(char *infile, char *outfile); int essai_displacement(char *infile, char *outfile);
int essai_qsort_rgb(char *infile, char *outfile); int essai_qsort_rgb(char *infile, char *outfile);
int essai_equalize(char *infile); int essai_equalize(char *infile);

View File

@ -188,11 +188,9 @@ if (foo) {
return foo; return foo;
} }
/* NO No no !!! don't do that !!! */
foo = fread(head->R, sizeof(float), foo = fread(head->R, sizeof(float),
filehead.w*filehead.h*filehead.t, fp); filehead.w*filehead.h*filehead.t, fp);
fclose(fp); fclose(fp);
return 0; return 0;