diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (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_ConvolutionEdgeFilterOperation.cpp')
-rw-r--r-- | source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp index b79fea5bfd9..1439c7abb45 100644 --- a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp @@ -21,79 +21,79 @@ ConvolutionEdgeFilterOperation::ConvolutionEdgeFilterOperation() : ConvolutionFilterOperation() { - /* pass */ + /* pass */ } void ConvolutionEdgeFilterOperation::executePixel(float output[4], int x, int y, void * /*data*/) { - float in1[4], in2[4], res1[4] = {0.0}, res2[4] = {0.0}; - - int x1 = x - 1; - int x2 = x; - int x3 = x + 1; - int y1 = y - 1; - int y2 = y; - int y3 = y + 1; - CLAMP(x1, 0, getWidth() - 1); - CLAMP(x2, 0, getWidth() - 1); - CLAMP(x3, 0, getWidth() - 1); - CLAMP(y1, 0, getHeight() - 1); - CLAMP(y2, 0, getHeight() - 1); - CLAMP(y3, 0, getHeight() - 1); - - float value[4]; - this->m_inputValueOperation->read(value, x2, y2, NULL); - float mval = 1.0f - value[0]; - - this->m_inputOperation->read(in1, x1, y1, NULL); - madd_v3_v3fl(res1, in1, this->m_filter[0]); - madd_v3_v3fl(res2, in1, this->m_filter[0]); - - this->m_inputOperation->read(in1, x2, y1, NULL); - madd_v3_v3fl(res1, in1, this->m_filter[1]); - madd_v3_v3fl(res2, in1, this->m_filter[3]); - - this->m_inputOperation->read(in1, x3, y1, NULL); - madd_v3_v3fl(res1, in1, this->m_filter[2]); - madd_v3_v3fl(res2, in1, this->m_filter[6]); - - this->m_inputOperation->read(in1, x1, y2, NULL); - madd_v3_v3fl(res1, in1, this->m_filter[3]); - madd_v3_v3fl(res2, in1, this->m_filter[1]); - - this->m_inputOperation->read(in2, x2, y2, NULL); - madd_v3_v3fl(res1, in2, this->m_filter[4]); - madd_v3_v3fl(res2, in2, this->m_filter[4]); - - this->m_inputOperation->read(in1, x3, y2, NULL); - madd_v3_v3fl(res1, in1, this->m_filter[5]); - madd_v3_v3fl(res2, in1, this->m_filter[7]); - - this->m_inputOperation->read(in1, x1, y3, NULL); - madd_v3_v3fl(res1, in1, this->m_filter[6]); - madd_v3_v3fl(res2, in1, this->m_filter[2]); - - this->m_inputOperation->read(in1, x2, y3, NULL); - madd_v3_v3fl(res1, in1, this->m_filter[7]); - madd_v3_v3fl(res2, in1, this->m_filter[5]); - - this->m_inputOperation->read(in1, x3, y3, NULL); - madd_v3_v3fl(res1, in1, this->m_filter[8]); - madd_v3_v3fl(res2, in1, this->m_filter[8]); - - output[0] = sqrt(res1[0] * res1[0] + res2[0] * res2[0]); - output[1] = sqrt(res1[1] * res1[1] + res2[1] * res2[1]); - output[2] = sqrt(res1[2] * res1[2] + res2[2] * res2[2]); - - output[0] = output[0] * value[0] + in2[0] * mval; - output[1] = output[1] * value[0] + in2[1] * mval; - output[2] = output[2] * value[0] + in2[2] * mval; - - output[3] = in2[3]; - - /* Make sure we don't return negative color. */ - output[0] = max(output[0], 0.0f); - output[1] = max(output[1], 0.0f); - output[2] = max(output[2], 0.0f); - output[3] = max(output[3], 0.0f); + float in1[4], in2[4], res1[4] = {0.0}, res2[4] = {0.0}; + + int x1 = x - 1; + int x2 = x; + int x3 = x + 1; + int y1 = y - 1; + int y2 = y; + int y3 = y + 1; + CLAMP(x1, 0, getWidth() - 1); + CLAMP(x2, 0, getWidth() - 1); + CLAMP(x3, 0, getWidth() - 1); + CLAMP(y1, 0, getHeight() - 1); + CLAMP(y2, 0, getHeight() - 1); + CLAMP(y3, 0, getHeight() - 1); + + float value[4]; + this->m_inputValueOperation->read(value, x2, y2, NULL); + float mval = 1.0f - value[0]; + + this->m_inputOperation->read(in1, x1, y1, NULL); + madd_v3_v3fl(res1, in1, this->m_filter[0]); + madd_v3_v3fl(res2, in1, this->m_filter[0]); + + this->m_inputOperation->read(in1, x2, y1, NULL); + madd_v3_v3fl(res1, in1, this->m_filter[1]); + madd_v3_v3fl(res2, in1, this->m_filter[3]); + + this->m_inputOperation->read(in1, x3, y1, NULL); + madd_v3_v3fl(res1, in1, this->m_filter[2]); + madd_v3_v3fl(res2, in1, this->m_filter[6]); + + this->m_inputOperation->read(in1, x1, y2, NULL); + madd_v3_v3fl(res1, in1, this->m_filter[3]); + madd_v3_v3fl(res2, in1, this->m_filter[1]); + + this->m_inputOperation->read(in2, x2, y2, NULL); + madd_v3_v3fl(res1, in2, this->m_filter[4]); + madd_v3_v3fl(res2, in2, this->m_filter[4]); + + this->m_inputOperation->read(in1, x3, y2, NULL); + madd_v3_v3fl(res1, in1, this->m_filter[5]); + madd_v3_v3fl(res2, in1, this->m_filter[7]); + + this->m_inputOperation->read(in1, x1, y3, NULL); + madd_v3_v3fl(res1, in1, this->m_filter[6]); + madd_v3_v3fl(res2, in1, this->m_filter[2]); + + this->m_inputOperation->read(in1, x2, y3, NULL); + madd_v3_v3fl(res1, in1, this->m_filter[7]); + madd_v3_v3fl(res2, in1, this->m_filter[5]); + + this->m_inputOperation->read(in1, x3, y3, NULL); + madd_v3_v3fl(res1, in1, this->m_filter[8]); + madd_v3_v3fl(res2, in1, this->m_filter[8]); + + output[0] = sqrt(res1[0] * res1[0] + res2[0] * res2[0]); + output[1] = sqrt(res1[1] * res1[1] + res2[1] * res2[1]); + output[2] = sqrt(res1[2] * res1[2] + res2[2] * res2[2]); + + output[0] = output[0] * value[0] + in2[0] * mval; + output[1] = output[1] * value[0] + in2[1] * mval; + output[2] = output[2] * value[0] + in2[2] * mval; + + output[3] = in2[3]; + + /* Make sure we don't return negative color. */ + output[0] = max(output[0], 0.0f); + output[1] = max(output[1], 0.0f); + output[2] = max(output[2], 0.0f); + output[3] = max(output[3], 0.0f); } |