From 207c360900ca2346fd01f32a8ded88fcdd5ec39f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 26 Aug 2015 16:45:37 +1000 Subject: Fix T45793: ChromaMatte incorrect output Port to new node system missed important step. --- .../compositor/operations/COM_ChromaMatteOperation.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'source/blender/compositor/operations/COM_ChromaMatteOperation.cpp') 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); -- cgit v1.2.3