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_CalculateStandardDeviationOperation.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_CalculateStandardDeviationOperation.cpp')
-rw-r--r--source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp128
1 files changed, 68 insertions, 60 deletions
diff --git a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp
index 7fa1929889c..dfe1a936c9c 100644
--- a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp
+++ b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp
@@ -24,75 +24,83 @@ extern "C" {
#include "IMB_colormanagement.h"
}
-CalculateStandardDeviationOperation::CalculateStandardDeviationOperation() : CalculateMeanOperation()
+CalculateStandardDeviationOperation::CalculateStandardDeviationOperation()
+ : CalculateMeanOperation()
{
- /* pass */
+ /* pass */
}
void CalculateStandardDeviationOperation::executePixel(float output[4],
- int /*x*/, int /*y*/,
+ int /*x*/,
+ int /*y*/,
void * /*data*/)
{
- output[0] = this->m_standardDeviation;
+ output[0] = this->m_standardDeviation;
}
void *CalculateStandardDeviationOperation::initializeTileData(rcti *rect)
{
- lockMutex();
- if (!this->m_iscalculated) {
- MemoryBuffer *tile = (MemoryBuffer *)this->m_imageReader->initializeTileData(rect);
- CalculateMeanOperation::calculateMean(tile);
- this->m_standardDeviation = 0.0f;
- float *buffer = tile->getBuffer();
- int size = tile->getWidth() * tile->getHeight();
- int pixels = 0;
- float sum = 0.0f;
- float mean = this->m_result;
- for (int i = 0, offset = 0; i < size; i++, offset += 4) {
- if (buffer[offset + 3] > 0) {
- pixels++;
+ lockMutex();
+ if (!this->m_iscalculated) {
+ MemoryBuffer *tile = (MemoryBuffer *)this->m_imageReader->initializeTileData(rect);
+ CalculateMeanOperation::calculateMean(tile);
+ this->m_standardDeviation = 0.0f;
+ float *buffer = tile->getBuffer();
+ int size = tile->getWidth() * tile->getHeight();
+ int pixels = 0;
+ float sum = 0.0f;
+ float mean = this->m_result;
+ for (int i = 0, offset = 0; i < size; i++, offset += 4) {
+ if (buffer[offset + 3] > 0) {
+ pixels++;
- switch (this->m_setting) {
- case 1: /* rgb combined */
- {
- float value = IMB_colormanagement_get_luminance(&buffer[offset]);
- sum += (value - mean) * (value - mean);
- break;
- }
- case 2: /* red */
- {
- float value = buffer[offset];
- sum += value;
- sum += (value - mean) * (value - mean);
- break;
- }
- case 3: /* green */
- {
- float value = buffer[offset + 1];
- sum += value;
- sum += (value - mean) * (value - mean);
- break;
- }
- case 4: /* blue */
- {
- float value = buffer[offset + 2];
- sum += value;
- sum += (value - mean) * (value - mean);
- break;
- }
- case 5: /* luminance */
- {
- float yuv[3];
- rgb_to_yuv(buffer[offset], buffer[offset + 1], buffer[offset + 2], &yuv[0], &yuv[1], &yuv[2], BLI_YUV_ITU_BT709);
- sum += (yuv[0] - mean) * (yuv[0] - mean);
- break;
- }
- }
- }
- }
- this->m_standardDeviation = sqrt(sum / (float)(pixels - 1));
- this->m_iscalculated = true;
- }
- unlockMutex();
- return NULL;
+ switch (this->m_setting) {
+ case 1: /* rgb combined */
+ {
+ float value = IMB_colormanagement_get_luminance(&buffer[offset]);
+ sum += (value - mean) * (value - mean);
+ break;
+ }
+ case 2: /* red */
+ {
+ float value = buffer[offset];
+ sum += value;
+ sum += (value - mean) * (value - mean);
+ break;
+ }
+ case 3: /* green */
+ {
+ float value = buffer[offset + 1];
+ sum += value;
+ sum += (value - mean) * (value - mean);
+ break;
+ }
+ case 4: /* blue */
+ {
+ float value = buffer[offset + 2];
+ sum += value;
+ sum += (value - mean) * (value - mean);
+ break;
+ }
+ case 5: /* luminance */
+ {
+ float yuv[3];
+ rgb_to_yuv(buffer[offset],
+ buffer[offset + 1],
+ buffer[offset + 2],
+ &yuv[0],
+ &yuv[1],
+ &yuv[2],
+ BLI_YUV_ITU_BT709);
+ sum += (yuv[0] - mean) * (yuv[0] - mean);
+ break;
+ }
+ }
+ }
+ }
+ this->m_standardDeviation = sqrt(sum / (float)(pixels - 1));
+ this->m_iscalculated = true;
+ }
+ unlockMutex();
+ return NULL;
}