Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-07-07 19:06:57 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-07-07 19:06:57 +0400
commitbe1846bcf68636628b60e5b958a6b41e41b3f5a0 (patch)
tree19b480c6c7cd86b3bfe011139139dcbb297a7d5d /source/blender/blenkernel
parent358738c1aa6115aa7ccbd676166f943e4ee1dbd3 (diff)
fix for numeric problems for color balance in the sequencer (same check as in compositor).
for optimized builds this gave crazy colors.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/sequencer.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 8412b5d64de..cf9e159bafb 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -1536,9 +1536,14 @@ static StripColorBalance calc_cb(StripColorBalance * cb_)
}
/* note: lift is actually 2-lift */
-MINLINE float color_balance_fl(float v, const float lift, const float gain, const float gamma, const float mul)
+MINLINE float color_balance_fl(float in, const float lift, const float gain, const float gamma, const float mul)
{
- return powf((((v - 1.0f) * lift) + 1.0f) * gain, gamma) * mul;
+ float x= (((in - 1.0f) * lift) + 1.0f) * gain;
+
+ /* prevent NaN */
+ if (x < 0.f) x = 0.f;
+
+ return powf(x, gamma) * mul;
}
static void make_cb_table_byte(float lift, float gain, float gamma,