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:21:55 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-10-23 20:21:55 +0400
commitfec81d9b56075f46f6dde196ac85140872cff74e (patch)
tree6ee12fcc0b04ba3041f1b7e4d17281136375beb1 /source/blender/compositor/operations
parentc623ba5e4b2aa68a5717ba17500c14217bc417aa (diff)
use min_ max_ functions in more places.
also fix minor error in MOD decimate when the modifier did nothing the reported face count would be wrong.
Diffstat (limited to 'source/blender/compositor/operations')
-rw-r--r--source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_CropOperation.cpp8
-rw-r--r--source/blender/compositor/operations/COM_DilateErodeOperation.cpp8
-rw-r--r--source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp2
-rw-r--r--source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp8
-rw-r--r--source/blender/compositor/operations/COM_KeyingDespillOperation.cpp8
-rw-r--r--source/blender/compositor/operations/COM_KeyingOperation.cpp12
-rw-r--r--source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp2
8 files changed, 25 insertions, 25 deletions
diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp
index f6b23f6afd2..f39a28b87a8 100644
--- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp
+++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp
@@ -65,7 +65,7 @@ void ConvertDepthToRadiusOperation::initExecution()
this->m_aspect = (this->getWidth() > this->getHeight()) ? (this->getHeight() / (float)this->getWidth()) : (this->getWidth() / (float)this->getHeight());
this->m_aperture = 0.5f * (this->m_cam_lens / (this->m_aspect * cam_sensor)) / this->m_fStop;
const float minsz = min(getWidth(), getHeight());
- this->m_dof_sp = minsz / ((cam_sensor / 2.0f) / this->m_cam_lens); // <- == aspect * MIN2(img->x, img->y) / tan(0.5f * fov);
+ this->m_dof_sp = minsz / ((cam_sensor / 2.0f) / this->m_cam_lens); // <- == aspect * min(img->x, img->y) / tan(0.5f * fov);
if (this->m_blurPostOperation) {
m_blurPostOperation->setSigma(min(m_aperture * 128.0f, this->m_maxRadius));
diff --git a/source/blender/compositor/operations/COM_CropOperation.cpp b/source/blender/compositor/operations/COM_CropOperation.cpp
index 24f28b2c98f..925374c79ed 100644
--- a/source/blender/compositor/operations/COM_CropOperation.cpp
+++ b/source/blender/compositor/operations/COM_CropOperation.cpp
@@ -54,10 +54,10 @@ void CropBaseOperation::updateArea()
if (height <= this->m_settings->y2 + 1)
this->m_settings->y2 = height - 1;
- this->m_xmax = MAX2(this->m_settings->x1, this->m_settings->x2) + 1;
- this->m_xmin = MIN2(this->m_settings->x1, this->m_settings->x2);
- this->m_ymax = MAX2(this->m_settings->y1, this->m_settings->y2) + 1;
- this->m_ymin = MIN2(this->m_settings->y1, this->m_settings->y2);
+ this->m_xmax = max(this->m_settings->x1, this->m_settings->x2) + 1;
+ this->m_xmin = min(this->m_settings->x1, this->m_settings->x2);
+ this->m_ymax = max(this->m_settings->y1, this->m_settings->y2) + 1;
+ this->m_ymin = min(this->m_settings->y1, this->m_settings->y2);
}
}
diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
index 9c09c9bf034..f0fffa770f8 100644
--- a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
+++ b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
@@ -344,28 +344,28 @@ void *DilateStepOperation::initializeTileData(rcti *rect)
for (y = 0; y < bheight; y++) {
for (x = 0; x < bwidth - 1; x++) {
p = rectf + (bwidth * y + x);
- *p = MAX2(*p, *(p + 1));
+ *p = max(*p, *(p + 1));
}
}
for (y = 0; y < bheight; y++) {
for (x = bwidth - 1; x >= 1; x--) {
p = rectf + (bwidth * y + x);
- *p = MAX2(*p, *(p - 1));
+ *p = max(*p, *(p - 1));
}
}
for (x = 0; x < bwidth; x++) {
for (y = 0; y < bheight - 1; y++) {
p = rectf + (bwidth * y + x);
- *p = MAX2(*p, *(p + bwidth));
+ *p = max(*p, *(p + bwidth));
}
}
for (x = 0; x < bwidth; x++) {
for (y = bheight - 1; y >= 1; y--) {
p = rectf + (bwidth * y + x);
- *p = MAX2(*p, *(p - bwidth));
+ *p = max(*p, *(p - bwidth));
}
}
}
diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
index 262252f7d8c..4bdb2591cb7 100644
--- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp
@@ -190,7 +190,7 @@ void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, unsign
} (void)0
// intermediate buffers
- sz = MAX2(src_width, src_height);
+ sz = max(src_width, src_height);
X = (double *)MEM_callocN(sz * sizeof(double), "IIR_gauss X buf");
Y = (double *)MEM_callocN(sz * sizeof(double), "IIR_gauss Y buf");
W = (double *)MEM_callocN(sz * sizeof(double), "IIR_gauss W buf");
diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
index a9bcb2dd752..44bce6308e8 100644
--- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
@@ -257,7 +257,7 @@ void GaussianBlurReferenceOperation::initExecution()
void GaussianBlurReferenceOperation::updateGauss()
{
int i;
- int x = MAX2(m_radx, m_rady);
+ int x = max(m_radx, m_rady);
this->m_maintabs = (float **)MEM_mallocN(x * sizeof(float *), "gauss array");
for (i = 0; i < x; i++) {
m_maintabs[i] = make_gausstab(i + 1);
@@ -327,11 +327,11 @@ void GaussianBlurReferenceOperation::executePixel(float output[4], int x, int y,
void GaussianBlurReferenceOperation::deinitExecution()
{
int x, i;
- x = MAX2(m_radx, m_rady);
+ x = max(this->m_radx, this->m_rady);
for (i = 0; i < x; i++) {
- MEM_freeN(m_maintabs[i]);
+ MEM_freeN(this->m_maintabs[i]);
}
- MEM_freeN(m_maintabs);
+ MEM_freeN(this->m_maintabs);
BlurBaseOperation::deinitExecution();
}
diff --git a/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp b/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp
index 4426666f100..f9f43025d29 100644
--- a/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp
+++ b/source/blender/compositor/operations/COM_KeyingDespillOperation.cpp
@@ -28,9 +28,9 @@
#include "BLI_listbase.h"
#include "BLI_math.h"
-static int get_pixel_primary_channel(float *pixel)
+static int get_pixel_primary_channel(float pixel[3])
{
- float max_value = MAX3(pixel[0], pixel[1], pixel[2]);
+ float max_value = max(max(pixel[0], pixel[1]), pixel[2]);
if (max_value == pixel[0])
return 0;
@@ -77,8 +77,8 @@ void KeyingDespillOperation::executePixel(float output[4], float x, float y, Pix
int other_1 = (screen_primary_channel + 1) % 3;
int other_2 = (screen_primary_channel + 2) % 3;
- int min_channel = MIN2(other_1, other_2);
- int max_channel = MAX2(other_1, other_2);
+ int min_channel = min(other_1, other_2);
+ 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 35138cf0b92..bc2d14d42b8 100644
--- a/source/blender/compositor/operations/COM_KeyingOperation.cpp
+++ b/source/blender/compositor/operations/COM_KeyingOperation.cpp
@@ -28,13 +28,13 @@
#include "BLI_listbase.h"
#include "BLI_math.h"
-static int get_pixel_primary_channel(float pixelColor[4])
+static int get_pixel_primary_channel(float pixel[3])
{
- float max_value = MAX3(pixelColor[0], pixelColor[1], pixelColor[2]);
+ float max_value = max(max(pixel[0], pixel[1]), pixel[2]);
- if (max_value == pixelColor[0])
+ if (max_value == pixel[0])
return 0;
- else if (max_value == pixelColor[1])
+ else if (max_value == pixel[1])
return 1;
return 2;
@@ -45,8 +45,8 @@ static float get_pixel_saturation(float pixelColor[4], float screen_balance, int
int other_1 = (primary_channel + 1) % 3;
int other_2 = (primary_channel + 2) % 3;
- int min_channel = MIN2(other_1, other_2);
- int max_channel = MAX2(other_1, other_2);
+ int min_channel = min(other_1, other_2);
+ int max_channel = max(other_1, other_2);
float val = screen_balance * pixelColor[min_channel] + (1.0f - screen_balance) * pixelColor[max_channel];
diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
index b8e15934c30..52a9e2a4d8c 100644
--- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
@@ -198,7 +198,7 @@ void VariableSizeBokehBlurOperation::executeOpenCL(OpenCLDevice *device,
cl_float scalar = this->m_do_size_scale ? (max_dim / 100.0f) : 1.0f;
maxBlur = (cl_int)sizeMemoryBuffer->getMaximumValue() * scalar;
- maxBlur = MIN2(maxBlur, this->m_maxBlur);
+ maxBlur = min(maxBlur, this->m_maxBlur);
device->COM_clAttachMemoryBufferToKernelParameter(defocusKernel, 0, -1, clMemToCleanUp, inputMemoryBuffers, this->m_inputProgram);
device->COM_clAttachMemoryBufferToKernelParameter(defocusKernel, 1, -1, clMemToCleanUp, inputMemoryBuffers, this->m_inputBokehProgram);