Compare commits

..

4 Commits

Author SHA1 Message Date
tth
4597598b02 konrad is up :) 2022-02-04 23:39:52 +01:00
tth
db7b740b2c add zero shift to fimgfx 2022-01-31 20:26:45 +01:00
tth
6aa802fde2 fix two missing break 2022-01-27 10:29:37 +01:00
tth
879e25463b DOUBLE OUPS ! 2022-01-24 12:58:05 +01:00
15 changed files with 63 additions and 19 deletions

View File

@ -26,7 +26,7 @@ extern int verbosity;
static A_Fifo g_fifo; static A_Fifo g_fifo;
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
static int big_adder(FloatImg *from, FloatImg *to) static inline int big_adder(FloatImg *from, FloatImg *to)
{ {
int size, idx; int size, idx;
@ -90,7 +90,7 @@ int export_fifo(char *fname, int notused)
int foo, type; int foo, type;
#if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, fname, step); fprintf(stderr, ">>> %s ( '%s' %d )\n", __func__, fname, notused);
#endif #endif
foo = faire_la_somme(&g_fifo, NULL, 1); foo = faire_la_somme(&g_fifo, NULL, 1);

View File

@ -175,7 +175,7 @@ for (idx=0; idx<globbuf.gl_pathc; idx++) {
fprintf(stderr, "load %s from dump -> %d\n", cptr, foo); fprintf(stderr, "load %s from dump -> %d\n", cptr, foo);
continue; continue;
} }
value = idx_values[idx].value; value = idx_values[idx].value; /* WTF ? */
/* here was the input filter */ /* here was the input filter */
foo = filterstack_run(0, &B, 0); foo = filterstack_run(0, &B, 0);

View File

@ -86,6 +86,9 @@ for (idx=20; idx < size; idx+=42) {
return 0; return 0;
} }
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */
/*
* LR mean left/right
*/
int get_float_metric_LR(FloatImg *pimg, float *where) int get_float_metric_LR(FloatImg *pimg, float *where)
{ {
int coords[4], foo; int coords[4], foo;
@ -97,8 +100,16 @@ coords[2] = pimg->width / 2; // W
coords[3] = pimg->height; // H coords[3] = pimg->height; // H
foo = stat_zone(pimg, coords, valL); foo = stat_zone(pimg, coords, valL);
if (foo) {
fprintf(stderr, "err %d stat zone in %s\n", foo, __func__);
return foo;
}
coords[1] = pimg->width / 2; coords[1] = pimg->width / 2;
foo = stat_zone(pimg, coords, valR); foo = stat_zone(pimg, coords, valR);
if (foo) {
fprintf(stderr, "err %d stat zone in %s\n", foo, __func__);
return foo;
}
*where = valL[1] - valR[1]; *where = valL[1] - valR[1];

View File

@ -25,7 +25,7 @@
static int nextpng, counter; static int nextpng, counter;
static char *destination; static char *destination;
static int chainfilter; static int chainfilter;
static int outtype; // static int outtype;
/* and the classic global var */ /* and the classic global var */
extern int verbosity; extern int verbosity;

View File

@ -38,8 +38,16 @@ apt install libv4l2-dev
apt install libcfitsio-dev apt install libcfitsio-dev
apt install libnetpbm-dev apt install libnetpbm-dev
``` ```
Il est probable que j'en oublient. Ensuite, j'ai dans l'idée de construire Il est probable que j'en oublie.
um met-packet à la sauce Debian pour installer facilement tout ce Et ya Debian qui change des trucs, alors, ça marche plus
```
E: Unable to locate package libv4l2-dev
E: Unable to locate package libnetpbm-dev
```
Ensuite, j'ai dans l'idée de construire
um meta-packet à la sauce Debian pour installer facilement tout ce
qui sert à faire fonctionner ce kluge. Ensuite, j'irais voir du qui sert à faire fonctionner ce kluge. Ensuite, j'irais voir du
coté de pkg-config. coté de pkg-config.

View File

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

View File

@ -36,7 +36,7 @@ return 42.0;
int fimg_decomp_rgbz_color(FloatImg *psrc, FloatImg *pdst, int k) int fimg_decomp_rgbz_color(FloatImg *psrc, FloatImg *pdst, int k)
{ {
int x, y, x2, y2; int x, y, x2, y2;
int w2, h2, idx; int w2, h2;
float cumul, vgray; float cumul, vgray;
#if DEBUG_LEVEL #if DEBUG_LEVEL

View File

@ -40,6 +40,10 @@ if (fimg_images_not_compatible(psrc, pdst)) {
} }
foo = fimg_get_minmax_rgb(psrc, minmax); foo = fimg_get_minmax_rgb(psrc, minmax);
if (foo) {
fprintf(stderr, "%s : err %d on get minmax\n", __func__, foo);
return foo;
}
if (verbosity) { if (verbosity) {
fimg_print_minmax(minmax, (char *)__func__); fimg_print_minmax(minmax, (char *)__func__);
} }

View File

@ -54,9 +54,11 @@ switch(filetype) {
case FILE_TYPE_BMP: case FILE_TYPE_BMP:
fprintf(stderr, "%s: file type BMP not implemented\n", __func__); fprintf(stderr, "%s: file type BMP not implemented\n", __func__);
foo = -666; foo = -666;
break;
case FILE_TYPE_EXR: case FILE_TYPE_EXR:
fprintf(stderr, "%s: file type EXR experimental\n", __func__); fprintf(stderr, "%s: file type EXR experimental\n", __func__);
foo = fimg_save_as_exr(pic, fname, 0); foo = fimg_save_as_exr(pic, fname, 0);
break;
default: default:
foo = -1789; foo = -1789;
break; break;

View File

@ -87,7 +87,7 @@ if (PNG_NO_ERROR != foo) {
} }
ptr = datas; ptr = datas;
for (idx=0; idx<png.width * png.height; idx++) { for (idx=0; idx<(int)(png.width*png.height); idx++) {
fimg->R[idx] = (float)*ptr++; fimg->R[idx] = (float)*ptr++;
fimg->G[idx] = (float)*ptr++; fimg->G[idx] = (float)*ptr++;
fimg->B[idx] = (float)*ptr++; fimg->B[idx] = (float)*ptr++;
@ -132,7 +132,7 @@ if ( 3 != png.bpp ) { /* TO BE PATCHED */
} }
/* check if floatimg and PNG have the same size */ /* check if floatimg and PNG have the same size */
if ((fimg->width != png.width) || (fimg->height != png.height)) { if ((fimg->width != (int)png.width) || (fimg->height != (int)png.height)) {
fprintf(stderr, "%s : fatal error on images sizes\n", __func__); fprintf(stderr, "%s : fatal error on images sizes\n", __func__);
exit(1); exit(1);
} }
@ -151,7 +151,7 @@ if (PNG_NO_ERROR != foo) {
} }
ptr = datas; ptr = datas;
for (idx=0; idx<png.width * png.height; idx++) { for (idx=0; idx<(int)(png.width*png.height); idx++) {
fimg->R[idx] = (float)*ptr++; fimg->R[idx] = (float)*ptr++;
fimg->G[idx] = (float)*ptr++; fimg->G[idx] = (float)*ptr++;
fimg->B[idx] = (float)*ptr++; fimg->B[idx] = (float)*ptr++;
@ -174,6 +174,10 @@ double maximum, fk;
fprintf(stderr, ">>> %-25s ( %p '%s' 0x%x )\n", __func__, src, outname, flags); fprintf(stderr, ">>> %-25s ( %p '%s' 0x%x )\n", __func__, src, outname, flags);
#endif #endif
if (flags) {
fprintf(stderr, "*** in %s, flags are %08x\n", __func__, flags);
}
/* convert ou floating datas to a byte/rgb array */ /* convert ou floating datas to a byte/rgb array */
/* first, alloc a buffer */ /* first, alloc a buffer */
sz = src->width * src->height; sz = src->width * src->height;

View File

@ -16,7 +16,7 @@
int fimg_killrgb_v(FloatImg *src, FloatImg *dst, int k) int fimg_killrgb_v(FloatImg *src, FloatImg *dst, int k)
{ {
int foo, line, col; int line, col;
int ir; int ir;
#if DEBUG_LEVEL #if DEBUG_LEVEL

View File

@ -47,7 +47,7 @@ return 0;
int fimg_split_level(FloatImg *src, FloatImg *dst, int notused) int fimg_split_level(FloatImg *src, FloatImg *dst, int notused)
{ {
float means[4]; float means[4];
float in[3], out[3]; float in[3];
int foo, idx, surface; int foo, idx, surface;
#if DEBUG_LEVEL #if DEBUG_LEVEL

View File

@ -106,6 +106,8 @@ while (pcmd->name) {
} }
fprintf(stderr, "\ncompiled on "__DATE__" at "__TIME__"\n"); fprintf(stderr, "\ncompiled on "__DATE__" at "__TIME__"\n");
if (k) fimg_print_version(k);
exit(0); exit(0);
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */

View File

@ -39,10 +39,12 @@ switch (head->type) {
if (head->G[foo] > maxval) maxval = head->G[foo]; if (head->G[foo] > maxval) maxval = head->G[foo];
if (head->B[foo] > maxval) maxval = head->B[foo]; if (head->B[foo] > maxval) maxval = head->B[foo];
} }
break;
case FIMG_TYPE_GRAY: case FIMG_TYPE_GRAY:
for (foo=0; foo<surface; foo++) { for (foo=0; foo<surface; foo++) {
if (head->R[foo] > maxval) maxval = head->R[foo]; if (head->R[foo] > maxval) maxval = head->R[foo];
} }
break;
} }
return maxval; return maxval;

View File

@ -28,7 +28,7 @@ enum fxid { Fx_cos01=5, Fx_cos010, Fx_pow2, Fx_sqrt, Fx_gray0, Fx_halfsz0,
Fx_rot90, Fx_cmixa, Fx_desat, Fx_ctr2x2, Fx_norm, Fx_rot90, Fx_cmixa, Fx_desat, Fx_ctr2x2, Fx_norm,
Fx_classtrial, Fx_mirror, Fx_shift0, Fx_trimul, Fx_classtrial, Fx_mirror, Fx_shift0, Fx_trimul,
Fx_xper, Fx_binarize, Fx_trinarize, Fx_hilight_R, Fx_xper, Fx_binarize, Fx_trinarize, Fx_hilight_R,
Fx_absolute, Fx_clamp }; Fx_absolute, Fx_clamp, Fx_shiftZ };
Fx fx_list[] = { Fx fx_list[] = {
{ "cos01", Fx_cos01, 0, 1 }, { "cos01", Fx_cos01, 0, 1 },
@ -52,6 +52,7 @@ Fx fx_list[] = {
{ "hilightr", Fx_hilight_R, 0, 1 }, { "hilightr", Fx_hilight_R, 0, 1 },
{ "abs", Fx_absolute, 0, 1 }, { "abs", Fx_absolute, 0, 1 },
{ "clamp", Fx_clamp, 0, 1 }, { "clamp", Fx_clamp, 0, 1 },
{ "shiftzero", Fx_shiftZ, 0, 1 },
{ NULL, 0, 0, 0 } { NULL, 0, 0, 0 }
}; };
@ -131,7 +132,8 @@ for (fx=fx_list; fx->name; fx++) {
} }
} }
puts("\n"); puts("\n");
fimg_print_version(1); if (lvl) fimg_print_version(1);
exit(0); exit(0);
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
@ -162,7 +164,7 @@ if (fx_list[fxidx].flags & 1) {
} }
} }
else { else {
fprintf(stderr, "%s: ???\n", __func__); /* XXX */ fprintf(stderr, "%s: flags & 1 ???\n", __func__); /* XXX */
memset(&dest, 0, sizeof(dest)); memset(&dest, 0, sizeof(dest));
return -888; return -888;
} }
@ -245,6 +247,14 @@ switch (action) {
negative pixels killed */ negative pixels killed */
if (foo > 0) foo = 0; if (foo > 0) foo = 0;
break; break;
case Fx_shiftZ:
foo = fimg_auto_shift_to_zero(&src, &dest);
if (foo) {
fprintf(stderr, "*** shiftzero -> %d\n", foo);
}
break;
default: default:
fprintf(stderr, "%s %s : %d is bad action\n", fprintf(stderr, "%s %s : %d is bad action\n",
__FILE__, __func__, action); __FILE__, __func__, action);
@ -277,12 +287,13 @@ char *operator;
char *srcname = ""; char *srcname = "";
char *dstname = "out.fimg"; char *dstname = "out.fimg";
while ((opt = getopt(argc, argv, "hk:lv")) != -1) { while ((opt = getopt(argc, argv, "hk:lvx")) != -1) {
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_of_effects(); exit(0); case 'l': list_of_effects(); exit(0);
case 'v': verbosity++; break; case 'v': verbosity++; break;
case 'x': break;
} }
} }