[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30024] trunk/blender/source/blender: Correction to recent color balance compositor and sequencer changes.

Campbell Barton ideasman42 at gmail.com
Tue Jul 6 12:21:29 CEST 2010


Revision: 30024
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30024
Author:   campbellbarton
Date:     2010-07-06 12:21:28 +0200 (Tue, 06 Jul 2010)

Log Message:
-----------
Correction to recent color balance compositor and sequencer changes.
- In my changes lift was acting like a second gamma.
- In blender 2.4x it was being added which gave ugly clipping.
- in Magic Bullet Looks it scales the color about 1.0: (col - 1 * (2-lift)) + 1

Did more testing and made sure the order of applying lift/gamma/gain works the same as MagicBulletLooks (tested on Collin's mac laptop).

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/sequencer.c
    trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c

Modified: trunk/blender/source/blender/blenkernel/intern/sequencer.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/sequencer.c	2010-07-06 09:40:49 UTC (rev 30023)
+++ trunk/blender/source/blender/blenkernel/intern/sequencer.c	2010-07-06 10:21:28 UTC (rev 30024)
@@ -1494,7 +1494,7 @@
 	int c;
 
 	for (c = 0; c < 3; c++) {
-		cb.lift[c] = 2.0f - pow(cb.lift[c], 2);
+		cb.lift[c] = 2.0f - cb.lift[c];
 	}
 
 	if(cb.flag & SEQ_COLOR_BALANCE_INVERSE_LIFT) {
@@ -1526,10 +1526,10 @@
 	return cb;
 }
 
-/* pow(p[c] * cb.gain[c] + cb.lift[c], cb.gamma[c]) * mul;*/
-MINLINE float color_balance_fl(const float v, const float lift, const float gain, const float gamma, const float mul)
+/* 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)
 {
-	return powf(powf(v * gain, lift), gamma) * mul;
+	return powf((((v - 1.0f) * lift) + 1.0f) * gain, gamma) * mul;
 }
 
 static void make_cb_table_byte(float lift, float gain, float gamma,

Modified: trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c
===================================================================
--- trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c	2010-07-06 09:40:49 UTC (rev 30023)
+++ trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c	2010-07-06 10:21:28 UTC (rev 30024)
@@ -54,9 +54,10 @@
 	return powf(x, 1.f/power);
 }
 
-DO_INLINE float colorbalance_lgg(float in, float lift, float gamma, float gain)
-{
-	float x= powf(in * gain, lift);
+/* note: lift_lgg is just 2-lift */
+DO_INLINE float colorbalance_lgg(float in, float lift_lgg, float gamma, float gain)
+{	
+	float x= (((in - 1.0f) * lift_lgg) + 1.0f) * gain;
 
 	/* prevent NaN */
 	if (x < 0.f) x = 0.f;
@@ -124,7 +125,7 @@
 		NodeColorBalance *n= (NodeColorBalance *)node->storage;
 		int c;
 		for (c = 0; c < 3; c++) {
-			n->lift_lgg[c] = 2.0f - pow(n->lift[c], 2);
+			n->lift_lgg[c] = 2.0f - n->lift[c];
 		}
 	}
 





More information about the Bf-blender-cvs mailing list