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>2012-10-23 20:32:39 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-10-23 20:32:39 +0400
commite038a1c613009d81adda0662dbb1e4a38228909a (patch)
treebe5851f67fda72085c51abd762fb81dd521f1e05 /source/blender/compositor/operations
parentfec81d9b56075f46f6dde196ac85140872cff74e (diff)
reduce float comparisons for keying operation and despill.
Diffstat (limited to 'source/blender/compositor/operations')
-rw-r--r--source/blender/compositor/operations/COM_KeyingDespillOperation.cpp22
-rw-r--r--source/blender/compositor/operations/COM_KeyingOperation.cpp14
2 files changed, 6 insertions, 30 deletions
diff --git a/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp b/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp
index f9f43025d29..73bc5fb2701 100644
--- a/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp
+++ b/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp
@@ -28,18 +28,6 @@
#include "BLI_listbase.h"
#include "BLI_math.h"
-static int get_pixel_primary_channel(float pixel[3])
-{
- float max_value = max(max(pixel[0], pixel[1]), pixel[2]);
-
- if (max_value == pixel[0])
- return 0;
- else if (max_value == pixel[1])
- return 1;
-
- return 2;
-}
-
KeyingDespillOperation::KeyingDespillOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
@@ -73,12 +61,12 @@ void KeyingDespillOperation::executePixel(float output[4], float x, float y, Pix
this->m_pixelReader->read(pixelColor, x, y, sampler);
this->m_screenReader->read(screenColor, x, y, sampler);
- int screen_primary_channel = get_pixel_primary_channel(screenColor);
- int other_1 = (screen_primary_channel + 1) % 3;
- int other_2 = (screen_primary_channel + 2) % 3;
+ const int screen_primary_channel = axis_primary_v3(screenColor);
+ const int other_1 = (screen_primary_channel + 1) % 3;
+ const int other_2 = (screen_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 average_value, amount;
diff --git a/source/blender/compositor/operations/COM_KeyingOperation.cpp b/source/blender/compositor/operations/COM_KeyingOperation.cpp
index bc2d14d42b8..dcb15eda638 100644
--- a/source/blender/compositor/operations/COM_KeyingOperation.cpp
+++ b/source/blender/compositor/operations/COM_KeyingOperation.cpp
@@ -28,18 +28,6 @@
#include "BLI_listbase.h"
#include "BLI_math.h"
-static int get_pixel_primary_channel(float pixel[3])
-{
- float max_value = max(max(pixel[0], pixel[1]), pixel[2]);
-
- if (max_value == pixel[0])
- return 0;
- else if (max_value == pixel[1])
- return 1;
-
- return 2;
-}
-
static float get_pixel_saturation(float pixelColor[4], float screen_balance, int primary_channel)
{
int other_1 = (primary_channel + 1) % 3;
@@ -85,7 +73,7 @@ void KeyingOperation::executePixel(float output[4], float x, float y, PixelSampl
this->m_pixelReader->read(pixelColor, x, y, sampler);
this->m_screenReader->read(screenColor, x, y, sampler);
- int primary_channel = get_pixel_primary_channel(screenColor);
+ const int primary_channel = axis_primary_v3(screenColor);
if (pixelColor[primary_channel] > 1.0f) {
/* overexposure doesn't happen on screen itself and usually happens