1) renommer quelques fonctions dans lib/operators.c
2) ajouter une fonction d'additin d'images (maybe ?) plus rapide 3) reparation d'un bug dans tools/fimgops.c
This commit is contained in:
@@ -16,10 +16,10 @@ extern int verbosity; /* must be declared around main() */
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/*
|
||||
* A + B -> D
|
||||
* A + B -> D
|
||||
* why is this func so slow ?
|
||||
*/
|
||||
int fimg_add(FloatImg *a, FloatImg *b, FloatImg *d)
|
||||
int fimg_add_3(FloatImg *a, FloatImg *b, FloatImg *d)
|
||||
{
|
||||
int idx, nbpixels;
|
||||
|
||||
@@ -40,13 +40,40 @@ for (idx=0; idx<nbpixels; idx++) {
|
||||
d->B[idx] = a->B[idx] + b->B[idx];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
||||
/*
|
||||
* B += A may be faster than fimg_add_3 ?
|
||||
*/
|
||||
int fimg_add_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];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* ---------------------------------------------------------------- */
|
||||
/*
|
||||
* A - B -> D
|
||||
*/
|
||||
int fimg_sub(FloatImg *a, FloatImg *b, FloatImg *d)
|
||||
int fimg_sub_3(FloatImg *a, FloatImg *b, FloatImg *d)
|
||||
{
|
||||
int idx, nbpixels;
|
||||
|
||||
@@ -57,7 +84,7 @@ fprintf(stderr, ">>> %s ( %p %p %p )\n", __func__, a, b, d);
|
||||
if (3 != a->type || 3 != b->type || 3 != d->type) {
|
||||
fprintf(stderr, "%s : got a bad type fimg\n", __func__);
|
||||
return -8;
|
||||
}
|
||||
}
|
||||
|
||||
nbpixels = a->width * a->height;
|
||||
|
||||
@@ -76,7 +103,7 @@ return 0;
|
||||
/*
|
||||
* A * B -> D
|
||||
*/
|
||||
int fimg_mul(FloatImg *a, FloatImg *b, FloatImg *d)
|
||||
int fimg_mul_3(FloatImg *a, FloatImg *b, FloatImg *d)
|
||||
{
|
||||
int idx, nbpixels;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user