Browse Source

cosmetic change

master
Tonton Th 3 years ago
parent
commit
6d13293ef2
  1. 18
      lib/operators.c

18
lib/operators.c

@ -21,7 +21,7 @@ extern int verbosity; /* must be declared around main() */ @@ -21,7 +21,7 @@ extern int verbosity; /* must be declared around main() */
*/
int fimg_add(FloatImg *a, FloatImg *b, FloatImg *d)
{
int idx, nbiter;
int idx, nbpixels;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %p )\n", __func__, a, b, d);
@ -32,9 +32,9 @@ if (3 != a->type || 3 != b->type || 3 != d->type) { @@ -32,9 +32,9 @@ if (3 != a->type || 3 != b->type || 3 != d->type) {
return -8;
}
nbiter = a->width * a->height;
nbpixels = a->width * a->height;
for (idx=0; idx<nbiter; idx++) {
for (idx=0; idx<nbpixels; idx++) {
d->R[idx] = a->R[idx] + b->R[idx];
d->G[idx] = a->G[idx] + b->G[idx];
d->B[idx] = a->B[idx] + b->B[idx];
@ -48,7 +48,7 @@ return 0; @@ -48,7 +48,7 @@ return 0;
*/
int fimg_sub(FloatImg *a, FloatImg *b, FloatImg *d)
{
int idx, nbiter;
int idx, nbpixels;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %p )\n", __func__, a, b, d);
@ -59,12 +59,12 @@ if (3 != a->type || 3 != b->type || 3 != d->type) { @@ -59,12 +59,12 @@ if (3 != a->type || 3 != b->type || 3 != d->type) {
return -8;
}
nbiter = a->width * a->height;
nbpixels = a->width * a->height;
/* maybe we can speedup this loop for
* avoiding the cache strashing ?
*/
for (idx=0; idx<nbiter; idx++) {
for (idx=0; idx<nbpixels; idx++) {
d->R[idx] = fabs(a->R[idx] - b->R[idx]);
d->G[idx] = fabs(a->G[idx] - b->G[idx]);
d->B[idx] = fabs(a->B[idx] - b->B[idx]);
@ -78,7 +78,7 @@ return 0; @@ -78,7 +78,7 @@ return 0;
*/
int fimg_mul(FloatImg *a, FloatImg *b, FloatImg *d)
{
int idx, nbiter;
int idx, nbpixels;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %p )\n", __func__, a, b, d);
@ -89,9 +89,9 @@ if (3 != a->type || 3 != b->type || 3 != d->type) { @@ -89,9 +89,9 @@ if (3 != a->type || 3 != b->type || 3 != d->type) {
return -8;
}
nbiter = a->width * a->height;
nbpixels = a->width * a->height;
for (idx=0; idx<nbiter; idx++) {
for (idx=0; idx<nbpixels; idx++) {
d->R[idx] = a->R[idx] * b->R[idx];
d->G[idx] = a->G[idx] * b->G[idx];
d->B[idx] = a->B[idx] * b->B[idx];

Loading…
Cancel
Save