diff options
author | Rohan Rathi <rohanrathi08@gmail.com> | 2018-06-20 19:59:44 +0300 |
---|---|---|
committer | Rohan Rathi <rohanrathi08@gmail.com> | 2018-06-20 19:59:44 +0300 |
commit | c73a6b0d42f5ee16bb2af7d585035463854f4024 (patch) | |
tree | c366aeac74491653e0ba516b745116bfa6475f94 /source/blender/compositor/operations | |
parent | dd752476b97aa3b35d1359422ca42e33d99ac851 (diff) | |
parent | 82dc5f91e86351e1a26769ec86d9054437eb77d6 (diff) |
Merge branch 'blender2.8' into soc-2018-bevel
Diffstat (limited to 'source/blender/compositor/operations')
132 files changed, 634 insertions, 627 deletions
diff --git a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp index 928525f2594..e6ae9b5fc8b 100644 --- a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp +++ b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp @@ -32,11 +32,11 @@ void AlphaOverKeyOperation::executePixelSampled(float output[4], float x, float float inputColor1[4]; float inputOverColor[4]; float value[4]; - + this->m_inputValueOperation->readSampled(value, x, y, sampler); this->m_inputColor1Operation->readSampled(inputColor1, x, y, sampler); this->m_inputColor2Operation->readSampled(inputOverColor, x, y, sampler); - + if (inputOverColor[3] <= 0.0f) { copy_v4_v4(output, inputColor1); } @@ -46,7 +46,7 @@ void AlphaOverKeyOperation::executePixelSampled(float output[4], float x, float else { float premul = value[0] * inputOverColor[3]; float mul = 1.0f - premul; - + output[0] = (mul * inputColor1[0]) + premul * inputOverColor[0]; output[1] = (mul * inputColor1[1]) + premul * inputOverColor[1]; output[2] = (mul * inputColor1[2]) + premul * inputOverColor[2]; diff --git a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h index 8e4a0c93202..144c60f2966 100644 --- a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h +++ b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h @@ -35,7 +35,7 @@ public: * Default constructor */ AlphaOverKeyOperation(); - + /** * the inner loop of this program */ diff --git a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp index 990ec5f5370..748b5c63409 100644 --- a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp +++ b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp @@ -32,11 +32,11 @@ void AlphaOverMixedOperation::executePixelSampled(float output[4], float x, floa float inputColor1[4]; float inputOverColor[4]; float value[4]; - + this->m_inputValueOperation->readSampled(value, x, y, sampler); this->m_inputColor1Operation->readSampled(inputColor1, x, y, sampler); this->m_inputColor2Operation->readSampled(inputOverColor, x, y, sampler); - + if (inputOverColor[3] <= 0.0f) { copy_v4_v4(output, inputColor1); } diff --git a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h index 8c97b065792..a76bf12481d 100644 --- a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h +++ b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h @@ -37,12 +37,12 @@ public: * Default constructor */ AlphaOverMixedOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + void setX(float x) { this->m_x = x; } }; #endif diff --git a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp index 1f397e8a126..b6a1ab57b14 100644 --- a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp +++ b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp @@ -32,11 +32,11 @@ void AlphaOverPremultiplyOperation::executePixelSampled(float output[4], float x float inputColor1[4]; float inputOverColor[4]; float value[4]; - + this->m_inputValueOperation->readSampled(value, x, y, sampler); this->m_inputColor1Operation->readSampled(inputColor1, x, y, sampler); this->m_inputColor2Operation->readSampled(inputOverColor, x, y, sampler); - + /* Zero alpha values should still permit an add of RGB data */ if (inputOverColor[3] < 0.0f) { copy_v4_v4(output, inputColor1); @@ -46,7 +46,7 @@ void AlphaOverPremultiplyOperation::executePixelSampled(float output[4], float x } else { float mul = 1.0f - value[0] * inputOverColor[3]; - + output[0] = (mul * inputColor1[0]) + value[0] * inputOverColor[0]; output[1] = (mul * inputColor1[1]) + value[0] * inputOverColor[1]; output[2] = (mul * inputColor1[2]) + value[0] * inputOverColor[2]; diff --git a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h index 1dad453ca4e..8551dba7b7c 100644 --- a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h +++ b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h @@ -35,7 +35,7 @@ public: * Default constructor */ AlphaOverPremultiplyOperation(); - + /** * the inner loop of this program */ diff --git a/source/blender/compositor/operations/COM_AntiAliasOperation.h b/source/blender/compositor/operations/COM_AntiAliasOperation.h index 13632a81084..a6f74eb214c 100644 --- a/source/blender/compositor/operations/COM_AntiAliasOperation.h +++ b/source/blender/compositor/operations/COM_AntiAliasOperation.h @@ -38,19 +38,19 @@ protected: SocketReader *m_valueReader; public: AntiAliasOperation(); - + /** * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + void *initializeTileData(rcti *rect); - + /** * Deinitialize the execution */ diff --git a/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp b/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp index 4a6da3092a2..506c2181ee9 100644 --- a/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp @@ -84,7 +84,7 @@ void BilateralBlurOperation::executePixel(float output[4], int x, int y, void *d } } } - + if (blurDivider > 0.0f) { mul_v4_v4fl(output, blurColor, 1.0f / blurDivider); } diff --git a/source/blender/compositor/operations/COM_BilateralBlurOperation.h b/source/blender/compositor/operations/COM_BilateralBlurOperation.h index b013e357b9c..70f291d5e1c 100644 --- a/source/blender/compositor/operations/COM_BilateralBlurOperation.h +++ b/source/blender/compositor/operations/COM_BilateralBlurOperation.h @@ -39,19 +39,19 @@ public: * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); - + void setData(NodeBilateralBlurData *data) { this->m_data = data; } }; #endif diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.h b/source/blender/compositor/operations/COM_BlurBaseOperation.h index 9fd7c017715..1a57b170c9a 100644 --- a/source/blender/compositor/operations/COM_BlurBaseOperation.h +++ b/source/blender/compositor/operations/COM_BlurBaseOperation.h @@ -62,12 +62,12 @@ public: * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + void setData(const NodeBlurData *data); void setSize(float size) { this->m_size = size; this->m_sizeavailable = true; } diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp index c413f45cbaa..2476ab3b591 100644 --- a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp @@ -194,8 +194,8 @@ bool BokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe } void BokehBlurOperation::executeOpenCL(OpenCLDevice *device, - MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, - MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, + MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, + MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> * /*clKernelsToCleanUp*/) { cl_kernel kernel = device->COM_clCreateKernel("bokehBlurKernel", NULL); @@ -205,7 +205,7 @@ void BokehBlurOperation::executeOpenCL(OpenCLDevice *device, const float max_dim = max(this->getWidth(), this->getHeight()); cl_int radius = this->m_size * max_dim / 100.0f; cl_int step = this->getStep(); - + device->COM_clAttachMemoryBufferToKernelParameter(kernel, 0, -1, clMemToCleanUp, inputMemoryBuffers, this->m_inputBoundingBoxReader); device->COM_clAttachMemoryBufferToKernelParameter(kernel, 1, 4, clMemToCleanUp, inputMemoryBuffers, this->m_inputProgram); device->COM_clAttachMemoryBufferToKernelParameter(kernel, 2, -1, clMemToCleanUp, inputMemoryBuffers, this->m_inputBokehProgram); @@ -214,7 +214,7 @@ void BokehBlurOperation::executeOpenCL(OpenCLDevice *device, clSetKernelArg(kernel, 6, sizeof(cl_int), &radius); clSetKernelArg(kernel, 7, sizeof(cl_int), &step); device->COM_clAttachSizeToKernelParameter(kernel, 8, this); - + device->COM_clEnqueueRange(kernel, outputMemoryBuffer, 9, this); } diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.h b/source/blender/compositor/operations/COM_BokehBlurOperation.h index 3bfaae6617e..f1540835eaf 100644 --- a/source/blender/compositor/operations/COM_BokehBlurOperation.h +++ b/source/blender/compositor/operations/COM_BokehBlurOperation.h @@ -46,21 +46,21 @@ public: * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); void setSize(float size) { this->m_size = size; this->m_sizeavailable = true; } - + void executeOpenCL(OpenCLDevice *device, MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, diff --git a/source/blender/compositor/operations/COM_BokehImageOperation.h b/source/blender/compositor/operations/COM_BokehImageOperation.h index a2dd3b6ddb7..6f2001566ea 100644 --- a/source/blender/compositor/operations/COM_BokehImageOperation.h +++ b/source/blender/compositor/operations/COM_BokehImageOperation.h @@ -61,27 +61,27 @@ private: * @brief precalced center of the image */ float m_center[2]; - + /** * @brief 1.0-rounding */ float m_inverseRounding; - + /** * @brief distance of a full circle lens */ float m_circularDistance; - + /** * @brief radius when the first flap starts */ float m_flapRad; - + /** * @brief radians of a single flap */ float m_flapRadAdd; - + /** * @brief should the m_data field by deleted when this operation is finished */ @@ -95,7 +95,7 @@ private: * @param distance the lens distance is used to simulate lens shifts */ void detemineStartPointOfFlap(float r[2], int flapNumber, float distance); - + /** * @brief Determine if a coordinate is inside the bokeh image * @@ -112,17 +112,17 @@ public: * @brief the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * @brief Initialize the execution */ void initExecution(); - + /** * @brief Deinitialize the execution */ void deinitExecution(); - + /** * @brief determine the resolution of this operation. currently fixed at [COM_BLUR_BOKEH_PIXELS, COM_BLUR_BOKEH_PIXELS] * @param resolution @@ -135,7 +135,7 @@ public: * @param data */ void setData(NodeBokehImage *data) { this->m_data = data; } - + /** * @brief deleteDataOnFinish * diff --git a/source/blender/compositor/operations/COM_BoxMaskOperation.cpp b/source/blender/compositor/operations/COM_BoxMaskOperation.cpp index e19e5bf031c..d4fe976cf26 100644 --- a/source/blender/compositor/operations/COM_BoxMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_BoxMaskOperation.cpp @@ -48,25 +48,25 @@ void BoxMaskOperation::executePixelSampled(float output[4], float x, float y, Pi { float inputMask[4]; float inputValue[4]; - + float rx = x / this->getWidth(); float ry = y / this->getHeight(); - + const float dy = (ry - this->m_data->y) / this->m_aspectRatio; const float dx = rx - this->m_data->x; rx = this->m_data->x + (this->m_cosine * dx + this->m_sine * dy); ry = this->m_data->y + (-this->m_sine * dx + this->m_cosine * dy); - + this->m_inputMask->readSampled(inputMask, x, y, sampler); this->m_inputValue->readSampled(inputValue, x, y, sampler); - + float halfHeight = this->m_data->height / 2.0f; float halfWidth = this->m_data->width / 2.0f; bool inside = (rx > this->m_data->x - halfWidth && rx < this->m_data->x + halfWidth && ry > this->m_data->y - halfHeight && ry < this->m_data->y + halfHeight); - + switch (this->m_maskType) { case CMP_NODE_MASKTYPE_ADD: if (inside) { diff --git a/source/blender/compositor/operations/COM_BoxMaskOperation.h b/source/blender/compositor/operations/COM_BoxMaskOperation.h index c8b2ba14467..292e3a9391f 100644 --- a/source/blender/compositor/operations/COM_BoxMaskOperation.h +++ b/source/blender/compositor/operations/COM_BoxMaskOperation.h @@ -32,31 +32,31 @@ private: */ SocketReader *m_inputMask; SocketReader *m_inputValue; - + float m_sine; float m_cosine; float m_aspectRatio; int m_maskType; - + NodeBoxMask *m_data; public: BoxMaskOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + void setData(NodeBoxMask *data) { this->m_data = data; } void setMaskType(int maskType) { this->m_maskType = maskType; } diff --git a/source/blender/compositor/operations/COM_BrightnessOperation.h b/source/blender/compositor/operations/COM_BrightnessOperation.h index 0b7656c5364..8bda13ea418 100644 --- a/source/blender/compositor/operations/COM_BrightnessOperation.h +++ b/source/blender/compositor/operations/COM_BrightnessOperation.h @@ -38,17 +38,17 @@ private: public: BrightnessOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ diff --git a/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp b/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp index 0fa8b5fa5d2..be6d2b40d7e 100644 --- a/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp +++ b/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp @@ -96,7 +96,7 @@ void CalculateMeanOperation::calculateMean(MemoryBuffer *tile) for (int i = 0, offset = 0; i < size; i++, offset += 4) { if (buffer[offset + 3] > 0) { pixels++; - + switch (this->m_setting) { case 1: { diff --git a/source/blender/compositor/operations/COM_CalculateMeanOperation.h b/source/blender/compositor/operations/COM_CalculateMeanOperation.h index 4fa89290c82..d7d927791b2 100644 --- a/source/blender/compositor/operations/COM_CalculateMeanOperation.h +++ b/source/blender/compositor/operations/COM_CalculateMeanOperation.h @@ -35,34 +35,34 @@ protected: * @brief Cached reference to the reader */ SocketReader *m_imageReader; - + bool m_iscalculated; float m_result; int m_setting; public: CalculateMeanOperation(); - + /** * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + void *initializeTileData(rcti *rect); - + /** * Deinitialize the execution */ void deinitExecution(); - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); void setSetting(int setting) { this->m_setting = setting; } - + protected: void calculateMean(MemoryBuffer *tile); }; diff --git a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp index ff4857b7b0f..28012cdfabf 100644 --- a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp +++ b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp @@ -55,7 +55,7 @@ void *CalculateStandardDeviationOperation::initializeTileData(rcti *rect) 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 */ { diff --git a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp index a02c1b03006..f90e9b70053 100644 --- a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp +++ b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp @@ -52,12 +52,12 @@ void ChangeHSVOperation::executePixelSampled(float output[4], float x, float y, { float inputColor1[4]; float hue[4], saturation[4], value[4]; - + this->m_inputOperation->readSampled(inputColor1, x, y, sampler); this->m_hueOperation->readSampled(hue, x, y, sampler); this->m_saturationOperation->readSampled(saturation, x, y, sampler); this->m_valueOperation->readSampled(value, x, y, sampler); - + output[0] = inputColor1[0] + (hue[0] - 0.5f); if (output[0] > 1.0f) output[0] -= 1.0f; else if (output[0] < 0.0f) output[0] += 1.0f; diff --git a/source/blender/compositor/operations/COM_ChangeHSVOperation.h b/source/blender/compositor/operations/COM_ChangeHSVOperation.h index e6f45c5ad36..9685a298607 100644 --- a/source/blender/compositor/operations/COM_ChangeHSVOperation.h +++ b/source/blender/compositor/operations/COM_ChangeHSVOperation.h @@ -41,10 +41,10 @@ public: * Default constructor */ ChangeHSVOperation(); - + void initExecution(); void deinitExecution(); - + /** * the inner loop of this program */ diff --git a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp index 3faffc1e3ff..688cbe91cf7 100644 --- a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp @@ -101,10 +101,10 @@ void ChannelMatteOperation::executePixelSampled(float output[4], float x, float /* matte operation */ alpha = inColor[this->m_ids[0]] - max(inColor[this->m_ids[1]], inColor[this->m_ids[2]]); - + /* flip because 0.0 is transparent, not 1.0 */ alpha = 1.0f - alpha; - + /* test range */ if (alpha > limit_max) { alpha = inColor[3]; /*whatever it was prior */ @@ -119,7 +119,7 @@ void ChannelMatteOperation::executePixelSampled(float output[4], float x, float /* store matte(alpha) value in [0] to go with * COM_SetAlphaOperation and the Value output */ - + /* don't make something that was more transparent less transparent */ output[0] = min(alpha, inColor[3]); } diff --git a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp index 23390bd337d..806772417a4 100644 --- a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cpp @@ -53,14 +53,14 @@ void ColorBalanceASCCDLOperation::executePixelSampled(float output[4], float x, { float inputColor[4]; float value[4]; - + this->m_inputValueOperation->readSampled(value, x, y, sampler); this->m_inputColorOperation->readSampled(inputColor, x, y, sampler); - + float fac = value[0]; fac = min(1.0f, fac); const float mfac = 1.0f - fac; - + output[0] = mfac * inputColor[0] + fac * colorbalance_cdl(inputColor[0], this->m_offset[0], this->m_power[0], this->m_slope[0]); output[1] = mfac * inputColor[1] + fac * colorbalance_cdl(inputColor[1], this->m_offset[1], this->m_power[1], this->m_slope[1]); output[2] = mfac * inputColor[2] + fac * colorbalance_cdl(inputColor[2], this->m_offset[2], this->m_power[2], this->m_slope[2]); diff --git a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h index cc6bd894748..44981a2c957 100644 --- a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h +++ b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h @@ -35,7 +35,7 @@ protected: */ SocketReader *m_inputValueOperation; SocketReader *m_inputColorOperation; - + float m_offset[3]; float m_power[3]; float m_slope[3]; @@ -45,22 +45,22 @@ public: * Default constructor */ ColorBalanceASCCDLOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + void setOffset(float offset[3]) { copy_v3_v3(this->m_offset, offset); } void setPower(float power[3]) { copy_v3_v3(this->m_power, power); } void setSlope(float slope[3]) { copy_v3_v3(this->m_slope, slope); } diff --git a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp index e13fd26aed2..e264c065f47 100644 --- a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cpp @@ -58,14 +58,14 @@ void ColorBalanceLGGOperation::executePixelSampled(float output[4], float x, flo { float inputColor[4]; float value[4]; - + this->m_inputValueOperation->readSampled(value, x, y, sampler); this->m_inputColorOperation->readSampled(inputColor, x, y, sampler); - + float fac = value[0]; fac = min(1.0f, fac); const float mfac = 1.0f - fac; - + output[0] = mfac * inputColor[0] + fac * colorbalance_lgg(inputColor[0], this->m_lift[0], this->m_gamma_inv[0], this->m_gain[0]); output[1] = mfac * inputColor[1] + fac * colorbalance_lgg(inputColor[1], this->m_lift[1], this->m_gamma_inv[1], this->m_gain[1]); output[2] = mfac * inputColor[2] + fac * colorbalance_lgg(inputColor[2], this->m_lift[2], this->m_gamma_inv[2], this->m_gain[2]); diff --git a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h index 86d7abc92bc..97fc8b6f870 100644 --- a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h +++ b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h @@ -36,7 +36,7 @@ protected: */ SocketReader *m_inputValueOperation; SocketReader *m_inputColorOperation; - + float m_gain[3]; float m_lift[3]; float m_gamma_inv[3]; @@ -46,22 +46,22 @@ public: * Default constructor */ ColorBalanceLGGOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + void setGain(const float gain[3]) { copy_v3_v3(this->m_gain, gain); } void setLift(const float lift[3]) { copy_v3_v3(this->m_lift, lift); } void setGammaInv(const float gamma_inv[3]) { copy_v3_v3(this->m_gamma_inv, gamma_inv); } diff --git a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp index 05edaf51a25..5e08dadd635 100644 --- a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp @@ -50,7 +50,7 @@ void ColorCorrectionOperation::executePixelSampled(float output[4], float x, flo float inputMask[4]; this->m_inputImage->readSampled(inputImageColor, x, y, sampler); this->m_inputMask->readSampled(inputMask, x, y, sampler); - + float level = (inputImageColor[0] + inputImageColor[1] + inputImageColor[2]) / 3.0f; float contrast = this->m_data->master.contrast; float saturation = this->m_data->master.saturation; @@ -58,11 +58,11 @@ void ColorCorrectionOperation::executePixelSampled(float output[4], float x, flo float gain = this->m_data->master.gain; float lift = this->m_data->master.lift; float r, g, b; - + float value = inputMask[0]; value = min(1.0f, value); const float mvalue = 1.0f - value; - + float levelShadows = 0.0; float levelMidtones = 0.0; float levelHighlights = 0.0; @@ -92,7 +92,7 @@ void ColorCorrectionOperation::executePixelSampled(float output[4], float x, flo gamma *= (levelShadows * this->m_data->shadows.gamma) + (levelMidtones * this->m_data->midtones.gamma) + (levelHighlights * this->m_data->highlights.gamma); gain *= (levelShadows * this->m_data->shadows.gain) + (levelMidtones * this->m_data->midtones.gain) + (levelHighlights * this->m_data->highlights.gain); lift += (levelShadows * this->m_data->shadows.lift) + (levelMidtones * this->m_data->midtones.lift) + (levelHighlights * this->m_data->highlights.lift); - + float invgamma = 1.0f / gamma; float luma = IMB_colormanagement_get_luminance(inputImageColor); @@ -103,21 +103,21 @@ void ColorCorrectionOperation::executePixelSampled(float output[4], float x, flo r = (luma + saturation * (r - luma)); g = (luma + saturation * (g - luma)); b = (luma + saturation * (b - luma)); - + r = 0.5f + ((r - 0.5f) * contrast); g = 0.5f + ((g - 0.5f) * contrast); b = 0.5f + ((b - 0.5f) * contrast); - + r = powf(r * gain + lift, invgamma); g = powf(g * gain + lift, invgamma); b = powf(b * gain + lift, invgamma); - - + + // mix with mask r = mvalue * inputImageColor[0] + value * r; g = mvalue * inputImageColor[1] + value * g; b = mvalue * inputImageColor[2] + value * b; - + if (this->m_redChannelEnabled) { output[0] = r; } diff --git a/source/blender/compositor/operations/COM_ColorCorrectionOperation.h b/source/blender/compositor/operations/COM_ColorCorrectionOperation.h index c386a2f3e6e..7c7ccf2db9b 100644 --- a/source/blender/compositor/operations/COM_ColorCorrectionOperation.h +++ b/source/blender/compositor/operations/COM_ColorCorrectionOperation.h @@ -33,29 +33,29 @@ private: SocketReader *m_inputImage; SocketReader *m_inputMask; NodeColorCorrection *m_data; - + bool m_redChannelEnabled; bool m_greenChannelEnabled; bool m_blueChannelEnabled; public: ColorCorrectionOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + void setData(NodeColorCorrection *data) { this->m_data = data; } void setRedChannelEnabled(bool enabled) { this->m_redChannelEnabled = enabled; } void setGreenChannelEnabled(bool enabled) { this->m_greenChannelEnabled = enabled; } diff --git a/source/blender/compositor/operations/COM_ColorCurveOperation.cpp b/source/blender/compositor/operations/COM_ColorCurveOperation.cpp index 5967147b3d1..4cecc53ad01 100644 --- a/source/blender/compositor/operations/COM_ColorCurveOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorCurveOperation.cpp @@ -61,7 +61,7 @@ void ColorCurveOperation::initExecution() void ColorCurveOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) { CurveMapping *cumap = this->m_curveMapping; - + float fac[4]; float image[4]; diff --git a/source/blender/compositor/operations/COM_ColorCurveOperation.h b/source/blender/compositor/operations/COM_ColorCurveOperation.h index 3b10786fb2c..17c94feed5f 100644 --- a/source/blender/compositor/operations/COM_ColorCurveOperation.h +++ b/source/blender/compositor/operations/COM_ColorCurveOperation.h @@ -37,17 +37,17 @@ private: SocketReader *m_inputWhiteProgram; public: ColorCurveOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ @@ -63,25 +63,25 @@ private: SocketReader *m_inputImageProgram; float m_black[3]; float m_white[3]; - + public: ConstantLevelColorCurveOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + void setBlackLevel(float black[3]) { copy_v3_v3(this->m_black, black); } void setWhiteLevel(float white[3]) { copy_v3_v3(this->m_white, white); } }; diff --git a/source/blender/compositor/operations/COM_ColorRampOperation.h b/source/blender/compositor/operations/COM_ColorRampOperation.h index 55f711165d6..2d1919bb4b5 100644 --- a/source/blender/compositor/operations/COM_ColorRampOperation.h +++ b/source/blender/compositor/operations/COM_ColorRampOperation.h @@ -34,22 +34,22 @@ private: ColorBand *m_colorBand; public: ColorRampOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + void setColorBand(ColorBand *colorBand) { this->m_colorBand = colorBand; } diff --git a/source/blender/compositor/operations/COM_ColorSpillOperation.cpp b/source/blender/compositor/operations/COM_ColorSpillOperation.cpp index 0769e5d0b01..2f30ed83043 100644 --- a/source/blender/compositor/operations/COM_ColorSpillOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorSpillOperation.cpp @@ -68,7 +68,7 @@ void ColorSpillOperation::initExecution() this->m_rmut = 1.0f; this->m_gmut = 1.0f; this->m_bmut = -1.0f; - + this->m_channel2 = 0; this->m_channel3 = 1; if (this->m_settings->unspill == 0) { diff --git a/source/blender/compositor/operations/COM_ColorSpillOperation.h b/source/blender/compositor/operations/COM_ColorSpillOperation.h index 3b94c293ec9..5971db9fa76 100644 --- a/source/blender/compositor/operations/COM_ColorSpillOperation.h +++ b/source/blender/compositor/operations/COM_ColorSpillOperation.h @@ -55,7 +55,7 @@ public: void setSettings(NodeColorspill *nodeColorSpill) { this->m_settings = nodeColorSpill; } void setSpillChannel(int channel) { this->m_spillChannel = channel; } void setSpillMethod(int method) { this->m_spillMethod = method; } - + float calculateMapValue(float fac, float *input); }; diff --git a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h index ceba2a85da0..47f9f20f393 100644 --- a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h +++ b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h @@ -35,17 +35,17 @@ private: * Cached reference to the inputProgram */ SocketReader *m_inputOperation; - + /** * @brief color profile where to convert from */ int m_fromProfile; - + /** * @brief color profile where to convert to */ int m_toProfile; - + /** * @brief is color predivided */ @@ -55,22 +55,22 @@ public: * Default constructor */ ConvertColorProfileOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + void setFromColorProfile(int colorProfile) { this->m_fromProfile = colorProfile; } void setToColorProfile(int colorProfile) { this->m_toProfile = colorProfile; } void setPredivided(bool predivided) { this->m_predivided = predivided; } diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp index 9057c3c92ec..111bfeadf35 100644 --- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp @@ -81,7 +81,7 @@ void ConvertDepthToRadiusOperation::executePixelSampled(float output[4], float x z = inputValue[0]; if (z != 0.0f) { float iZ = (1.0f / z); - + // bug #6656 part 2b, do not rescale #if 0 bcrad = 0.5f * fabs(aperture * (dof_sp * (cam_invfdist - iZ) - 1.0f)); diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h index 697ac455702..65db1cf45d9 100644 --- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h +++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h @@ -43,34 +43,34 @@ private: float m_cam_lens; float m_dof_sp; Object *m_cameraObject; - + FastGaussianBlurValueOperation *m_blurPostOperation; public: /** * Default constructor */ ConvertDepthToRadiusOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + void setfStop(float fStop) { this->m_fStop = fStop; } void setMaxRadius(float maxRadius) { this->m_maxRadius = maxRadius; } void setCameraObject(Object *camera) { this->m_cameraObject = camera; } float determineFocalDistance(); void setPostBlur(FastGaussianBlurValueOperation *operation) {this->m_blurPostOperation = operation;} - + }; #endif diff --git a/source/blender/compositor/operations/COM_ConvertOperation.h b/source/blender/compositor/operations/COM_ConvertOperation.h index 5dee63ea739..9c23cc9bda7 100644 --- a/source/blender/compositor/operations/COM_ConvertOperation.h +++ b/source/blender/compositor/operations/COM_ConvertOperation.h @@ -29,10 +29,10 @@ class ConvertBaseOperation : public NodeOperation { protected: SocketReader *m_inputOperation; - + public: ConvertBaseOperation(); - + void initExecution(); void deinitExecution(); }; @@ -41,7 +41,7 @@ public: class ConvertValueToColorOperation : public ConvertBaseOperation { public: ConvertValueToColorOperation(); - + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; @@ -49,7 +49,7 @@ public: class ConvertColorToValueOperation : public ConvertBaseOperation { public: ConvertColorToValueOperation(); - + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; @@ -57,7 +57,7 @@ public: class ConvertColorToBWOperation : public ConvertBaseOperation { public: ConvertColorToBWOperation(); - + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; @@ -65,7 +65,7 @@ public: class ConvertColorToVectorOperation : public ConvertBaseOperation { public: ConvertColorToVectorOperation(); - + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; @@ -73,7 +73,7 @@ public: class ConvertValueToVectorOperation : public ConvertBaseOperation { public: ConvertValueToVectorOperation(); - + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; @@ -81,7 +81,7 @@ public: class ConvertVectorToColorOperation : public ConvertBaseOperation { public: ConvertVectorToColorOperation(); - + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; @@ -89,7 +89,7 @@ public: class ConvertVectorToValueOperation : public ConvertBaseOperation { public: ConvertVectorToValueOperation(); - + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; @@ -114,9 +114,9 @@ private: int m_mode; public: ConvertYCCToRGBOperation(); - + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** Set the YCC mode */ void setMode(int mode); }; @@ -125,7 +125,7 @@ public: class ConvertRGBToYUVOperation : public ConvertBaseOperation { public: ConvertRGBToYUVOperation(); - + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; @@ -133,7 +133,7 @@ public: class ConvertYUVToRGBOperation : public ConvertBaseOperation { public: ConvertYUVToRGBOperation(); - + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; @@ -141,7 +141,7 @@ public: class ConvertRGBToHSVOperation : public ConvertBaseOperation { public: ConvertRGBToHSVOperation(); - + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; @@ -149,7 +149,7 @@ public: class ConvertHSVToRGBOperation : public ConvertBaseOperation { public: ConvertHSVToRGBOperation(); - + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); }; @@ -177,10 +177,10 @@ private: public: SeparateChannelOperation(); void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + void initExecution(); void deinitExecution(); - + void setChannel(int channel) { this->m_channel = channel; } }; @@ -194,7 +194,7 @@ private: public: CombineChannelsOperation(); void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + void initExecution(); void deinitExecution(); }; diff --git a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp index 56815459ee7..9eb2d1bfcc5 100644 --- a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cpp @@ -44,7 +44,7 @@ void ConvolutionEdgeFilterOperation::executePixel(float output[4], int x, int y, 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]; @@ -52,47 +52,47 @@ void ConvolutionEdgeFilterOperation::executePixel(float output[4], int x, int y, 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. */ diff --git a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp index 41cc504af05..b14fdc811d4 100644 --- a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cpp @@ -102,7 +102,7 @@ void ConvolutionFilterOperation::executePixel(float output[4], int x, int y, voi madd_v4_v4fl(output, in1, this->m_filter[7]); this->m_inputOperation->read(in1, x3, y3, NULL); madd_v4_v4fl(output, in1, this->m_filter[8]); - + 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; @@ -124,6 +124,6 @@ bool ConvolutionFilterOperation::determineDependingAreaOfInterest(rcti *input, R newInput.xmin = input->xmin - addx; newInput.ymax = input->ymax + addy; newInput.ymin = input->ymin - addy; - + return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } diff --git a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h index 75fba0ee1e4..99e6fc52ddc 100644 --- a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h +++ b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h @@ -40,7 +40,7 @@ public: void set3x3Filter(float f1, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); void executePixel(float output[4], int x, int y, void *data); - + void initExecution(); void deinitExecution(); }; diff --git a/source/blender/compositor/operations/COM_CropOperation.cpp b/source/blender/compositor/operations/COM_CropOperation.cpp index 162811ac31d..af68fa09f1a 100644 --- a/source/blender/compositor/operations/COM_CropOperation.cpp +++ b/source/blender/compositor/operations/COM_CropOperation.cpp @@ -37,7 +37,7 @@ void CropBaseOperation::updateArea() float width = inputReference->getWidth(); float height = inputReference->getHeight(); NodeTwoXYs local_settings = *this->m_settings; - + if (width > 0.0f && height > 0.0f) { if (this->m_relative) { local_settings.x1 = width * local_settings.fac_x1; @@ -53,7 +53,7 @@ void CropBaseOperation::updateArea() local_settings.x2 = width - 1; if (height <= local_settings.y2 + 1) local_settings.y2 = height - 1; - + this->m_xmax = max(local_settings.x1, local_settings.x2) + 1; this->m_xmin = min(local_settings.x1, local_settings.x2); this->m_ymax = max(local_settings.y1, local_settings.y2) + 1; @@ -101,12 +101,12 @@ CropImageOperation::CropImageOperation() : CropBaseOperation() bool CropImageOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { rcti newInput; - + newInput.xmax = input->xmax + this->m_xmin; newInput.xmin = input->xmin + this->m_xmin; newInput.ymax = input->ymax + this->m_ymin; newInput.ymin = input->ymin + this->m_ymin; - + return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } diff --git a/source/blender/compositor/operations/COM_CropOperation.h b/source/blender/compositor/operations/COM_CropOperation.h index 7c5b995fb17..f73b4c602f6 100644 --- a/source/blender/compositor/operations/COM_CropOperation.h +++ b/source/blender/compositor/operations/COM_CropOperation.h @@ -34,7 +34,7 @@ protected: int m_xmin; int m_ymax; int m_ymin; - + void updateArea(); public: CropBaseOperation(); diff --git a/source/blender/compositor/operations/COM_CurveBaseOperation.h b/source/blender/compositor/operations/COM_CurveBaseOperation.h index 169022de5f5..191cf7f5307 100644 --- a/source/blender/compositor/operations/COM_CurveBaseOperation.h +++ b/source/blender/compositor/operations/COM_CurveBaseOperation.h @@ -34,13 +34,13 @@ protected: public: CurveBaseOperation(); ~CurveBaseOperation(); - + /** * Initialize the execution */ void initExecution(); void deinitExecution(); - + void setCurveMapping(CurveMapping *mapping); }; #endif diff --git a/source/blender/compositor/operations/COM_DifferenceMatteOperation.h b/source/blender/compositor/operations/COM_DifferenceMatteOperation.h index ddf6bf6f893..3766f85444d 100644 --- a/source/blender/compositor/operations/COM_DifferenceMatteOperation.h +++ b/source/blender/compositor/operations/COM_DifferenceMatteOperation.h @@ -39,15 +39,15 @@ public: * Default constructor */ DifferenceMatteOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + void initExecution(); void deinitExecution(); - + void setSettings(NodeChroma *nodeChroma) { this->m_settings = nodeChroma; } }; #endif diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp index 2ea438d070d..17f3dfeac62 100644 --- a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp +++ b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp @@ -200,7 +200,7 @@ void DilateDistanceOperation::executePixel(float output[4], int x, int y, void * const int maxy = min(y + this->m_scope, rect->ymax); const int bufferWidth = BLI_rcti_size_x(rect); int offset; - + float value = 0.0f; for (int yi = miny; yi < maxy; yi++) { @@ -244,7 +244,7 @@ void DilateDistanceOperation::executeOpenCL(OpenCLDevice *device, cl_int distanceSquared = this->m_distance * this->m_distance; cl_int scope = this->m_scope; - + device->COM_clAttachMemoryBufferToKernelParameter(dilateKernel, 0, 2, clMemToCleanUp, inputMemoryBuffers, this->m_inputProgram); device->COM_clAttachOutputMemoryBufferToKernelParameter(dilateKernel, 1, clOutputBuffer); device->COM_clAttachMemoryBufferOffsetToKernelParameter(dilateKernel, 3, outputMemoryBuffer); @@ -255,7 +255,7 @@ void DilateDistanceOperation::executeOpenCL(OpenCLDevice *device, } // Erode Distance -ErodeDistanceOperation::ErodeDistanceOperation() : DilateDistanceOperation() +ErodeDistanceOperation::ErodeDistanceOperation() : DilateDistanceOperation() { /* pass */ } @@ -274,7 +274,7 @@ void ErodeDistanceOperation::executePixel(float output[4], int x, int y, void *d const int maxy = min(y + this->m_scope, rect->ymax); const int bufferWidth = BLI_rcti_size_x(rect); int offset; - + float value = 1.0f; for (int yi = miny; yi < maxy; yi++) { @@ -301,7 +301,7 @@ void ErodeDistanceOperation::executeOpenCL(OpenCLDevice *device, cl_int distanceSquared = this->m_distance * this->m_distance; cl_int scope = this->m_scope; - + device->COM_clAttachMemoryBufferToKernelParameter(erodeKernel, 0, 2, clMemToCleanUp, inputMemoryBuffers, this->m_inputProgram); device->COM_clAttachOutputMemoryBufferToKernelParameter(erodeKernel, 1, clOutputBuffer); device->COM_clAttachMemoryBufferOffsetToKernelParameter(erodeKernel, 3, outputMemoryBuffer); diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.h b/source/blender/compositor/operations/COM_DilateErodeOperation.h index c929fcf7fec..92c453d9d85 100644 --- a/source/blender/compositor/operations/COM_DilateErodeOperation.h +++ b/source/blender/compositor/operations/COM_DilateErodeOperation.h @@ -31,11 +31,11 @@ private: * Cached reference to the inputProgram */ SocketReader *m_inputProgram; - + float m_distance; float m__switch; float m_inset; - + /** * determines the area of interest to track pixels * keep this one as small as possible for speed gain. @@ -43,27 +43,27 @@ private: int m_scope; public: DilateErodeThresholdOperation(); - + /** * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + void *initializeTileData(rcti *rect); /** * Deinitialize the execution */ void deinitExecution(); - + void setDistance(float distance) { this->m_distance = distance; } void setSwitch(float sw) { this->m__switch = sw; } void setInset(float inset) { this->m_inset = inset; } - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); }; @@ -79,43 +79,43 @@ protected: int m_scope; public: DilateDistanceOperation(); - + /** * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + void *initializeTileData(rcti *rect); /** * Deinitialize the execution */ void deinitExecution(); - + void setDistance(float distance) { this->m_distance = distance; } bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); - + void executeOpenCL(OpenCLDevice *device, - MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, + MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> *clKernelsToCleanUp); }; class ErodeDistanceOperation : public DilateDistanceOperation { public: ErodeDistanceOperation(); - + /** * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); void executeOpenCL(OpenCLDevice *device, - MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, - MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, + MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, + MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> *clKernelsToCleanUp); }; @@ -125,38 +125,38 @@ protected: * Cached reference to the inputProgram */ SocketReader *m_inputProgram; - + int m_iterations; - + public: DilateStepOperation(); - + /** * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + void *initializeTileData(rcti *rect); /** * Deinitialize the execution */ void deinitExecution(); void deinitializeTileData(rcti *rect, void *data); - + void setIterations(int iterations) { this->m_iterations = iterations; } - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); }; class ErodeStepOperation : public DilateStepOperation { public: ErodeStepOperation(); - + void *initializeTileData(rcti *rect); }; diff --git a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp index 2e0be8d8410..e3dec838589 100644 --- a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp @@ -102,8 +102,8 @@ void DirectionalBlurOperation::executePixel(float output[4], int x, int y, void } void DirectionalBlurOperation::executeOpenCL(OpenCLDevice *device, - MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, - MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, + MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, + MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> * /*clKernelsToCleanUp*/) { cl_kernel directionalBlurKernel = device->COM_clCreateKernel("directionalBlurKernel", NULL); @@ -113,7 +113,7 @@ void DirectionalBlurOperation::executeOpenCL(OpenCLDevice *device, cl_float2 centerpix = {{this->m_center_x_pix, this->m_center_y_pix}}; cl_float lsc = this->m_sc; cl_float lrot = this->m_rot; - + device->COM_clAttachMemoryBufferToKernelParameter(directionalBlurKernel, 0, -1, clMemToCleanUp, inputMemoryBuffers, this->m_inputProgram); device->COM_clAttachOutputMemoryBufferToKernelParameter(directionalBlurKernel, 1, clOutputBuffer); device->COM_clAttachMemoryBufferOffsetToKernelParameter(directionalBlurKernel, 2, outputMemoryBuffer); @@ -122,7 +122,7 @@ void DirectionalBlurOperation::executeOpenCL(OpenCLDevice *device, clSetKernelArg(directionalBlurKernel, 5, sizeof(cl_float), &lrot); clSetKernelArg(directionalBlurKernel, 6, sizeof(cl_float2), <xy); clSetKernelArg(directionalBlurKernel, 7, sizeof(cl_float2), ¢erpix); - + device->COM_clEnqueueRange(directionalBlurKernel, outputMemoryBuffer, 8, this); } diff --git a/source/blender/compositor/operations/COM_DirectionalBlurOperation.h b/source/blender/compositor/operations/COM_DirectionalBlurOperation.h index a6194a0ca73..eaabf49bf74 100644 --- a/source/blender/compositor/operations/COM_DirectionalBlurOperation.h +++ b/source/blender/compositor/operations/COM_DirectionalBlurOperation.h @@ -41,25 +41,25 @@ public: * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); - + void setData(NodeDBlurData *data) { this->m_data = data; } void executeOpenCL(OpenCLDevice *device, MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> *clKernelsToCleanUp); - + }; #endif diff --git a/source/blender/compositor/operations/COM_DisplaceOperation.cpp b/source/blender/compositor/operations/COM_DisplaceOperation.cpp index 9b3377e887a..0d959996be1 100644 --- a/source/blender/compositor/operations/COM_DisplaceOperation.cpp +++ b/source/blender/compositor/operations/COM_DisplaceOperation.cpp @@ -92,7 +92,7 @@ void DisplaceOperation::pixelTransform(const float xy[2], float r_uv[2], float r float xs = col[0]; m_inputScaleYProgram->readSampled(col, xy[0], xy[1], COM_PS_NEAREST); float ys = col[0]; - /* clamp x and y displacement to triple image resolution - + /* clamp x and y displacement to triple image resolution - * to prevent hangs from huge values mistakenly plugged in eg. z buffers */ CLAMP(xs, -m_width_x4, m_width_x4); CLAMP(ys, -m_height_x4, m_height_x4); @@ -102,7 +102,7 @@ void DisplaceOperation::pixelTransform(const float xy[2], float r_uv[2], float r /* Estimate partial derivatives using 1-pixel offsets */ const float epsilon[2] = { 1.0f, 1.0f }; - + zero_v2(r_deriv[0]); zero_v2(r_deriv[1]); diff --git a/source/blender/compositor/operations/COM_DisplaceOperation.h b/source/blender/compositor/operations/COM_DisplaceOperation.h index cec7937d9d6..680f2606692 100644 --- a/source/blender/compositor/operations/COM_DisplaceOperation.h +++ b/source/blender/compositor/operations/COM_DisplaceOperation.h @@ -49,14 +49,14 @@ public: * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + void pixelTransform(const float xy[2], float r_uv[2], float r_deriv[2][2]); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ diff --git a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp index 40b4fdec28e..0d7cd129a2f 100644 --- a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp +++ b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cpp @@ -66,7 +66,7 @@ void DisplaceSimpleOperation::executePixelSampled(float output[4], float x, floa this->m_inputScaleYProgram->readSampled(inScale, x, y, sampler); float ys = inScale[0]; - /* clamp x and y displacement to triple image resolution - + /* clamp x and y displacement to triple image resolution - * to prevent hangs from huge values mistakenly plugged in eg. z buffers */ CLAMP(xs, -this->m_width_x4, this->m_width_x4); CLAMP(ys, -this->m_height_x4, this->m_height_x4); diff --git a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h index 6e52dfe86e9..b3da61722ec 100644 --- a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h +++ b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h @@ -49,12 +49,12 @@ public: * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ diff --git a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp index b9e6864b340..adc977d014d 100644 --- a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp @@ -62,13 +62,13 @@ void DistanceRGBMatteOperation::executePixelSampled(float output[4], float x, fl this->m_inputKeyProgram->readSampled(inKey, x, y, sampler); this->m_inputImageProgram->readSampled(inImage, x, y, sampler); - + distance = this->calculateDistance(inKey, inImage); /* store matte(alpha) value in [0] to go with * COM_SetAlphaOperation and the Value output */ - + /*make 100% transparent */ if (distance < tolerance) { output[0] = 0.0f; diff --git a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h index a815caa5ef5..22bc10b7bc3 100644 --- a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h +++ b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h @@ -41,15 +41,15 @@ public: * Default constructor */ DistanceRGBMatteOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + void initExecution(); void deinitExecution(); - + void setSettings(NodeChroma *nodeChroma) { this->m_settings = nodeChroma; } }; #endif diff --git a/source/blender/compositor/operations/COM_DotproductOperation.h b/source/blender/compositor/operations/COM_DotproductOperation.h index 218409cbf5b..0fbefd716eb 100644 --- a/source/blender/compositor/operations/COM_DotproductOperation.h +++ b/source/blender/compositor/operations/COM_DotproductOperation.h @@ -32,7 +32,7 @@ private: public: DotproductOperation(); void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + void initExecution(); void deinitExecution(); diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp index 8d2a0f3b427..ffa2f812ed7 100644 --- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp @@ -108,7 +108,7 @@ static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int osz++; // increment outer edge size lres[x] = 3; // flag pixel as outer edge } - + /* Test the TOP row of pixels in buffer, except corners */ for (x = t - 1; x >= (t - rw) + 2; x--) { // test if inner mask is filled @@ -128,7 +128,7 @@ static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int lres[x] = 3; // flag pixel as outer edge } } - + /* Test the BOTTOM row of pixels in buffer, except corners */ for (x = rw - 2; x; x--) { // test if inner mask is filled @@ -167,7 +167,7 @@ static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int lres[x] = 3; // flag pixel as outer edge } } - + /* Test the RIGHT edge of pixels in buffer, except corners */ for (x = t - rw; x > rw; x -= rw) { // test if inner mask is filled @@ -187,7 +187,7 @@ static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int lres[x] = 3; // flag pixel as outer edge } } - + rsize[0] = isz; // fill in our return sizes for edges + fill rsize[1] = osz; rsize[2] = gsz; @@ -321,7 +321,7 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in } } } - + /* Test the BOTTOM row of pixels in buffer, except corners */ for (x = rw - 2; x; x--) { // test if inner mask is filled @@ -372,7 +372,7 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in } } } - + /* Test the RIGHT edge of pixels in buffer, except corners */ for (x = t - rw; x > rw; x -= rw) { // test if inner mask is filled @@ -398,7 +398,7 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in } } } - + rsize[0] = isz; // fill in our return sizes for edges + fill rsize[1] = osz; rsize[2] = gsz; @@ -479,7 +479,7 @@ static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *lim osz++; // increment outer edge size lres[x] = 3; // flag pixel as outer edge } - + /* Test the TOP row of pixels in buffer, except corners */ for (x = t - 1; x >= (t - rw) + 2; x--) { // test if inner mask is filled @@ -498,7 +498,7 @@ static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *lim lres[x] = 3; // flag pixel as outer edge } } - + /* Test the BOTTOM row of pixels in buffer, except corners */ for (x = rw - 2; x; x--) { // test if inner mask is filled @@ -535,7 +535,7 @@ static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *lim lres[x] = 3; // flag pixel as outer edge } } - + /* Test the RIGHT edge of pixels in buffer, except corners */ for (x = t - rw; x > rw; x -= rw) { // test if inner mask is filled @@ -554,7 +554,7 @@ static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *lim lres[x] = 3; // flag pixel as outer edge } } - + rsize[0] = isz; // fill in our return sizes for edges + fill rsize[1] = osz; rsize[2] = gsz; @@ -683,7 +683,7 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li } } } - + /* Test the BOTTOM row of pixels in buffer, except corners */ for (x = rw - 2; x; x--) { // test if inner mask is filled @@ -732,7 +732,7 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li } } } - + /* Test the RIGHT edge of pixels in buffer, except corners */ for (x = t - rw; x > rw; x -= rw) { // test if inner mask is filled @@ -757,7 +757,7 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li } } } - + rsize[0] = isz; // fill in our return sizes for edges + fill rsize[1] = osz; rsize[2] = gsz; @@ -801,7 +801,7 @@ static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *l lres[a] = 2; // flag pixel as gradient } } - + } else { if (!limask[pix_nextCol] || !limask[pix_prevCol] || !limask[pix_nextRow] || !limask[pix_prevRow]) { @@ -819,7 +819,7 @@ static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *l pix_nextCol--; } } - + rsize[0] = in_isz; // fill in our return sizes for edges + fill rsize[1] = in_osz; rsize[2] = in_gsz; @@ -863,7 +863,7 @@ static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned i lres[a] = 2; // flag pixel as gradient } } - + } else { if ((!limask[pix_nextCol] && lomask[pix_nextCol]) || @@ -885,7 +885,7 @@ static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned i pix_nextCol--; } } - + rsize[0] = in_isz; // fill in our return sizes for edges + fill rsize[1] = in_osz; rsize[2] = in_gsz; @@ -897,7 +897,7 @@ static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigne int a; // a = temporary pixel index buffer loop counter unsigned int ud; // ud = unscaled edge distance unsigned int dmin; // dmin = minimum edge distance - + unsigned int rsl; // long used for finding fast 1.0/sqrt unsigned int gradientFillOffset; unsigned int innerAccum = 0; // for looping inner edge pixel indexes, represents current position from offset @@ -999,7 +999,7 @@ static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigne } } } - + } static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *gbuf, unsigned int isz, unsigned int osz, unsigned int gsz, unsigned int innerEdgeOffset, unsigned int outerEdgeOffset) @@ -1010,7 +1010,7 @@ static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *g unsigned int rsl; // long used for finding fast 1.0/sqrt float rsf; // float used for finding fast 1.0/sqrt const float rsopf = 1.5f; // constant float used for finding fast 1.0/sqrt - + unsigned int gradientFillOffset; unsigned int t; unsigned int ud; // ud = unscaled edge distance @@ -1019,7 +1019,7 @@ static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *g float idist; // idist = current inner edge distance int dx; // dx = X-delta (used for distance proportion calculation) int dy; // dy = Y-delta (used for distance proportion calculation) - + /* * The general algorithm used to color each gradient pixel is: * @@ -1057,7 +1057,7 @@ static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *g * G = gradient pixel * | * I = inside edge pixel - * + * * __ * *note that IO does not need to be a straight line, in fact * many cases can arise where straight lines do not work @@ -1120,14 +1120,14 @@ static void do_fillGradientBuffer(unsigned int rw, float *res, unsigned short *g * proportion is already the correct intensity, and does not need to be * subtracted from 1.0 like it would have if we used real distances. */ - + /* * Here we reconstruct the pixel's memory location in the CompBuf by * Pixel Index = Pixel Column + ( Pixel Row * Row Width ) */ res[gbuf[gradientFillOffset + 1] + (gbuf[gradientFillOffset] * rw)] = (idist / (idist + odist)); //set intensity } - + } // end of copy @@ -1137,31 +1137,31 @@ void DoubleEdgeMaskOperation::doDoubleEdgeMask(float *imask, float *omask, float unsigned int *lres; // lres = unsigned int pointer to output pixel buffer (for bit operations) unsigned int *limask; // limask = unsigned int pointer to inner mask (for bit operations) unsigned int *lomask; // lomask = unsigned int pointer to outer mask (for bit operations) - + int rw; // rw = pixel row width int t; // t = total number of pixels in buffer - 1 (used for loop starts) int fsz; // size of the frame - + unsigned int isz = 0; // size (in pixels) of inside edge pixel index buffer unsigned int osz = 0; // size (in pixels) of outside edge pixel index buffer unsigned int gsz = 0; // size (in pixels) of gradient pixel index buffer unsigned int rsize[3]; // size storage to pass to helper functions unsigned int innerEdgeOffset = 0; // offset into final buffer where inner edge pixel indexes start unsigned int outerEdgeOffset = 0; // offset into final buffer where outer edge pixel indexes start - + unsigned short *gbuf; // gradient/inner/outer pixel location index buffer - + if (true) { // if both input sockets have some data coming in... - + rw = this->getWidth(); // width of a row of pixels t = (rw * this->getHeight()) - 1; // determine size of the frame memset(res, 0, sizeof(float) * (t + 1)); // clear output buffer (not all pixels will be written later) - + lres = (unsigned int *)res; // unsigned int pointer to output buffer (for bit level ops) limask = (unsigned int *)imask; // unsigned int pointer to input mask (for bit level ops) lomask = (unsigned int *)omask; // unsigned int pointer to output mask (for bit level ops) - - + + /* * The whole buffer is broken up into 4 parts. The four CORNERS, the FIRST and LAST rows, the * LEFT and RIGHT edges (excluding the corner pixels), and all OTHER rows. @@ -1213,17 +1213,17 @@ void DoubleEdgeMaskOperation::doDoubleEdgeMask(float *imask, float *omask, float // detect edges in all non-border pixels in the buffer do_allEdgeDetection(t, rw, limask, lomask, lres, res, rsize, isz, osz, gsz); } - + isz = rsize[0]; // set edge and gradient buffer sizes once again... osz = rsize[1]; // the sizes in rsize[] may have been modified gsz = rsize[2]; // by the do_*EdgeDetection() function. - + fsz = gsz + isz + osz; // calculate size of pixel index buffer needed gbuf = (unsigned short *)MEM_callocN(sizeof(unsigned short) * fsz * 2, "DEM"); // allocate edge/gradient pixel index buffer - + do_createEdgeLocationBuffer(t, rw, lres, res, gbuf, &innerEdgeOffset, &outerEdgeOffset, isz, gsz); do_fillGradientBuffer(rw, res, gbuf, isz, osz, gsz, innerEdgeOffset, outerEdgeOffset); - + MEM_freeN(gbuf); // free the gradient index buffer } } @@ -1267,7 +1267,7 @@ void *DoubleEdgeMaskOperation::initializeTileData(rcti *rect) { if (this->m_cachedInstance) return this->m_cachedInstance; - + lockMutex(); if (this->m_cachedInstance == NULL) { MemoryBuffer *innerMask = (MemoryBuffer *)this->m_inputInnerMask->initializeTileData(rect); diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h index a12c44b02a1..4574454dd02 100644 --- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h +++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h @@ -43,12 +43,12 @@ public: * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ @@ -57,7 +57,7 @@ public: void *initializeTileData(rcti *rect); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); - + void setAdjecentOnly(bool adjecentOnly) { this->m_adjecentOnly = adjecentOnly; } void setKeepInside(bool keepInside) { this->m_keepInside = keepInside; } }; diff --git a/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp b/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp index 482473cbe1f..fac0e028c6d 100644 --- a/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp @@ -48,18 +48,18 @@ void EllipseMaskOperation::executePixelSampled(float output[4], float x, float y { float inputMask[4]; float inputValue[4]; - + float rx = x / this->getWidth(); float ry = y / this->getHeight(); - + const float dy = (ry - this->m_data->y) / this->m_aspectRatio; const float dx = rx - this->m_data->x; rx = this->m_data->x + (this->m_cosine * dx + this->m_sine * dy); ry = this->m_data->y + (-this->m_sine * dx + this->m_cosine * dy); - + this->m_inputMask->readSampled(inputMask, x, y, sampler); this->m_inputValue->readSampled(inputValue, x, y, sampler); - + const float halfHeight = (this->m_data->height) / 2.0f; const float halfWidth = this->m_data->width / 2.0f; float sx = rx - this->m_data->x; @@ -68,9 +68,9 @@ void EllipseMaskOperation::executePixelSampled(float output[4], float x, float y float sy = ry - this->m_data->y; sy *= sy; const float ty = halfHeight * halfHeight; - + bool inside = ((sx / tx) + (sy / ty)) < 1.0f; - + switch (this->m_maskType) { case CMP_NODE_MASKTYPE_ADD: if (inside) { diff --git a/source/blender/compositor/operations/COM_EllipseMaskOperation.h b/source/blender/compositor/operations/COM_EllipseMaskOperation.h index 419b2c2d63b..9de9fb3e11c 100644 --- a/source/blender/compositor/operations/COM_EllipseMaskOperation.h +++ b/source/blender/compositor/operations/COM_EllipseMaskOperation.h @@ -32,34 +32,34 @@ private: */ SocketReader *m_inputMask; SocketReader *m_inputValue; - + float m_sine; float m_cosine; float m_aspectRatio; int m_maskType; - + NodeEllipseMask *m_data; public: EllipseMaskOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + void setData(NodeEllipseMask *data) { this->m_data = data; } void setMaskType(int maskType) { this->m_maskType = maskType; } - + }; #endif diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp index a223ac31e3d..11843da3634 100644 --- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp @@ -70,7 +70,7 @@ void FastGaussianBlurOperation::initExecution() BlurBaseOperation::initMutex(); } -void FastGaussianBlurOperation::deinitExecution() +void FastGaussianBlurOperation::deinitExecution() { if (this->m_iirgaus) { delete this->m_iirgaus; @@ -90,7 +90,7 @@ void *FastGaussianBlurOperation::initializeTileData(rcti *rect) int c; this->m_sx = this->m_data.sizex * this->m_size / 2.0f; this->m_sy = this->m_data.sizey * this->m_size / 2.0f; - + if ((this->m_sx == this->m_sy) && (this->m_sx > 0.0f)) { for (c = 0; c < COM_NUM_CHANNELS_COLOR; ++c) IIR_gauss(copy, this->m_sx, c, 3); @@ -121,18 +121,18 @@ void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, unsign unsigned int i; float *buffer = src->getBuffer(); const unsigned int num_channels = src->get_num_channels(); - + // <0.5 not valid, though can have a possibly useful sort of sharpening effect if (sigma < 0.5f) return; - + if ((xy < 1) || (xy > 3)) xy = 3; - + // XXX The YVV macro defined below explicitly expects sources of at least 3x3 pixels, // so just skiping blur along faulty direction if src's def is below that limit! if (src_width < 3) xy &= ~1; if (src_height < 3) xy &= ~2; if (xy < 1) return; - + // see "Recursive Gabor Filtering" by Young/VanVliet // all factors here in double.prec. Required, because for single.prec it seems to blow up if sigma > ~200 if (sigma >= 3.556f) @@ -148,7 +148,7 @@ void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, unsign // 0 & 3 unchanged cf[3] = q2 * q / sc; cf[0] = 1.0 - cf[1] - cf[2] - cf[3]; - + // Triggs/Sdika border corrections, // it seems to work, not entirely sure if it is actually totally correct, // Besides J.M.Geusebroek's anigauss.c (see http://www.science.uva.nl/~mark), @@ -166,7 +166,7 @@ void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, unsign tsM[6] = sc * (cf[3] * cf[1] + cf[2] + cf[1] * cf[1] - cf[2] * cf[2]); tsM[7] = sc * (cf[1] * cf[2] + cf[3] * cf[2] * cf[2] - cf[1] * cf[3] * cf[3] - cf[3] * cf[3] * cf[3] - cf[3] * cf[2] + cf[3]); tsM[8] = sc * (cf[3] * (cf[1] + cf[3] * cf[2])); - + #define YVV(L) \ { \ W[0] = cf[0] * X[0] + cf[1] * X[0] + cf[2] * X[0] + cf[3] * X[0]; \ @@ -189,7 +189,7 @@ void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, unsign Y[i] = cf[0] * W[i] + cf[1] * Y[i + 1] + cf[2] * Y[i + 2] + cf[3] * Y[i + 3]; \ } \ } (void)0 - + // intermediate buffers sz = max(src_width, src_height); X = (double *)MEM_callocN(sz * sizeof(double), "IIR_gauss X buf"); @@ -230,12 +230,12 @@ void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, unsign } } } - + MEM_freeN(X); MEM_freeN(W); MEM_freeN(Y); #undef YVV - + } @@ -260,7 +260,7 @@ void FastGaussianBlurValueOperation::executePixel(float output[4], int x, int y, bool FastGaussianBlurValueOperation::determineDependingAreaOfInterest(rcti * /*input*/, ReadBufferOperation *readOperation, rcti *output) { rcti newInput; - + if (this->m_iirgaus) { return false; } @@ -279,7 +279,7 @@ void FastGaussianBlurValueOperation::initExecution() initMutex(); } -void FastGaussianBlurValueOperation::deinitExecution() +void FastGaussianBlurValueOperation::deinitExecution() { if (this->m_iirgaus) { delete this->m_iirgaus; diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h index 1cfaee3f537..2b02cf322ef 100644 --- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h +++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h @@ -35,7 +35,7 @@ public: FastGaussianBlurOperation(); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); void executePixel(float output[4], int x, int y, void *data); - + static void IIR_gauss(MemoryBuffer *src, float sigma, unsigned int channel, unsigned int xy); void *initializeTileData(rcti *rect); void deinitExecution(); @@ -63,7 +63,7 @@ public: FastGaussianBlurValueOperation(); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); void executePixel(float output[4], int x, int y, void *data); - + void *initializeTileData(rcti *rect); void deinitExecution(); void initExecution(); diff --git a/source/blender/compositor/operations/COM_FlipOperation.cpp b/source/blender/compositor/operations/COM_FlipOperation.cpp index 80e67a7297b..c75201903eb 100644 --- a/source/blender/compositor/operations/COM_FlipOperation.cpp +++ b/source/blender/compositor/operations/COM_FlipOperation.cpp @@ -46,14 +46,14 @@ void FlipOperation::executePixelSampled(float output[4], float x, float y, Pixel { float nx = this->m_flipX ? ((int)this->getWidth() - 1) - x : x; float ny = this->m_flipY ? ((int)this->getHeight() - 1) - y : y; - + this->m_inputOperation->readSampled(output, nx, ny, sampler); } bool FlipOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { rcti newInput; - + if (this->m_flipX) { const int w = (int)this->getWidth() - 1; newInput.xmax = (w - input->xmin) + 1; @@ -72,6 +72,6 @@ bool FlipOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOper newInput.ymin = input->ymin; newInput.ymax = input->ymax; } - + return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } diff --git a/source/blender/compositor/operations/COM_FlipOperation.h b/source/blender/compositor/operations/COM_FlipOperation.h index 3a7bf77f29b..e577259fea4 100644 --- a/source/blender/compositor/operations/COM_FlipOperation.h +++ b/source/blender/compositor/operations/COM_FlipOperation.h @@ -34,7 +34,7 @@ public: FlipOperation(); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + void initExecution(); void deinitExecution(); void setFlipX(bool flipX) { this->m_flipX = flipX; } diff --git a/source/blender/compositor/operations/COM_GammaCorrectOperation.h b/source/blender/compositor/operations/COM_GammaCorrectOperation.h index b3f0cedce22..aabfe09fbf2 100644 --- a/source/blender/compositor/operations/COM_GammaCorrectOperation.h +++ b/source/blender/compositor/operations/COM_GammaCorrectOperation.h @@ -34,17 +34,17 @@ private: public: GammaCorrectOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ @@ -60,17 +60,17 @@ private: public: GammaUncorrectOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ diff --git a/source/blender/compositor/operations/COM_GammaOperation.cpp b/source/blender/compositor/operations/COM_GammaOperation.cpp index 79b70b5170e..0cc0cbefd46 100644 --- a/source/blender/compositor/operations/COM_GammaOperation.cpp +++ b/source/blender/compositor/operations/COM_GammaOperation.cpp @@ -41,7 +41,7 @@ void GammaOperation::executePixelSampled(float output[4], float x, float y, Pixe { float inputValue[4]; float inputGamma[4]; - + this->m_inputProgram->readSampled(inputValue, x, y, sampler); this->m_inputGammaProgram->readSampled(inputGamma, x, y, sampler); const float gamma = inputGamma[0]; @@ -49,7 +49,7 @@ void GammaOperation::executePixelSampled(float output[4], float x, float y, Pixe output[0] = inputValue[0] > 0.0f ? powf(inputValue[0], gamma) : inputValue[0]; output[1] = inputValue[1] > 0.0f ? powf(inputValue[1], gamma) : inputValue[1]; output[2] = inputValue[2] > 0.0f ? powf(inputValue[2], gamma) : inputValue[2]; - + output[3] = inputValue[3]; } diff --git a/source/blender/compositor/operations/COM_GammaOperation.h b/source/blender/compositor/operations/COM_GammaOperation.h index 9243ece6b30..ce221965eb5 100644 --- a/source/blender/compositor/operations/COM_GammaOperation.h +++ b/source/blender/compositor/operations/COM_GammaOperation.h @@ -35,17 +35,17 @@ private: public: GammaOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ diff --git a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp index 0fab888b9d9..c560257b859 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp @@ -56,7 +56,7 @@ void GaussianAlphaXBlurOperation::initExecution() if (this->m_sizeavailable) { float rad = max_ff(m_size * m_data.sizex, 0.0f); m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); - + m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize); m_distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad, m_filtersize, m_falloff); } @@ -68,7 +68,7 @@ void GaussianAlphaXBlurOperation::updateGauss() updateSize(); float rad = max_ff(m_size * m_data.sizex, 0.0f); m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); - + m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize); } @@ -76,7 +76,7 @@ void GaussianAlphaXBlurOperation::updateGauss() updateSize(); float rad = max_ff(m_size * m_data.sizex, 0.0f); m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); - + m_distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad, m_filtersize, m_falloff); } } diff --git a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h index fc5b3384749..651e8d9e658 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h @@ -41,7 +41,7 @@ public: * @brief the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * @brief initialize the execution */ @@ -51,7 +51,7 @@ public: * @brief Deinitialize the execution */ void deinitExecution(); - + void *initializeTileData(rcti *rect); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); diff --git a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp index b4e535cbf20..b90320afdeb 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp @@ -56,7 +56,7 @@ void GaussianAlphaYBlurOperation::initExecution() if (this->m_sizeavailable) { float rad = max_ff(m_size * m_data.sizey, 0.0f); m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); - + m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize); m_distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad, m_filtersize, m_falloff); } @@ -68,7 +68,7 @@ void GaussianAlphaYBlurOperation::updateGauss() updateSize(); float rad = max_ff(m_size * m_data.sizey, 0.0f); m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); - + m_gausstab = BlurBaseOperation::make_gausstab(rad, m_filtersize); } @@ -76,7 +76,7 @@ void GaussianAlphaYBlurOperation::updateGauss() updateSize(); float rad = max_ff(m_size * m_data.sizey, 0.0f); m_filtersize = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); - + m_distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad, m_filtersize, m_falloff); } } diff --git a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h index 4f2f2ec3fe4..dc9e5607ae6 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h @@ -36,12 +36,12 @@ private: void updateGauss(); public: GaussianAlphaYBlurOperation(); - + /** * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * @brief initialize the execution */ @@ -51,7 +51,7 @@ public: * Deinitialize the execution */ void deinitExecution(); - + void *initializeTileData(rcti *rect); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp index c268cff557a..483ddb53344 100644 --- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp @@ -70,18 +70,18 @@ void GaussianBokehBlurOperation::updateGauss() } radxf = this->m_size * (float)this->m_data.sizex; CLAMP(radxf, 0.0f, width / 2.0f); - + /* vertical */ radyf = this->m_size * (float)this->m_data.sizey; CLAMP(radyf, 0.0f, height / 2.0f); - + this->m_radx = ceil(radxf); this->m_rady = ceil(radyf); - + int ddwidth = 2 * this->m_radx + 1; int ddheight = 2 * this->m_rady + 1; n = ddwidth * ddheight; - + /* create a full filter image */ ddgauss = (float *)MEM_mallocN(sizeof(float) * n, __func__); dgauss = ddgauss; @@ -94,7 +94,7 @@ void GaussianBokehBlurOperation::updateGauss() float fi = (float)i * facx; float dist = sqrt(fj * fj + fi * fi); *dgauss = RE_filter_value(this->m_data.filtertype, dist); - + sum += *dgauss; } } @@ -109,7 +109,7 @@ void GaussianBokehBlurOperation::updateGauss() int center = m_rady * ddwidth + m_radx; ddgauss[center] = 1.0f; } - + this->m_gausstab = ddgauss; } } @@ -175,7 +175,7 @@ bool GaussianBokehBlurOperation::determineDependingAreaOfInterest(rcti *input, R sizeInput.xmax = 5; sizeInput.ymax = 5; NodeOperation *operation = this->getInputOperation(1); - + if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) { return true; } @@ -233,8 +233,8 @@ void GaussianBlurReferenceOperation::initExecution() break; } } - - + + /* horizontal */ m_filtersizex = (float)this->m_data.sizex; int imgx = getWidth() / 2; @@ -307,7 +307,7 @@ void GaussianBlurReferenceOperation::executePixel(float output[4], int x, int y, for (i = minyr; i < maxyr; i++, srcd += COM_NUM_CHANNELS_COLOR * imgx) { src = srcd; for (j = minxr; j < maxxr; j++, src += COM_NUM_CHANNELS_COLOR) { - + val = gausstabcenty[i] * gausstabcentx[j]; sum += val; rval += val * src[0]; @@ -340,7 +340,7 @@ bool GaussianBlurReferenceOperation::determineDependingAreaOfInterest(rcti *inpu { rcti newInput; NodeOperation *operation = this->getInputOperation(1); - + if (operation->determineDependingAreaOfInterest(input, readOperation, output)) { return true; } diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h index e483ffd4f2d..9089838add5 100644 --- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h @@ -40,19 +40,19 @@ public: * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Deinitialize the execution */ void deinitExecution(); - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); }; class GaussianBlurReferenceOperation : public BlurBaseOperation { private: float **m_maintabs; - + void updateGauss(); int m_filtersizex; int m_filtersizey; @@ -67,12 +67,12 @@ public: * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Deinitialize the execution */ void deinitExecution(); - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); }; diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp index ef438e1d364..3eafc7a1bfe 100644 --- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp @@ -170,7 +170,7 @@ void GaussianXBlurOperation::deinitExecution() bool GaussianXBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { rcti newInput; - + if (!this->m_sizeavailable) { rcti sizeInput; sizeInput.xmin = 0; diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.h b/source/blender/compositor/operations/COM_GaussianXBlurOperation.h index 46a5c4e3c03..4ad57bda742 100644 --- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.h @@ -55,7 +55,7 @@ public: * @brief Deinitialize the execution */ void deinitExecution(); - + void *initializeTileData(rcti *rect); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp index 6f8f96a6344..45089598af5 100644 --- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp @@ -172,7 +172,7 @@ void GaussianYBlurOperation::deinitExecution() bool GaussianYBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { rcti newInput; - + if (!m_sizeavailable) { rcti sizeInput; sizeInput.xmin = 0; diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.h b/source/blender/compositor/operations/COM_GaussianYBlurOperation.h index ca3172bd505..da1adbd0ea7 100644 --- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.h @@ -35,7 +35,7 @@ private: void updateGauss(); public: GaussianYBlurOperation(); - + /** * the inner loop of this program */ @@ -55,7 +55,7 @@ public: * Deinitialize the execution */ void deinitExecution(); - + void *initializeTileData(rcti *rect); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); diff --git a/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp b/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp index f54e75a6b35..62ebe601d8d 100644 --- a/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp +++ b/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp @@ -49,7 +49,7 @@ void GlareThresholdOperation::initExecution() void GlareThresholdOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) { const float threshold = this->m_settings->threshold; - + this->m_inputProgram->readSampled(output, x, y, sampler); if (IMB_colormanagement_get_luminance(output) >= threshold) { output[0] -= threshold; diff --git a/source/blender/compositor/operations/COM_GlareThresholdOperation.h b/source/blender/compositor/operations/COM_GlareThresholdOperation.h index 7760a19251b..647cf74cdcf 100644 --- a/source/blender/compositor/operations/COM_GlareThresholdOperation.h +++ b/source/blender/compositor/operations/COM_GlareThresholdOperation.h @@ -57,7 +57,7 @@ public: void setGlareSettings(NodeGlare *settings) { this->m_settings = settings; } - + void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); }; #endif diff --git a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h index 06d785f2c51..97bfc836ae2 100644 --- a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h +++ b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h @@ -33,17 +33,17 @@ private: SocketReader *m_inputProgram; public: HueSaturationValueCorrectOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ diff --git a/source/blender/compositor/operations/COM_ImageOperation.h b/source/blender/compositor/operations/COM_ImageOperation.h index 1f9a9a45af1..8ab93c2ba64 100644 --- a/source/blender/compositor/operations/COM_ImageOperation.h +++ b/source/blender/compositor/operations/COM_ImageOperation.h @@ -57,11 +57,11 @@ protected: * Determine the output resolution. The resolution is retrieved from the Renderer */ void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); - + virtual ImBuf *getImBuf(); public: - + void initExecution(); void deinitExecution(); void setImage(Image *image) { this->m_image = image; } diff --git a/source/blender/compositor/operations/COM_InpaintOperation.cpp b/source/blender/compositor/operations/COM_InpaintOperation.cpp index 11896b1d78c..da31638ff07 100644 --- a/source/blender/compositor/operations/COM_InpaintOperation.cpp +++ b/source/blender/compositor/operations/COM_InpaintOperation.cpp @@ -87,7 +87,7 @@ float *InpaintSimpleOperation::get_pixel(int x, int y) x * COM_NUM_CHANNELS_COLOR]; } -int InpaintSimpleOperation::mdist(int x, int y) +int InpaintSimpleOperation::mdist(int x, int y) { int width = this->getWidth(); @@ -103,7 +103,7 @@ bool InpaintSimpleOperation::next_pixel(int &x, int &y, int & curr, int iters) if (curr >= this->m_area_size) { return false; } - + int r = this->m_pixelorder[curr++]; x = r % width; @@ -112,11 +112,11 @@ bool InpaintSimpleOperation::next_pixel(int &x, int &y, int & curr, int iters) if (this->mdist(x, y) > iters) { return false; } - + return true; } -void InpaintSimpleOperation::calc_manhatten_distance() +void InpaintSimpleOperation::calc_manhatten_distance() { int width = this->getWidth(); int height = this->getHeight(); @@ -131,9 +131,9 @@ void InpaintSimpleOperation::calc_manhatten_distance() /* no need to clamp here */ if (this->get_pixel(i, j)[3] < 1.0f) { r = width + height; - if (i > 0) + if (i > 0) r = min_ii(r, m[j * width + i - 1] + 1); - if (j > 0) + if (j > 0) r = min_ii(r, m[(j - 1) * width + i] + 1); } m[j * width + i] = r; @@ -143,27 +143,27 @@ void InpaintSimpleOperation::calc_manhatten_distance() for (int j = height - 1; j >= 0; j--) { for (int i = width - 1; i >= 0; i--) { int r = m[j * width + i]; - - if (i + 1 < width) + + if (i + 1 < width) r = min_ii(r, m[j * width + i + 1] + 1); - if (j + 1 < height) + if (j + 1 < height) r = min_ii(r, m[(j + 1) * width + i] + 1); - + m[j * width + i] = r; - + offsets[r]++; } } - + offsets[0] = 0; - + for (int i = 1; i < width + height + 1; i++) { offsets[i] += offsets[i - 1]; } - + this->m_area_size = offsets[width + height]; this->m_pixelorder = (int *)MEM_mallocN(sizeof(int) * this->m_area_size, __func__); - + for (int i = 0; i < width * height; i++) { if (m[i] > 0) { this->m_pixelorder[offsets[m[i] - 1]++] = i; @@ -230,7 +230,7 @@ void *InpaintSimpleOperation::initializeTileData(rcti *rect) int curr = 0; int x, y; - + while (this->next_pixel(x, y, curr, this->m_iterations)) { this->pix_step(x, y); } @@ -275,12 +275,12 @@ bool InpaintSimpleOperation::determineDependingAreaOfInterest(rcti * /*input*/, } else { rcti newInput; - + newInput.xmax = getWidth(); newInput.xmin = 0; newInput.ymax = getHeight(); newInput.ymin = 0; - + return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } } diff --git a/source/blender/compositor/operations/COM_InpaintOperation.h b/source/blender/compositor/operations/COM_InpaintOperation.h index 9ddcac93c5c..fe8e2dd2a19 100644 --- a/source/blender/compositor/operations/COM_InpaintOperation.h +++ b/source/blender/compositor/operations/COM_InpaintOperation.h @@ -30,9 +30,9 @@ protected: * Cached reference to the inputProgram */ SocketReader *m_inputImageProgram; - + int m_iterations; - + float *m_cached_buffer; bool m_cached_buffer_ready; @@ -41,25 +41,25 @@ protected: short *m_manhatten_distance; public: InpaintSimpleOperation(); - + /** * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + void *initializeTileData(rcti *rect); /** * Deinitialize the execution */ void deinitExecution(); - + void setIterations(int iterations) { this->m_iterations = iterations; } - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); private: diff --git a/source/blender/compositor/operations/COM_InvertOperation.cpp b/source/blender/compositor/operations/COM_InvertOperation.cpp index 833b91ac1e3..53f181cf008 100644 --- a/source/blender/compositor/operations/COM_InvertOperation.cpp +++ b/source/blender/compositor/operations/COM_InvertOperation.cpp @@ -45,10 +45,10 @@ void InvertOperation::executePixelSampled(float output[4], float x, float y, Pix float inputColor[4]; this->m_inputValueProgram->readSampled(inputValue, x, y, sampler); this->m_inputColorProgram->readSampled(inputColor, x, y, sampler); - + const float value = inputValue[0]; const float invertedValue = 1.0f - value; - + if (this->m_color) { output[0] = (1.0f - inputColor[0]) * value + inputColor[0] * invertedValue; output[1] = (1.0f - inputColor[1]) * value + inputColor[1] * invertedValue; @@ -57,7 +57,7 @@ void InvertOperation::executePixelSampled(float output[4], float x, float y, Pix else { copy_v3_v3(output, inputColor); } - + if (this->m_alpha) output[3] = (1.0f - inputColor[3]) * value + inputColor[3] * invertedValue; else diff --git a/source/blender/compositor/operations/COM_InvertOperation.h b/source/blender/compositor/operations/COM_InvertOperation.h index 977feeb87af..4528895c282 100644 --- a/source/blender/compositor/operations/COM_InvertOperation.h +++ b/source/blender/compositor/operations/COM_InvertOperation.h @@ -32,28 +32,28 @@ private: */ SocketReader *m_inputValueProgram; SocketReader *m_inputColorProgram; - + bool m_alpha; bool m_color; public: InvertOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + void setColor(bool color) { this->m_color = color; } void setAlpha(bool alpha) { this->m_alpha = alpha; } }; diff --git a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp index 1401ab56fbd..e07da3bd17f 100644 --- a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp @@ -54,11 +54,11 @@ void LuminanceMatteOperation::executePixelSampled(float output[4], float x, floa const float luminance = IMB_colormanagement_get_luminance(inColor); float alpha; - + /* one line thread-friend algorithm: * output[0] = min(inputValue[3], min(1.0f, max(0.0f, ((luminance - low) / (high - low)))); */ - + /* test range */ if (luminance > high) { alpha = 1.0f; diff --git a/source/blender/compositor/operations/COM_LuminanceMatteOperation.h b/source/blender/compositor/operations/COM_LuminanceMatteOperation.h index 93051f52228..951c054d241 100644 --- a/source/blender/compositor/operations/COM_LuminanceMatteOperation.h +++ b/source/blender/compositor/operations/COM_LuminanceMatteOperation.h @@ -37,15 +37,15 @@ public: * Default constructor */ LuminanceMatteOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + void initExecution(); void deinitExecution(); - + void setSettings(NodeChroma *nodeChroma) { this->m_settings = nodeChroma; } }; #endif diff --git a/source/blender/compositor/operations/COM_MapRangeOperation.cpp b/source/blender/compositor/operations/COM_MapRangeOperation.cpp index 6124a53d5b9..f5d3b146196 100644 --- a/source/blender/compositor/operations/COM_MapRangeOperation.cpp +++ b/source/blender/compositor/operations/COM_MapRangeOperation.cpp @@ -58,7 +58,7 @@ void MapRangeOperation::executePixelSampled(float output[4], float x, float y, P this->m_sourceMaxOperation->readSampled(inputs + 2, x, y, sampler); this->m_destMinOperation->readSampled(inputs + 3, x, y, sampler); this->m_destMaxOperation->readSampled(inputs + 4, x, y, sampler); - + value = inputs[0]; source_min = inputs[1]; source_max = inputs[2]; diff --git a/source/blender/compositor/operations/COM_MapRangeOperation.h b/source/blender/compositor/operations/COM_MapRangeOperation.h index 48ecad9d226..405faf3fb2c 100644 --- a/source/blender/compositor/operations/COM_MapRangeOperation.h +++ b/source/blender/compositor/operations/COM_MapRangeOperation.h @@ -46,26 +46,26 @@ public: * Default constructor */ MapRangeOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + /** * Clamp the output */ void setUseClamp(bool value) { this->m_useClamp = value; } - + }; #endif diff --git a/source/blender/compositor/operations/COM_MapUVOperation.cpp b/source/blender/compositor/operations/COM_MapUVOperation.cpp index 0112f4bbf21..54d63b6a12c 100644 --- a/source/blender/compositor/operations/COM_MapUVOperation.cpp +++ b/source/blender/compositor/operations/COM_MapUVOperation.cpp @@ -54,7 +54,7 @@ void MapUVOperation::executePixelSampled(float output[4], float x, float y, Pixe /* EWA filtering */ this->m_inputColorProgram->readFiltered(output, uv[0], uv[1], deriv[0], deriv[1]); - + /* UV to alpha threshold */ const float threshold = this->m_alpha * 0.05f; /* XXX alpha threshold is used to fade out pixels on boundaries with invalid derivatives. diff --git a/source/blender/compositor/operations/COM_MapUVOperation.h b/source/blender/compositor/operations/COM_MapUVOperation.h index 796ee952607..1bb26bf14f0 100644 --- a/source/blender/compositor/operations/COM_MapUVOperation.h +++ b/source/blender/compositor/operations/COM_MapUVOperation.h @@ -33,7 +33,7 @@ private: SocketReader *m_inputColorProgram; float m_alpha; - + public: MapUVOperation(); @@ -53,7 +53,7 @@ public: * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ diff --git a/source/blender/compositor/operations/COM_MapValueOperation.cpp b/source/blender/compositor/operations/COM_MapValueOperation.cpp index 59d4d836b1b..afe3961dbf1 100644 --- a/source/blender/compositor/operations/COM_MapValueOperation.cpp +++ b/source/blender/compositor/operations/COM_MapValueOperation.cpp @@ -46,7 +46,7 @@ void MapValueOperation::executePixelSampled(float output[4], float x, float y, P if (texmap->flag & TEXMAP_CLIP_MAX) if (value > texmap->max[0]) value = texmap->max[0]; - + output[0] = value; } diff --git a/source/blender/compositor/operations/COM_MapValueOperation.h b/source/blender/compositor/operations/COM_MapValueOperation.h index ba19e76f4db..97528efca19 100644 --- a/source/blender/compositor/operations/COM_MapValueOperation.h +++ b/source/blender/compositor/operations/COM_MapValueOperation.h @@ -41,26 +41,26 @@ public: * Default constructor */ MapValueOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ void deinitExecution(); - + /** * @brief set the TexMapping settings */ void setSettings(TexMapping *settings) { this->m_settings = settings; } - + }; #endif diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.cpp b/source/blender/compositor/operations/COM_MathBaseOperation.cpp index bb6e1f9da8d..0a515da1877 100644 --- a/source/blender/compositor/operations/COM_MathBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_MathBaseOperation.cpp @@ -76,10 +76,10 @@ void MathAddOperation::executePixelSampled(float output[4], float x, float y, Pi { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + output[0] = inputValue1[0] + inputValue2[0]; clampIfNeeded(output); @@ -89,10 +89,10 @@ void MathSubtractOperation::executePixelSampled(float output[4], float x, float { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + output[0] = inputValue1[0] - inputValue2[0]; clampIfNeeded(output); @@ -102,10 +102,10 @@ void MathMultiplyOperation::executePixelSampled(float output[4], float x, float { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + output[0] = inputValue1[0] * inputValue2[0]; clampIfNeeded(output); @@ -115,10 +115,10 @@ void MathDivideOperation::executePixelSampled(float output[4], float x, float y, { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + if (inputValue2[0] == 0) /* We don't want to divide by zero. */ output[0] = 0.0; else @@ -131,10 +131,10 @@ void MathSineOperation::executePixelSampled(float output[4], float x, float y, P { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + output[0] = sin(inputValue1[0]); clampIfNeeded(output); @@ -144,10 +144,10 @@ void MathCosineOperation::executePixelSampled(float output[4], float x, float y, { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + output[0] = cos(inputValue1[0]); clampIfNeeded(output); @@ -157,10 +157,10 @@ void MathTangentOperation::executePixelSampled(float output[4], float x, float y { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + output[0] = tan(inputValue1[0]); clampIfNeeded(output); @@ -170,10 +170,10 @@ void MathArcSineOperation::executePixelSampled(float output[4], float x, float y { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + if (inputValue1[0] <= 1 && inputValue1[0] >= -1) output[0] = asin(inputValue1[0]); else @@ -186,10 +186,10 @@ void MathArcCosineOperation::executePixelSampled(float output[4], float x, float { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + if (inputValue1[0] <= 1 && inputValue1[0] >= -1) output[0] = acos(inputValue1[0]); else @@ -202,10 +202,10 @@ void MathArcTangentOperation::executePixelSampled(float output[4], float x, floa { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + output[0] = atan(inputValue1[0]); clampIfNeeded(output); @@ -215,10 +215,10 @@ void MathPowerOperation::executePixelSampled(float output[4], float x, float y, { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + if (inputValue1[0] >= 0) { output[0] = pow(inputValue1[0], inputValue2[0]); } @@ -240,10 +240,10 @@ void MathLogarithmOperation::executePixelSampled(float output[4], float x, float { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + if (inputValue1[0] > 0 && inputValue2[0] > 0) output[0] = log(inputValue1[0]) / log(inputValue2[0]); else @@ -256,10 +256,10 @@ void MathMinimumOperation::executePixelSampled(float output[4], float x, float y { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + output[0] = min(inputValue1[0], inputValue2[0]); clampIfNeeded(output); @@ -269,10 +269,10 @@ void MathMaximumOperation::executePixelSampled(float output[4], float x, float y { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + output[0] = max(inputValue1[0], inputValue2[0]); clampIfNeeded(output); @@ -282,10 +282,10 @@ void MathRoundOperation::executePixelSampled(float output[4], float x, float y, { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + output[0] = round(inputValue1[0]); clampIfNeeded(output); @@ -295,10 +295,10 @@ void MathLessThanOperation::executePixelSampled(float output[4], float x, float { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + output[0] = inputValue1[0] < inputValue2[0] ? 1.0f : 0.0f; clampIfNeeded(output); @@ -308,10 +308,10 @@ void MathGreaterThanOperation::executePixelSampled(float output[4], float x, flo { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + output[0] = inputValue1[0] > inputValue2[0] ? 1.0f : 0.0f; clampIfNeeded(output); @@ -321,10 +321,10 @@ void MathModuloOperation::executePixelSampled(float output[4], float x, float y, { float inputValue1[4]; float inputValue2[4]; - + this->m_inputValue1Operation->readSampled(inputValue1, x, y, sampler); this->m_inputValue2Operation->readSampled(inputValue2, x, y, sampler); - + if (inputValue2[0] == 0) output[0] = 0.0; else @@ -355,4 +355,4 @@ void MathArcTan2Operation::executePixelSampled(float output[4], float x, float y output[0] = atan2(inputValue1[0], inputValue2[0]); clampIfNeeded(output); -}
\ No newline at end of file +} diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.h b/source/blender/compositor/operations/COM_MathBaseOperation.h index 862783fff5d..c636117451f 100644 --- a/source/blender/compositor/operations/COM_MathBaseOperation.h +++ b/source/blender/compositor/operations/COM_MathBaseOperation.h @@ -51,12 +51,12 @@ public: * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) = 0; - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ diff --git a/source/blender/compositor/operations/COM_MixOperation.cpp b/source/blender/compositor/operations/COM_MixOperation.cpp index 314e16895f3..0acbe63e20e 100644 --- a/source/blender/compositor/operations/COM_MixOperation.cpp +++ b/source/blender/compositor/operations/COM_MixOperation.cpp @@ -53,11 +53,11 @@ void MixBaseOperation::executePixelSampled(float output[4], float x, float y, Pi float inputColor1[4]; float inputColor2[4]; float inputValue[4]; - + this->m_inputValueOperation->readSampled(inputValue, x, y, sampler); this->m_inputColor1Operation->readSampled(inputColor1, x, y, sampler); this->m_inputColor2Operation->readSampled(inputColor2, x, y, sampler); - + float value = inputValue[0]; if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; @@ -147,7 +147,7 @@ void MixBlendOperation::executePixelSampled(float output[4], float x, float y, P this->m_inputColor1Operation->readSampled(inputColor1, x, y, sampler); this->m_inputColor2Operation->readSampled(inputColor2, x, y, sampler); value = inputValue[0]; - + if (this->useValueAlphaMultiply()) { value *= inputColor2[3]; } diff --git a/source/blender/compositor/operations/COM_MixOperation.h b/source/blender/compositor/operations/COM_MixOperation.h index f375a47f087..fa13a486657 100644 --- a/source/blender/compositor/operations/COM_MixOperation.h +++ b/source/blender/compositor/operations/COM_MixOperation.h @@ -50,23 +50,23 @@ protected: CLAMP(color[3], 0.0f, 1.0f); } } - + public: /** * Default constructor */ MixBaseOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ @@ -74,7 +74,7 @@ public: void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); - + void setUseValueAlphaMultiply(const bool value) { this->m_valueAlphaMultiply = value; } inline bool useValueAlphaMultiply() { return this->m_valueAlphaMultiply; } void setUseClamp(bool value) { this->m_useClamp = value; } diff --git a/source/blender/compositor/operations/COM_MovieClipOperation.h b/source/blender/compositor/operations/COM_MovieClipOperation.h index 93452752234..28e6c0d0c3a 100644 --- a/source/blender/compositor/operations/COM_MovieClipOperation.h +++ b/source/blender/compositor/operations/COM_MovieClipOperation.h @@ -41,7 +41,7 @@ protected: int m_movieClipwidth; int m_framenumber; bool m_cacheFrame; - + /** * Determine the output resolution. The resolution is retrieved from the Renderer */ @@ -49,7 +49,7 @@ protected: public: MovieClipBaseOperation(); - + void initExecution(); void deinitExecution(); void setMovieClip(MovieClip *image) { this->m_movieClip = image; } diff --git a/source/blender/compositor/operations/COM_NormalizeOperation.cpp b/source/blender/compositor/operations/COM_NormalizeOperation.cpp index 6106a805f87..3527c874bcf 100644 --- a/source/blender/compositor/operations/COM_NormalizeOperation.cpp +++ b/source/blender/compositor/operations/COM_NormalizeOperation.cpp @@ -64,7 +64,7 @@ bool NormalizeOperation::determineDependingAreaOfInterest(rcti * /*input*/, Read { rcti imageInput; if (this->m_cachedInstance) return false; - + NodeOperation *operation = getInputOperation(0); imageInput.xmax = operation->getWidth(); imageInput.xmin = 0; diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.cpp b/source/blender/compositor/operations/COM_OutputFileOperation.cpp index 39877e35605..db2598ad6dc 100644 --- a/source/blender/compositor/operations/COM_OutputFileOperation.cpp +++ b/source/blender/compositor/operations/COM_OutputFileOperation.cpp @@ -135,11 +135,11 @@ static void write_buffer_rect(rcti *rect, const bNodeTree *tree, for (y = y1; y < y2 && (!breaked); y++) { for (x = x1; x < x2 && (!breaked); x++) { reader->readSampled(color, x, y, COM_PS_NEAREST); - + for (i = 0; i < size; ++i) buffer[offset + i] = color[i]; offset += size; - + if (tree->test_break && tree->test_break(tree->tbh)) breaked = true; } @@ -154,13 +154,13 @@ OutputSingleLayerOperation::OutputSingleLayerOperation( { this->m_rd = rd; this->m_tree = tree; - + this->addInputSocket(datatype); - + this->m_outputBuffer = NULL; this->m_datatype = datatype; this->m_imageInput = NULL; - + this->m_format = format; BLI_strncpy(this->m_path, path, sizeof(this->m_path)); @@ -183,17 +183,17 @@ void OutputSingleLayerOperation::executeRegion(rcti *rect, unsigned int /*tileNu void OutputSingleLayerOperation::deinitExecution() { if (this->getWidth() * this->getHeight() != 0) { - + int size = get_datatype_size(this->m_datatype); ImBuf *ibuf = IMB_allocImBuf(this->getWidth(), this->getHeight(), this->m_format->planes, 0); char filename[FILE_MAX]; const char *suffix; - + ibuf->channels = size; ibuf->rect_float = this->m_outputBuffer; - ibuf->mall |= IB_rectfloat; + ibuf->mall |= IB_rectfloat; ibuf->dither = this->m_rd->dither_intensity; - + IMB_colormanagement_imbuf_for_write(ibuf, true, false, m_viewSettings, m_displaySettings, this->m_format); @@ -207,7 +207,7 @@ void OutputSingleLayerOperation::deinitExecution() printf("Cannot save Node File Output to %s\n", filename); else printf("Saved: %s\n", filename); - + IMB_freeImBuf(ibuf); } this->m_outputBuffer = NULL; @@ -221,7 +221,7 @@ OutputOpenExrLayer::OutputOpenExrLayer(const char *name_, DataType datatype_, bo BLI_strncpy(this->name, name_, sizeof(this->name)); this->datatype = datatype_; this->use_layer = use_layer_; - + /* these are created in initExecution */ this->outputBuffer = 0; this->imageInput = 0; @@ -233,7 +233,7 @@ OutputOpenExrMultiLayerOperation::OutputOpenExrMultiLayerOperation( { this->m_rd = rd; this->m_tree = tree; - + BLI_strncpy(this->m_path, path, sizeof(this->m_path)); this->m_exr_codec = exr_codec; this->m_exr_half_float = exr_half_float; @@ -285,11 +285,11 @@ void OutputOpenExrMultiLayerOperation::deinitExecution() OutputOpenExrLayer &layer = this->m_layers[i]; if (!layer.imageInput) continue; /* skip unconnected sockets */ - + add_exr_channels(exrhandle, this->m_layers[i].name, this->m_layers[i].datatype, "", width, this->m_exr_half_float, this->m_layers[i].outputBuffer); } - + /* when the filename has no permissions, this can fail */ if (IMB_exr_begin_write(exrhandle, filename, width, height, this->m_exr_codec, NULL)) { IMB_exr_write_channels(exrhandle); @@ -299,14 +299,14 @@ void OutputOpenExrMultiLayerOperation::deinitExecution() /* XXX nice way to do report? */ printf("Error Writing Render Result, see console\n"); } - + IMB_exr_close(exrhandle); for (unsigned int i = 0; i < this->m_layers.size(); ++i) { if (this->m_layers[i].outputBuffer) { MEM_freeN(this->m_layers[i].outputBuffer); this->m_layers[i].outputBuffer = NULL; } - + this->m_layers[i].imageInput = NULL; } } diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.h b/source/blender/compositor/operations/COM_OutputFileOperation.h index 60862de48cb..32c9b5ab5b8 100644 --- a/source/blender/compositor/operations/COM_OutputFileOperation.h +++ b/source/blender/compositor/operations/COM_OutputFileOperation.h @@ -37,10 +37,10 @@ class OutputSingleLayerOperation : public NodeOperation { protected: const RenderData *m_rd; const bNodeTree *m_tree; - + ImageFormatData *m_format; char m_path[FILE_MAX]; - + float *m_outputBuffer; DataType m_datatype; SocketReader *m_imageInput; @@ -52,7 +52,7 @@ protected: public: OutputSingleLayerOperation(const RenderData *rd, const bNodeTree *tree, DataType datatype, ImageFormatData *format, const char *path, const ColorManagedViewSettings *viewSettings, const ColorManagedDisplaySettings *displaySettings, const char *viewName); - + void executeRegion(rcti *rect, unsigned int tileNumber); bool isOutputOperation(bool /*rendering*/) const { return true; } void initExecution(); @@ -65,11 +65,11 @@ public: /* extra info for OpenEXR layers */ struct OutputOpenExrLayer { OutputOpenExrLayer(const char *name, DataType datatype, bool use_layer); - + char name[EXR_TOT_MAXNAME - 2]; DataType datatype; bool use_layer; - + /* internals */ float *outputBuffer; SocketReader *imageInput; @@ -79,22 +79,22 @@ struct OutputOpenExrLayer { class OutputOpenExrMultiLayerOperation : public NodeOperation { protected: typedef std::vector<OutputOpenExrLayer> LayerList; - + const RenderData *m_rd; const bNodeTree *m_tree; - + char m_path[FILE_MAX]; char m_exr_codec; bool m_exr_half_float; LayerList m_layers; const char *m_viewName; - + public: OutputOpenExrMultiLayerOperation(const RenderData *rd, const bNodeTree *tree, const char *path, char exr_codec, bool exr_half_float, const char *viewName); - + void add_layer(const char *name, DataType datatype, bool use_layer); - + void executeRegion(rcti *rect, unsigned int tileNumber); bool isOutputOperation(bool /*rendering*/) const { return true; } void initExecution(); diff --git a/source/blender/compositor/operations/COM_PlaneCornerPinOperation.cpp b/source/blender/compositor/operations/COM_PlaneCornerPinOperation.cpp index d6affa6eee9..4e4e803c757 100644 --- a/source/blender/compositor/operations/COM_PlaneCornerPinOperation.cpp +++ b/source/blender/compositor/operations/COM_PlaneCornerPinOperation.cpp @@ -49,7 +49,7 @@ static bool check_corners(float corners[4][2]) cur_cross = cross_v2v2(v1, v2); if (fabsf(cur_cross) <= FLT_EPSILON) return false; - + if (cross == 0.0f) cross = cur_cross; else if (cross * cur_cross < 0.0f) @@ -67,7 +67,7 @@ static void readCornersFromSockets(rcti *rect, SocketReader *readers[4], float c corners[i][0] = result[0]; corners[i][1] = result[1]; } - + /* convexity check: * concave corners need to be prevented, otherwise * BKE_tracking_homography_between_two_quads will freeze @@ -95,7 +95,7 @@ PlaneCornerPinMaskOperation::PlaneCornerPinMaskOperation() : addInputSocket(COM_DT_VECTOR); addInputSocket(COM_DT_VECTOR); addInputSocket(COM_DT_VECTOR); - + /* XXX this is stupid: we need to make this "complex", * so we can use the initializeTileData function * to read corners from input sockets ... @@ -106,21 +106,21 @@ PlaneCornerPinMaskOperation::PlaneCornerPinMaskOperation() : void PlaneCornerPinMaskOperation::initExecution() { PlaneDistortMaskOperation::initExecution(); - + initMutex(); } void PlaneCornerPinMaskOperation::deinitExecution() { PlaneDistortMaskOperation::deinitExecution(); - + deinitMutex(); } void *PlaneCornerPinMaskOperation::initializeTileData(rcti *rect) { void *data = PlaneDistortMaskOperation::initializeTileData(rect); - + /* get corner values once, by reading inputs at (0,0) * XXX this assumes invariable values (no image inputs), * we don't have a nice generic system for that yet @@ -134,11 +134,11 @@ void *PlaneCornerPinMaskOperation::initializeTileData(rcti *rect) float corners[4][2]; readCornersFromSockets(rect, readers, corners); calculateCorners(corners, true, 0); - + m_corners_ready = true; } unlockMutex(); - + return data; } @@ -164,21 +164,21 @@ PlaneCornerPinWarpImageOperation::PlaneCornerPinWarpImageOperation() : void PlaneCornerPinWarpImageOperation::initExecution() { PlaneDistortWarpImageOperation::initExecution(); - + initMutex(); } void PlaneCornerPinWarpImageOperation::deinitExecution() { PlaneDistortWarpImageOperation::deinitExecution(); - + deinitMutex(); } void *PlaneCornerPinWarpImageOperation::initializeTileData(rcti *rect) { void *data = PlaneDistortWarpImageOperation::initializeTileData(rect); - + /* get corner values once, by reading inputs at (0,0) * XXX this assumes invariable values (no image inputs), * we don't have a nice generic system for that yet @@ -193,11 +193,11 @@ void *PlaneCornerPinWarpImageOperation::initializeTileData(rcti *rect) float corners[4][2]; readCornersFromSockets(rect, readers, corners); calculateCorners(corners, true, 0); - + m_corners_ready = true; } unlockMutex(); - + return data; } @@ -206,7 +206,7 @@ bool PlaneCornerPinWarpImageOperation::determineDependingAreaOfInterest(rcti *in for (int i = 0; i < 4; ++i) if (getInputOperation(i + 1)->determineDependingAreaOfInterest(input, readOperation, output)) return true; - + /* XXX this is bad, but unavoidable with the current design: * we don't know the actual corners and matrix at this point, * so all we can do is get the full input image diff --git a/source/blender/compositor/operations/COM_PlaneCornerPinOperation.h b/source/blender/compositor/operations/COM_PlaneCornerPinOperation.h index ed70d9c80a3..a9bd18299eb 100644 --- a/source/blender/compositor/operations/COM_PlaneCornerPinOperation.h +++ b/source/blender/compositor/operations/COM_PlaneCornerPinOperation.h @@ -37,15 +37,15 @@ class PlaneCornerPinMaskOperation : public PlaneDistortMaskOperation { private: bool m_corners_ready; - + public: PlaneCornerPinMaskOperation(); - + void initExecution(); void deinitExecution(); - + void *initializeTileData(rcti *rect); - + void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); }; @@ -53,15 +53,15 @@ public: class PlaneCornerPinWarpImageOperation : public PlaneDistortWarpImageOperation { private: bool m_corners_ready; - + public: PlaneCornerPinWarpImageOperation(); - + void initExecution(); void deinitExecution(); - + void *initializeTileData(rcti *rect); - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); }; diff --git a/source/blender/compositor/operations/COM_PreviewOperation.cpp b/source/blender/compositor/operations/COM_PreviewOperation.cpp index d4075844f0e..90e1bba3cd9 100644 --- a/source/blender/compositor/operations/COM_PreviewOperation.cpp +++ b/source/blender/compositor/operations/COM_PreviewOperation.cpp @@ -61,7 +61,7 @@ void PreviewOperation::verifyPreview(bNodeInstanceHash *previews, bNodeInstanceK void PreviewOperation::initExecution() { this->m_input = getInputSocketReader(0); - + if (this->getWidth() == (unsigned int)this->m_preview->xsize && this->getHeight() == (unsigned int)this->m_preview->ysize) { @@ -98,7 +98,7 @@ void PreviewOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/) for (int x = rect->xmin; x < rect->xmax; x++) { float rx = floor(x / this->m_divider); float ry = floor(y / this->m_divider); - + color[0] = 0.0f; color[1] = 0.0f; color[2] = 0.0f; @@ -137,7 +137,7 @@ void PreviewOperation::determineResolution(unsigned int resolution[2], unsigned } width = width * this->m_divider; height = height * this->m_divider; - + resolution[0] = width; resolution[1] = height; } diff --git a/source/blender/compositor/operations/COM_PreviewOperation.h b/source/blender/compositor/operations/COM_PreviewOperation.h index ca1d6f54cdc..907a6c8997f 100644 --- a/source/blender/compositor/operations/COM_PreviewOperation.h +++ b/source/blender/compositor/operations/COM_PreviewOperation.h @@ -44,16 +44,16 @@ protected: public: PreviewOperation(const ColorManagedViewSettings *viewSettings, const ColorManagedDisplaySettings *displaySettings); void verifyPreview(bNodeInstanceHash *previews, bNodeInstanceKey key); - + bool isOutputOperation(bool /*rendering*/) const { return !G.background; } void initExecution(); void deinitExecution(); const CompositorPriority getRenderPriority() const; - + void executeRegion(rcti *rect, unsigned int tileNumber); void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); bool isPreviewOperation() const { return true; } - + }; #endif diff --git a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp index 020bdde8c93..e135abe5f20 100644 --- a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp +++ b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cpp @@ -96,7 +96,7 @@ bool ProjectorLensDistortionOperation::determineDependingAreaOfInterest(rcti *in return false; } -void ProjectorLensDistortionOperation::updateDispersion() +void ProjectorLensDistortionOperation::updateDispersion() { if (this->m_dispersionAvailable) return; this->lockMutex(); diff --git a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h index 9eb90b6006b..12efff14839 100644 --- a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h +++ b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h @@ -31,30 +31,30 @@ private: * Cached reference to the inputProgram */ SocketReader *m_inputProgram; - + float m_dispersion; bool m_dispersionAvailable; - + float m_kr, m_kr2; public: ProjectorLensDistortionOperation(); - + /** * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + void *initializeTileData(rcti *rect); /** * Deinitialize the execution */ void deinitExecution(); - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); void updateDispersion(); diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp index f256d3a6aa1..6e7a32ba5a9 100644 --- a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp +++ b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp @@ -120,8 +120,8 @@ void ReadBufferOperation::readResolutionFromWriteBuffer() } } -void ReadBufferOperation::updateMemoryBuffer() +void ReadBufferOperation::updateMemoryBuffer() { this->m_buffer = this->getMemoryProxy()->getBuffer(); - + } diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.h b/source/blender/compositor/operations/COM_ReadBufferOperation.h index 898b568bb91..c42de32b9e9 100644 --- a/source/blender/compositor/operations/COM_ReadBufferOperation.h +++ b/source/blender/compositor/operations/COM_ReadBufferOperation.h @@ -38,7 +38,7 @@ public: void setMemoryProxy(MemoryProxy *memoryProxy) { this->m_memoryProxy = memoryProxy; } MemoryProxy *getMemoryProxy() { return this->m_memoryProxy; } void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); - + void *initializeTileData(rcti *rect); void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); void executePixelExtend(float output[4], float x, float y, PixelSampler sampler, diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.cpp b/source/blender/compositor/operations/COM_RenderLayersProg.cpp index ca135a650bd..e1a77158175 100644 --- a/source/blender/compositor/operations/COM_RenderLayersProg.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersProg.cpp @@ -50,10 +50,10 @@ void RenderLayersProg::initExecution() Scene *scene = this->getScene(); Render *re = (scene) ? RE_GetSceneRender(scene) : NULL; RenderResult *rr = NULL; - + if (re) rr = RE_AcquireResultRead(re); - + if (rr) { ViewLayer *view_layer = (ViewLayer *)BLI_findlink(&scene->view_layers, getLayerId()); if (view_layer) { @@ -181,13 +181,13 @@ void RenderLayersProg::determineResolution(unsigned int resolution[2], unsigned Scene *sce = this->getScene(); Render *re = (sce) ? RE_GetSceneRender(sce) : NULL; RenderResult *rr = NULL; - + resolution[0] = 0; resolution[1] = 0; - + if (re) rr = RE_AcquireResultRead(re); - + if (rr) { ViewLayer *view_layer = (ViewLayer *)BLI_findlink(&sce->view_layers, getLayerId()); if (view_layer) { @@ -198,7 +198,7 @@ void RenderLayersProg::determineResolution(unsigned int resolution[2], unsigned } } } - + if (re) RE_ReleaseResult(re); diff --git a/source/blender/compositor/operations/COM_RotateOperation.cpp b/source/blender/compositor/operations/COM_RotateOperation.cpp index 2d0d5aaf8d3..4186a0e1fc8 100644 --- a/source/blender/compositor/operations/COM_RotateOperation.cpp +++ b/source/blender/compositor/operations/COM_RotateOperation.cpp @@ -62,7 +62,7 @@ inline void RotateOperation::ensureDegree() } this->m_cosine = cos(rad); this->m_sine = sin(rad); - + this->m_isDegreeSet = true; } } @@ -82,12 +82,12 @@ bool RotateOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOp { ensureDegree(); rcti newInput; - + const float dxmin = input->xmin - this->m_centerX; const float dymin = input->ymin - this->m_centerY; const float dxmax = input->xmax - this->m_centerX; const float dymax = input->ymax - this->m_centerY; - + const float x1 = this->m_centerX + (this->m_cosine * dxmin + this->m_sine * dymin); const float x2 = this->m_centerX + (this->m_cosine * dxmax + this->m_sine * dymin); const float x3 = this->m_centerX + (this->m_cosine * dxmin + this->m_sine * dymax); @@ -100,11 +100,11 @@ bool RotateOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOp const float maxx = max(x1, max(x2, max(x3, x4))); const float miny = min(y1, min(y2, min(y3, y4))); const float maxy = max(y1, max(y2, max(y3, y4))); - + newInput.xmax = ceil(maxx) + 1; newInput.xmin = floor(minx) - 1; newInput.ymax = ceil(maxy) + 1; newInput.ymin = floor(miny) - 1; - + return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } diff --git a/source/blender/compositor/operations/COM_RotateOperation.h b/source/blender/compositor/operations/COM_RotateOperation.h index 7b99b6faa97..d332f7208b5 100644 --- a/source/blender/compositor/operations/COM_RotateOperation.h +++ b/source/blender/compositor/operations/COM_RotateOperation.h @@ -42,7 +42,7 @@ public: void initExecution(); void deinitExecution(); void setDoDegree2RadConversion(bool abool) { this->m_doDegree2RadConversion = abool; } - + void ensureDegree(); }; diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp index 651c336452e..f7b8d285cc2 100644 --- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp +++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp @@ -26,6 +26,7 @@ extern "C" { # include "BLI_math.h" # include "BLI_utildefines.h" # include "BLI_rand.h" +# include "PIL_time.h" } ScreenLensDistortionOperation::ScreenLensDistortionOperation() : NodeOperation() @@ -59,10 +60,14 @@ void ScreenLensDistortionOperation::initExecution() { this->m_inputProgram = this->getInputSocketReader(0); this->initMutex(); - + + uint rng_seed = (uint)(PIL_check_seconds_timer_i() & UINT_MAX); + rng_seed ^= (uint)GET_INT_FROM_POINTER(m_inputProgram); + this->m_rng = BLI_rng_new(rng_seed); + this->m_cx = 0.5f * (float)getWidth(); this->m_cy = 0.5f * (float)getHeight(); - + /* if both are constant, init variables once */ if (m_distortion_const && m_dispersion_const) { updateVariables(m_distortion, m_dispersion); @@ -80,7 +85,7 @@ void *ScreenLensDistortionOperation::initializeTileData(rcti * /*rect*/) */ if (!m_variables_ready) { this->lockMutex(); - + if (!m_distortion_const) { float result[4]; getInputSocketReader(1)->readSampled(result, 0, 0, COM_PS_NEAREST); @@ -91,13 +96,13 @@ void *ScreenLensDistortionOperation::initializeTileData(rcti * /*rect*/) getInputSocketReader(2)->readSampled(result, 0, 0, COM_PS_NEAREST); m_dispersion = result[0]; } - + updateVariables(m_distortion, m_dispersion); m_variables_ready = true; - + this->unlockMutex(); } - + return buffer; } @@ -123,7 +128,7 @@ bool ScreenLensDistortionOperation::get_delta(float r_sq, float k4, const float } else return false; - + } void ScreenLensDistortionOperation::accumulate(MemoryBuffer *buffer, @@ -133,7 +138,7 @@ void ScreenLensDistortionOperation::accumulate(MemoryBuffer *buffer, float sum[4], int count[3]) const { float color[4]; - + float dsf = len_v2v2(delta[a], delta[b]) + 1.0f; int ds = m_jitter ? (dsf < 4.0f ? 2 : (int)sqrtf(dsf)) : (int)dsf; float sd = 1.0f / (float)ds; @@ -142,13 +147,13 @@ void ScreenLensDistortionOperation::accumulate(MemoryBuffer *buffer, float dk4 = m_dk4[a]; for (float z = 0; z < ds; ++z) { - float tz = (z + (m_jitter ? BLI_frand() : 0.5f)) * sd; + float tz = (z + (m_jitter ? BLI_rng_get_float(m_rng) : 0.5f)) * sd; float t = 1.0f - (k4 + tz * dk4) * r_sq; - + float xy[2]; distort_uv(uv, t, xy); buffer->readBilinear(color, xy[0], xy[1]); - + sum[a] += (1.0f - tz) * color[a]; sum[b] += (tz ) * color[b]; count[a]++; @@ -175,11 +180,11 @@ void ScreenLensDistortionOperation::executePixel(float output[4], int x, int y, if (valid_r && valid_g && valid_b) { accumulate(buffer, 0, 1, uv_dot, uv, delta, sum, count); accumulate(buffer, 1, 2, uv_dot, uv, delta, sum, count); - + if (count[0]) output[0] = 2.0f * sum[0] / (float)count[0]; if (count[1]) output[1] = 2.0f * sum[1] / (float)count[1]; if (count[2]) output[2] = 2.0f * sum[2] / (float)count[2]; - + /* set alpha */ output[3] = 1.0f; } @@ -192,6 +197,7 @@ void ScreenLensDistortionOperation::deinitExecution() { this->deinitMutex(); this->m_inputProgram = NULL; + BLI_rng_free(this->m_rng); } void ScreenLensDistortionOperation::determineUV(float result[6], float x, float y) const @@ -200,7 +206,7 @@ void ScreenLensDistortionOperation::determineUV(float result[6], float x, float float uv[2]; get_uv(xy, uv); float uv_dot = len_squared_v2(uv); - + copy_v2_v2(result + 0, xy); copy_v2_v2(result + 2, xy); copy_v2_v2(result + 4, xy); @@ -216,7 +222,7 @@ bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti * /*in newInputValue.ymin = 0; newInputValue.xmax = 2; newInputValue.ymax = 2; - + NodeOperation *operation = getInputOperation(1); if (operation->determineDependingAreaOfInterest(&newInputValue, readOperation, output) ) { return true; @@ -226,7 +232,7 @@ bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti * /*in if (operation->determineDependingAreaOfInterest(&newInputValue, readOperation, output) ) { return true; } - + /* XXX the original method of estimating the area-of-interest does not work * it assumes a linear increase/decrease of mapped coordinates, which does not * yield correct results for the area and leaves uninitialized buffer areas. @@ -234,7 +240,7 @@ bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti * /*in */ #if 1 rcti imageInput; - + operation = getInputOperation(0); imageInput.xmax = operation->getWidth(); imageInput.xmin = 0; @@ -248,9 +254,9 @@ bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti * /*in #else rcti newInput; const float margin = 2; - + BLI_rcti_init_minmax(&newInput); - + if (m_dispersion_const && m_distortion_const) { /* update from fixed distortion/dispersion */ #define UPDATE_INPUT(x, y) \ @@ -284,7 +290,7 @@ bool ScreenLensDistortionOperation::determineDependingAreaOfInterest(rcti * /*in newInput.xmax = max_ffff(newInput.xmax, coords[0], coords[2], coords[4]); \ newInput.ymax = max_ffff(newInput.ymax, coords[1], coords[3], coords[5]); \ } (void)0 - + if (m_distortion_const) { /* update from fixed distortion */ UPDATE_INPUT(input->xmin, input->xmax, m_distortion); diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h index 648a7a6e551..e1e276d0dc4 100644 --- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h +++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h @@ -31,10 +31,11 @@ private: * Cached reference to the inputProgram */ SocketReader *m_inputProgram; - + struct RNG *m_rng; + bool m_fit; bool m_jitter; - + float m_dispersion; float m_distortion; bool m_dispersion_const; @@ -47,31 +48,31 @@ private: float m_sc, m_cx, m_cy; public: ScreenLensDistortionOperation(); - + /** * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + void *initializeTileData(rcti *rect); /** * Deinitialize the execution */ void deinitExecution(); - + void setFit(bool fit) { m_fit = fit; } void setJitter(bool jitter) { m_jitter = jitter; } - + /** Set constant distortion value */ void setDistortion(float distortion); /** Set constant dispersion value */ void setDispersion(float dispersion); - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); private: diff --git a/source/blender/compositor/operations/COM_SetAlphaOperation.cpp b/source/blender/compositor/operations/COM_SetAlphaOperation.cpp index 91933484027..e6c04a4b68c 100644 --- a/source/blender/compositor/operations/COM_SetAlphaOperation.cpp +++ b/source/blender/compositor/operations/COM_SetAlphaOperation.cpp @@ -27,7 +27,7 @@ SetAlphaOperation::SetAlphaOperation() : NodeOperation() this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_COLOR); - + this->m_inputColor = NULL; this->m_inputAlpha = NULL; } @@ -41,10 +41,10 @@ void SetAlphaOperation::initExecution() void SetAlphaOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) { float alphaInput[4]; - + this->m_inputColor->readSampled(output, x, y, sampler); this->m_inputAlpha->readSampled(alphaInput, x, y, sampler); - + output[3] = alphaInput[0]; } diff --git a/source/blender/compositor/operations/COM_SetAlphaOperation.h b/source/blender/compositor/operations/COM_SetAlphaOperation.h index 12e3debf3d3..c4e12a367a5 100644 --- a/source/blender/compositor/operations/COM_SetAlphaOperation.h +++ b/source/blender/compositor/operations/COM_SetAlphaOperation.h @@ -39,12 +39,12 @@ public: * Default constructor */ SetAlphaOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + void initExecution(); void deinitExecution(); }; diff --git a/source/blender/compositor/operations/COM_SetSamplerOperation.h b/source/blender/compositor/operations/COM_SetSamplerOperation.h index 903bcef95f0..6d97b20769d 100644 --- a/source/blender/compositor/operations/COM_SetSamplerOperation.h +++ b/source/blender/compositor/operations/COM_SetSamplerOperation.h @@ -38,9 +38,9 @@ public: * Default constructor */ SetSamplerOperation(); - + void setSampler(PixelSampler sampler) { this->m_sampler = sampler; } - + /** * the inner loop of this program */ diff --git a/source/blender/compositor/operations/COM_SetValueOperation.h b/source/blender/compositor/operations/COM_SetValueOperation.h index 10de8825d38..a0867a3bc9c 100644 --- a/source/blender/compositor/operations/COM_SetValueOperation.h +++ b/source/blender/compositor/operations/COM_SetValueOperation.h @@ -38,17 +38,17 @@ public: * Default constructor */ SetValueOperation(); - + const float getValue() { return this->m_value; } void setValue(float value) { this->m_value = value; } - - + + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); - + bool isSetOperation() const { return true; } }; #endif diff --git a/source/blender/compositor/operations/COM_SetVectorOperation.h b/source/blender/compositor/operations/COM_SetVectorOperation.h index b01f2f7a6b5..79b55bb7d91 100644 --- a/source/blender/compositor/operations/COM_SetVectorOperation.h +++ b/source/blender/compositor/operations/COM_SetVectorOperation.h @@ -41,7 +41,7 @@ public: * Default constructor */ SetVectorOperation(); - + const float getX() { return this->m_x; } void setX(float value) { this->m_x = value; } const float getY() { return this->m_y; } @@ -50,7 +50,7 @@ public: void setZ(float value) { this->m_z = value; } const float getW() { return this->m_w; } void setW(float value) { this->m_w = value; } - + /** * the inner loop of this program */ diff --git a/source/blender/compositor/operations/COM_SocketProxyOperation.h b/source/blender/compositor/operations/COM_SocketProxyOperation.h index 86c8b23b115..55cf6d376b7 100644 --- a/source/blender/compositor/operations/COM_SocketProxyOperation.h +++ b/source/blender/compositor/operations/COM_SocketProxyOperation.h @@ -28,13 +28,13 @@ class SocketProxyOperation : public NodeOperation { public: SocketProxyOperation(DataType type, bool use_conversion); - + bool isProxyOperation() const { return true; } bool useDatatypeConversion() const { return m_use_conversion; } - + bool getUseConversion() const { return m_use_conversion; } void setUseConversion(bool use_conversion) { m_use_conversion = use_conversion; } - + private: bool m_use_conversion; }; diff --git a/source/blender/compositor/operations/COM_SunBeamsOperation.cpp b/source/blender/compositor/operations/COM_SunBeamsOperation.cpp index 81b967bf530..964ba36d08c 100644 --- a/source/blender/compositor/operations/COM_SunBeamsOperation.cpp +++ b/source/blender/compositor/operations/COM_SunBeamsOperation.cpp @@ -61,7 +61,7 @@ template <int fxu, int fxv, int fyu, int fyv> struct BufferLineAccumulator { /* utility functions implementing the matrix transform to/from sector space */ - + static inline void buffer_to_sector(const float source[2], int x, int y, int &u, int &v) { int x0 = (int)source[0]; @@ -155,9 +155,9 @@ struct BufferLineAccumulator { float v, dv; float falloff_factor; float border[4]; - + zero_v4(output); - + if ((int)(co[0] - source[0]) == 0 && (int)(co[1] - source[1]) == 0) { copy_v4_v4(output, input->getBuffer() + COM_NUM_CHANNELS_COLOR * ((int)source[0] + input->getWidth() * (int)source[1])); return; @@ -174,7 +174,7 @@ struct BufferLineAccumulator { for (int i = 0; i < num; i++) { float weight = 1.0f - (float)i * falloff_factor; weight *= weight; - + /* range check, use last valid color when running beyond the image border */ if (x >= rect.xmin && x < rect.xmax && y >= rect.ymin && y < rect.ymax) { madd_v4_v4fl(output, buffer, buffer[3] * weight); @@ -184,7 +184,7 @@ struct BufferLineAccumulator { else { madd_v4_v4fl(output, border, border[3] * weight); } - + /* TODO implement proper filtering here, see * https://en.wikipedia.org/wiki/Lanczos_resampling * https://en.wikipedia.org/wiki/Sinc_function diff --git a/source/blender/compositor/operations/COM_TextureOperation.h b/source/blender/compositor/operations/COM_TextureOperation.h index a2fb7c7501f..26d50ca1753 100644 --- a/source/blender/compositor/operations/COM_TextureOperation.h +++ b/source/blender/compositor/operations/COM_TextureOperation.h @@ -54,7 +54,7 @@ protected: * Determine the output resolution. The resolution is retrieved from the Renderer */ void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); - + /** * Constructor */ diff --git a/source/blender/compositor/operations/COM_TonemapOperation.h b/source/blender/compositor/operations/COM_TonemapOperation.h index 51ffaac8503..6fcf72c9d14 100644 --- a/source/blender/compositor/operations/COM_TonemapOperation.h +++ b/source/blender/compositor/operations/COM_TonemapOperation.h @@ -47,12 +47,12 @@ protected: * @brief Cached reference to the reader */ SocketReader *m_imageReader; - + /** * @brief settings of the Tonemap */ NodeTonemap *m_data; - + /** * @brief temporarily cache of the execution storage */ @@ -60,27 +60,27 @@ protected: public: TonemapOperation(); - + /** * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + void *initializeTileData(rcti *rect); void deinitializeTileData(rcti *rect, void *data); - + /** * Deinitialize the execution */ void deinitExecution(); - + void setData(NodeTonemap *data) { this->m_data = data; } - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); }; diff --git a/source/blender/compositor/operations/COM_TranslateOperation.h b/source/blender/compositor/operations/COM_TranslateOperation.h index e30ba7ff2d7..f3708ef3c7c 100644 --- a/source/blender/compositor/operations/COM_TranslateOperation.h +++ b/source/blender/compositor/operations/COM_TranslateOperation.h @@ -45,7 +45,7 @@ public: float getDeltaX() { return this->m_deltaX * this->m_factorX; } float getDeltaY() { return this->m_deltaY * this->m_factorY; } - + inline void ensureDelta() { if (!this->m_isDeltaSet) { float tempDelta[4]; diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp index e8dbff9b2d7..a252af053cc 100644 --- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp @@ -135,7 +135,7 @@ void VariableSizeBokehBlurOperation::executePixel(float output[4], int x, int y, copy_v4_v4(color_accum, readColor); copy_v4_fl(multiplier_accum, 1.0f); float size_center = tempSize[0] * scalar; - + const int addXStepValue = QualityStepHelper::getStep(); const int addYStepValue = addXStepValue; const int addXStepColor = addXStepValue * COM_NUM_CHANNELS_COLOR; @@ -184,8 +184,8 @@ void VariableSizeBokehBlurOperation::executePixel(float output[4], int x, int y, } void VariableSizeBokehBlurOperation::executeOpenCL(OpenCLDevice *device, - MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, - MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, + MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, + MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> * /*clKernelsToCleanUp*/) { cl_kernel defocusKernel = device->COM_clCreateKernel("defocusKernel", NULL); @@ -193,7 +193,7 @@ void VariableSizeBokehBlurOperation::executeOpenCL(OpenCLDevice *device, cl_int step = this->getStep(); cl_int maxBlur; cl_float threshold = this->m_threshold; - + MemoryBuffer *sizeMemoryBuffer = this->m_inputSizeProgram->getInputMemoryBuffer(inputMemoryBuffers); const float max_dim = max(m_width, m_height); @@ -212,7 +212,7 @@ void VariableSizeBokehBlurOperation::executeOpenCL(OpenCLDevice *device, clSetKernelArg(defocusKernel, 8, sizeof(cl_float), &threshold); clSetKernelArg(defocusKernel, 9, sizeof(cl_float), &scalar); device->COM_clAttachSizeToKernelParameter(defocusKernel, 10, this); - + device->COM_clEnqueueRange(defocusKernel, outputMemoryBuffer, 11, this); } @@ -243,7 +243,7 @@ bool VariableSizeBokehBlurOperation::determineDependingAreaOfInterest(rcti *inpu bokehInput.xmin = 0; bokehInput.ymax = COM_BLUR_BOKEH_PIXELS; bokehInput.ymin = 0; - + NodeOperation *operation = getInputOperation(2); if (operation->determineDependingAreaOfInterest(&newInput, readOperation, output) ) { @@ -273,7 +273,7 @@ bool VariableSizeBokehBlurOperation::determineDependingAreaOfInterest(rcti *inpu #ifdef COM_DEFOCUS_SEARCH // InverseSearchRadiusOperation -InverseSearchRadiusOperation::InverseSearchRadiusOperation() : NodeOperation() +InverseSearchRadiusOperation::InverseSearchRadiusOperation() : NodeOperation() { this->addInputSocket(COM_DT_VALUE, COM_SC_NO_RESIZE); // radius this->addOutputSocket(COM_DT_COLOR); @@ -281,7 +281,7 @@ InverseSearchRadiusOperation::InverseSearchRadiusOperation() : NodeOperation() this->m_inputRadius = NULL; } -void InverseSearchRadiusOperation::initExecution() +void InverseSearchRadiusOperation::initExecution() { this->m_inputRadius = this->getInputSocketReader(0); } @@ -313,7 +313,7 @@ void *InverseSearchRadiusOperation::initializeTileData(rcti *rect) // float radius = 0.0f; // float maxx = x; // float maxy = y; - + // for (int x2 = 0 ; x2 < DIVIDER ; x2 ++) { // for (int y2 = 0 ; y2 < DIVIDER ; y2 ++) { // this->m_inputRadius->read(temp, rx+x2, ry+y2, COM_PS_NEAREST); @@ -346,7 +346,7 @@ void InverseSearchRadiusOperation::executePixelChunk(float output[4], int x, int buffer->readNoCheck(output, x, y); } -void InverseSearchRadiusOperation::deinitializeTileData(rcti *rect, void *data) +void InverseSearchRadiusOperation::deinitializeTileData(rcti *rect, void *data) { if (data) { MemoryBuffer *mb = (MemoryBuffer *)data; @@ -354,7 +354,7 @@ void InverseSearchRadiusOperation::deinitializeTileData(rcti *rect, void *data) } } -void InverseSearchRadiusOperation::deinitExecution() +void InverseSearchRadiusOperation::deinitExecution() { this->m_inputRadius = NULL; } diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h index 110bb6b4952..57ffde6d398 100644 --- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h +++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h @@ -46,23 +46,23 @@ public: * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + void *initializeTileData(rcti *rect); - + void deinitializeTileData(rcti *rect, void *data); - + /** * Deinitialize the execution */ void deinitExecution(); - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); - + void setMaxBlur(int maxRadius) { this->m_maxBlur = maxRadius; } void setThreshold(float threshold) { this->m_threshold = threshold; } @@ -79,29 +79,29 @@ private: SocketReader *m_inputRadius; public: static const int DIVIDER = 4; - + InverseSearchRadiusOperation(); /** * the inner loop of this program */ void executePixelChunk(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); void *initializeTileData(rcti *rect); void deinitializeTileData(rcti *rect, void *data); - + /** * Deinitialize the execution */ void deinitExecution(); - + bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); - + void setMaxBlur(int maxRadius) { this->m_maxBlur = maxRadius; } }; #endif diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.h b/source/blender/compositor/operations/COM_VectorBlurOperation.h index 05c2c3183c1..30ca2f644bb 100644 --- a/source/blender/compositor/operations/COM_VectorBlurOperation.h +++ b/source/blender/compositor/operations/COM_VectorBlurOperation.h @@ -34,27 +34,27 @@ private: SocketReader *m_inputImageProgram; SocketReader *m_inputSpeedProgram; SocketReader *m_inputZProgram; - + /** * @brief settings of the glare node. */ NodeBlurData *m_settings; - + float *m_cachedInstance; public: VectorBlurOperation(); - + /** * the inner loop of this program */ void executePixel(float output[4], int x, int y, void *data); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ @@ -65,9 +65,9 @@ public: void setVectorBlurSettings(NodeBlurData *settings) { this->m_settings = settings; } bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output); protected: - + void generateVectorBlur(float *data, MemoryBuffer *inputImage, MemoryBuffer *inputSpeed, MemoryBuffer *inputZ); - - + + }; #endif diff --git a/source/blender/compositor/operations/COM_VectorCurveOperation.h b/source/blender/compositor/operations/COM_VectorCurveOperation.h index 444f848cb0a..518e4713c99 100644 --- a/source/blender/compositor/operations/COM_VectorCurveOperation.h +++ b/source/blender/compositor/operations/COM_VectorCurveOperation.h @@ -33,17 +33,17 @@ private: SocketReader *m_inputProgram; public: VectorCurveOperation(); - + /** * the inner loop of this program */ void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - + /** * Initialize the execution */ void initExecution(); - + /** * Deinitialize the execution */ diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cpp b/source/blender/compositor/operations/COM_ViewerOperation.cpp index 0eff52f4d9a..51fd5d4dc76 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.cpp +++ b/source/blender/compositor/operations/COM_ViewerOperation.cpp @@ -50,7 +50,7 @@ ViewerOperation::ViewerOperation() : NodeOperation() this->m_viewSettings = NULL; this->m_displaySettings = NULL; this->m_useAlphaInput = false; - + this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_VALUE); @@ -69,7 +69,7 @@ void ViewerOperation::initExecution() this->m_alphaInput = getInputSocketReader(1); this->m_depthInput = getInputSocketReader(2); this->m_doDepthBuffer = (this->m_depthInput != NULL); - + if (isActiveViewerOutput()) { initImage(); } diff --git a/source/blender/compositor/operations/COM_ViewerOperation.h b/source/blender/compositor/operations/COM_ViewerOperation.h index e5eed3e8024..0e4bff2c4e8 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.h +++ b/source/blender/compositor/operations/COM_ViewerOperation.h @@ -45,7 +45,7 @@ private: const ColorManagedViewSettings *m_viewSettings; const ColorManagedDisplaySettings *m_displaySettings; - + SocketReader *m_imageInput; SocketReader *m_alphaInput; SocketReader *m_depthInput; diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp index 85602e6741c..5a34673b2bd 100644 --- a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp +++ b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp @@ -131,7 +131,7 @@ void WriteBufferOperation::executeOpenCLRegion(OpenCLDevice *device, rcti * /*re cl_mem clOutputBuffer = clCreateImage2D(device->getContext(), CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR, imageFormat, outputBufferWidth, outputBufferHeight, 0, outputFloatBuffer, &error); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } - + // STEP 2 list<cl_mem> *clMemToCleanUp = new list<cl_mem>(); clMemToCleanUp->push_back(clOutputBuffer); @@ -151,7 +151,7 @@ void WriteBufferOperation::executeOpenCLRegion(OpenCLDevice *device, rcti * /*re if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } error = clEnqueueReadImage(device->getQueue(), clOutputBuffer, CL_TRUE, origin, region, 0, 0, outputFloatBuffer, 0, NULL, NULL); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } - + this->getMemoryProxy()->getBuffer()->copyContentFrom(outputBuffer); // STEP 4 diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.h b/source/blender/compositor/operations/COM_WriteBufferOperation.h index afcdc70889b..73314c947f5 100644 --- a/source/blender/compositor/operations/COM_WriteBufferOperation.h +++ b/source/blender/compositor/operations/COM_WriteBufferOperation.h @@ -41,7 +41,7 @@ public: void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); const bool isWriteBufferOperation() const { return true; } bool isSingleValue() const { return m_single_value; } - + void executeRegion(rcti *rect, unsigned int tileNumber); void initExecution(); void deinitExecution(); diff --git a/source/blender/compositor/operations/COM_ZCombineOperation.h b/source/blender/compositor/operations/COM_ZCombineOperation.h index a89a2c7bd62..c9d26adfc46 100644 --- a/source/blender/compositor/operations/COM_ZCombineOperation.h +++ b/source/blender/compositor/operations/COM_ZCombineOperation.h @@ -40,10 +40,10 @@ public: * Default constructor */ ZCombineOperation(); - + void initExecution(); void deinitExecution(); - + /** * the inner loop of this program */ |