diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-08-26 09:45:37 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-08-26 09:49:34 +0300 |
commit | 207c360900ca2346fd01f32a8ded88fcdd5ec39f (patch) | |
tree | 831b258edc046f44b49e548d75e37e0672169219 | |
parent | 1d34f0feede65460d564e4f0cf17f73007e102f2 (diff) |
Fix T45793: ChromaMatte incorrect output
Port to new node system missed important step.
-rw-r--r-- | source/blender/compositor/operations/COM_ChromaMatteOperation.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp b/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp index 3329093882d..9a20ca412e0 100644 --- a/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp @@ -66,6 +66,16 @@ void ChromaMatteOperation::executePixelSampled(float output[4], float x, float y /* Algorithm from book "Video Demistified," does not include the spill reduction part */ /* find theta, the angle that the color space should be rotated based on key */ + + /* rescale to -1.0..1.0 */ + // inImage[0] = (inImage[0] * 2.0f) - 1.0f; // UNUSED + inImage[1] = (inImage[1] * 2.0f) - 1.0f; + inImage[2] = (inImage[2] * 2.0f) - 1.0f; + + // inKey[0] = (inKey[0] * 2.0f) - 1.0f; // UNUSED + inKey[1] = (inKey[1] * 2.0f) - 1.0f; + inKey[2] = (inKey[2] * 2.0f) - 1.0f; + theta = atan2(inKey[2], inKey[1]); /*rotate the cb and cr into x/z space */ @@ -77,7 +87,7 @@ void ChromaMatteOperation::executePixelSampled(float output[4], float x, float y kfg = x_angle - (fabsf(z_angle) / tanf(acceptance / 2.f)); if (kfg > 0.f) { /* found a pixel that is within key color */ - alpha = (1.f - kfg) * (gain); + alpha = 1.0f - (kfg / gain); beta = atan2(z_angle, x_angle); |