diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-06-14 23:22:55 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-06-14 23:22:55 +0400 |
commit | 813348a4eeeb97536cc47a9eb30605cdb68ca781 (patch) | |
tree | a1006b6d371b876d3be7032c557ac115bfd56d50 /source/blender/compositor/operations | |
parent | 8ae116fbbb505be7055046eb15ba82ced203ced2 (diff) |
code cleanup: replace most fRGB functions with inline vector functions
Diffstat (limited to 'source/blender/compositor/operations')
3 files changed, 7 insertions, 17 deletions
diff --git a/source/blender/compositor/operations/COM_GlareBaseOperation.h b/source/blender/compositor/operations/COM_GlareBaseOperation.h index dc708044d31..ac67ac055e9 100644 --- a/source/blender/compositor/operations/COM_GlareBaseOperation.h +++ b/source/blender/compositor/operations/COM_GlareBaseOperation.h @@ -32,16 +32,6 @@ typedef float fRGB[4]; /* TODO - replace with BLI_math_vector */ -/* copy c2 to c1 */ -#define fRGB_copy(c1, c2) { c1[0] = c2[0]; c1[1] = c2[1]; c1[2] = c2[2]; c1[3] = c2[3]; } (void)0 -/* add c2 to c1 */ -#define fRGB_add(c1, c2) { c1[0] += c2[0]; c1[1] += c2[1]; c1[2] += c2[2]; } (void)0 -/* multiply c by float value s */ -#define fRGB_mult(c, s) { c[0] *= s; c[1] *= s; c[2] *= s; } (void)0 -/* multiply c2 by s and add to c1 */ -#define fRGB_madd(c1, c2, s) { c1[0] += c2[0] * s; c1[1] += c2[1] * s; c1[2] += c2[2] * s; } (void)0 -/* multiply c2 by color c1 */ -#define fRGB_colormult(c, cs) { c[0] *= cs[0]; c[1] *= cs[1]; c[2] *= cs[2]; } (void)0 /* multiply c2 by color rgb, rgb as separate arguments */ #define fRGB_rgbmult(c, r, g, b) { c[0] *= (r); c[1] *= (g); c[2] *= (b); } (void)0 diff --git a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp index a91445be4b5..694aa26bcde 100644 --- a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp +++ b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp @@ -277,7 +277,7 @@ void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) for (y = 0; y < kernelHeight; y++) { colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_NUMBER_OF_CHANNELS]; for (x = 0; x < kernelWidth; x++) - fRGB_add(wt, colp[x]); + add_v3_v3(wt, colp[x]); } if (wt[0] != 0.f) wt[0] = 1.f / wt[0]; if (wt[1] != 0.f) wt[1] = 1.f / wt[1]; @@ -285,7 +285,7 @@ void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) for (y = 0; y < kernelHeight; y++) { colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_NUMBER_OF_CHANNELS]; for (x = 0; x < kernelWidth; x++) - fRGB_colormult(colp[x], wt); + mul_v3_v3(colp[x], wt); } // copy image data, unpacking interleaved RGBA into separate channels @@ -395,7 +395,7 @@ void GlareFogGlowOperation::generateGlare(float *data, MemoryBuffer *inputTile, //w = (1.f-fabs(u))*(1.f-fabs(v)); // actually, Hanning window is ok, cos^2 for some reason is slower w = (0.5f + 0.5f * cos((double)u * M_PI)) * (0.5f + 0.5f * cos((double)v * M_PI)); - fRGB_mult(fcol, w); + mul_v3_fl(fcol, w); ckrn->writePixel(x, y, fcol); } } diff --git a/source/blender/compositor/operations/COM_GlareGhostOperation.cpp b/source/blender/compositor/operations/COM_GlareGhostOperation.cpp index 2d5fe57b817..39fffd6ac64 100644 --- a/source/blender/compositor/operations/COM_GlareGhostOperation.cpp +++ b/source/blender/compositor/operations/COM_GlareGhostOperation.cpp @@ -85,11 +85,11 @@ void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, No s = (u - 0.5f) * sc + 0.5f, t = (v - 0.5f) * sc + 0.5f; tbuf1->read(c, s * gbuf->getWidth(), t * gbuf->getHeight()); sm = smoothMask(s, t); - fRGB_mult(c, sm); + mul_v3_fl(c, sm); s = (u - 0.5f) * isc + 0.5f, t = (v - 0.5f) * isc + 0.5f; tbuf2->read(tc, s * gbuf->getWidth() - 0.5f, t * gbuf->getHeight() - 0.5f); sm = smoothMask(s, t); - fRGB_madd(c, tc, sm); + madd_v3_v3fl(c, tc, sm); gbuf->writePixel(x, y, c); } @@ -109,9 +109,9 @@ void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, No s = (u - 0.5f) * scalef[np] + 0.5f; t = (v - 0.5f) * scalef[np] + 0.5f; gbuf->read(c, s * gbuf->getWidth() - 0.5f, t * gbuf->getHeight() - 0.5f); - fRGB_colormult(c, cm[np]); + mul_v3_v3(c, cm[np]); sm = smoothMask(s, t) * 0.25f; - fRGB_madd(tc, c, sm); + madd_v3_v3fl(tc, c, sm); } tbuf1->addPixel(x, y, tc); } |