diff options
Diffstat (limited to 'source/blender/compositor/operations')
232 files changed, 2707 insertions, 789 deletions
diff --git a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cc b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cc index 668d07c7c3d..34638cbe7d6 100644 --- a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cc +++ b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cc @@ -18,6 +18,8 @@ #include "COM_AlphaOverKeyOperation.h" +namespace blender::compositor { + AlphaOverKeyOperation::AlphaOverKeyOperation() { /* pass */ @@ -52,3 +54,5 @@ void AlphaOverKeyOperation::executePixelSampled(float output[4], output[3] = (mul * inputColor1[3]) + value[0] * inputOverColor[3]; } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h index f2ec5ff12c2..8b8debefa7a 100644 --- a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h +++ b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h @@ -20,6 +20,8 @@ #include "COM_MixOperation.h" +namespace blender::compositor { + /** * this program converts an input color to an output value. * it assumes we are in sRGB color space. @@ -34,5 +36,7 @@ class AlphaOverKeyOperation : public MixBaseOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cc b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cc index b8465ab7ccf..c68c79d2263 100644 --- a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cc +++ b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cc @@ -18,6 +18,8 @@ #include "COM_AlphaOverMixedOperation.h" +namespace blender::compositor { + AlphaOverMixedOperation::AlphaOverMixedOperation() { this->m_x = 0.0f; @@ -53,3 +55,5 @@ void AlphaOverMixedOperation::executePixelSampled(float output[4], output[3] = (mul * inputColor1[3]) + value[0] * inputOverColor[3]; } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h index 73433ec3077..e2b3af84162 100644 --- a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h +++ b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h @@ -20,6 +20,8 @@ #include "COM_MixOperation.h" +namespace blender::compositor { + /** * this program converts an input color to an output value. * it assumes we are in sRGB color space. @@ -37,10 +39,12 @@ class AlphaOverMixedOperation : public MixBaseOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; void setX(float x) { this->m_x = x; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cc b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cc index 4510c027d46..edb248d16e8 100644 --- a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cc +++ b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cc @@ -18,6 +18,8 @@ #include "COM_AlphaOverPremultiplyOperation.h" +namespace blender::compositor { + AlphaOverPremultiplyOperation::AlphaOverPremultiplyOperation() { /* pass */ @@ -52,3 +54,5 @@ void AlphaOverPremultiplyOperation::executePixelSampled(float output[4], output[3] = (mul * inputColor1[3]) + value[0] * inputOverColor[3]; } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h index b149789878e..16246231a57 100644 --- a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h +++ b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h @@ -20,6 +20,8 @@ #include "COM_MixOperation.h" +namespace blender::compositor { + /** * this program converts an input color to an output value. * it assumes we are in sRGB color space. @@ -34,5 +36,7 @@ class AlphaOverPremultiplyOperation : public MixBaseOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_AntiAliasOperation.cc b/source/blender/compositor/operations/COM_AntiAliasOperation.cc index 740cd3ff609..23d6f4b80c7 100644 --- a/source/blender/compositor/operations/COM_AntiAliasOperation.cc +++ b/source/blender/compositor/operations/COM_AntiAliasOperation.cc @@ -24,6 +24,8 @@ #include "RE_texture.h" +namespace blender::compositor { + /* An implementation of the Scale3X edge-extrapolation algorithm. * * Code from GIMP plugin, based on code from Adam D. Moss <adam@gimp.org> @@ -117,7 +119,7 @@ AntiAliasOperation::AntiAliasOperation() this->addInputSocket(DataType::Value); this->addOutputSocket(DataType::Value); this->m_valueReader = nullptr; - this->setComplex(true); + this->flags.complex = true; } void AntiAliasOperation::initExecution() @@ -199,3 +201,5 @@ void *AntiAliasOperation::initializeTileData(rcti *rect) { return getInputOperation(0)->initializeTileData(rect); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_AntiAliasOperation.h b/source/blender/compositor/operations/COM_AntiAliasOperation.h index 571655813ae..fc9102b5b4c 100644 --- a/source/blender/compositor/operations/COM_AntiAliasOperation.h +++ b/source/blender/compositor/operations/COM_AntiAliasOperation.h @@ -21,6 +21,8 @@ #include "COM_NodeOperation.h" #include "DNA_node_types.h" +namespace blender::compositor { + /** * \brief AntiAlias operations * it only supports anti aliasing on BW buffers. @@ -39,20 +41,22 @@ class AntiAliasOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; - void *initializeTileData(rcti *rect); + void *initializeTileData(rcti *rect) override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_BilateralBlurOperation.cc b/source/blender/compositor/operations/COM_BilateralBlurOperation.cc index d04fade2e93..64448e2ae95 100644 --- a/source/blender/compositor/operations/COM_BilateralBlurOperation.cc +++ b/source/blender/compositor/operations/COM_BilateralBlurOperation.cc @@ -21,12 +21,14 @@ #include "RE_pipeline.h" +namespace blender::compositor { + BilateralBlurOperation::BilateralBlurOperation() { this->addInputSocket(DataType::Color); this->addInputSocket(DataType::Color); this->addOutputSocket(DataType::Color); - this->setComplex(true); + this->flags.complex = true; this->m_inputColorProgram = nullptr; this->m_inputDeterminatorProgram = nullptr; @@ -112,3 +114,5 @@ bool BilateralBlurOperation::determineDependingAreaOfInterest(rcti *input, return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_BilateralBlurOperation.h b/source/blender/compositor/operations/COM_BilateralBlurOperation.h index d059510f0bc..c56cef35050 100644 --- a/source/blender/compositor/operations/COM_BilateralBlurOperation.h +++ b/source/blender/compositor/operations/COM_BilateralBlurOperation.h @@ -21,6 +21,8 @@ #include "COM_NodeOperation.h" #include "COM_QualityStepHelper.h" +namespace blender::compositor { + class BilateralBlurOperation : public NodeOperation, public QualityStepHelper { private: SocketReader *m_inputColorProgram; @@ -34,24 +36,26 @@ class BilateralBlurOperation : public NodeOperation, public QualityStepHelper { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; void setData(NodeBilateralBlurData *data) { this->m_data = data; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.cc b/source/blender/compositor/operations/COM_BlurBaseOperation.cc index fe6ca1cfd4e..8b73624ca79 100644 --- a/source/blender/compositor/operations/COM_BlurBaseOperation.cc +++ b/source/blender/compositor/operations/COM_BlurBaseOperation.cc @@ -22,13 +22,15 @@ #include "RE_pipeline.h" +namespace blender::compositor { + BlurBaseOperation::BlurBaseOperation(DataType data_type) { /* data_type is almost always DataType::Color except for alpha-blur */ this->addInputSocket(data_type); this->addInputSocket(DataType::Value); this->addOutputSocket(data_type); - this->setComplex(true); + this->flags.complex = true; this->m_inputProgram = nullptr; memset(&m_data, 0, sizeof(NodeBlurData)); this->m_size = 1.0f; @@ -167,7 +169,7 @@ void BlurBaseOperation::updateSize() { if (!this->m_sizeavailable) { float result[4]; - this->getInputSocketReader(1)->readSampled(result, 0, 0, COM_PS_NEAREST); + this->getInputSocketReader(1)->readSampled(result, 0, 0, PixelSampler::Nearest); this->m_size = result[0]; this->m_sizeavailable = true; } @@ -182,3 +184,5 @@ void BlurBaseOperation::determineResolution(unsigned int resolution[2], resolution[1] += 2 * this->m_size * m_data.sizey; } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.h b/source/blender/compositor/operations/COM_BlurBaseOperation.h index 56dacc96710..7937ebd69dc 100644 --- a/source/blender/compositor/operations/COM_BlurBaseOperation.h +++ b/source/blender/compositor/operations/COM_BlurBaseOperation.h @@ -25,6 +25,8 @@ #include "BLI_simd.h" +namespace blender::compositor { + class BlurBaseOperation : public NodeOperation, public QualityStepHelper { private: protected: @@ -53,12 +55,12 @@ class BlurBaseOperation : public NodeOperation, public QualityStepHelper { /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; void setData(const NodeBlurData *data); @@ -73,5 +75,8 @@ class BlurBaseOperation : public NodeOperation, public QualityStepHelper { this->m_extend_bounds = extend_bounds; } - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); + void determineResolution(unsigned int resolution[2], + unsigned int preferredResolution[2]) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.cc b/source/blender/compositor/operations/COM_BokehBlurOperation.cc index 7bb8cd49bfc..3f98732b403 100644 --- a/source/blender/compositor/operations/COM_BokehBlurOperation.cc +++ b/source/blender/compositor/operations/COM_BokehBlurOperation.cc @@ -22,15 +22,18 @@ #include "RE_pipeline.h" +namespace blender::compositor { + BokehBlurOperation::BokehBlurOperation() { this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE); + this->addInputSocket(DataType::Color, ResizeMode::None); this->addInputSocket(DataType::Value); this->addInputSocket(DataType::Value); this->addOutputSocket(DataType::Color); - this->setComplex(true); - this->setOpenCL(true); + + flags.complex = true; + flags.open_cl = true; this->m_size = 1.0f; this->m_sizeavailable = false; @@ -76,7 +79,7 @@ void BokehBlurOperation::executePixel(float output[4], int x, int y, void *data) float tempBoundingBox[4]; float bokeh[4]; - this->m_inputBoundingBoxReader->readSampled(tempBoundingBox, x, y, COM_PS_NEAREST); + this->m_inputBoundingBoxReader->readSampled(tempBoundingBox, x, y, PixelSampler::Nearest); if (tempBoundingBox[0] > 0.0f) { float multiplier_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f}; MemoryBuffer *inputBuffer = (MemoryBuffer *)data; @@ -90,7 +93,7 @@ void BokehBlurOperation::executePixel(float output[4], int x, int y, void *data) zero_v4(color_accum); if (pixelSize < 2) { - this->m_inputProgram->readSampled(color_accum, x, y, COM_PS_NEAREST); + this->m_inputProgram->readSampled(color_accum, x, y, PixelSampler::Nearest); multiplier_accum[0] = 1.0f; multiplier_accum[1] = 1.0f; multiplier_accum[2] = 1.0f; @@ -106,16 +109,16 @@ void BokehBlurOperation::executePixel(float output[4], int x, int y, void *data) maxx = MIN2(maxx, input_rect.xmax); int step = getStep(); - int offsetadd = getOffsetAdd() * COM_NUM_CHANNELS_COLOR; + int offsetadd = getOffsetAdd() * COM_DATA_TYPE_COLOR_CHANNELS; float m = this->m_bokehDimension / pixelSize; for (int ny = miny; ny < maxy; ny += step) { - int bufferindex = ((minx - bufferstartx) * COM_NUM_CHANNELS_COLOR) + - ((ny - bufferstarty) * COM_NUM_CHANNELS_COLOR * bufferwidth); + int bufferindex = ((minx - bufferstartx) * COM_DATA_TYPE_COLOR_CHANNELS) + + ((ny - bufferstarty) * COM_DATA_TYPE_COLOR_CHANNELS * bufferwidth); for (int nx = minx; nx < maxx; nx += step) { float u = this->m_bokehMidX - (nx - x) * m; float v = this->m_bokehMidY - (ny - y) * m; - this->m_inputBokehProgram->readSampled(bokeh, u, v, COM_PS_NEAREST); + this->m_inputBokehProgram->readSampled(bokeh, u, v, PixelSampler::Nearest); madd_v4_v4v4(color_accum, bokeh, &buffer[bufferindex]); add_v4_v4(multiplier_accum, bokeh); bufferindex += offsetadd; @@ -127,7 +130,7 @@ void BokehBlurOperation::executePixel(float output[4], int x, int y, void *data) output[3] = color_accum[3] * (1.0f / multiplier_accum[3]); } else { - this->m_inputProgram->readSampled(output, x, y, COM_PS_NEAREST); + this->m_inputProgram->readSampled(output, x, y, PixelSampler::Nearest); } } @@ -224,7 +227,7 @@ void BokehBlurOperation::updateSize() { if (!this->m_sizeavailable) { float result[4]; - this->getInputSocketReader(3)->readSampled(result, 0, 0, COM_PS_NEAREST); + this->getInputSocketReader(3)->readSampled(result, 0, 0, PixelSampler::Nearest); this->m_size = result[0]; CLAMP(this->m_size, 0.0f, 10.0f); this->m_sizeavailable = true; @@ -241,3 +244,5 @@ void BokehBlurOperation::determineResolution(unsigned int resolution[2], resolution[1] += 2 * this->m_size * max_dim / 100.0f; } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.h b/source/blender/compositor/operations/COM_BokehBlurOperation.h index a2e320dfdad..3ce06adb5d6 100644 --- a/source/blender/compositor/operations/COM_BokehBlurOperation.h +++ b/source/blender/compositor/operations/COM_BokehBlurOperation.h @@ -21,6 +21,8 @@ #include "COM_NodeOperation.h" #include "COM_QualityStepHelper.h" +namespace blender::compositor { + class BokehBlurOperation : public NodeOperation, public QualityStepHelper { private: SocketReader *m_inputProgram; @@ -37,25 +39,25 @@ class BokehBlurOperation : public NodeOperation, public QualityStepHelper { public: BokehBlurOperation(); - void *initializeTileData(rcti *rect); + void *initializeTileData(rcti *rect) override; /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; void setSize(float size) { @@ -68,12 +70,15 @@ class BokehBlurOperation : public NodeOperation, public QualityStepHelper { cl_mem clOutputBuffer, MemoryBuffer **inputMemoryBuffers, std::list<cl_mem> *clMemToCleanUp, - std::list<cl_kernel> *clKernelsToCleanUp); + std::list<cl_kernel> *clKernelsToCleanUp) override; void setExtendBounds(bool extend_bounds) { this->m_extend_bounds = extend_bounds; } - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); + void determineResolution(unsigned int resolution[2], + unsigned int preferredResolution[2]) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_BokehImageOperation.cc b/source/blender/compositor/operations/COM_BokehImageOperation.cc index 01f8c81b3b7..63f283b6acc 100644 --- a/source/blender/compositor/operations/COM_BokehImageOperation.cc +++ b/source/blender/compositor/operations/COM_BokehImageOperation.cc @@ -19,6 +19,8 @@ #include "COM_BokehImageOperation.h" #include "BLI_math.h" +namespace blender::compositor { + BokehImageOperation::BokehImageOperation() { this->addOutputSocket(DataType::Color); @@ -124,3 +126,5 @@ void BokehImageOperation::determineResolution(unsigned int resolution[2], resolution[0] = COM_BLUR_BOKEH_PIXELS; resolution[1] = COM_BLUR_BOKEH_PIXELS; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_BokehImageOperation.h b/source/blender/compositor/operations/COM_BokehImageOperation.h index 2d775bdf738..2e0bc8a34dc 100644 --- a/source/blender/compositor/operations/COM_BokehImageOperation.h +++ b/source/blender/compositor/operations/COM_BokehImageOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + /** * \brief The BokehImageOperation class is an operation that creates an image useful to mimic the *internals of a camera. @@ -110,23 +112,24 @@ class BokehImageOperation : public NodeOperation { /** * \brief The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; /** * \brief Initialize the execution */ - void initExecution(); + void initExecution() override; /** * \brief Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; /** * \brief determine the resolution of this operation. currently fixed at [COM_BLUR_BOKEH_PIXELS, * COM_BLUR_BOKEH_PIXELS] \param resolution: \param preferredResolution: */ - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); + void determineResolution(unsigned int resolution[2], + unsigned int preferredResolution[2]) override; /** * \brief set the node data @@ -149,3 +152,5 @@ class BokehImageOperation : public NodeOperation { this->m_deleteData = true; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_BoxMaskOperation.cc b/source/blender/compositor/operations/COM_BoxMaskOperation.cc index 51b1ea98456..9938d4a85ed 100644 --- a/source/blender/compositor/operations/COM_BoxMaskOperation.cc +++ b/source/blender/compositor/operations/COM_BoxMaskOperation.cc @@ -20,6 +20,8 @@ #include "BLI_math.h" #include "DNA_node_types.h" +namespace blender::compositor { + BoxMaskOperation::BoxMaskOperation() { this->addInputSocket(DataType::Value); @@ -108,3 +110,5 @@ void BoxMaskOperation::deinitExecution() this->m_inputMask = nullptr; this->m_inputValue = nullptr; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_BoxMaskOperation.h b/source/blender/compositor/operations/COM_BoxMaskOperation.h index c98972b82b7..fdec7bdd8ca 100644 --- a/source/blender/compositor/operations/COM_BoxMaskOperation.h +++ b/source/blender/compositor/operations/COM_BoxMaskOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class BoxMaskOperation : public NodeOperation { private: /** @@ -41,17 +43,17 @@ class BoxMaskOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; void setData(NodeBoxMask *data) { @@ -63,3 +65,5 @@ class BoxMaskOperation : public NodeOperation { this->m_maskType = maskType; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_BrightnessOperation.cc b/source/blender/compositor/operations/COM_BrightnessOperation.cc index 3a6ddd178e8..92cab47318a 100644 --- a/source/blender/compositor/operations/COM_BrightnessOperation.cc +++ b/source/blender/compositor/operations/COM_BrightnessOperation.cc @@ -18,6 +18,8 @@ #include "COM_BrightnessOperation.h" +namespace blender::compositor { + BrightnessOperation::BrightnessOperation() { this->addInputSocket(DataType::Color); @@ -89,3 +91,5 @@ void BrightnessOperation::deinitExecution() this->m_inputBrightnessProgram = nullptr; this->m_inputContrastProgram = nullptr; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_BrightnessOperation.h b/source/blender/compositor/operations/COM_BrightnessOperation.h index 6fbcfe3a17a..7c33e0b35ec 100644 --- a/source/blender/compositor/operations/COM_BrightnessOperation.h +++ b/source/blender/compositor/operations/COM_BrightnessOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class BrightnessOperation : public NodeOperation { private: /** @@ -37,17 +39,19 @@ class BrightnessOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; void setUsePremultiply(bool use_premultiply); }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_CalculateMeanOperation.cc b/source/blender/compositor/operations/COM_CalculateMeanOperation.cc index fdeecd0cb29..a7ea49aed8d 100644 --- a/source/blender/compositor/operations/COM_CalculateMeanOperation.cc +++ b/source/blender/compositor/operations/COM_CalculateMeanOperation.cc @@ -22,14 +22,16 @@ #include "IMB_colormanagement.h" +namespace blender::compositor { + CalculateMeanOperation::CalculateMeanOperation() { - this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE); + this->addInputSocket(DataType::Color, ResizeMode::None); this->addOutputSocket(DataType::Value); this->m_imageReader = nullptr; this->m_iscalculated = false; this->m_setting = 1; - this->setComplex(true); + this->flags.complex = true; } void CalculateMeanOperation::initExecution() { @@ -125,3 +127,5 @@ void CalculateMeanOperation::calculateMean(MemoryBuffer *tile) } this->m_result = sum / pixels; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_CalculateMeanOperation.h b/source/blender/compositor/operations/COM_CalculateMeanOperation.h index e4937931df0..8b3bf281c93 100644 --- a/source/blender/compositor/operations/COM_CalculateMeanOperation.h +++ b/source/blender/compositor/operations/COM_CalculateMeanOperation.h @@ -21,6 +21,8 @@ #include "COM_NodeOperation.h" #include "DNA_node_types.h" +namespace blender::compositor { + /** * \brief base class of CalculateMean, implementing the simple CalculateMean * \ingroup operation @@ -42,23 +44,23 @@ class CalculateMeanOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; - void *initializeTileData(rcti *rect); + void *initializeTileData(rcti *rect) override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; void setSetting(int setting) { this->m_setting = setting; @@ -67,3 +69,5 @@ class CalculateMeanOperation : public NodeOperation { protected: void calculateMean(MemoryBuffer *tile); }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cc b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cc index 9a1e48177ed..5ddb4b1c859 100644 --- a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cc +++ b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cc @@ -22,6 +22,8 @@ #include "IMB_colormanagement.h" +namespace blender::compositor { + CalculateStandardDeviationOperation::CalculateStandardDeviationOperation() { /* pass */ @@ -98,3 +100,5 @@ void *CalculateStandardDeviationOperation::initializeTileData(rcti *rect) unlockMutex(); return nullptr; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.h b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.h index a267663cfc8..b8487e0aa4c 100644 --- a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.h +++ b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.h @@ -21,6 +21,9 @@ #include "COM_CalculateMeanOperation.h" #include "COM_NodeOperation.h" #include "DNA_node_types.h" + +namespace blender::compositor { + /** * \brief base class of CalculateStandardDeviation, * implementing the simple CalculateStandardDeviation. @@ -36,7 +39,9 @@ class CalculateStandardDeviationOperation : public CalculateMeanOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; - void *initializeTileData(rcti *rect); + void *initializeTileData(rcti *rect) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ChangeHSVOperation.cc b/source/blender/compositor/operations/COM_ChangeHSVOperation.cc index e53a416f0dd..eee007ce9e6 100644 --- a/source/blender/compositor/operations/COM_ChangeHSVOperation.cc +++ b/source/blender/compositor/operations/COM_ChangeHSVOperation.cc @@ -18,6 +18,8 @@ #include "COM_ChangeHSVOperation.h" +namespace blender::compositor { + ChangeHSVOperation::ChangeHSVOperation() { this->addInputSocket(DataType::Color); @@ -68,3 +70,5 @@ void ChangeHSVOperation::executePixelSampled(float output[4], output[2] = inputColor1[2] * value[0]; output[3] = inputColor1[3]; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ChangeHSVOperation.h b/source/blender/compositor/operations/COM_ChangeHSVOperation.h index edc532a3f43..d38b4be3efe 100644 --- a/source/blender/compositor/operations/COM_ChangeHSVOperation.h +++ b/source/blender/compositor/operations/COM_ChangeHSVOperation.h @@ -20,6 +20,8 @@ #include "COM_MixOperation.h" +namespace blender::compositor { + /** * this program converts an input color to an output value. * it assumes we are in sRGB color space. @@ -37,11 +39,13 @@ class ChangeHSVOperation : public NodeOperation { */ ChangeHSVOperation(); - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ChannelMatteOperation.cc b/source/blender/compositor/operations/COM_ChannelMatteOperation.cc index 98105a9dfde..89290978608 100644 --- a/source/blender/compositor/operations/COM_ChannelMatteOperation.cc +++ b/source/blender/compositor/operations/COM_ChannelMatteOperation.cc @@ -19,6 +19,8 @@ #include "COM_ChannelMatteOperation.h" #include "BLI_math.h" +namespace blender::compositor { + ChannelMatteOperation::ChannelMatteOperation() { addInputSocket(DataType::Color); @@ -118,3 +120,5 @@ void ChannelMatteOperation::executePixelSampled(float output[4], /* Don't make something that was more transparent less transparent. */ output[0] = MIN2(alpha, inColor[3]); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ChannelMatteOperation.h b/source/blender/compositor/operations/COM_ChannelMatteOperation.h index 9a0b888b5a2..6e9dcccd36e 100644 --- a/source/blender/compositor/operations/COM_ChannelMatteOperation.h +++ b/source/blender/compositor/operations/COM_ChannelMatteOperation.h @@ -20,6 +20,8 @@ #include "COM_MixOperation.h" +namespace blender::compositor { + /** * this program converts an input color to an output value. * it assumes we are in sRGB color space. @@ -56,10 +58,10 @@ class ChannelMatteOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; void setSettings(NodeChroma *nodeChroma, const int custom2) { @@ -70,3 +72,5 @@ class ChannelMatteOperation : public NodeOperation { this->m_matte_channel = custom2; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ChromaMatteOperation.cc b/source/blender/compositor/operations/COM_ChromaMatteOperation.cc index 09bf9c76e55..69aa4aac163 100644 --- a/source/blender/compositor/operations/COM_ChromaMatteOperation.cc +++ b/source/blender/compositor/operations/COM_ChromaMatteOperation.cc @@ -19,6 +19,8 @@ #include "COM_ChromaMatteOperation.h" #include "BLI_math.h" +namespace blender::compositor { + ChromaMatteOperation::ChromaMatteOperation() { addInputSocket(DataType::Color); @@ -107,3 +109,5 @@ void ChromaMatteOperation::executePixelSampled(float output[4], output[0] = inImage[3]; /* make pixel just as transparent as it was before */ } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ChromaMatteOperation.h b/source/blender/compositor/operations/COM_ChromaMatteOperation.h index c8d261284ed..48c3a785011 100644 --- a/source/blender/compositor/operations/COM_ChromaMatteOperation.h +++ b/source/blender/compositor/operations/COM_ChromaMatteOperation.h @@ -20,6 +20,8 @@ #include "COM_MixOperation.h" +namespace blender::compositor { + /** * this program converts an input color to an output value. * it assumes we are in sRGB color space. @@ -39,13 +41,15 @@ class ChromaMatteOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; void setSettings(NodeChroma *nodeChroma) { this->m_settings = nodeChroma; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cc b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cc index b21e453699b..d1d3752e402 100644 --- a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cc +++ b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cc @@ -19,6 +19,8 @@ #include "COM_ColorBalanceASCCDLOperation.h" #include "BLI_math.h" +namespace blender::compositor { + inline float colorbalance_cdl(float in, float offset, float power, float slope) { float x = in * slope + offset; @@ -79,3 +81,5 @@ void ColorBalanceASCCDLOperation::deinitExecution() this->m_inputValueOperation = nullptr; this->m_inputColorOperation = nullptr; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h index 1ec920cb2da..5851600190f 100644 --- a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h +++ b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + /** * this program converts an input color to an output value. * it assumes we are in sRGB color space. @@ -45,17 +47,17 @@ class ColorBalanceASCCDLOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; void setOffset(float offset[3]) { @@ -70,3 +72,5 @@ class ColorBalanceASCCDLOperation : public NodeOperation { copy_v3_v3(this->m_slope, slope); } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cc b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cc index b6ff636bce9..cac16a3f7b0 100644 --- a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cc +++ b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cc @@ -19,6 +19,8 @@ #include "COM_ColorBalanceLGGOperation.h" #include "BLI_math.h" +namespace blender::compositor { + inline float colorbalance_lgg(float in, float lift_lgg, float gamma_inv, float gain) { /* 1:1 match with the sequencer with linear/srgb conversions, the conversion isn't pretty @@ -84,3 +86,5 @@ void ColorBalanceLGGOperation::deinitExecution() this->m_inputValueOperation = nullptr; this->m_inputColorOperation = nullptr; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h index e6acd16e4f0..23f70247b66 100644 --- a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h +++ b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + /** * this program converts an input color to an output value. * it assumes we are in sRGB color space. @@ -45,17 +47,17 @@ class ColorBalanceLGGOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; void setGain(const float gain[3]) { @@ -70,3 +72,5 @@ class ColorBalanceLGGOperation : public NodeOperation { copy_v3_v3(this->m_gamma_inv, gamma_inv); } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cc b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cc index b2578451180..168e9b57eb2 100644 --- a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cc +++ b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cc @@ -21,6 +21,8 @@ #include "IMB_colormanagement.h" +namespace blender::compositor { + ColorCorrectionOperation::ColorCorrectionOperation() { this->addInputSocket(DataType::Color); @@ -160,3 +162,5 @@ void ColorCorrectionOperation::deinitExecution() this->m_inputImage = nullptr; this->m_inputMask = nullptr; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ColorCorrectionOperation.h b/source/blender/compositor/operations/COM_ColorCorrectionOperation.h index 9a2e60c0d77..c5826ed0152 100644 --- a/source/blender/compositor/operations/COM_ColorCorrectionOperation.h +++ b/source/blender/compositor/operations/COM_ColorCorrectionOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class ColorCorrectionOperation : public NodeOperation { private: /** @@ -39,17 +41,17 @@ class ColorCorrectionOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; void setData(NodeColorCorrection *data) { @@ -68,3 +70,5 @@ class ColorCorrectionOperation : public NodeOperation { this->m_blueChannelEnabled = enabled; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ColorCurveOperation.cc b/source/blender/compositor/operations/COM_ColorCurveOperation.cc index 35218cef7cc..cb0565a81a2 100644 --- a/source/blender/compositor/operations/COM_ColorCurveOperation.cc +++ b/source/blender/compositor/operations/COM_ColorCurveOperation.cc @@ -22,6 +22,8 @@ #include "MEM_guardedalloc.h" +namespace blender::compositor { + ColorCurveOperation::ColorCurveOperation() { this->addInputSocket(DataType::Value); @@ -151,3 +153,5 @@ void ConstantLevelColorCurveOperation::deinitExecution() this->m_inputFacProgram = nullptr; this->m_inputImageProgram = nullptr; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ColorCurveOperation.h b/source/blender/compositor/operations/COM_ColorCurveOperation.h index 2eb20148db9..6fc7759b8d2 100644 --- a/source/blender/compositor/operations/COM_ColorCurveOperation.h +++ b/source/blender/compositor/operations/COM_ColorCurveOperation.h @@ -22,6 +22,8 @@ #include "COM_NodeOperation.h" #include "DNA_color_types.h" +namespace blender::compositor { + class ColorCurveOperation : public CurveBaseOperation { private: /** @@ -38,17 +40,17 @@ class ColorCurveOperation : public CurveBaseOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; }; class ConstantLevelColorCurveOperation : public CurveBaseOperation { @@ -67,17 +69,17 @@ class ConstantLevelColorCurveOperation : public CurveBaseOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; void setBlackLevel(float black[3]) { @@ -88,3 +90,5 @@ class ConstantLevelColorCurveOperation : public CurveBaseOperation { copy_v3_v3(this->m_white, white); } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ColorExposureOperation.cc b/source/blender/compositor/operations/COM_ColorExposureOperation.cc index 0e24620846e..1512ff87658 100644 --- a/source/blender/compositor/operations/COM_ColorExposureOperation.cc +++ b/source/blender/compositor/operations/COM_ColorExposureOperation.cc @@ -18,6 +18,8 @@ #include "COM_ColorExposureOperation.h" +namespace blender::compositor { + ExposureOperation::ExposureOperation() { this->addInputSocket(DataType::Color); @@ -55,3 +57,5 @@ void ExposureOperation::deinitExecution() this->m_inputProgram = nullptr; this->m_inputExposureProgram = nullptr; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ColorExposureOperation.h b/source/blender/compositor/operations/COM_ColorExposureOperation.h index 97590b85d77..0cfaa059e41 100644 --- a/source/blender/compositor/operations/COM_ColorExposureOperation.h +++ b/source/blender/compositor/operations/COM_ColorExposureOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class ExposureOperation : public NodeOperation { private: /** @@ -34,15 +36,17 @@ class ExposureOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ColorMatteOperation.cc b/source/blender/compositor/operations/COM_ColorMatteOperation.cc index cc7a81f68d1..89f56ac4aae 100644 --- a/source/blender/compositor/operations/COM_ColorMatteOperation.cc +++ b/source/blender/compositor/operations/COM_ColorMatteOperation.cc @@ -19,6 +19,8 @@ #include "COM_ColorMatteOperation.h" #include "BLI_math.h" +namespace blender::compositor { + ColorMatteOperation::ColorMatteOperation() { addInputSocket(DataType::Color); @@ -79,3 +81,5 @@ void ColorMatteOperation::executePixelSampled(float output[4], output[0] = inColor[3]; /* make pixel just as transparent as it was before */ } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ColorMatteOperation.h b/source/blender/compositor/operations/COM_ColorMatteOperation.h index 91ba27ce2b6..439a3b0741d 100644 --- a/source/blender/compositor/operations/COM_ColorMatteOperation.h +++ b/source/blender/compositor/operations/COM_ColorMatteOperation.h @@ -20,6 +20,8 @@ #include "COM_MixOperation.h" +namespace blender::compositor { + /** * this program converts an input color to an output value. * it assumes we are in sRGB color space. @@ -39,13 +41,15 @@ class ColorMatteOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; void setSettings(NodeChroma *nodeChroma) { this->m_settings = nodeChroma; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ColorRampOperation.cc b/source/blender/compositor/operations/COM_ColorRampOperation.cc index 4fde951fd3c..0ee65a6529e 100644 --- a/source/blender/compositor/operations/COM_ColorRampOperation.cc +++ b/source/blender/compositor/operations/COM_ColorRampOperation.cc @@ -20,6 +20,8 @@ #include "BKE_colorband.h" +namespace blender::compositor { + ColorRampOperation::ColorRampOperation() { this->addInputSocket(DataType::Value); @@ -48,3 +50,5 @@ void ColorRampOperation::deinitExecution() { this->m_inputProgram = nullptr; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ColorRampOperation.h b/source/blender/compositor/operations/COM_ColorRampOperation.h index 49bdb266ce9..d32af9bea24 100644 --- a/source/blender/compositor/operations/COM_ColorRampOperation.h +++ b/source/blender/compositor/operations/COM_ColorRampOperation.h @@ -21,6 +21,8 @@ #include "COM_NodeOperation.h" #include "DNA_texture_types.h" +namespace blender::compositor { + class ColorRampOperation : public NodeOperation { private: /** @@ -35,20 +37,22 @@ class ColorRampOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; void setColorBand(ColorBand *colorBand) { this->m_colorBand = colorBand; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ColorSpillOperation.cc b/source/blender/compositor/operations/COM_ColorSpillOperation.cc index 8e8eaabfc6b..7dc7e2775fc 100644 --- a/source/blender/compositor/operations/COM_ColorSpillOperation.cc +++ b/source/blender/compositor/operations/COM_ColorSpillOperation.cc @@ -20,6 +20,8 @@ #include "BLI_math.h" #define AVG(a, b) ((a + b) / 2) +namespace blender::compositor { + ColorSpillOperation::ColorSpillOperation() { addInputSocket(DataType::Color); @@ -115,3 +117,5 @@ void ColorSpillOperation::executePixelSampled(float output[4], copy_v4_v4(output, input); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ColorSpillOperation.h b/source/blender/compositor/operations/COM_ColorSpillOperation.h index e51101adf84..9b82e720527 100644 --- a/source/blender/compositor/operations/COM_ColorSpillOperation.h +++ b/source/blender/compositor/operations/COM_ColorSpillOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + /** * this program converts an input color to an output value. * it assumes we are in sRGB color space. @@ -44,10 +46,10 @@ class ColorSpillOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; void setSettings(NodeColorspill *nodeColorSpill) { @@ -64,3 +66,5 @@ class ColorSpillOperation : public NodeOperation { float calculateMapValue(float fac, float *input); }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cc b/source/blender/compositor/operations/COM_CompositorOperation.cc index 0454bae8b38..94d41b28f5d 100644 --- a/source/blender/compositor/operations/COM_CompositorOperation.cc +++ b/source/blender/compositor/operations/COM_CompositorOperation.cc @@ -31,6 +31,8 @@ #include "PIL_time.h" +namespace blender::compositor { + CompositorOperation::CompositorOperation() { this->addInputSocket(DataType::Color); @@ -50,6 +52,8 @@ CompositorOperation::CompositorOperation() this->m_scene = nullptr; this->m_sceneName[0] = '\0'; this->m_viewName = nullptr; + + flags.use_render_border = true; } void CompositorOperation::initExecution() @@ -147,7 +151,7 @@ void CompositorOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/) int y2 = rect->ymax; int offset = (y1 * this->getWidth() + x1); int add = (this->getWidth() - (x2 - x1)); - int offset4 = offset * COM_NUM_CHANNELS_COLOR; + int offset4 = offset * COM_DATA_TYPE_COLOR_CHANNELS; int x; int y; bool breaked = false; @@ -196,23 +200,23 @@ void CompositorOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/) for (x = x1; x < x2 && (!breaked); x++) { int input_x = x + dx, input_y = y + dy; - this->m_imageInput->readSampled(color, input_x, input_y, COM_PS_NEAREST); + this->m_imageInput->readSampled(color, input_x, input_y, PixelSampler::Nearest); if (this->m_useAlphaInput) { - this->m_alphaInput->readSampled(&(color[3]), input_x, input_y, COM_PS_NEAREST); + this->m_alphaInput->readSampled(&(color[3]), input_x, input_y, PixelSampler::Nearest); } copy_v4_v4(buffer + offset4, color); - this->m_depthInput->readSampled(color, input_x, input_y, COM_PS_NEAREST); + this->m_depthInput->readSampled(color, input_x, input_y, PixelSampler::Nearest); zbuffer[offset] = color[0]; - offset4 += COM_NUM_CHANNELS_COLOR; + offset4 += COM_DATA_TYPE_COLOR_CHANNELS; offset++; if (isBraked()) { breaked = true; } } offset += add; - offset4 += add * COM_NUM_CHANNELS_COLOR; + offset4 += add * COM_DATA_TYPE_COLOR_CHANNELS; } } @@ -242,3 +246,5 @@ void CompositorOperation::determineResolution(unsigned int resolution[2], resolution[0] = width; resolution[1] = height; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_CompositorOperation.h b/source/blender/compositor/operations/COM_CompositorOperation.h index 63b87563852..49ed65f01fc 100644 --- a/source/blender/compositor/operations/COM_CompositorOperation.h +++ b/source/blender/compositor/operations/COM_CompositorOperation.h @@ -24,6 +24,8 @@ struct Scene; +namespace blender::compositor { + /** * \brief Compositor output operation */ @@ -86,7 +88,7 @@ class CompositorOperation : public NodeOperation { { return this->m_active; } - void executeRegion(rcti *rect, unsigned int tileNumber); + void executeRegion(rcti *rect, unsigned int tileNumber) override; void setScene(const struct Scene *scene) { m_scene = scene; @@ -103,17 +105,18 @@ class CompositorOperation : public NodeOperation { { this->m_rd = rd; } - bool isOutputOperation(bool /*rendering*/) const + bool isOutputOperation(bool /*rendering*/) const override { return this->isActiveCompositorOutput(); } - void initExecution(); - void deinitExecution(); - CompositorPriority getRenderPriority() const + void initExecution() override; + void deinitExecution() override; + CompositorPriority getRenderPriority() const override { return CompositorPriority::Medium; } - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); + void determineResolution(unsigned int resolution[2], + unsigned int preferredResolution[2]) override; void setUseAlphaInput(bool value) { this->m_useAlphaInput = value; @@ -123,3 +126,5 @@ class CompositorOperation : public NodeOperation { this->m_active = active; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cc b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cc index 431f0e9c880..c00fe5d5f61 100644 --- a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cc +++ b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cc @@ -20,6 +20,8 @@ #include "IMB_imbuf.h" +namespace blender::compositor { + ConvertColorProfileOperation::ConvertColorProfileOperation() { this->addInputSocket(DataType::Color); @@ -48,3 +50,5 @@ void ConvertColorProfileOperation::deinitExecution() { this->m_inputOperation = nullptr; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h index 7b96895d845..6162408501b 100644 --- a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h +++ b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + /** * this program converts an input color to an output value. * it assumes we are in sRGB color space. @@ -55,17 +57,17 @@ class ConvertColorProfileOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; void setFromColorProfile(int colorProfile) { @@ -80,3 +82,5 @@ class ConvertColorProfileOperation : public NodeOperation { this->m_predivided = predivided; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cc b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cc index 17b351cb14c..57027c11949 100644 --- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cc +++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cc @@ -21,6 +21,8 @@ #include "BLI_math.h" #include "DNA_camera_types.h" +namespace blender::compositor { + ConvertDepthToRadiusOperation::ConvertDepthToRadiusOperation() { this->addInputSocket(DataType::Value); @@ -113,3 +115,5 @@ void ConvertDepthToRadiusOperation::deinitExecution() { this->m_inputOperation = nullptr; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h index 564a0facec7..1f4e856b128 100644 --- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h +++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h @@ -21,6 +21,9 @@ #include "COM_FastGaussianBlurOperation.h" #include "COM_NodeOperation.h" #include "DNA_object_types.h" + +namespace blender::compositor { + /** * this program converts an input color to an output value. * it assumes we are in sRGB color space. @@ -51,17 +54,17 @@ class ConvertDepthToRadiusOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; void setfStop(float fStop) { @@ -81,3 +84,5 @@ class ConvertDepthToRadiusOperation : public NodeOperation { this->m_blurPostOperation = operation; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ConvertOperation.cc b/source/blender/compositor/operations/COM_ConvertOperation.cc index 648b3f0b30a..2ea15185c0f 100644 --- a/source/blender/compositor/operations/COM_ConvertOperation.cc +++ b/source/blender/compositor/operations/COM_ConvertOperation.cc @@ -20,6 +20,8 @@ #include "IMB_colormanagement.h" +namespace blender::compositor { + ConvertBaseOperation::ConvertBaseOperation() { this->m_inputOperation = nullptr; @@ -478,3 +480,5 @@ void CombineChannelsOperation::executePixelSampled(float output[4], output[3] = input[0]; } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ConvertOperation.h b/source/blender/compositor/operations/COM_ConvertOperation.h index ca026528a38..7a726e35c7c 100644 --- a/source/blender/compositor/operations/COM_ConvertOperation.h +++ b/source/blender/compositor/operations/COM_ConvertOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class ConvertBaseOperation : public NodeOperation { protected: SocketReader *m_inputOperation; @@ -27,57 +29,57 @@ class ConvertBaseOperation : public NodeOperation { public: ConvertBaseOperation(); - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; }; class ConvertValueToColorOperation : public ConvertBaseOperation { public: ConvertValueToColorOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class ConvertColorToValueOperation : public ConvertBaseOperation { public: ConvertColorToValueOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class ConvertColorToBWOperation : public ConvertBaseOperation { public: ConvertColorToBWOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class ConvertColorToVectorOperation : public ConvertBaseOperation { public: ConvertColorToVectorOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class ConvertValueToVectorOperation : public ConvertBaseOperation { public: ConvertValueToVectorOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class ConvertVectorToColorOperation : public ConvertBaseOperation { public: ConvertVectorToColorOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class ConvertVectorToValueOperation : public ConvertBaseOperation { public: ConvertVectorToValueOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class ConvertRGBToYCCOperation : public ConvertBaseOperation { @@ -88,7 +90,7 @@ class ConvertRGBToYCCOperation : public ConvertBaseOperation { public: ConvertRGBToYCCOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; /** Set the YCC mode */ void setMode(int mode); @@ -102,7 +104,7 @@ class ConvertYCCToRGBOperation : public ConvertBaseOperation { public: ConvertYCCToRGBOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; /** Set the YCC mode */ void setMode(int mode); @@ -112,42 +114,42 @@ class ConvertRGBToYUVOperation : public ConvertBaseOperation { public: ConvertRGBToYUVOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class ConvertYUVToRGBOperation : public ConvertBaseOperation { public: ConvertYUVToRGBOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class ConvertRGBToHSVOperation : public ConvertBaseOperation { public: ConvertRGBToHSVOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class ConvertHSVToRGBOperation : public ConvertBaseOperation { public: ConvertHSVToRGBOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class ConvertPremulToStraightOperation : public ConvertBaseOperation { public: ConvertPremulToStraightOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class ConvertStraightToPremulOperation : public ConvertBaseOperation { public: ConvertStraightToPremulOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class SeparateChannelOperation : public NodeOperation { @@ -157,10 +159,10 @@ class SeparateChannelOperation : public NodeOperation { public: SeparateChannelOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; void setChannel(int channel) { @@ -177,8 +179,10 @@ class CombineChannelsOperation : public NodeOperation { public: CombineChannelsOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cc b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cc index a5f2ae404e3..9114200a8ec 100644 --- a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cc +++ b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cc @@ -19,6 +19,8 @@ #include "COM_ConvolutionEdgeFilterOperation.h" #include "BLI_math.h" +namespace blender::compositor { + ConvolutionEdgeFilterOperation::ConvolutionEdgeFilterOperation() { /* pass */ @@ -97,3 +99,5 @@ void ConvolutionEdgeFilterOperation::executePixel(float output[4], int x, int y, output[2] = MAX2(output[2], 0.0f); output[3] = MAX2(output[3], 0.0f); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h index ab4b8a1dad1..98bfa1768d8 100644 --- a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h +++ b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h @@ -20,8 +20,12 @@ #include "COM_ConvolutionFilterOperation.h" +namespace blender::compositor { + class ConvolutionEdgeFilterOperation : public ConvolutionFilterOperation { public: ConvolutionEdgeFilterOperation(); - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cc b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cc index f80144fb06d..72cbbf4283a 100644 --- a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cc +++ b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cc @@ -22,6 +22,8 @@ #include "MEM_guardedalloc.h" +namespace blender::compositor { + ConvolutionFilterOperation::ConvolutionFilterOperation() { this->addInputSocket(DataType::Color); @@ -29,7 +31,7 @@ ConvolutionFilterOperation::ConvolutionFilterOperation() this->addOutputSocket(DataType::Color); this->setResolutionInputSocketIndex(0); this->m_inputOperation = nullptr; - this->setComplex(true); + this->flags.complex = true; } void ConvolutionFilterOperation::initExecution() { @@ -124,3 +126,5 @@ bool ConvolutionFilterOperation::determineDependingAreaOfInterest( return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h index d178b0a7418..16dee502929 100644 --- a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h +++ b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class ConvolutionFilterOperation : public NodeOperation { private: int m_filterWidth; @@ -36,9 +38,11 @@ class ConvolutionFilterOperation : public NodeOperation { 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); + rcti *output) override; + void executePixel(float output[4], int x, int y, void *data) override; - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_CropOperation.cc b/source/blender/compositor/operations/COM_CropOperation.cc index 55a1e505ec8..f12d93bc8d3 100644 --- a/source/blender/compositor/operations/COM_CropOperation.cc +++ b/source/blender/compositor/operations/COM_CropOperation.cc @@ -19,9 +19,11 @@ #include "COM_CropOperation.h" #include "BLI_math.h" +namespace blender::compositor { + CropBaseOperation::CropBaseOperation() { - this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE); + this->addInputSocket(DataType::Color, ResizeMode::None); this->addOutputSocket(DataType::Color); this->m_inputOperation = nullptr; this->m_settings = nullptr; @@ -133,3 +135,5 @@ void CropImageOperation::executePixelSampled(float output[4], zero_v4(output); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_CropOperation.h b/source/blender/compositor/operations/COM_CropOperation.h index f20664f0501..acdff79a77c 100644 --- a/source/blender/compositor/operations/COM_CropOperation.h +++ b/source/blender/compositor/operations/COM_CropOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class CropBaseOperation : public NodeOperation { protected: SocketReader *m_inputOperation; @@ -34,8 +36,8 @@ class CropBaseOperation : public NodeOperation { public: CropBaseOperation(); - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; void setCropSettings(NodeTwoXYs *settings) { this->m_settings = settings; @@ -50,7 +52,7 @@ class CropOperation : public CropBaseOperation { private: public: CropOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class CropImageOperation : public CropBaseOperation { @@ -59,7 +61,10 @@ class CropImageOperation : public CropBaseOperation { CropImageOperation(); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + rcti *output) override; + void determineResolution(unsigned int resolution[2], + unsigned int preferredResolution[2]) override; + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_CryptomatteOperation.cc b/source/blender/compositor/operations/COM_CryptomatteOperation.cc index 8d42a756f51..52ae1d6d5b5 100644 --- a/source/blender/compositor/operations/COM_CryptomatteOperation.cc +++ b/source/blender/compositor/operations/COM_CryptomatteOperation.cc @@ -18,14 +18,16 @@ #include "COM_CryptomatteOperation.h" +namespace blender::compositor { + CryptomatteOperation::CryptomatteOperation(size_t num_inputs) { + inputs.resize(num_inputs); for (size_t i = 0; i < num_inputs; i++) { this->addInputSocket(DataType::Color); } - inputs.resize(num_inputs); this->addOutputSocket(DataType::Color); - this->setComplex(true); + this->flags.complex = true; } void CryptomatteOperation::initExecution() @@ -38,7 +40,7 @@ void CryptomatteOperation::initExecution() void CryptomatteOperation::addObjectIndex(float objectIndex) { if (objectIndex != 0.0f) { - m_objectIndex.push_back(objectIndex); + m_objectIndex.append(objectIndex); } } @@ -58,13 +60,15 @@ void CryptomatteOperation::executePixel(float output[4], int x, int y, void *dat output[1] = ((float)((m3hash << 8)) / (float)UINT32_MAX); output[2] = ((float)((m3hash << 16)) / (float)UINT32_MAX); } - for (size_t i = 0; i < m_objectIndex.size(); i++) { - if (m_objectIndex[i] == input[0]) { + for (float hash : m_objectIndex) { + if (input[0] == hash) { output[3] += input[1]; } - if (m_objectIndex[i] == input[2]) { + if (input[2] == hash) { output[3] += input[3]; } } } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_CryptomatteOperation.h b/source/blender/compositor/operations/COM_CryptomatteOperation.h index 8c5a3134720..40a1fbf5a80 100644 --- a/source/blender/compositor/operations/COM_CryptomatteOperation.h +++ b/source/blender/compositor/operations/COM_CryptomatteOperation.h @@ -20,17 +20,21 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class CryptomatteOperation : public NodeOperation { private: - std::vector<float> m_objectIndex; + blender::Vector<float> m_objectIndex; public: - std::vector<SocketReader *> inputs; + blender::Vector<SocketReader *> inputs; CryptomatteOperation(size_t num_inputs = 6); - void initExecution(); - void executePixel(float output[4], int x, int y, void *data); + void initExecution() override; + void executePixel(float output[4], int x, int y, void *data) override; void addObjectIndex(float objectIndex); }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_CurveBaseOperation.cc b/source/blender/compositor/operations/COM_CurveBaseOperation.cc index b58efcf0cca..8f655964570 100644 --- a/source/blender/compositor/operations/COM_CurveBaseOperation.cc +++ b/source/blender/compositor/operations/COM_CurveBaseOperation.cc @@ -20,6 +20,8 @@ #include "BKE_colortools.h" +namespace blender::compositor { + CurveBaseOperation::CurveBaseOperation() { this->m_curveMapping = nullptr; @@ -53,3 +55,5 @@ void CurveBaseOperation::setCurveMapping(CurveMapping *mapping) } this->m_curveMapping = BKE_curvemapping_copy(mapping); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_CurveBaseOperation.h b/source/blender/compositor/operations/COM_CurveBaseOperation.h index 63e667cfe12..fff0f3168ba 100644 --- a/source/blender/compositor/operations/COM_CurveBaseOperation.h +++ b/source/blender/compositor/operations/COM_CurveBaseOperation.h @@ -21,6 +21,8 @@ #include "COM_NodeOperation.h" #include "DNA_color_types.h" +namespace blender::compositor { + class CurveBaseOperation : public NodeOperation { protected: /** @@ -35,8 +37,10 @@ class CurveBaseOperation : public NodeOperation { /** * Initialize the execution */ - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; void setCurveMapping(CurveMapping *mapping); }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_DenoiseOperation.cc b/source/blender/compositor/operations/COM_DenoiseOperation.cc index 66d0f3fd9bd..587afdc2d00 100644 --- a/source/blender/compositor/operations/COM_DenoiseOperation.cc +++ b/source/blender/compositor/operations/COM_DenoiseOperation.cc @@ -26,6 +26,8 @@ static pthread_mutex_t oidn_lock = BLI_MUTEX_INITIALIZER; #endif #include <iostream> +namespace blender::compositor { + DenoiseOperation::DenoiseOperation() { this->addInputSocket(DataType::Color); @@ -164,3 +166,5 @@ void DenoiseOperation::generateDenoise(float *data, inputBufferColor, sizeof(float[4]) * inputTileColor->getWidth() * inputTileColor->getHeight()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_DenoiseOperation.h b/source/blender/compositor/operations/COM_DenoiseOperation.h index 5af6e16c958..a9298c17e92 100644 --- a/source/blender/compositor/operations/COM_DenoiseOperation.h +++ b/source/blender/compositor/operations/COM_DenoiseOperation.h @@ -21,6 +21,8 @@ #include "COM_SingleThreadedOperation.h" #include "DNA_node_types.h" +namespace blender::compositor { + class DenoiseOperation : public SingleThreadedOperation { private: /** @@ -40,12 +42,12 @@ class DenoiseOperation : public SingleThreadedOperation { /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; void setDenoiseSettings(NodeDenoise *settings) { @@ -53,7 +55,7 @@ class DenoiseOperation : public SingleThreadedOperation { } bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; protected: void generateDenoise(float *data, @@ -62,5 +64,7 @@ class DenoiseOperation : public SingleThreadedOperation { MemoryBuffer *inputTileAlbedo, NodeDenoise *settings); - MemoryBuffer *createMemoryBuffer(rcti *rect); + MemoryBuffer *createMemoryBuffer(rcti *rect) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_DespeckleOperation.cc b/source/blender/compositor/operations/COM_DespeckleOperation.cc index 813ae07a97a..fc8778c7d2e 100644 --- a/source/blender/compositor/operations/COM_DespeckleOperation.cc +++ b/source/blender/compositor/operations/COM_DespeckleOperation.cc @@ -22,6 +22,8 @@ #include "BLI_utildefines.h" +namespace blender::compositor { + DespeckleOperation::DespeckleOperation() { this->addInputSocket(DataType::Color); @@ -29,7 +31,7 @@ DespeckleOperation::DespeckleOperation() this->addOutputSocket(DataType::Color); this->setResolutionInputSocketIndex(0); this->m_inputOperation = nullptr; - this->setComplex(true); + this->flags.complex = true; } void DespeckleOperation::initExecution() { @@ -141,3 +143,5 @@ bool DespeckleOperation::determineDependingAreaOfInterest(rcti *input, return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_DespeckleOperation.h b/source/blender/compositor/operations/COM_DespeckleOperation.h index af37c276bd2..e8d3461d2ec 100644 --- a/source/blender/compositor/operations/COM_DespeckleOperation.h +++ b/source/blender/compositor/operations/COM_DespeckleOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class DespeckleOperation : public NodeOperation { private: float m_threshold; @@ -36,8 +38,8 @@ class DespeckleOperation : public NodeOperation { DespeckleOperation(); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); - void executePixel(float output[4], int x, int y, void *data); + rcti *output) override; + void executePixel(float output[4], int x, int y, void *data) override; void setThreshold(float threshold) { @@ -48,6 +50,8 @@ class DespeckleOperation : public NodeOperation { this->m_threshold_neighbor = threshold; } - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cc b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cc index 1ce91aeb4c3..e380131634f 100644 --- a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cc +++ b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cc @@ -19,6 +19,8 @@ #include "COM_DifferenceMatteOperation.h" #include "BLI_math.h" +namespace blender::compositor { + DifferenceMatteOperation::DifferenceMatteOperation() { addInputSocket(DataType::Color); @@ -83,3 +85,5 @@ void DifferenceMatteOperation::executePixelSampled(float output[4], output[0] = inColor1[3]; } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_DifferenceMatteOperation.h b/source/blender/compositor/operations/COM_DifferenceMatteOperation.h index 0ee5eab3fe7..d3963fee1c1 100644 --- a/source/blender/compositor/operations/COM_DifferenceMatteOperation.h +++ b/source/blender/compositor/operations/COM_DifferenceMatteOperation.h @@ -20,6 +20,8 @@ #include "COM_MixOperation.h" +namespace blender::compositor { + /** * this program converts an input color to an output value. * it assumes we are in sRGB color space. @@ -39,13 +41,15 @@ class DifferenceMatteOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; void setSettings(NodeChroma *nodeChroma) { this->m_settings = nodeChroma; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.cc b/source/blender/compositor/operations/COM_DilateErodeOperation.cc index 33ddf9187b0..9e18a8e2f2c 100644 --- a/source/blender/compositor/operations/COM_DilateErodeOperation.cc +++ b/source/blender/compositor/operations/COM_DilateErodeOperation.cc @@ -22,12 +22,14 @@ #include "MEM_guardedalloc.h" +namespace blender::compositor { + // DilateErode Distance Threshold DilateErodeThresholdOperation::DilateErodeThresholdOperation() { this->addInputSocket(DataType::Value); this->addOutputSocket(DataType::Value); - this->setComplex(true); + this->flags.complex = true; this->m_inputProgram = nullptr; this->m_inset = 0.0f; this->m__switch = 0.5f; @@ -163,10 +165,10 @@ DilateDistanceOperation::DilateDistanceOperation() { this->addInputSocket(DataType::Value); this->addOutputSocket(DataType::Value); - this->setComplex(true); this->m_inputProgram = nullptr; this->m_distance = 0.0f; - this->setOpenCL(true); + flags.complex = true; + flags.open_cl = true; } void DilateDistanceOperation::initExecution() { @@ -321,7 +323,7 @@ DilateStepOperation::DilateStepOperation() { this->addInputSocket(DataType::Value); this->addOutputSocket(DataType::Value); - this->setComplex(true); + this->flags.complex = true; this->m_inputProgram = nullptr; } void DilateStepOperation::initExecution() @@ -568,3 +570,5 @@ void *ErodeStepOperation::initializeTileData(rcti *rect) return result; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.h b/source/blender/compositor/operations/COM_DilateErodeOperation.h index 35f9be89220..a489e293e8e 100644 --- a/source/blender/compositor/operations/COM_DilateErodeOperation.h +++ b/source/blender/compositor/operations/COM_DilateErodeOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class DilateErodeThresholdOperation : public NodeOperation { private: /** @@ -43,18 +45,18 @@ class DilateErodeThresholdOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; - void *initializeTileData(rcti *rect); + void *initializeTileData(rcti *rect) override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; void setDistance(float distance) { @@ -71,7 +73,7 @@ class DilateErodeThresholdOperation : public NodeOperation { bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; }; class DilateDistanceOperation : public NodeOperation { @@ -90,18 +92,18 @@ class DilateDistanceOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; - void *initializeTileData(rcti *rect); + void *initializeTileData(rcti *rect) override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; void setDistance(float distance) { @@ -109,14 +111,14 @@ class DilateDistanceOperation : public NodeOperation { } bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; void executeOpenCL(OpenCLDevice *device, MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer **inputMemoryBuffers, std::list<cl_mem> *clMemToCleanUp, - std::list<cl_kernel> *clKernelsToCleanUp); + std::list<cl_kernel> *clKernelsToCleanUp) override; }; class ErodeDistanceOperation : public DilateDistanceOperation { public: @@ -125,14 +127,14 @@ class ErodeDistanceOperation : public DilateDistanceOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; void executeOpenCL(OpenCLDevice *device, MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer **inputMemoryBuffers, std::list<cl_mem> *clMemToCleanUp, - std::list<cl_kernel> *clKernelsToCleanUp); + std::list<cl_kernel> *clKernelsToCleanUp) override; }; class DilateStepOperation : public NodeOperation { @@ -150,19 +152,19 @@ class DilateStepOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; - void *initializeTileData(rcti *rect); + void *initializeTileData(rcti *rect) override; /** * Deinitialize the execution */ - void deinitExecution(); - void deinitializeTileData(rcti *rect, void *data); + void deinitExecution() override; + void deinitializeTileData(rcti *rect, void *data) override; void setIterations(int iterations) { @@ -171,12 +173,14 @@ class DilateStepOperation : public NodeOperation { bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; }; class ErodeStepOperation : public DilateStepOperation { public: ErodeStepOperation(); - void *initializeTileData(rcti *rect); + void *initializeTileData(rcti *rect) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cc b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cc index 1a2701a681d..97bdc25af3b 100644 --- a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cc +++ b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cc @@ -23,13 +23,14 @@ #include "RE_pipeline.h" +namespace blender::compositor { + DirectionalBlurOperation::DirectionalBlurOperation() { this->addInputSocket(DataType::Color); this->addOutputSocket(DataType::Color); - this->setComplex(true); - - this->setOpenCL(true); + flags.complex = true; + flags.open_cl = true; this->m_inputProgram = nullptr; } @@ -66,7 +67,7 @@ void DirectionalBlurOperation::executePixel(float output[4], int x, int y, void const int iterations = pow(2.0f, this->m_data->iter); float col[4] = {0.0f, 0.0f, 0.0f, 0.0f}; float col2[4] = {0.0f, 0.0f, 0.0f, 0.0f}; - this->m_inputProgram->readSampled(col2, x, y, COM_PS_BILINEAR); + this->m_inputProgram->readSampled(col2, x, y, PixelSampler::Bilinear); float ltx = this->m_tx; float lty = this->m_ty; float lsc = this->m_sc; @@ -82,7 +83,7 @@ void DirectionalBlurOperation::executePixel(float output[4], int x, int y, void this->m_inputProgram->readSampled(col, cs * u + ss * v + this->m_center_x_pix, cs * v - ss * u + this->m_center_y_pix, - COM_PS_BILINEAR); + PixelSampler::Bilinear); add_v4_v4(col2, col); @@ -144,3 +145,5 @@ bool DirectionalBlurOperation::determineDependingAreaOfInterest(rcti * /*input*/ return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_DirectionalBlurOperation.h b/source/blender/compositor/operations/COM_DirectionalBlurOperation.h index 0c220f0e239..5555520462b 100644 --- a/source/blender/compositor/operations/COM_DirectionalBlurOperation.h +++ b/source/blender/compositor/operations/COM_DirectionalBlurOperation.h @@ -21,6 +21,8 @@ #include "COM_NodeOperation.h" #include "COM_QualityStepHelper.h" +namespace blender::compositor { + class DirectionalBlurOperation : public NodeOperation, public QualityStepHelper { private: SocketReader *m_inputProgram; @@ -36,21 +38,21 @@ class DirectionalBlurOperation : public NodeOperation, public QualityStepHelper /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; void setData(NodeDBlurData *data) { @@ -62,5 +64,7 @@ class DirectionalBlurOperation : public NodeOperation, public QualityStepHelper cl_mem clOutputBuffer, MemoryBuffer **inputMemoryBuffers, std::list<cl_mem> *clMemToCleanUp, - std::list<cl_kernel> *clKernelsToCleanUp); + std::list<cl_kernel> *clKernelsToCleanUp) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_DisplaceOperation.cc b/source/blender/compositor/operations/COM_DisplaceOperation.cc index 12c7d29a210..9f3f5cfe489 100644 --- a/source/blender/compositor/operations/COM_DisplaceOperation.cc +++ b/source/blender/compositor/operations/COM_DisplaceOperation.cc @@ -20,6 +20,8 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +namespace blender::compositor { + DisplaceOperation::DisplaceOperation() { this->addInputSocket(DataType::Color); @@ -27,7 +29,7 @@ DisplaceOperation::DisplaceOperation() this->addInputSocket(DataType::Value); this->addInputSocket(DataType::Value); this->addOutputSocket(DataType::Color); - this->setComplex(true); + this->flags.complex = true; this->m_inputColorProgram = nullptr; this->m_inputVectorProgram = nullptr; @@ -56,7 +58,7 @@ void DisplaceOperation::executePixelSampled(float output[4], pixelTransform(xy, uv, deriv); if (is_zero_v2(deriv[0]) && is_zero_v2(deriv[1])) { - this->m_inputColorProgram->readSampled(output, uv[0], uv[1], COM_PS_BILINEAR); + this->m_inputColorProgram->readSampled(output, uv[0], uv[1], PixelSampler::Bilinear); } else { /* EWA filtering (without nearest it gets blurry with NO distortion) */ @@ -76,7 +78,7 @@ bool DisplaceOperation::read_displacement( } float col[4]; - m_inputVectorProgram->readSampled(col, x, y, COM_PS_BILINEAR); + m_inputVectorProgram->readSampled(col, x, y, PixelSampler::Bilinear); r_u = origin[0] - col[0] * xscale; r_v = origin[1] - col[1] * yscale; return true; @@ -88,9 +90,9 @@ void DisplaceOperation::pixelTransform(const float xy[2], float r_uv[2], float r float uv[2]; /* temporary variables for derivative estimation */ int num; - m_inputScaleXProgram->readSampled(col, xy[0], xy[1], COM_PS_NEAREST); + m_inputScaleXProgram->readSampled(col, xy[0], xy[1], PixelSampler::Nearest); float xs = col[0]; - m_inputScaleYProgram->readSampled(col, xy[0], xy[1], COM_PS_NEAREST); + m_inputScaleYProgram->readSampled(col, xy[0], xy[1], PixelSampler::Nearest); float ys = col[0]; /* clamp x and y displacement to triple image resolution - * to prevent hangs from huge values mistakenly plugged in eg. z buffers */ @@ -192,3 +194,5 @@ bool DisplaceOperation::determineDependingAreaOfInterest(rcti *input, return false; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_DisplaceOperation.h b/source/blender/compositor/operations/COM_DisplaceOperation.h index 52874779f73..fd82692f687 100644 --- a/source/blender/compositor/operations/COM_DisplaceOperation.h +++ b/source/blender/compositor/operations/COM_DisplaceOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class DisplaceOperation : public NodeOperation { private: /** @@ -41,26 +43,28 @@ class DisplaceOperation : public NodeOperation { */ bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; void pixelTransform(const float xy[2], float r_uv[2], float r_deriv[2][2]); /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; private: bool read_displacement( float x, float y, float xscale, float yscale, const float origin[2], float &r_u, float &r_v); }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cc b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cc index 9d00c2cb148..f4b77f5d32c 100644 --- a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cc +++ b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cc @@ -20,6 +20,8 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +namespace blender::compositor { + DisplaceSimpleOperation::DisplaceSimpleOperation() { this->addInputSocket(DataType::Color); @@ -129,3 +131,5 @@ bool DisplaceSimpleOperation::determineDependingAreaOfInterest(rcti *input, return false; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h index 3b850d94750..15e6fcd0523 100644 --- a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h +++ b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class DisplaceSimpleOperation : public NodeOperation { private: /** @@ -41,20 +43,22 @@ class DisplaceSimpleOperation : public NodeOperation { */ bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cc b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cc index ae024d497d6..12cb7e7d075 100644 --- a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cc +++ b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cc @@ -19,6 +19,8 @@ #include "COM_DistanceRGBMatteOperation.h" #include "BLI_math.h" +namespace blender::compositor { + DistanceRGBMatteOperation::DistanceRGBMatteOperation() { this->addInputSocket(DataType::Color); @@ -90,3 +92,5 @@ void DistanceRGBMatteOperation::executePixelSampled(float output[4], output[0] = inImage[3]; } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h index 5c8c2204637..6fe603233b7 100644 --- a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h +++ b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h @@ -20,6 +20,8 @@ #include "COM_MixOperation.h" +namespace blender::compositor { + /** * this program converts an input color to an output value. * it assumes we are in sRGB color space. @@ -41,13 +43,15 @@ class DistanceRGBMatteOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; void setSettings(NodeChroma *nodeChroma) { this->m_settings = nodeChroma; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.cc b/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.cc index f333cc1ecd9..15ed2b0aaa4 100644 --- a/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.cc +++ b/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.cc @@ -19,6 +19,8 @@ #include "COM_DistanceYCCMatteOperation.h" #include "BLI_math.h" +namespace blender::compositor { + DistanceYCCMatteOperation::DistanceYCCMatteOperation() { /* pass */ @@ -29,3 +31,5 @@ float DistanceYCCMatteOperation::calculateDistance(float key[4], float image[4]) /* only measure the second 2 values */ return len_v2v2(key + 1, image + 1); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.h b/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.h index e9b2cda6251..9027fbabe7b 100644 --- a/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.h +++ b/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.h @@ -21,13 +21,15 @@ #include "COM_DistanceRGBMatteOperation.h" #include "COM_MixOperation.h" +namespace blender::compositor { + /** * this program converts an input color to an output value. * it assumes we are in sRGB color space. */ class DistanceYCCMatteOperation : public DistanceRGBMatteOperation { protected: - virtual float calculateDistance(float key[4], float image[4]); + float calculateDistance(float key[4], float image[4]) override; public: /** @@ -35,3 +37,5 @@ class DistanceYCCMatteOperation : public DistanceRGBMatteOperation { */ DistanceYCCMatteOperation(); }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_DotproductOperation.cc b/source/blender/compositor/operations/COM_DotproductOperation.cc index c5b89bb7fae..07075ae1d9d 100644 --- a/source/blender/compositor/operations/COM_DotproductOperation.cc +++ b/source/blender/compositor/operations/COM_DotproductOperation.cc @@ -18,6 +18,8 @@ #include "COM_DotproductOperation.h" +namespace blender::compositor { + DotproductOperation::DotproductOperation() { this->addInputSocket(DataType::Vector); @@ -52,3 +54,5 @@ void DotproductOperation::executePixelSampled(float output[4], this->m_input2Operation->readSampled(input2, x, y, sampler); output[0] = -(input1[0] * input2[0] + input1[1] * input2[1] + input1[2] * input2[2]); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_DotproductOperation.h b/source/blender/compositor/operations/COM_DotproductOperation.h index 63b735ce30f..728033bcf32 100644 --- a/source/blender/compositor/operations/COM_DotproductOperation.h +++ b/source/blender/compositor/operations/COM_DotproductOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class DotproductOperation : public NodeOperation { private: SocketReader *m_input1Operation; @@ -27,8 +29,10 @@ class DotproductOperation : public NodeOperation { public: DotproductOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cc b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cc index 4c7cbb3cc7e..a3a86a6c502 100644 --- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cc +++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cc @@ -23,6 +23,8 @@ #include "DNA_node_types.h" #include "MEM_guardedalloc.h" +namespace blender::compositor { + // this part has been copied from the double edge mask static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, @@ -1315,7 +1317,7 @@ DoubleEdgeMaskOperation::DoubleEdgeMaskOperation() this->m_inputOuterMask = nullptr; this->m_adjacentOnly = false; this->m_keepInside = false; - this->setComplex(true); + this->flags.complex = true; } bool DoubleEdgeMaskOperation::determineDependingAreaOfInterest(rcti * /*input*/, @@ -1379,3 +1381,5 @@ void DoubleEdgeMaskOperation::deinitExecution() this->m_cachedInstance = nullptr; } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h index 813f5009815..e956e8edc3e 100644 --- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h +++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class DoubleEdgeMaskOperation : public NodeOperation { private: /** @@ -38,23 +40,23 @@ class DoubleEdgeMaskOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; - void *initializeTileData(rcti *rect); + void *initializeTileData(rcti *rect) override; bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; void setAdjecentOnly(bool adjacentOnly) { @@ -65,3 +67,5 @@ class DoubleEdgeMaskOperation : public NodeOperation { this->m_keepInside = keepInside; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_EllipseMaskOperation.cc b/source/blender/compositor/operations/COM_EllipseMaskOperation.cc index 956b5e50edc..5a4503fecec 100644 --- a/source/blender/compositor/operations/COM_EllipseMaskOperation.cc +++ b/source/blender/compositor/operations/COM_EllipseMaskOperation.cc @@ -20,6 +20,8 @@ #include "BLI_math.h" #include "DNA_node_types.h" +namespace blender::compositor { + EllipseMaskOperation::EllipseMaskOperation() { this->addInputSocket(DataType::Value); @@ -117,3 +119,5 @@ void EllipseMaskOperation::deinitExecution() this->m_inputMask = nullptr; this->m_inputValue = nullptr; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_EllipseMaskOperation.h b/source/blender/compositor/operations/COM_EllipseMaskOperation.h index 8fce7166900..64afe0145cf 100644 --- a/source/blender/compositor/operations/COM_EllipseMaskOperation.h +++ b/source/blender/compositor/operations/COM_EllipseMaskOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class EllipseMaskOperation : public NodeOperation { private: /** @@ -41,17 +43,17 @@ class EllipseMaskOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; void setData(NodeEllipseMask *data) { @@ -63,3 +65,5 @@ class EllipseMaskOperation : public NodeOperation { this->m_maskType = maskType; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc index 4dded61fba5..2be6e4d1be7 100644 --- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc +++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc @@ -22,6 +22,8 @@ #include "COM_FastGaussianBlurOperation.h" #include "MEM_guardedalloc.h" +namespace blender::compositor { + FastGaussianBlurOperation::FastGaussianBlurOperation() : BlurBaseOperation(DataType::Color) { this->m_iirgaus = nullptr; @@ -88,18 +90,18 @@ void *FastGaussianBlurOperation::initializeTileData(rcti *rect) 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++) { + for (c = 0; c < COM_DATA_TYPE_COLOR_CHANNELS; c++) { IIR_gauss(copy, this->m_sx, c, 3); } } else { if (this->m_sx > 0.0f) { - for (c = 0; c < COM_NUM_CHANNELS_COLOR; c++) { + for (c = 0; c < COM_DATA_TYPE_COLOR_CHANNELS; c++) { IIR_gauss(copy, this->m_sx, c, 1); } } if (this->m_sy > 0.0f) { - for (c = 0; c < COM_NUM_CHANNELS_COLOR; c++) { + for (c = 0; c < COM_DATA_TYPE_COLOR_CHANNELS; c++) { IIR_gauss(copy, this->m_sy, c, 2); } } @@ -264,7 +266,7 @@ FastGaussianBlurValueOperation::FastGaussianBlurValueOperation() this->m_inputprogram = nullptr; this->m_sigma = 1.0f; this->m_overlay = 0; - setComplex(true); + flags.complex = true; } void FastGaussianBlurValueOperation::executePixel(float output[4], int x, int y, void *data) @@ -317,7 +319,7 @@ void *FastGaussianBlurValueOperation::initializeTileData(rcti *rect) float *src = newBuf->getBuffer(); float *dst = copy->getBuffer(); for (int i = copy->getWidth() * copy->getHeight(); i != 0; - i--, src += COM_NUM_CHANNELS_VALUE, dst += COM_NUM_CHANNELS_VALUE) { + i--, src += COM_DATA_TYPE_VALUE_CHANNELS, dst += COM_DATA_TYPE_VALUE_CHANNELS) { if (*src < *dst) { *dst = *src; } @@ -327,7 +329,7 @@ void *FastGaussianBlurValueOperation::initializeTileData(rcti *rect) float *src = newBuf->getBuffer(); float *dst = copy->getBuffer(); for (int i = copy->getWidth() * copy->getHeight(); i != 0; - i--, src += COM_NUM_CHANNELS_VALUE, dst += COM_NUM_CHANNELS_VALUE) { + i--, src += COM_DATA_TYPE_VALUE_CHANNELS, dst += COM_DATA_TYPE_VALUE_CHANNELS) { if (*src > *dst) { *dst = *src; } @@ -341,3 +343,5 @@ void *FastGaussianBlurValueOperation::initializeTileData(rcti *rect) unlockMutex(); return this->m_iirgaus; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h index 6ab6474c20a..c25afe6c4a4 100644 --- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h +++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h @@ -21,6 +21,8 @@ #include "COM_BlurBaseOperation.h" #include "DNA_node_types.h" +namespace blender::compositor { + class FastGaussianBlurOperation : public BlurBaseOperation { private: float m_sx; @@ -31,13 +33,13 @@ class FastGaussianBlurOperation : public BlurBaseOperation { FastGaussianBlurOperation(); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); - void executePixel(float output[4], int x, int y, void *data); + rcti *output) override; + void executePixel(float output[4], int x, int y, void *data) override; static void IIR_gauss(MemoryBuffer *src, float sigma, unsigned int channel, unsigned int xy); - void *initializeTileData(rcti *rect); - void deinitExecution(); - void initExecution(); + void *initializeTileData(rcti *rect) override; + void deinitExecution() override; + void initExecution() override; }; enum { @@ -62,12 +64,12 @@ class FastGaussianBlurValueOperation : public NodeOperation { FastGaussianBlurValueOperation(); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); - void executePixel(float output[4], int x, int y, void *data); + rcti *output) override; + void executePixel(float output[4], int x, int y, void *data) override; - void *initializeTileData(rcti *rect); - void deinitExecution(); - void initExecution(); + void *initializeTileData(rcti *rect) override; + void deinitExecution() override; + void initExecution() override; void setSigma(float sigma) { this->m_sigma = sigma; @@ -79,3 +81,5 @@ class FastGaussianBlurValueOperation : public NodeOperation { this->m_overlay = overlay; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_FlipOperation.cc b/source/blender/compositor/operations/COM_FlipOperation.cc index 4837766b5eb..8afbec4ddbe 100644 --- a/source/blender/compositor/operations/COM_FlipOperation.cc +++ b/source/blender/compositor/operations/COM_FlipOperation.cc @@ -18,6 +18,8 @@ #include "COM_FlipOperation.h" +namespace blender::compositor { + FlipOperation::FlipOperation() { this->addInputSocket(DataType::Color); @@ -72,3 +74,5 @@ bool FlipOperation::determineDependingAreaOfInterest(rcti *input, return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_FlipOperation.h b/source/blender/compositor/operations/COM_FlipOperation.h index 711b51261e6..f26d587fde6 100644 --- a/source/blender/compositor/operations/COM_FlipOperation.h +++ b/source/blender/compositor/operations/COM_FlipOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class FlipOperation : public NodeOperation { private: SocketReader *m_inputOperation; @@ -30,11 +32,11 @@ class FlipOperation : public NodeOperation { FlipOperation(); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + rcti *output) override; + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; void setFlipX(bool flipX) { this->m_flipX = flipX; @@ -44,3 +46,5 @@ class FlipOperation : public NodeOperation { this->m_flipY = flipY; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GammaCorrectOperation.cc b/source/blender/compositor/operations/COM_GammaCorrectOperation.cc index 51c033498ef..16b79fddd06 100644 --- a/source/blender/compositor/operations/COM_GammaCorrectOperation.cc +++ b/source/blender/compositor/operations/COM_GammaCorrectOperation.cc @@ -19,6 +19,8 @@ #include "COM_GammaCorrectOperation.h" #include "BLI_math.h" +namespace blender::compositor { + GammaCorrectOperation::GammaCorrectOperation() { this->addInputSocket(DataType::Color); @@ -102,3 +104,5 @@ void GammaUncorrectOperation::deinitExecution() { this->m_inputProgram = nullptr; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GammaCorrectOperation.h b/source/blender/compositor/operations/COM_GammaCorrectOperation.h index 077493bbd2f..ac3d45b94b1 100644 --- a/source/blender/compositor/operations/COM_GammaCorrectOperation.h +++ b/source/blender/compositor/operations/COM_GammaCorrectOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class GammaCorrectOperation : public NodeOperation { private: /** @@ -33,17 +35,17 @@ class GammaCorrectOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; }; class GammaUncorrectOperation : public NodeOperation { @@ -59,15 +61,17 @@ class GammaUncorrectOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GammaOperation.cc b/source/blender/compositor/operations/COM_GammaOperation.cc index 327c5c24929..343e335070a 100644 --- a/source/blender/compositor/operations/COM_GammaOperation.cc +++ b/source/blender/compositor/operations/COM_GammaOperation.cc @@ -19,6 +19,8 @@ #include "COM_GammaOperation.h" #include "BLI_math.h" +namespace blender::compositor { + GammaOperation::GammaOperation() { this->addInputSocket(DataType::Color); @@ -54,3 +56,5 @@ void GammaOperation::deinitExecution() this->m_inputProgram = nullptr; this->m_inputGammaProgram = nullptr; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GammaOperation.h b/source/blender/compositor/operations/COM_GammaOperation.h index 8641f2fde62..034046106d6 100644 --- a/source/blender/compositor/operations/COM_GammaOperation.h +++ b/source/blender/compositor/operations/COM_GammaOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class GammaOperation : public NodeOperation { private: /** @@ -34,15 +36,17 @@ class GammaOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cc b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cc index 1f03bb8d9cb..7ca5dc4ca76 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cc +++ b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cc @@ -22,6 +22,8 @@ #include "RE_pipeline.h" +namespace blender::compositor { + GaussianAlphaXBlurOperation::GaussianAlphaXBlurOperation() : BlurBaseOperation(DataType::Value) { this->m_gausstab = nullptr; @@ -190,3 +192,5 @@ bool GaussianAlphaXBlurOperation::determineDependingAreaOfInterest( return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h index 2d536a98bee..949956fae04 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h @@ -21,6 +21,8 @@ #include "COM_BlurBaseOperation.h" #include "COM_NodeOperation.h" +namespace blender::compositor { + class GaussianAlphaXBlurOperation : public BlurBaseOperation { private: float *m_gausstab; @@ -36,22 +38,22 @@ class GaussianAlphaXBlurOperation : public BlurBaseOperation { /** * \brief The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; /** * \brief initialize the execution */ - void initExecution(); + void initExecution() override; /** * \brief Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; - void *initializeTileData(rcti *rect); + void *initializeTileData(rcti *rect) override; bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; /** * Set subtract for Dilate/Erode functionality @@ -65,3 +67,5 @@ class GaussianAlphaXBlurOperation : public BlurBaseOperation { this->m_falloff = falloff; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cc b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cc index de35c164fc7..d2385a972dd 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cc +++ b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cc @@ -22,6 +22,8 @@ #include "RE_pipeline.h" +namespace blender::compositor { + GaussianAlphaYBlurOperation::GaussianAlphaYBlurOperation() : BlurBaseOperation(DataType::Value) { this->m_gausstab = nullptr; @@ -189,3 +191,5 @@ bool GaussianAlphaYBlurOperation::determineDependingAreaOfInterest( return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h index 7f1dfd78e7c..d25770386c4 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h @@ -21,6 +21,8 @@ #include "COM_BlurBaseOperation.h" #include "COM_NodeOperation.h" +namespace blender::compositor { + class GaussianAlphaYBlurOperation : public BlurBaseOperation { private: float *m_gausstab; @@ -36,22 +38,22 @@ class GaussianAlphaYBlurOperation : public BlurBaseOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; /** * \brief initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; - void *initializeTileData(rcti *rect); + void *initializeTileData(rcti *rect) override; bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; /** * Set subtract for Dilate/Erode functionality @@ -65,3 +67,5 @@ class GaussianAlphaYBlurOperation : public BlurBaseOperation { this->m_falloff = falloff; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cc b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cc index 73b0914c086..b2c65ff2c96 100644 --- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cc +++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cc @@ -22,6 +22,8 @@ #include "RE_pipeline.h" +namespace blender::compositor { + GaussianBokehBlurOperation::GaussianBokehBlurOperation() : BlurBaseOperation(DataType::Color) { this->m_gausstab = nullptr; @@ -303,7 +305,7 @@ void GaussianBlurReferenceOperation::executePixel(float output[4], int x, int y, int minyr = y - refrady < 0 ? -y : -refrady; int maxyr = y + refrady > imgy ? imgy - y : refrady; - float *srcd = buffer + COM_NUM_CHANNELS_COLOR * ((y + minyr) * imgx + x + minxr); + float *srcd = buffer + COM_DATA_TYPE_COLOR_CHANNELS * ((y + minyr) * imgx + x + minxr); gausstabx = m_maintabs[refradx - 1]; gausstabcentx = gausstabx + refradx; @@ -311,9 +313,9 @@ void GaussianBlurReferenceOperation::executePixel(float output[4], int x, int y, gausstabcenty = gausstaby + refrady; sum = gval = rval = bval = aval = 0.0f; - for (i = minyr; i < maxyr; i++, srcd += COM_NUM_CHANNELS_COLOR * imgx) { + for (i = minyr; i < maxyr; i++, srcd += COM_DATA_TYPE_COLOR_CHANNELS * imgx) { src = srcd; - for (j = minxr; j < maxxr; j++, src += COM_NUM_CHANNELS_COLOR) { + for (j = minxr; j < maxxr; j++, src += COM_DATA_TYPE_COLOR_CHANNELS) { val = gausstabcenty[i] * gausstabcentx[j]; sum += val; @@ -360,3 +362,5 @@ bool GaussianBlurReferenceOperation::determineDependingAreaOfInterest( newInput.ymin = input->ymin - addy; return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h index a37a70b4b33..59ba3d06619 100644 --- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h @@ -22,6 +22,8 @@ #include "COM_NodeOperation.h" #include "COM_QualityStepHelper.h" +namespace blender::compositor { + class GaussianBokehBlurOperation : public BlurBaseOperation { private: float *m_gausstab; @@ -30,21 +32,21 @@ class GaussianBokehBlurOperation : public BlurBaseOperation { public: GaussianBokehBlurOperation(); - void initExecution(); - void *initializeTileData(rcti *rect); + void initExecution() override; + void *initializeTileData(rcti *rect) override; /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; }; class GaussianBlurReferenceOperation : public BlurBaseOperation { @@ -59,19 +61,21 @@ class GaussianBlurReferenceOperation : public BlurBaseOperation { public: GaussianBlurReferenceOperation(); - void initExecution(); - void *initializeTileData(rcti *rect); + void initExecution() override; + void *initializeTileData(rcti *rect) override; /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cc b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cc index 43bf961cfc4..4b46cfc8776 100644 --- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cc +++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cc @@ -23,6 +23,8 @@ #include "RE_pipeline.h" +namespace blender::compositor { + GaussianXBlurOperation::GaussianXBlurOperation() : BlurBaseOperation(DataType::Color) { this->m_gausstab = nullptr; @@ -205,3 +207,5 @@ bool GaussianXBlurOperation::determineDependingAreaOfInterest(rcti *input, return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.h b/source/blender/compositor/operations/COM_GaussianXBlurOperation.h index 78ea6aa3cc2..15277f0a42d 100644 --- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.h @@ -21,6 +21,8 @@ #include "COM_BlurBaseOperation.h" #include "COM_NodeOperation.h" +namespace blender::compositor { + class GaussianXBlurOperation : public BlurBaseOperation { private: float *m_gausstab; @@ -36,32 +38,34 @@ class GaussianXBlurOperation : public BlurBaseOperation { /** * \brief The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; void executeOpenCL(OpenCLDevice *device, MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer **inputMemoryBuffers, std::list<cl_mem> *clMemToCleanUp, - std::list<cl_kernel> *clKernelsToCleanUp); + std::list<cl_kernel> *clKernelsToCleanUp) override; /** * \brief initialize the execution */ - void initExecution(); + void initExecution() override; /** * \brief Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; - void *initializeTileData(rcti *rect); + void *initializeTileData(rcti *rect) override; bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; void checkOpenCL() { - this->setOpenCL(m_data.sizex >= 128); + flags.open_cl = (m_data.sizex >= 128); } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cc b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cc index 1e853dfb8f9..590ac5faa6a 100644 --- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cc +++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cc @@ -23,6 +23,8 @@ #include "RE_pipeline.h" +namespace blender::compositor { + GaussianYBlurOperation::GaussianYBlurOperation() : BlurBaseOperation(DataType::Color) { this->m_gausstab = nullptr; @@ -205,3 +207,5 @@ bool GaussianYBlurOperation::determineDependingAreaOfInterest(rcti *input, return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.h b/source/blender/compositor/operations/COM_GaussianYBlurOperation.h index 8e7440b6fe4..56d40849ba4 100644 --- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.h @@ -21,6 +21,8 @@ #include "COM_BlurBaseOperation.h" #include "COM_NodeOperation.h" +namespace blender::compositor { + class GaussianYBlurOperation : public BlurBaseOperation { private: float *m_gausstab; @@ -36,32 +38,34 @@ class GaussianYBlurOperation : public BlurBaseOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; void executeOpenCL(OpenCLDevice *device, MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer **inputMemoryBuffers, std::list<cl_mem> *clMemToCleanUp, - std::list<cl_kernel> *clKernelsToCleanUp); + std::list<cl_kernel> *clKernelsToCleanUp) override; /** * \brief initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; - void *initializeTileData(rcti *rect); + void *initializeTileData(rcti *rect) override; bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; void checkOpenCL() { - this->setOpenCL(m_data.sizex >= 128); + flags.open_cl = (m_data.sizex >= 128); } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GlareBaseOperation.cc b/source/blender/compositor/operations/COM_GlareBaseOperation.cc index cdf64ed8b5a..90755d9f27a 100644 --- a/source/blender/compositor/operations/COM_GlareBaseOperation.cc +++ b/source/blender/compositor/operations/COM_GlareBaseOperation.cc @@ -19,6 +19,8 @@ #include "COM_GlareBaseOperation.h" #include "BLI_math.h" +namespace blender::compositor { + GlareBaseOperation::GlareBaseOperation() { this->addInputSocket(DataType::Color); @@ -66,3 +68,5 @@ bool GlareBaseOperation::determineDependingAreaOfInterest(rcti * /*input*/, newInput.ymin = 0; return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GlareBaseOperation.h b/source/blender/compositor/operations/COM_GlareBaseOperation.h index aabb76f5cf0..7ae15595e3b 100644 --- a/source/blender/compositor/operations/COM_GlareBaseOperation.h +++ b/source/blender/compositor/operations/COM_GlareBaseOperation.h @@ -21,6 +21,8 @@ #include "COM_SingleThreadedOperation.h" #include "DNA_node_types.h" +namespace blender::compositor { + /* utility functions used by glare, tonemap and lens distortion */ /* soms macros for color handling */ typedef float fRGB[4]; @@ -51,12 +53,12 @@ class GlareBaseOperation : public SingleThreadedOperation { /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; void setGlareSettings(NodeGlare *settings) { @@ -64,12 +66,14 @@ class GlareBaseOperation : public SingleThreadedOperation { } bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; protected: GlareBaseOperation(); virtual void generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings) = 0; - MemoryBuffer *createMemoryBuffer(rcti *rect); + MemoryBuffer *createMemoryBuffer(rcti *rect) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc index 23dfc95f9e3..1c1eaebd331 100644 --- a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc +++ b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc @@ -19,6 +19,8 @@ #include "COM_GlareFogGlowOperation.h" #include "MEM_guardedalloc.h" +namespace blender::compositor { + /* * 2D Fast Hartley Transform, used for convolution */ @@ -271,7 +273,7 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) MemoryBuffer *rdst = new MemoryBuffer(DataType::Color, in1->get_rect()); memset(rdst->getBuffer(), 0, - rdst->getWidth() * rdst->getHeight() * COM_NUM_CHANNELS_COLOR * sizeof(float)); + rdst->getWidth() * rdst->getHeight() * COM_DATA_TYPE_COLOR_CHANNELS * sizeof(float)); // convolution result width & height w2 = 2 * kernelWidth - 1; @@ -287,7 +289,7 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) // normalize convolutor wt[0] = wt[1] = wt[2] = 0.0f; for (y = 0; y < kernelHeight; y++) { - colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_NUM_CHANNELS_COLOR]; + colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_DATA_TYPE_COLOR_CHANNELS]; for (x = 0; x < kernelWidth; x++) { add_v3_v3(wt, colp[x]); } @@ -302,7 +304,7 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) wt[2] = 1.0f / wt[2]; } for (y = 0; y < kernelHeight; y++) { - colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_NUM_CHANNELS_COLOR]; + colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_DATA_TYPE_COLOR_CHANNELS]; for (x = 0; x < kernelWidth; x++) { mul_v3_v3(colp[x], wt); } @@ -336,7 +338,7 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) // in2, channel ch -> data1 for (y = 0; y < kernelHeight; y++) { fp = &data1ch[y * w2]; - colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_NUM_CHANNELS_COLOR]; + colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_DATA_TYPE_COLOR_CHANNELS]; for (x = 0; x < kernelWidth; x++) { fp[x] = colp[x][ch]; } @@ -351,7 +353,7 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) continue; } fp = &data2[y * w2]; - colp = (fRGB *)&imageBuffer[yy * imageWidth * COM_NUM_CHANNELS_COLOR]; + colp = (fRGB *)&imageBuffer[yy * imageWidth * COM_DATA_TYPE_COLOR_CHANNELS]; for (x = 0; x < xbsz; x++) { int xx = xbl * xbsz + x; if (xx >= imageWidth) { @@ -381,7 +383,7 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) continue; } fp = &data2[y * w2]; - colp = (fRGB *)&rdst->getBuffer()[yy * imageWidth * COM_NUM_CHANNELS_COLOR]; + colp = (fRGB *)&rdst->getBuffer()[yy * imageWidth * COM_DATA_TYPE_COLOR_CHANNELS]; for (x = 0; x < (int)w2; x++) { const int xx = xbl * xbsz + x - hw; if ((xx < 0) || (xx >= imageWidth)) { @@ -397,8 +399,9 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) MEM_freeN(data2); MEM_freeN(data1); - memcpy( - dst, rdst->getBuffer(), sizeof(float) * imageWidth * imageHeight * COM_NUM_CHANNELS_COLOR); + memcpy(dst, + rdst->getBuffer(), + sizeof(float) * imageWidth * imageHeight * COM_DATA_TYPE_COLOR_CHANNELS); delete (rdst); } @@ -442,3 +445,5 @@ void GlareFogGlowOperation::generateGlare(float *data, convolve(data, inputTile, ckrn); delete ckrn; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GlareFogGlowOperation.h b/source/blender/compositor/operations/COM_GlareFogGlowOperation.h index 9084f27052e..5701f76ab13 100644 --- a/source/blender/compositor/operations/COM_GlareFogGlowOperation.h +++ b/source/blender/compositor/operations/COM_GlareFogGlowOperation.h @@ -22,6 +22,8 @@ #include "COM_NodeOperation.h" #include "DNA_node_types.h" +namespace blender::compositor { + class GlareFogGlowOperation : public GlareBaseOperation { public: GlareFogGlowOperation() : GlareBaseOperation() @@ -29,5 +31,7 @@ class GlareFogGlowOperation : public GlareBaseOperation { } protected: - void generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings); + void generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GlareGhostOperation.cc b/source/blender/compositor/operations/COM_GlareGhostOperation.cc index a4cd6dc60c1..22c8767632e 100644 --- a/source/blender/compositor/operations/COM_GlareGhostOperation.cc +++ b/source/blender/compositor/operations/COM_GlareGhostOperation.cc @@ -20,6 +20,8 @@ #include "BLI_math.h" #include "COM_FastGaussianBlurOperation.h" +namespace blender::compositor { + static float smoothMask(float x, float y) { float t; @@ -123,7 +125,7 @@ void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, No memset(tbuf1.getBuffer(), 0, - tbuf1.getWidth() * tbuf1.getHeight() * COM_NUM_CHANNELS_COLOR * sizeof(float)); + tbuf1.getWidth() * tbuf1.getHeight() * COM_DATA_TYPE_COLOR_CHANNELS * sizeof(float)); for (n = 1; n < settings->iter && (!breaked); n++) { for (y = 0; y < gbuf.getHeight() && (!breaked); y++) { v = ((float)y + 0.5f) / (float)gbuf.getHeight(); @@ -147,9 +149,11 @@ void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, No } memcpy(gbuf.getBuffer(), tbuf1.getBuffer(), - tbuf1.getWidth() * tbuf1.getHeight() * COM_NUM_CHANNELS_COLOR * sizeof(float)); + tbuf1.getWidth() * tbuf1.getHeight() * COM_DATA_TYPE_COLOR_CHANNELS * sizeof(float)); } memcpy(data, gbuf.getBuffer(), - gbuf.getWidth() * gbuf.getHeight() * COM_NUM_CHANNELS_COLOR * sizeof(float)); + gbuf.getWidth() * gbuf.getHeight() * COM_DATA_TYPE_COLOR_CHANNELS * sizeof(float)); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GlareGhostOperation.h b/source/blender/compositor/operations/COM_GlareGhostOperation.h index 8ecf8da3385..60256d8e0ef 100644 --- a/source/blender/compositor/operations/COM_GlareGhostOperation.h +++ b/source/blender/compositor/operations/COM_GlareGhostOperation.h @@ -22,6 +22,8 @@ #include "COM_NodeOperation.h" #include "DNA_node_types.h" +namespace blender::compositor { + class GlareGhostOperation : public GlareBaseOperation { public: GlareGhostOperation() : GlareBaseOperation() @@ -29,5 +31,7 @@ class GlareGhostOperation : public GlareBaseOperation { } protected: - void generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings); + void generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GlareSimpleStarOperation.cc b/source/blender/compositor/operations/COM_GlareSimpleStarOperation.cc index a2cecb7e171..cc24a50a307 100644 --- a/source/blender/compositor/operations/COM_GlareSimpleStarOperation.cc +++ b/source/blender/compositor/operations/COM_GlareSimpleStarOperation.cc @@ -18,6 +18,8 @@ #include "COM_GlareSimpleStarOperation.h" +namespace blender::compositor { + void GlareSimpleStarOperation::generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings) @@ -97,3 +99,5 @@ void GlareSimpleStarOperation::generateGlare(float *data, data[i] = tbuf1.getBuffer()[i] + tbuf2.getBuffer()[i]; } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GlareSimpleStarOperation.h b/source/blender/compositor/operations/COM_GlareSimpleStarOperation.h index 0f5913fcef9..4a074f53e7b 100644 --- a/source/blender/compositor/operations/COM_GlareSimpleStarOperation.h +++ b/source/blender/compositor/operations/COM_GlareSimpleStarOperation.h @@ -22,6 +22,8 @@ #include "COM_NodeOperation.h" #include "DNA_node_types.h" +namespace blender::compositor { + class GlareSimpleStarOperation : public GlareBaseOperation { public: GlareSimpleStarOperation() : GlareBaseOperation() @@ -29,5 +31,7 @@ class GlareSimpleStarOperation : public GlareBaseOperation { } protected: - void generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings); + void generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GlareStreaksOperation.cc b/source/blender/compositor/operations/COM_GlareStreaksOperation.cc index 0ea277881da..0af4eb43624 100644 --- a/source/blender/compositor/operations/COM_GlareStreaksOperation.cc +++ b/source/blender/compositor/operations/COM_GlareStreaksOperation.cc @@ -19,6 +19,8 @@ #include "COM_GlareStreaksOperation.h" #include "BLI_math.h" +namespace blender::compositor { + void GlareStreaksOperation::generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings) @@ -97,3 +99,5 @@ void GlareStreaksOperation::generateGlare(float *data, nump++; } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GlareStreaksOperation.h b/source/blender/compositor/operations/COM_GlareStreaksOperation.h index df31981170d..487c910960a 100644 --- a/source/blender/compositor/operations/COM_GlareStreaksOperation.h +++ b/source/blender/compositor/operations/COM_GlareStreaksOperation.h @@ -22,6 +22,8 @@ #include "COM_NodeOperation.h" #include "DNA_node_types.h" +namespace blender::compositor { + class GlareStreaksOperation : public GlareBaseOperation { public: GlareStreaksOperation() : GlareBaseOperation() @@ -29,5 +31,7 @@ class GlareStreaksOperation : public GlareBaseOperation { } protected: - void generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings); + void generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GlareThresholdOperation.cc b/source/blender/compositor/operations/COM_GlareThresholdOperation.cc index 984b433469a..1d3402f5b7b 100644 --- a/source/blender/compositor/operations/COM_GlareThresholdOperation.cc +++ b/source/blender/compositor/operations/COM_GlareThresholdOperation.cc @@ -21,9 +21,11 @@ #include "IMB_colormanagement.h" +namespace blender::compositor { + GlareThresholdOperation::GlareThresholdOperation() { - this->addInputSocket(DataType::Color, COM_SC_FIT); + this->addInputSocket(DataType::Color, ResizeMode::FitAny); this->addOutputSocket(DataType::Color); this->m_inputProgram = nullptr; } @@ -67,3 +69,5 @@ void GlareThresholdOperation::deinitExecution() { this->m_inputProgram = nullptr; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GlareThresholdOperation.h b/source/blender/compositor/operations/COM_GlareThresholdOperation.h index 1e55f401ef3..a6e971dada7 100644 --- a/source/blender/compositor/operations/COM_GlareThresholdOperation.h +++ b/source/blender/compositor/operations/COM_GlareThresholdOperation.h @@ -21,6 +21,8 @@ #include "COM_NodeOperation.h" #include "DNA_light_types.h" +namespace blender::compositor { + class GlareThresholdOperation : public NodeOperation { private: /** @@ -39,22 +41,25 @@ class GlareThresholdOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; void setGlareSettings(NodeGlare *settings) { this->m_settings = settings; } - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); + void determineResolution(unsigned int resolution[2], + unsigned int preferredResolution[2]) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cc b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cc index 0ef15b2b3d7..e341a88ff71 100644 --- a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cc +++ b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cc @@ -22,6 +22,8 @@ #include "BKE_colortools.h" +namespace blender::compositor { + HueSaturationValueCorrectOperation::HueSaturationValueCorrectOperation() { this->addInputSocket(DataType::Color); @@ -70,3 +72,5 @@ void HueSaturationValueCorrectOperation::deinitExecution() CurveBaseOperation::deinitExecution(); this->m_inputProgram = nullptr; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h index dea7eae4a15..703b2894bdb 100644 --- a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h +++ b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h @@ -21,6 +21,8 @@ #include "COM_CurveBaseOperation.h" #include "COM_NodeOperation.h" +namespace blender::compositor { + class HueSaturationValueCorrectOperation : public CurveBaseOperation { private: /** @@ -34,15 +36,17 @@ class HueSaturationValueCorrectOperation : public CurveBaseOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_IDMaskOperation.cc b/source/blender/compositor/operations/COM_IDMaskOperation.cc index 8757908e354..1bb247e9bc5 100644 --- a/source/blender/compositor/operations/COM_IDMaskOperation.cc +++ b/source/blender/compositor/operations/COM_IDMaskOperation.cc @@ -18,11 +18,13 @@ #include "COM_IDMaskOperation.h" +namespace blender::compositor { + IDMaskOperation::IDMaskOperation() { this->addInputSocket(DataType::Value); this->addOutputSocket(DataType::Value); - this->setComplex(true); + this->flags.complex = true; } void *IDMaskOperation::initializeTileData(rcti *rect) @@ -39,3 +41,5 @@ void IDMaskOperation::executePixel(float output[4], int x, int y, void *data) int buffer_index = (y * buffer_width + x); output[0] = (roundf(buffer[buffer_index]) == this->m_objectIndex) ? 1.0f : 0.0f; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_IDMaskOperation.h b/source/blender/compositor/operations/COM_IDMaskOperation.h index abd2a719371..79b7e53b67c 100644 --- a/source/blender/compositor/operations/COM_IDMaskOperation.h +++ b/source/blender/compositor/operations/COM_IDMaskOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class IDMaskOperation : public NodeOperation { private: float m_objectIndex; @@ -27,11 +29,13 @@ class IDMaskOperation : public NodeOperation { public: IDMaskOperation(); - void *initializeTileData(rcti *rect); - void executePixel(float output[4], int x, int y, void *data); + void *initializeTileData(rcti *rect) override; + void executePixel(float output[4], int x, int y, void *data) override; void setObjectIndex(float objectIndex) { this->m_objectIndex = objectIndex; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ImageOperation.cc b/source/blender/compositor/operations/COM_ImageOperation.cc index 06e8db7b467..a1d401d4499 100644 --- a/source/blender/compositor/operations/COM_ImageOperation.cc +++ b/source/blender/compositor/operations/COM_ImageOperation.cc @@ -31,6 +31,8 @@ #include "RE_pipeline.h" #include "RE_texture.h" +namespace blender::compositor { + BaseImageOperation::BaseImageOperation() { this->m_image = nullptr; @@ -123,13 +125,13 @@ static void sampleImageAtLocation( { if (ibuf->rect_float) { switch (sampler) { - case COM_PS_NEAREST: + case PixelSampler::Nearest: nearest_interpolation_color(ibuf, nullptr, color, x, y); break; - case COM_PS_BILINEAR: + case PixelSampler::Bilinear: bilinear_interpolation_color(ibuf, nullptr, color, x, y); break; - case COM_PS_BICUBIC: + case PixelSampler::Bicubic: bicubic_interpolation_color(ibuf, nullptr, color, x, y); break; } @@ -137,13 +139,13 @@ static void sampleImageAtLocation( else { unsigned char byte_color[4]; switch (sampler) { - case COM_PS_NEAREST: + case PixelSampler::Nearest: nearest_interpolation_color(ibuf, byte_color, nullptr, x, y); break; - case COM_PS_BILINEAR: + case PixelSampler::Bilinear: bilinear_interpolation_color(ibuf, byte_color, nullptr, x, y); break; - case COM_PS_BICUBIC: + case PixelSampler::Bicubic: bicubic_interpolation_color(ibuf, byte_color, nullptr, x, y); break; } @@ -203,3 +205,5 @@ void ImageDepthOperation::executePixelSampled(float output[4], } } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ImageOperation.h b/source/blender/compositor/operations/COM_ImageOperation.h index bff8dcc1cea..58373663db5 100644 --- a/source/blender/compositor/operations/COM_ImageOperation.h +++ b/source/blender/compositor/operations/COM_ImageOperation.h @@ -27,6 +27,8 @@ #include "RE_pipeline.h" #include "RE_texture.h" +namespace blender::compositor { + /** * \brief Base class for all image operations */ @@ -49,13 +51,14 @@ class BaseImageOperation : public NodeOperation { /** * Determine the output resolution. The resolution is retrieved from the Renderer */ - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); + void determineResolution(unsigned int resolution[2], + unsigned int preferredResolution[2]) override; virtual ImBuf *getImBuf(); public: - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; void setImage(Image *image) { this->m_image = image; @@ -83,7 +86,7 @@ class ImageOperation : public BaseImageOperation { * Constructor */ ImageOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class ImageAlphaOperation : public BaseImageOperation { public: @@ -91,7 +94,7 @@ class ImageAlphaOperation : public BaseImageOperation { * Constructor */ ImageAlphaOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class ImageDepthOperation : public BaseImageOperation { public: @@ -99,5 +102,7 @@ class ImageDepthOperation : public BaseImageOperation { * Constructor */ ImageDepthOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_InpaintOperation.cc b/source/blender/compositor/operations/COM_InpaintOperation.cc index f4e38c85e50..413ed2694a9 100644 --- a/source/blender/compositor/operations/COM_InpaintOperation.cc +++ b/source/blender/compositor/operations/COM_InpaintOperation.cc @@ -23,6 +23,8 @@ #include "BLI_math.h" +namespace blender::compositor { + #define ASSERT_XY_RANGE(x, y) \ BLI_assert(x >= 0 && x < this->getWidth() && y >= 0 && y < this->getHeight()) @@ -31,7 +33,7 @@ InpaintSimpleOperation::InpaintSimpleOperation() { this->addInputSocket(DataType::Color); this->addOutputSocket(DataType::Color); - this->setComplex(true); + this->flags.complex = true; this->m_inputImageProgram = nullptr; this->m_pixelorder = nullptr; this->m_manhattan_distance = nullptr; @@ -76,7 +78,8 @@ float *InpaintSimpleOperation::get_pixel(int x, int y) ASSERT_XY_RANGE(x, y); - return &this->m_cached_buffer[y * width * COM_NUM_CHANNELS_COLOR + x * COM_NUM_CHANNELS_COLOR]; + return &this->m_cached_buffer[y * width * COM_DATA_TYPE_COLOR_CHANNELS + + x * COM_DATA_TYPE_COLOR_CHANNELS]; } int InpaintSimpleOperation::mdist(int x, int y) @@ -282,3 +285,5 @@ bool InpaintSimpleOperation::determineDependingAreaOfInterest(rcti * /*input*/, return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_InpaintOperation.h b/source/blender/compositor/operations/COM_InpaintOperation.h index 4c43e433dec..e3d27bf7704 100644 --- a/source/blender/compositor/operations/COM_InpaintOperation.h +++ b/source/blender/compositor/operations/COM_InpaintOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class InpaintSimpleOperation : public NodeOperation { protected: /** @@ -42,18 +44,18 @@ class InpaintSimpleOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; - void *initializeTileData(rcti *rect); + void *initializeTileData(rcti *rect) override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; void setIterations(int iterations) { @@ -62,7 +64,7 @@ class InpaintSimpleOperation : public NodeOperation { bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; private: void calc_manhattan_distance(); @@ -72,3 +74,5 @@ class InpaintSimpleOperation : public NodeOperation { bool next_pixel(int &x, int &y, int &curr, int iters); void pix_step(int x, int y); }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_InvertOperation.cc b/source/blender/compositor/operations/COM_InvertOperation.cc index 53e32baaa3d..339e40a5d1f 100644 --- a/source/blender/compositor/operations/COM_InvertOperation.cc +++ b/source/blender/compositor/operations/COM_InvertOperation.cc @@ -18,6 +18,8 @@ #include "COM_InvertOperation.h" +namespace blender::compositor { + InvertOperation::InvertOperation() { this->addInputSocket(DataType::Value); @@ -67,3 +69,5 @@ void InvertOperation::deinitExecution() this->m_inputValueProgram = nullptr; this->m_inputColorProgram = nullptr; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_InvertOperation.h b/source/blender/compositor/operations/COM_InvertOperation.h index ac0b1c3ab2e..17e5eb95f3e 100644 --- a/source/blender/compositor/operations/COM_InvertOperation.h +++ b/source/blender/compositor/operations/COM_InvertOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class InvertOperation : public NodeOperation { private: /** @@ -37,17 +39,17 @@ class InvertOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; void setColor(bool color) { @@ -58,3 +60,5 @@ class InvertOperation : public NodeOperation { this->m_alpha = alpha; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_KeyingBlurOperation.cc b/source/blender/compositor/operations/COM_KeyingBlurOperation.cc index 0d9613eea96..994b00cd3f4 100644 --- a/source/blender/compositor/operations/COM_KeyingBlurOperation.cc +++ b/source/blender/compositor/operations/COM_KeyingBlurOperation.cc @@ -23,6 +23,8 @@ #include "BLI_listbase.h" #include "BLI_math.h" +namespace blender::compositor { + KeyingBlurOperation::KeyingBlurOperation() { this->addInputSocket(DataType::Value); @@ -31,7 +33,7 @@ KeyingBlurOperation::KeyingBlurOperation() this->m_size = 0; this->m_axis = BLUR_AXIS_X; - this->setComplex(true); + this->flags.complex = true; } void *KeyingBlurOperation::initializeTileData(rcti *rect) @@ -93,3 +95,5 @@ bool KeyingBlurOperation::determineDependingAreaOfInterest(rcti *input, return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_KeyingBlurOperation.h b/source/blender/compositor/operations/COM_KeyingBlurOperation.h index 6a2b43a6cd4..b055d7713f1 100644 --- a/source/blender/compositor/operations/COM_KeyingBlurOperation.h +++ b/source/blender/compositor/operations/COM_KeyingBlurOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + /** * Class with implementation of blurring for keying node */ @@ -45,11 +47,13 @@ class KeyingBlurOperation : public NodeOperation { this->m_axis = value; } - void *initializeTileData(rcti *rect); + void *initializeTileData(rcti *rect) override; - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_KeyingClipOperation.cc b/source/blender/compositor/operations/COM_KeyingClipOperation.cc index e8556d9d8c9..4029be4e077 100644 --- a/source/blender/compositor/operations/COM_KeyingClipOperation.cc +++ b/source/blender/compositor/operations/COM_KeyingClipOperation.cc @@ -23,6 +23,8 @@ #include "BLI_listbase.h" #include "BLI_math.h" +namespace blender::compositor { + KeyingClipOperation::KeyingClipOperation() { this->addInputSocket(DataType::Value); @@ -36,7 +38,7 @@ KeyingClipOperation::KeyingClipOperation() this->m_isEdgeMatte = false; - this->setComplex(true); + this->flags.complex = true; } void *KeyingClipOperation::initializeTileData(rcti *rect) @@ -127,3 +129,5 @@ bool KeyingClipOperation::determineDependingAreaOfInterest(rcti *input, return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_KeyingClipOperation.h b/source/blender/compositor/operations/COM_KeyingClipOperation.h index 9d876966e96..0a21fb48c99 100644 --- a/source/blender/compositor/operations/COM_KeyingClipOperation.h +++ b/source/blender/compositor/operations/COM_KeyingClipOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + /** * Class with implementation of black/white clipping for keying node */ @@ -59,11 +61,13 @@ class KeyingClipOperation : public NodeOperation { this->m_isEdgeMatte = value; } - void *initializeTileData(rcti *rect); + void *initializeTileData(rcti *rect) override; - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_KeyingDespillOperation.cc b/source/blender/compositor/operations/COM_KeyingDespillOperation.cc index 5caa450a878..d31a88cb91e 100644 --- a/source/blender/compositor/operations/COM_KeyingDespillOperation.cc +++ b/source/blender/compositor/operations/COM_KeyingDespillOperation.cc @@ -23,6 +23,8 @@ #include "BLI_listbase.h" #include "BLI_math.h" +namespace blender::compositor { + KeyingDespillOperation::KeyingDespillOperation() { this->addInputSocket(DataType::Color); @@ -79,3 +81,5 @@ void KeyingDespillOperation::executePixelSampled(float output[4], output[screen_primary_channel] = pixelColor[screen_primary_channel] - amount_despill; } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_KeyingDespillOperation.h b/source/blender/compositor/operations/COM_KeyingDespillOperation.h index 32df7939c43..279ac60e6e9 100644 --- a/source/blender/compositor/operations/COM_KeyingDespillOperation.h +++ b/source/blender/compositor/operations/COM_KeyingDespillOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + /** * Class with implementation of keying despill node */ @@ -33,8 +35,8 @@ class KeyingDespillOperation : public NodeOperation { public: KeyingDespillOperation(); - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; void setDespillFactor(float value) { @@ -45,5 +47,7 @@ class KeyingDespillOperation : public NodeOperation { this->m_colorBalance = value; } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_KeyingOperation.cc b/source/blender/compositor/operations/COM_KeyingOperation.cc index 108b7c60874..e786e4b8219 100644 --- a/source/blender/compositor/operations/COM_KeyingOperation.cc +++ b/source/blender/compositor/operations/COM_KeyingOperation.cc @@ -23,6 +23,8 @@ #include "BLI_listbase.h" #include "BLI_math.h" +namespace blender::compositor { + static float get_pixel_saturation(const float pixelColor[4], float screen_balance, int primary_channel) @@ -107,3 +109,5 @@ void KeyingOperation::executePixelSampled(float output[4], float x, float y, Pix } } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_KeyingOperation.h b/source/blender/compositor/operations/COM_KeyingOperation.h index 946d7bdc1f7..3d41ecaa0f6 100644 --- a/source/blender/compositor/operations/COM_KeyingOperation.h +++ b/source/blender/compositor/operations/COM_KeyingOperation.h @@ -24,6 +24,8 @@ #include "BLI_listbase.h" +namespace blender::compositor { + /** * Class with implementation of keying node */ @@ -37,13 +39,15 @@ class KeyingOperation : public NodeOperation { public: KeyingOperation(); - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; void setScreenBalance(float value) { this->m_screenBalance = value; } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_KeyingScreenOperation.cc b/source/blender/compositor/operations/COM_KeyingScreenOperation.cc index 801750d99d0..17b613246ad 100644 --- a/source/blender/compositor/operations/COM_KeyingScreenOperation.cc +++ b/source/blender/compositor/operations/COM_KeyingScreenOperation.cc @@ -30,13 +30,15 @@ #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" +namespace blender::compositor { + KeyingScreenOperation::KeyingScreenOperation() { this->addOutputSocket(DataType::Color); this->m_movieClip = nullptr; this->m_framenumber = 0; this->m_trackingObject[0] = 0; - setComplex(true); + flags.complex = true; } void KeyingScreenOperation::initExecution() @@ -344,3 +346,5 @@ void KeyingScreenOperation::executePixel(float output[4], int x, int y, void *da } } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_KeyingScreenOperation.h b/source/blender/compositor/operations/COM_KeyingScreenOperation.h index 595301bb951..4118d229be9 100644 --- a/source/blender/compositor/operations/COM_KeyingScreenOperation.h +++ b/source/blender/compositor/operations/COM_KeyingScreenOperation.h @@ -29,6 +29,8 @@ #include "BLI_voronoi_2d.h" +namespace blender::compositor { + /** * Class with implementation of green screen gradient rasterization */ @@ -54,18 +56,19 @@ class KeyingScreenOperation : public NodeOperation { /** * Determine the output resolution. The resolution is retrieved from the Renderer */ - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); + void determineResolution(unsigned int resolution[2], + unsigned int preferredResolution[2]) override; TriangulationData *buildVoronoiTriangulation(); public: KeyingScreenOperation(); - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; - void *initializeTileData(rcti *rect); - void deinitializeTileData(rcti *rect, void *data); + void *initializeTileData(rcti *rect) override; + void deinitializeTileData(rcti *rect, void *data) override; void setMovieClip(MovieClip *clip) { @@ -80,5 +83,7 @@ class KeyingScreenOperation : public NodeOperation { this->m_framenumber = framenumber; } - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cc b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cc index 43cc8f8bf71..0afc4278a45 100644 --- a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cc +++ b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cc @@ -21,6 +21,8 @@ #include "IMB_colormanagement.h" +namespace blender::compositor { + LuminanceMatteOperation::LuminanceMatteOperation() { addInputSocket(DataType::Color); @@ -75,3 +77,5 @@ void LuminanceMatteOperation::executePixelSampled(float output[4], /* don't make something that was more transparent less transparent */ output[0] = min_ff(alpha, inColor[3]); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_LuminanceMatteOperation.h b/source/blender/compositor/operations/COM_LuminanceMatteOperation.h index 2c3a61d8755..035c68b9d59 100644 --- a/source/blender/compositor/operations/COM_LuminanceMatteOperation.h +++ b/source/blender/compositor/operations/COM_LuminanceMatteOperation.h @@ -20,6 +20,8 @@ #include "COM_MixOperation.h" +namespace blender::compositor { + /** * this program converts an input color to an output value. * it assumes we are in sRGB color space. @@ -38,13 +40,15 @@ class LuminanceMatteOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; void setSettings(NodeChroma *nodeChroma) { this->m_settings = nodeChroma; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_MapRangeOperation.cc b/source/blender/compositor/operations/COM_MapRangeOperation.cc index 78ba446051e..ada3cd6f159 100644 --- a/source/blender/compositor/operations/COM_MapRangeOperation.cc +++ b/source/blender/compositor/operations/COM_MapRangeOperation.cc @@ -18,6 +18,8 @@ #include "COM_MapRangeOperation.h" +namespace blender::compositor { + MapRangeOperation::MapRangeOperation() { this->addInputSocket(DataType::Value); @@ -101,3 +103,5 @@ void MapRangeOperation::deinitExecution() this->m_destMinOperation = nullptr; this->m_destMaxOperation = nullptr; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_MapRangeOperation.h b/source/blender/compositor/operations/COM_MapRangeOperation.h index 95268d5699f..a544c59887e 100644 --- a/source/blender/compositor/operations/COM_MapRangeOperation.h +++ b/source/blender/compositor/operations/COM_MapRangeOperation.h @@ -21,6 +21,8 @@ #include "COM_NodeOperation.h" #include "DNA_texture_types.h" +namespace blender::compositor { + /** * this program converts an input color to an output value. * it assumes we are in sRGB color space. @@ -47,17 +49,17 @@ class MapRangeOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; /** * Clamp the output @@ -67,3 +69,5 @@ class MapRangeOperation : public NodeOperation { this->m_useClamp = value; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_MapUVOperation.cc b/source/blender/compositor/operations/COM_MapUVOperation.cc index 7328de7f49f..74e3d965d41 100644 --- a/source/blender/compositor/operations/COM_MapUVOperation.cc +++ b/source/blender/compositor/operations/COM_MapUVOperation.cc @@ -19,13 +19,15 @@ #include "COM_MapUVOperation.h" #include "BLI_math.h" +namespace blender::compositor { + MapUVOperation::MapUVOperation() { - this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE); + this->addInputSocket(DataType::Color, ResizeMode::None); this->addInputSocket(DataType::Vector); this->addOutputSocket(DataType::Color); this->m_alpha = 0.0f; - this->setComplex(true); + this->flags.complex = true; setResolutionInputSocketIndex(1); this->m_inputUVProgram = nullptr; @@ -89,7 +91,7 @@ bool MapUVOperation::read_uv(float x, float y, float &r_u, float &r_v, float &r_ } float vector[3]; - m_inputUVProgram->readSampled(vector, x, y, COM_PS_BILINEAR); + m_inputUVProgram->readSampled(vector, x, y, PixelSampler::Bilinear); r_u = vector[0] * m_inputColorProgram->getWidth(); r_v = vector[1] * m_inputColorProgram->getHeight(); r_alpha = vector[2]; @@ -183,3 +185,5 @@ bool MapUVOperation::determineDependingAreaOfInterest(rcti *input, return false; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_MapUVOperation.h b/source/blender/compositor/operations/COM_MapUVOperation.h index 66e70a7ab83..eb5f7d49122 100644 --- a/source/blender/compositor/operations/COM_MapUVOperation.h +++ b/source/blender/compositor/operations/COM_MapUVOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class MapUVOperation : public NodeOperation { private: /** @@ -38,24 +40,24 @@ class MapUVOperation : public NodeOperation { */ bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; void pixelTransform(const float xy[2], float r_uv[2], float r_deriv[2][2], float &r_alpha); /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; void setAlpha(float alpha) { @@ -65,3 +67,5 @@ class MapUVOperation : public NodeOperation { private: bool read_uv(float x, float y, float &r_u, float &r_v, float &r_alpha); }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_MapValueOperation.cc b/source/blender/compositor/operations/COM_MapValueOperation.cc index 9c28e3c2577..03fa80d220d 100644 --- a/source/blender/compositor/operations/COM_MapValueOperation.cc +++ b/source/blender/compositor/operations/COM_MapValueOperation.cc @@ -18,6 +18,8 @@ #include "COM_MapValueOperation.h" +namespace blender::compositor { + MapValueOperation::MapValueOperation() { this->addInputSocket(DataType::Value); @@ -57,3 +59,5 @@ void MapValueOperation::deinitExecution() { this->m_inputOperation = nullptr; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_MapValueOperation.h b/source/blender/compositor/operations/COM_MapValueOperation.h index 3de377ed0fc..eb7714714e9 100644 --- a/source/blender/compositor/operations/COM_MapValueOperation.h +++ b/source/blender/compositor/operations/COM_MapValueOperation.h @@ -21,6 +21,8 @@ #include "COM_NodeOperation.h" #include "DNA_texture_types.h" +namespace blender::compositor { + /** * this program converts an input color to an output value. * it assumes we are in sRGB color space. @@ -42,17 +44,17 @@ class MapValueOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; /** * \brief set the TexMapping settings @@ -62,3 +64,5 @@ class MapValueOperation : public NodeOperation { this->m_settings = settings; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_MaskOperation.cc b/source/blender/compositor/operations/COM_MaskOperation.cc index 64d8c9a5492..c7763f08e71 100644 --- a/source/blender/compositor/operations/COM_MaskOperation.cc +++ b/source/blender/compositor/operations/COM_MaskOperation.cc @@ -26,6 +26,8 @@ #include "BKE_lib_id.h" #include "BKE_mask.h" +namespace blender::compositor { + MaskOperation::MaskOperation() { this->addOutputSocket(DataType::Value); @@ -158,3 +160,5 @@ void MaskOperation::executePixelSampled(float output[4], output[0] /= this->m_rasterMaskHandleTot; } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_MaskOperation.h b/source/blender/compositor/operations/COM_MaskOperation.h index 67e6b64315c..48fd54b00fe 100644 --- a/source/blender/compositor/operations/COM_MaskOperation.h +++ b/source/blender/compositor/operations/COM_MaskOperation.h @@ -23,6 +23,11 @@ #include "DNA_mask_types.h" #include "IMB_imbuf_types.h" +/* Forward declarations. */ +struct MaskRasterHandle; + +namespace blender::compositor { + /** * Class with implementation of mask rasterization */ @@ -49,13 +54,14 @@ class MaskOperation : public NodeOperation { /** * Determine the output resolution. The resolution is retrieved from the Renderer */ - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); + void determineResolution(unsigned int resolution[2], + unsigned int preferredResolution[2]) override; public: MaskOperation(); - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; void setMask(Mask *mask) { @@ -91,5 +97,7 @@ class MaskOperation : public NodeOperation { this->m_frame_shutter = shutter; } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.cc b/source/blender/compositor/operations/COM_MathBaseOperation.cc index 57ccbe7792b..a94c14347fb 100644 --- a/source/blender/compositor/operations/COM_MathBaseOperation.cc +++ b/source/blender/compositor/operations/COM_MathBaseOperation.cc @@ -20,6 +20,8 @@ #include "BLI_math.h" +namespace blender::compositor { + MathBaseOperation::MathBaseOperation() { this->addInputSocket(DataType::Value); @@ -748,3 +750,5 @@ void MathSmoothMaxOperation::executePixelSampled(float output[4], clampIfNeeded(output); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.h b/source/blender/compositor/operations/COM_MathBaseOperation.h index 292326caded..69555524274 100644 --- a/source/blender/compositor/operations/COM_MathBaseOperation.h +++ b/source/blender/compositor/operations/COM_MathBaseOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + /** * this program converts an input color to an output value. * it assumes we are in sRGB color space. @@ -45,24 +47,20 @@ class MathBaseOperation : public NodeOperation { public: /** - * The inner loop of this operation. - */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) = 0; - - /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; /** * Determine resolution */ - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); + void determineResolution(unsigned int resolution[2], + unsigned int preferredResolution[2]) override; void setUseClamp(bool value) { @@ -75,49 +73,49 @@ class MathAddOperation : public MathBaseOperation { MathAddOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathSubtractOperation : public MathBaseOperation { public: MathSubtractOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathMultiplyOperation : public MathBaseOperation { public: MathMultiplyOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathDivideOperation : public MathBaseOperation { public: MathDivideOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathSineOperation : public MathBaseOperation { public: MathSineOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathCosineOperation : public MathBaseOperation { public: MathCosineOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathTangentOperation : public MathBaseOperation { public: MathTangentOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathHyperbolicSineOperation : public MathBaseOperation { @@ -125,21 +123,21 @@ class MathHyperbolicSineOperation : public MathBaseOperation { MathHyperbolicSineOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathHyperbolicCosineOperation : public MathBaseOperation { public: MathHyperbolicCosineOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathHyperbolicTangentOperation : public MathBaseOperation { public: MathHyperbolicTangentOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathArcSineOperation : public MathBaseOperation { @@ -147,70 +145,70 @@ class MathArcSineOperation : public MathBaseOperation { MathArcSineOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathArcCosineOperation : public MathBaseOperation { public: MathArcCosineOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathArcTangentOperation : public MathBaseOperation { public: MathArcTangentOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathPowerOperation : public MathBaseOperation { public: MathPowerOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathLogarithmOperation : public MathBaseOperation { public: MathLogarithmOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathMinimumOperation : public MathBaseOperation { public: MathMinimumOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathMaximumOperation : public MathBaseOperation { public: MathMaximumOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathRoundOperation : public MathBaseOperation { public: MathRoundOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathLessThanOperation : public MathBaseOperation { public: MathLessThanOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathGreaterThanOperation : public MathBaseOperation { public: MathGreaterThanOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathModuloOperation : public MathBaseOperation { @@ -218,7 +216,7 @@ class MathModuloOperation : public MathBaseOperation { MathModuloOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathAbsoluteOperation : public MathBaseOperation { @@ -226,7 +224,7 @@ class MathAbsoluteOperation : public MathBaseOperation { MathAbsoluteOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathRadiansOperation : public MathBaseOperation { @@ -234,7 +232,7 @@ class MathRadiansOperation : public MathBaseOperation { MathRadiansOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathDegreesOperation : public MathBaseOperation { @@ -242,7 +240,7 @@ class MathDegreesOperation : public MathBaseOperation { MathDegreesOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathArcTan2Operation : public MathBaseOperation { @@ -250,7 +248,7 @@ class MathArcTan2Operation : public MathBaseOperation { MathArcTan2Operation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathFloorOperation : public MathBaseOperation { @@ -258,7 +256,7 @@ class MathFloorOperation : public MathBaseOperation { MathFloorOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathCeilOperation : public MathBaseOperation { @@ -266,7 +264,7 @@ class MathCeilOperation : public MathBaseOperation { MathCeilOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathFractOperation : public MathBaseOperation { @@ -274,7 +272,7 @@ class MathFractOperation : public MathBaseOperation { MathFractOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathSqrtOperation : public MathBaseOperation { @@ -282,7 +280,7 @@ class MathSqrtOperation : public MathBaseOperation { MathSqrtOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathInverseSqrtOperation : public MathBaseOperation { @@ -290,7 +288,7 @@ class MathInverseSqrtOperation : public MathBaseOperation { MathInverseSqrtOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathSignOperation : public MathBaseOperation { @@ -298,7 +296,7 @@ class MathSignOperation : public MathBaseOperation { MathSignOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathExponentOperation : public MathBaseOperation { @@ -306,7 +304,7 @@ class MathExponentOperation : public MathBaseOperation { MathExponentOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathTruncOperation : public MathBaseOperation { @@ -314,7 +312,7 @@ class MathTruncOperation : public MathBaseOperation { MathTruncOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathSnapOperation : public MathBaseOperation { @@ -322,7 +320,7 @@ class MathSnapOperation : public MathBaseOperation { MathSnapOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathWrapOperation : public MathBaseOperation { @@ -330,7 +328,7 @@ class MathWrapOperation : public MathBaseOperation { MathWrapOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathPingpongOperation : public MathBaseOperation { @@ -338,7 +336,7 @@ class MathPingpongOperation : public MathBaseOperation { MathPingpongOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathCompareOperation : public MathBaseOperation { @@ -346,7 +344,7 @@ class MathCompareOperation : public MathBaseOperation { MathCompareOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathMultiplyAddOperation : public MathBaseOperation { @@ -354,7 +352,7 @@ class MathMultiplyAddOperation : public MathBaseOperation { MathMultiplyAddOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathSmoothMinOperation : public MathBaseOperation { @@ -362,7 +360,7 @@ class MathSmoothMinOperation : public MathBaseOperation { MathSmoothMinOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathSmoothMaxOperation : public MathBaseOperation { @@ -370,5 +368,7 @@ class MathSmoothMaxOperation : public MathBaseOperation { MathSmoothMaxOperation() : MathBaseOperation() { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_MixOperation.cc b/source/blender/compositor/operations/COM_MixOperation.cc index e70c59c6a01..70f3242c076 100644 --- a/source/blender/compositor/operations/COM_MixOperation.cc +++ b/source/blender/compositor/operations/COM_MixOperation.cc @@ -20,6 +20,8 @@ #include "BLI_math.h" +namespace blender::compositor { + /* ******** Mix Base Operation ******** */ MixBaseOperation::MixBaseOperation() @@ -944,3 +946,5 @@ void MixValueOperation::executePixelSampled(float output[4], clampIfNeeded(output); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_MixOperation.h b/source/blender/compositor/operations/COM_MixOperation.h index 2f6e03ca7a3..86200c9836e 100644 --- a/source/blender/compositor/operations/COM_MixOperation.h +++ b/source/blender/compositor/operations/COM_MixOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + /** * All this programs converts an input color to an output value. * it assumes we are in sRGB color space. @@ -52,19 +54,20 @@ class MixBaseOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); + void determineResolution(unsigned int resolution[2], + unsigned int preferredResolution[2]) override; void setUseValueAlphaMultiply(const bool value) { @@ -83,113 +86,115 @@ class MixBaseOperation : public NodeOperation { class MixAddOperation : public MixBaseOperation { public: MixAddOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MixBlendOperation : public MixBaseOperation { public: MixBlendOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MixColorBurnOperation : public MixBaseOperation { public: MixColorBurnOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MixColorOperation : public MixBaseOperation { public: MixColorOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MixDarkenOperation : public MixBaseOperation { public: MixDarkenOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MixDifferenceOperation : public MixBaseOperation { public: MixDifferenceOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MixDivideOperation : public MixBaseOperation { public: MixDivideOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MixDodgeOperation : public MixBaseOperation { public: MixDodgeOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MixGlareOperation : public MixBaseOperation { public: MixGlareOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MixHueOperation : public MixBaseOperation { public: MixHueOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MixLightenOperation : public MixBaseOperation { public: MixLightenOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MixLinearLightOperation : public MixBaseOperation { public: MixLinearLightOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MixMultiplyOperation : public MixBaseOperation { public: MixMultiplyOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MixOverlayOperation : public MixBaseOperation { public: MixOverlayOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MixSaturationOperation : public MixBaseOperation { public: MixSaturationOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MixScreenOperation : public MixBaseOperation { public: MixScreenOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MixSoftLightOperation : public MixBaseOperation { public: MixSoftLightOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MixSubtractOperation : public MixBaseOperation { public: MixSubtractOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MixValueOperation : public MixBaseOperation { public: MixValueOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cc b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cc index 3920b4c02bd..a9f187258b2 100644 --- a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cc +++ b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cc @@ -21,6 +21,8 @@ #include "BKE_movieclip.h" #include "BKE_tracking.h" +namespace blender::compositor { + MovieClipAttributeOperation::MovieClipAttributeOperation() { this->addOutputSocket(DataType::Value); @@ -80,3 +82,5 @@ void MovieClipAttributeOperation::determineResolution(unsigned int resolution[2] resolution[0] = preferredResolution[0]; resolution[1] = preferredResolution[1]; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h index 50ed6cdb69e..8507e98d08f 100644 --- a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h +++ b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h @@ -21,6 +21,8 @@ #include "COM_NodeOperation.h" #include "DNA_movieclip_types.h" +namespace blender::compositor { + typedef enum MovieClipAttribute { MCA_SCALE, MCA_X, @@ -45,13 +47,14 @@ class MovieClipAttributeOperation : public NodeOperation { */ MovieClipAttributeOperation(); - void initExecution(); + void initExecution() override; /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void determineResolution(unsigned int resolution[2], + unsigned int preferredResolution[2]) override; void setMovieClip(MovieClip *clip) { @@ -70,3 +73,5 @@ class MovieClipAttributeOperation : public NodeOperation { this->m_invert = invert; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_MovieClipOperation.cc b/source/blender/compositor/operations/COM_MovieClipOperation.cc index 5d5880e14b0..d93a75407c4 100644 --- a/source/blender/compositor/operations/COM_MovieClipOperation.cc +++ b/source/blender/compositor/operations/COM_MovieClipOperation.cc @@ -26,6 +26,8 @@ #include "IMB_imbuf.h" +namespace blender::compositor { + MovieClipBaseOperation::MovieClipBaseOperation() { this->m_movieClip = nullptr; @@ -101,13 +103,13 @@ void MovieClipBaseOperation::executePixelSampled(float output[4], } else { switch (sampler) { - case COM_PS_NEAREST: + case PixelSampler::Nearest: nearest_interpolation_color(ibuf, nullptr, output, x, y); break; - case COM_PS_BILINEAR: + case PixelSampler::Bilinear: bilinear_interpolation_color(ibuf, nullptr, output, x, y); break; - case COM_PS_BICUBIC: + case PixelSampler::Bicubic: bicubic_interpolation_color(ibuf, nullptr, output, x, y); break; } @@ -133,3 +135,5 @@ void MovieClipAlphaOperation::executePixelSampled(float output[4], MovieClipBaseOperation::executePixelSampled(result, x, y, sampler); output[0] = result[3]; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_MovieClipOperation.h b/source/blender/compositor/operations/COM_MovieClipOperation.h index 8897f85f77c..c853ea43762 100644 --- a/source/blender/compositor/operations/COM_MovieClipOperation.h +++ b/source/blender/compositor/operations/COM_MovieClipOperation.h @@ -23,6 +23,8 @@ #include "DNA_movieclip_types.h" #include "IMB_imbuf_types.h" +namespace blender::compositor { + /** * Base class for movie clip */ @@ -39,13 +41,14 @@ class MovieClipBaseOperation : public NodeOperation { /** * Determine the output resolution. The resolution is retrieved from the Renderer */ - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); + void determineResolution(unsigned int resolution[2], + unsigned int preferredResolution[2]) override; public: MovieClipBaseOperation(); - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; void setMovieClip(MovieClip *image) { this->m_movieClip = image; @@ -63,7 +66,7 @@ class MovieClipBaseOperation : public NodeOperation { { this->m_framenumber = framenumber; } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MovieClipOperation : public MovieClipBaseOperation { @@ -74,5 +77,7 @@ class MovieClipOperation : public MovieClipBaseOperation { class MovieClipAlphaOperation : public MovieClipBaseOperation { public: MovieClipAlphaOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.cc b/source/blender/compositor/operations/COM_MovieDistortionOperation.cc index fcd482a69ef..c8e045ea117 100644 --- a/source/blender/compositor/operations/COM_MovieDistortionOperation.cc +++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.cc @@ -23,6 +23,8 @@ #include "BLI_linklist.h" +namespace blender::compositor { + MovieDistortionOperation::MovieDistortionOperation(bool distortion) { this->addInputSocket(DataType::Color); @@ -107,10 +109,10 @@ void MovieDistortionOperation::executePixelSampled(float output[4], float u = out[0] * aspx /* + 0.5 * overscan * w */, v = (out[1] * aspy /* + 0.5 * overscan * h */) * pixel_aspect; - this->m_inputOperation->readSampled(output, u, v, COM_PS_BILINEAR); + this->m_inputOperation->readSampled(output, u, v, PixelSampler::Bilinear); } else { - this->m_inputOperation->readSampled(output, x, y, COM_PS_BILINEAR); + this->m_inputOperation->readSampled(output, x, y, PixelSampler::Bilinear); } } @@ -125,3 +127,5 @@ bool MovieDistortionOperation::determineDependingAreaOfInterest(rcti *input, newInput.ymax = input->ymax + m_margin[1]; return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.h b/source/blender/compositor/operations/COM_MovieDistortionOperation.h index f11ce485f97..631a62f7ebf 100644 --- a/source/blender/compositor/operations/COM_MovieDistortionOperation.h +++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.h @@ -24,6 +24,8 @@ #include "BKE_tracking.h" +namespace blender::compositor { + class MovieDistortionOperation : public NodeOperation { private: SocketReader *m_inputOperation; @@ -40,10 +42,10 @@ class MovieDistortionOperation : public NodeOperation { public: MovieDistortionOperation(bool distortion); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; void setMovieClip(MovieClip *clip) { @@ -55,5 +57,7 @@ class MovieDistortionOperation : public NodeOperation { } bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_MultilayerImageOperation.cc b/source/blender/compositor/operations/COM_MultilayerImageOperation.cc index 60936ee1939..647e93225e5 100644 --- a/source/blender/compositor/operations/COM_MultilayerImageOperation.cc +++ b/source/blender/compositor/operations/COM_MultilayerImageOperation.cc @@ -21,6 +21,8 @@ #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" +namespace blender::compositor { + MultilayerBaseOperation::MultilayerBaseOperation(RenderLayer *render_layer, RenderPass *render_pass, int view) @@ -49,7 +51,7 @@ ImBuf *MultilayerBaseOperation::getImBuf() return nullptr; } -std::unique_ptr<MetaData> MultilayerColorOperation::getMetaData() const +std::unique_ptr<MetaData> MultilayerColorOperation::getMetaData() { BLI_assert(this->m_buffer); MetaDataExtractCallbackData callback_data = {nullptr}; @@ -86,13 +88,13 @@ void MultilayerColorOperation::executePixelSampled(float output[4], else { if (this->m_numberOfChannels == 4) { switch (sampler) { - case COM_PS_NEAREST: + case PixelSampler::Nearest: nearest_interpolation_color(this->m_buffer, nullptr, output, x, y); break; - case COM_PS_BILINEAR: + case PixelSampler::Bilinear: bilinear_interpolation_color(this->m_buffer, nullptr, output, x, y); break; - case COM_PS_BICUBIC: + case PixelSampler::Bicubic: bicubic_interpolation_color(this->m_buffer, nullptr, output, x, y); break; } @@ -155,3 +157,5 @@ void MultilayerVectorOperation::executePixelSampled(float output[4], } } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_MultilayerImageOperation.h b/source/blender/compositor/operations/COM_MultilayerImageOperation.h index dceb57de140..6e6062cf854 100644 --- a/source/blender/compositor/operations/COM_MultilayerImageOperation.h +++ b/source/blender/compositor/operations/COM_MultilayerImageOperation.h @@ -20,6 +20,8 @@ #include "COM_ImageOperation.h" +namespace blender::compositor { + class MultilayerBaseOperation : public BaseImageOperation { private: int m_passId; @@ -45,7 +47,7 @@ class MultilayerColorOperation : public MultilayerBaseOperation { this->addOutputSocket(DataType::Color); } void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; - std::unique_ptr<MetaData> getMetaData() const override; + std::unique_ptr<MetaData> getMetaData() override; }; class MultilayerValueOperation : public MultilayerBaseOperation { @@ -67,3 +69,5 @@ class MultilayerVectorOperation : public MultilayerBaseOperation { } void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_NormalizeOperation.cc b/source/blender/compositor/operations/COM_NormalizeOperation.cc index fd3b951c842..faacb429f71 100644 --- a/source/blender/compositor/operations/COM_NormalizeOperation.cc +++ b/source/blender/compositor/operations/COM_NormalizeOperation.cc @@ -18,13 +18,15 @@ #include "COM_NormalizeOperation.h" +namespace blender::compositor { + NormalizeOperation::NormalizeOperation() { this->addInputSocket(DataType::Value); this->addOutputSocket(DataType::Value); this->m_imageReader = nullptr; this->m_cachedInstance = nullptr; - this->setComplex(true); + this->flags.complex = true; } void NormalizeOperation::initExecution() { @@ -124,3 +126,5 @@ void NormalizeOperation::deinitializeTileData(rcti * /*rect*/, void * /*data*/) { /* pass */ } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_NormalizeOperation.h b/source/blender/compositor/operations/COM_NormalizeOperation.h index 8090cf4973b..93d4a0fc67d 100644 --- a/source/blender/compositor/operations/COM_NormalizeOperation.h +++ b/source/blender/compositor/operations/COM_NormalizeOperation.h @@ -21,6 +21,8 @@ #include "COM_NodeOperation.h" #include "DNA_node_types.h" +namespace blender::compositor { + /** * \brief base class of normalize, implementing the simple normalize * \ingroup operation @@ -44,22 +46,24 @@ class NormalizeOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; - void *initializeTileData(rcti *rect); - void deinitializeTileData(rcti *rect, void *data); + void *initializeTileData(rcti *rect) override; + void deinitializeTileData(rcti *rect, void *data) override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cc b/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cc index 7044fe402eb..5b6f650d40e 100644 --- a/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cc +++ b/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cc @@ -37,6 +37,8 @@ #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" +namespace blender::compositor { + /************************************ OpenEXR Singlelayer Multiview ******************************/ OutputOpenExrSingleLayerMultiViewOperation::OutputOpenExrSingleLayerMultiViewOperation( @@ -380,3 +382,5 @@ void OutputStereoOperation::deinitExecution() } } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.h b/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.h index 258ac1f9e98..6230a6f306b 100644 --- a/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.h +++ b/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.h @@ -28,6 +28,8 @@ #include "intern/openexr/openexr_multi.h" +namespace blender::compositor { + class OutputOpenExrSingleLayerMultiViewOperation : public OutputSingleLayerOperation { private: public: @@ -42,7 +44,7 @@ class OutputOpenExrSingleLayerMultiViewOperation : public OutputSingleLayerOpera const bool saveAsRender); void *get_handle(const char *filename); - void deinitExecution(); + void deinitExecution() override; }; /* Writes inputs into OpenEXR multilayer channels. */ @@ -58,7 +60,7 @@ class OutputOpenExrMultiLayerMultiViewOperation : public OutputOpenExrMultiLayer const char *viewName); void *get_handle(const char *filename); - void deinitExecution(); + void deinitExecution() override; }; class OutputStereoOperation : public OutputSingleLayerOperation { @@ -78,5 +80,7 @@ class OutputStereoOperation : public OutputSingleLayerOperation { const char *viewName, const bool saveAsRender); void *get_handle(const char *filename); - void deinitExecution(); + void deinitExecution() override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.cc b/source/blender/compositor/operations/COM_OutputFileOperation.cc index a6135ef064c..5184cd42b9e 100644 --- a/source/blender/compositor/operations/COM_OutputFileOperation.cc +++ b/source/blender/compositor/operations/COM_OutputFileOperation.cc @@ -40,6 +40,8 @@ #include "RE_pipeline.h" +namespace blender::compositor { + void add_exr_channels(void *exrhandle, const char *layerName, const DataType datatype, @@ -191,7 +193,7 @@ static void write_buffer_rect(rcti *rect, for (y = y1; y < y2 && (!breaked); y++) { for (x = x1; x < x2 && (!breaked); x++) { - reader->readSampled(color, x, y, COM_PS_NEAREST); + reader->readSampled(color, x, y, PixelSampler::Nearest); for (i = 0; i < size; i++) { buffer[offset + i] = color[i]; @@ -328,7 +330,7 @@ void OutputOpenExrMultiLayerOperation::add_layer(const char *name, bool use_layer) { this->addInputSocket(datatype); - this->m_layers.push_back(OutputOpenExrLayer(name, datatype, use_layer)); + this->m_layers.append(OutputOpenExrLayer(name, datatype, use_layer)); } StampData *OutputOpenExrMultiLayerOperation::createStampData() const @@ -338,17 +340,16 @@ StampData *OutputOpenExrMultiLayerOperation::createStampData() const RenderResult render_result; StampData *stamp_data = BKE_stamp_info_from_scene_static(m_scene); render_result.stamp_data = stamp_data; - for (int i = 0; i < this->m_layers.size(); i++) { - const OutputOpenExrLayer *layer = &this->m_layers[i]; + for (const OutputOpenExrLayer &layer : m_layers) { /* Skip unconnected sockets. */ - if (layer->imageInput == nullptr) { + if (layer.imageInput == nullptr) { continue; } - std::unique_ptr<MetaData> meta_data = layer->imageInput->getMetaData(); + std::unique_ptr<MetaData> meta_data = layer.imageInput->getMetaData(); if (meta_data) { blender::StringRef layer_name = blender::bke::cryptomatte::BKE_cryptomatte_extract_layer_name( - blender::StringRef(layer->name, BLI_strnlen(layer->name, sizeof(layer->name)))); + blender::StringRef(layer.name, BLI_strnlen(layer.name, sizeof(layer.name)))); meta_data->replaceHashNeutralCryptomatteKeys(layer_name); meta_data->addToRenderResult(&render_result); } @@ -441,3 +442,5 @@ void OutputOpenExrMultiLayerOperation::deinitExecution() BKE_stamp_data_free(stamp_data); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.h b/source/blender/compositor/operations/COM_OutputFileOperation.h index ecc52355824..6415891032a 100644 --- a/source/blender/compositor/operations/COM_OutputFileOperation.h +++ b/source/blender/compositor/operations/COM_OutputFileOperation.h @@ -27,6 +27,8 @@ #include "intern/openexr/openexr_multi.h" +namespace blender::compositor { + /* Writes the image to a single-layer file. */ class OutputSingleLayerOperation : public NodeOperation { protected: @@ -57,22 +59,17 @@ class OutputSingleLayerOperation : public NodeOperation { const char *viewName, const bool saveAsRender); - void executeRegion(rcti *rect, unsigned int tileNumber); - bool isOutputOperation(bool /*rendering*/) const + void executeRegion(rcti *rect, unsigned int tileNumber) override; + bool isOutputOperation(bool /*rendering*/) const override { return true; } - void initExecution(); - void deinitExecution(); - CompositorPriority getRenderPriority() const + void initExecution() override; + void deinitExecution() override; + CompositorPriority getRenderPriority() const override { return CompositorPriority::Low; } - - bool isFileOutputOperation() const - { - return true; - } }; /* extra info for OpenEXR layers */ @@ -91,8 +88,6 @@ struct OutputOpenExrLayer { /* Writes inputs into OpenEXR multilayer channels. */ class OutputOpenExrMultiLayerOperation : public NodeOperation { protected: - typedef std::vector<OutputOpenExrLayer> LayerList; - const Scene *m_scene; const RenderData *m_rd; const bNodeTree *m_tree; @@ -100,7 +95,7 @@ class OutputOpenExrMultiLayerOperation : public NodeOperation { char m_path[FILE_MAX]; char m_exr_codec; bool m_exr_half_float; - LayerList m_layers; + blender::Vector<OutputOpenExrLayer> m_layers; const char *m_viewName; StampData *createStampData() const; @@ -116,22 +111,17 @@ class OutputOpenExrMultiLayerOperation : public NodeOperation { void add_layer(const char *name, DataType datatype, bool use_layer); - void executeRegion(rcti *rect, unsigned int tileNumber); - bool isOutputOperation(bool /*rendering*/) const + void executeRegion(rcti *rect, unsigned int tileNumber) override; + bool isOutputOperation(bool /*rendering*/) const override { return true; } - void initExecution(); - void deinitExecution(); - CompositorPriority getRenderPriority() const + void initExecution() override; + void deinitExecution() override; + CompositorPriority getRenderPriority() const override { return CompositorPriority::Low; } - - bool isFileOutputOperation() const - { - return true; - } }; void add_exr_channels(void *exrhandle, @@ -146,3 +136,5 @@ void free_exr_channels(void *exrhandle, const char *layerName, const DataType datatype); int get_datatype_size(DataType datatype); + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_PixelateOperation.cc b/source/blender/compositor/operations/COM_PixelateOperation.cc index 0d810c80ab4..94827cd1b02 100644 --- a/source/blender/compositor/operations/COM_PixelateOperation.cc +++ b/source/blender/compositor/operations/COM_PixelateOperation.cc @@ -18,6 +18,8 @@ #include "COM_PixelateOperation.h" +namespace blender::compositor { + PixelateOperation::PixelateOperation(DataType datatype) { this->addInputSocket(datatype); @@ -45,3 +47,5 @@ void PixelateOperation::executePixelSampled(float output[4], float ny = round(y); this->m_inputOperation->readSampled(output, nx, ny, sampler); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_PixelateOperation.h b/source/blender/compositor/operations/COM_PixelateOperation.h index c7595756d39..e8b272853da 100644 --- a/source/blender/compositor/operations/COM_PixelateOperation.h +++ b/source/blender/compositor/operations/COM_PixelateOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + /** * \brief Pixelate operation * @@ -44,12 +46,12 @@ class PixelateOperation : public NodeOperation { /** * \brief initialization of the execution */ - void initExecution(); + void initExecution() override; /** * \brief de-initialization of the execution */ - void deinitExecution(); + void deinitExecution() override; /** * \brief executePixel @@ -58,5 +60,7 @@ class PixelateOperation : public NodeOperation { * \param y: y-coordinate * \param sampler: sampler */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_PlaneCornerPinOperation.cc b/source/blender/compositor/operations/COM_PlaneCornerPinOperation.cc index bcf79e1c6c6..3577860b93d 100644 --- a/source/blender/compositor/operations/COM_PlaneCornerPinOperation.cc +++ b/source/blender/compositor/operations/COM_PlaneCornerPinOperation.cc @@ -26,6 +26,8 @@ #include "BKE_node.h" +namespace blender::compositor { + static bool check_corners(float corners[4][2]) { int i, next, prev; @@ -60,7 +62,7 @@ static void readCornersFromSockets(rcti *rect, SocketReader *readers[4], float c { for (int i = 0; i < 4; i++) { float result[4] = {0.0f, 0.0f, 0.0f, 0.0f}; - readers[i]->readSampled(result, rect->xmin, rect->ymin, COM_PS_NEAREST); + readers[i]->readSampled(result, rect->xmin, rect->ymin, PixelSampler::Nearest); corners[i][0] = result[0]; corners[i][1] = result[1]; } @@ -98,7 +100,7 @@ PlaneCornerPinMaskOperation::PlaneCornerPinMaskOperation() : m_corners_ready(fal * so we can use the initializeTileData function * to read corners from input sockets ... */ - setComplex(true); + flags.complex = true; } void PlaneCornerPinMaskOperation::initExecution() @@ -224,3 +226,5 @@ bool PlaneCornerPinWarpImageOperation::determineDependingAreaOfInterest( input, readOperation, output); #endif } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_PlaneCornerPinOperation.h b/source/blender/compositor/operations/COM_PlaneCornerPinOperation.h index 1e892465db8..91c0cd9e16b 100644 --- a/source/blender/compositor/operations/COM_PlaneCornerPinOperation.h +++ b/source/blender/compositor/operations/COM_PlaneCornerPinOperation.h @@ -27,6 +27,8 @@ #include "BLI_listbase.h" #include "BLI_string.h" +namespace blender::compositor { + class PlaneCornerPinMaskOperation : public PlaneDistortMaskOperation { private: bool m_corners_ready; @@ -34,12 +36,13 @@ class PlaneCornerPinMaskOperation : public PlaneDistortMaskOperation { public: PlaneCornerPinMaskOperation(); - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; - void *initializeTileData(rcti *rect); + void *initializeTileData(rcti *rect) override; - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); + void determineResolution(unsigned int resolution[2], + unsigned int preferredResolution[2]) override; }; class PlaneCornerPinWarpImageOperation : public PlaneDistortWarpImageOperation { @@ -49,12 +52,14 @@ class PlaneCornerPinWarpImageOperation : public PlaneDistortWarpImageOperation { public: PlaneCornerPinWarpImageOperation(); - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; - void *initializeTileData(rcti *rect); + void *initializeTileData(rcti *rect) override; bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc b/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc index 87f837973d2..46ae00dee34 100644 --- a/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc +++ b/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc @@ -29,6 +29,8 @@ #include "BKE_node.h" #include "BKE_tracking.h" +namespace blender::compositor { + /* ******** PlaneDistort WarpImage ******** */ BLI_INLINE void warpCoord(float x, float y, float matrix[3][3], float uv[2], float deriv[2][2]) @@ -46,12 +48,12 @@ BLI_INLINE void warpCoord(float x, float y, float matrix[3][3], float uv[2], flo PlaneDistortWarpImageOperation::PlaneDistortWarpImageOperation() { - this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE); + this->addInputSocket(DataType::Color, ResizeMode::None); this->addOutputSocket(DataType::Color); this->m_pixelReader = nullptr; this->m_motion_blur_samples = 1; this->m_motion_blur_shutter = 0.5f; - this->setComplex(true); + this->flags.complex = true; } void PlaneDistortWarpImageOperation::calculateCorners(const float corners[4][2], @@ -226,3 +228,5 @@ void PlaneDistortMaskOperation::executePixelSampled(float output[4], output[0] = (float)inside_counter / (this->m_osa * this->m_motion_blur_samples); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.h b/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.h index 6cc9456c13f..95e5c86bd4d 100644 --- a/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.h +++ b/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.h @@ -28,6 +28,8 @@ #include "BLI_listbase.h" #include "BLI_string.h" +namespace blender::compositor { + #define PLANE_DISTORT_MAX_SAMPLES 64 class PlaneDistortWarpImageOperation : public NodeOperation { @@ -46,14 +48,14 @@ class PlaneDistortWarpImageOperation : public NodeOperation { void calculateCorners(const float corners[4][2], bool normalized, int sample); - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; void setMotionBlurSamples(int samples) { @@ -82,9 +84,9 @@ class PlaneDistortMaskOperation : public NodeOperation { void calculateCorners(const float corners[4][2], bool normalized, int sample); - void initExecution(); + void initExecution() override; - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; void setMotionBlurSamples(int samples) { @@ -96,3 +98,5 @@ class PlaneDistortMaskOperation : public NodeOperation { this->m_motion_blur_shutter = shutter; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_PlaneTrackOperation.cc b/source/blender/compositor/operations/COM_PlaneTrackOperation.cc index 81a598e937b..565bde6c945 100644 --- a/source/blender/compositor/operations/COM_PlaneTrackOperation.cc +++ b/source/blender/compositor/operations/COM_PlaneTrackOperation.cc @@ -29,6 +29,8 @@ #include "BKE_node.h" #include "BKE_tracking.h" +namespace blender::compositor { + /* ******** PlaneTrackCommon ******** */ PlaneTrackCommon::PlaneTrackCommon() @@ -121,3 +123,5 @@ void PlaneTrackWarpImageOperation::initExecution() } } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_PlaneTrackOperation.h b/source/blender/compositor/operations/COM_PlaneTrackOperation.h index fc325c7db7d..95a7d536742 100644 --- a/source/blender/compositor/operations/COM_PlaneTrackOperation.h +++ b/source/blender/compositor/operations/COM_PlaneTrackOperation.h @@ -28,6 +28,8 @@ #include "BLI_listbase.h" #include "BLI_string.h" +namespace blender::compositor { + class PlaneTrackCommon { protected: MovieClip *m_movieClip; @@ -68,9 +70,10 @@ class PlaneTrackMaskOperation : public PlaneDistortMaskOperation, public PlaneTr { } - void initExecution(); + void initExecution() override; - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]) + void determineResolution(unsigned int resolution[2], + unsigned int preferredResolution[2]) override { PlaneTrackCommon::determineResolution(resolution, preferredResolution); @@ -86,12 +89,15 @@ class PlaneTrackWarpImageOperation : public PlaneDistortWarpImageOperation, { } - void initExecution(); + void initExecution() override; - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]) + void determineResolution(unsigned int resolution[2], + unsigned int preferredResolution[2]) override { PlaneTrackCommon::determineResolution(resolution, preferredResolution); unsigned int temp[2]; NodeOperation::determineResolution(temp, resolution); } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_PreviewOperation.cc b/source/blender/compositor/operations/COM_PreviewOperation.cc index 6d1199ab118..9a1990740f4 100644 --- a/source/blender/compositor/operations/COM_PreviewOperation.cc +++ b/source/blender/compositor/operations/COM_PreviewOperation.cc @@ -33,13 +33,15 @@ #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" +namespace blender::compositor { + PreviewOperation::PreviewOperation(const ColorManagedViewSettings *viewSettings, const ColorManagedDisplaySettings *displaySettings, const unsigned int defaultWidth, const unsigned int defaultHeight) { - this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE); + this->addInputSocket(DataType::Color, ResizeMode::None); this->m_preview = nullptr; this->m_outputBuffer = nullptr; this->m_input = nullptr; @@ -48,6 +50,8 @@ PreviewOperation::PreviewOperation(const ColorManagedViewSettings *viewSettings, this->m_displaySettings = displaySettings; this->m_defaultWidth = defaultWidth; this->m_defaultHeight = defaultHeight; + flags.use_viewer_border = true; + flags.is_preview_operation = true; } void PreviewOperation::verifyPreview(bNodeInstanceHash *previews, bNodeInstanceKey key) @@ -104,7 +108,7 @@ void PreviewOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/) color[1] = 0.0f; color[2] = 0.0f; color[3] = 1.0f; - this->m_input->readSampled(color, rx, ry, COM_PS_NEAREST); + this->m_input->readSampled(color, rx, ry, PixelSampler::Nearest); IMB_colormanagement_processor_apply_v4(cm_processor, color); rgba_float_to_uchar(this->m_outputBuffer + offset, color); offset += 4; @@ -166,3 +170,5 @@ CompositorPriority PreviewOperation::getRenderPriority() const { return CompositorPriority::Low; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_PreviewOperation.h b/source/blender/compositor/operations/COM_PreviewOperation.h index 03ae6a6c42e..5e2b27475a1 100644 --- a/source/blender/compositor/operations/COM_PreviewOperation.h +++ b/source/blender/compositor/operations/COM_PreviewOperation.h @@ -24,6 +24,8 @@ #include "DNA_color_types.h" #include "DNA_image_types.h" +namespace blender::compositor { + class PreviewOperation : public NodeOperation { protected: unsigned char *m_outputBuffer; @@ -47,21 +49,20 @@ class PreviewOperation : public NodeOperation { unsigned int defaultHeight); void verifyPreview(bNodeInstanceHash *previews, bNodeInstanceKey key); - bool isOutputOperation(bool /*rendering*/) const + bool isOutputOperation(bool /*rendering*/) const override { return !G.background; } - void initExecution(); - void deinitExecution(); - CompositorPriority getRenderPriority() const; + void initExecution() override; + void deinitExecution() override; + CompositorPriority getRenderPriority() const override; - void executeRegion(rcti *rect, unsigned int tileNumber); - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); + void executeRegion(rcti *rect, unsigned int tileNumber) override; + void determineResolution(unsigned int resolution[2], + unsigned int preferredResolution[2]) override; bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); - bool isPreviewOperation() const - { - return true; - } + rcti *output) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cc b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cc index 5494c3cd46b..93702d3f0cf 100644 --- a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cc +++ b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cc @@ -20,12 +20,14 @@ #include "BLI_math.h" #include "BLI_utildefines.h" +namespace blender::compositor { + ProjectorLensDistortionOperation::ProjectorLensDistortionOperation() { this->addInputSocket(DataType::Color); this->addInputSocket(DataType::Value); this->addOutputSocket(DataType::Color); - this->setComplex(true); + this->flags.complex = true; this->m_inputProgram = nullptr; this->m_dispersionAvailable = false; this->m_dispersion = 0.0f; @@ -103,7 +105,7 @@ void ProjectorLensDistortionOperation::updateDispersion() this->lockMutex(); if (!this->m_dispersionAvailable) { float result[4]; - this->getInputSocketReader(1)->readSampled(result, 1, 1, COM_PS_NEAREST); + this->getInputSocketReader(1)->readSampled(result, 1, 1, PixelSampler::Nearest); this->m_dispersion = result[0]; this->m_kr = 0.25f * max_ff(min_ff(this->m_dispersion, 1.0f), 0.0f); this->m_kr2 = this->m_kr * 20; @@ -111,3 +113,5 @@ void ProjectorLensDistortionOperation::updateDispersion() } this->unlockMutex(); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h index 96bede20623..bce61d3de15 100644 --- a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h +++ b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h @@ -21,6 +21,8 @@ #include "COM_NodeOperation.h" #include "DNA_node_types.h" +namespace blender::compositor { + class ProjectorLensDistortionOperation : public NodeOperation { private: /** @@ -39,22 +41,24 @@ class ProjectorLensDistortionOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; - void *initializeTileData(rcti *rect); + void *initializeTileData(rcti *rect) override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; void updateDispersion(); }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_QualityStepHelper.cc b/source/blender/compositor/operations/COM_QualityStepHelper.cc index c0d86314fb7..385e0bebca4 100644 --- a/source/blender/compositor/operations/COM_QualityStepHelper.cc +++ b/source/blender/compositor/operations/COM_QualityStepHelper.cc @@ -18,6 +18,8 @@ #include "COM_QualityStepHelper.h" +namespace blender::compositor { + QualityStepHelper::QualityStepHelper() { this->m_quality = CompositorQuality::High; @@ -64,3 +66,5 @@ void QualityStepHelper::initExecution(QualityHelper helper) break; } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_QualityStepHelper.h b/source/blender/compositor/operations/COM_QualityStepHelper.h index e437613fb29..bc2eaa88e3d 100644 --- a/source/blender/compositor/operations/COM_QualityStepHelper.h +++ b/source/blender/compositor/operations/COM_QualityStepHelper.h @@ -20,6 +20,8 @@ #include "COM_defines.h" +namespace blender::compositor { + typedef enum QualityHelper { COM_QH_INCREASE, COM_QH_MULTIPLY, @@ -54,3 +56,5 @@ class QualityStepHelper { this->m_quality = quality; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.cc b/source/blender/compositor/operations/COM_ReadBufferOperation.cc index 2977e6685d2..cc58f29e8d9 100644 --- a/source/blender/compositor/operations/COM_ReadBufferOperation.cc +++ b/source/blender/compositor/operations/COM_ReadBufferOperation.cc @@ -20,12 +20,15 @@ #include "COM_WriteBufferOperation.h" #include "COM_defines.h" +namespace blender::compositor { + ReadBufferOperation::ReadBufferOperation(DataType datatype) { this->addOutputSocket(datatype); this->m_single_value = false; this->m_offset = 0; this->m_buffer = nullptr; + flags.is_read_buffer_operation = true; } void *ReadBufferOperation::initializeTileData(rcti * /*rect*/) @@ -60,14 +63,14 @@ void ReadBufferOperation::executePixelSampled(float output[4], } else { switch (sampler) { - case COM_PS_NEAREST: + case PixelSampler::Nearest: m_buffer->read(output, x, y); break; - case COM_PS_BILINEAR: + case PixelSampler::Bilinear: default: m_buffer->readBilinear(output, x, y); break; - case COM_PS_BICUBIC: + case PixelSampler::Bicubic: m_buffer->readBilinear(output, x, y); break; } @@ -85,7 +88,7 @@ void ReadBufferOperation::executePixelExtend(float output[4], /* write buffer has a single value stored at (0,0) */ m_buffer->read(output, 0, 0); } - else if (sampler == COM_PS_NEAREST) { + else if (sampler == PixelSampler::Nearest) { m_buffer->read(output, x, y, extend_x, extend_y); } else { @@ -131,3 +134,5 @@ void ReadBufferOperation::updateMemoryBuffer() { this->m_buffer = this->getMemoryProxy()->getBuffer(); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.h b/source/blender/compositor/operations/COM_ReadBufferOperation.h index 2ada33906ef..981c09292af 100644 --- a/source/blender/compositor/operations/COM_ReadBufferOperation.h +++ b/source/blender/compositor/operations/COM_ReadBufferOperation.h @@ -22,6 +22,8 @@ #include "COM_MemoryProxy.h" #include "COM_NodeOperation.h" +namespace blender::compositor { + class ReadBufferOperation : public NodeOperation { private: MemoryProxy *m_memoryProxy; @@ -39,21 +41,18 @@ class ReadBufferOperation : public NodeOperation { { return this->m_memoryProxy; } - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); + void determineResolution(unsigned int resolution[2], + unsigned int preferredResolution[2]) override; - void *initializeTileData(rcti *rect); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void *initializeTileData(rcti *rect) override; + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; void executePixelExtend(float output[4], float x, float y, PixelSampler sampler, MemoryBufferExtend extend_x, MemoryBufferExtend extend_y); - void executePixelFiltered(float output[4], float x, float y, float dx[2], float dy[2]); - bool isReadBufferOperation() const - { - return true; - } + void executePixelFiltered(float output[4], float x, float y, float dx[2], float dy[2]) override; void setOffset(unsigned int offset) { this->m_offset = offset; @@ -64,11 +63,13 @@ class ReadBufferOperation : public NodeOperation { } bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); - MemoryBuffer *getInputMemoryBuffer(MemoryBuffer **memoryBuffers) + rcti *output) override; + MemoryBuffer *getInputMemoryBuffer(MemoryBuffer **memoryBuffers) override { return memoryBuffers[this->m_offset]; } void readResolutionFromWriteBuffer(); void updateMemoryBuffer(); }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.cc b/source/blender/compositor/operations/COM_RenderLayersProg.cc index d622e14b585..1ac451b95c2 100644 --- a/source/blender/compositor/operations/COM_RenderLayersProg.cc +++ b/source/blender/compositor/operations/COM_RenderLayersProg.cc @@ -32,6 +32,8 @@ #include "RE_pipeline.h" #include "RE_texture.h" +namespace blender::compositor { + /* ******** Render Layers Base Prog ******** */ RenderLayersProg::RenderLayersProg(const char *passName, DataType type, int elementsize) @@ -92,7 +94,7 @@ void RenderLayersProg::doInterpolation(float output[4], float x, float y, PixelS } switch (sampler) { - case COM_PS_NEAREST: { + case PixelSampler::Nearest: { offset = (iy * width + ix) * this->m_elementsize; if (this->m_elementsize == 1) { @@ -107,12 +109,12 @@ void RenderLayersProg::doInterpolation(float output[4], float x, float y, PixelS break; } - case COM_PS_BILINEAR: + case PixelSampler::Bilinear: BLI_bilinear_interpolation_fl( this->m_inputBuffer, output, width, height, this->m_elementsize, x, y); break; - case COM_PS_BICUBIC: + case PixelSampler::Bicubic: BLI_bicubic_interpolation_fl( this->m_inputBuffer, output, width, height, this->m_elementsize, x, y); break; @@ -216,7 +218,7 @@ void RenderLayersProg::determineResolution(unsigned int resolution[2], } } -std::unique_ptr<MetaData> RenderLayersProg::getMetaData() const +std::unique_ptr<MetaData> RenderLayersProg::getMetaData() { Scene *scene = this->getScene(); Render *re = (scene) ? RE_GetSceneRender(scene) : nullptr; @@ -306,3 +308,5 @@ void RenderLayersDepthProg::executePixelSampled(float output[4], output[0] = inputBuffer[offset]; } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.h b/source/blender/compositor/operations/COM_RenderLayersProg.h index a0d5bc2953b..33e4fb163c5 100644 --- a/source/blender/compositor/operations/COM_RenderLayersProg.h +++ b/source/blender/compositor/operations/COM_RenderLayersProg.h @@ -26,6 +26,8 @@ #include "RE_pipeline.h" +namespace blender::compositor { + /** * Base class for all renderlayeroperations * @@ -123,7 +125,7 @@ class RenderLayersProg : public NodeOperation { void deinitExecution() override; void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; - std::unique_ptr<MetaData> getMetaData() const override; + std::unique_ptr<MetaData> getMetaData() override; }; class RenderLayersAOOperation : public RenderLayersProg { @@ -132,7 +134,7 @@ class RenderLayersAOOperation : public RenderLayersProg { : RenderLayersProg(passName, type, elementsize) { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class RenderLayersAlphaProg : public RenderLayersProg { @@ -141,7 +143,7 @@ class RenderLayersAlphaProg : public RenderLayersProg { : RenderLayersProg(passName, type, elementsize) { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class RenderLayersDepthProg : public RenderLayersProg { @@ -150,5 +152,7 @@ class RenderLayersDepthProg : public RenderLayersProg { : RenderLayersProg(passName, type, elementsize) { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_RotateOperation.cc b/source/blender/compositor/operations/COM_RotateOperation.cc index c2105efe246..4fb3d324992 100644 --- a/source/blender/compositor/operations/COM_RotateOperation.cc +++ b/source/blender/compositor/operations/COM_RotateOperation.cc @@ -19,6 +19,8 @@ #include "COM_RotateOperation.h" #include "BLI_math.h" +namespace blender::compositor { + RotateOperation::RotateOperation() { this->addInputSocket(DataType::Color); @@ -48,7 +50,7 @@ inline void RotateOperation::ensureDegree() { if (!this->m_isDegreeSet) { float degree[4]; - this->m_degreeSocket->readSampled(degree, 0, 0, COM_PS_NEAREST); + this->m_degreeSocket->readSampled(degree, 0, 0, PixelSampler::Nearest); double rad; if (this->m_doDegree2RadConversion) { rad = DEG2RAD((double)degree[0]); @@ -105,3 +107,5 @@ bool RotateOperation::determineDependingAreaOfInterest(rcti *input, return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_RotateOperation.h b/source/blender/compositor/operations/COM_RotateOperation.h index 0ef4466671a..d76507f9816 100644 --- a/source/blender/compositor/operations/COM_RotateOperation.h +++ b/source/blender/compositor/operations/COM_RotateOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class RotateOperation : public NodeOperation { private: SocketReader *m_imageSocket; @@ -35,10 +37,10 @@ class RotateOperation : public NodeOperation { RotateOperation(); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - void initExecution(); - void deinitExecution(); + rcti *output) override; + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void initExecution() override; + void deinitExecution() override; void setDoDegree2RadConversion(bool abool) { this->m_doDegree2RadConversion = abool; @@ -46,3 +48,5 @@ class RotateOperation : public NodeOperation { void ensureDegree(); }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_SMAAOperation.cc b/source/blender/compositor/operations/COM_SMAAOperation.cc new file mode 100644 index 00000000000..38700c76f07 --- /dev/null +++ b/source/blender/compositor/operations/COM_SMAAOperation.cc @@ -0,0 +1,868 @@ +/* + * Copyright 2017, Blender Foundation. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor: IRIE Shinsuke + */ + +#include "COM_SMAAOperation.h" +#include "BLI_math.h" +#include "COM_SMAAAreaTexture.h" + +extern "C" { +#include "IMB_colormanagement.h" +} + +namespace blender::compositor { + +/* + * An implementation of Enhanced Subpixel Morphological Antialiasing (SMAA) + * + * The algorithm was proposed by: + * Jorge Jimenez, Jose I. Echevarria, Tiago Sousa, Diego Gutierrez + * + * http://www.iryoku.com/smaa/ + * + * This file is based on smaa-cpp: + * + * https://github.com/iRi-E/smaa-cpp + * + * Currently only SMAA 1x mode is provided, so the operation will be done + * with no spatial multisampling nor temporal supersampling. + * + * Note: This program assumes the screen coordinates are DirectX style, so + * the vertical direction is upside-down. "top" and "bottom" actually mean + * bottom and top, respectively. + */ + +/*-----------------------------------------------------------------------------*/ +/* Non-Configurable Defines */ + +#define SMAA_AREATEX_SIZE 80 +#define SMAA_AREATEX_MAX_DISTANCE 20 +#define SMAA_AREATEX_MAX_DISTANCE_DIAG 20 +#define SMAA_MAX_SEARCH_STEPS 362 /* 362 - 1 = 19^2 */ +#define SMAA_MAX_SEARCH_STEPS_DIAG 19 + +/*-----------------------------------------------------------------------------*/ +/* Internal Functions to Sample Pixel Color from Image */ + +static inline void sample(SocketReader *reader, int x, int y, float color[4]) +{ + if (x < 0 || x >= reader->getWidth() || y < 0 || y >= reader->getHeight()) { + color[0] = color[1] = color[2] = color[3] = 0.0; + return; + } + + reader->read(color, x, y, nullptr); +} + +static void sample_bilinear_vertical( + SocketReader *reader, int x, int y, float yoffset, float color[4]) +{ + float iy = floorf(yoffset); + float fy = yoffset - iy; + y += (int)iy; + + float color00[4], color01[4]; + + sample(reader, x + 0, y + 0, color00); + sample(reader, x + 0, y + 1, color01); + + color[0] = interpf(color01[0], color00[0], fy); + color[1] = interpf(color01[1], color00[1], fy); + color[2] = interpf(color01[2], color00[2], fy); + color[3] = interpf(color01[3], color00[3], fy); +} + +static void sample_bilinear_horizontal( + SocketReader *reader, int x, int y, float xoffset, float color[4]) +{ + float ix = floorf(xoffset); + float fx = xoffset - ix; + x += (int)ix; + + float color00[4], color10[4]; + + sample(reader, x + 0, y + 0, color00); + sample(reader, x + 1, y + 0, color10); + + color[0] = interpf(color10[0], color00[0], fx); + color[1] = interpf(color10[1], color00[1], fx); + color[2] = interpf(color10[2], color00[2], fx); + color[3] = interpf(color10[3], color00[3], fx); +} + +/*-----------------------------------------------------------------------------*/ +/* Internal Functions to Sample Blending Weights from AreaTex */ + +static inline const float *areatex_sample_internal(const float *areatex, int x, int y) +{ + return &areatex[(CLAMPIS(x, 0, SMAA_AREATEX_SIZE - 1) + + CLAMPIS(y, 0, SMAA_AREATEX_SIZE - 1) * SMAA_AREATEX_SIZE) * + 2]; +} + +/** + * We have the distance and both crossing edges. So, what are the areas + * at each side of current edge? + */ +static void area(int d1, int d2, int e1, int e2, float weights[2]) +{ + /* The areas texture is compressed quadratically: */ + float x = (float)(SMAA_AREATEX_MAX_DISTANCE * e1) + sqrtf((float)d1); + float y = (float)(SMAA_AREATEX_MAX_DISTANCE * e2) + sqrtf((float)d2); + + float ix = floorf(x), iy = floorf(y); + float fx = x - ix, fy = y - iy; + int X = (int)ix, Y = (int)iy; + + const float *weights00 = areatex_sample_internal(areatex, X + 0, Y + 0); + const float *weights10 = areatex_sample_internal(areatex, X + 1, Y + 0); + const float *weights01 = areatex_sample_internal(areatex, X + 0, Y + 1); + const float *weights11 = areatex_sample_internal(areatex, X + 1, Y + 1); + + weights[0] = interpf( + interpf(weights11[0], weights01[0], fx), interpf(weights10[0], weights00[0], fx), fy); + weights[1] = interpf( + interpf(weights11[1], weights01[1], fx), interpf(weights10[1], weights00[1], fx), fy); +} + +/** + * Similar to area(), this calculates the area corresponding to a certain + * diagonal distance and crossing edges 'e'. + */ +static void area_diag(int d1, int d2, int e1, int e2, float weights[2]) +{ + int x = SMAA_AREATEX_MAX_DISTANCE_DIAG * e1 + d1; + int y = SMAA_AREATEX_MAX_DISTANCE_DIAG * e2 + d2; + + const float *w = areatex_sample_internal(areatex_diag, x, y); + copy_v2_v2(weights, w); +} + +/*-----------------------------------------------------------------------------*/ +/* Edge Detection (First Pass) */ +/*-----------------------------------------------------------------------------*/ + +SMAAEdgeDetectionOperation::SMAAEdgeDetectionOperation() +{ + this->addInputSocket(DataType::Color); /* image */ + this->addInputSocket(DataType::Value); /* depth, material ID, etc. */ + this->addOutputSocket(DataType::Color); + this->flags.complex = true; + this->m_imageReader = nullptr; + this->m_valueReader = nullptr; + this->m_threshold = 0.1f; + this->m_contrast_limit = 2.0f; +} + +void SMAAEdgeDetectionOperation::initExecution() +{ + this->m_imageReader = this->getInputSocketReader(0); + this->m_valueReader = this->getInputSocketReader(1); +} + +void SMAAEdgeDetectionOperation::deinitExecution() +{ + this->m_imageReader = nullptr; + this->m_valueReader = nullptr; +} + +void SMAAEdgeDetectionOperation::setThreshold(float threshold) +{ + /* UI values are between 0 and 1 for simplicity but algorithm expects values between 0 and 0.5 */ + m_threshold = scalenorm(0, 0.5, threshold); +} + +void SMAAEdgeDetectionOperation::setLocalContrastAdaptationFactor(float factor) +{ + /* UI values are between 0 and 1 for simplicity but algorithm expects values between 1 and 10 */ + m_contrast_limit = scalenorm(1, 10, factor); +} + +bool SMAAEdgeDetectionOperation::determineDependingAreaOfInterest( + rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ + rcti newInput; + newInput.xmax = input->xmax + 1; + newInput.xmin = input->xmin - 2; + newInput.ymax = input->ymax + 1; + newInput.ymin = input->ymin - 2; + + return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); +} + +void SMAAEdgeDetectionOperation::executePixel(float output[4], int x, int y, void * /*data*/) +{ + float color[4]; + + /* Calculate luma deltas: */ + sample(m_imageReader, x, y, color); + float L = IMB_colormanagement_get_luminance(color); + sample(m_imageReader, x - 1, y, color); + float Lleft = IMB_colormanagement_get_luminance(color); + sample(m_imageReader, x, y - 1, color); + float Ltop = IMB_colormanagement_get_luminance(color); + float Dleft = fabsf(L - Lleft); + float Dtop = fabsf(L - Ltop); + + /* We do the usual threshold: */ + output[0] = (x > 0 && Dleft >= m_threshold) ? 1.0f : 0.0f; + output[1] = (y > 0 && Dtop >= m_threshold) ? 1.0f : 0.0f; + output[2] = 0.0f; + output[3] = 1.0f; + + /* Then discard if there is no edge: */ + if (is_zero_v2(output)) { + return; + } + + /* Calculate right and bottom deltas: */ + sample(m_imageReader, x + 1, y, color); + float Lright = IMB_colormanagement_get_luminance(color); + sample(m_imageReader, x, y + 1, color); + float Lbottom = IMB_colormanagement_get_luminance(color); + float Dright = fabsf(L - Lright); + float Dbottom = fabsf(L - Lbottom); + + /* Calculate the maximum delta in the direct neighborhood: */ + float maxDelta = fmaxf(fmaxf(Dleft, Dright), fmaxf(Dtop, Dbottom)); + + /* Calculate luma used for both left and top edges: */ + sample(m_imageReader, x - 1, y - 1, color); + float Llefttop = IMB_colormanagement_get_luminance(color); + + /* Left edge */ + if (output[0] != 0.0f) { + /* Calculate deltas around the left pixel: */ + sample(m_imageReader, x - 2, y, color); + float Lleftleft = IMB_colormanagement_get_luminance(color); + sample(m_imageReader, x - 1, y + 1, color); + float Lleftbottom = IMB_colormanagement_get_luminance(color); + float Dleftleft = fabsf(Lleft - Lleftleft); + float Dlefttop = fabsf(Lleft - Llefttop); + float Dleftbottom = fabsf(Lleft - Lleftbottom); + + /* Calculate the final maximum delta: */ + maxDelta = fmaxf(maxDelta, fmaxf(Dleftleft, fmaxf(Dlefttop, Dleftbottom))); + + /* Local contrast adaptation: */ + if (maxDelta > m_contrast_limit * Dleft) { + output[0] = 0.0f; + } + } + + /* Top edge */ + if (output[1] != 0.0f) { + /* Calculate top-top delta: */ + sample(m_imageReader, x, y - 2, color); + float Ltoptop = IMB_colormanagement_get_luminance(color); + sample(m_imageReader, x + 1, y - 1, color); + float Ltopright = IMB_colormanagement_get_luminance(color); + float Dtoptop = fabsf(Ltop - Ltoptop); + float Dtopleft = fabsf(Ltop - Llefttop); + float Dtopright = fabsf(Ltop - Ltopright); + + /* Calculate the final maximum delta: */ + maxDelta = fmaxf(maxDelta, fmaxf(Dtoptop, fmaxf(Dtopleft, Dtopright))); + + /* Local contrast adaptation: */ + if (maxDelta > m_contrast_limit * Dtop) { + output[1] = 0.0f; + } + } +} + +/*-----------------------------------------------------------------------------*/ +/* Blending Weight Calculation (Second Pass) */ +/*-----------------------------------------------------------------------------*/ + +SMAABlendingWeightCalculationOperation::SMAABlendingWeightCalculationOperation() +{ + this->addInputSocket(DataType::Color); /* edges */ + this->addOutputSocket(DataType::Color); + this->flags.complex = true; + this->m_imageReader = nullptr; + this->m_corner_rounding = 25; +} + +void *SMAABlendingWeightCalculationOperation::initializeTileData(rcti *rect) +{ + return getInputOperation(0)->initializeTileData(rect); +} + +void SMAABlendingWeightCalculationOperation::initExecution() +{ + this->m_imageReader = this->getInputSocketReader(0); +} + +void SMAABlendingWeightCalculationOperation::setCornerRounding(float rounding) +{ + /* UI values are between 0 and 1 for simplicity but algorithm expects values between 0 and 100 */ + m_corner_rounding = static_cast<int>(scalenorm(0, 100, rounding)); +} + +void SMAABlendingWeightCalculationOperation::executePixel(float output[4], + int x, + int y, + void * /*data*/) +{ + float edges[4], c[4]; + + zero_v4(output); + sample(m_imageReader, x, y, edges); + + /* Edge at north */ + if (edges[1] > 0.0f) { + /* Diagonals have both north and west edges, so calculating weights for them */ + /* in one of the boundaries is enough. */ + calculateDiagWeights(x, y, edges, output); + + /* We give priority to diagonals, so if we find a diagonal we skip */ + /* horizontal/vertical processing. */ + if (!is_zero_v2(output)) { + return; + } + + /* Find the distance to the left and the right: */ + int left = searchXLeft(x, y); + int right = searchXRight(x, y); + int d1 = x - left, d2 = right - x; + + /* Fetch the left and right crossing edges: */ + int e1 = 0, e2 = 0; + sample(m_imageReader, left, y - 1, c); + if (c[0] > 0.0) { + e1 += 1; + } + sample(m_imageReader, left, y, c); + if (c[0] > 0.0) { + e1 += 2; + } + sample(m_imageReader, right + 1, y - 1, c); + if (c[0] > 0.0) { + e2 += 1; + } + sample(m_imageReader, right + 1, y, c); + if (c[0] > 0.0) { + e2 += 2; + } + + /* Ok, we know how this pattern looks like, now it is time for getting */ + /* the actual area: */ + area(d1, d2, e1, e2, output); /* R, G */ + + /* Fix corners: */ + if (m_corner_rounding) { + detectHorizontalCornerPattern(output, left, right, y, d1, d2); + } + } + + /* Edge at west */ + if (edges[0] > 0.0f) { + /* Did we already do diagonal search for this west edge from the left neighboring pixel? */ + if (isVerticalSearchUnneeded(x, y)) { + return; + } + + /* Find the distance to the top and the bottom: */ + int top = searchYUp(x, y); + int bottom = searchYDown(x, y); + int d1 = y - top, d2 = bottom - y; + + /* Fetch the top ang bottom crossing edges: */ + int e1 = 0, e2 = 0; + sample(m_imageReader, x - 1, top, c); + if (c[1] > 0.0) { + e1 += 1; + } + sample(m_imageReader, x, top, c); + if (c[1] > 0.0) { + e1 += 2; + } + sample(m_imageReader, x - 1, bottom + 1, c); + if (c[1] > 0.0) { + e2 += 1; + } + sample(m_imageReader, x, bottom + 1, c); + if (c[1] > 0.0) { + e2 += 2; + } + + /* Get the area for this direction: */ + area(d1, d2, e1, e2, output + 2); /* B, A */ + + /* Fix corners: */ + if (m_corner_rounding) { + detectVerticalCornerPattern(output + 2, x, top, bottom, d1, d2); + } + } +} + +void SMAABlendingWeightCalculationOperation::deinitExecution() +{ + this->m_imageReader = nullptr; +} + +bool SMAABlendingWeightCalculationOperation::determineDependingAreaOfInterest( + rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ + rcti newInput; + + newInput.xmax = input->xmax + fmax(SMAA_MAX_SEARCH_STEPS, SMAA_MAX_SEARCH_STEPS_DIAG + 1); + newInput.xmin = input->xmin - + fmax(fmax(SMAA_MAX_SEARCH_STEPS - 1, 1), SMAA_MAX_SEARCH_STEPS_DIAG + 1); + newInput.ymax = input->ymax + fmax(SMAA_MAX_SEARCH_STEPS, SMAA_MAX_SEARCH_STEPS_DIAG); + newInput.ymin = input->ymin - + fmax(fmax(SMAA_MAX_SEARCH_STEPS - 1, 1), SMAA_MAX_SEARCH_STEPS_DIAG); + + return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); +} + +/*-----------------------------------------------------------------------------*/ +/* Diagonal Search Functions */ + +/** + * These functions allows to perform diagonal pattern searches. + */ +int SMAABlendingWeightCalculationOperation::searchDiag1(int x, int y, int dir, bool *found) +{ + float e[4]; + int end = x + SMAA_MAX_SEARCH_STEPS_DIAG * dir; + *found = false; + + while (x != end) { + x += dir; + y -= dir; + sample(m_imageReader, x, y, e); + if (e[1] == 0.0f) { + *found = true; + break; + } + if (e[0] == 0.0f) { + *found = true; + return (dir < 0) ? x : x - dir; + } + } + + return x - dir; +} + +int SMAABlendingWeightCalculationOperation::searchDiag2(int x, int y, int dir, bool *found) +{ + float e[4]; + int end = x + SMAA_MAX_SEARCH_STEPS_DIAG * dir; + *found = false; + + while (x != end) { + x += dir; + y += dir; + sample(m_imageReader, x, y, e); + if (e[1] == 0.0f) { + *found = true; + break; + } + sample(m_imageReader, x + 1, y, e); + if (e[0] == 0.0f) { + *found = true; + return (dir > 0) ? x : x - dir; + } + } + + return x - dir; +} + +/** + * This searches for diagonal patterns and returns the corresponding weights. + */ +void SMAABlendingWeightCalculationOperation::calculateDiagWeights(int x, + int y, + const float edges[2], + float weights[2]) +{ + int d1, d2; + bool d1_found, d2_found; + float e[4], c[4]; + + zero_v2(weights); + + if (SMAA_MAX_SEARCH_STEPS_DIAG <= 0) { + return; + } + + /* Search for the line ends: */ + if (edges[0] > 0.0f) { + d1 = x - searchDiag1(x, y, -1, &d1_found); + } + else { + d1 = 0; + d1_found = true; + } + d2 = searchDiag1(x, y, 1, &d2_found) - x; + + if (d1 + d2 > 2) { /* d1 + d2 + 1 > 3 */ + int e1 = 0, e2 = 0; + + if (d1_found) { + /* Fetch the crossing edges: */ + int left = x - d1, bottom = y + d1; + + sample(m_imageReader, left - 1, bottom, c); + if (c[1] > 0.0) { + e1 += 2; + } + sample(m_imageReader, left, bottom, c); + if (c[0] > 0.0) { + e1 += 1; + } + } + + if (d2_found) { + /* Fetch the crossing edges: */ + int right = x + d2, top = y - d2; + + sample(m_imageReader, right + 1, top, c); + if (c[1] > 0.0) { + e2 += 2; + } + sample(m_imageReader, right + 1, top - 1, c); + if (c[0] > 0.0) { + e2 += 1; + } + } + + /* Fetch the areas for this line: */ + area_diag(d1, d2, e1, e2, weights); + } + + /* Search for the line ends: */ + d1 = x - searchDiag2(x, y, -1, &d1_found); + sample(m_imageReader, x + 1, y, e); + if (e[0] > 0.0f) { + d2 = searchDiag2(x, y, 1, &d2_found) - x; + } + else { + d2 = 0; + d2_found = true; + } + + if (d1 + d2 > 2) { /* d1 + d2 + 1 > 3 */ + int e1 = 0, e2 = 0; + + if (d1_found) { + /* Fetch the crossing edges: */ + int left = x - d1, top = y - d1; + + sample(m_imageReader, left - 1, top, c); + if (c[1] > 0.0) { + e1 += 2; + } + sample(m_imageReader, left, top - 1, c); + if (c[0] > 0.0) { + e1 += 1; + } + } + + if (d2_found) { + /* Fetch the crossing edges: */ + int right = x + d2, bottom = y + d2; + + sample(m_imageReader, right + 1, bottom, c); + if (c[1] > 0.0) { + e2 += 2; + } + if (c[0] > 0.0) { + e2 += 1; + } + } + + /* Fetch the areas for this line: */ + float w[2]; + area_diag(d1, d2, e1, e2, w); + weights[0] += w[1]; + weights[1] += w[0]; + } +} + +bool SMAABlendingWeightCalculationOperation::isVerticalSearchUnneeded(int x, int y) +{ + int d1, d2; + bool found; + float e[4]; + + if (SMAA_MAX_SEARCH_STEPS_DIAG <= 0) { + return false; + } + + /* Search for the line ends: */ + sample(m_imageReader, x - 1, y, e); + if (e[1] > 0.0f) { + d1 = x - searchDiag2(x - 1, y, -1, &found); + } + else { + d1 = 0; + } + d2 = searchDiag2(x - 1, y, 1, &found) - x; + + return (d1 + d2 > 2); /* d1 + d2 + 1 > 3 */ +} + +/*-----------------------------------------------------------------------------*/ +/* Horizontal/Vertical Search Functions */ + +int SMAABlendingWeightCalculationOperation::searchXLeft(int x, int y) +{ + int end = x - SMAA_MAX_SEARCH_STEPS; + float e[4]; + + while (x > end) { + sample(m_imageReader, x, y, e); + if (e[1] == 0.0f) { /* Is the edge not activated? */ + break; + } + if (e[0] != 0.0f) { /* Or is there a crossing edge that breaks the line? */ + return x; + } + sample(m_imageReader, x, y - 1, e); + if (e[0] != 0.0f) { /* Or is there a crossing edge that breaks the line? */ + return x; + } + x--; + } + + return x + 1; +} + +int SMAABlendingWeightCalculationOperation::searchXRight(int x, int y) +{ + int end = x + SMAA_MAX_SEARCH_STEPS; + float e[4]; + + while (x < end) { + x++; + sample(m_imageReader, x, y, e); + if (e[1] == 0.0f || /* Is the edge not activated? */ + e[0] != 0.0f) { /* Or is there a crossing edge that breaks the line? */ + break; + } + sample(m_imageReader, x, y - 1, e); + if (e[0] != 0.0f) { /* Or is there a crossing edge that breaks the line? */ + break; + } + } + + return x - 1; +} + +int SMAABlendingWeightCalculationOperation::searchYUp(int x, int y) +{ + int end = y - SMAA_MAX_SEARCH_STEPS; + float e[4]; + + while (y > end) { + sample(m_imageReader, x, y, e); + if (e[0] == 0.0f) { /* Is the edge not activated? */ + break; + } + if (e[1] != 0.0f) { /* Or is there a crossing edge that breaks the line? */ + return y; + } + sample(m_imageReader, x - 1, y, e); + if (e[1] != 0.0f) { /* Or is there a crossing edge that breaks the line? */ + return y; + } + y--; + } + + return y + 1; +} + +int SMAABlendingWeightCalculationOperation::searchYDown(int x, int y) +{ + int end = y + SMAA_MAX_SEARCH_STEPS; + float e[4]; + + while (y < end) { + y++; + sample(m_imageReader, x, y, e); + if (e[0] == 0.0f || /* Is the edge not activated? */ + e[1] != 0.0f) { /* Or is there a crossing edge that breaks the line? */ + break; + } + sample(m_imageReader, x - 1, y, e); + if (e[1] != 0.0f) { /* Or is there a crossing edge that breaks the line? */ + break; + } + } + + return y - 1; +} + +/*-----------------------------------------------------------------------------*/ +/* Corner Detection Functions */ + +void SMAABlendingWeightCalculationOperation::detectHorizontalCornerPattern( + float weights[2], int left, int right, int y, int d1, int d2) +{ + float factor[2] = {1.0f, 1.0f}; + float rounding = m_corner_rounding / 100.0f; + float e[4]; + + /* Reduce blending for pixels in the center of a line. */ + rounding *= (d1 == d2) ? 0.5f : 1.0f; + + /* Near the left corner */ + if (d1 <= d2) { + sample(m_imageReader, left, y + 1, e); + factor[0] -= rounding * e[0]; + sample(m_imageReader, left, y - 2, e); + factor[1] -= rounding * e[0]; + } + /* Near the right corner */ + if (d1 >= d2) { + sample(m_imageReader, right + 1, y + 1, e); + factor[0] -= rounding * e[0]; + sample(m_imageReader, right + 1, y - 2, e); + factor[1] -= rounding * e[0]; + } + + weights[0] *= CLAMPIS(factor[0], 0.0f, 1.0f); + weights[1] *= CLAMPIS(factor[1], 0.0f, 1.0f); +} + +void SMAABlendingWeightCalculationOperation::detectVerticalCornerPattern( + float weights[2], int x, int top, int bottom, int d1, int d2) +{ + float factor[2] = {1.0f, 1.0f}; + float rounding = m_corner_rounding / 100.0f; + float e[4]; + + /* Reduce blending for pixels in the center of a line. */ + rounding *= (d1 == d2) ? 0.5f : 1.0f; + + /* Near the top corner */ + if (d1 <= d2) { + sample(m_imageReader, x + 1, top, e); + factor[0] -= rounding * e[1]; + sample(m_imageReader, x - 2, top, e); + factor[1] -= rounding * e[1]; + } + /* Near the bottom corner */ + if (d1 >= d2) { + sample(m_imageReader, x + 1, bottom + 1, e); + factor[0] -= rounding * e[1]; + sample(m_imageReader, x - 2, bottom + 1, e); + factor[1] -= rounding * e[1]; + } + + weights[0] *= CLAMPIS(factor[0], 0.0f, 1.0f); + weights[1] *= CLAMPIS(factor[1], 0.0f, 1.0f); +} + +/*-----------------------------------------------------------------------------*/ +/* Neighborhood Blending (Third Pass) */ +/*-----------------------------------------------------------------------------*/ + +SMAANeighborhoodBlendingOperation::SMAANeighborhoodBlendingOperation() +{ + this->addInputSocket(DataType::Color); /* image */ + this->addInputSocket(DataType::Color); /* blend */ + this->addOutputSocket(DataType::Color); + this->flags.complex = true; + this->m_image1Reader = nullptr; + this->m_image2Reader = nullptr; +} + +void *SMAANeighborhoodBlendingOperation::initializeTileData(rcti *rect) +{ + return getInputOperation(0)->initializeTileData(rect); +} + +void SMAANeighborhoodBlendingOperation::initExecution() +{ + this->m_image1Reader = this->getInputSocketReader(0); + this->m_image2Reader = this->getInputSocketReader(1); +} + +void SMAANeighborhoodBlendingOperation::executePixel(float output[4], + int x, + int y, + void * /*data*/) +{ + float w[4]; + + /* Fetch the blending weights for current pixel: */ + sample(m_image2Reader, x, y, w); + float left = w[2], top = w[0]; + sample(m_image2Reader, x + 1, y, w); + float right = w[3]; + sample(m_image2Reader, x, y + 1, w); + float bottom = w[1]; + + /* Is there any blending weight with a value greater than 0.0? */ + if (right + bottom + left + top < 1e-5f) { + sample(m_image1Reader, x, y, output); + return; + } + + /* Calculate the blending offsets: */ + void (*samplefunc)(SocketReader * reader, int x, int y, float xoffset, float color[4]); + float offset1, offset2, weight1, weight2, color1[4], color2[4]; + + if (fmaxf(right, left) > fmaxf(bottom, top)) { /* max(horizontal) > max(vertical) */ + samplefunc = sample_bilinear_horizontal; + offset1 = right; + offset2 = -left; + weight1 = right / (right + left); + weight2 = left / (right + left); + } + else { + samplefunc = sample_bilinear_vertical; + offset1 = bottom; + offset2 = -top; + weight1 = bottom / (bottom + top); + weight2 = top / (bottom + top); + } + + /* We exploit bilinear filtering to mix current pixel with the chosen neighbor: */ + samplefunc(m_image1Reader, x, y, offset1, color1); + samplefunc(m_image1Reader, x, y, offset2, color2); + + mul_v4_v4fl(output, color1, weight1); + madd_v4_v4fl(output, color2, weight2); +} + +void SMAANeighborhoodBlendingOperation::deinitExecution() +{ + this->m_image1Reader = nullptr; + this->m_image2Reader = nullptr; +} + +bool SMAANeighborhoodBlendingOperation::determineDependingAreaOfInterest( + rcti *input, ReadBufferOperation *readOperation, rcti *output) +{ + rcti newInput; + + newInput.xmax = input->xmax + 1; + newInput.xmin = input->xmin - 1; + newInput.ymax = input->ymax + 1; + newInput.ymin = input->ymin - 1; + + return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); +} + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_SMAAOperation.h b/source/blender/compositor/operations/COM_SMAAOperation.h new file mode 100644 index 00000000000..781762202b4 --- /dev/null +++ b/source/blender/compositor/operations/COM_SMAAOperation.h @@ -0,0 +1,149 @@ +/* + * Copyright 2017, Blender Foundation. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor: IRIE Shinsuke + */ + +#pragma once + +#include "COM_NodeOperation.h" + +namespace blender::compositor { + +/*-----------------------------------------------------------------------------*/ +/* Edge Detection (First Pass) */ + +class SMAAEdgeDetectionOperation : public NodeOperation { + protected: + SocketReader *m_imageReader; + SocketReader *m_valueReader; + + float m_threshold; + float m_contrast_limit; + + public: + SMAAEdgeDetectionOperation(); + + /** + * the inner loop of this program + */ + virtual void executePixel(float output[4], int x, int y, void *data) override; + + /** + * Initialize the execution + */ + void initExecution() override; + + /** + * Deinitialize the execution + */ + void deinitExecution() override; + + void setThreshold(float threshold); + + void setLocalContrastAdaptationFactor(float factor); + + bool determineDependingAreaOfInterest(rcti *input, + ReadBufferOperation *readOperation, + rcti *output) override; +}; + +/*-----------------------------------------------------------------------------*/ +/* Blending Weight Calculation (Second Pass) */ + +class SMAABlendingWeightCalculationOperation : public NodeOperation { + private: + SocketReader *m_imageReader; + + int m_corner_rounding; + + public: + SMAABlendingWeightCalculationOperation(); + + /** + * the inner loop of this program + */ + void executePixel(float output[4], int x, int y, void *data) override; + + /** + * Initialize the execution + */ + void initExecution() override; + void *initializeTileData(rcti *rect) override; + + /** + * Deinitialize the execution + */ + void deinitExecution() override; + + void setCornerRounding(float rounding); + + bool determineDependingAreaOfInterest(rcti *input, + ReadBufferOperation *readOperation, + rcti *output) override; + + private: + /* Diagonal Search Functions */ + int searchDiag1(int x, int y, int dir, bool *found); + int searchDiag2(int x, int y, int dir, bool *found); + void calculateDiagWeights(int x, int y, const float edges[2], float weights[2]); + bool isVerticalSearchUnneeded(int x, int y); + + /* Horizontal/Vertical Search Functions */ + int searchXLeft(int x, int y); + int searchXRight(int x, int y); + int searchYUp(int x, int y); + int searchYDown(int x, int y); + + /* Corner Detection Functions */ + void detectHorizontalCornerPattern(float weights[2], int left, int right, int y, int d1, int d2); + void detectVerticalCornerPattern(float weights[2], int x, int top, int bottom, int d1, int d2); +}; + +/*-----------------------------------------------------------------------------*/ +/* Neighborhood Blending (Third Pass) */ + +class SMAANeighborhoodBlendingOperation : public NodeOperation { + private: + SocketReader *m_image1Reader; + SocketReader *m_image2Reader; + + public: + SMAANeighborhoodBlendingOperation(); + + /** + * the inner loop of this program + */ + void executePixel(float output[4], int x, int y, void *data) override; + + /** + * Initialize the execution + */ + void initExecution() override; + void *initializeTileData(rcti *rect) override; + + /** + * Deinitialize the execution + */ + void deinitExecution() override; + + bool determineDependingAreaOfInterest(rcti *input, + ReadBufferOperation *readOperation, + rcti *output) override; +}; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ScaleOperation.cc b/source/blender/compositor/operations/COM_ScaleOperation.cc index b0c9bfb2663..03525d4ea01 100644 --- a/source/blender/compositor/operations/COM_ScaleOperation.cc +++ b/source/blender/compositor/operations/COM_ScaleOperation.cc @@ -18,6 +18,8 @@ #include "COM_ScaleOperation.h" +namespace blender::compositor { + #define USE_FORCE_BILINEAR /* XXX - ignore input and use default from old compositor, * could become an option like the transform node - campbell @@ -28,7 +30,7 @@ BaseScaleOperation::BaseScaleOperation() { #ifdef USE_FORCE_BILINEAR - m_sampler = (int)COM_PS_BILINEAR; + m_sampler = (int)PixelSampler::Bilinear; #else m_sampler = -1; #endif @@ -89,8 +91,8 @@ bool ScaleOperation::determineDependingAreaOfInterest(rcti *input, float scaleX[4]; float scaleY[4]; - this->m_inputXOperation->readSampled(scaleX, 0, 0, COM_PS_NEAREST); - this->m_inputYOperation->readSampled(scaleY, 0, 0, COM_PS_NEAREST); + this->m_inputXOperation->readSampled(scaleX, 0, 0, PixelSampler::Nearest); + this->m_inputYOperation->readSampled(scaleY, 0, 0, PixelSampler::Nearest); const float scx = scaleX[0]; const float scy = scaleY[0]; @@ -174,8 +176,8 @@ bool ScaleAbsoluteOperation::determineDependingAreaOfInterest(rcti *input, float scaleX[4]; float scaleY[4]; - this->m_inputXOperation->readSampled(scaleX, 0, 0, COM_PS_NEAREST); - this->m_inputYOperation->readSampled(scaleY, 0, 0, COM_PS_NEAREST); + this->m_inputXOperation->readSampled(scaleX, 0, 0, PixelSampler::Nearest); + this->m_inputYOperation->readSampled(scaleY, 0, 0, PixelSampler::Nearest); const float scx = scaleX[0]; const float scy = scaleY[0]; @@ -203,7 +205,7 @@ bool ScaleAbsoluteOperation::determineDependingAreaOfInterest(rcti *input, // Absolute fixed size ScaleFixedSizeOperation::ScaleFixedSizeOperation() : BaseScaleOperation() { - this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE); + this->addInputSocket(DataType::Color, ResizeMode::None); this->addOutputSocket(DataType::Color); this->setResolutionInputSocketIndex(0); this->m_inputOperation = nullptr; @@ -308,3 +310,5 @@ void ScaleFixedSizeOperation::determineResolution(unsigned int resolution[2], resolution[0] = this->m_newWidth; resolution[1] = this->m_newHeight; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ScaleOperation.h b/source/blender/compositor/operations/COM_ScaleOperation.h index f28b8237485..dc3de3602bf 100644 --- a/source/blender/compositor/operations/COM_ScaleOperation.h +++ b/source/blender/compositor/operations/COM_ScaleOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class BaseScaleOperation : public NodeOperation { public: void setSampler(PixelSampler sampler) @@ -55,11 +57,11 @@ class ScaleOperation : public BaseScaleOperation { ScaleOperation(); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + rcti *output) override; + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; }; class ScaleAbsoluteOperation : public BaseScaleOperation { @@ -73,11 +75,11 @@ class ScaleAbsoluteOperation : public BaseScaleOperation { ScaleAbsoluteOperation(); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + rcti *output) override; + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; }; class ScaleFixedSizeOperation : public BaseScaleOperation { @@ -100,12 +102,13 @@ class ScaleFixedSizeOperation : public BaseScaleOperation { ScaleFixedSizeOperation(); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + rcti *output) override; + void determineResolution(unsigned int resolution[2], + unsigned int preferredResolution[2]) override; + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; void setNewWidth(int width) { this->m_newWidth = width; @@ -128,3 +131,5 @@ class ScaleFixedSizeOperation : public BaseScaleOperation { this->m_offsetY = y; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc index d5918dfa6f5..634fe66b0dd 100644 --- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc +++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc @@ -24,13 +24,15 @@ #include "PIL_time.h" +namespace blender::compositor { + ScreenLensDistortionOperation::ScreenLensDistortionOperation() { this->addInputSocket(DataType::Color); this->addInputSocket(DataType::Value); this->addInputSocket(DataType::Value); this->addOutputSocket(DataType::Color); - this->setComplex(true); + this->flags.complex = true; this->m_inputProgram = nullptr; this->m_distortion = 0.0f; this->m_dispersion = 0.0f; @@ -83,12 +85,12 @@ void *ScreenLensDistortionOperation::initializeTileData(rcti * /*rect*/) if (!m_distortion_const) { float result[4]; - getInputSocketReader(1)->readSampled(result, 0, 0, COM_PS_NEAREST); + getInputSocketReader(1)->readSampled(result, 0, 0, PixelSampler::Nearest); m_distortion = result[0]; } if (!m_dispersion_const) { float result[4]; - getInputSocketReader(2)->readSampled(result, 0, 0, COM_PS_NEAREST); + getInputSocketReader(2)->readSampled(result, 0, 0, PixelSampler::Nearest); m_dispersion = result[0]; } @@ -351,3 +353,5 @@ void ScreenLensDistortionOperation::updateVariables(float distortion, float disp mul_v3_v3fl(m_k4, m_k, 4.0f); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h index 35d2bccce68..98872bfe142 100644 --- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h +++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h @@ -21,6 +21,10 @@ #include "COM_NodeOperation.h" #include "DNA_node_types.h" +struct RNG; + +namespace blender::compositor { + class ScreenLensDistortionOperation : public NodeOperation { private: /** @@ -49,18 +53,18 @@ class ScreenLensDistortionOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; - void *initializeTileData(rcti *rect); + void *initializeTileData(rcti *rect) override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; void setFit(bool fit) { @@ -78,7 +82,7 @@ class ScreenLensDistortionOperation : public NodeOperation { bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; private: void determineUV(float result[6], float x, float y) const; @@ -96,3 +100,5 @@ class ScreenLensDistortionOperation : public NodeOperation { float sum[4], int count[3]) const; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_SetAlphaMultiplyOperation.cc b/source/blender/compositor/operations/COM_SetAlphaMultiplyOperation.cc index 3151bad5e4a..24edbc61d40 100644 --- a/source/blender/compositor/operations/COM_SetAlphaMultiplyOperation.cc +++ b/source/blender/compositor/operations/COM_SetAlphaMultiplyOperation.cc @@ -18,6 +18,8 @@ #include "COM_SetAlphaMultiplyOperation.h" +namespace blender::compositor { + SetAlphaMultiplyOperation::SetAlphaMultiplyOperation() { this->addInputSocket(DataType::Color); @@ -53,3 +55,5 @@ void SetAlphaMultiplyOperation::deinitExecution() this->m_inputColor = nullptr; this->m_inputAlpha = nullptr; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_SetAlphaMultiplyOperation.h b/source/blender/compositor/operations/COM_SetAlphaMultiplyOperation.h index db58b18688a..b4eea659fa2 100644 --- a/source/blender/compositor/operations/COM_SetAlphaMultiplyOperation.h +++ b/source/blender/compositor/operations/COM_SetAlphaMultiplyOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + /** * This operation will apply a mask to its input image. * @@ -33,8 +35,10 @@ class SetAlphaMultiplyOperation : public NodeOperation { public: SetAlphaMultiplyOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_SetAlphaReplaceOperation.cc b/source/blender/compositor/operations/COM_SetAlphaReplaceOperation.cc index cd9bf039f3e..90bfc814b09 100644 --- a/source/blender/compositor/operations/COM_SetAlphaReplaceOperation.cc +++ b/source/blender/compositor/operations/COM_SetAlphaReplaceOperation.cc @@ -18,6 +18,8 @@ #include "COM_SetAlphaReplaceOperation.h" +namespace blender::compositor { + SetAlphaReplaceOperation::SetAlphaReplaceOperation() { this->addInputSocket(DataType::Color); @@ -51,3 +53,5 @@ void SetAlphaReplaceOperation::deinitExecution() this->m_inputColor = nullptr; this->m_inputAlpha = nullptr; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_SetAlphaReplaceOperation.h b/source/blender/compositor/operations/COM_SetAlphaReplaceOperation.h index b4cab82855b..c84299b6d82 100644 --- a/source/blender/compositor/operations/COM_SetAlphaReplaceOperation.h +++ b/source/blender/compositor/operations/COM_SetAlphaReplaceOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + /** * this program converts an input color to an output value. * it assumes we are in sRGB color space. @@ -38,8 +40,10 @@ class SetAlphaReplaceOperation : public NodeOperation { /** * the inner loop of this program */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_SetColorOperation.cc b/source/blender/compositor/operations/COM_SetColorOperation.cc index b08381963fd..dbe45fa60db 100644 --- a/source/blender/compositor/operations/COM_SetColorOperation.cc +++ b/source/blender/compositor/operations/COM_SetColorOperation.cc @@ -18,9 +18,12 @@ #include "COM_SetColorOperation.h" +namespace blender::compositor { + SetColorOperation::SetColorOperation() { this->addOutputSocket(DataType::Color); + flags.is_set_operation = true; } void SetColorOperation::executePixelSampled(float output[4], @@ -37,3 +40,5 @@ void SetColorOperation::determineResolution(unsigned int resolution[2], resolution[0] = preferredResolution[0]; resolution[1] = preferredResolution[1]; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_SetColorOperation.h b/source/blender/compositor/operations/COM_SetColorOperation.h index c61a4e10ac0..4b9b80013d4 100644 --- a/source/blender/compositor/operations/COM_SetColorOperation.h +++ b/source/blender/compositor/operations/COM_SetColorOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + /** * this program converts an input color to an output value. * it assumes we are in sRGB color space. @@ -74,11 +76,10 @@ class SetColorOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); - bool isSetOperation() const - { - return true; - } + void determineResolution(unsigned int resolution[2], + unsigned int preferredResolution[2]) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_SetSamplerOperation.cc b/source/blender/compositor/operations/COM_SetSamplerOperation.cc index 8272ad7583d..e68774736f3 100644 --- a/source/blender/compositor/operations/COM_SetSamplerOperation.cc +++ b/source/blender/compositor/operations/COM_SetSamplerOperation.cc @@ -18,6 +18,8 @@ #include "COM_SetSamplerOperation.h" +namespace blender::compositor { + SetSamplerOperation::SetSamplerOperation() { this->addInputSocket(DataType::Color); @@ -40,3 +42,5 @@ void SetSamplerOperation::executePixelSampled(float output[4], { this->m_reader->readSampled(output, x, y, this->m_sampler); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_SetSamplerOperation.h b/source/blender/compositor/operations/COM_SetSamplerOperation.h index 5c1ed9b12d6..d355d937806 100644 --- a/source/blender/compositor/operations/COM_SetSamplerOperation.h +++ b/source/blender/compositor/operations/COM_SetSamplerOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + /** * this program converts an input color to an output Sampler. * it assumes we are in sRGB color space. @@ -43,7 +45,9 @@ class SetSamplerOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - void initExecution(); - void deinitExecution(); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void initExecution() override; + void deinitExecution() override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_SetValueOperation.cc b/source/blender/compositor/operations/COM_SetValueOperation.cc index 98d0ad630ad..ef43cf64653 100644 --- a/source/blender/compositor/operations/COM_SetValueOperation.cc +++ b/source/blender/compositor/operations/COM_SetValueOperation.cc @@ -18,9 +18,12 @@ #include "COM_SetValueOperation.h" +namespace blender::compositor { + SetValueOperation::SetValueOperation() { this->addOutputSocket(DataType::Value); + flags.is_set_operation = true; } void SetValueOperation::executePixelSampled(float output[4], @@ -37,3 +40,5 @@ void SetValueOperation::determineResolution(unsigned int resolution[2], resolution[0] = preferredResolution[0]; resolution[1] = preferredResolution[1]; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_SetValueOperation.h b/source/blender/compositor/operations/COM_SetValueOperation.h index 72cd70ec1f6..5383f3b5fd3 100644 --- a/source/blender/compositor/operations/COM_SetValueOperation.h +++ b/source/blender/compositor/operations/COM_SetValueOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + /** * this program converts an input color to an output value. * it assumes we are in sRGB color space. @@ -46,11 +48,9 @@ class SetValueOperation : public NodeOperation { /** * The inner loop of this operation. */ - 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; - } + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void determineResolution(unsigned int resolution[2], + unsigned int preferredResolution[2]) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_SetVectorOperation.cc b/source/blender/compositor/operations/COM_SetVectorOperation.cc index 6b6bcad02f3..7152d5e61d4 100644 --- a/source/blender/compositor/operations/COM_SetVectorOperation.cc +++ b/source/blender/compositor/operations/COM_SetVectorOperation.cc @@ -19,9 +19,12 @@ #include "COM_SetVectorOperation.h" #include "COM_defines.h" +namespace blender::compositor { + SetVectorOperation::SetVectorOperation() { this->addOutputSocket(DataType::Vector); + flags.is_set_operation = true; } void SetVectorOperation::executePixelSampled(float output[4], @@ -40,3 +43,5 @@ void SetVectorOperation::determineResolution(unsigned int resolution[2], resolution[0] = preferredResolution[0]; resolution[1] = preferredResolution[1]; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_SetVectorOperation.h b/source/blender/compositor/operations/COM_SetVectorOperation.h index 4bdd03809de..b444339fcb2 100644 --- a/source/blender/compositor/operations/COM_SetVectorOperation.h +++ b/source/blender/compositor/operations/COM_SetVectorOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + /** * this program converts an input color to an output value. * it assumes we are in sRGB color space. @@ -73,13 +75,10 @@ class SetVectorOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); - bool isSetOperation() const - { - return true; - } + void determineResolution(unsigned int resolution[2], + unsigned int preferredResolution[2]) override; void setVector(const float vector[3]) { @@ -88,3 +87,5 @@ class SetVectorOperation : public NodeOperation { setZ(vector[2]); } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_SocketProxyOperation.cc b/source/blender/compositor/operations/COM_SocketProxyOperation.cc index 53f5fea8795..39876439b7b 100644 --- a/source/blender/compositor/operations/COM_SocketProxyOperation.cc +++ b/source/blender/compositor/operations/COM_SocketProxyOperation.cc @@ -18,14 +18,19 @@ #include "COM_SocketProxyOperation.h" +namespace blender::compositor { + SocketProxyOperation::SocketProxyOperation(DataType type, bool use_conversion) - : m_use_conversion(use_conversion) { this->addInputSocket(type); this->addOutputSocket(type); + flags.is_proxy_operation = true; + flags.use_datatype_conversion = use_conversion; } -std::unique_ptr<MetaData> SocketProxyOperation::getMetaData() const +std::unique_ptr<MetaData> SocketProxyOperation::getMetaData() { return this->getInputSocket(0)->getReader()->getMetaData(); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_SocketProxyOperation.h b/source/blender/compositor/operations/COM_SocketProxyOperation.h index 712347a8ea2..1d3b76055bd 100644 --- a/source/blender/compositor/operations/COM_SocketProxyOperation.h +++ b/source/blender/compositor/operations/COM_SocketProxyOperation.h @@ -20,29 +20,13 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class SocketProxyOperation : public NodeOperation { public: SocketProxyOperation(DataType type, bool use_conversion); - bool isProxyOperation() const override - { - return true; - } - bool useDatatypeConversion() const override - { - return m_use_conversion; - } - - bool getUseConversion() const - { - return m_use_conversion; - } - void setUseConversion(bool use_conversion) - { - m_use_conversion = use_conversion; - } - std::unique_ptr<MetaData> getMetaData() const override; - - private: - bool m_use_conversion; + std::unique_ptr<MetaData> getMetaData() override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_SplitOperation.cc b/source/blender/compositor/operations/COM_SplitOperation.cc index 25438259973..a4754de370d 100644 --- a/source/blender/compositor/operations/COM_SplitOperation.cc +++ b/source/blender/compositor/operations/COM_SplitOperation.cc @@ -27,6 +27,8 @@ #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" +namespace blender::compositor { + SplitOperation::SplitOperation() { this->addInputSocket(DataType::Color); @@ -58,10 +60,10 @@ void SplitOperation::executePixelSampled(float output[4], this->m_splitPercentage * this->getHeight() / 100.0f; bool image1 = this->m_xSplit ? x > perc : y > perc; if (image1) { - this->m_image1Input->readSampled(output, x, y, COM_PS_NEAREST); + this->m_image1Input->readSampled(output, x, y, PixelSampler::Nearest); } else { - this->m_image2Input->readSampled(output, x, y, COM_PS_NEAREST); + this->m_image2Input->readSampled(output, x, y, PixelSampler::Nearest); } } @@ -76,3 +78,5 @@ void SplitOperation::determineResolution(unsigned int resolution[2], NodeOperation::determineResolution(resolution, preferredResolution); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_SplitOperation.h b/source/blender/compositor/operations/COM_SplitOperation.h index 62d41a615ff..09e48821dd0 100644 --- a/source/blender/compositor/operations/COM_SplitOperation.h +++ b/source/blender/compositor/operations/COM_SplitOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class SplitOperation : public NodeOperation { private: SocketReader *m_image1Input; @@ -30,10 +32,11 @@ class SplitOperation : public NodeOperation { public: SplitOperation(); - void initExecution(); - void deinitExecution(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); + void initExecution() override; + void deinitExecution() override; + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void determineResolution(unsigned int resolution[2], + unsigned int preferredResolution[2]) override; void setSplitPercentage(float splitPercentage) { this->m_splitPercentage = splitPercentage; @@ -43,3 +46,5 @@ class SplitOperation : public NodeOperation { this->m_xSplit = xsplit; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_SunBeamsOperation.cc b/source/blender/compositor/operations/COM_SunBeamsOperation.cc index 23bf5897297..839eeb9ff8f 100644 --- a/source/blender/compositor/operations/COM_SunBeamsOperation.cc +++ b/source/blender/compositor/operations/COM_SunBeamsOperation.cc @@ -19,13 +19,15 @@ #include "COM_SunBeamsOperation.h" +namespace blender::compositor { + SunBeamsOperation::SunBeamsOperation() { this->addInputSocket(DataType::Color); this->addOutputSocket(DataType::Color); this->setResolutionInputSocketIndex(0); - this->setComplex(true); + this->flags.complex = true; } void SunBeamsOperation::initExecution() @@ -138,7 +140,7 @@ template<int fxu, int fxv, int fyu, int fyv> struct BufferLineAccumulator { falloff_factor = dist_max > dist_min ? dr / (float)(dist_max - dist_min) : 0.0f; - float *iter = input->getBuffer() + COM_NUM_CHANNELS_COLOR * (x + input->getWidth() * y); + float *iter = input->getBuffer() + COM_DATA_TYPE_COLOR_CHANNELS * (x + input->getWidth() * y); return iter; } @@ -167,7 +169,7 @@ template<int fxu, int fxv, int fyu, int fyv> struct BufferLineAccumulator { if ((int)(co[0] - source[0]) == 0 && (int)(co[1] - source[1]) == 0) { copy_v4_v4(output, - input->getBuffer() + COM_NUM_CHANNELS_COLOR * + input->getBuffer() + COM_DATA_TYPE_COLOR_CHANNELS * ((int)source[0] + input->getWidth() * (int)source[1])); return; } @@ -208,7 +210,7 @@ template<int fxu, int fxv, int fyu, int fyv> struct BufferLineAccumulator { /* decrement u */ x -= fxu; y -= fyu; - buffer -= (fxu + fyu * buffer_width) * COM_NUM_CHANNELS_COLOR; + buffer -= (fxu + fyu * buffer_width) * COM_DATA_TYPE_COLOR_CHANNELS; /* decrement v (in steps of dv < 1) */ v_local -= dv; @@ -217,7 +219,7 @@ template<int fxu, int fxv, int fyu, int fyv> struct BufferLineAccumulator { x -= fxv; y -= fyv; - buffer -= (fxv + fyv * buffer_width) * COM_NUM_CHANNELS_COLOR; + buffer -= (fxv + fyv * buffer_width) * COM_DATA_TYPE_COLOR_CHANNELS; } } @@ -353,3 +355,5 @@ bool SunBeamsOperation::determineDependingAreaOfInterest(rcti *input, return NodeOperation::determineDependingAreaOfInterest(&rect, readOperation, output); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_SunBeamsOperation.h b/source/blender/compositor/operations/COM_SunBeamsOperation.h index 09bdb018cc3..d3725021cde 100644 --- a/source/blender/compositor/operations/COM_SunBeamsOperation.h +++ b/source/blender/compositor/operations/COM_SunBeamsOperation.h @@ -19,19 +19,21 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class SunBeamsOperation : public NodeOperation { public: SunBeamsOperation(); - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; - void initExecution(); + void initExecution() override; - void *initializeTileData(rcti *rect); + void *initializeTileData(rcti *rect) override; bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; void setData(const NodeSunBeams &data) { @@ -44,3 +46,5 @@ class SunBeamsOperation : public NodeOperation { float m_source_px[2]; float m_ray_length_px; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_TextureOperation.cc b/source/blender/compositor/operations/COM_TextureOperation.cc index 146f43dbe3a..e94c457f981 100644 --- a/source/blender/compositor/operations/COM_TextureOperation.cc +++ b/source/blender/compositor/operations/COM_TextureOperation.cc @@ -25,6 +25,8 @@ #include "BLI_listbase.h" #include "BLI_threads.h" +namespace blender::compositor { + TextureBaseOperation::TextureBaseOperation() { this->addInputSocket(DataType::Vector); // offset @@ -35,7 +37,7 @@ TextureBaseOperation::TextureBaseOperation() this->m_rd = nullptr; this->m_pool = nullptr; this->m_sceneColorManage = false; - setComplex(true); + flags.complex = true; } TextureOperation::TextureOperation() : TextureBaseOperation() { @@ -155,3 +157,5 @@ void TextureBaseOperation::executePixelSampled(float output[4], output[0] = output[1] = output[2] = output[3]; } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_TextureOperation.h b/source/blender/compositor/operations/COM_TextureOperation.h index a40dafd14cf..e1e04611c6c 100644 --- a/source/blender/compositor/operations/COM_TextureOperation.h +++ b/source/blender/compositor/operations/COM_TextureOperation.h @@ -26,6 +26,8 @@ #include "RE_pipeline.h" #include "RE_texture.h" +namespace blender::compositor { + /** * Base class for all renderlayeroperations * @@ -44,7 +46,8 @@ class TextureBaseOperation : public NodeOperation { /** * Determine the output resolution. The resolution is retrieved from the Renderer */ - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); + void determineResolution(unsigned int resolution[2], + unsigned int preferredResolution[2]) override; /** * Constructor @@ -52,14 +55,14 @@ class TextureBaseOperation : public NodeOperation { TextureBaseOperation(); public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; void setTexture(Tex *texture) { this->m_texture = texture; } - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; void setRenderData(const RenderData *rd) { this->m_rd = rd; @@ -77,5 +80,7 @@ class TextureOperation : public TextureBaseOperation { class TextureAlphaOperation : public TextureBaseOperation { public: TextureAlphaOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_TonemapOperation.cc b/source/blender/compositor/operations/COM_TonemapOperation.cc index 85011171432..6bfacb0c75d 100644 --- a/source/blender/compositor/operations/COM_TonemapOperation.cc +++ b/source/blender/compositor/operations/COM_TonemapOperation.cc @@ -22,14 +22,16 @@ #include "IMB_colormanagement.h" +namespace blender::compositor { + TonemapOperation::TonemapOperation() { - this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE); + this->addInputSocket(DataType::Color, ResizeMode::None); this->addOutputSocket(DataType::Color); this->m_imageReader = nullptr; this->m_data = nullptr; this->m_cachedInstance = nullptr; - this->setComplex(true); + this->flags.complex = true; } void TonemapOperation::initExecution() { @@ -150,3 +152,5 @@ void TonemapOperation::deinitializeTileData(rcti * /*rect*/, void * /*data*/) { /* pass */ } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_TonemapOperation.h b/source/blender/compositor/operations/COM_TonemapOperation.h index cb8816b93b3..7ecb179504d 100644 --- a/source/blender/compositor/operations/COM_TonemapOperation.h +++ b/source/blender/compositor/operations/COM_TonemapOperation.h @@ -21,6 +21,8 @@ #include "COM_NodeOperation.h" #include "DNA_node_types.h" +namespace blender::compositor { + /** * \brief temporarily storage during execution of Tone-map * \ingroup operation @@ -60,20 +62,20 @@ class TonemapOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; - void *initializeTileData(rcti *rect); - void deinitializeTileData(rcti *rect, void *data); + void *initializeTileData(rcti *rect) override; + void deinitializeTileData(rcti *rect, void *data) override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; void setData(NodeTonemap *data) { @@ -82,7 +84,7 @@ class TonemapOperation : public NodeOperation { bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; }; /** @@ -96,5 +98,7 @@ class PhotoreceptorTonemapOperation : public TonemapOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_TrackPositionOperation.cc b/source/blender/compositor/operations/COM_TrackPositionOperation.cc index 97d602aa458..993410e3e84 100644 --- a/source/blender/compositor/operations/COM_TrackPositionOperation.cc +++ b/source/blender/compositor/operations/COM_TrackPositionOperation.cc @@ -28,6 +28,8 @@ #include "BKE_node.h" #include "BKE_tracking.h" +namespace blender::compositor { + TrackPositionOperation::TrackPositionOperation() { this->addOutputSocket(DataType::Value); @@ -39,6 +41,7 @@ TrackPositionOperation::TrackPositionOperation() this->m_position = CMP_TRACKPOS_ABSOLUTE; this->m_relativeFrame = 0; this->m_speed_output = false; + flags.is_set_operation = true; } void TrackPositionOperation::initExecution() @@ -134,3 +137,5 @@ void TrackPositionOperation::determineResolution(unsigned int resolution[2], resolution[0] = preferredResolution[0]; resolution[1] = preferredResolution[1]; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_TrackPositionOperation.h b/source/blender/compositor/operations/COM_TrackPositionOperation.h index 7d831ec5d8d..b0b0a123bd6 100644 --- a/source/blender/compositor/operations/COM_TrackPositionOperation.h +++ b/source/blender/compositor/operations/COM_TrackPositionOperation.h @@ -28,6 +28,8 @@ #include "BLI_listbase.h" #include "BLI_string.h" +namespace blender::compositor { + /** * Class with implementation of green screen gradient rasterization */ @@ -49,7 +51,8 @@ class TrackPositionOperation : public NodeOperation { /** * Determine the output resolution. The resolution is retrieved from the Renderer */ - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); + void determineResolution(unsigned int resolution[2], + unsigned int preferredResolution[2]) override; public: TrackPositionOperation(); @@ -87,12 +90,9 @@ class TrackPositionOperation : public NodeOperation { this->m_speed_output = speed_output; } - void initExecution(); - - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void initExecution() override; - bool isSetOperation() const - { - return true; - } + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_TranslateOperation.cc b/source/blender/compositor/operations/COM_TranslateOperation.cc index 7efd655b1df..49135f25320 100644 --- a/source/blender/compositor/operations/COM_TranslateOperation.cc +++ b/source/blender/compositor/operations/COM_TranslateOperation.cc @@ -18,6 +18,8 @@ #include "COM_TranslateOperation.h" +namespace blender::compositor { + TranslateOperation::TranslateOperation() { this->addInputSocket(DataType::Color); @@ -56,7 +58,7 @@ void TranslateOperation::executePixelSampled(float output[4], float originalXPos = x - this->getDeltaX(); float originalYPos = y - this->getDeltaY(); - this->m_inputOperation->readSampled(output, originalXPos, originalYPos, COM_PS_BILINEAR); + this->m_inputOperation->readSampled(output, originalXPos, originalYPos, PixelSampler::Bilinear); } bool TranslateOperation::determineDependingAreaOfInterest(rcti *input, @@ -80,3 +82,5 @@ void TranslateOperation::setFactorXY(float factorX, float factorY) m_factorX = factorX; m_factorY = factorY; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_TranslateOperation.h b/source/blender/compositor/operations/COM_TranslateOperation.h index 99cfb528858..eb3a664159f 100644 --- a/source/blender/compositor/operations/COM_TranslateOperation.h +++ b/source/blender/compositor/operations/COM_TranslateOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class TranslateOperation : public NodeOperation { private: SocketReader *m_inputOperation; @@ -35,11 +37,11 @@ class TranslateOperation : public NodeOperation { TranslateOperation(); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + rcti *output) override; + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; float getDeltaX() { @@ -54,9 +56,9 @@ class TranslateOperation : public NodeOperation { { if (!this->m_isDeltaSet) { float tempDelta[4]; - this->m_inputXOperation->readSampled(tempDelta, 0, 0, COM_PS_NEAREST); + this->m_inputXOperation->readSampled(tempDelta, 0, 0, PixelSampler::Nearest); this->m_deltaX = tempDelta[0]; - this->m_inputYOperation->readSampled(tempDelta, 0, 0, COM_PS_NEAREST); + this->m_inputYOperation->readSampled(tempDelta, 0, 0, PixelSampler::Nearest); this->m_deltaY = tempDelta[0]; this->m_isDeltaSet = true; } @@ -64,3 +66,5 @@ class TranslateOperation : public NodeOperation { void setFactorXY(float factorX, float factorY); }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc index ea33f3cd787..19cd5a53084 100644 --- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc +++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc @@ -22,18 +22,20 @@ #include "RE_pipeline.h" +namespace blender::compositor { + VariableSizeBokehBlurOperation::VariableSizeBokehBlurOperation() { this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Color, COM_SC_NO_RESIZE); // do not resize the bokeh image. + this->addInputSocket(DataType::Color, ResizeMode::None); // do not resize the bokeh image. this->addInputSocket(DataType::Value); // radius #ifdef COM_DEFOCUS_SEARCH this->addInputSocket(DataType::Color, - COM_SC_NO_RESIZE); // inverse search radius optimization structure. + ResizeMode::None); // inverse search radius optimization structure. #endif this->addOutputSocket(DataType::Color); - this->setComplex(true); - this->setOpenCL(true); + flags.complex = true; + flags.open_cl = true; this->m_inputProgram = nullptr; this->m_inputBokehProgram = nullptr; @@ -135,14 +137,14 @@ void VariableSizeBokehBlurOperation::executePixel(float output[4], int x, int y, const int addXStepValue = QualityStepHelper::getStep(); const int addYStepValue = addXStepValue; - const int addXStepColor = addXStepValue * COM_NUM_CHANNELS_COLOR; + const int addXStepColor = addXStepValue * COM_DATA_TYPE_COLOR_CHANNELS; if (size_center > this->m_threshold) { for (int ny = miny; ny < maxy; ny += addYStepValue) { float dy = ny - y; int offsetValueNy = ny * inputSizeBuffer->getWidth(); int offsetValueNxNy = offsetValueNy + (minx); - int offsetColorNxNy = offsetValueNxNy * COM_NUM_CHANNELS_COLOR; + int offsetColorNxNy = offsetValueNxNy * COM_DATA_TYPE_COLOR_CHANNELS; for (int nx = minx; nx < maxx; nx += addXStepValue) { if (nx != x || ny != y) { float size = MIN2(inputSizeFloatBuffer[offsetValueNxNy] * scalar, size_center); @@ -278,9 +280,9 @@ bool VariableSizeBokehBlurOperation::determineDependingAreaOfInterest( // InverseSearchRadiusOperation InverseSearchRadiusOperation::InverseSearchRadiusOperation() { - this->addInputSocket(DataType::Value, COM_SC_NO_RESIZE); // radius + this->addInputSocket(DataType::Value, ResizeMode::None); // radius this->addOutputSocket(DataType::Color); - this->setComplex(true); + this->flags.complex = true; this->m_inputRadius = nullptr; } @@ -319,7 +321,7 @@ void *InverseSearchRadiusOperation::initializeTileData(rcti *rect) // 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); + // this->m_inputRadius->read(temp, rx+x2, ry+y2, PixelSampler::Nearest); // if (radius < temp[0]) { // radius = temp[0]; // maxx = x2; @@ -381,3 +383,5 @@ bool InverseSearchRadiusOperation::determineDependingAreaOfInterest( return NodeOperation::determineDependingAreaOfInterest(&newRect, readOperation, output); } #endif + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h index fe927f791fa..baeab6a646e 100644 --- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h +++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h @@ -21,6 +21,8 @@ #include "COM_NodeOperation.h" #include "COM_QualityStepHelper.h" +namespace blender::compositor { + //#define COM_DEFOCUS_SEARCH class VariableSizeBokehBlurOperation : public NodeOperation, public QualityStepHelper { @@ -41,25 +43,25 @@ class VariableSizeBokehBlurOperation : public NodeOperation, public QualityStepH /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; - void *initializeTileData(rcti *rect); + void *initializeTileData(rcti *rect) override; - void deinitializeTileData(rcti *rect, void *data); + void deinitializeTileData(rcti *rect, void *data) override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; void setMaxBlur(int maxRadius) { @@ -81,7 +83,7 @@ class VariableSizeBokehBlurOperation : public NodeOperation, public QualityStepH cl_mem clOutputBuffer, MemoryBuffer **inputMemoryBuffers, std::list<cl_mem> *clMemToCleanUp, - std::list<cl_kernel> *clKernelsToCleanUp); + std::list<cl_kernel> *clKernelsToCleanUp) override; }; #ifdef COM_DEFOCUS_SEARCH @@ -103,19 +105,20 @@ class InverseSearchRadiusOperation : public NodeOperation { /** * Initialize the execution */ - void initExecution(); - void *initializeTileData(rcti *rect); - void deinitializeTileData(rcti *rect, void *data); + void initExecution() override; + void *initializeTileData(rcti *rect) override; + void deinitializeTileData(rcti *rect, void *data) override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); + rcti *output) override; + void determineResolution(unsigned int resolution[2], + unsigned int preferredResolution[2]) override; void setMaxBlur(int maxRadius) { @@ -123,3 +126,5 @@ class InverseSearchRadiusOperation : public NodeOperation { } }; #endif + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.cc b/source/blender/compositor/operations/COM_VectorBlurOperation.cc index ff9eef8a7e1..fd64bda156b 100644 --- a/source/blender/compositor/operations/COM_VectorBlurOperation.cc +++ b/source/blender/compositor/operations/COM_VectorBlurOperation.cc @@ -25,6 +25,8 @@ #include "COM_VectorBlurOperation.h" +namespace blender::compositor { + /* Defined */ #define PASS_VECTOR_MAX 10000.0f @@ -54,7 +56,7 @@ VectorBlurOperation::VectorBlurOperation() this->m_inputImageProgram = nullptr; this->m_inputSpeedProgram = nullptr; this->m_inputZProgram = nullptr; - setComplex(true); + flags.complex = true; } void VectorBlurOperation::initExecution() { @@ -69,7 +71,7 @@ void VectorBlurOperation::initExecution() void VectorBlurOperation::executePixel(float output[4], int x, int y, void *data) { float *buffer = (float *)data; - int index = (y * this->getWidth() + x) * COM_NUM_CHANNELS_COLOR; + int index = (y * this->getWidth() + x) * COM_DATA_TYPE_COLOR_CHANNELS; copy_v4_v4(output, &buffer[index]); } @@ -897,3 +899,5 @@ void zbuf_accumulate_vecblur(NodeBlurData *nbd, } zbuf_free_span(&zspan); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.h b/source/blender/compositor/operations/COM_VectorBlurOperation.h index 222e8b26968..dfcf1fb16f7 100644 --- a/source/blender/compositor/operations/COM_VectorBlurOperation.h +++ b/source/blender/compositor/operations/COM_VectorBlurOperation.h @@ -22,6 +22,8 @@ #include "COM_QualityStepHelper.h" #include "DNA_node_types.h" +namespace blender::compositor { + class VectorBlurOperation : public NodeOperation, public QualityStepHelper { private: /** @@ -44,19 +46,19 @@ class VectorBlurOperation : public NodeOperation, public QualityStepHelper { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data); + void executePixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; - void *initializeTileData(rcti *rect); + void *initializeTileData(rcti *rect) override; void setVectorBlurSettings(NodeBlurData *settings) { @@ -64,7 +66,7 @@ class VectorBlurOperation : public NodeOperation, public QualityStepHelper { } bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); + rcti *output) override; protected: void generateVectorBlur(float *data, @@ -72,3 +74,5 @@ class VectorBlurOperation : public NodeOperation, public QualityStepHelper { MemoryBuffer *inputSpeed, MemoryBuffer *inputZ); }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_VectorCurveOperation.cc b/source/blender/compositor/operations/COM_VectorCurveOperation.cc index a6638a78e88..9d53ed5d8ee 100644 --- a/source/blender/compositor/operations/COM_VectorCurveOperation.cc +++ b/source/blender/compositor/operations/COM_VectorCurveOperation.cc @@ -20,6 +20,8 @@ #include "BKE_colortools.h" +namespace blender::compositor { + VectorCurveOperation::VectorCurveOperation() { this->addInputSocket(DataType::Vector); @@ -50,3 +52,5 @@ void VectorCurveOperation::deinitExecution() CurveBaseOperation::deinitExecution(); this->m_inputProgram = nullptr; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_VectorCurveOperation.h b/source/blender/compositor/operations/COM_VectorCurveOperation.h index cf0d22eca1a..8cbb80e27c7 100644 --- a/source/blender/compositor/operations/COM_VectorCurveOperation.h +++ b/source/blender/compositor/operations/COM_VectorCurveOperation.h @@ -21,6 +21,8 @@ #include "COM_CurveBaseOperation.h" #include "COM_NodeOperation.h" +namespace blender::compositor { + class VectorCurveOperation : public CurveBaseOperation { private: /** @@ -34,15 +36,17 @@ class VectorCurveOperation : public CurveBaseOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution(); + void initExecution() override; /** * Deinitialize the execution */ - void deinitExecution(); + void deinitExecution() override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cc b/source/blender/compositor/operations/COM_ViewerOperation.cc index ea5937d8afb..1ae0fe6101f 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.cc +++ b/source/blender/compositor/operations/COM_ViewerOperation.cc @@ -32,6 +32,8 @@ #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" +namespace blender::compositor { + ViewerOperation::ViewerOperation() { this->setImage(nullptr); @@ -53,6 +55,8 @@ ViewerOperation::ViewerOperation() this->m_depthInput = nullptr; this->m_rd = nullptr; this->m_viewName = nullptr; + flags.use_viewer_border = true; + flags.is_viewer_operation = true; } void ViewerOperation::initExecution() @@ -98,12 +102,12 @@ void ViewerOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/) for (y = y1; y < y2 && (!breaked); y++) { for (x = x1; x < x2; x++) { - this->m_imageInput->readSampled(&(buffer[offset4]), x, y, COM_PS_NEAREST); + this->m_imageInput->readSampled(&(buffer[offset4]), x, y, PixelSampler::Nearest); if (this->m_useAlphaInput) { - this->m_alphaInput->readSampled(alpha, x, y, COM_PS_NEAREST); + this->m_alphaInput->readSampled(alpha, x, y, PixelSampler::Nearest); buffer[offset4 + 3] = alpha[0]; } - this->m_depthInput->readSampled(depth, x, y, COM_PS_NEAREST); + this->m_depthInput->readSampled(depth, x, y, PixelSampler::Nearest); depthbuffer[offset] = depth[0]; offset++; @@ -213,3 +217,5 @@ CompositorPriority ViewerOperation::getRenderPriority() const return CompositorPriority::Low; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ViewerOperation.h b/source/blender/compositor/operations/COM_ViewerOperation.h index 513c6eae487..8406ea41f20 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.h +++ b/source/blender/compositor/operations/COM_ViewerOperation.h @@ -23,6 +23,8 @@ #include "COM_NodeOperation.h" #include "DNA_image_types.h" +namespace blender::compositor { + class ViewerOperation : public NodeOperation { private: float *m_outputBuffer; @@ -48,11 +50,12 @@ class ViewerOperation : public NodeOperation { public: ViewerOperation(); - void initExecution(); - void deinitExecution(); - void executeRegion(rcti *rect, unsigned int tileNumber); - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); - bool isOutputOperation(bool /*rendering*/) const + void initExecution() override; + void deinitExecution() override; + void executeRegion(rcti *rect, unsigned int tileNumber) override; + void determineResolution(unsigned int resolution[2], + unsigned int preferredResolution[2]) override; + bool isOutputOperation(bool /*rendering*/) const override { if (G.background) { return false; @@ -67,7 +70,7 @@ class ViewerOperation : public NodeOperation { { this->m_imageUser = imageUser; } - bool isActiveViewerOutput() const + bool isActiveViewerOutput() const override { return this->m_active; } @@ -99,11 +102,7 @@ class ViewerOperation : public NodeOperation { { return this->m_chunkOrder; } - CompositorPriority getRenderPriority() const; - bool isViewerOperation() const - { - return true; - } + CompositorPriority getRenderPriority() const override; void setUseAlphaInput(bool value) { this->m_useAlphaInput = value; @@ -130,3 +129,5 @@ class ViewerOperation : public NodeOperation { void updateImage(rcti *rect); void initImage(); }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_WrapOperation.cc b/source/blender/compositor/operations/COM_WrapOperation.cc index a869666967e..d0d2fcac3ac 100644 --- a/source/blender/compositor/operations/COM_WrapOperation.cc +++ b/source/blender/compositor/operations/COM_WrapOperation.cc @@ -20,6 +20,8 @@ #include "COM_WrapOperation.h" +namespace blender::compositor { + WrapOperation::WrapOperation(DataType datatype) : ReadBufferOperation(datatype) { this->m_wrappingType = CMP_NODE_WRAP_NONE; @@ -115,3 +117,5 @@ void WrapOperation::setWrapping(int wrapping_type) { m_wrappingType = wrapping_type; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_WrapOperation.h b/source/blender/compositor/operations/COM_WrapOperation.h index a72b90e7e94..6279129a550 100644 --- a/source/blender/compositor/operations/COM_WrapOperation.h +++ b/source/blender/compositor/operations/COM_WrapOperation.h @@ -20,6 +20,8 @@ #include "COM_ReadBufferOperation.h" +namespace blender::compositor { + class WrapOperation : public ReadBufferOperation { private: int m_wrappingType; @@ -28,8 +30,8 @@ class WrapOperation : public ReadBufferOperation { WrapOperation(DataType datatype); bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, - rcti *output); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + rcti *output) override; + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; void setWrapping(int wrapping_type); float getWrappedOriginalXPos(float x); @@ -37,3 +39,5 @@ class WrapOperation : public ReadBufferOperation { void setFactorXY(float factorX, float factorY); }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.cc b/source/blender/compositor/operations/COM_WriteBufferOperation.cc index e426bc76ef3..1aa19f26e2b 100644 --- a/source/blender/compositor/operations/COM_WriteBufferOperation.cc +++ b/source/blender/compositor/operations/COM_WriteBufferOperation.cc @@ -21,12 +21,15 @@ #include "COM_defines.h" #include <cstdio> +namespace blender::compositor { + WriteBufferOperation::WriteBufferOperation(DataType datatype) { this->addInputSocket(datatype); this->m_memoryProxy = new MemoryProxy(datatype); this->m_memoryProxy->setWriteBufferOperation(this); this->m_memoryProxy->setExecutor(nullptr); + flags.is_write_buffer_operation = true; } WriteBufferOperation::~WriteBufferOperation() { @@ -61,7 +64,7 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/ MemoryBuffer *memoryBuffer = this->m_memoryProxy->getBuffer(); float *buffer = memoryBuffer->getBuffer(); const uint8_t num_channels = memoryBuffer->get_num_channels(); - if (this->m_input->isComplex()) { + if (this->m_input->get_flags().complex) { void *data = this->m_input->initializeTileData(rect); int x1 = rect->xmin; int y1 = rect->ymin; @@ -97,7 +100,7 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/ for (y = y1; y < y2 && (!breaked); y++) { int offset4 = (y * memoryBuffer->getWidth() + x1) * num_channels; for (x = x1; x < x2; x++) { - this->m_input->readSampled(&(buffer[offset4]), x, y, COM_PS_NEAREST); + this->m_input->readSampled(&(buffer[offset4]), x, y, PixelSampler::Nearest); offset4 += num_channels; } if (isBraked()) { @@ -225,3 +228,5 @@ void WriteBufferOperation::readResolutionFromInputSocket() this->setWidth(inputOperation->getWidth()); this->setHeight(inputOperation->getHeight()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.h b/source/blender/compositor/operations/COM_WriteBufferOperation.h index a9f90830a92..2817fbe24b9 100644 --- a/source/blender/compositor/operations/COM_WriteBufferOperation.h +++ b/source/blender/compositor/operations/COM_WriteBufferOperation.h @@ -20,7 +20,12 @@ #include "COM_MemoryProxy.h" #include "COM_NodeOperation.h" -#include "COM_SocketReader.h" + +namespace blender::compositor { + +class OpenCLDevice; +class MemoryProxy; + /** * \brief NodeOperation to write to a tile * \ingroup Operation @@ -37,28 +42,27 @@ class WriteBufferOperation : public NodeOperation { { return this->m_memoryProxy; } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); - bool isWriteBufferOperation() const - { - return true; - } + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; bool isSingleValue() const { return m_single_value; } - void executeRegion(rcti *rect, unsigned int tileNumber); - void initExecution(); - void deinitExecution(); + void executeRegion(rcti *rect, unsigned int tileNumber) override; + void initExecution() override; + void deinitExecution() override; void executeOpenCLRegion(OpenCLDevice *device, rcti *rect, unsigned int chunkNumber, MemoryBuffer **memoryBuffers, - MemoryBuffer *outputBuffer); - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); + MemoryBuffer *outputBuffer) override; + void determineResolution(unsigned int resolution[2], + unsigned int preferredResolution[2]) override; void readResolutionFromInputSocket(); inline NodeOperation *getInput() { return m_input; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ZCombineOperation.cc b/source/blender/compositor/operations/COM_ZCombineOperation.cc index 8afdbcc7c2d..9d3ca7e736e 100644 --- a/source/blender/compositor/operations/COM_ZCombineOperation.cc +++ b/source/blender/compositor/operations/COM_ZCombineOperation.cc @@ -19,6 +19,8 @@ #include "COM_ZCombineOperation.h" #include "BLI_utildefines.h" +namespace blender::compositor { + ZCombineOperation::ZCombineOperation() { this->addInputSocket(DataType::Color); @@ -158,3 +160,5 @@ void ZCombineMaskOperation::deinitExecution() this->m_maskReader = nullptr; this->m_image2Reader = nullptr; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ZCombineOperation.h b/source/blender/compositor/operations/COM_ZCombineOperation.h index a64e3c5b70f..d0b1aee7310 100644 --- a/source/blender/compositor/operations/COM_ZCombineOperation.h +++ b/source/blender/compositor/operations/COM_ZCombineOperation.h @@ -20,6 +20,8 @@ #include "COM_MixOperation.h" +namespace blender::compositor { + /** * this program converts an input color to an output value. * it assumes we are in sRGB color space. @@ -37,17 +39,17 @@ class ZCombineOperation : public NodeOperation { */ ZCombineOperation(); - void initExecution(); - void deinitExecution(); + void initExecution() override; + void deinitExecution() override; /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class ZCombineAlphaOperation : public ZCombineOperation { - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class ZCombineMaskOperation : public NodeOperation { @@ -59,10 +61,12 @@ class ZCombineMaskOperation : public NodeOperation { public: ZCombineMaskOperation(); - void initExecution(); - void deinitExecution(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void initExecution() override; + void deinitExecution() override; + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; class ZCombineMaskAlphaOperation : public ZCombineMaskOperation { - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler); + void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; }; + +} // namespace blender::compositor |