[Bf-blender-cvs] [207c360] master: Fix T45793: ChromaMatte incorrect output

Campbell Barton noreply at git.blender.org
Wed Aug 26 08:54:57 CEST 2015


Commit: 207c360900ca2346fd01f32a8ded88fcdd5ec39f
Author: Campbell Barton
Date:   Wed Aug 26 16:45:37 2015 +1000
Branches: master
https://developer.blender.org/rB207c360900ca2346fd01f32a8ded88fcdd5ec39f

Fix T45793: ChromaMatte incorrect output

Port to new node system missed important step.

===================================================================

M	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 3329093..9a20ca4 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);




More information about the Bf-blender-cvs mailing list