func 'fimg_mul_2' added

This commit is contained in:
Tonton Th 2020-01-17 10:53:45 +01:00
parent 692735a57f
commit d3c52d6127
2 changed files with 28 additions and 0 deletions

View File

@ -14,6 +14,8 @@ int essai_ecrire_tiff(FloatImg *src, char *fname)
/* bon, tout cela semble bien tortueux ! */ /* bon, tout cela semble bien tortueux ! */
fprintf(stderr, "%s %s to be implemented\n", __FILE__, __func__);
return 0; return 0;
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */

View File

@ -98,6 +98,32 @@ for (idx=0; idx<nbpixels; idx++) {
} }
return 0; return 0;
}
/* ---------------------------------------------------------------- */
/*
* B *= A may be faster than fimg_mul_3 ?
*/
int fimg_mul_2(FloatImg *a, FloatImg *b)
{
int idx, nbpixels;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p )\n", __func__, a, b);
#endif
if (3 != a->type || 3 != b->type) {
fprintf(stderr, "%s : got a bad type fimg\n", __func__);
return -8;
}
nbpixels = a->width * a->height;
for (idx=0; idx<nbpixels; idx++) {
b->R[idx] *= a->R[idx];
b->G[idx] *= a->G[idx];
b->B[idx] *= a->B[idx];
}
} }
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
/* /*