forked from tTh/FloatImg
de-kluging some funcs
This commit is contained in:
parent
2b62730f47
commit
59cbb3c1e0
@ -63,12 +63,13 @@ if (FIMG_TYPE_RGB != a->type || FIMG_TYPE_RGB != b->type) {
|
|||||||
|
|
||||||
nbpixels = a->width * a->height;
|
nbpixels = a->width * a->height;
|
||||||
|
|
||||||
|
/* are we cache-friendly here ?
|
||||||
|
* we need an accurate benchmarking... */
|
||||||
|
|
||||||
for (idx=0; idx<nbpixels; idx++) {
|
for (idx=0; idx<nbpixels; idx++) {
|
||||||
b->R[idx] += a->R[idx];
|
b->R[idx] += a->R[idx];
|
||||||
b->G[idx] += a->G[idx];
|
b->G[idx] += a->G[idx];
|
||||||
b->B[idx] += a->B[idx];
|
b->B[idx] += a->B[idx];
|
||||||
/* are we cache-friendly here ?
|
|
||||||
* we need an accurate benchmarking... */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -85,8 +86,8 @@ int idx, nbpixels;
|
|||||||
fprintf(stderr, ">>> %s ( %p %p %p )\n", __func__, a, b, d);
|
fprintf(stderr, ">>> %s ( %p %p %p )\n", __func__, a, b, d);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (FIMG_TYPE_RGB != a->type ||
|
if ( FIMG_TYPE_RGB != a->type ||
|
||||||
FIMG_TYPE_RGB != b->type ||
|
FIMG_TYPE_RGB != b->type ||
|
||||||
FIMG_TYPE_RGB != d->type) {
|
FIMG_TYPE_RGB != d->type) {
|
||||||
fprintf(stderr, "%s : got a bad type fimg\n", __func__);
|
fprintf(stderr, "%s : got a bad type fimg\n", __func__);
|
||||||
return -8;
|
return -8;
|
||||||
@ -175,13 +176,15 @@ if (FIMG_TYPE_RGB != a->type || FIMG_TYPE_RGB != b->type ||
|
|||||||
return -8;
|
return -8;
|
||||||
}
|
}
|
||||||
|
|
||||||
nbiter = a->width * a->height * 3;
|
nbiter = a->width * a->height;
|
||||||
|
|
||||||
for (idx=0; idx<nbiter; idx++) {
|
for (idx=0; idx<nbiter; idx++) {
|
||||||
if (a->R[idx] > b->R[idx])
|
if (a->R[idx] > b->R[idx]) d->R[idx] = a->R[idx];
|
||||||
d->R[idx] = a->R[idx];
|
else d->R[idx] = b->R[idx];
|
||||||
else
|
if (a->G[idx] > b->G[idx]) d->G[idx] = a->G[idx];
|
||||||
d->R[idx] = b->R[idx];
|
else d->G[idx] = b->G[idx];
|
||||||
|
if (a->B[idx] > b->B[idx]) d->B[idx] = a->B[idx];
|
||||||
|
else d->B[idx] = b->B[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -201,13 +204,15 @@ if (FIMG_TYPE_RGB != a->type || FIMG_TYPE_RGB != b->type ||
|
|||||||
return -8;
|
return -8;
|
||||||
}
|
}
|
||||||
|
|
||||||
nbiter = a->width * a->height * 3;
|
nbiter = a->width * a->height ;
|
||||||
|
|
||||||
for (idx=0; idx<nbiter; idx++) {
|
for (idx=0; idx<nbiter; idx++) {
|
||||||
if (a->R[idx] < b->R[idx])
|
if (a->R[idx] < b->R[idx]) d->R[idx] = a->R[idx];
|
||||||
d->R[idx] = a->R[idx];
|
else d->R[idx] = b->R[idx];
|
||||||
else
|
if (a->G[idx] < b->G[idx]) d->G[idx] = a->G[idx];
|
||||||
d->R[idx] = b->R[idx];
|
else d->G[idx] = b->G[idx];
|
||||||
|
if (a->B[idx] < b->B[idx]) d->B[idx] = a->B[idx];
|
||||||
|
else d->B[idx] = b->B[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user