[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29979] trunk/blender/source/blender/ blenkernel/intern/sequencer.c: Color Balance
Campbell Barton
ideasman42 at gmail.com
Mon Jul 5 11:56:08 CEST 2010
Revision: 29979
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29979
Author: campbellbarton
Date: 2010-07-05 11:56:06 +0200 (Mon, 05 Jul 2010)
Log Message:
-----------
Color Balance
- color_balance_float_float wasnt using the new calculation method
- moved calculation into an inline function color_balance_fl() & made the lift adjustments less confusing.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/sequencer.c
Modified: trunk/blender/source/blender/blenkernel/intern/sequencer.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/sequencer.c 2010-07-05 09:39:59 UTC (rev 29978)
+++ trunk/blender/source/blender/blenkernel/intern/sequencer.c 2010-07-05 09:56:06 UTC (rev 29979)
@@ -1493,15 +1493,15 @@
StripColorBalance cb = *cb_;
int c;
- if (cb.flag & SEQ_COLOR_BALANCE_INVERSE_LIFT) {
- for (c = 0; c < 3; c++) {
- cb.lift[c] = 1.0 - cb.lift[c];
- }
- } else {
- for (c = 0; c < 3; c++) {
- cb.lift[c] = -(1.0 - cb.lift[c]);
- }
+ for (c = 0; c < 3; c++) {
+ cb.lift[c] = 2.0f - pow(cb.lift[c], 2);
}
+
+ if(cb.flag & SEQ_COLOR_BALANCE_INVERSE_LIFT) {
+ negate_v3(cb.lift);
+ }
+
+
if (cb.flag & SEQ_COLOR_BALANCE_INVERSE_GAIN) {
for (c = 0; c < 3; c++) {
if (cb.gain[c] != 0.0) {
@@ -1525,21 +1525,20 @@
return cb;
}
+/* compiler should inline */
+MINLINE float color_balance_fl(float v, float lift, float gain, float gamma, float mul)
+{
+ return pow(pow(v * gain, lift), gamma) * mul;
+}
+
+
static void make_cb_table_byte(float lift, float gain, float gamma,
unsigned char * table, float mul)
{
int y;
- /* matches 'LooksBuilder', generally looks nice too */
- if(lift >= 1.0f) lift= 0.0f;
- else lift= (1.0f - lift) * (1.0f - lift);
- /* end modif's */
for (y = 0; y < 256; y++) {
- float v = (float)y * (1.0 / 255.0f);
- v *= gain;
- v = pow(v, lift);
- v = pow(v, gamma);
- v *= mul;
+ float v= color_balance_fl((float)y * (1.0 / 255.0f), lift, gain, gamma, mul);
CLAMP(v, 0.0f, 1.0f);
table[y] = v * 255;
}
@@ -1549,17 +1548,9 @@
float * table, float mul)
{
int y;
- /* matches 'LooksBuilder', generally looks nice too */
- if(lift >= 1.0f) lift= 0.0f;
- else lift= (1.0f - lift) * (1.0f - lift);
- /* end modif's */
for (y = 0; y < 256; y++) {
- float v = (float)y * (1.0 / 255.0f);
- v *= gain;
- v = pow(v, lift);
- v = pow(v, gamma);
- v *= mul;
+ float v= color_balance_fl((float)y * (1.0 / 255.0f), lift, gain, gamma, mul);
table[y] = v;
}
}
@@ -1630,8 +1621,7 @@
while (p < e) {
int c;
for (c = 0; c < 3; c++) {
- p[c] = pow(p[c] * cb.gain[c] + cb.lift[c],
- cb.gamma[c]) * mul;
+ p[c]= color_balance_fl(p[c], cb.lift[c], cb.gain[c], cb.gamma[c], mul);
}
p += 4;
}
More information about the Bf-blender-cvs
mailing list