diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-06-13 19:05:42 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-06-13 19:05:42 +0400 |
commit | 1dec23d33a86c0412852ef510fc5b5b619284697 (patch) | |
tree | 22250958b09cf33ac1e6ea764709194da4307b13 /source/blender/nodes/composite | |
parent | e22aa7bc38c5d38a0714bed8a2a1869383cd5e5a (diff) |
add rgb_to_luma_y(), was being done inline in many places.
Diffstat (limited to 'source/blender/nodes/composite')
-rw-r--r-- | source/blender/nodes/composite/nodes/node_composite_glare.c | 2 | ||||
-rw-r--r-- | source/blender/nodes/composite/nodes/node_composite_tonemap.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/nodes/composite/nodes/node_composite_glare.c b/source/blender/nodes/composite/nodes/node_composite_glare.c index 1e32d6f0461..9b1505e9333 100644 --- a/source/blender/nodes/composite/nodes/node_composite_glare.c +++ b/source/blender/nodes/composite/nodes/node_composite_glare.c @@ -107,7 +107,7 @@ static CompBuf* BTP(CompBuf* src, float threshold, int scaledown) float* cr = bsrc->rect; for (y=0; y<bsrc->y; ++y) for (x=0; x<bsrc->x; ++x, cr+=4) { - if ((0.212671f*cr[0] + 0.71516f*cr[1] + 0.072169f*cr[2]) >= threshold) { + if (rgb_to_luma_y(cr) >= threshold) { cr[0] -= threshold, cr[1] -= threshold, cr[2] -= threshold; cr[0] = MAX2(cr[0], 0.f); cr[1] = MAX2(cr[1], 0.f); diff --git a/source/blender/nodes/composite/nodes/node_composite_tonemap.c b/source/blender/nodes/composite/nodes/node_composite_tonemap.c index a9d071ececc..6196825c9b3 100644 --- a/source/blender/nodes/composite/nodes/node_composite_tonemap.c +++ b/source/blender/nodes/composite/nodes/node_composite_tonemap.c @@ -51,7 +51,7 @@ static float avgLogLum(CompBuf *src, float* auto_key, float* Lav, float* Cav) const float sc = 1.f/(src->x*src->y); *Lav = 0.f; while (p--) { - float L = 0.212671f*bc[0][0] + 0.71516f*bc[0][1] + 0.072169f*bc[0][2]; + float L = rgb_to_luma_y(bc[0]); *Lav += L; fRGB_add(Cav, bc[0]); lsum += (float)log((double)MAX2(L, 0.0) + 1e-5); @@ -86,7 +86,7 @@ static void tonemap(NodeTonemap* ntm, CompBuf* dst, CompBuf* src) fRGB* sp = (fRGB*)&src->rect[y*src->x*src->type]; fRGB* dp = (fRGB*)&dst->rect[y*src->x*src->type]; for (x=0; x<src->x; ++x) { - const float L = 0.212671f*sp[x][0] + 0.71516f*sp[x][1] + 0.072169f*sp[x][2]; + const float L = rgb_to_luma_y(sp[x]); float I_l = sp[x][0] + ic*(L - sp[x][0]); float I_g = Cav[0] + ic*(Lav - Cav[0]); float I_a = I_l + ia*(I_g - I_l); |