diff options
author | Matt Ebb <matt@mke3.net> | 2010-08-29 08:48:00 +0400 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2010-08-29 08:48:00 +0400 |
commit | c2e43d7c3be5202a36da46d6ddb564148da57ef0 (patch) | |
tree | 10d7d54fa2d74ea03c271d4620e29dbd81f0972b | |
parent | ad70072009179fc888572ebc0625a44634052cfe (diff) |
Tweaks to ASC-CDL colour balance formula to exactly match the spec.
-rw-r--r-- | source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c b/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c index 43c6c6d791e..33f5680eaa9 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c @@ -43,15 +43,24 @@ static bNodeSocketType cmp_node_colorbalance_out[]={ {-1,0,""} }; +/* this function implements ASC-CDL according to the spec at http://www.asctech.org/ + Slope + S = in * slope + Offset + O = S + offset + = (in * slope) + offset + Power + out = Clamp(O) ^ power + = Clamp((in * slope) + offset) ^ power + */ DO_INLINE float colorbalance_cdl(float in, float offset, float power, float slope) { float x = in * slope + offset; /* prevent NaN */ - if (x < 0.f) x = 0.f; + CLAMP(x, 0.0, 1.0); - //powf(in * slope + offset, power) - return powf(x, 1.f/power); + return powf(x, power); } /* note: lift_lgg is just 2-lift, gamma_inv is 1.0/gamma */ |