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>2019-04-17 07:17:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-17 07:21:24 +0300
commite12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch)
tree8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/compositor/operations/COM_BilateralBlurOperation.cpp
parentb3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff)
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/compositor/operations/COM_BilateralBlurOperation.cpp')
-rw-r--r--source/blender/compositor/operations/COM_BilateralBlurOperation.cpp133
1 files changed, 68 insertions, 65 deletions
diff --git a/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp b/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp
index f866eac8ae3..5628c575b70 100644
--- a/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp
@@ -20,93 +20,96 @@
#include "BLI_math.h"
extern "C" {
-# include "RE_pipeline.h"
+#include "RE_pipeline.h"
}
BilateralBlurOperation::BilateralBlurOperation() : NodeOperation()
{
- this->addInputSocket(COM_DT_COLOR);
- this->addInputSocket(COM_DT_COLOR);
- this->addOutputSocket(COM_DT_COLOR);
- this->setComplex(true);
+ this->addInputSocket(COM_DT_COLOR);
+ this->addInputSocket(COM_DT_COLOR);
+ this->addOutputSocket(COM_DT_COLOR);
+ this->setComplex(true);
- this->m_inputColorProgram = NULL;
- this->m_inputDeterminatorProgram = NULL;
+ this->m_inputColorProgram = NULL;
+ this->m_inputDeterminatorProgram = NULL;
}
void BilateralBlurOperation::initExecution()
{
- this->m_inputColorProgram = getInputSocketReader(0);
- this->m_inputDeterminatorProgram = getInputSocketReader(1);
- this->m_space = this->m_data->sigma_space + this->m_data->iter;
- QualityStepHelper::initExecution(COM_QH_INCREASE);
+ this->m_inputColorProgram = getInputSocketReader(0);
+ this->m_inputDeterminatorProgram = getInputSocketReader(1);
+ this->m_space = this->m_data->sigma_space + this->m_data->iter;
+ QualityStepHelper::initExecution(COM_QH_INCREASE);
}
void BilateralBlurOperation::executePixel(float output[4], int x, int y, void *data)
{
- // read the determinator color at x, y, this will be used as the reference color for the determinator
- float determinatorReferenceColor[4];
- float determinator[4];
- float tempColor[4];
- float blurColor[4];
- float blurDivider;
- float space = this->m_space;
- float sigmacolor = this->m_data->sigma_color;
- int minx = floor(x - space);
- int maxx = ceil(x + space);
- int miny = floor(y - space);
- int maxy = ceil(y + space);
- float deltaColor;
- this->m_inputDeterminatorProgram->read(determinatorReferenceColor, x, y, data);
+ // read the determinator color at x, y, this will be used as the reference color for the determinator
+ float determinatorReferenceColor[4];
+ float determinator[4];
+ float tempColor[4];
+ float blurColor[4];
+ float blurDivider;
+ float space = this->m_space;
+ float sigmacolor = this->m_data->sigma_color;
+ int minx = floor(x - space);
+ int maxx = ceil(x + space);
+ int miny = floor(y - space);
+ int maxy = ceil(y + space);
+ float deltaColor;
+ this->m_inputDeterminatorProgram->read(determinatorReferenceColor, x, y, data);
- zero_v4(blurColor);
- blurDivider = 0.0f;
- /* TODO(sergey): This isn't really good bilateral filter, it should be
- * using gaussian bell for weights. Also sigma_color doesn't seem to be
- * used correct at all.
- */
- for (int yi = miny; yi < maxy; yi += QualityStepHelper::getStep()) {
- for (int xi = minx; xi < maxx; xi += QualityStepHelper::getStep()) {
- // read determinator
- this->m_inputDeterminatorProgram->read(determinator, xi, yi, data);
- deltaColor = (fabsf(determinatorReferenceColor[0] - determinator[0]) +
- fabsf(determinatorReferenceColor[1] - determinator[1]) +
- fabsf(determinatorReferenceColor[2] - determinator[2])); // do not take the alpha channel into account
- if (deltaColor < sigmacolor) {
- // add this to the blur
- this->m_inputColorProgram->read(tempColor, xi, yi, data);
- add_v4_v4(blurColor, tempColor);
- blurDivider += 1.0f;
- }
- }
- }
+ zero_v4(blurColor);
+ blurDivider = 0.0f;
+ /* TODO(sergey): This isn't really good bilateral filter, it should be
+ * using gaussian bell for weights. Also sigma_color doesn't seem to be
+ * used correct at all.
+ */
+ for (int yi = miny; yi < maxy; yi += QualityStepHelper::getStep()) {
+ for (int xi = minx; xi < maxx; xi += QualityStepHelper::getStep()) {
+ // read determinator
+ this->m_inputDeterminatorProgram->read(determinator, xi, yi, data);
+ deltaColor = (fabsf(determinatorReferenceColor[0] - determinator[0]) +
+ fabsf(determinatorReferenceColor[1] - determinator[1]) +
+ fabsf(determinatorReferenceColor[2] -
+ determinator[2])); // do not take the alpha channel into account
+ if (deltaColor < sigmacolor) {
+ // add this to the blur
+ this->m_inputColorProgram->read(tempColor, xi, yi, data);
+ add_v4_v4(blurColor, tempColor);
+ blurDivider += 1.0f;
+ }
+ }
+ }
- if (blurDivider > 0.0f) {
- mul_v4_v4fl(output, blurColor, 1.0f / blurDivider);
- }
- else {
- output[0] = 0.0f;
- output[1] = 0.0f;
- output[2] = 0.0f;
- output[3] = 1.0f;
- }
+ if (blurDivider > 0.0f) {
+ mul_v4_v4fl(output, blurColor, 1.0f / blurDivider);
+ }
+ else {
+ output[0] = 0.0f;
+ output[1] = 0.0f;
+ output[2] = 0.0f;
+ output[3] = 1.0f;
+ }
}
void BilateralBlurOperation::deinitExecution()
{
- this->m_inputColorProgram = NULL;
- this->m_inputDeterminatorProgram = NULL;
+ this->m_inputColorProgram = NULL;
+ this->m_inputDeterminatorProgram = NULL;
}
-bool BilateralBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
+bool BilateralBlurOperation::determineDependingAreaOfInterest(rcti *input,
+ ReadBufferOperation *readOperation,
+ rcti *output)
{
- rcti newInput;
- int add = ceil(this->m_space) + 1;
+ rcti newInput;
+ int add = ceil(this->m_space) + 1;
- newInput.xmax = input->xmax + (add);
- newInput.xmin = input->xmin - (add);
- newInput.ymax = input->ymax + (add);
- newInput.ymin = input->ymin - (add);
+ newInput.xmax = input->xmax + (add);
+ newInput.xmin = input->xmin - (add);
+ newInput.ymax = input->ymax + (add);
+ newInput.ymin = input->ymin - (add);
- return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
+ return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output);
}