[Bf-blender-cvs] [10705807fe0] blender-v2.82-release: Fix T68076: Color Correction node generates NaN
Jacques Lucke
noreply at git.blender.org
Thu Feb 6 10:24:19 CET 2020
Commit: 10705807fe0672d9d42bee293aab6d73f1deb6b2
Author: Jacques Lucke
Date: Thu Feb 6 10:19:51 2020 +0100
Branches: blender-v2.82-release
https://developer.blender.org/rB10705807fe0672d9d42bee293aab6d73f1deb6b2
Fix T68076: Color Correction node generates NaN
This is the same fix that the `GammaOperation` uses.
Differential Revision: https://developer.blender.org/D6696
Reviewers: brecht
===================================================================
M source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp
===================================================================
diff --git a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp
index a90a3e234d8..31567398d98 100644
--- a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp
@@ -117,9 +117,10 @@ void ColorCorrectionOperation::executePixelSampled(float output[4],
g = 0.5f + ((g - 0.5f) * contrast);
b = 0.5f + ((b - 0.5f) * contrast);
- r = powf(r * gain + lift, invgamma);
- g = powf(g * gain + lift, invgamma);
- b = powf(b * gain + lift, invgamma);
+ /* Check for negative values to avoid nan. */
+ r = (r > 0.0f) ? powf(r * gain + lift, invgamma) : r;
+ g = (g > 0.0f) ? powf(g * gain + lift, invgamma) : g;
+ b = (b > 0.0f) ? powf(b * gain + lift, invgamma) : b;
// mix with mask
r = mvalue * inputImageColor[0] + value * r;
More information about the Bf-blender-cvs
mailing list