adding mollyguard

This commit is contained in:
tth 2020-10-14 10:32:29 +02:00
parent 947152532d
commit 9fda48ab30
3 changed files with 40 additions and 2 deletions

View File

@ -21,9 +21,19 @@ 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__, psrc, pdst, fval, notused); fprintf(stderr, ">>> %s ( %p %p %f %d )\n", __func__,
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];

View File

@ -32,6 +32,16 @@ int tbl[] = /* deep magic inside */
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, psrc, pdst, reverse); fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, psrc, pdst, reverse);
#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) { if (reverse) {
v1 = 0.0; v2 = 1.0; v1 = 0.0; v2 = 1.0;
} }

View File

@ -27,6 +27,15 @@ 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;
@ -44,7 +53,7 @@ typedef struct {
float r, g, b; float r, g, b;
} pix; } pix;
static compare_b(const void *p1, const void *p2) static int compare_b(const void *p1, const void *p2)
{ {
pix *s1, *s2; pix *s1, *s2;
s1 = (pix *)p1; s1 = (pix *)p1;
@ -62,6 +71,15 @@ 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);