[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51560] trunk/blender/source/blender: rename axis_primary_v3() to max_axis_v3() to avoid confusion with axis_dominant_v3().
Campbell Barton
ideasman42 at gmail.com
Wed Oct 24 04:25:03 CEST 2012
Revision: 51560
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51560
Author: campbellbarton
Date: 2012-10-24 02:25:00 +0000 (Wed, 24 Oct 2012)
Log Message:
-----------
rename axis_primary_v3() to max_axis_v3() to avoid confusion with axis_dominant_v3(). also add min_axis_v3().
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/BLI_math_geom.h
trunk/blender/source/blender/blenlib/intern/math_geom_inline.c
trunk/blender/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_KeyingOperation.cpp
Modified: trunk/blender/source/blender/blenlib/BLI_math_geom.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_math_geom.h 2012-10-24 01:43:59 UTC (rev 51559)
+++ trunk/blender/source/blender/blenlib/BLI_math_geom.h 2012-10-24 02:25:00 UTC (rev 51560)
@@ -283,7 +283,8 @@
void axis_dominant_v3(int *axis_a, int *axis_b, const float axis[3]);
-MINLINE int axis_primary_v3(const float vec[3]);
+MINLINE int max_axis_v3(const float vec[3]);
+MINLINE int min_axis_v3(const float vec[3]);
#ifdef __cplusplus
}
Modified: trunk/blender/source/blender/blenlib/intern/math_geom_inline.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_geom_inline.c 2012-10-24 01:43:59 UTC (rev 51559)
+++ trunk/blender/source/blender/blenlib/intern/math_geom_inline.c 2012-10-24 02:25:00 UTC (rev 51560)
@@ -137,28 +137,24 @@
add_sh_shsh(r, r, tmp);
}
-MINLINE int axis_primary_v3(const float vec[3])
+MINLINE int max_axis_v3(const float vec[3])
{
const float x = vec[0];
const float y = vec[1];
const float z = vec[2];
+ return ((x > y) ?
+ ((x > z) ? 0 : 2) :
+ ((y > z) ? 1 : 2));
+}
- if (x > y) {
- if (x > z) {
- return 0;
- }
- else {
- return 2;
- }
- }
- else {
- if (y > z) {
- return 1;
- }
- else {
- return 2;
- }
- }
+MINLINE int min_axis_v3(const float vec[3])
+{
+ const float x = vec[0];
+ const float y = vec[1];
+ const float z = vec[2];
+ return ((x < y) ?
+ ((x < z) ? 0 : 2) :
+ ((y < z) ? 1 : 2));
}
#endif /* __MATH_GEOM_INLINE_C__ */
Modified: trunk/blender/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp 2012-10-24 01:43:59 UTC (rev 51559)
+++ trunk/blender/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp 2012-10-24 02:25:00 UTC (rev 51560)
@@ -61,7 +61,7 @@
this->m_pixelReader->read(pixelColor, x, y, sampler);
this->m_screenReader->read(screenColor, x, y, sampler);
- const int screen_primary_channel = axis_primary_v3(screenColor);
+ const int screen_primary_channel = max_axis_v3(screenColor);
const int other_1 = (screen_primary_channel + 1) % 3;
const int other_2 = (screen_primary_channel + 2) % 3;
@@ -75,7 +75,8 @@
copy_v4_v4(output, pixelColor);
- if (this->m_despillFactor * amount > 0) {
- output[screen_primary_channel] = pixelColor[screen_primary_channel] - this->m_despillFactor * amount;
+ const float amount_despill = this->m_despillFactor * amount;
+ if (amount_despill > 0.0f) {
+ output[screen_primary_channel] = pixelColor[screen_primary_channel] - amount_despill;
}
}
Modified: trunk/blender/source/blender/compositor/operations/COM_KeyingOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_KeyingOperation.cpp 2012-10-24 01:43:59 UTC (rev 51559)
+++ trunk/blender/source/blender/compositor/operations/COM_KeyingOperation.cpp 2012-10-24 02:25:00 UTC (rev 51560)
@@ -28,15 +28,15 @@
#include "BLI_listbase.h"
#include "BLI_math.h"
-static float get_pixel_saturation(float pixelColor[4], float screen_balance, int primary_channel)
+static float get_pixel_saturation(const float pixelColor[4], float screen_balance, int primary_channel)
{
- int other_1 = (primary_channel + 1) % 3;
- int other_2 = (primary_channel + 2) % 3;
+ const int other_1 = (primary_channel + 1) % 3;
+ const int other_2 = (primary_channel + 2) % 3;
- int min_channel = min(other_1, other_2);
- int max_channel = max(other_1, other_2);
+ const int min_channel = min(other_1, other_2);
+ const int max_channel = max(other_1, other_2);
- float val = screen_balance * pixelColor[min_channel] + (1.0f - screen_balance) * pixelColor[max_channel];
+ const float val = screen_balance * pixelColor[min_channel] + (1.0f - screen_balance) * pixelColor[max_channel];
return (pixelColor[primary_channel] - val) * fabsf(1.0f - val);
}
@@ -73,13 +73,13 @@
this->m_pixelReader->read(pixelColor, x, y, sampler);
this->m_screenReader->read(screenColor, x, y, sampler);
- const int primary_channel = axis_primary_v3(screenColor);
+ const int primary_channel = max_axis_v3(screenColor);
if (pixelColor[primary_channel] > 1.0f) {
/* overexposure doesn't happen on screen itself and usually happens
* on light sources in the shot, this need to be checked separately
* because saturation and falloff calculation is based on the fact
- * that pixels are not overexposured
+ * that pixels are not overexposed
*/
output[0] = 1.0f;
}
More information about the Bf-blender-cvs
mailing list