Compare commits
No commits in common. "9fda48ab304a920629d1337d6004ae31972c7307" and "414bff491be07bbcc782d2cef835b9f10b347f19" have entirely different histories.
9fda48ab30
...
414bff491b
@ -98,7 +98,7 @@ int fimg_lissage_2x2(FloatImg *img);
|
|||||||
int fimg_filter_3x3(FloatImg *s, FloatImg *d, FimgFilter3x3 *filtr);
|
int fimg_filter_3x3(FloatImg *s, FloatImg *d, FimgFilter3x3 *filtr);
|
||||||
|
|
||||||
|
|
||||||
int fimg_contour_2x2(FloatImg *psrc, FloatImg *pdst, int reverse);
|
int fimg_contour_2x2(FloatImg *psrc, FloatImg *pdst, int notused);
|
||||||
|
|
||||||
/* 'sfx0' module */
|
/* 'sfx0' module */
|
||||||
int fimg_killcolors_a(FloatImg *fimg, float fval);
|
int fimg_killcolors_a(FloatImg *fimg, float fval);
|
||||||
|
@ -21,19 +21,9 @@ float range, dist, rgb[3], dr, dg, db;
|
|||||||
int x, y, on, off;
|
int x, y, on, off;
|
||||||
|
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
fprintf(stderr, ">>> %s ( %p %p %f %d )\n", __func__,
|
fprintf(stderr, ">>> %s ( %p %p %f %d )\n", __func__, psrc, pdst, fval, notused);
|
||||||
psrc, pdst, fval, notused);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (FIMG_TYPE_RGB != psrc->type) {
|
|
||||||
fprintf(stderr, "%s: bad src type %d\n", __func__, psrc->type);
|
|
||||||
return -7;
|
|
||||||
}
|
|
||||||
if (fimg_images_not_compatible(psrc, pdst)) {
|
|
||||||
fprintf(stderr, "%s: bad dst type %d\n", __func__, pdst->type);
|
|
||||||
return -8;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* calculer les amplitudes RGB de l'image source */
|
/* calculer les amplitudes RGB de l'image source */
|
||||||
fimg_get_minmax_rgb(psrc, minmax);
|
fimg_get_minmax_rgb(psrc, minmax);
|
||||||
delta[0] = minmax[1] - minmax[0];
|
delta[0] = minmax[1] - minmax[0];
|
||||||
|
@ -14,11 +14,10 @@ int verbosity;
|
|||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
/* nouveau 4 octobre 2020, juste avant sonoptic de la pluie craignos */
|
/* nouveau 4 octobre 2020, juste avant sonoptic de la pluie craignos */
|
||||||
|
|
||||||
int fimg_contour_2x2(FloatImg *psrc, FloatImg *pdst, int reverse)
|
int fimg_contour_2x2(FloatImg *psrc, FloatImg *pdst, int notused)
|
||||||
{
|
{
|
||||||
float avg[4];
|
float avg[4];
|
||||||
int foo, x, y, q;
|
int foo, x, y, q;
|
||||||
float v1, v2;
|
|
||||||
|
|
||||||
int tbl[] = /* deep magic inside */
|
int tbl[] = /* deep magic inside */
|
||||||
{
|
{
|
||||||
@ -29,26 +28,9 @@ int tbl[] = /* deep magic inside */
|
|||||||
};
|
};
|
||||||
|
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, psrc, pdst, reverse);
|
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, psrc, pdst, notused);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (FIMG_TYPE_RGB != psrc->type) {
|
|
||||||
fprintf(stderr, "%s: bad src type %d\n", __func__, psrc->type);
|
|
||||||
return -7;
|
|
||||||
}
|
|
||||||
if (fimg_images_not_compatible(psrc, pdst)) {
|
|
||||||
fprintf(stderr, "%s: bad dst type %d\n", __func__, pdst->type);
|
|
||||||
return -8;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (reverse) {
|
|
||||||
v1 = 0.0; v2 = 1.0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
v1 = 1.0; v2 = 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
foo = fimg_meanvalues(psrc, avg);
|
foo = fimg_meanvalues(psrc, avg);
|
||||||
if (verbosity) {
|
if (verbosity) {
|
||||||
fprintf(stderr, "mean values : %f %f %f\n", avg[0], avg[1], avg[2]);
|
fprintf(stderr, "mean values : %f %f %f\n", avg[0], avg[1], avg[2]);
|
||||||
@ -66,19 +48,19 @@ for (y=0; y<psrc->height-1; y++) {
|
|||||||
( RP(x+1, y) << 2 ) |
|
( RP(x+1, y) << 2 ) |
|
||||||
( RP(x, y+1) << 1 ) |
|
( RP(x, y+1) << 1 ) |
|
||||||
( RP(x+1, y+1) ) );
|
( RP(x+1, y+1) ) );
|
||||||
pdst->R[(y*psrc->width)+x] = tbl[q] ? v1 : v2 ;
|
pdst->R[(y*psrc->width)+x] = tbl[q] ? 1.0 : 0.0 ;
|
||||||
|
|
||||||
q = ( ( GP(x, y) << 3 ) |
|
q = ( ( GP(x, y) << 3 ) |
|
||||||
( GP(x+1, y) << 2 ) |
|
( GP(x+1, y) << 2 ) |
|
||||||
( GP(x, y+1) << 1 ) |
|
( GP(x, y+1) << 1 ) |
|
||||||
( GP(x+1, y+1) ) );
|
( GP(x+1, y+1) ) );
|
||||||
pdst->G[(y*psrc->width)+x] = tbl[q] ? v1 : v2 ;
|
pdst->G[(y*psrc->width)+x] = tbl[q] ? 1.0 : 0.0 ;
|
||||||
|
|
||||||
q = ( ( BP(x, y) << 3 ) |
|
q = ( ( BP(x, y) << 3 ) |
|
||||||
( BP(x+1, y) << 2 ) |
|
( BP(x+1, y) << 2 ) |
|
||||||
( BP(x, y+1) << 1 ) |
|
( BP(x, y+1) << 1 ) |
|
||||||
( BP(x+1, y+1) ) );
|
( BP(x+1, y+1) ) );
|
||||||
pdst->B[(y*psrc->width)+x] = tbl[q] ? v1 : v2 ;
|
pdst->B[(y*psrc->width)+x] = tbl[q] ? 1.0 : 0.0 ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,15 +27,6 @@ int foo, szimg;
|
|||||||
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, psrc, pdst, notused);
|
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, psrc, pdst, notused);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (FIMG_TYPE_RGB != psrc->type) {
|
|
||||||
fprintf(stderr, "%s: bad src type %d\n", __func__, psrc->type);
|
|
||||||
return -7;
|
|
||||||
}
|
|
||||||
if (fimg_images_not_compatible(psrc, pdst)) {
|
|
||||||
fprintf(stderr, "%s: bad dst type %d\n", __func__, pdst->type);
|
|
||||||
return -8;
|
|
||||||
}
|
|
||||||
|
|
||||||
foo = fimg_copy_data(psrc, pdst);
|
foo = fimg_copy_data(psrc, pdst);
|
||||||
|
|
||||||
szimg = pdst->width * pdst->height;
|
szimg = pdst->width * pdst->height;
|
||||||
@ -53,7 +44,7 @@ typedef struct {
|
|||||||
float r, g, b;
|
float r, g, b;
|
||||||
} pix;
|
} pix;
|
||||||
|
|
||||||
static int compare_b(const void *p1, const void *p2)
|
static compare_b(const void *p1, const void *p2)
|
||||||
{
|
{
|
||||||
pix *s1, *s2;
|
pix *s1, *s2;
|
||||||
s1 = (pix *)p1;
|
s1 = (pix *)p1;
|
||||||
@ -71,15 +62,6 @@ float rgb[3];
|
|||||||
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, psrc, pdst, notused);
|
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, psrc, pdst, notused);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (FIMG_TYPE_RGB != psrc->type) {
|
|
||||||
fprintf(stderr, "%s: bad src type %d\n", __func__, psrc->type);
|
|
||||||
return -7;
|
|
||||||
}
|
|
||||||
if (fimg_images_not_compatible(psrc, pdst)) {
|
|
||||||
fprintf(stderr, "%s: bad dst type %d\n", __func__, pdst->type);
|
|
||||||
return -8;
|
|
||||||
}
|
|
||||||
|
|
||||||
szimg = pdst->width * pdst->height;
|
szimg = pdst->width * pdst->height;
|
||||||
fprintf(stderr, "%s : %d pixels\n", __func__, szimg);
|
fprintf(stderr, "%s : %d pixels\n", __func__, szimg);
|
||||||
|
|
||||||
|
10
funcs/t.c
10
funcs/t.c
@ -78,7 +78,7 @@ else {
|
|||||||
|
|
||||||
fimg_clone(&src, &dst, 1);
|
fimg_clone(&src, &dst, 1);
|
||||||
|
|
||||||
foo = fimg_contour_2x2(&src, &dst, 1);
|
foo = fimg_contour_2x2(&src, &dst, 0);
|
||||||
if (foo) {
|
if (foo) {
|
||||||
fprintf(stderr, "%s: err %d in contour_2x2\n", __func__, foo);
|
fprintf(stderr, "%s: err %d in contour_2x2\n", __func__, foo);
|
||||||
return foo;
|
return foo;
|
||||||
@ -456,12 +456,6 @@ printf("%-10s %d\n\n", fname, foo);
|
|||||||
foo = format_from_extension(fname="foo.png");
|
foo = format_from_extension(fname="foo.png");
|
||||||
printf("%-10s %d\n\n", fname, foo);
|
printf("%-10s %d\n\n", fname, foo);
|
||||||
|
|
||||||
foo = format_from_extension(fname="foo.tiff");
|
|
||||||
printf("%-10s %d\n\n", fname, foo);
|
|
||||||
|
|
||||||
foo = format_from_extension(fname="foo.fits");
|
|
||||||
printf("%-10s %d\n\n", fname, foo);
|
|
||||||
|
|
||||||
foo = format_from_extension(fname="foo.xyzzy");
|
foo = format_from_extension(fname="foo.xyzzy");
|
||||||
printf("%-10s %d\n\n", fname, foo);
|
printf("%-10s %d\n\n", fname, foo);
|
||||||
|
|
||||||
@ -694,7 +688,7 @@ 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 pid %d\n", getpid());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
|
Loading…
Reference in New Issue
Block a user