diff options
Diffstat (limited to 'source/blender/compositor')
448 files changed, 4580 insertions, 1948 deletions
diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt index 64033cbe5c4..c8ee8af4542 100644 --- a/source/blender/compositor/CMakeLists.txt +++ b/source/blender/compositor/CMakeLists.txt @@ -87,8 +87,6 @@ set(SRC intern/COM_OpenCLDevice.h intern/COM_SingleThreadedOperation.cc intern/COM_SingleThreadedOperation.h - intern/COM_SocketReader.cc - intern/COM_SocketReader.h intern/COM_WorkPackage.cc intern/COM_WorkPackage.h intern/COM_WorkScheduler.cc @@ -296,6 +294,9 @@ set(SRC nodes/COM_FilterNode.h nodes/COM_InpaintNode.cc nodes/COM_InpaintNode.h + nodes/COM_AntiAliasingNode.cc + nodes/COM_AntiAliasingNode.h + operations/COM_BlurBaseOperation.cc operations/COM_BlurBaseOperation.h operations/COM_BokehBlurOperation.cc @@ -322,6 +323,8 @@ set(SRC operations/COM_MovieDistortionOperation.h operations/COM_VariableSizeBokehBlurOperation.cc operations/COM_VariableSizeBokehBlurOperation.h + operations/COM_SMAAOperation.cc + operations/COM_SMAAOperation.h # Matte nodes nodes/COM_BoxMaskNode.cc @@ -568,6 +571,23 @@ data_to_c( add_definitions(-DCL_USE_DEPRECATED_OPENCL_1_1_APIS) +set(GENSRC_DIR ${CMAKE_CURRENT_BINARY_DIR}/operations) +set(GENSRC ${GENSRC_DIR}/COM_SMAAAreaTexture.h) +add_custom_command( + OUTPUT ${GENSRC} + COMMAND ${CMAKE_COMMAND} -E make_directory ${GENSRC_DIR} + COMMAND "$<TARGET_FILE:smaa_areatex>" ${GENSRC} + DEPENDS smaa_areatex +) +add_custom_target(smaa_areatex_header + SOURCES ${GENSRC} +) +list(APPEND SRC + ${GENSRC} +) +unset(GENSRC) +unset(GENSRC_DIR) + if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() @@ -586,3 +606,5 @@ if(WITH_OPENIMAGEDENOISE) endif() blender_add_lib(bf_compositor "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") + +add_dependencies(bf_compositor smaa_areatex_header) diff --git a/source/blender/compositor/COM_compositor.h b/source/blender/compositor/COM_compositor.h index 8e3caf7aaf5..300a06005ac 100644 --- a/source/blender/compositor/COM_compositor.h +++ b/source/blender/compositor/COM_compositor.h @@ -113,11 +113,11 @@ extern "C" { * * When the chunk-order is determined, the first few chunks will be checked if they can be scheduled. * Chunks can have three states: - * - [@ref eChunkExecutionState.NOT_SCHEDULED]: + * - [@ref eChunkExecutionState.NotScheduled]: * Chunk is not yet scheduled, or dependencies are not met. - * - [@ref eChunkExecutionState.SCHEDULED]: + * - [@ref eChunkExecutionState.Scheduled]: * All dependencies are met, chunk is scheduled, but not finished. - * - [@ref eChunkExecutionState.EXECUTED]: + * - [@ref eChunkExecutionState.Executed]: * Chunk is finished. * * \see ExecutionGroup.execute diff --git a/source/blender/compositor/COM_defines.h b/source/blender/compositor/COM_defines.h index 266f532ebb8..5a5868f1909 100644 --- a/source/blender/compositor/COM_defines.h +++ b/source/blender/compositor/COM_defines.h @@ -18,6 +18,8 @@ #pragma once +namespace blender::compositor { + /** * \brief possible data types for sockets * \ingroup Model @@ -32,6 +34,25 @@ enum class DataType { }; /** + * Utility to get the number of channels of the given data type. + */ +constexpr int COM_data_type_num_channels(const DataType datatype) +{ + switch (datatype) { + case DataType::Value: + return 1; + case DataType::Vector: + return 3; + case DataType::Color: + default: + return 4; + } +} + +constexpr int COM_DATA_TYPE_VALUE_CHANNELS = COM_data_type_num_channels(DataType::Value); +constexpr int COM_DATA_TYPE_COLOR_CHANNELS = COM_data_type_num_channels(DataType::Color); + +/** * \brief Possible quality settings * \see CompositorContext.quality * \ingroup Execution @@ -58,11 +79,29 @@ enum class CompositorPriority { Low = 0, }; +/** + * \brief the execution state of a chunk in an ExecutionGroup + * \ingroup Execution + */ +enum class eChunkExecutionState { + /** + * \brief chunk is not yet scheduled + */ + NotScheduled = 0, + /** + * \brief chunk is scheduled, but not yet executed + */ + Scheduled = 1, + /** + * \brief chunk is executed. + */ + Executed = 2, +}; + // configurable items // chunk size determination -#define COM_PREVIEW_SIZE 140.0f -//#define COM_DEBUG +// #define COM_DEBUG // chunk order /** @@ -82,10 +121,8 @@ enum class ChunkOrdering { Default = ChunkOrdering::CenterOut, }; -#define COM_RULE_OF_THIRDS_DIVIDER 100.0f - -#define COM_NUM_CHANNELS_VALUE 1 -#define COM_NUM_CHANNELS_VECTOR 3 -#define COM_NUM_CHANNELS_COLOR 4 +constexpr float COM_PREVIEW_SIZE = 140.f; +constexpr float COM_RULE_OF_THIRDS_DIVIDER = 100.0f; +constexpr float COM_BLUR_BOKEH_PIXELS = 512; -#define COM_BLUR_BOKEH_PIXELS 512 +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_CPUDevice.cc b/source/blender/compositor/intern/COM_CPUDevice.cc index b520a437008..29a82bec636 100644 --- a/source/blender/compositor/intern/COM_CPUDevice.cc +++ b/source/blender/compositor/intern/COM_CPUDevice.cc @@ -18,19 +18,23 @@ #include "COM_CPUDevice.h" +#include "COM_ExecutionGroup.h" + +#include "BLI_rect.h" + +namespace blender::compositor { + CPUDevice::CPUDevice(int thread_id) : m_thread_id(thread_id) { } -void CPUDevice::execute(WorkPackage *work) +void CPUDevice::execute(WorkPackage *work_package) { - const unsigned int chunkNumber = work->chunk_number; - ExecutionGroup *executionGroup = work->execution_group; - rcti rect; - - executionGroup->determineChunkRect(&rect, chunkNumber); - - executionGroup->getOutputOperation()->executeRegion(&rect, chunkNumber); + const unsigned int chunkNumber = work_package->chunk_number; + ExecutionGroup *executionGroup = work_package->execution_group; + executionGroup->getOutputOperation()->executeRegion(&work_package->rect, chunkNumber); executionGroup->finalizeChunkExecution(chunkNumber, nullptr); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_CPUDevice.h b/source/blender/compositor/intern/COM_CPUDevice.h index 962380d7bc8..99629890b30 100644 --- a/source/blender/compositor/intern/COM_CPUDevice.h +++ b/source/blender/compositor/intern/COM_CPUDevice.h @@ -20,6 +20,8 @@ #include "COM_Device.h" +namespace blender::compositor { + /** * \brief class representing a CPU device. * \note for every hardware thread in the system a CPUDevice instance @@ -33,7 +35,7 @@ class CPUDevice : public Device { * \brief execute a WorkPackage * \param work: the WorkPackage to execute */ - void execute(WorkPackage *work); + void execute(WorkPackage *work) override; int thread_id() { @@ -43,3 +45,5 @@ class CPUDevice : public Device { protected: int m_thread_id; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_ChunkOrder.cc b/source/blender/compositor/intern/COM_ChunkOrder.cc index 9687154120d..a03718d720d 100644 --- a/source/blender/compositor/intern/COM_ChunkOrder.cc +++ b/source/blender/compositor/intern/COM_ChunkOrder.cc @@ -20,6 +20,8 @@ #include "BLI_math.h" +namespace blender::compositor { + void ChunkOrder::update_distance(ChunkOrderHotspot *hotspots, unsigned int len_hotspots) { double new_distance = DBL_MAX; @@ -36,3 +38,5 @@ bool operator<(const ChunkOrder &a, const ChunkOrder &b) { return a.distance < b.distance; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_ChunkOrder.h b/source/blender/compositor/intern/COM_ChunkOrder.h index a634309f345..a697f9231d9 100644 --- a/source/blender/compositor/intern/COM_ChunkOrder.h +++ b/source/blender/compositor/intern/COM_ChunkOrder.h @@ -24,6 +24,8 @@ #include "COM_ChunkOrderHotspot.h" +namespace blender::compositor { + /** Helper to determine the order how chunks are prioritized during execution. */ struct ChunkOrder { unsigned int index = 0; @@ -39,3 +41,5 @@ struct ChunkOrder { MEM_CXX_CLASS_ALLOC_FUNCS("COM:ChunkOrderHotspot") #endif }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_ChunkOrderHotspot.cc b/source/blender/compositor/intern/COM_ChunkOrderHotspot.cc index d31ff518ecd..79afcc9deea 100644 --- a/source/blender/compositor/intern/COM_ChunkOrderHotspot.cc +++ b/source/blender/compositor/intern/COM_ChunkOrderHotspot.cc @@ -19,6 +19,8 @@ #include "COM_ChunkOrderHotspot.h" #include <cmath> +namespace blender::compositor { + double ChunkOrderHotspot::calc_distance(int x, int y) { int dx = this->x - x; @@ -27,3 +29,5 @@ double ChunkOrderHotspot::calc_distance(int x, int y) result += (double)this->addition; return result; } + +} // namespace blender::compositor
\ No newline at end of file diff --git a/source/blender/compositor/intern/COM_ChunkOrderHotspot.h b/source/blender/compositor/intern/COM_ChunkOrderHotspot.h index d7f40921836..249b328f5c2 100644 --- a/source/blender/compositor/intern/COM_ChunkOrderHotspot.h +++ b/source/blender/compositor/intern/COM_ChunkOrderHotspot.h @@ -22,6 +22,8 @@ # include "MEM_guardedalloc.h" #endif +namespace blender::compositor { + struct ChunkOrderHotspot { int x; int y; @@ -37,3 +39,5 @@ struct ChunkOrderHotspot { MEM_CXX_CLASS_ALLOC_FUNCS("COM:ChunkOrderHotspot") #endif }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_CompositorContext.cc b/source/blender/compositor/intern/COM_CompositorContext.cc index e2447fb5c13..fdd47a6ca79 100644 --- a/source/blender/compositor/intern/COM_CompositorContext.cc +++ b/source/blender/compositor/intern/COM_CompositorContext.cc @@ -20,6 +20,10 @@ #include "COM_defines.h" #include <cstdio> +#include "BLI_assert.h" + +namespace blender::compositor { + CompositorContext::CompositorContext() { this->m_scene = nullptr; @@ -33,9 +37,8 @@ CompositorContext::CompositorContext() int CompositorContext::getFramenumber() const { - if (this->m_rd) { - return this->m_rd->cfra; - } - - return -1; /* this should never happen */ + BLI_assert(m_rd); + return m_rd->cfra; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_CompositorContext.h b/source/blender/compositor/intern/COM_CompositorContext.h index 46cf65bbb79..c6468865fc8 100644 --- a/source/blender/compositor/intern/COM_CompositorContext.h +++ b/source/blender/compositor/intern/COM_CompositorContext.h @@ -26,6 +26,8 @@ #include <string> #include <vector> +namespace blender::compositor { + /** * \brief Overall context of the compositor */ @@ -277,3 +279,5 @@ class CompositorContext { return m_rd->size * 0.01f; } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_Converter.cc b/source/blender/compositor/intern/COM_Converter.cc index d5bce636b8c..af593b2e1b5 100644 --- a/source/blender/compositor/intern/COM_Converter.cc +++ b/source/blender/compositor/intern/COM_Converter.cc @@ -26,6 +26,7 @@ #include "COM_NodeOperationBuilder.h" #include "COM_AlphaOverNode.h" +#include "COM_AntiAliasingNode.h" #include "COM_BilateralBlurNode.h" #include "COM_BlurNode.h" #include "COM_BokehBlurNode.h" @@ -115,6 +116,8 @@ #include "COM_ViewerNode.h" #include "COM_ZCombineNode.h" +namespace blender::compositor { + bool COM_bnode_is_fast_node(const bNode &b_node) { return !ELEM(b_node.type, @@ -418,6 +421,9 @@ Node *COM_convert_bnode(bNode *b_node) case CMP_NODE_EXPOSURE: node = new ExposureNode(b_node); break; + case CMP_NODE_ANTIALIASING: + node = new AntiAliasingNode(b_node); + break; } return node; } @@ -454,7 +460,7 @@ void COM_convert_resolution(NodeOperationBuilder &builder, NodeOperationOutput *fromSocket, NodeOperationInput *toSocket) { - InputResizeMode mode = toSocket->getResizeMode(); + ResizeMode mode = toSocket->getResizeMode(); NodeOperation *toOperation = &toSocket->getOperation(); const float toWidth = toOperation->getWidth(); @@ -470,22 +476,22 @@ void COM_convert_resolution(NodeOperationBuilder &builder, float scaleY = 0; switch (mode) { - case COM_SC_NO_RESIZE: + case ResizeMode::None: break; - case COM_SC_CENTER: + case ResizeMode::Center: doCenter = true; break; - case COM_SC_FIT_WIDTH: + case ResizeMode::FitWidth: doCenter = true; doScale = true; scaleX = scaleY = toWidth / fromWidth; break; - case COM_SC_FIT_HEIGHT: + case ResizeMode::FitHeight: doCenter = true; doScale = true; scaleX = scaleY = toHeight / fromHeight; break; - case COM_SC_FIT: + case ResizeMode::FitAny: doCenter = true; doScale = true; scaleX = toWidth / fromWidth; @@ -497,7 +503,7 @@ void COM_convert_resolution(NodeOperationBuilder &builder, scaleY = scaleX; } break; - case COM_SC_STRETCH: + case ResizeMode::Stretch: doCenter = true; doScale = true; scaleX = toWidth / fromWidth; @@ -510,8 +516,8 @@ void COM_convert_resolution(NodeOperationBuilder &builder, ScaleOperation *scaleOperation = nullptr; if (doScale) { scaleOperation = new ScaleOperation(); - scaleOperation->getInputSocket(1)->setResizeMode(COM_SC_NO_RESIZE); - scaleOperation->getInputSocket(2)->setResizeMode(COM_SC_NO_RESIZE); + scaleOperation->getInputSocket(1)->setResizeMode(ResizeMode::None); + scaleOperation->getInputSocket(2)->setResizeMode(ResizeMode::None); first = scaleOperation; SetValueOperation *sxop = new SetValueOperation(); sxop->setValue(scaleX); @@ -530,8 +536,8 @@ void COM_convert_resolution(NodeOperationBuilder &builder, } TranslateOperation *translateOperation = new TranslateOperation(); - translateOperation->getInputSocket(1)->setResizeMode(COM_SC_NO_RESIZE); - translateOperation->getInputSocket(2)->setResizeMode(COM_SC_NO_RESIZE); + translateOperation->getInputSocket(1)->setResizeMode(ResizeMode::None); + translateOperation->getInputSocket(2)->setResizeMode(ResizeMode::None); if (!first) { first = translateOperation; } @@ -551,15 +557,17 @@ void COM_convert_resolution(NodeOperationBuilder &builder, builder.addOperation(translateOperation); if (doScale) { - translateOperation->getInputSocket(0)->setResizeMode(COM_SC_NO_RESIZE); + translateOperation->getInputSocket(0)->setResizeMode(ResizeMode::None); builder.addLink(scaleOperation->getOutputSocket(), translateOperation->getInputSocket(0)); } /* remove previous link and replace */ builder.removeInputLink(toSocket); - first->getInputSocket(0)->setResizeMode(COM_SC_NO_RESIZE); - toSocket->setResizeMode(COM_SC_NO_RESIZE); + first->getInputSocket(0)->setResizeMode(ResizeMode::None); + toSocket->setResizeMode(ResizeMode::None); builder.addLink(fromSocket, first->getInputSocket(0)); builder.addLink(translateOperation->getOutputSocket(), toSocket); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_Converter.h b/source/blender/compositor/intern/COM_Converter.h index 59be34bf0e3..28136437103 100644 --- a/source/blender/compositor/intern/COM_Converter.h +++ b/source/blender/compositor/intern/COM_Converter.h @@ -18,14 +18,17 @@ #pragma once +#include "COM_NodeOperation.h" + #ifdef WITH_CXX_GUARDEDALLOC # include "MEM_guardedalloc.h" #endif struct bNode; +namespace blender::compositor { + class Node; -class NodeOperation; class NodeOperationInput; class NodeOperationOutput; class NodeOperationBuilder; @@ -65,3 +68,5 @@ NodeOperation *COM_convert_data_type(const NodeOperationOutput &from, void COM_convert_resolution(NodeOperationBuilder &builder, NodeOperationOutput *fromSocket, NodeOperationInput *toSocket); + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_Debug.cc b/source/blender/compositor/intern/COM_Debug.cc index c299bd1c72d..56bc2dc947f 100644 --- a/source/blender/compositor/intern/COM_Debug.cc +++ b/source/blender/compositor/intern/COM_Debug.cc @@ -18,30 +18,31 @@ #include "COM_Debug.h" -#ifdef COM_DEBUG - -# include <map> -# include <typeinfo> -# include <vector> +#include <map> +#include <typeinfo> +#include <vector> extern "C" { -# include "BLI_fileops.h" -# include "BLI_path_util.h" -# include "BLI_string.h" -# include "BLI_sys_types.h" - -# include "BKE_appdir.h" -# include "BKE_node.h" -# include "DNA_node_types.h" +#include "BLI_fileops.h" +#include "BLI_path_util.h" +#include "BLI_string.h" +#include "BLI_sys_types.h" + +#include "BKE_appdir.h" +#include "BKE_node.h" +#include "DNA_node_types.h" } -# include "COM_ExecutionGroup.h" -# include "COM_ExecutionSystem.h" -# include "COM_Node.h" +#include "COM_ExecutionSystem.h" +#include "COM_Node.h" + +#include "COM_ReadBufferOperation.h" +#include "COM_ViewerOperation.h" +#include "COM_WriteBufferOperation.h" -# include "COM_ReadBufferOperation.h" -# include "COM_ViewerOperation.h" -# include "COM_WriteBufferOperation.h" +namespace blender::compositor { + +#ifdef COM_DEBUG int DebugInfo::m_file_index = 0; DebugInfo::NodeNameMap DebugInfo::m_node_names; @@ -113,7 +114,7 @@ void DebugInfo::execution_group_finished(const ExecutionGroup *group) } int DebugInfo::graphviz_operation(const ExecutionSystem *system, - const NodeOperation *operation, + NodeOperation *operation, const ExecutionGroup *group, char *str, int maxlen) @@ -121,7 +122,7 @@ int DebugInfo::graphviz_operation(const ExecutionSystem *system, int len = 0; std::string fillcolor = "gainsboro"; - if (operation->isViewerOperation()) { + if (operation->get_flags().is_viewer_operation) { const ViewerOperation *viewer = (const ViewerOperation *)operation; if (viewer->isActiveViewerOutput()) { fillcolor = "lightskyblue1"; @@ -133,13 +134,13 @@ int DebugInfo::graphviz_operation(const ExecutionSystem *system, else if (operation->isOutputOperation(system->getContext().isRendering())) { fillcolor = "dodgerblue1"; } - else if (operation->isSetOperation()) { + else if (operation->get_flags().is_set_operation) { fillcolor = "khaki1"; } - else if (operation->isReadBufferOperation()) { + else if (operation->get_flags().is_read_buffer_operation) { fillcolor = "darkolivegreen3"; } - else if (operation->isWriteBufferOperation()) { + else if (operation->get_flags().is_write_buffer_operation) { fillcolor = "darkorange"; } @@ -360,7 +361,7 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma } for (NodeOperation *operation : system->m_operations) { - if (operation->isReadBufferOperation()) { + if (operation->get_flags().is_read_buffer_operation) { ReadBufferOperation *read = (ReadBufferOperation *)operation; WriteBufferOperation *write = read->getMemoryProxy()->getWriteBufferOperation(); std::vector<std::string> &read_groups = op_groups[read]; @@ -381,8 +382,8 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma } for (NodeOperation *op : system->m_operations) { - for (NodeOperationInput *to : op->m_inputs) { - NodeOperationOutput *from = to->getLink(); + for (NodeOperationInput &to : op->m_inputs) { + NodeOperationOutput *from = to.getLink(); if (!from) { continue; @@ -401,7 +402,7 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma break; } - NodeOperation *to_op = &to->getOperation(); + NodeOperation *to_op = &to.getOperation(); NodeOperation *from_op = &from->getOperation(); std::vector<std::string> &from_groups = op_groups[from_op]; std::vector<std::string> &to_groups = op_groups[to_op]; @@ -412,7 +413,7 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma from_op, from, to_op, - to); + &to); for (int k = 0; k < from_groups.size(); k++) { for (int l = 0; l < to_groups.size(); l++) { len += snprintf(str + len, @@ -423,7 +424,7 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma from, to_op, to_groups[l].c_str(), - to); + &to); len += snprintf( str + len, maxlen > len ? maxlen - len : 0, " [color=%s]", color.c_str()); len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "\r\n"); @@ -495,3 +496,5 @@ void DebugInfo::graphviz(const ExecutionSystem * /*system*/) } #endif + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_Debug.h b/source/blender/compositor/intern/COM_Debug.h index 0107d8b396d..bf7b981fbd5 100644 --- a/source/blender/compositor/intern/COM_Debug.h +++ b/source/blender/compositor/intern/COM_Debug.h @@ -21,10 +21,12 @@ #include <map> #include <string> +#include "COM_NodeOperation.h" #include "COM_defines.h" +namespace blender::compositor { + class Node; -class NodeOperation; class ExecutionSystem; class ExecutionGroup; @@ -55,7 +57,7 @@ class DebugInfo { #ifdef COM_DEBUG protected: static int graphviz_operation(const ExecutionSystem *system, - const NodeOperation *operation, + NodeOperation *operation, const ExecutionGroup *group, char *str, int maxlen); @@ -81,3 +83,5 @@ class DebugInfo { static GroupStateMap m_group_states; #endif }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_Device.h b/source/blender/compositor/intern/COM_Device.h index 0b0f0f5c1c6..2a43c1be2b4 100644 --- a/source/blender/compositor/intern/COM_Device.h +++ b/source/blender/compositor/intern/COM_Device.h @@ -20,6 +20,8 @@ #include "COM_WorkPackage.h" +namespace blender::compositor { + /** * \brief Abstract class for device implementations to be used by the Compositor. * devices are queried, initialized and used by the WorkScheduler. @@ -37,21 +39,6 @@ class Device { } /** - * \brief initialize the device - */ - virtual bool initialize() - { - return true; - } - - /** - * \brief deinitialize the device - */ - virtual void deinitialize() - { - } - - /** * \brief execute a WorkPackage * \param work: the WorkPackage to execute */ @@ -61,3 +48,5 @@ class Device { MEM_CXX_CLASS_ALLOC_FUNCS("COM:Device") #endif }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cc b/source/blender/compositor/intern/COM_ExecutionGroup.cc index 3cedc5da663..37c363501ad 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.cc +++ b/source/blender/compositor/intern/COM_ExecutionGroup.cc @@ -46,10 +46,10 @@ #include "WM_api.h" #include "WM_types.h" +namespace blender::compositor { + ExecutionGroup::ExecutionGroup() { - this->m_is_output = false; - this->m_complex = false; this->m_bTree = nullptr; this->m_height = 0; this->m_width = 0; @@ -57,42 +57,39 @@ ExecutionGroup::ExecutionGroup() this->m_x_chunks_len = 0; this->m_y_chunks_len = 0; this->m_chunks_len = 0; - this->m_initialized = false; - this->m_openCL = false; - this->m_singleThreaded = false; this->m_chunks_finished = 0; BLI_rcti_init(&this->m_viewerBorder, 0, 0, 0, 0); this->m_executionStartTime = 0; } -CompositorPriority ExecutionGroup::getRenderPriotrity() +CompositorPriority ExecutionGroup::getRenderPriority() { return this->getOutputOperation()->getRenderPriority(); } bool ExecutionGroup::can_contain(NodeOperation &operation) { - if (!this->m_initialized) { + if (!m_flags.initialized) { return true; } - if (operation.isReadBufferOperation()) { + if (operation.get_flags().is_read_buffer_operation) { return true; } - if (operation.isWriteBufferOperation()) { + if (operation.get_flags().is_write_buffer_operation) { return false; } - if (operation.isSetOperation()) { + if (operation.get_flags().is_set_operation) { return true; } /* complex groups don't allow further ops (except read buffer and values, see above) */ - if (m_complex) { + if (m_flags.complex) { return false; } /* complex ops can't be added to other groups (except their own, which they initialize, see * above) */ - if (operation.isComplex()) { + if (operation.get_flags().complex) { return false; } @@ -105,11 +102,12 @@ bool ExecutionGroup::addOperation(NodeOperation *operation) return false; } - if (!operation->isReadBufferOperation() && !operation->isWriteBufferOperation()) { - m_complex = operation->isComplex(); - m_openCL = operation->isOpenCL(); - m_singleThreaded = operation->isSingleThreaded(); - m_initialized = true; + if (!operation->get_flags().is_read_buffer_operation && + !operation->get_flags().is_write_buffer_operation) { + m_flags.complex = operation->get_flags().complex; + m_flags.open_cl = operation->get_flags().open_cl; + m_flags.single_threaded = operation->get_flags().single_threaded; + m_flags.initialized = true; } m_operations.append(operation); @@ -125,20 +123,23 @@ NodeOperation *ExecutionGroup::getOutputOperation() const void ExecutionGroup::initExecution() { - m_chunk_execution_states.clear(); + m_work_packages.clear(); determineNumberOfChunks(); if (this->m_chunks_len != 0) { - m_chunk_execution_states.resize(this->m_chunks_len); - for (int index = 0; index < this->m_chunks_len; index++) { - m_chunk_execution_states[index] = eChunkExecutionState::NOT_SCHEDULED; + m_work_packages.resize(this->m_chunks_len); + for (unsigned int index = 0; index < m_chunks_len; index++) { + m_work_packages[index].state = eChunkExecutionState::NotScheduled; + m_work_packages[index].execution_group = this; + m_work_packages[index].chunk_number = index; + determineChunkRect(&m_work_packages[index].rect, index); } } unsigned int max_offset = 0; for (NodeOperation *operation : m_operations) { - if (operation->isReadBufferOperation()) { + if (operation->get_flags().is_read_buffer_operation) { ReadBufferOperation *readOperation = static_cast<ReadBufferOperation *>(operation); this->m_read_operations.append(readOperation); max_offset = MAX2(max_offset, readOperation->getOffset()); @@ -150,7 +151,7 @@ void ExecutionGroup::initExecution() void ExecutionGroup::deinitExecution() { - m_chunk_execution_states.clear(); + m_work_packages.clear(); this->m_chunks_len = 0; this->m_x_chunks_len = 0; this->m_y_chunks_len = 0; @@ -168,7 +169,7 @@ void ExecutionGroup::determineResolution(unsigned int resolution[2]) void ExecutionGroup::determineNumberOfChunks() { - if (this->m_singleThreaded) { + if (this->m_flags.single_threaded) { this->m_x_chunks_len = 1; this->m_y_chunks_len = 1; this->m_chunks_len = 1; @@ -185,7 +186,6 @@ void ExecutionGroup::determineNumberOfChunks() blender::Array<unsigned int> ExecutionGroup::determine_chunk_execution_order() const { - int index; blender::Array<unsigned int> chunk_order(m_chunks_len); for (int chunk_index = 0; chunk_index < this->m_chunks_len; chunk_index++) { chunk_order[chunk_index] = chunk_index; @@ -196,7 +196,7 @@ blender::Array<unsigned int> ExecutionGroup::determine_chunk_execution_order() c float centerY = 0.5f; ChunkOrdering order_type = ChunkOrdering::Default; - if (operation->isViewerOperation()) { + if (operation->get_flags().is_viewer_operation) { ViewerOperation *viewer = (ViewerOperation *)operation; centerX = viewer->getCenterX(); centerY = viewer->getCenterY(); @@ -205,7 +205,7 @@ blender::Array<unsigned int> ExecutionGroup::determine_chunk_execution_order() c const int border_width = BLI_rcti_size_x(&this->m_viewerBorder); const int border_height = BLI_rcti_size_y(&this->m_viewerBorder); - + int index; switch (order_type) { case ChunkOrdering::Random: { static blender::RandomNumberGenerator rng; @@ -219,11 +219,10 @@ blender::Array<unsigned int> ExecutionGroup::determine_chunk_execution_order() c ChunkOrderHotspot hotspot(border_width * centerX, border_height * centerY, 0.0f); blender::Array<ChunkOrder> chunk_orders(m_chunks_len); for (index = 0; index < this->m_chunks_len; index++) { - rcti rect; - determineChunkRect(&rect, index); + const WorkPackage &work_package = m_work_packages[index]; chunk_orders[index].index = index; - chunk_orders[index].x = rect.xmin - this->m_viewerBorder.xmin; - chunk_orders[index].y = rect.ymin - this->m_viewerBorder.ymin; + chunk_orders[index].x = work_package.rect.xmin - this->m_viewerBorder.xmin; + chunk_orders[index].y = work_package.rect.ymin - this->m_viewerBorder.ymin; chunk_orders[index].update_distance(&hotspot, 1); } @@ -257,11 +256,10 @@ blender::Array<unsigned int> ExecutionGroup::determine_chunk_execution_order() c blender::Array<ChunkOrder> chunk_orders(m_chunks_len); for (index = 0; index < this->m_chunks_len; index++) { - rcti rect; - determineChunkRect(&rect, index); + const WorkPackage &work_package = m_work_packages[index]; chunk_orders[index].index = index; - chunk_orders[index].x = rect.xmin - this->m_viewerBorder.xmin; - chunk_orders[index].y = rect.ymin - this->m_viewerBorder.ymin; + chunk_orders[index].x = work_package.rect.xmin - this->m_viewerBorder.xmin; + chunk_orders[index].y = work_package.rect.ymin - this->m_viewerBorder.ymin; chunk_orders[index].update_distance(hotspots, 9); } @@ -303,7 +301,6 @@ void ExecutionGroup::execute(ExecutionSystem *graph) this->m_chunks_finished = 0; this->m_bTree = bTree; - unsigned int index; blender::Array<unsigned int> chunk_order = determine_chunk_execution_order(); @@ -320,13 +317,15 @@ void ExecutionGroup::execute(ExecutionSystem *graph) finished = true; int numberEvaluated = 0; - for (index = startIndex; index < this->m_chunks_len && numberEvaluated < maxNumberEvaluated; + for (int index = startIndex; + index < this->m_chunks_len && numberEvaluated < maxNumberEvaluated; index++) { chunk_index = chunk_order[index]; int yChunk = chunk_index / this->m_x_chunks_len; int xChunk = chunk_index - (yChunk * this->m_x_chunks_len); - switch (m_chunk_execution_states[chunk_index]) { - case eChunkExecutionState::NOT_SCHEDULED: { + const WorkPackage &work_package = m_work_packages[chunk_index]; + switch (work_package.state) { + case eChunkExecutionState::NotScheduled: { scheduleChunkWhenPossible(graph, xChunk, yChunk); finished = false; startEvaluated = true; @@ -337,13 +336,13 @@ void ExecutionGroup::execute(ExecutionSystem *graph) } break; } - case eChunkExecutionState::SCHEDULED: { + case eChunkExecutionState::Scheduled: { finished = false; startEvaluated = true; numberEvaluated++; break; } - case eChunkExecutionState::EXECUTED: { + case eChunkExecutionState::Executed: { if (!startEvaluated) { startIndex = index + 1; } @@ -363,15 +362,14 @@ void ExecutionGroup::execute(ExecutionSystem *graph) MemoryBuffer **ExecutionGroup::getInputBuffersOpenCL(int chunkNumber) { - rcti rect; - determineChunkRect(&rect, chunkNumber); + WorkPackage &work_package = m_work_packages[chunkNumber]; MemoryBuffer **memoryBuffers = (MemoryBuffer **)MEM_callocN( sizeof(MemoryBuffer *) * this->m_max_read_buffer_offset, __func__); rcti output; for (ReadBufferOperation *readOperation : m_read_operations) { MemoryProxy *memoryProxy = readOperation->getMemoryProxy(); - this->determineDependingAreaOfInterest(&rect, readOperation, &output); + this->determineDependingAreaOfInterest(&work_package.rect, readOperation, &output); MemoryBuffer *memoryBuffer = memoryProxy->getExecutor()->constructConsolidatedMemoryBuffer( *memoryProxy, output); memoryBuffers[readOperation->getOffset()] = memoryBuffer; @@ -390,8 +388,9 @@ MemoryBuffer *ExecutionGroup::constructConsolidatedMemoryBuffer(MemoryProxy &mem void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memoryBuffers) { - if (this->m_chunk_execution_states[chunkNumber] == eChunkExecutionState::SCHEDULED) { - this->m_chunk_execution_states[chunkNumber] = eChunkExecutionState::EXECUTED; + WorkPackage &work_package = m_work_packages[chunkNumber]; + if (work_package.state == eChunkExecutionState::Scheduled) { + work_package.state = eChunkExecutionState::Executed; } atomic_add_and_fetch_u(&this->m_chunks_finished, 1); @@ -423,23 +422,23 @@ void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memo } } -inline void ExecutionGroup::determineChunkRect(rcti *rect, +inline void ExecutionGroup::determineChunkRect(rcti *r_rect, const unsigned int xChunk, const unsigned int yChunk) const { const int border_width = BLI_rcti_size_x(&this->m_viewerBorder); const int border_height = BLI_rcti_size_y(&this->m_viewerBorder); - if (this->m_singleThreaded) { + if (this->m_flags.single_threaded) { BLI_rcti_init( - rect, this->m_viewerBorder.xmin, border_width, this->m_viewerBorder.ymin, border_height); + r_rect, this->m_viewerBorder.xmin, border_width, this->m_viewerBorder.ymin, border_height); } else { const unsigned int minx = xChunk * this->m_chunkSize + this->m_viewerBorder.xmin; const unsigned int miny = yChunk * this->m_chunkSize + this->m_viewerBorder.ymin; const unsigned int width = MIN2((unsigned int)this->m_viewerBorder.xmax, this->m_width); const unsigned int height = MIN2((unsigned int)this->m_viewerBorder.ymax, this->m_height); - BLI_rcti_init(rect, + BLI_rcti_init(r_rect, MIN2(minx, this->m_width), MIN2(minx + this->m_chunkSize, width), MIN2(miny, this->m_height), @@ -447,18 +446,18 @@ inline void ExecutionGroup::determineChunkRect(rcti *rect, } } -void ExecutionGroup::determineChunkRect(rcti *rect, const unsigned int chunkNumber) const +void ExecutionGroup::determineChunkRect(rcti *r_rect, const unsigned int chunkNumber) const { const unsigned int yChunk = chunkNumber / this->m_x_chunks_len; const unsigned int xChunk = chunkNumber - (yChunk * this->m_x_chunks_len); - determineChunkRect(rect, xChunk, yChunk); + determineChunkRect(r_rect, xChunk, yChunk); } MemoryBuffer *ExecutionGroup::allocateOutputBuffer(rcti &rect) { // we assume that this method is only called from complex execution groups. NodeOperation *operation = this->getOutputOperation(); - if (operation->isWriteBufferOperation()) { + if (operation->get_flags().is_write_buffer_operation) { WriteBufferOperation *writeOperation = (WriteBufferOperation *)operation; MemoryBuffer *buffer = new MemoryBuffer( writeOperation->getMemoryProxy(), rect, MemoryBufferState::Temporary); @@ -469,7 +468,7 @@ MemoryBuffer *ExecutionGroup::allocateOutputBuffer(rcti &rect) bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem *graph, rcti *area) { - if (this->m_singleThreaded) { + if (this->m_flags.single_threaded) { return scheduleChunkWhenPossible(graph, 0, 0); } // find all chunks inside the rect @@ -503,9 +502,10 @@ bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem *graph, rcti *area bool ExecutionGroup::scheduleChunk(unsigned int chunkNumber) { - if (this->m_chunk_execution_states[chunkNumber] == eChunkExecutionState::NOT_SCHEDULED) { - this->m_chunk_execution_states[chunkNumber] = eChunkExecutionState::SCHEDULED; - WorkScheduler::schedule(this, chunkNumber); + WorkPackage &work_package = m_work_packages[chunkNumber]; + if (work_package.state == eChunkExecutionState::NotScheduled) { + work_package.state = eChunkExecutionState::Scheduled; + WorkScheduler::schedule(&work_package); return true; } return false; @@ -524,22 +524,21 @@ bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem *graph, // Check if chunk is already executed or scheduled and not yet executed. const int chunk_index = chunk_y * this->m_x_chunks_len + chunk_x; - if (this->m_chunk_execution_states[chunk_index] == eChunkExecutionState::EXECUTED) { + WorkPackage &work_package = m_work_packages[chunk_index]; + if (work_package.state == eChunkExecutionState::Executed) { return true; } - if (this->m_chunk_execution_states[chunk_index] == eChunkExecutionState::SCHEDULED) { + if (work_package.state == eChunkExecutionState::Scheduled) { return false; } - rcti rect; - determineChunkRect(&rect, chunk_x, chunk_y); bool can_be_executed = true; rcti area; for (ReadBufferOperation *read_operation : m_read_operations) { BLI_rcti_init(&area, 0, 0, 0, 0); MemoryProxy *memory_proxy = read_operation->getMemoryProxy(); - determineDependingAreaOfInterest(&rect, read_operation, &area); + determineDependingAreaOfInterest(&work_package.rect, read_operation, &area); ExecutionGroup *group = memory_proxy->getExecutor(); if (!group->scheduleAreaWhenPossible(graph, &area)) { @@ -561,16 +560,10 @@ void ExecutionGroup::determineDependingAreaOfInterest(rcti *input, this->getOutputOperation()->determineDependingAreaOfInterest(input, readOperation, output); } -bool ExecutionGroup::isOpenCL() -{ - return this->m_openCL; -} - void ExecutionGroup::setViewerBorder(float xmin, float xmax, float ymin, float ymax) { - NodeOperation *operation = this->getOutputOperation(); - - if (operation->isViewerOperation() || operation->isPreviewOperation()) { + const NodeOperation &operation = *this->getOutputOperation(); + if (operation.get_flags().use_viewer_border) { BLI_rcti_init(&this->m_viewerBorder, xmin * this->m_width, xmax * this->m_width, @@ -581,32 +574,14 @@ void ExecutionGroup::setViewerBorder(float xmin, float xmax, float ymin, float y void ExecutionGroup::setRenderBorder(float xmin, float xmax, float ymin, float ymax) { - NodeOperation *operation = this->getOutputOperation(); - - if (operation->isOutputOperation(true)) { - /* Basically, setting border need to happen for only operations - * which operates in render resolution buffers (like compositor - * output nodes). - * - * In this cases adding border will lead to mapping coordinates - * from output buffer space to input buffer spaces when executing - * operation. - * - * But nodes like viewer and file output just shall display or - * safe the same exact buffer which goes to their input, no need - * in any kind of coordinates mapping. - */ - - bool operationNeedsBorder = !(operation->isViewerOperation() || - operation->isPreviewOperation() || - operation->isFileOutputOperation()); - - if (operationNeedsBorder) { - BLI_rcti_init(&this->m_viewerBorder, - xmin * this->m_width, - xmax * this->m_width, - ymin * this->m_height, - ymax * this->m_height); - } + const NodeOperation &operation = *this->getOutputOperation(); + if (operation.isOutputOperation(true) && operation.get_flags().use_render_border) { + BLI_rcti_init(&this->m_viewerBorder, + xmin * this->m_width, + xmax * this->m_width, + ymin * this->m_height, + ymax * this->m_height); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.h b/source/blender/compositor/intern/COM_ExecutionGroup.h index 6fd93d2d93c..ff5c1698a75 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.h +++ b/source/blender/compositor/intern/COM_ExecutionGroup.h @@ -31,30 +31,46 @@ #include "COM_MemoryProxy.h" #include "COM_Node.h" #include "COM_NodeOperation.h" +#include "COM_WorkPackage.h" #include <vector> +namespace blender::compositor { + class ExecutionSystem; class MemoryProxy; +class MemoryBuffer; class ReadBufferOperation; class Device; -/** - * \brief the execution state of a chunk in an ExecutionGroup - * \ingroup Execution - */ -enum class eChunkExecutionState { +struct ExecutionGroupFlags { + bool initialized : 1; /** - * \brief chunk is not yet scheduled + * Is this ExecutionGroup an output ExecutionGroup + * An OutputExecution group are groups containing a + * ViewerOperation, CompositeOperation, PreviewOperation. */ - NOT_SCHEDULED = 0, + bool is_output : 1; + bool complex : 1; + /** - * \brief chunk is scheduled, but not yet executed + * Can this ExecutionGroup be scheduled on an OpenCLDevice. */ - SCHEDULED = 1, + bool open_cl : 1; + /** - * \brief chunk is executed. + * Schedule this execution group as a single chunk. This + * chunk will be executed by a single thread. */ - EXECUTED = 2, + bool single_threaded : 1; + + ExecutionGroupFlags() + { + initialized = false; + is_output = false; + complex = false; + open_cl = false; + single_threaded = false; + } }; /** @@ -72,12 +88,7 @@ class ExecutionGroup { */ blender::Vector<NodeOperation *> m_operations; - /** - * \brief is this ExecutionGroup an input ExecutionGroup - * an input execution group is a group that is at the end of the calculation - * (the output is important for the user). - */ - bool m_is_output; + ExecutionGroupFlags m_flags; /** * \brief Width of the output @@ -111,21 +122,6 @@ class ExecutionGroup { unsigned int m_chunks_len; /** - * \brief contains this ExecutionGroup a complex NodeOperation. - */ - bool m_complex; - - /** - * \brief can this ExecutionGroup be scheduled on an OpenCLDevice - */ - bool m_openCL; - - /** - * \brief Is this Execution group SingleThreaded - */ - bool m_singleThreaded; - - /** * \brief what is the maximum number field of all ReadBufferOperation in this ExecutionGroup. * \note this is used to construct the MemoryBuffers that will be passed during execution. */ @@ -149,24 +145,9 @@ class ExecutionGroup { unsigned int m_chunks_finished; /** - * \brief m_chunk_execution_states holds per chunk the execution state. this state can be - * - eChunkExecutionState::NOT_SCHEDULED: not scheduled - * - eChunkExecutionState::SCHEDULED: scheduled - * - eChunkExecutionState::EXECUTED: executed + * \brief m_work_packages holds all unit of work. */ - blender::Vector<eChunkExecutionState> m_chunk_execution_states; - - /** - * \brief indicator when this ExecutionGroup has valid Operations in its vector for Execution - * \note When building the ExecutionGroup Operations are added via recursion. - * First a WriteBufferOperations is added, then the. - * \note Operation containing the settings that is important for the ExecutiongGroup is added, - * \note When this occurs, these settings are copied over from the node to the ExecutionGroup - * \note and the Initialized flag is set to true. - * \see complex - * \see openCL - */ - bool m_initialized; + blender::Vector<WorkPackage> m_work_packages; /** * \brief denotes boundary for border compositing @@ -187,19 +168,11 @@ class ExecutionGroup { bool can_contain(NodeOperation &operation); /** - * \brief calculate the actual chunk size of this execution group. - * \note A chunk size is an unsigned int that is both the height and width of a chunk. - * \note The chunk size will not be stored in the chunkSize field. This needs to be done - * \note by the calling method. - */ - unsigned int determineChunkSize(); - - /** * \brief Determine the rect (minx, maxx, miny, maxy) of a chunk at a position. - * \note Only gives useful results after the determination of the chunksize - * \see determineChunkSize() */ - void determineChunkRect(rcti *rect, const unsigned int xChunk, const unsigned int yChunk) const; + void determineChunkRect(rcti *r_rect, + const unsigned int xChunk, + const unsigned int yChunk) const; /** * \brief determine the number of chunks, based on the chunkSize, width and height. @@ -258,6 +231,11 @@ class ExecutionGroup { // constructors ExecutionGroup(); + const ExecutionGroupFlags get_flags() const + { + return m_flags; + } + // methods /** * \brief add an operation to this ExecutionGroup @@ -270,23 +248,12 @@ class ExecutionGroup { bool addOperation(NodeOperation *operation); /** - * \brief is this ExecutionGroup an output ExecutionGroup - * \note An OutputExecution group are groups containing a - * \note ViewerOperation, CompositeOperation, PreviewOperation. - * \see NodeOperation.isOutputOperation - */ - bool isOutputExecutionGroup() const - { - return this->m_is_output; - } - - /** * \brief set whether this ExecutionGroup is an output * \param isOutput: */ void setOutputExecutionGroup(bool is_output) { - this->m_is_output = is_output; + this->m_flags.is_output = is_output; } /** @@ -322,14 +289,6 @@ class ExecutionGroup { } /** - * \brief does this ExecutionGroup contains a complex NodeOperation - */ - bool isComplex() const - { - return m_complex; - } - - /** * \brief get the output operation of this ExecutionGroup * \return NodeOperation *output operation */ @@ -404,16 +363,8 @@ class ExecutionGroup { /** * \brief Determine the rect (minx, maxx, miny, maxy) of a chunk. - * \note Only gives useful results after the determination of the chunksize - * \see determineChunkSize() */ - void determineChunkRect(rcti *rect, const unsigned int chunkNumber) const; - - /** - * \brief can this ExecutionGroup be scheduled on an OpenCLDevice - * \see WorkScheduler.schedule - */ - bool isOpenCL(); + void determineChunkRect(rcti *r_rect, const unsigned int chunkNumber) const; void setChunksize(int chunksize) { @@ -424,7 +375,7 @@ class ExecutionGroup { * \brief get the Render priority of this ExecutionGroup * \see ExecutionSystem.execute */ - CompositorPriority getRenderPriotrity(); + CompositorPriority getRenderPriority(); /** * \brief set border for viewer operation @@ -441,3 +392,5 @@ class ExecutionGroup { MEM_CXX_CLASS_ALLOC_FUNCS("COM:ExecutionGroup") #endif }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cc b/source/blender/compositor/intern/COM_ExecutionSystem.cc index 993aedf7715..9a3dc6ee56f 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystem.cc +++ b/source/blender/compositor/intern/COM_ExecutionSystem.cc @@ -37,6 +37,8 @@ # include "MEM_guardedalloc.h" #endif +namespace blender::compositor { + ExecutionSystem::ExecutionSystem(RenderData *rd, Scene *scene, bNodeTree *editingtree, @@ -71,7 +73,6 @@ ExecutionSystem::ExecutionSystem(RenderData *rd, builder.convertToOperations(this); } - unsigned int index; unsigned int resolution[2]; rctf *viewer_border = &editingtree->viewer_border; @@ -81,10 +82,9 @@ ExecutionSystem::ExecutionSystem(RenderData *rd, editingtree->stats_draw(editingtree->sdh, TIP_("Compositing | Determining resolution")); - for (index = 0; index < this->m_groups.size(); index++) { + for (ExecutionGroup *executionGroup : m_groups) { resolution[0] = 0; resolution[1] = 0; - ExecutionGroup *executionGroup = this->m_groups[index]; executionGroup->determineResolution(resolution); if (rendering) { @@ -108,14 +108,12 @@ ExecutionSystem::ExecutionSystem(RenderData *rd, ExecutionSystem::~ExecutionSystem() { - unsigned int index; - for (index = 0; index < this->m_operations.size(); index++) { - NodeOperation *operation = this->m_operations[index]; + for (NodeOperation *operation : m_operations) { delete operation; } this->m_operations.clear(); - for (index = 0; index < this->m_groups.size(); index++) { - ExecutionGroup *group = this->m_groups[index]; + + for (ExecutionGroup *group : m_groups) { delete group; } this->m_groups.clear(); @@ -128,92 +126,100 @@ void ExecutionSystem::set_operations(const blender::Vector<NodeOperation *> &ope m_groups = groups; } -void ExecutionSystem::execute() +static void update_read_buffer_offset(blender::Vector<NodeOperation *> &operations) { - const bNodeTree *editingtree = this->m_context.getbNodeTree(); - editingtree->stats_draw(editingtree->sdh, TIP_("Compositing | Initializing execution")); - - DebugInfo::execute_started(this); - unsigned int order = 0; - for (NodeOperation *operation : m_operations) { - if (operation->isReadBufferOperation()) { + for (NodeOperation *operation : operations) { + if (operation->get_flags().is_read_buffer_operation) { ReadBufferOperation *readOperation = (ReadBufferOperation *)operation; readOperation->setOffset(order); order++; } } - unsigned int index; +} - // First allocale all write buffer - for (index = 0; index < this->m_operations.size(); index++) { - NodeOperation *operation = this->m_operations[index]; - if (operation->isWriteBufferOperation()) { - operation->setbNodeTree(this->m_context.getbNodeTree()); +static void init_write_operations_for_execution(blender::Vector<NodeOperation *> &operations, + const bNodeTree *bTree) +{ + for (NodeOperation *operation : operations) { + if (operation->get_flags().is_write_buffer_operation) { + operation->setbNodeTree(bTree); operation->initExecution(); } } - // Connect read buffers to their write buffers - for (index = 0; index < this->m_operations.size(); index++) { - NodeOperation *operation = this->m_operations[index]; - if (operation->isReadBufferOperation()) { - ReadBufferOperation *readOperation = (ReadBufferOperation *)operation; +} + +static void link_write_buffers(blender::Vector<NodeOperation *> &operations) +{ + for (NodeOperation *operation : operations) { + if (operation->get_flags().is_read_buffer_operation) { + ReadBufferOperation *readOperation = static_cast<ReadBufferOperation *>(operation); readOperation->updateMemoryBuffer(); } } - // initialize other operations - for (index = 0; index < this->m_operations.size(); index++) { - NodeOperation *operation = this->m_operations[index]; - if (!operation->isWriteBufferOperation()) { - operation->setbNodeTree(this->m_context.getbNodeTree()); +} + +static void init_non_write_operations_for_execution(blender::Vector<NodeOperation *> &operations, + const bNodeTree *bTree) +{ + for (NodeOperation *operation : operations) { + if (!operation->get_flags().is_write_buffer_operation) { + operation->setbNodeTree(bTree); operation->initExecution(); } } - for (index = 0; index < this->m_groups.size(); index++) { - ExecutionGroup *executionGroup = this->m_groups[index]; - executionGroup->setChunksize(this->m_context.getChunksize()); - executionGroup->initExecution(); +} + +static void init_execution_groups_for_execution(blender::Vector<ExecutionGroup *> &groups, + const int chunk_size) +{ + for (ExecutionGroup *execution_group : groups) { + execution_group->setChunksize(chunk_size); + execution_group->initExecution(); } +} - WorkScheduler::start(this->m_context); +void ExecutionSystem::execute() +{ + const bNodeTree *editingtree = this->m_context.getbNodeTree(); + editingtree->stats_draw(editingtree->sdh, TIP_("Compositing | Initializing execution")); + + DebugInfo::execute_started(this); + update_read_buffer_offset(m_operations); + init_write_operations_for_execution(m_operations, m_context.getbNodeTree()); + link_write_buffers(m_operations); + init_non_write_operations_for_execution(m_operations, m_context.getbNodeTree()); + init_execution_groups_for_execution(m_groups, m_context.getChunksize()); + + WorkScheduler::start(this->m_context); execute_groups(CompositorPriority::High); if (!this->getContext().isFastCalculation()) { execute_groups(CompositorPriority::Medium); execute_groups(CompositorPriority::Low); } - WorkScheduler::finish(); WorkScheduler::stop(); editingtree->stats_draw(editingtree->sdh, TIP_("Compositing | De-initializing execution")); - for (index = 0; index < this->m_operations.size(); index++) { - NodeOperation *operation = this->m_operations[index]; + + for (NodeOperation *operation : m_operations) { operation->deinitExecution(); } - for (index = 0; index < this->m_groups.size(); index++) { - ExecutionGroup *executionGroup = this->m_groups[index]; - executionGroup->deinitExecution(); - } -} -void ExecutionSystem::execute_groups(CompositorPriority priority) -{ - blender::Vector<ExecutionGroup *> execution_groups = find_output_execution_groups(priority); - for (ExecutionGroup *group : execution_groups) { - group->execute(this); + for (ExecutionGroup *execution_group : m_groups) { + execution_group->deinitExecution(); } } -blender::Vector<ExecutionGroup *> ExecutionSystem::find_output_execution_groups( - CompositorPriority priority) const +void ExecutionSystem::execute_groups(CompositorPriority priority) { - blender::Vector<ExecutionGroup *> result; - - for (ExecutionGroup *group : m_groups) { - if (group->isOutputExecutionGroup() && group->getRenderPriotrity() == priority) { - result.append(group); + for (ExecutionGroup *execution_group : m_groups) { + if (execution_group->get_flags().is_output && + execution_group->getRenderPriority() == priority) { + execution_group->execute(this); } } - return result; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.h b/source/blender/compositor/intern/COM_ExecutionSystem.h index 6a50cc6906b..b8dcd90e1a6 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystem.h +++ b/source/blender/compositor/intern/COM_ExecutionSystem.h @@ -31,6 +31,8 @@ class ExecutionGroup; #include "BLI_vector.hh" +namespace blender::compositor { + /** * \page execution Execution model * In order to get to an efficient model for execution, several steps are being done. these steps @@ -70,17 +72,17 @@ class ExecutionGroup; * * - Image size conversions: the system can automatically convert when resolutions do not match. * An NodeInput has a resize mode. This can be any of the following settings. - * - [@ref InputSocketResizeMode.COM_SC_CENTER]: + * - [@ref InputSocketResizeMode.ResizeMode::Center]: * The center of both images are aligned - * - [@ref InputSocketResizeMode.COM_SC_FIT_WIDTH]: + * - [@ref InputSocketResizeMode.ResizeMode::FitWidth]: * The width of both images are aligned - * - [@ref InputSocketResizeMode.COM_SC_FIT_HEIGHT]: + * - [@ref InputSocketResizeMode.ResizeMode::FitHeight]: * The height of both images are aligned - * - [@ref InputSocketResizeMode.COM_SC_FIT]: + * - [@ref InputSocketResizeMode.ResizeMode::FitAny]: * The width, or the height of both images are aligned to make sure that it fits. - * - [@ref InputSocketResizeMode.COM_SC_STRETCH]: + * - [@ref InputSocketResizeMode.ResizeMode::Stretch]: * The width and the height of both images are aligned. - * - [@ref InputSocketResizeMode.COM_SC_NO_RESIZE]: + * - [@ref InputSocketResizeMode.ResizeMode::None]: * Bottom left of the images are aligned. * * \see COM_convert_data_type Datatype conversions @@ -135,12 +137,6 @@ class ExecutionSystem { blender::Vector<ExecutionGroup *> m_groups; private: // methods - /** - * find all execution group with output nodes - */ - blender::Vector<ExecutionGroup *> find_output_execution_groups( - CompositorPriority priority) const; - public: /** * \brief Create a new ExecutionSystem and initialize it with the @@ -192,3 +188,5 @@ class ExecutionSystem { MEM_CXX_CLASS_ALLOC_FUNCS("COM:ExecutionSystem") #endif }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cc b/source/blender/compositor/intern/COM_MemoryBuffer.cc index 0b28168720e..68e39b19eaf 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.cc +++ b/source/blender/compositor/intern/COM_MemoryBuffer.cc @@ -20,24 +20,13 @@ #include "MEM_guardedalloc.h" -static unsigned int determine_num_channels(DataType datatype) -{ - switch (datatype) { - case DataType::Value: - return COM_NUM_CHANNELS_VALUE; - case DataType::Vector: - return COM_NUM_CHANNELS_VECTOR; - case DataType::Color: - default: - return COM_NUM_CHANNELS_COLOR; - } -} +namespace blender::compositor { MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, const rcti &rect, MemoryBufferState state) { m_rect = rect; this->m_memoryProxy = memoryProxy; - this->m_num_channels = determine_num_channels(memoryProxy->getDataType()); + this->m_num_channels = COM_data_type_num_channels(memoryProxy->getDataType()); this->m_buffer = (float *)MEM_mallocN_aligned( sizeof(float) * buffer_len() * this->m_num_channels, 16, "COM_MemoryBuffer"); this->m_state = state; @@ -48,7 +37,7 @@ MemoryBuffer::MemoryBuffer(DataType dataType, const rcti &rect) { m_rect = rect; this->m_memoryProxy = nullptr; - this->m_num_channels = determine_num_channels(dataType); + this->m_num_channels = COM_data_type_num_channels(dataType); this->m_buffer = (float *)MEM_mallocN_aligned( sizeof(float) * buffer_len() * this->m_num_channels, 16, "COM_MemoryBuffer"); this->m_state = MemoryBufferState::Temporary; @@ -183,3 +172,5 @@ void MemoryBuffer::readEWA(float *result, const float uv[2], const float derivat this, result); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.h b/source/blender/compositor/intern/COM_MemoryBuffer.h index 6f719b61122..060a67f8797 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.h +++ b/source/blender/compositor/intern/COM_MemoryBuffer.h @@ -16,17 +16,16 @@ * Copyright 2011, Blender Foundation. */ -class MemoryBuffer; - #pragma once #include "COM_ExecutionGroup.h" #include "COM_MemoryProxy.h" -#include "COM_SocketReader.h" #include "BLI_math.h" #include "BLI_rect.h" +namespace blender::compositor { + /** * \brief state of a memory buffer * \ingroup Memory @@ -331,3 +330,5 @@ class MemoryBuffer { MEM_CXX_CLASS_ALLOC_FUNCS("COM:MemoryBuffer") #endif }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_MemoryProxy.cc b/source/blender/compositor/intern/COM_MemoryProxy.cc index 8ef834e1efe..6023850c944 100644 --- a/source/blender/compositor/intern/COM_MemoryProxy.cc +++ b/source/blender/compositor/intern/COM_MemoryProxy.cc @@ -18,6 +18,12 @@ #include "COM_MemoryProxy.h" +#include "COM_MemoryBuffer.h" + +#include "BLI_rect.h" + +namespace blender::compositor { + MemoryProxy::MemoryProxy(DataType datatype) { this->m_writeBufferOperation = nullptr; @@ -43,3 +49,5 @@ void MemoryProxy::free() this->m_buffer = nullptr; } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_MemoryProxy.h b/source/blender/compositor/intern/COM_MemoryProxy.h index a40e6f95dce..0966eadadb2 100644 --- a/source/blender/compositor/intern/COM_MemoryProxy.h +++ b/source/blender/compositor/intern/COM_MemoryProxy.h @@ -16,13 +16,14 @@ * Copyright 2011, Blender Foundation. */ -class MemoryProxy; - #pragma once -#include "COM_ExecutionGroup.h" -#include "COM_MemoryBuffer.h" +#include "COM_defines.h" + +namespace blender::compositor { +/* Forward declarations. */ +class MemoryBuffer; class ExecutionGroup; class WriteBufferOperation; @@ -45,16 +46,6 @@ class MemoryProxy { ExecutionGroup *m_executor; /** - * \brief datatype of this MemoryProxy - */ - /* DataType m_datatype; */ /* UNUSED */ - - /** - * \brief channel information of this buffer - */ - /* ChannelInfo m_channelInfo[COM_NUMBER_OF_CHANNELS]; */ /* UNUSED */ - - /** * \brief the allocated memory */ MemoryBuffer *m_buffer; @@ -129,3 +120,5 @@ class MemoryProxy { MEM_CXX_CLASS_ALLOC_FUNCS("COM:MemoryProxy") #endif }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_MetaData.cc b/source/blender/compositor/intern/COM_MetaData.cc index ad72b242c8c..6762955ef78 100644 --- a/source/blender/compositor/intern/COM_MetaData.cc +++ b/source/blender/compositor/intern/COM_MetaData.cc @@ -24,6 +24,8 @@ #include <string_view> +namespace blender::compositor { + void MetaData::add(const blender::StringRef key, const blender::StringRef value) { entries_.add(key, value); @@ -104,3 +106,5 @@ void MetaDataExtractCallbackData::extract_cryptomatte_meta_data(void *_data, data->addMetaData(META_DATA_KEY_CRYPTOMATTE_MANIFEST, propvalue); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_MetaData.h b/source/blender/compositor/intern/COM_MetaData.h index fa3de895b4e..ce437fd5df8 100644 --- a/source/blender/compositor/intern/COM_MetaData.h +++ b/source/blender/compositor/intern/COM_MetaData.h @@ -28,6 +28,8 @@ /* Forward declarations. */ struct RenderResult; +namespace blender::compositor { + /* Cryptomatte includes hash in its meta data keys. The hash is generated from the render * layer/pass name. Compositing happens without the knowledge of the original layer and pass. The * next keys are used to transfer the cryptomatte meta data in a neutral way. The file output node @@ -69,3 +71,5 @@ struct MetaDataExtractCallbackData { char *propvalue, int UNUSED(len)); }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_Node.cc b/source/blender/compositor/intern/COM_Node.cc index 819f1c02b14..6ac48e3646c 100644 --- a/source/blender/compositor/intern/COM_Node.cc +++ b/source/blender/compositor/intern/COM_Node.cc @@ -32,6 +32,8 @@ #include "COM_Node.h" /* own include */ +namespace blender::compositor { + /************** **** Node **** **************/ @@ -74,13 +76,11 @@ Node::Node(bNode *editorNode, bool create_sockets) Node::~Node() { - while (!this->m_outputsockets.empty()) { - delete (this->m_outputsockets.back()); - this->m_outputsockets.pop_back(); + while (!this->outputs.is_empty()) { + delete (this->outputs.pop_last()); } - while (!this->m_inputsockets.empty()) { - delete (this->m_inputsockets.back()); - this->m_inputsockets.pop_back(); + while (!this->inputs.is_empty()) { + delete (this->inputs.pop_last()); } } @@ -92,7 +92,7 @@ void Node::addInputSocket(DataType datatype) void Node::addInputSocket(DataType datatype, bNodeSocket *bSocket) { NodeInput *socket = new NodeInput(this, bSocket, datatype); - this->m_inputsockets.push_back(socket); + this->inputs.append(socket); } void Node::addOutputSocket(DataType datatype) @@ -102,19 +102,17 @@ void Node::addOutputSocket(DataType datatype) void Node::addOutputSocket(DataType datatype, bNodeSocket *bSocket) { NodeOutput *socket = new NodeOutput(this, bSocket, datatype); - this->m_outputsockets.push_back(socket); + outputs.append(socket); } NodeOutput *Node::getOutputSocket(unsigned int index) const { - BLI_assert(index < this->m_outputsockets.size()); - return this->m_outputsockets[index]; + return outputs[index]; } NodeInput *Node::getInputSocket(unsigned int index) const { - BLI_assert(index < this->m_inputsockets.size()); - return this->m_inputsockets[index]; + return inputs[index]; } bNodeSocket *Node::getEditorInputSocket(int editorNodeInputSocketIndex) @@ -208,3 +206,5 @@ void NodeOutput::getEditorValueVector(float *value) RNA_pointer_create((ID *)getNode()->getbNodeTree(), &RNA_NodeSocket, getbNodeSocket(), &ptr); return RNA_float_get_array(&ptr, "default_value", value); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_Node.h b/source/blender/compositor/intern/COM_Node.h index 99f1b58b5ef..9aca1a8ff44 100644 --- a/source/blender/compositor/intern/COM_Node.h +++ b/source/blender/compositor/intern/COM_Node.h @@ -18,10 +18,12 @@ #pragma once +#include "BLI_vector.hh" + #include "DNA_node_types.h" + #include <algorithm> #include <string> -#include <vector> /* common node includes * added here so node files don't have to include themselves @@ -29,7 +31,8 @@ #include "COM_CompositorContext.h" #include "COM_NodeConverter.h" -class Node; +namespace blender::compositor { + class NodeOperation; class NodeConverter; @@ -37,10 +40,6 @@ class NodeConverter; * My node documentation. */ class Node { - public: - typedef std::vector<NodeInput *> Inputs; - typedef std::vector<NodeOutput *> Outputs; - private: /** * \brief stores the reference to the SDNA bNode struct @@ -53,16 +52,6 @@ class Node { bNode *m_editorNode; /** - * \brief the list of actual inputsockets \see NodeInput - */ - Inputs m_inputsockets; - - /** - * \brief the list of actual outputsockets \see NodeOutput - */ - Outputs m_outputsockets; - - /** * \brief Is this node part of the active group */ bool m_inActiveGroup; @@ -74,20 +63,14 @@ class Node { protected: /** - * \brief get access to the vector of input sockets + * \brief the list of actual inputsockets \see NodeInput */ - const Inputs &getInputSockets() const - { - return this->m_inputsockets; - } + blender::Vector<NodeInput *> inputs; /** - * \brief get access to the vector of input sockets + * \brief the list of actual outputsockets \see NodeOutput */ - const Outputs &getOutputSockets() const - { - return this->m_outputsockets; - } + blender::Vector<NodeOutput *> outputs; public: Node(bNode *editorNode, bool create_sockets = true); @@ -130,19 +113,19 @@ class Node { } /** - * \brief Return the number of input sockets of this node. + * \brief get access to the vector of input sockets */ - unsigned int getNumberOfInputSockets() const + const blender::Vector<NodeInput *> &getInputSockets() const { - return this->m_inputsockets.size(); + return this->inputs; } /** - * \brief Return the number of output sockets of this node. + * \brief get access to the vector of input sockets */ - unsigned int getNumberOfOutputSockets() const + const blender::Vector<NodeOutput *> &getOutputSockets() const { - return this->m_outputsockets.size(); + return this->outputs; } /** @@ -150,17 +133,7 @@ class Node { * \param index: * the index of the needed outputsocket */ - NodeOutput *getOutputSocket(const unsigned int index) const; - - /** - * get the reference to the first outputsocket - * \param index: - * the index of the needed outputsocket - */ - inline NodeOutput *getOutputSocket() const - { - return getOutputSocket(0); - } + NodeOutput *getOutputSocket(const unsigned int index = 0) const; /** * get the reference to a certain inputsocket @@ -169,14 +142,6 @@ class Node { */ NodeInput *getInputSocket(const unsigned int index) const; - /** Check if this is an input node - * An input node is a node that only has output sockets and no input sockets - */ - bool isInputNode() const - { - return m_inputsockets.empty(); - } - /** * \brief Is this node in the active group (the group that is being edited) * \param isInActiveGroup: @@ -317,3 +282,5 @@ class NodeOutput { void getEditorValueColor(float *value); void getEditorValueVector(float *value); }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_NodeConverter.cc b/source/blender/compositor/intern/COM_NodeConverter.cc index 2db31bd4133..49a2e7988c4 100644 --- a/source/blender/compositor/intern/COM_NodeConverter.cc +++ b/source/blender/compositor/intern/COM_NodeConverter.cc @@ -29,6 +29,8 @@ #include "COM_NodeConverter.h" /* own include */ +namespace blender::compositor { + NodeConverter::NodeConverter(NodeOperationBuilder *builder) : m_builder(builder) { } @@ -160,3 +162,5 @@ ViewerOperation *NodeConverter::active_viewer() const { return m_builder->active_viewer(); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_NodeConverter.h b/source/blender/compositor/intern/COM_NodeConverter.h index e9b05184857..b3f03485249 100644 --- a/source/blender/compositor/intern/COM_NodeConverter.h +++ b/source/blender/compositor/intern/COM_NodeConverter.h @@ -22,6 +22,8 @@ # include "MEM_guardedalloc.h" #endif +namespace blender::compositor { + class NodeInput; class NodeOutput; @@ -120,3 +122,5 @@ class NodeConverter { MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeCompiler") #endif }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_NodeGraph.cc b/source/blender/compositor/intern/COM_NodeGraph.cc index d8220099f1f..7e05bf637b7 100644 --- a/source/blender/compositor/intern/COM_NodeGraph.cc +++ b/source/blender/compositor/intern/COM_NodeGraph.cc @@ -33,6 +33,8 @@ #include "COM_NodeGraph.h" /* own include */ +namespace blender::compositor { + /******************* **** NodeGraph **** *******************/ @@ -43,9 +45,8 @@ NodeGraph::NodeGraph() NodeGraph::~NodeGraph() { - for (int index = 0; index < this->m_nodes.size(); index++) { - Node *node = this->m_nodes[index]; - delete node; + while (m_nodes.size()) { + delete m_nodes.pop_last(); } } @@ -83,7 +84,7 @@ void NodeGraph::add_node(Node *node, node->setInstanceKey(key); node->setIsInActiveGroup(is_active_group); - m_nodes.push_back(node); + m_nodes.append(node); DebugInfo::node_added(node); } @@ -153,27 +154,11 @@ void NodeGraph::add_bNode(const CompositorContext &context, } } -NodeGraph::NodeInputs NodeGraph::find_inputs(const NodeRange &node_range, bNodeSocket *b_socket) -{ - NodeInputs result; - for (NodeGraph::NodeIterator it = node_range.first; it != node_range.second; ++it) { - Node *node = *it; - for (int index = 0; index < node->getNumberOfInputSockets(); index++) { - NodeInput *input = node->getInputSocket(index); - if (input->getbNodeSocket() == b_socket) { - result.push_back(input); - } - } - } - return result; -} - NodeOutput *NodeGraph::find_output(const NodeRange &node_range, bNodeSocket *b_socket) { - for (NodeGraph::NodeIterator it = node_range.first; it != node_range.second; ++it) { + for (blender::Vector<Node *>::iterator it = node_range.first; it != node_range.second; ++it) { Node *node = *it; - for (int index = 0; index < node->getNumberOfOutputSockets(); index++) { - NodeOutput *output = node->getOutputSocket(index); + for (NodeOutput *output : node->getOutputSockets()) { if (output->getbNodeSocket() == b_socket) { return output; } @@ -202,12 +187,13 @@ void NodeGraph::add_bNodeLink(const NodeRange &node_range, bNodeLink *b_nodelink return; } - NodeInputs inputs = find_inputs(node_range, b_nodelink->tosock); - for (NodeInput *input : inputs) { - if (input->isLinked()) { - continue; + for (blender::Vector<Node *>::iterator it = node_range.first; it != node_range.second; ++it) { + Node *node = *it; + for (NodeInput *input : node->getInputSockets()) { + if (input->getbNodeSocket() == b_nodelink->tosock && !input->isLinked()) { + add_link(output, input); + } } - add_link(output, input); } } @@ -331,3 +317,5 @@ void NodeGraph::add_proxies_reroute(bNodeTree *b_ntree, b_node, (bNodeSocket *)b_node->inputs.first, (bNodeSocket *)b_node->outputs.first, false); add_node(proxy, b_ntree, key, is_active_group); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_NodeGraph.h b/source/blender/compositor/intern/COM_NodeGraph.h index 990e3a30831..9347df5d9e2 100644 --- a/source/blender/compositor/intern/COM_NodeGraph.h +++ b/source/blender/compositor/intern/COM_NodeGraph.h @@ -22,7 +22,6 @@ #include <map> #include <set> -#include <vector> #include "DNA_node_types.h" @@ -30,6 +29,8 @@ # include "MEM_guardedalloc.h" #endif +namespace blender::compositor { + class CompositorContext; class Node; class NodeInput; @@ -50,18 +51,15 @@ class NodeGraph { } }; - typedef std::vector<Node *> Nodes; - typedef Nodes::iterator NodeIterator; - private: - Nodes m_nodes; + blender::Vector<Node *> m_nodes; blender::Vector<Link> m_links; public: NodeGraph(); ~NodeGraph(); - const Nodes &nodes() const + const blender::Vector<Node *> &nodes() const { return m_nodes; } @@ -73,8 +71,8 @@ class NodeGraph { void from_bNodeTree(const CompositorContext &context, bNodeTree *tree); protected: - typedef std::pair<NodeIterator, NodeIterator> NodeRange; - typedef std::vector<NodeInput *> NodeInputs; + typedef std::pair<blender::Vector<Node *>::iterator, blender::Vector<Node *>::iterator> + NodeRange; static bNodeSocket *find_b_node_input(bNode *b_node, const char *identifier); static bNodeSocket *find_b_node_output(bNode *b_node, const char *identifier); @@ -93,7 +91,6 @@ class NodeGraph { bNodeInstanceKey key, bool is_active_group); - NodeInputs find_inputs(const NodeRange &node_range, bNodeSocket *b_socket); NodeOutput *find_output(const NodeRange &node_range, bNodeSocket *b_socket); void add_bNodeLink(const NodeRange &node_range, bNodeLink *b_nodelink); @@ -124,3 +121,5 @@ class NodeGraph { MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeGraph") #endif }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_NodeOperation.cc b/source/blender/compositor/intern/COM_NodeOperation.cc index 0cc642479ac..297ef100a1b 100644 --- a/source/blender/compositor/intern/COM_NodeOperation.cc +++ b/source/blender/compositor/intern/COM_NodeOperation.cc @@ -24,6 +24,8 @@ #include "COM_NodeOperation.h" /* own include */ +namespace blender::compositor { + /******************* **** NodeOperation **** *******************/ @@ -31,76 +33,52 @@ NodeOperation::NodeOperation() { this->m_resolutionInputSocketIndex = 0; - this->m_complex = false; this->m_width = 0; this->m_height = 0; - this->m_isResolutionSet = false; - this->m_openCL = false; this->m_btree = nullptr; } -NodeOperation::~NodeOperation() -{ - while (!this->m_outputs.empty()) { - delete (this->m_outputs.back()); - this->m_outputs.pop_back(); - } - while (!this->m_inputs.empty()) { - delete (this->m_inputs.back()); - this->m_inputs.pop_back(); - } -} - -NodeOperationOutput *NodeOperation::getOutputSocket(unsigned int index) const +NodeOperationOutput *NodeOperation::getOutputSocket(unsigned int index) { - BLI_assert(index < m_outputs.size()); - return m_outputs[index]; + return &m_outputs[index]; } -NodeOperationInput *NodeOperation::getInputSocket(unsigned int index) const +NodeOperationInput *NodeOperation::getInputSocket(unsigned int index) { - BLI_assert(index < m_inputs.size()); - return m_inputs[index]; + return &m_inputs[index]; } -void NodeOperation::addInputSocket(DataType datatype, InputResizeMode resize_mode) +void NodeOperation::addInputSocket(DataType datatype, ResizeMode resize_mode) { - NodeOperationInput *socket = new NodeOperationInput(this, datatype, resize_mode); - m_inputs.push_back(socket); + m_inputs.append(NodeOperationInput(this, datatype, resize_mode)); } void NodeOperation::addOutputSocket(DataType datatype) { - NodeOperationOutput *socket = new NodeOperationOutput(this, datatype); - m_outputs.push_back(socket); + m_outputs.append(NodeOperationOutput(this, datatype)); } void NodeOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]) { - unsigned int temp[2]; - unsigned int temp2[2]; + if (m_resolutionInputSocketIndex < m_inputs.size()) { + NodeOperationInput &input = m_inputs[m_resolutionInputSocketIndex]; + input.determineResolution(resolution, preferredResolution); + } + unsigned int temp2[2] = {resolution[0], resolution[1]}; + unsigned int temp[2]; for (unsigned int index = 0; index < m_inputs.size(); index++) { - NodeOperationInput *input = m_inputs[index]; - if (input->isConnected()) { - if (index == this->m_resolutionInputSocketIndex) { - input->determineResolution(resolution, preferredResolution); - temp2[0] = resolution[0]; - temp2[1] = resolution[1]; - break; - } + if (index == this->m_resolutionInputSocketIndex) { + continue; } - } - for (unsigned int index = 0; index < m_inputs.size(); index++) { - NodeOperationInput *input = m_inputs[index]; - if (input->isConnected()) { - if (index != this->m_resolutionInputSocketIndex) { - input->determineResolution(temp, temp2); - } + NodeOperationInput &input = m_inputs[index]; + if (input.isConnected()) { + input.determineResolution(temp, temp2); } } } + void NodeOperation::setResolutionInputSocketIndex(unsigned int index) { this->m_resolutionInputSocketIndex = index; @@ -149,20 +127,11 @@ NodeOperation *NodeOperation::getInputOperation(unsigned int inputSocketIndex) return nullptr; } -void NodeOperation::getConnectedInputSockets(Inputs *sockets) -{ - for (NodeOperationInput *input : m_inputs) { - if (input->isConnected()) { - sockets->push_back(input); - } - } -} - bool NodeOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { - if (isInputOperation()) { + if (m_inputs.size() == 0) { BLI_rcti_init(output, input->xmin, input->xmax, input->ymin, input->ymax); return false; } @@ -195,9 +164,7 @@ bool NodeOperation::determineDependingAreaOfInterest(rcti *input, **** OpInput **** *****************/ -NodeOperationInput::NodeOperationInput(NodeOperation *op, - DataType datatype, - InputResizeMode resizeMode) +NodeOperationInput::NodeOperationInput(NodeOperation *op, DataType datatype, ResizeMode resizeMode) : m_operation(op), m_datatype(datatype), m_resizeMode(resizeMode), m_link(nullptr) { } @@ -232,7 +199,7 @@ void NodeOperationOutput::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]) { NodeOperation &operation = getOperation(); - if (operation.isResolutionSet()) { + if (operation.get_flags().is_resolution_set) { resolution[0] = operation.getWidth(); resolution[1] = operation.getHeight(); } @@ -241,3 +208,5 @@ void NodeOperationOutput::determineResolution(unsigned int resolution[2], operation.setResolution(resolution); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_NodeOperation.h b/source/blender/compositor/intern/COM_NodeOperation.h index 7857837a95d..f300fb092a3 100644 --- a/source/blender/compositor/intern/COM_NodeOperation.h +++ b/source/blender/compositor/intern/COM_NodeOperation.h @@ -28,75 +28,235 @@ #include "COM_MemoryBuffer.h" #include "COM_MemoryProxy.h" +#include "COM_MetaData.h" #include "COM_Node.h" -#include "COM_SocketReader.h" #include "clew.h" +namespace blender::compositor { + class OpenCLDevice; class ReadBufferOperation; class WriteBufferOperation; -class NodeOperationInput; -class NodeOperationOutput; +class NodeOperation; +typedef NodeOperation SocketReader; /** * \brief Resize modes of inputsockets * How are the input and working resolutions matched * \ingroup Model */ -typedef enum InputResizeMode { +enum class ResizeMode { /** \brief Center the input image to the center of the working area of the node, no resizing * occurs */ - COM_SC_CENTER = NS_CR_CENTER, + Center = NS_CR_CENTER, /** \brief The bottom left of the input image is the bottom left of the working area of the node, * no resizing occurs */ - COM_SC_NO_RESIZE = NS_CR_NONE, + None = NS_CR_NONE, /** \brief Fit the width of the input image to the width of the working area of the node */ - COM_SC_FIT_WIDTH = NS_CR_FIT_WIDTH, + FitWidth = NS_CR_FIT_WIDTH, /** \brief Fit the height of the input image to the height of the working area of the node */ - COM_SC_FIT_HEIGHT = NS_CR_FIT_HEIGHT, + FitHeight = NS_CR_FIT_HEIGHT, /** \brief Fit the width or the height of the input image to the width or height of the working * area of the node, image will be larger than the working area */ - COM_SC_FIT = NS_CR_FIT, + FitAny = NS_CR_FIT, /** \brief Fit the width and the height of the input image to the width and height of the working * area of the node, image will be equally larger than the working area */ - COM_SC_STRETCH = NS_CR_STRETCH, -} InputResizeMode; + Stretch = NS_CR_STRETCH, +}; + +enum class PixelSampler { + Nearest = 0, + Bilinear = 1, + Bicubic = 2, +}; + +class NodeOperationInput { + private: + NodeOperation *m_operation; + + /** Datatype of this socket. Is used for automatically data transformation. + * \section data-conversion + */ + DataType m_datatype; + + /** Resize mode of this socket */ + ResizeMode m_resizeMode; + + /** Connected output */ + NodeOperationOutput *m_link; -/** - * \brief NodeOperation contains calculation logic - * - * Subclasses needs to implement the execution method (defined in SocketReader) to implement logic. - * \ingroup Model - */ -class NodeOperation : public SocketReader { public: - typedef std::vector<NodeOperationInput *> Inputs; - typedef std::vector<NodeOperationOutput *> Outputs; + NodeOperationInput(NodeOperation *op, + DataType datatype, + ResizeMode resizeMode = ResizeMode::Center); + NodeOperation &getOperation() const + { + return *m_operation; + } + DataType getDataType() const + { + return m_datatype; + } + + void setLink(NodeOperationOutput *link) + { + m_link = link; + } + NodeOperationOutput *getLink() const + { + return m_link; + } + bool isConnected() const + { + return m_link; + } + + void setResizeMode(ResizeMode resizeMode) + { + this->m_resizeMode = resizeMode; + } + ResizeMode getResizeMode() const + { + return this->m_resizeMode; + } + + SocketReader *getReader(); + + void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); + +#ifdef WITH_CXX_GUARDEDALLOC + MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeOperation") +#endif +}; + +class NodeOperationOutput { private: - Inputs m_inputs; - Outputs m_outputs; + NodeOperation *m_operation; + + /** Datatype of this socket. Is used for automatically data transformation. + * \section data-conversion + */ + DataType m_datatype; + + public: + NodeOperationOutput(NodeOperation *op, DataType datatype); + + NodeOperation &getOperation() const + { + return *m_operation; + } + DataType getDataType() const + { + return m_datatype; + } /** - * \brief the index of the input socket that will be used to determine the resolution + * \brief determine the resolution of this data going through this socket + * \param resolution: the result of this operation + * \param preferredResolution: the preferable resolution as no resolution could be determined */ - unsigned int m_resolutionInputSocketIndex; + void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); + +#ifdef WITH_CXX_GUARDEDALLOC + MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeOperation") +#endif +}; +struct NodeOperationFlags { /** - * \brief is this operation a complex one. + * Is this an complex operation. + * + * The input and output buffers of Complex operations are stored in buffers. It allows + * sequential and read/write. * * Complex operations are typically doing many reads to calculate the output of a single pixel. * Mostly Filter types (Blurs, Convolution, Defocus etc) need this to be set to true. */ - bool m_complex; + bool complex : 1; + + /** + * Does this operation support OpenCL. + */ + bool open_cl : 1; + + bool single_threaded : 1; + + /** + * Does the operation needs a viewer border. + * Basically, setting border need to happen for only operations + * which operates in render resolution buffers (like compositor + * output nodes). + * + * In this cases adding border will lead to mapping coordinates + * from output buffer space to input buffer spaces when executing + * operation. + * + * But nodes like viewer and file output just shall display or + * safe the same exact buffer which goes to their input, no need + * in any kind of coordinates mapping. + */ + bool use_render_border : 1; + bool use_viewer_border : 1; + + /** + * Is the resolution of the operation set. + */ + bool is_resolution_set : 1; + + /** + * Is this a set operation (value, color, vector). + */ + bool is_set_operation : 1; + bool is_write_buffer_operation : 1; + bool is_read_buffer_operation : 1; + bool is_proxy_operation : 1; + bool is_viewer_operation : 1; + bool is_preview_operation : 1; + + /** + * When set additional data conversion operations are added to + * convert the data. SocketProxyOperation don't always need to do data conversions. + * + * By default data conversions are enabled. + */ + bool use_datatype_conversion : 1; + + NodeOperationFlags() + { + complex = false; + single_threaded = false; + open_cl = false; + use_render_border = false; + use_viewer_border = false; + is_resolution_set = false; + is_set_operation = false; + is_read_buffer_operation = false; + is_write_buffer_operation = false; + is_proxy_operation = false; + is_viewer_operation = false; + is_preview_operation = false; + use_datatype_conversion = true; + } +}; + +/** + * \brief NodeOperation contains calculation logic + * + * Subclasses needs to implement the execution method (defined in SocketReader) to implement logic. + * \ingroup Model + */ +class NodeOperation { + private: + blender::Vector<NodeOperationInput> m_inputs; + blender::Vector<NodeOperationOutput> m_outputs; /** - * \brief can this operation be scheduled on an OpenCL device. - * \note Only applicable if complex is True + * \brief the index of the input socket that will be used to determine the resolution */ - bool m_openCL; + unsigned int m_resolutionInputSocketIndex; /** * \brief mutex reference for very special node initializations @@ -114,13 +274,31 @@ class NodeOperation : public SocketReader { */ const bNodeTree *m_btree; + protected: /** - * \brief set to truth when resolution for this operation is set + * Width of the output of this operation. */ - bool m_isResolutionSet; + unsigned int m_width; + + /** + * Height of the output of this operation. + */ + unsigned int m_height; + + /** + * Flags how to evaluate this operation. + */ + NodeOperationFlags flags; public: - virtual ~NodeOperation(); + virtual ~NodeOperation() + { + } + + const NodeOperationFlags get_flags() const + { + return flags; + } unsigned int getNumberOfInputSockets() const { @@ -130,20 +308,8 @@ class NodeOperation : public SocketReader { { return m_outputs.size(); } - NodeOperationOutput *getOutputSocket(unsigned int index) const; - NodeOperationOutput *getOutputSocket() const - { - return getOutputSocket(0); - } - NodeOperationInput *getInputSocket(unsigned int index) const; - - /** Check if this is an input operation - * An input operation is an operation that only has output sockets and no input sockets - */ - bool isInputOperation() const - { - return m_inputs.empty(); - } + NodeOperationOutput *getOutputSocket(unsigned int index = 0); + NodeOperationInput *getInputSocket(unsigned int index); /** * \brief determine the resolution of this node @@ -155,11 +321,11 @@ class NodeOperation : public SocketReader { unsigned int preferredResolution[2]); /** - * \brief isOutputOperation determines whether this operation is an output of the ExecutionSystem - * during rendering or editing. + * \brief isOutputOperation determines whether this operation is an output of the + * ExecutionSystem during rendering or editing. * - * Default behavior if not overridden, this operation will not be evaluated as being an output of - * the ExecutionSystem. + * Default behavior if not overridden, this operation will not be evaluated as being an output + * of the ExecutionSystem. * * \see ExecutionSystem * \ingroup check @@ -174,11 +340,6 @@ class NodeOperation : public SocketReader { return false; } - virtual int isSingleThreaded() - { - return false; - } - void setbNodeTree(const bNodeTree *tree) { this->m_btree = tree; @@ -241,62 +402,19 @@ class NodeOperation : public SocketReader { } virtual void deinitExecution(); - bool isResolutionSet() - { - return this->m_isResolutionSet; - } - /** * \brief set the resolution * \param resolution: the resolution to set */ void setResolution(unsigned int resolution[2]) { - if (!isResolutionSet()) { + if (!this->flags.is_resolution_set) { this->m_width = resolution[0]; this->m_height = resolution[1]; - this->m_isResolutionSet = true; + this->flags.is_resolution_set = true; } } - void getConnectedInputSockets(Inputs *sockets); - - /** - * \brief is this operation complex - * - * Complex operations are typically doing many reads to calculate the output of a single pixel. - * Mostly Filter types (Blurs, Convolution, Defocus etc) need this to be set to true. - */ - bool isComplex() const - { - return this->m_complex; - } - - virtual bool isSetOperation() const - { - return false; - } - - /** - * \brief is this operation of type ReadBufferOperation - * \return [true:false] - * \see ReadBufferOperation - */ - virtual bool isReadBufferOperation() const - { - return false; - } - - /** - * \brief is this operation of type WriteBufferOperation - * \return [true:false] - * \see WriteBufferOperation - */ - virtual bool isWriteBufferOperation() const - { - return false; - } - /** * \brief is this operation the active viewer output * user can select an ViewerNode to be active @@ -314,8 +432,8 @@ class NodeOperation : public SocketReader { rcti *output); /** - * \brief set the index of the input socket that will determine the resolution of this operation - * \param index: the index to set + * \brief set the index of the input socket that will determine the resolution of this + * operation \param index: the index to set */ void setResolutionInputSocketIndex(unsigned int index); @@ -329,65 +447,81 @@ class NodeOperation : public SocketReader { return CompositorPriority::Low; } - /** - * \brief can this NodeOperation be scheduled on an OpenCLDevice - * \see WorkScheduler.schedule - * \see ExecutionGroup.addOperation - */ - bool isOpenCL() const + inline bool isBraked() const { - return this->m_openCL; + return this->m_btree->test_break(this->m_btree->tbh); } - virtual bool isViewerOperation() const + inline void updateDraw() { - return false; + if (this->m_btree->update_draw) { + this->m_btree->update_draw(this->m_btree->udh); + } } - virtual bool isPreviewOperation() const + + unsigned int getWidth() const { - return false; + return m_width; } - virtual bool isFileOutputOperation() const + + unsigned int getHeight() const { - return false; + return m_height; } - virtual bool isProxyOperation() const + + inline void readSampled(float result[4], float x, float y, PixelSampler sampler) { - return false; + executePixelSampled(result, x, y, sampler); } - virtual bool useDatatypeConversion() const + inline void readFiltered(float result[4], float x, float y, float dx[2], float dy[2]) { - return true; + executePixelFiltered(result, x, y, dx, dy); } - inline bool isBraked() const + inline void read(float result[4], int x, int y, void *chunkData) { - return this->m_btree->test_break(this->m_btree->tbh); + executePixel(result, x, y, chunkData); } - inline void updateDraw() + virtual void *initializeTileData(rcti * /*rect*/) + { + return 0; + } + + virtual void deinitializeTileData(rcti * /*rect*/, void * /*data*/) { - if (this->m_btree->update_draw) { - this->m_btree->update_draw(this->m_btree->udh); - } + } + + virtual MemoryBuffer *getInputMemoryBuffer(MemoryBuffer ** /*memoryBuffers*/) + { + return 0; + } + + /** + * Return the meta data associated with this branch. + * + * The return parameter holds an instance or is an nullptr. */ + virtual std::unique_ptr<MetaData> getMetaData() + { + return std::unique_ptr<MetaData>(); } protected: NodeOperation(); - void addInputSocket(DataType datatype, InputResizeMode resize_mode = COM_SC_CENTER); + void addInputSocket(DataType datatype, ResizeMode resize_mode = ResizeMode::Center); void addOutputSocket(DataType datatype); void setWidth(unsigned int width) { this->m_width = width; - this->m_isResolutionSet = true; + this->flags.is_resolution_set = true; } void setHeight(unsigned int height) { this->m_height = height; - this->m_isResolutionSet = true; + this->flags.is_resolution_set = true; } SocketReader *getInputSocketReader(unsigned int inputSocketindex); NodeOperation *getInputOperation(unsigned int inputSocketindex); @@ -405,114 +539,59 @@ class NodeOperation : public SocketReader { */ void setComplex(bool complex) { - this->m_complex = complex; + this->flags.complex = complex; } /** - * \brief set if this NodeOperation can be scheduled on a OpenCLDevice + * \brief calculate a single pixel + * \note this method is called for non-complex + * \param result: is a float[4] array to store the result + * \param x: the x-coordinate of the pixel to calculate in image space + * \param y: the y-coordinate of the pixel to calculate in image space + * \param inputBuffers: chunks that can be read by their ReadBufferOperation. */ - void setOpenCL(bool openCL) + virtual void executePixelSampled(float /*output*/[4], + float /*x*/, + float /*y*/, + PixelSampler /*sampler*/) { - this->m_openCL = openCL; } - /* allow the DebugInfo class to look at internals */ - friend class DebugInfo; - -#ifdef WITH_CXX_GUARDEDALLOC - MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeOperation") -#endif -}; - -class NodeOperationInput { - private: - NodeOperation *m_operation; - - /** Datatype of this socket. Is used for automatically data transformation. - * \section data-conversion + /** + * \brief calculate a single pixel + * \note this method is called for complex + * \param result: is a float[4] array to store the result + * \param x: the x-coordinate of the pixel to calculate in image space + * \param y: the y-coordinate of the pixel to calculate in image space + * \param inputBuffers: chunks that can be read by their ReadBufferOperation. + * \param chunkData: chunk specific data a during execution time. */ - DataType m_datatype; - - /** Resize mode of this socket */ - InputResizeMode m_resizeMode; - - /** Connected output */ - NodeOperationOutput *m_link; - - public: - NodeOperationInput(NodeOperation *op, - DataType datatype, - InputResizeMode resizeMode = COM_SC_CENTER); - - NodeOperation &getOperation() const - { - return *m_operation; - } - DataType getDataType() const - { - return m_datatype; - } - - void setLink(NodeOperationOutput *link) - { - m_link = link; - } - NodeOperationOutput *getLink() const - { - return m_link; - } - bool isConnected() const - { - return m_link; - } - - void setResizeMode(InputResizeMode resizeMode) - { - this->m_resizeMode = resizeMode; - } - InputResizeMode getResizeMode() const + virtual void executePixel(float output[4], int x, int y, void * /*chunkData*/) { - return this->m_resizeMode; + executePixelSampled(output, x, y, PixelSampler::Nearest); } - SocketReader *getReader(); - - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); - -#ifdef WITH_CXX_GUARDEDALLOC - MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeOperation") -#endif -}; - -class NodeOperationOutput { - private: - NodeOperation *m_operation; - - /** Datatype of this socket. Is used for automatically data transformation. - * \section data-conversion + /** + * \brief calculate a single pixel using an EWA filter + * \note this method is called for complex + * \param result: is a float[4] array to store the result + * \param x: the x-coordinate of the pixel to calculate in image space + * \param y: the y-coordinate of the pixel to calculate in image space + * \param dx: + * \param dy: + * \param inputBuffers: chunks that can be read by their ReadBufferOperation. */ - DataType m_datatype; - - public: - NodeOperationOutput(NodeOperation *op, DataType datatype); - - NodeOperation &getOperation() const + virtual void executePixelFiltered( + float /*output*/[4], float /*x*/, float /*y*/, float /*dx*/[2], float /*dy*/[2]) { - return *m_operation; - } - DataType getDataType() const - { - return m_datatype; } - /** - * \brief determine the resolution of this data going through this socket - * \param resolution: the result of this operation - * \param preferredResolution: the preferable resolution as no resolution could be determined - */ - void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); + /* allow the DebugInfo class to look at internals */ + friend class DebugInfo; #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeOperation") #endif }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.cc b/source/blender/compositor/intern/COM_NodeOperationBuilder.cc index 1c741283c7b..fdd48da3fb4 100644 --- a/source/blender/compositor/intern/COM_NodeOperationBuilder.cc +++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.cc @@ -38,6 +38,8 @@ #include "COM_NodeOperationBuilder.h" /* own include */ +namespace blender::compositor { + NodeOperationBuilder::NodeOperationBuilder(const CompositorContext *context, bNodeTree *b_nodetree) : m_context(context), m_current_node(nullptr), m_active_viewer(nullptr) { @@ -53,9 +55,7 @@ void NodeOperationBuilder::convertToOperations(ExecutionSystem *system) /* interface handle for nodes */ NodeConverter converter(this); - for (int index = 0; index < m_graph.nodes().size(); index++) { - Node *node = (Node *)m_graph.nodes()[index]; - + for (Node *node : m_graph.nodes()) { m_current_node = node; DebugInfo::node_to_operations(node); @@ -256,7 +256,8 @@ void NodeOperationBuilder::add_datatype_conversions() /* proxy operations can skip data type conversion */ NodeOperation *from_op = &link.from()->getOperation(); NodeOperation *to_op = &link.to()->getOperation(); - if (!(from_op->useDatatypeConversion() || to_op->useDatatypeConversion())) { + if (!(from_op->get_flags().use_datatype_conversion || + to_op->get_flags().use_datatype_conversion)) { continue; } @@ -352,8 +353,8 @@ void NodeOperationBuilder::resolve_proxies() blender::Vector<Link> proxy_links; for (const Link &link : m_links) { /* don't replace links from proxy to proxy, since we may need them for replacing others! */ - if (link.from()->getOperation().isProxyOperation() && - !link.to()->getOperation().isProxyOperation()) { + if (link.from()->getOperation().get_flags().is_proxy_operation && + !link.to()->getOperation().get_flags().is_proxy_operation) { proxy_links.append(link); } } @@ -364,7 +365,7 @@ void NodeOperationBuilder::resolve_proxies() do { /* walk upstream bypassing the proxy operation */ from = from->getOperation().getInputSocket(0)->getLink(); - } while (from && from->getOperation().isProxyOperation()); + } while (from && from->getOperation().get_flags().is_proxy_operation); removeInputLink(to); /* we may not have a final proxy input link, @@ -380,7 +381,7 @@ void NodeOperationBuilder::determineResolutions() { /* determine all resolutions of the operations (Width/Height) */ for (NodeOperation *op : m_operations) { - if (op->isOutputOperation(m_context->isRendering()) && !op->isPreviewOperation()) { + if (op->isOutputOperation(m_context->isRendering()) && !op->get_flags().is_preview_operation) { unsigned int resolution[2] = {0, 0}; unsigned int preferredResolution[2] = {0, 0}; op->determineResolution(resolution, preferredResolution); @@ -389,7 +390,7 @@ void NodeOperationBuilder::determineResolutions() } for (NodeOperation *op : m_operations) { - if (op->isOutputOperation(m_context->isRendering()) && op->isPreviewOperation()) { + if (op->isOutputOperation(m_context->isRendering()) && op->get_flags().is_preview_operation) { unsigned int resolution[2] = {0, 0}; unsigned int preferredResolution[2] = {0, 0}; op->determineResolution(resolution, preferredResolution); @@ -401,7 +402,7 @@ void NodeOperationBuilder::determineResolutions() { blender::Vector<Link> convert_links; for (const Link &link : m_links) { - if (link.to()->getResizeMode() != COM_SC_NO_RESIZE) { + if (link.to()->getResizeMode() != ResizeMode::None) { NodeOperation &from_op = link.from()->getOperation(); NodeOperation &to_op = link.to()->getOperation(); if (from_op.getWidth() != to_op.getWidth() || from_op.getHeight() != to_op.getHeight()) { @@ -433,7 +434,7 @@ WriteBufferOperation *NodeOperationBuilder::find_attached_write_buffer_operation for (const Link &link : m_links) { if (link.from() == output) { NodeOperation &op = link.to()->getOperation(); - if (op.isWriteBufferOperation()) { + if (op.get_flags().is_write_buffer_operation) { return (WriteBufferOperation *)(&op); } } @@ -449,7 +450,7 @@ void NodeOperationBuilder::add_input_buffers(NodeOperation * /*operation*/, } NodeOperationOutput *output = input->getLink(); - if (output->getOperation().isReadBufferOperation()) { + if (output->getOperation().get_flags().is_read_buffer_operation) { /* input is already buffered, no need to add another */ return; } @@ -491,7 +492,7 @@ void NodeOperationBuilder::add_output_buffers(NodeOperation *operation, WriteBufferOperation *writeOperation = nullptr; for (NodeOperationInput *target : targets) { /* try to find existing write buffer operation */ - if (target->getOperation().isWriteBufferOperation()) { + if (target->getOperation().get_flags().is_write_buffer_operation) { BLI_assert(writeOperation == nullptr); /* there should only be one write op connected */ writeOperation = (WriteBufferOperation *)(&target->getOperation()); } @@ -536,7 +537,7 @@ void NodeOperationBuilder::add_complex_operation_buffers() */ blender::Vector<NodeOperation *> complex_ops; for (NodeOperation *operation : m_operations) { - if (operation->isComplex()) { + if (operation->get_flags().complex) { complex_ops.append(operation); } } @@ -571,7 +572,7 @@ static void find_reachable_operations_recursive(Tags &reachable, NodeOperation * } /* associated write-buffer operations are executed as well */ - if (op->isReadBufferOperation()) { + if (op->get_flags().is_read_buffer_operation) { ReadBufferOperation *read_op = (ReadBufferOperation *)op; MemoryProxy *memproxy = read_op->getMemoryProxy(); find_reachable_operations_recursive(reachable, memproxy->getWriteBufferOperation()); @@ -675,7 +676,7 @@ void NodeOperationBuilder::group_operations() } /* add new groups for associated memory proxies where needed */ - if (op->isReadBufferOperation()) { + if (op->get_flags().is_read_buffer_operation) { ReadBufferOperation *read_op = (ReadBufferOperation *)op; MemoryProxy *memproxy = read_op->getMemoryProxy(); @@ -686,3 +687,5 @@ void NodeOperationBuilder::group_operations() } } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.h b/source/blender/compositor/intern/COM_NodeOperationBuilder.h index 8f55574fa88..8e5ec58c3be 100644 --- a/source/blender/compositor/intern/COM_NodeOperationBuilder.h +++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.h @@ -24,6 +24,8 @@ #include "COM_NodeGraph.h" +namespace blender::compositor { + class CompositorContext; class Node; @@ -157,3 +159,5 @@ class NodeOperationBuilder { MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeCompilerImpl") #endif }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.cc b/source/blender/compositor/intern/COM_OpenCLDevice.cc index 9a6012e5c68..b96dbe91434 100644 --- a/source/blender/compositor/intern/COM_OpenCLDevice.cc +++ b/source/blender/compositor/intern/COM_OpenCLDevice.cc @@ -19,6 +19,8 @@ #include "COM_OpenCLDevice.h" #include "COM_WorkScheduler.h" +namespace blender::compositor { + enum COM_VendorID { NVIDIA = 0x10DE, AMD = 0x1002 }; const cl_image_format IMAGE_FORMAT_COLOR = { CL_RGBA, @@ -43,34 +45,28 @@ OpenCLDevice::OpenCLDevice(cl_context context, this->m_program = program; this->m_queue = nullptr; this->m_vendorID = vendorId; -} -bool OpenCLDevice::initialize() -{ cl_int error; this->m_queue = clCreateCommandQueue(this->m_context, this->m_device, 0, &error); - return false; } -void OpenCLDevice::deinitialize() +OpenCLDevice::~OpenCLDevice() { if (this->m_queue) { clReleaseCommandQueue(this->m_queue); } } -void OpenCLDevice::execute(WorkPackage *work) +void OpenCLDevice::execute(WorkPackage *work_package) { - const unsigned int chunkNumber = work->chunk_number; - ExecutionGroup *executionGroup = work->execution_group; - rcti rect; + const unsigned int chunkNumber = work_package->chunk_number; + ExecutionGroup *executionGroup = work_package->execution_group; - executionGroup->determineChunkRect(&rect, chunkNumber); MemoryBuffer **inputBuffers = executionGroup->getInputBuffersOpenCL(chunkNumber); - MemoryBuffer *outputBuffer = executionGroup->allocateOutputBuffer(rect); + MemoryBuffer *outputBuffer = executionGroup->allocateOutputBuffer(work_package->rect); executionGroup->getOutputOperation()->executeOpenCLRegion( - this, &rect, chunkNumber, inputBuffers, outputBuffer); + this, &work_package->rect, chunkNumber, inputBuffers, outputBuffer); delete outputBuffer; @@ -274,3 +270,5 @@ cl_kernel OpenCLDevice::COM_clCreateKernel(const char *kernelname, } return kernel; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.h b/source/blender/compositor/intern/COM_OpenCLDevice.h index e4fd397b4e8..355451cef68 100644 --- a/source/blender/compositor/intern/COM_OpenCLDevice.h +++ b/source/blender/compositor/intern/COM_OpenCLDevice.h @@ -25,6 +25,8 @@ class OpenCLDevice; #include "COM_WorkScheduler.h" #include "clew.h" +namespace blender::compositor { + /** * \brief device representing an GPU OpenCL device. * an instance of this class represents a single cl_device @@ -65,26 +67,13 @@ class OpenCLDevice : public Device { * \param vendorID: */ OpenCLDevice(cl_context context, cl_device_id device, cl_program program, cl_int vendorId); - - /** - * \brief initialize the device - * During initialization the OpenCL cl_command_queue is created - * the command queue is stored in the field queue. - * \see queue - */ - bool initialize(); - - /** - * \brief de-initialize the device - * During de-initialization the command queue is cleared - */ - void deinitialize(); + ~OpenCLDevice(); /** * \brief execute a WorkPackage * \param work: the WorkPackage to execute */ - void execute(WorkPackage *work); + void execute(WorkPackage *work) override; /** * \brief determine an image format @@ -130,3 +119,5 @@ class OpenCLDevice : public Device { NodeOperation *operation); cl_kernel COM_clCreateKernel(const char *kernelname, std::list<cl_kernel> *clKernelsToCleanUp); }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_SingleThreadedOperation.cc b/source/blender/compositor/intern/COM_SingleThreadedOperation.cc index 5febf3802de..01be6e1afed 100644 --- a/source/blender/compositor/intern/COM_SingleThreadedOperation.cc +++ b/source/blender/compositor/intern/COM_SingleThreadedOperation.cc @@ -18,10 +18,13 @@ #include "COM_SingleThreadedOperation.h" +namespace blender::compositor { + SingleThreadedOperation::SingleThreadedOperation() { this->m_cachedInstance = nullptr; - setComplex(true); + flags.complex = true; + flags.single_threaded = true; } void SingleThreadedOperation::initExecution() @@ -56,3 +59,5 @@ void *SingleThreadedOperation::initializeTileData(rcti *rect) unlockMutex(); return this->m_cachedInstance; } + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_SingleThreadedOperation.h b/source/blender/compositor/intern/COM_SingleThreadedOperation.h index 32f4515cf2a..9945f938ff9 100644 --- a/source/blender/compositor/intern/COM_SingleThreadedOperation.h +++ b/source/blender/compositor/intern/COM_SingleThreadedOperation.h @@ -20,6 +20,8 @@ #include "COM_NodeOperation.h" +namespace blender::compositor { + class SingleThreadedOperation : public NodeOperation { private: MemoryBuffer *m_cachedInstance; @@ -36,24 +38,21 @@ class SingleThreadedOperation : 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; virtual MemoryBuffer *createMemoryBuffer(rcti *rect) = 0; - - int isSingleThreaded() - { - return true; - } }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_SocketReader.h b/source/blender/compositor/intern/COM_SocketReader.h deleted file mode 100644 index 7c4132efe60..00000000000 --- a/source/blender/compositor/intern/COM_SocketReader.h +++ /dev/null @@ -1,153 +0,0 @@ -/* - * 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. - * - * Copyright 2011, Blender Foundation. - */ - -#pragma once - -#include "BLI_rect.h" -#include "COM_MetaData.h" -#include "COM_defines.h" - -#include <memory> -#include <optional> - -#ifdef WITH_CXX_GUARDEDALLOC -# include "MEM_guardedalloc.h" -#endif - -typedef enum PixelSampler { - COM_PS_NEAREST = 0, - COM_PS_BILINEAR = 1, - COM_PS_BICUBIC = 2, -} PixelSampler; - -class MemoryBuffer; - -/** - * \brief Helper class for reading socket data. - * Only use this class for dispatching (un-ary and n-ary) executions. - * \ingroup Execution - */ -class SocketReader { - private: - protected: - /** - * \brief Holds the width of the output of this operation. - */ - unsigned int m_width; - - /** - * \brief Holds the height of the output of this operation. - */ - unsigned int m_height; - - /** - * \brief calculate a single pixel - * \note this method is called for non-complex - * \param result: is a float[4] array to store the result - * \param x: the x-coordinate of the pixel to calculate in image space - * \param y: the y-coordinate of the pixel to calculate in image space - * \param inputBuffers: chunks that can be read by their ReadBufferOperation. - */ - virtual void executePixelSampled(float /*output*/[4], - float /*x*/, - float /*y*/, - PixelSampler /*sampler*/) - { - } - - /** - * \brief calculate a single pixel - * \note this method is called for complex - * \param result: is a float[4] array to store the result - * \param x: the x-coordinate of the pixel to calculate in image space - * \param y: the y-coordinate of the pixel to calculate in image space - * \param inputBuffers: chunks that can be read by their ReadBufferOperation. - * \param chunkData: chunk specific data a during execution time. - */ - virtual void executePixel(float output[4], int x, int y, void * /*chunkData*/) - { - executePixelSampled(output, x, y, COM_PS_NEAREST); - } - - /** - * \brief calculate a single pixel using an EWA filter - * \note this method is called for complex - * \param result: is a float[4] array to store the result - * \param x: the x-coordinate of the pixel to calculate in image space - * \param y: the y-coordinate of the pixel to calculate in image space - * \param dx: - * \param dy: - * \param inputBuffers: chunks that can be read by their ReadBufferOperation. - */ - virtual void executePixelFiltered( - float /*output*/[4], float /*x*/, float /*y*/, float /*dx*/[2], float /*dy*/[2]) - { - } - - public: - inline void readSampled(float result[4], float x, float y, PixelSampler sampler) - { - executePixelSampled(result, x, y, sampler); - } - inline void read(float result[4], int x, int y, void *chunkData) - { - executePixel(result, x, y, chunkData); - } - inline void readFiltered(float result[4], float x, float y, float dx[2], float dy[2]) - { - executePixelFiltered(result, x, y, dx, dy); - } - - virtual void *initializeTileData(rcti * /*rect*/) - { - return 0; - } - virtual void deinitializeTileData(rcti * /*rect*/, void * /*data*/) - { - } - - virtual ~SocketReader() - { - } - - virtual MemoryBuffer *getInputMemoryBuffer(MemoryBuffer ** /*memoryBuffers*/) - { - return 0; - } - - inline unsigned int getWidth() const - { - return this->m_width; - } - inline unsigned int getHeight() const - { - return this->m_height; - } - - /* Return the meta data associated with this branch. - * - * The return parameter holds an instance or is an nullptr. */ - virtual std::unique_ptr<MetaData> getMetaData() const - { - return std::unique_ptr<MetaData>(); - } - -#ifdef WITH_CXX_GUARDEDALLOC - MEM_CXX_CLASS_ALLOC_FUNCS("COM:SocketReader") -#endif -}; diff --git a/source/blender/compositor/intern/COM_WorkPackage.cc b/source/blender/compositor/intern/COM_WorkPackage.cc index 60684f2c45c..c0bc274da8f 100644 --- a/source/blender/compositor/intern/COM_WorkPackage.cc +++ b/source/blender/compositor/intern/COM_WorkPackage.cc @@ -18,8 +18,6 @@ #include "COM_WorkPackage.h" -WorkPackage::WorkPackage(ExecutionGroup *execution_group, unsigned int chunk_number) -{ - this->execution_group = execution_group; - this->chunk_number = chunk_number; -} +namespace blender::compositor { + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_WorkPackage.h b/source/blender/compositor/intern/COM_WorkPackage.h index db5eb3d3072..4541a778711 100644 --- a/source/blender/compositor/intern/COM_WorkPackage.h +++ b/source/blender/compositor/intern/COM_WorkPackage.h @@ -18,14 +18,21 @@ #pragma once +#include "COM_defines.h" + +#include "BLI_rect.h" + +namespace blender::compositor { +// Forward Declarations. class ExecutionGroup; -#include "COM_ExecutionGroup.h" /** * \brief contains data about work that can be scheduled * \see WorkScheduler */ struct WorkPackage { + eChunkExecutionState state = eChunkExecutionState::NotScheduled; + /** * \brief executionGroup with the operations-setup to be evaluated */ @@ -37,13 +44,13 @@ struct WorkPackage { unsigned int chunk_number; /** - * constructor - * \param group: the ExecutionGroup - * \param chunk_number: the number of the chunk + * Area of the execution group that the work package calculates. */ - WorkPackage(ExecutionGroup *group, unsigned int chunk_number); + rcti rect; #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("COM:WorkPackage") #endif }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cc b/source/blender/compositor/intern/COM_WorkScheduler.cc index 56956b9d097..55114e6b72a 100644 --- a/source/blender/compositor/intern/COM_WorkScheduler.cc +++ b/source/blender/compositor/intern/COM_WorkScheduler.cc @@ -37,6 +37,8 @@ #include "BKE_global.h" +namespace blender::compositor { + enum class ThreadingModel { /** Everything is executed in the caller thread. easy for debugging. */ SingleThreaded, @@ -70,7 +72,7 @@ static struct { /** \brief list of all CPUDevices. for every hardware thread an instance of CPUDevice is * created */ - blender::Vector<CPUDevice *> devices; + blender::Vector<CPUDevice> devices; /** \brief list of all thread for every CPUDevice in cpudevices a thread exists. */ ListBase threads; @@ -89,7 +91,7 @@ static struct { cl_program program; /** \brief list of all OpenCLDevices. for every OpenCL GPU device an instance of OpenCLDevice * is created. */ - blender::Vector<OpenCLDevice *> devices; + blender::Vector<OpenCLDevice> devices; /** \brief list of all thread for every GPUDevice in cpudevices a thread exists. */ ListBase threads; /** \brief all scheduled work for the GPU. */ @@ -117,7 +119,6 @@ static void *thread_execute_gpu(void *data) while ((work = (WorkPackage *)BLI_thread_queue_pop(g_work_scheduler.opencl.queue))) { device->execute(work); - delete work; } return nullptr; @@ -130,9 +131,8 @@ static void opencl_start(CompositorContext &context) BLI_threadpool_init(&g_work_scheduler.opencl.threads, thread_execute_gpu, g_work_scheduler.opencl.devices.size()); - for (int index = 0; index < g_work_scheduler.opencl.devices.size(); index++) { - Device *device = g_work_scheduler.opencl.devices[index]; - BLI_threadpool_insert(&g_work_scheduler.opencl.threads, device); + for (Device &device : g_work_scheduler.opencl.devices) { + BLI_threadpool_insert(&g_work_scheduler.opencl.threads, &device); } g_work_scheduler.opencl.active = true; } @@ -143,7 +143,7 @@ static void opencl_start(CompositorContext &context) static bool opencl_schedule(WorkPackage *package) { - if (package->execution_group->isOpenCL() && g_work_scheduler.opencl.active) { + if (package->execution_group->get_flags().open_cl && g_work_scheduler.opencl.active) { BLI_thread_queue_push(g_work_scheduler.opencl.queue, package); return true; } @@ -263,12 +263,10 @@ static void opencl_initialize(const bool use_opencl) if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error2, clewErrorString(error2)); } - OpenCLDevice *clDevice = new OpenCLDevice(g_work_scheduler.opencl.context, - device, - g_work_scheduler.opencl.program, - vendorID); - clDevice->initialize(); - g_work_scheduler.opencl.devices.append(clDevice); + g_work_scheduler.opencl.devices.append(OpenCLDevice(g_work_scheduler.opencl.context, + device, + g_work_scheduler.opencl.program, + vendorID)); } } MEM_freeN(cldevices); @@ -282,26 +280,19 @@ static void opencl_initialize(const bool use_opencl) static void opencl_deinitialize() { - /* Deinitialize OpenCL GPU's. */ - if (g_work_scheduler.opencl.initialized) { - while (!g_work_scheduler.opencl.devices.is_empty()) { - Device *device = g_work_scheduler.opencl.devices.pop_last(); - device->deinitialize(); - delete device; - } - g_work_scheduler.opencl.devices.clear_and_make_inline(); + g_work_scheduler.opencl.devices.clear_and_make_inline(); - if (g_work_scheduler.opencl.program) { - clReleaseProgram(g_work_scheduler.opencl.program); - g_work_scheduler.opencl.program = nullptr; - } - if (g_work_scheduler.opencl.context) { - clReleaseContext(g_work_scheduler.opencl.context); - g_work_scheduler.opencl.context = nullptr; - } + if (g_work_scheduler.opencl.program) { + clReleaseProgram(g_work_scheduler.opencl.program); + g_work_scheduler.opencl.program = nullptr; + } - g_work_scheduler.opencl.initialized = false; + if (g_work_scheduler.opencl.context) { + clReleaseContext(g_work_scheduler.opencl.context); + g_work_scheduler.opencl.context = nullptr; } + + g_work_scheduler.opencl.initialized = false; } /* \} */ @@ -314,7 +305,6 @@ static void threading_model_single_thread_execute(WorkPackage *package) { CPUDevice device(0); device.execute(package); - delete package; } /* \} */ @@ -330,7 +320,6 @@ static void *threading_model_queue_execute(void *data) BLI_thread_local_set(g_thread_device, device); while ((work = (WorkPackage *)BLI_thread_queue_pop(g_work_scheduler.queue.queue))) { device->execute(work); - delete work; } return nullptr; @@ -347,9 +336,8 @@ static void threading_model_queue_start() BLI_threadpool_init(&g_work_scheduler.queue.threads, threading_model_queue_execute, g_work_scheduler.queue.devices.size()); - for (int index = 0; index < g_work_scheduler.queue.devices.size(); index++) { - Device *device = g_work_scheduler.queue.devices[index]; - BLI_threadpool_insert(&g_work_scheduler.queue.threads, device); + for (Device &device : g_work_scheduler.queue.devices) { + BLI_threadpool_insert(&g_work_scheduler.queue.threads, &device); } } @@ -370,25 +358,17 @@ static void threading_model_queue_initialize(const int num_cpu_threads) { /* Reinitialize if number of threads doesn't match. */ if (g_work_scheduler.queue.devices.size() != num_cpu_threads) { - Device *device; - - while (!g_work_scheduler.queue.devices.is_empty()) { - device = g_work_scheduler.queue.devices.pop_last(); - device->deinitialize(); - delete device; - } + g_work_scheduler.queue.devices.clear(); if (g_work_scheduler.queue.initialized) { BLI_thread_local_delete(g_thread_device); + g_work_scheduler.queue.initialized = false; } - g_work_scheduler.queue.initialized = false; } /* Initialize CPU threads. */ if (!g_work_scheduler.queue.initialized) { for (int index = 0; index < num_cpu_threads; index++) { - CPUDevice *device = new CPUDevice(index); - device->initialize(); - g_work_scheduler.queue.devices.append(device); + g_work_scheduler.queue.devices.append(CPUDevice(index)); } BLI_thread_local_create(g_thread_device); g_work_scheduler.queue.initialized = true; @@ -398,11 +378,6 @@ static void threading_model_queue_deinitialize() { /* deinitialize CPU threads */ if (g_work_scheduler.queue.initialized) { - while (!g_work_scheduler.queue.devices.is_empty()) { - Device *device = g_work_scheduler.queue.devices.pop_last(); - device->deinitialize(); - delete device; - } g_work_scheduler.queue.devices.clear_and_make_inline(); BLI_thread_local_delete(g_thread_device); @@ -455,10 +430,8 @@ static void threading_model_task_stop() /** \name Public API * \{ */ -void WorkScheduler::schedule(ExecutionGroup *group, int chunkNumber) +void WorkScheduler::schedule(WorkPackage *package) { - WorkPackage *package = new WorkPackage(group, chunkNumber); - if (COM_is_opencl_enabled()) { if (opencl_schedule(package)) { return; @@ -607,3 +580,5 @@ int WorkScheduler::current_thread_id() } /* \} */ + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_WorkScheduler.h b/source/blender/compositor/intern/COM_WorkScheduler.h index 6b53cc3efd6..85b1d7e2ebf 100644 --- a/source/blender/compositor/intern/COM_WorkScheduler.h +++ b/source/blender/compositor/intern/COM_WorkScheduler.h @@ -24,6 +24,8 @@ #include "COM_WorkPackage.h" #include "COM_defines.h" +namespace blender::compositor { + /** \brief the workscheduler * \ingroup execution */ @@ -31,13 +33,11 @@ struct WorkScheduler { /** * \brief schedule a chunk of a group to be calculated. * An execution group schedules a chunk in the WorkScheduler - * when ExecutionGroup.isOpenCL is set the work will be handled by a OpenCLDevice + * when ExecutionGroup.get_flags().open_cl is set the work will be handled by a OpenCLDevice * otherwise the work is scheduled for an CPUDevice * \see ExecutionGroup.execute - * \param group: the execution group - * \param chunkNumber: the number of the chunk in the group to be executed */ - static void schedule(ExecutionGroup *group, int chunkNumber); + static void schedule(WorkPackage *package); /** * \brief initialize the WorkScheduler @@ -93,3 +93,5 @@ struct WorkScheduler { MEM_CXX_CLASS_ALLOC_FUNCS("COM:WorkScheduler") #endif }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_compositor.cc b/source/blender/compositor/intern/COM_compositor.cc index 68e4f80f91f..5839f53976b 100644 --- a/source/blender/compositor/intern/COM_compositor.cc +++ b/source/blender/compositor/intern/COM_compositor.cc @@ -46,12 +46,12 @@ static void compositor_init_node_previews(const RenderData *render_data, bNodeTr 1.0f; int preview_width, preview_height; if (aspect < 1.0f) { - preview_width = COM_PREVIEW_SIZE; - preview_height = (int)(COM_PREVIEW_SIZE * aspect); + preview_width = blender::compositor::COM_PREVIEW_SIZE; + preview_height = (int)(blender::compositor::COM_PREVIEW_SIZE * aspect); } else { - preview_width = (int)(COM_PREVIEW_SIZE / aspect); - preview_height = COM_PREVIEW_SIZE; + preview_width = (int)(blender::compositor::COM_PREVIEW_SIZE / aspect); + preview_height = blender::compositor::COM_PREVIEW_SIZE; } BKE_node_preview_init_tree(node_tree, preview_width, preview_height, false); } @@ -92,12 +92,12 @@ void COM_execute(RenderData *render_data, /* Initialize workscheduler. */ const bool use_opencl = (node_tree->flag & NTREE_COM_OPENCL) != 0; - WorkScheduler::initialize(use_opencl, BKE_render_num_threads(render_data)); + blender::compositor::WorkScheduler::initialize(use_opencl, BKE_render_num_threads(render_data)); /* Execute. */ const bool twopass = (node_tree->flag & NTREE_TWO_PASS) && !rendering; if (twopass) { - ExecutionSystem fast_pass( + blender::compositor::ExecutionSystem fast_pass( render_data, scene, node_tree, rendering, true, viewSettings, displaySettings, viewName); fast_pass.execute(); @@ -107,7 +107,7 @@ void COM_execute(RenderData *render_data, } } - ExecutionSystem system( + blender::compositor::ExecutionSystem system( render_data, scene, node_tree, rendering, false, viewSettings, displaySettings, viewName); system.execute(); @@ -118,7 +118,7 @@ void COM_deinitialize() { if (g_compositor.is_initialized) { BLI_mutex_lock(&g_compositor.mutex); - WorkScheduler::deinitialize(); + blender::compositor::WorkScheduler::deinitialize(); g_compositor.is_initialized = false; BLI_mutex_unlock(&g_compositor.mutex); BLI_mutex_end(&g_compositor.mutex); diff --git a/source/blender/compositor/nodes/COM_AlphaOverNode.cc b/source/blender/compositor/nodes/COM_AlphaOverNode.cc index 640fbf49808..5e09902aee2 100644 --- a/source/blender/compositor/nodes/COM_AlphaOverNode.cc +++ b/source/blender/compositor/nodes/COM_AlphaOverNode.cc @@ -26,6 +26,8 @@ #include "COM_SetValueOperation.h" #include "DNA_material_types.h" /* the ramp types */ +namespace blender::compositor { + void AlphaOverNode::convertToOperations(NodeConverter &converter, const CompositorContext & /*context*/) const { @@ -64,3 +66,5 @@ void AlphaOverNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(getInputSocket(2), convertProg->getInputSocket(2)); converter.mapOutputSocket(getOutputSocket(0), convertProg->getOutputSocket(0)); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_AlphaOverNode.h b/source/blender/compositor/nodes/COM_AlphaOverNode.h index 32cd2e20204..201c8ed5b6e 100644 --- a/source/blender/compositor/nodes/COM_AlphaOverNode.h +++ b/source/blender/compositor/nodes/COM_AlphaOverNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief AlphaOverNode * \ingroup Node @@ -29,5 +31,8 @@ class AlphaOverNode : public Node { AlphaOverNode(bNode *editorNode) : Node(editorNode) { } - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_AntiAliasingNode.cc b/source/blender/compositor/nodes/COM_AntiAliasingNode.cc new file mode 100644 index 00000000000..af4832665df --- /dev/null +++ b/source/blender/compositor/nodes/COM_AntiAliasingNode.cc @@ -0,0 +1,60 @@ +/* + * 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_AntiAliasingNode.h" +#include "COM_SMAAOperation.h" +#include "DNA_node_types.h" + +namespace blender::compositor { + +void AntiAliasingNode::convertToOperations(NodeConverter &converter, + const CompositorContext & /*context*/) const +{ + bNode *node = this->getbNode(); + NodeAntiAliasingData *data = (NodeAntiAliasingData *)node->storage; + + /* Edge Detection (First Pass) */ + SMAAEdgeDetectionOperation *operation1 = nullptr; + + operation1 = new SMAAEdgeDetectionOperation(); + operation1->setThreshold(data->threshold); + operation1->setLocalContrastAdaptationFactor(data->contrast_limit); + converter.addOperation(operation1); + + converter.mapInputSocket(getInputSocket(0), operation1->getInputSocket(0)); + + /* Blending Weight Calculation Pixel Shader (Second Pass) */ + SMAABlendingWeightCalculationOperation *operation2 = + new SMAABlendingWeightCalculationOperation(); + operation2->setCornerRounding(data->corner_rounding); + converter.addOperation(operation2); + + converter.addLink(operation1->getOutputSocket(), operation2->getInputSocket(0)); + + /* Neighborhood Blending Pixel Shader (Third Pass) */ + SMAANeighborhoodBlendingOperation *operation3 = new SMAANeighborhoodBlendingOperation(); + converter.addOperation(operation3); + + converter.mapInputSocket(getInputSocket(0), operation3->getInputSocket(0)); + converter.addLink(operation2->getOutputSocket(), operation3->getInputSocket(1)); + converter.mapOutputSocket(getOutputSocket(0), operation3->getOutputSocket()); +} + +} // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_SocketReader.cc b/source/blender/compositor/nodes/COM_AntiAliasingNode.h index 93c8a143b86..d4a6d0d26dc 100644 --- a/source/blender/compositor/intern/COM_SocketReader.cc +++ b/source/blender/compositor/nodes/COM_AntiAliasingNode.h @@ -1,4 +1,6 @@ /* + * 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 @@ -13,7 +15,26 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - * Copyright 2011, Blender Foundation. + * Contributor: IRIE Shinsuke + */ + +#pragma once + +#include "COM_Node.h" + +namespace blender::compositor { + +/** + * @brief AntiAliasingNode + * @ingroup Node */ +class AntiAliasingNode : public Node { + public: + AntiAliasingNode(bNode *editorNode) : Node(editorNode) + { + } + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; +}; -#include "COM_SocketReader.h" +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_BilateralBlurNode.cc b/source/blender/compositor/nodes/COM_BilateralBlurNode.cc index e8037f923f2..1b9da789d3c 100644 --- a/source/blender/compositor/nodes/COM_BilateralBlurNode.cc +++ b/source/blender/compositor/nodes/COM_BilateralBlurNode.cc @@ -21,6 +21,8 @@ #include "COM_ExecutionSystem.h" #include "DNA_node_types.h" +namespace blender::compositor { + BilateralBlurNode::BilateralBlurNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -39,3 +41,5 @@ void BilateralBlurNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_BilateralBlurNode.h b/source/blender/compositor/nodes/COM_BilateralBlurNode.h index 39308c7d1b6..fed2612ac02 100644 --- a/source/blender/compositor/nodes/COM_BilateralBlurNode.h +++ b/source/blender/compositor/nodes/COM_BilateralBlurNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief BilateralBlurNode * \ingroup Node @@ -27,5 +29,8 @@ class BilateralBlurNode : public Node { public: BilateralBlurNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_BlurNode.cc b/source/blender/compositor/nodes/COM_BlurNode.cc index b82bede8443..e55a594b9c0 100644 --- a/source/blender/compositor/nodes/COM_BlurNode.cc +++ b/source/blender/compositor/nodes/COM_BlurNode.cc @@ -29,6 +29,8 @@ #include "COM_SetValueOperation.h" #include "DNA_node_types.h" +namespace blender::compositor { + BlurNode::BlurNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -168,3 +170,5 @@ void BlurNode::convertToOperations(NodeConverter &converter, converter.addPreview(output_operation->getOutputSocket()); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_BlurNode.h b/source/blender/compositor/nodes/COM_BlurNode.h index 3c832c93ca2..61cdc17f3a9 100644 --- a/source/blender/compositor/nodes/COM_BlurNode.h +++ b/source/blender/compositor/nodes/COM_BlurNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief BlurNode * \ingroup Node @@ -27,5 +29,8 @@ class BlurNode : public Node { public: BlurNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_BokehBlurNode.cc b/source/blender/compositor/nodes/COM_BokehBlurNode.cc index 5096dbef608..1d2a0dae390 100644 --- a/source/blender/compositor/nodes/COM_BokehBlurNode.cc +++ b/source/blender/compositor/nodes/COM_BokehBlurNode.cc @@ -25,6 +25,8 @@ #include "DNA_node_types.h" #include "DNA_object_types.h" +namespace blender::compositor { + BokehBlurNode::BokehBlurNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -75,3 +77,5 @@ void BokehBlurNode::convertToOperations(NodeConverter &converter, } } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_BokehBlurNode.h b/source/blender/compositor/nodes/COM_BokehBlurNode.h index 87aca9af1f6..2c060936025 100644 --- a/source/blender/compositor/nodes/COM_BokehBlurNode.h +++ b/source/blender/compositor/nodes/COM_BokehBlurNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief BokehBlurNode * \ingroup Node @@ -27,5 +29,8 @@ class BokehBlurNode : public Node { public: BokehBlurNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_BokehImageNode.cc b/source/blender/compositor/nodes/COM_BokehImageNode.cc index 87fe4979c1d..2b0a47c76bc 100644 --- a/source/blender/compositor/nodes/COM_BokehImageNode.cc +++ b/source/blender/compositor/nodes/COM_BokehImageNode.cc @@ -20,6 +20,8 @@ #include "COM_BokehImageOperation.h" #include "COM_ExecutionSystem.h" +namespace blender::compositor { + BokehImageNode::BokehImageNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -36,3 +38,5 @@ void BokehImageNode::convertToOperations(NodeConverter &converter, converter.addPreview(operation->getOutputSocket(0)); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_BokehImageNode.h b/source/blender/compositor/nodes/COM_BokehImageNode.h index b9d957cd6df..323561a7e4f 100644 --- a/source/blender/compositor/nodes/COM_BokehImageNode.h +++ b/source/blender/compositor/nodes/COM_BokehImageNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief BokehImageNode * \ingroup Node @@ -27,5 +29,8 @@ class BokehImageNode : public Node { public: BokehImageNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_BoxMaskNode.cc b/source/blender/compositor/nodes/COM_BoxMaskNode.cc index fe59bd32939..14f42cc42f7 100644 --- a/source/blender/compositor/nodes/COM_BoxMaskNode.cc +++ b/source/blender/compositor/nodes/COM_BoxMaskNode.cc @@ -23,6 +23,8 @@ #include "COM_ScaleOperation.h" #include "COM_SetValueOperation.h" +namespace blender::compositor { + BoxMaskNode::BoxMaskNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -60,7 +62,7 @@ void BoxMaskNode::convertToOperations(NodeConverter &converter, scaleOperation->setOffset(0.0f, 0.0f); scaleOperation->setNewWidth(rd->xsch * render_size_factor); scaleOperation->setNewHeight(rd->ysch * render_size_factor); - scaleOperation->getInputSocket(0)->setResizeMode(COM_SC_NO_RESIZE); + scaleOperation->getInputSocket(0)->setResizeMode(ResizeMode::None); converter.addOperation(scaleOperation); converter.addLink(valueOperation->getOutputSocket(0), scaleOperation->getInputSocket(0)); @@ -70,3 +72,5 @@ void BoxMaskNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_BoxMaskNode.h b/source/blender/compositor/nodes/COM_BoxMaskNode.h index b815fd75284..46cedf7af75 100644 --- a/source/blender/compositor/nodes/COM_BoxMaskNode.h +++ b/source/blender/compositor/nodes/COM_BoxMaskNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief BoxMaskNode * \ingroup Node @@ -27,5 +29,8 @@ class BoxMaskNode : public Node { public: BoxMaskNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_BrightnessNode.cc b/source/blender/compositor/nodes/COM_BrightnessNode.cc index fcd2a6de1f4..b64f1fea99f 100644 --- a/source/blender/compositor/nodes/COM_BrightnessNode.cc +++ b/source/blender/compositor/nodes/COM_BrightnessNode.cc @@ -20,6 +20,8 @@ #include "COM_BrightnessOperation.h" #include "COM_ExecutionSystem.h" +namespace blender::compositor { + BrightnessNode::BrightnessNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -38,3 +40,5 @@ void BrightnessNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_BrightnessNode.h b/source/blender/compositor/nodes/COM_BrightnessNode.h index b64b622dd71..1084108b1c3 100644 --- a/source/blender/compositor/nodes/COM_BrightnessNode.h +++ b/source/blender/compositor/nodes/COM_BrightnessNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief BrightnessNode * \ingroup Node @@ -27,5 +29,8 @@ class BrightnessNode : public Node { public: BrightnessNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ChannelMatteNode.cc b/source/blender/compositor/nodes/COM_ChannelMatteNode.cc index 598cd7b7745..d0f72274aea 100644 --- a/source/blender/compositor/nodes/COM_ChannelMatteNode.cc +++ b/source/blender/compositor/nodes/COM_ChannelMatteNode.cc @@ -22,6 +22,8 @@ #include "COM_ConvertOperation.h" #include "COM_SetAlphaMultiplyOperation.h" +namespace blender::compositor { + ChannelMatteNode::ChannelMatteNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -93,3 +95,5 @@ void ChannelMatteNode::convertToOperations(NodeConverter &converter, converter.addPreview(operationAlpha->getOutputSocket()); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ChannelMatteNode.h b/source/blender/compositor/nodes/COM_ChannelMatteNode.h index bca821fa60c..46100b3f7ea 100644 --- a/source/blender/compositor/nodes/COM_ChannelMatteNode.h +++ b/source/blender/compositor/nodes/COM_ChannelMatteNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief ChannelMatteNode * \ingroup Node @@ -27,5 +29,8 @@ class ChannelMatteNode : public Node { public: ChannelMatteNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ChromaMatteNode.cc b/source/blender/compositor/nodes/COM_ChromaMatteNode.cc index 83e88b35f92..9abf183a843 100644 --- a/source/blender/compositor/nodes/COM_ChromaMatteNode.cc +++ b/source/blender/compositor/nodes/COM_ChromaMatteNode.cc @@ -22,6 +22,8 @@ #include "COM_ConvertOperation.h" #include "COM_SetAlphaMultiplyOperation.h" +namespace blender::compositor { + ChromaMatteNode::ChromaMatteNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -63,3 +65,5 @@ void ChromaMatteNode::convertToOperations(NodeConverter &converter, converter.addPreview(operationAlpha->getOutputSocket()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ChromaMatteNode.h b/source/blender/compositor/nodes/COM_ChromaMatteNode.h index d8febdde36f..f3ddd013fa4 100644 --- a/source/blender/compositor/nodes/COM_ChromaMatteNode.h +++ b/source/blender/compositor/nodes/COM_ChromaMatteNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief ChromaMatteNode * \ingroup Node @@ -27,5 +29,8 @@ class ChromaMatteNode : public Node { public: ChromaMatteNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ColorBalanceNode.cc b/source/blender/compositor/nodes/COM_ColorBalanceNode.cc index 596d9631297..03e4e143061 100644 --- a/source/blender/compositor/nodes/COM_ColorBalanceNode.cc +++ b/source/blender/compositor/nodes/COM_ColorBalanceNode.cc @@ -23,6 +23,8 @@ #include "COM_ExecutionSystem.h" #include "COM_MixOperation.h" +namespace blender::compositor { + ColorBalanceNode::ColorBalanceNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -71,3 +73,5 @@ void ColorBalanceNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(inputImageSocket, operation->getInputSocket(1)); converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ColorBalanceNode.h b/source/blender/compositor/nodes/COM_ColorBalanceNode.h index 302b66863ca..243713b4912 100644 --- a/source/blender/compositor/nodes/COM_ColorBalanceNode.h +++ b/source/blender/compositor/nodes/COM_ColorBalanceNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief ColorBalanceNode * \ingroup Node @@ -27,5 +29,8 @@ class ColorBalanceNode : public Node { public: ColorBalanceNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ColorCorrectionNode.cc b/source/blender/compositor/nodes/COM_ColorCorrectionNode.cc index 92b334fddb9..6397b1d8e4b 100644 --- a/source/blender/compositor/nodes/COM_ColorCorrectionNode.cc +++ b/source/blender/compositor/nodes/COM_ColorCorrectionNode.cc @@ -20,6 +20,8 @@ #include "COM_ColorCorrectionOperation.h" #include "COM_ExecutionSystem.h" +namespace blender::compositor { + ColorCorrectionNode::ColorCorrectionNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -41,3 +43,5 @@ void ColorCorrectionNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ColorCorrectionNode.h b/source/blender/compositor/nodes/COM_ColorCorrectionNode.h index be6545f0cfa..aee07ee07a3 100644 --- a/source/blender/compositor/nodes/COM_ColorCorrectionNode.h +++ b/source/blender/compositor/nodes/COM_ColorCorrectionNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief ColorCorrectionNode * \ingroup Node @@ -27,5 +29,8 @@ class ColorCorrectionNode : public Node { public: ColorCorrectionNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ColorCurveNode.cc b/source/blender/compositor/nodes/COM_ColorCurveNode.cc index e1888f3f0bc..774dd689a46 100644 --- a/source/blender/compositor/nodes/COM_ColorCurveNode.cc +++ b/source/blender/compositor/nodes/COM_ColorCurveNode.cc @@ -20,6 +20,8 @@ #include "COM_ColorCurveOperation.h" #include "COM_ExecutionSystem.h" +namespace blender::compositor { + ColorCurveNode::ColorCurveNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -55,3 +57,5 @@ void ColorCurveNode::convertToOperations(NodeConverter &converter, converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ColorCurveNode.h b/source/blender/compositor/nodes/COM_ColorCurveNode.h index 6eaf1db6fbb..89786b47cf5 100644 --- a/source/blender/compositor/nodes/COM_ColorCurveNode.h +++ b/source/blender/compositor/nodes/COM_ColorCurveNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief ColorCurveNode * \ingroup Node @@ -27,5 +29,8 @@ class ColorCurveNode : public Node { public: ColorCurveNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ColorExposureNode.cc b/source/blender/compositor/nodes/COM_ColorExposureNode.cc index cd0285ac373..a8f164e6b66 100644 --- a/source/blender/compositor/nodes/COM_ColorExposureNode.cc +++ b/source/blender/compositor/nodes/COM_ColorExposureNode.cc @@ -20,6 +20,8 @@ #include "COM_ColorExposureOperation.h" #include "COM_ExecutionSystem.h" +namespace blender::compositor { + ExposureNode::ExposureNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -35,3 +37,5 @@ void ExposureNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ColorExposureNode.h b/source/blender/compositor/nodes/COM_ColorExposureNode.h index c17e798b979..df9bfc65f81 100644 --- a/source/blender/compositor/nodes/COM_ColorExposureNode.h +++ b/source/blender/compositor/nodes/COM_ColorExposureNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief ExposureNode * \ingroup Node @@ -27,5 +29,8 @@ class ExposureNode : public Node { public: ExposureNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ColorMatteNode.cc b/source/blender/compositor/nodes/COM_ColorMatteNode.cc index 865eee5427f..eadb8ce4f96 100644 --- a/source/blender/compositor/nodes/COM_ColorMatteNode.cc +++ b/source/blender/compositor/nodes/COM_ColorMatteNode.cc @@ -22,6 +22,8 @@ #include "COM_ConvertOperation.h" #include "COM_SetAlphaMultiplyOperation.h" +namespace blender::compositor { + ColorMatteNode::ColorMatteNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -61,3 +63,5 @@ void ColorMatteNode::convertToOperations(NodeConverter &converter, converter.addPreview(operationAlpha->getOutputSocket()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ColorMatteNode.h b/source/blender/compositor/nodes/COM_ColorMatteNode.h index e84bdfc836f..9d70b6d8416 100644 --- a/source/blender/compositor/nodes/COM_ColorMatteNode.h +++ b/source/blender/compositor/nodes/COM_ColorMatteNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief ColorMatteNode * \ingroup Node @@ -27,5 +29,8 @@ class ColorMatteNode : public Node { public: ColorMatteNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ColorNode.cc b/source/blender/compositor/nodes/COM_ColorNode.cc index e6f8bfa01fe..f8277645a4b 100644 --- a/source/blender/compositor/nodes/COM_ColorNode.cc +++ b/source/blender/compositor/nodes/COM_ColorNode.cc @@ -20,6 +20,8 @@ #include "COM_ExecutionSystem.h" #include "COM_SetColorOperation.h" +namespace blender::compositor { + ColorNode::ColorNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -37,3 +39,5 @@ void ColorNode::convertToOperations(NodeConverter &converter, converter.mapOutputSocket(output, operation->getOutputSocket()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ColorNode.h b/source/blender/compositor/nodes/COM_ColorNode.h index 9b50e9ab7d4..ae3bf575bb4 100644 --- a/source/blender/compositor/nodes/COM_ColorNode.h +++ b/source/blender/compositor/nodes/COM_ColorNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief ColorNode * \ingroup Node @@ -27,5 +29,8 @@ class ColorNode : public Node { public: ColorNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ColorRampNode.cc b/source/blender/compositor/nodes/COM_ColorRampNode.cc index 1504a76cee7..6b44ef3057e 100644 --- a/source/blender/compositor/nodes/COM_ColorRampNode.cc +++ b/source/blender/compositor/nodes/COM_ColorRampNode.cc @@ -23,6 +23,8 @@ #include "COM_ExecutionSystem.h" #include "DNA_texture_types.h" +namespace blender::compositor { + ColorRampNode::ColorRampNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -50,3 +52,5 @@ void ColorRampNode::convertToOperations(NodeConverter &converter, converter.addLink(operation->getOutputSocket(), operation2->getInputSocket(0)); converter.mapOutputSocket(outputSocketAlpha, operation2->getOutputSocket()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ColorRampNode.h b/source/blender/compositor/nodes/COM_ColorRampNode.h index b53edf14dbd..d0c0e43d56c 100644 --- a/source/blender/compositor/nodes/COM_ColorRampNode.h +++ b/source/blender/compositor/nodes/COM_ColorRampNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief ColorRampNode * \ingroup Node @@ -27,5 +29,8 @@ class ColorRampNode : public Node { public: ColorRampNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ColorSpillNode.cc b/source/blender/compositor/nodes/COM_ColorSpillNode.cc index d1a3099e998..119cff93e84 100644 --- a/source/blender/compositor/nodes/COM_ColorSpillNode.cc +++ b/source/blender/compositor/nodes/COM_ColorSpillNode.cc @@ -20,6 +20,8 @@ #include "BKE_node.h" #include "COM_ColorSpillOperation.h" +namespace blender::compositor { + ColorSpillNode::ColorSpillNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -45,3 +47,5 @@ void ColorSpillNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(inputSocketFac, operation->getInputSocket(1)); converter.mapOutputSocket(outputSocketImage, operation->getOutputSocket()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ColorSpillNode.h b/source/blender/compositor/nodes/COM_ColorSpillNode.h index 3cf8072c7b7..731a76e8811 100644 --- a/source/blender/compositor/nodes/COM_ColorSpillNode.h +++ b/source/blender/compositor/nodes/COM_ColorSpillNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief ColorSpillNode * \ingroup Node @@ -27,5 +29,8 @@ class ColorSpillNode : public Node { public: ColorSpillNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ColorToBWNode.cc b/source/blender/compositor/nodes/COM_ColorToBWNode.cc index 4115bad5d3f..dcedfc19e4d 100644 --- a/source/blender/compositor/nodes/COM_ColorToBWNode.cc +++ b/source/blender/compositor/nodes/COM_ColorToBWNode.cc @@ -21,6 +21,8 @@ #include "COM_ConvertOperation.h" #include "COM_ExecutionSystem.h" +namespace blender::compositor { + ColorToBWNode::ColorToBWNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -38,3 +40,5 @@ void ColorToBWNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(colorSocket, convertProg->getInputSocket(0)); converter.mapOutputSocket(valueSocket, convertProg->getOutputSocket(0)); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ColorToBWNode.h b/source/blender/compositor/nodes/COM_ColorToBWNode.h index 6e7025de496..60c08a3c886 100644 --- a/source/blender/compositor/nodes/COM_ColorToBWNode.h +++ b/source/blender/compositor/nodes/COM_ColorToBWNode.h @@ -20,6 +20,9 @@ #include "COM_Node.h" #include "DNA_node_types.h" + +namespace blender::compositor { + /** * \brief ColorToBWNode * \ingroup Node @@ -27,5 +30,8 @@ class ColorToBWNode : public Node { public: ColorToBWNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_CombineColorNode.cc b/source/blender/compositor/nodes/COM_CombineColorNode.cc index 12968f06a10..8a2bbba1c1e 100644 --- a/source/blender/compositor/nodes/COM_CombineColorNode.cc +++ b/source/blender/compositor/nodes/COM_CombineColorNode.cc @@ -20,6 +20,8 @@ #include "COM_ConvertOperation.h" +namespace blender::compositor { + CombineColorNode::CombineColorNode(bNode *editorNode) : Node(editorNode) { } @@ -87,3 +89,5 @@ NodeOperation *CombineYUVANode::getColorConverter(const CompositorContext & /*co { return new ConvertYUVToRGBOperation(); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_CombineColorNode.h b/source/blender/compositor/nodes/COM_CombineColorNode.h index 378a4855abf..29d3fa37817 100644 --- a/source/blender/compositor/nodes/COM_CombineColorNode.h +++ b/source/blender/compositor/nodes/COM_CombineColorNode.h @@ -20,10 +20,13 @@ #include "COM_Node.h" +namespace blender::compositor { + class CombineColorNode : public Node { public: CombineColorNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; protected: virtual NodeOperation *getColorConverter(const CompositorContext &context) const = 0; @@ -35,7 +38,7 @@ class CombineRGBANode : public CombineColorNode { { } - NodeOperation *getColorConverter(const CompositorContext &context) const; + NodeOperation *getColorConverter(const CompositorContext &context) const override; }; class CombineHSVANode : public CombineColorNode { @@ -44,7 +47,7 @@ class CombineHSVANode : public CombineColorNode { { } - NodeOperation *getColorConverter(const CompositorContext &context) const; + NodeOperation *getColorConverter(const CompositorContext &context) const override; }; class CombineYCCANode : public CombineColorNode { @@ -53,7 +56,7 @@ class CombineYCCANode : public CombineColorNode { { } - NodeOperation *getColorConverter(const CompositorContext &context) const; + NodeOperation *getColorConverter(const CompositorContext &context) const override; }; class CombineYUVANode : public CombineColorNode { @@ -62,5 +65,7 @@ class CombineYUVANode : public CombineColorNode { { } - NodeOperation *getColorConverter(const CompositorContext &context) const; + NodeOperation *getColorConverter(const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_CompositorNode.cc b/source/blender/compositor/nodes/COM_CompositorNode.cc index 32ac1fccec9..262fa550915 100644 --- a/source/blender/compositor/nodes/COM_CompositorNode.cc +++ b/source/blender/compositor/nodes/COM_CompositorNode.cc @@ -20,6 +20,8 @@ #include "COM_CompositorOperation.h" #include "COM_ExecutionSystem.h" +namespace blender::compositor { + CompositorNode::CompositorNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -59,3 +61,5 @@ void CompositorNode::convertToOperations(NodeConverter &converter, converter.addNodeInputPreview(imageSocket); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_CompositorNode.h b/source/blender/compositor/nodes/COM_CompositorNode.h index a75355dfc14..4da9f9a766f 100644 --- a/source/blender/compositor/nodes/COM_CompositorNode.h +++ b/source/blender/compositor/nodes/COM_CompositorNode.h @@ -20,6 +20,9 @@ #include "COM_Node.h" #include "DNA_node_types.h" + +namespace blender::compositor { + /** * \brief CompositorNode * \ingroup Node @@ -27,5 +30,8 @@ class CompositorNode : public Node { public: CompositorNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ConvertAlphaNode.cc b/source/blender/compositor/nodes/COM_ConvertAlphaNode.cc index 2921b44c95b..ac4e45357dc 100644 --- a/source/blender/compositor/nodes/COM_ConvertAlphaNode.cc +++ b/source/blender/compositor/nodes/COM_ConvertAlphaNode.cc @@ -20,6 +20,8 @@ #include "COM_ConvertOperation.h" #include "COM_ExecutionSystem.h" +namespace blender::compositor { + void ConvertAlphaNode::convertToOperations(NodeConverter &converter, const CompositorContext & /*context*/) const { @@ -39,3 +41,5 @@ void ConvertAlphaNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ConvertAlphaNode.h b/source/blender/compositor/nodes/COM_ConvertAlphaNode.h index 372f34a576f..f3d0ef2cd5b 100644 --- a/source/blender/compositor/nodes/COM_ConvertAlphaNode.h +++ b/source/blender/compositor/nodes/COM_ConvertAlphaNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief ConvertAlphaNode * \ingroup Node @@ -29,5 +31,8 @@ class ConvertAlphaNode : public Node { ConvertAlphaNode(bNode *editorNode) : Node(editorNode) { } - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_CornerPinNode.cc b/source/blender/compositor/nodes/COM_CornerPinNode.cc index efe847bbfbf..6a120cffe0a 100644 --- a/source/blender/compositor/nodes/COM_CornerPinNode.cc +++ b/source/blender/compositor/nodes/COM_CornerPinNode.cc @@ -20,6 +20,8 @@ #include "COM_PlaneCornerPinOperation.h" +namespace blender::compositor { + CornerPinNode::CornerPinNode(bNode *editorNode) : Node(editorNode) { } @@ -53,3 +55,5 @@ void CornerPinNode::convertToOperations(NodeConverter &converter, converter.mapOutputSocket(output_warped_image, warp_image_operation->getOutputSocket()); converter.mapOutputSocket(output_plane, plane_mask_operation->getOutputSocket()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_CornerPinNode.h b/source/blender/compositor/nodes/COM_CornerPinNode.h index ba845a614fb..779e057ebb5 100644 --- a/source/blender/compositor/nodes/COM_CornerPinNode.h +++ b/source/blender/compositor/nodes/COM_CornerPinNode.h @@ -21,6 +21,8 @@ #include "DNA_node_types.h" +namespace blender::compositor { + /** * \brief CornerPinNode * \ingroup Node @@ -28,5 +30,8 @@ class CornerPinNode : public Node { public: CornerPinNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_CropNode.cc b/source/blender/compositor/nodes/COM_CropNode.cc index 0f0883b0151..3f01062c789 100644 --- a/source/blender/compositor/nodes/COM_CropNode.cc +++ b/source/blender/compositor/nodes/COM_CropNode.cc @@ -19,6 +19,8 @@ #include "COM_CropNode.h" #include "COM_CropOperation.h" +namespace blender::compositor { + CropNode::CropNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -45,3 +47,5 @@ void CropNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapOutputSocket(getOutputSocket(), operation->getOutputSocket()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_CropNode.h b/source/blender/compositor/nodes/COM_CropNode.h index f643ebbabcc..be3c9a268f9 100644 --- a/source/blender/compositor/nodes/COM_CropNode.h +++ b/source/blender/compositor/nodes/COM_CropNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief CropNode * \ingroup Node @@ -27,5 +29,8 @@ class CropNode : public Node { public: CropNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_CryptomatteNode.cc b/source/blender/compositor/nodes/COM_CryptomatteNode.cc index 591db8a96e5..23305fa06f8 100644 --- a/source/blender/compositor/nodes/COM_CryptomatteNode.cc +++ b/source/blender/compositor/nodes/COM_CryptomatteNode.cc @@ -31,6 +31,8 @@ #include <iterator> #include <string> +namespace blender::compositor { + /** \name Cryptomatte base * \{ */ @@ -176,7 +178,12 @@ void CryptomatteNode::input_operations_from_image_source( } const std::string prefix = prefix_from_node(node); - LISTBASE_FOREACH (RenderLayer *, render_layer, &image->rr->layers) { + int layer_index; + LISTBASE_FOREACH_INDEX (RenderLayer *, render_layer, &image->rr->layers, layer_index) { + if (!blender::StringRef(prefix).startswith(blender::StringRef( + render_layer->name, BLI_strnlen(render_layer->name, sizeof(render_layer->name))))) { + continue; + } LISTBASE_FOREACH (RenderPass *, render_pass, &render_layer->passes) { const std::string combined_name = combined_layer_pass_name(render_layer, render_pass); if (blender::StringRef(combined_name).startswith(prefix)) { @@ -184,10 +191,12 @@ void CryptomatteNode::input_operations_from_image_source( render_layer, render_pass, view); op->setImage(image); op->setImageUser(iuser); + iuser->layer = layer_index; op->setFramenumber(context.getFramenumber()); r_input_operations.append(op); } } + break; } } BKE_image_release_ibuf(image, ibuf, nullptr); @@ -245,7 +254,7 @@ CryptomatteOperation *CryptomatteLegacyNode::create_cryptomatte_operation( const bNode &UNUSED(node), const NodeCryptomatte *cryptomatte_settings) const { - const int num_inputs = getNumberOfInputSockets() - 1; + const int num_inputs = inputs.size() - 1; CryptomatteOperation *operation = new CryptomatteOperation(num_inputs); if (cryptomatte_settings) { LISTBASE_FOREACH (CryptomatteEntry *, cryptomatte_entry, &cryptomatte_settings->entries) { @@ -261,3 +270,5 @@ CryptomatteOperation *CryptomatteLegacyNode::create_cryptomatte_operation( } /* \} */ + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_CryptomatteNode.h b/source/blender/compositor/nodes/COM_CryptomatteNode.h index e99a104c914..a6ba860c678 100644 --- a/source/blender/compositor/nodes/COM_CryptomatteNode.h +++ b/source/blender/compositor/nodes/COM_CryptomatteNode.h @@ -24,6 +24,8 @@ #include "COM_CryptomatteOperation.h" #include "COM_Node.h" +namespace blender::compositor { + /** * \brief CryptomatteNode * \ingroup Node @@ -36,7 +38,8 @@ class CryptomatteBaseNode : public Node { } public: - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; protected: virtual CryptomatteOperation *create_cryptomatte_operation( @@ -87,3 +90,5 @@ class CryptomatteLegacyNode : public CryptomatteBaseNode { const bNode &node, const NodeCryptomatte *cryptomatte_settings) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_DefocusNode.cc b/source/blender/compositor/nodes/COM_DefocusNode.cc index 2343b14f68d..fee7c477d9c 100644 --- a/source/blender/compositor/nodes/COM_DefocusNode.cc +++ b/source/blender/compositor/nodes/COM_DefocusNode.cc @@ -30,6 +30,8 @@ #include "DNA_object_types.h" #include "DNA_scene_types.h" +namespace blender::compositor { + DefocusNode::DefocusNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -141,3 +143,5 @@ void DefocusNode::convertToOperations(NodeConverter &converter, converter.mapOutputSocket(getOutputSocket(), operation->getOutputSocket()); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_DefocusNode.h b/source/blender/compositor/nodes/COM_DefocusNode.h index c042e98c515..5e51a0ccd52 100644 --- a/source/blender/compositor/nodes/COM_DefocusNode.h +++ b/source/blender/compositor/nodes/COM_DefocusNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief DefocusNode * \ingroup Node @@ -27,5 +29,8 @@ class DefocusNode : public Node { public: DefocusNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_DenoiseNode.cc b/source/blender/compositor/nodes/COM_DenoiseNode.cc index 1aae81e1e7b..e58a9c7ba9a 100644 --- a/source/blender/compositor/nodes/COM_DenoiseNode.cc +++ b/source/blender/compositor/nodes/COM_DenoiseNode.cc @@ -21,6 +21,8 @@ #include "COM_SetValueOperation.h" #include "DNA_node_types.h" +namespace blender::compositor { + DenoiseNode::DenoiseNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -41,3 +43,5 @@ void DenoiseNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_DenoiseNode.h b/source/blender/compositor/nodes/COM_DenoiseNode.h index 99f59c89fdb..91be8e3e3ad 100644 --- a/source/blender/compositor/nodes/COM_DenoiseNode.h +++ b/source/blender/compositor/nodes/COM_DenoiseNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief DenoiseNode * \ingroup Node @@ -27,5 +29,8 @@ class DenoiseNode : public Node { public: DenoiseNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_DespeckleNode.cc b/source/blender/compositor/nodes/COM_DespeckleNode.cc index 58734917831..beda479025d 100644 --- a/source/blender/compositor/nodes/COM_DespeckleNode.cc +++ b/source/blender/compositor/nodes/COM_DespeckleNode.cc @@ -22,6 +22,8 @@ #include "COM_ExecutionSystem.h" #include "DNA_scene_types.h" +namespace blender::compositor { + DespeckleNode::DespeckleNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -46,3 +48,5 @@ void DespeckleNode::convertToOperations(NodeConverter &converter, converter.addPreview(operation->getOutputSocket(0)); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_DespeckleNode.h b/source/blender/compositor/nodes/COM_DespeckleNode.h index 6b39dd94ac7..2f268e99e1b 100644 --- a/source/blender/compositor/nodes/COM_DespeckleNode.h +++ b/source/blender/compositor/nodes/COM_DespeckleNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief DespeckleNode * \ingroup Node @@ -27,5 +29,8 @@ class DespeckleNode : public Node { public: DespeckleNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_DifferenceMatteNode.cc b/source/blender/compositor/nodes/COM_DifferenceMatteNode.cc index 3d538e9b4a0..8c989bfc04e 100644 --- a/source/blender/compositor/nodes/COM_DifferenceMatteNode.cc +++ b/source/blender/compositor/nodes/COM_DifferenceMatteNode.cc @@ -21,6 +21,8 @@ #include "COM_DifferenceMatteOperation.h" #include "COM_SetAlphaMultiplyOperation.h" +namespace blender::compositor { + DifferenceMatteNode::DifferenceMatteNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -52,3 +54,5 @@ void DifferenceMatteNode::convertToOperations(NodeConverter &converter, converter.addPreview(operation->getOutputSocket()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_DifferenceMatteNode.h b/source/blender/compositor/nodes/COM_DifferenceMatteNode.h index 26be5fe1e80..a173c723192 100644 --- a/source/blender/compositor/nodes/COM_DifferenceMatteNode.h +++ b/source/blender/compositor/nodes/COM_DifferenceMatteNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief DifferenceMatteNode * \ingroup Node @@ -27,5 +29,8 @@ class DifferenceMatteNode : public Node { public: DifferenceMatteNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_DilateErodeNode.cc b/source/blender/compositor/nodes/COM_DilateErodeNode.cc index e90707618e5..81af1687959 100644 --- a/source/blender/compositor/nodes/COM_DilateErodeNode.cc +++ b/source/blender/compositor/nodes/COM_DilateErodeNode.cc @@ -24,6 +24,8 @@ #include "COM_GaussianAlphaXBlurOperation.h" #include "COM_GaussianAlphaYBlurOperation.h" +namespace blender::compositor { + DilateErodeNode::DilateErodeNode(bNode *editorNode) : Node(editorNode) { /* initialize node data */ @@ -147,3 +149,5 @@ void DilateErodeNode::convertToOperations(NodeConverter &converter, } } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_DilateErodeNode.h b/source/blender/compositor/nodes/COM_DilateErodeNode.h index 090095df447..7684d7e3834 100644 --- a/source/blender/compositor/nodes/COM_DilateErodeNode.h +++ b/source/blender/compositor/nodes/COM_DilateErodeNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief DilateErodeNode * \ingroup Node @@ -30,5 +32,8 @@ class DilateErodeNode : public Node { public: DilateErodeNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_DirectionalBlurNode.cc b/source/blender/compositor/nodes/COM_DirectionalBlurNode.cc index f8d0eaf4675..90c4236bce8 100644 --- a/source/blender/compositor/nodes/COM_DirectionalBlurNode.cc +++ b/source/blender/compositor/nodes/COM_DirectionalBlurNode.cc @@ -21,6 +21,8 @@ #include "COM_ExecutionSystem.h" #include "DNA_node_types.h" +namespace blender::compositor { + DirectionalBlurNode::DirectionalBlurNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -38,3 +40,5 @@ void DirectionalBlurNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_DirectionalBlurNode.h b/source/blender/compositor/nodes/COM_DirectionalBlurNode.h index dfb705cbe64..ce3ef378aaf 100644 --- a/source/blender/compositor/nodes/COM_DirectionalBlurNode.h +++ b/source/blender/compositor/nodes/COM_DirectionalBlurNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief DirectionalBlurNode * \ingroup Node @@ -27,5 +29,8 @@ class DirectionalBlurNode : public Node { public: DirectionalBlurNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_DisplaceNode.cc b/source/blender/compositor/nodes/COM_DisplaceNode.cc index 5b63bc1f393..8217caecf44 100644 --- a/source/blender/compositor/nodes/COM_DisplaceNode.cc +++ b/source/blender/compositor/nodes/COM_DisplaceNode.cc @@ -21,6 +21,8 @@ #include "COM_DisplaceSimpleOperation.h" #include "COM_ExecutionSystem.h" +namespace blender::compositor { + DisplaceNode::DisplaceNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -44,3 +46,5 @@ void DisplaceNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(getInputSocket(3), operation->getInputSocket(3)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_DisplaceNode.h b/source/blender/compositor/nodes/COM_DisplaceNode.h index a9e8a5ad657..b2495839da3 100644 --- a/source/blender/compositor/nodes/COM_DisplaceNode.h +++ b/source/blender/compositor/nodes/COM_DisplaceNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief DisplaceNode * \ingroup Node @@ -27,5 +29,8 @@ class DisplaceNode : public Node { public: DisplaceNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_DistanceMatteNode.cc b/source/blender/compositor/nodes/COM_DistanceMatteNode.cc index 37aeb5c8504..4450c4a2f4a 100644 --- a/source/blender/compositor/nodes/COM_DistanceMatteNode.cc +++ b/source/blender/compositor/nodes/COM_DistanceMatteNode.cc @@ -23,6 +23,8 @@ #include "COM_DistanceYCCMatteOperation.h" #include "COM_SetAlphaMultiplyOperation.h" +namespace blender::compositor { + DistanceMatteNode::DistanceMatteNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -96,3 +98,5 @@ void DistanceMatteNode::convertToOperations(NodeConverter &converter, converter.addPreview(operationAlpha->getOutputSocket()); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_DistanceMatteNode.h b/source/blender/compositor/nodes/COM_DistanceMatteNode.h index 6ae71ef715f..0baa531b4d2 100644 --- a/source/blender/compositor/nodes/COM_DistanceMatteNode.h +++ b/source/blender/compositor/nodes/COM_DistanceMatteNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief DistanceMatteNode * \ingroup Node @@ -27,5 +29,8 @@ class DistanceMatteNode : public Node { public: DistanceMatteNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cc b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cc index 907a9f49353..847dcc2f8f1 100644 --- a/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cc +++ b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cc @@ -20,6 +20,8 @@ #include "COM_DoubleEdgeMaskOperation.h" #include "COM_ExecutionSystem.h" +namespace blender::compositor { + DoubleEdgeMaskNode::DoubleEdgeMaskNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -40,3 +42,5 @@ void DoubleEdgeMaskNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.h b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.h index 6d26cbbf528..90e009747c1 100644 --- a/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.h +++ b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief DoubleEdgeMaskNode * \ingroup Node @@ -27,5 +29,8 @@ class DoubleEdgeMaskNode : public Node { public: DoubleEdgeMaskNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_EllipseMaskNode.cc b/source/blender/compositor/nodes/COM_EllipseMaskNode.cc index 1ae855c0f1d..3b4f5ca8c94 100644 --- a/source/blender/compositor/nodes/COM_EllipseMaskNode.cc +++ b/source/blender/compositor/nodes/COM_EllipseMaskNode.cc @@ -23,6 +23,8 @@ #include "COM_ScaleOperation.h" #include "COM_SetValueOperation.h" +namespace blender::compositor { + EllipseMaskNode::EllipseMaskNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -60,7 +62,7 @@ void EllipseMaskNode::convertToOperations(NodeConverter &converter, scaleOperation->setOffset(0.0f, 0.0f); scaleOperation->setNewWidth(rd->xsch * render_size_factor); scaleOperation->setNewHeight(rd->ysch * render_size_factor); - scaleOperation->getInputSocket(0)->setResizeMode(COM_SC_NO_RESIZE); + scaleOperation->getInputSocket(0)->setResizeMode(ResizeMode::None); converter.addOperation(scaleOperation); converter.addLink(valueOperation->getOutputSocket(0), scaleOperation->getInputSocket(0)); @@ -70,3 +72,5 @@ void EllipseMaskNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_EllipseMaskNode.h b/source/blender/compositor/nodes/COM_EllipseMaskNode.h index d7376cad52e..cbe189be9f6 100644 --- a/source/blender/compositor/nodes/COM_EllipseMaskNode.h +++ b/source/blender/compositor/nodes/COM_EllipseMaskNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief EllipseMaskNode * \ingroup Node @@ -27,5 +29,8 @@ class EllipseMaskNode : public Node { public: EllipseMaskNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_FilterNode.cc b/source/blender/compositor/nodes/COM_FilterNode.cc index 1147c11794f..351219155c2 100644 --- a/source/blender/compositor/nodes/COM_FilterNode.cc +++ b/source/blender/compositor/nodes/COM_FilterNode.cc @@ -23,6 +23,8 @@ #include "COM_ExecutionSystem.h" #include "COM_MixOperation.h" +namespace blender::compositor { + FilterNode::FilterNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -94,3 +96,5 @@ void FilterNode::convertToOperations(NodeConverter &converter, converter.addPreview(operation->getOutputSocket(0)); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_FilterNode.h b/source/blender/compositor/nodes/COM_FilterNode.h index 735d8925b48..f7f4176cea5 100644 --- a/source/blender/compositor/nodes/COM_FilterNode.h +++ b/source/blender/compositor/nodes/COM_FilterNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief FilterNode * \ingroup Node @@ -27,5 +29,8 @@ class FilterNode : public Node { public: FilterNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_FlipNode.cc b/source/blender/compositor/nodes/COM_FlipNode.cc index d89e6b7b844..bca6cd3c4f7 100644 --- a/source/blender/compositor/nodes/COM_FlipNode.cc +++ b/source/blender/compositor/nodes/COM_FlipNode.cc @@ -21,6 +21,8 @@ #include "COM_ExecutionSystem.h" #include "COM_FlipOperation.h" +namespace blender::compositor { + FlipNode::FlipNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -52,3 +54,5 @@ void FlipNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_FlipNode.h b/source/blender/compositor/nodes/COM_FlipNode.h index e819c003430..ee61d09fbba 100644 --- a/source/blender/compositor/nodes/COM_FlipNode.h +++ b/source/blender/compositor/nodes/COM_FlipNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief FlipNode * \ingroup Node @@ -27,5 +29,8 @@ class FlipNode : public Node { public: FlipNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_GammaNode.cc b/source/blender/compositor/nodes/COM_GammaNode.cc index 1ce17faa0dc..52148a80a8f 100644 --- a/source/blender/compositor/nodes/COM_GammaNode.cc +++ b/source/blender/compositor/nodes/COM_GammaNode.cc @@ -20,6 +20,8 @@ #include "COM_ExecutionSystem.h" #include "COM_GammaOperation.h" +namespace blender::compositor { + GammaNode::GammaNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -35,3 +37,5 @@ void GammaNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_GammaNode.h b/source/blender/compositor/nodes/COM_GammaNode.h index 1a4d02af160..29c9ed170fa 100644 --- a/source/blender/compositor/nodes/COM_GammaNode.h +++ b/source/blender/compositor/nodes/COM_GammaNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief GammaNode * \ingroup Node @@ -27,5 +29,8 @@ class GammaNode : public Node { public: GammaNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_GlareNode.cc b/source/blender/compositor/nodes/COM_GlareNode.cc index ef088e42205..dbe9aaf73ed 100644 --- a/source/blender/compositor/nodes/COM_GlareNode.cc +++ b/source/blender/compositor/nodes/COM_GlareNode.cc @@ -27,6 +27,8 @@ #include "COM_SetValueOperation.h" #include "DNA_node_types.h" +namespace blender::compositor { + GlareNode::GlareNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -65,7 +67,7 @@ void GlareNode::convertToOperations(NodeConverter &converter, MixGlareOperation *mixoperation = new MixGlareOperation(); mixoperation->setResolutionInputSocketIndex(1); - mixoperation->getInputSocket(2)->setResizeMode(COM_SC_FIT); + mixoperation->getInputSocket(2)->setResizeMode(ResizeMode::FitAny); converter.addOperation(glareoperation); converter.addOperation(thresholdOperation); @@ -80,3 +82,5 @@ void GlareNode::convertToOperations(NodeConverter &converter, converter.addLink(glareoperation->getOutputSocket(), mixoperation->getInputSocket(2)); converter.mapOutputSocket(getOutputSocket(), mixoperation->getOutputSocket()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_GlareNode.h b/source/blender/compositor/nodes/COM_GlareNode.h index 7463af97306..7db5fa85e04 100644 --- a/source/blender/compositor/nodes/COM_GlareNode.h +++ b/source/blender/compositor/nodes/COM_GlareNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief GlareNode * \ingroup Node @@ -27,5 +29,8 @@ class GlareNode : public Node { public: GlareNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cc b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cc index 00125ba2ea5..5042d217f9a 100644 --- a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cc +++ b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cc @@ -26,6 +26,8 @@ #include "COM_SetValueOperation.h" #include "DNA_node_types.h" +namespace blender::compositor { + HueSaturationValueCorrectNode::HueSaturationValueCorrectNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -62,3 +64,5 @@ void HueSaturationValueCorrectNode::convertToOperations( converter.mapInputSocket(valueSocket, blend->getInputSocket(0)); converter.mapOutputSocket(outputSocket, blend->getOutputSocket()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.h b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.h index 01790c1a5fb..d75b2ba51ca 100644 --- a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.h +++ b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief HueSaturationValueCorrectNode * \ingroup Node @@ -27,5 +29,8 @@ class HueSaturationValueCorrectNode : public Node { public: HueSaturationValueCorrectNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueNode.cc b/source/blender/compositor/nodes/COM_HueSaturationValueNode.cc index dc2e5187e8f..54d2caa75af 100644 --- a/source/blender/compositor/nodes/COM_HueSaturationValueNode.cc +++ b/source/blender/compositor/nodes/COM_HueSaturationValueNode.cc @@ -26,6 +26,8 @@ #include "COM_SetValueOperation.h" #include "DNA_node_types.h" +namespace blender::compositor { + HueSaturationValueNode::HueSaturationValueNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -65,3 +67,5 @@ void HueSaturationValueNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(facSocket, blend->getInputSocket(0)); converter.mapOutputSocket(outputSocket, blend->getOutputSocket()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueNode.h b/source/blender/compositor/nodes/COM_HueSaturationValueNode.h index 7ef7abe4188..0b295158cc7 100644 --- a/source/blender/compositor/nodes/COM_HueSaturationValueNode.h +++ b/source/blender/compositor/nodes/COM_HueSaturationValueNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief HueSaturationValueNode * \ingroup Node @@ -27,5 +29,8 @@ class HueSaturationValueNode : public Node { public: HueSaturationValueNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_IDMaskNode.cc b/source/blender/compositor/nodes/COM_IDMaskNode.cc index 5ba54d75bcd..9798dabd035 100644 --- a/source/blender/compositor/nodes/COM_IDMaskNode.cc +++ b/source/blender/compositor/nodes/COM_IDMaskNode.cc @@ -21,6 +21,8 @@ #include "COM_ExecutionSystem.h" #include "COM_IDMaskOperation.h" +namespace blender::compositor { + IDMaskNode::IDMaskNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -47,3 +49,5 @@ void IDMaskNode::convertToOperations(NodeConverter &converter, converter.mapOutputSocket(getOutputSocket(0), antiAliasOperation->getOutputSocket(0)); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_IDMaskNode.h b/source/blender/compositor/nodes/COM_IDMaskNode.h index 51076619951..f702732a8ed 100644 --- a/source/blender/compositor/nodes/COM_IDMaskNode.h +++ b/source/blender/compositor/nodes/COM_IDMaskNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief IDMaskNode * \ingroup Node @@ -27,5 +29,8 @@ class IDMaskNode : public Node { public: IDMaskNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ImageNode.cc b/source/blender/compositor/nodes/COM_ImageNode.cc index 711399ccd63..f0bfda0f40e 100644 --- a/source/blender/compositor/nodes/COM_ImageNode.cc +++ b/source/blender/compositor/nodes/COM_ImageNode.cc @@ -29,6 +29,8 @@ #include "COM_SetValueOperation.h" #include "COM_SetVectorOperation.h" +namespace blender::compositor { + ImageNode::ImageNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -77,7 +79,6 @@ void ImageNode::convertToOperations(NodeConverter &converter, Image *image = (Image *)editorNode->id; ImageUser *imageuser = (ImageUser *)editorNode->storage; int framenumber = context.getFramenumber(); - int numberOfOutputs = this->getNumberOfOutputSockets(); bool outputStraightAlpha = (editorNode->custom1 & CMP_NODE_IMAGE_USE_STRAIGHT_OUTPUT) != 0; BKE_image_user_frame_calc(image, imageuser, context.getFramenumber()); /* force a load, we assume iuser index will be set OK anyway */ @@ -87,14 +88,11 @@ void ImageNode::convertToOperations(NodeConverter &converter, if (image->rr) { RenderLayer *rl = (RenderLayer *)BLI_findlink(&image->rr->layers, imageuser->layer); if (rl) { - NodeOutput *socket; - int index; - is_multilayer_ok = true; - for (index = 0; index < numberOfOutputs; index++) { + for (int64_t index = 0; index < outputs.size(); index++) { + NodeOutput *socket = outputs[index]; NodeOperation *operation = nullptr; - socket = this->getOutputSocket(index); bNodeSocket *bnodeSocket = socket->getbNodeSocket(); NodeImageLayer *storage = (NodeImageLayer *)bnodeSocket->storage; RenderPass *rpass = (RenderPass *)BLI_findstring( @@ -171,8 +169,7 @@ void ImageNode::convertToOperations(NodeConverter &converter, converter.addPreview(operation->getOutputSocket()); } if (STREQ(rpass->name, RE_PASSNAME_COMBINED)) { - for (int alphaIndex = 0; alphaIndex < numberOfOutputs; alphaIndex++) { - NodeOutput *alphaSocket = this->getOutputSocket(alphaIndex); + for (NodeOutput *alphaSocket : getOutputSockets()) { bNodeSocket *bnodeAlphaSocket = alphaSocket->getbNodeSocket(); if (!STREQ(bnodeAlphaSocket->name, "Alpha")) { continue; @@ -204,12 +201,13 @@ void ImageNode::convertToOperations(NodeConverter &converter, /* without this, multilayer that fail to load will crash blender T32490. */ if (is_multilayer_ok == false) { - for (int i = 0; i < getNumberOfOutputSockets(); i++) { - converter.setInvalidOutput(getOutputSocket(i)); + for (NodeOutput *output : getOutputSockets()) { + converter.setInvalidOutput(output); } } } else { + const int64_t numberOfOutputs = getOutputSockets().size(); if (numberOfOutputs > 0) { ImageOperation *operation = new ImageOperation(); operation->setImage(image); @@ -296,4 +294,6 @@ void ImageNode::convertToOperations(NodeConverter &converter, } } } -} +} // namespace blender::compositor + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ImageNode.h b/source/blender/compositor/nodes/COM_ImageNode.h index b99fc07f105..047cc496f83 100644 --- a/source/blender/compositor/nodes/COM_ImageNode.h +++ b/source/blender/compositor/nodes/COM_ImageNode.h @@ -26,6 +26,8 @@ #include "RE_engine.h" #include "RE_pipeline.h" +namespace blender::compositor { + /** * \brief ImageNode * \ingroup Node @@ -44,5 +46,8 @@ class ImageNode : public Node { public: ImageNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_InpaintNode.cc b/source/blender/compositor/nodes/COM_InpaintNode.cc index 40fe63ec9f3..01ec5523939 100644 --- a/source/blender/compositor/nodes/COM_InpaintNode.cc +++ b/source/blender/compositor/nodes/COM_InpaintNode.cc @@ -22,6 +22,8 @@ #include "COM_InpaintOperation.h" #include "DNA_scene_types.h" +namespace blender::compositor { + InpaintNode::InpaintNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -43,3 +45,5 @@ void InpaintNode::convertToOperations(NodeConverter &converter, converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_InpaintNode.h b/source/blender/compositor/nodes/COM_InpaintNode.h index 3f778c8ba5c..3a10c11bf61 100644 --- a/source/blender/compositor/nodes/COM_InpaintNode.h +++ b/source/blender/compositor/nodes/COM_InpaintNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief InpaintNode * \ingroup Node @@ -27,5 +29,8 @@ class InpaintNode : public Node { public: InpaintNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_InvertNode.cc b/source/blender/compositor/nodes/COM_InvertNode.cc index 913452c42c8..5fe2033227f 100644 --- a/source/blender/compositor/nodes/COM_InvertNode.cc +++ b/source/blender/compositor/nodes/COM_InvertNode.cc @@ -21,6 +21,8 @@ #include "COM_ExecutionSystem.h" #include "COM_InvertOperation.h" +namespace blender::compositor { + InvertNode::InvertNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -39,3 +41,5 @@ void InvertNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_InvertNode.h b/source/blender/compositor/nodes/COM_InvertNode.h index d90d6e48713..1cc975b8236 100644 --- a/source/blender/compositor/nodes/COM_InvertNode.h +++ b/source/blender/compositor/nodes/COM_InvertNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief InvertNode * \ingroup Node @@ -27,5 +29,8 @@ class InvertNode : public Node { public: InvertNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_KeyingNode.cc b/source/blender/compositor/nodes/COM_KeyingNode.cc index 9b493d3f332..2054ed67190 100644 --- a/source/blender/compositor/nodes/COM_KeyingNode.cc +++ b/source/blender/compositor/nodes/COM_KeyingNode.cc @@ -37,6 +37,8 @@ #include "COM_GaussianAlphaXBlurOperation.h" #include "COM_GaussianAlphaYBlurOperation.h" +namespace blender::compositor { + KeyingNode::KeyingNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -348,3 +350,5 @@ void KeyingNode::convertToOperations(NodeConverter &converter, converter.mapOutputSocket(outputEdges, edgesMatte); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_KeyingNode.h b/source/blender/compositor/nodes/COM_KeyingNode.h index 6920d2af09d..6d5e3ca1883 100644 --- a/source/blender/compositor/nodes/COM_KeyingNode.h +++ b/source/blender/compositor/nodes/COM_KeyingNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief KeyingNode * \ingroup Node @@ -55,5 +57,8 @@ class KeyingNode : public Node { public: KeyingNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_KeyingScreenNode.cc b/source/blender/compositor/nodes/COM_KeyingScreenNode.cc index 93a9a071226..cbe4f165a45 100644 --- a/source/blender/compositor/nodes/COM_KeyingScreenNode.cc +++ b/source/blender/compositor/nodes/COM_KeyingScreenNode.cc @@ -22,6 +22,8 @@ #include "DNA_movieclip_types.h" +namespace blender::compositor { + KeyingScreenNode::KeyingScreenNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -45,3 +47,5 @@ void KeyingScreenNode::convertToOperations(NodeConverter &converter, converter.mapOutputSocket(outputScreen, operation->getOutputSocket()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_KeyingScreenNode.h b/source/blender/compositor/nodes/COM_KeyingScreenNode.h index ce9ef54543d..f2ad3b344f1 100644 --- a/source/blender/compositor/nodes/COM_KeyingScreenNode.h +++ b/source/blender/compositor/nodes/COM_KeyingScreenNode.h @@ -21,6 +21,8 @@ #include "COM_Node.h" #include "DNA_node_types.h" +namespace blender::compositor { + /** * \brief KeyingScreenNode * \ingroup Node @@ -28,5 +30,8 @@ class KeyingScreenNode : public Node { public: KeyingScreenNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_LensDistortionNode.cc b/source/blender/compositor/nodes/COM_LensDistortionNode.cc index 34d2fba6433..f5226d31989 100644 --- a/source/blender/compositor/nodes/COM_LensDistortionNode.cc +++ b/source/blender/compositor/nodes/COM_LensDistortionNode.cc @@ -21,6 +21,8 @@ #include "COM_ProjectorLensDistortionOperation.h" #include "COM_ScreenLensDistortionOperation.h" +namespace blender::compositor { + LensDistortionNode::LensDistortionNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -59,3 +61,5 @@ void LensDistortionNode::convertToOperations(NodeConverter &converter, converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_LensDistortionNode.h b/source/blender/compositor/nodes/COM_LensDistortionNode.h index 8df0e3f7df1..4de1b0fe4da 100644 --- a/source/blender/compositor/nodes/COM_LensDistortionNode.h +++ b/source/blender/compositor/nodes/COM_LensDistortionNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief LensDistortionNode * \ingroup Node @@ -27,5 +29,8 @@ class LensDistortionNode : public Node { public: LensDistortionNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_LuminanceMatteNode.cc b/source/blender/compositor/nodes/COM_LuminanceMatteNode.cc index 8bfea1eff49..920da53231f 100644 --- a/source/blender/compositor/nodes/COM_LuminanceMatteNode.cc +++ b/source/blender/compositor/nodes/COM_LuminanceMatteNode.cc @@ -22,6 +22,8 @@ #include "COM_LuminanceMatteOperation.h" #include "COM_SetAlphaMultiplyOperation.h" +namespace blender::compositor { + LuminanceMatteNode::LuminanceMatteNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -51,3 +53,5 @@ void LuminanceMatteNode::convertToOperations(NodeConverter &converter, converter.addPreview(operation->getOutputSocket()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_LuminanceMatteNode.h b/source/blender/compositor/nodes/COM_LuminanceMatteNode.h index 7f2d9dfbe95..ef4ebc8ad92 100644 --- a/source/blender/compositor/nodes/COM_LuminanceMatteNode.h +++ b/source/blender/compositor/nodes/COM_LuminanceMatteNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief LuminanceMatteNode * \ingroup Node @@ -27,5 +29,8 @@ class LuminanceMatteNode : public Node { public: LuminanceMatteNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_MapRangeNode.cc b/source/blender/compositor/nodes/COM_MapRangeNode.cc index 352bc0dd48d..718a6d9e47b 100644 --- a/source/blender/compositor/nodes/COM_MapRangeNode.cc +++ b/source/blender/compositor/nodes/COM_MapRangeNode.cc @@ -21,6 +21,8 @@ #include "COM_ExecutionSystem.h" #include "COM_MapRangeOperation.h" +namespace blender::compositor { + MapRangeNode::MapRangeNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -47,3 +49,5 @@ void MapRangeNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(destMaxSocket, operation->getInputSocket(4)); converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_MapRangeNode.h b/source/blender/compositor/nodes/COM_MapRangeNode.h index b838ea858ee..ad6fd78a7d5 100644 --- a/source/blender/compositor/nodes/COM_MapRangeNode.h +++ b/source/blender/compositor/nodes/COM_MapRangeNode.h @@ -20,6 +20,9 @@ #include "COM_Node.h" #include "DNA_node_types.h" + +namespace blender::compositor { + /** * \brief MapRangeNode * \ingroup Node @@ -27,5 +30,8 @@ class MapRangeNode : public Node { public: MapRangeNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_MapUVNode.cc b/source/blender/compositor/nodes/COM_MapUVNode.cc index feb9c75ec56..4b7a9e8af0f 100644 --- a/source/blender/compositor/nodes/COM_MapUVNode.cc +++ b/source/blender/compositor/nodes/COM_MapUVNode.cc @@ -20,6 +20,8 @@ #include "COM_ExecutionSystem.h" #include "COM_MapUVOperation.h" +namespace blender::compositor { + MapUVNode::MapUVNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -39,3 +41,5 @@ void MapUVNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_MapUVNode.h b/source/blender/compositor/nodes/COM_MapUVNode.h index f9fc413dbe5..f7f4db167ea 100644 --- a/source/blender/compositor/nodes/COM_MapUVNode.h +++ b/source/blender/compositor/nodes/COM_MapUVNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief MapUVNode * \ingroup Node @@ -27,5 +29,8 @@ class MapUVNode : public Node { public: MapUVNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_MapValueNode.cc b/source/blender/compositor/nodes/COM_MapValueNode.cc index e07df8ad367..ae48bda6cb8 100644 --- a/source/blender/compositor/nodes/COM_MapValueNode.cc +++ b/source/blender/compositor/nodes/COM_MapValueNode.cc @@ -21,6 +21,8 @@ #include "COM_ExecutionSystem.h" #include "COM_MapValueOperation.h" +namespace blender::compositor { + MapValueNode::MapValueNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -41,3 +43,5 @@ void MapValueNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(colorSocket, convertProg->getInputSocket(0)); converter.mapOutputSocket(valueSocket, convertProg->getOutputSocket(0)); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_MapValueNode.h b/source/blender/compositor/nodes/COM_MapValueNode.h index 60ee262d447..dcac1d6e3c5 100644 --- a/source/blender/compositor/nodes/COM_MapValueNode.h +++ b/source/blender/compositor/nodes/COM_MapValueNode.h @@ -20,6 +20,9 @@ #include "COM_Node.h" #include "DNA_node_types.h" + +namespace blender::compositor { + /** * \brief MapValueNode * \ingroup Node @@ -27,5 +30,8 @@ class MapValueNode : public Node { public: MapValueNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_MaskNode.cc b/source/blender/compositor/nodes/COM_MaskNode.cc index a6415a3992e..ef171c01653 100644 --- a/source/blender/compositor/nodes/COM_MaskNode.cc +++ b/source/blender/compositor/nodes/COM_MaskNode.cc @@ -22,6 +22,8 @@ #include "DNA_mask_types.h" +namespace blender::compositor { + MaskNode::MaskNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -68,3 +70,5 @@ void MaskNode::convertToOperations(NodeConverter &converter, converter.addOperation(operation); converter.mapOutputSocket(outputMask, operation->getOutputSocket()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_MaskNode.h b/source/blender/compositor/nodes/COM_MaskNode.h index 4a03916b3c2..5890cf5957a 100644 --- a/source/blender/compositor/nodes/COM_MaskNode.h +++ b/source/blender/compositor/nodes/COM_MaskNode.h @@ -21,6 +21,8 @@ #include "COM_Node.h" #include "DNA_node_types.h" +namespace blender::compositor { + /** * \brief MaskNode * \ingroup Node @@ -28,5 +30,8 @@ class MaskNode : public Node { public: MaskNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_MathNode.cc b/source/blender/compositor/nodes/COM_MathNode.cc index 0edf880400f..dd0d8931d58 100644 --- a/source/blender/compositor/nodes/COM_MathNode.cc +++ b/source/blender/compositor/nodes/COM_MathNode.cc @@ -20,6 +20,8 @@ #include "COM_ExecutionSystem.h" #include "COM_MathBaseOperation.h" +namespace blender::compositor { + void MathNode::convertToOperations(NodeConverter &converter, const CompositorContext & /*context*/) const { @@ -159,3 +161,5 @@ void MathNode::convertToOperations(NodeConverter &converter, converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_MathNode.h b/source/blender/compositor/nodes/COM_MathNode.h index 41b144679ac..5db59e62bab 100644 --- a/source/blender/compositor/nodes/COM_MathNode.h +++ b/source/blender/compositor/nodes/COM_MathNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief MathNode * \ingroup Node @@ -29,5 +31,8 @@ class MathNode : public Node { MathNode(bNode *editorNode) : Node(editorNode) { } - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_MixNode.cc b/source/blender/compositor/nodes/COM_MixNode.cc index d082590d21b..cfa8d0ee6a6 100644 --- a/source/blender/compositor/nodes/COM_MixNode.cc +++ b/source/blender/compositor/nodes/COM_MixNode.cc @@ -24,6 +24,8 @@ #include "COM_SetValueOperation.h" #include "DNA_material_types.h" /* the ramp types */ +namespace blender::compositor { + MixNode::MixNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -110,3 +112,5 @@ void MixNode::convertToOperations(NodeConverter &converter, converter.addPreview(convertProg->getOutputSocket(0)); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_MixNode.h b/source/blender/compositor/nodes/COM_MixNode.h index 91ce29fdbf2..81f9c41871e 100644 --- a/source/blender/compositor/nodes/COM_MixNode.h +++ b/source/blender/compositor/nodes/COM_MixNode.h @@ -20,6 +20,9 @@ #include "COM_Node.h" #include "DNA_node_types.h" + +namespace blender::compositor { + /** * \brief MixNode * \ingroup Node @@ -27,5 +30,8 @@ class MixNode : public Node { public: MixNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_MovieClipNode.cc b/source/blender/compositor/nodes/COM_MovieClipNode.cc index 7cc8f2ea19c..50bd9b4d71b 100644 --- a/source/blender/compositor/nodes/COM_MovieClipNode.cc +++ b/source/blender/compositor/nodes/COM_MovieClipNode.cc @@ -29,6 +29,8 @@ #include "IMB_imbuf.h" +namespace blender::compositor { + MovieClipNode::MovieClipNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -106,3 +108,5 @@ void MovieClipNode::convertToOperations(NodeConverter &converter, IMB_freeImBuf(ibuf); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_MovieClipNode.h b/source/blender/compositor/nodes/COM_MovieClipNode.h index 58262592dca..a469ce9e2a4 100644 --- a/source/blender/compositor/nodes/COM_MovieClipNode.h +++ b/source/blender/compositor/nodes/COM_MovieClipNode.h @@ -21,6 +21,8 @@ #include "COM_Node.h" #include "DNA_node_types.h" +namespace blender::compositor { + /** * \brief MovieClipNode * \ingroup Node @@ -28,5 +30,8 @@ class MovieClipNode : public Node { public: MovieClipNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_MovieDistortionNode.cc b/source/blender/compositor/nodes/COM_MovieDistortionNode.cc index ebace6d5fff..8f17ef8bb98 100644 --- a/source/blender/compositor/nodes/COM_MovieDistortionNode.cc +++ b/source/blender/compositor/nodes/COM_MovieDistortionNode.cc @@ -22,6 +22,8 @@ #include "COM_MovieDistortionOperation.h" #include "DNA_movieclip_types.h" +namespace blender::compositor { + MovieDistortionNode::MovieDistortionNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -44,3 +46,5 @@ void MovieDistortionNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_MovieDistortionNode.h b/source/blender/compositor/nodes/COM_MovieDistortionNode.h index f4df48dac13..0c1610aa3d3 100644 --- a/source/blender/compositor/nodes/COM_MovieDistortionNode.h +++ b/source/blender/compositor/nodes/COM_MovieDistortionNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief MovieDistortionNode * \ingroup Node @@ -27,5 +29,8 @@ class MovieDistortionNode : public Node { public: MovieDistortionNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_NormalNode.cc b/source/blender/compositor/nodes/COM_NormalNode.cc index 1f48a26fd75..5a97b0932ef 100644 --- a/source/blender/compositor/nodes/COM_NormalNode.cc +++ b/source/blender/compositor/nodes/COM_NormalNode.cc @@ -22,6 +22,8 @@ #include "COM_ExecutionSystem.h" #include "COM_SetVectorOperation.h" +namespace blender::compositor { + NormalNode::NormalNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -54,3 +56,5 @@ void NormalNode::convertToOperations(NodeConverter &converter, converter.addLink(operationSet->getOutputSocket(0), operation->getInputSocket(1)); converter.mapOutputSocket(outputSocketDotproduct, operation->getOutputSocket(0)); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_NormalNode.h b/source/blender/compositor/nodes/COM_NormalNode.h index c23e83fb023..6d5cbb394a0 100644 --- a/source/blender/compositor/nodes/COM_NormalNode.h +++ b/source/blender/compositor/nodes/COM_NormalNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief NormalNode * \ingroup Node @@ -27,5 +29,8 @@ class NormalNode : public Node { public: NormalNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_NormalizeNode.cc b/source/blender/compositor/nodes/COM_NormalizeNode.cc index 72459fd477c..639dd8e5a51 100644 --- a/source/blender/compositor/nodes/COM_NormalizeNode.cc +++ b/source/blender/compositor/nodes/COM_NormalizeNode.cc @@ -20,6 +20,8 @@ #include "COM_ExecutionSystem.h" #include "COM_NormalizeOperation.h" +namespace blender::compositor { + NormalizeNode::NormalizeNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -34,3 +36,5 @@ void NormalizeNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_NormalizeNode.h b/source/blender/compositor/nodes/COM_NormalizeNode.h index 7e53ac7e9a0..7770fc49b61 100644 --- a/source/blender/compositor/nodes/COM_NormalizeNode.h +++ b/source/blender/compositor/nodes/COM_NormalizeNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief NormalizeNode * \ingroup Node @@ -27,5 +29,8 @@ class NormalizeNode : public Node { public: NormalizeNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_OutputFileNode.cc b/source/blender/compositor/nodes/COM_OutputFileNode.cc index dcc1fbdec67..10f176d71f5 100644 --- a/source/blender/compositor/nodes/COM_OutputFileNode.cc +++ b/source/blender/compositor/nodes/COM_OutputFileNode.cc @@ -25,6 +25,8 @@ #include "BLI_path_util.h" +namespace blender::compositor { + OutputFileNode::OutputFileNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -69,17 +71,16 @@ void OutputFileNode::convertToOperations(NodeConverter &converter, } converter.addOperation(outputOperation); - int num_inputs = getNumberOfInputSockets(); bool previewAdded = false; - for (int i = 0; i < num_inputs; i++) { - NodeInput *input = getInputSocket(i); + int index = 0; + for (NodeInput *input : inputs) { NodeImageMultiFileSocket *sockdata = (NodeImageMultiFileSocket *)input->getbNodeSocket()->storage; /* note: layer becomes an empty placeholder if the input is not linked */ outputOperation->add_layer(sockdata->layer, input->getDataType(), input->isLinked()); - converter.mapInputSocket(input, outputOperation->getInputSocket(i)); + converter.mapInputSocket(input, outputOperation->getInputSocket(index++)); if (!previewAdded) { converter.addNodeInputPreview(input); @@ -88,10 +89,8 @@ void OutputFileNode::convertToOperations(NodeConverter &converter, } } else { /* single layer format */ - int num_inputs = getNumberOfInputSockets(); bool previewAdded = false; - for (int i = 0; i < num_inputs; i++) { - NodeInput *input = getInputSocket(i); + for (NodeInput *input : inputs) { if (input->isLinked()) { NodeImageMultiFileSocket *sockdata = (NodeImageMultiFileSocket *)input->getbNodeSocket()->storage; @@ -151,3 +150,5 @@ void OutputFileNode::convertToOperations(NodeConverter &converter, } } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_OutputFileNode.h b/source/blender/compositor/nodes/COM_OutputFileNode.h index 037a345fa50..d1826797c6e 100644 --- a/source/blender/compositor/nodes/COM_OutputFileNode.h +++ b/source/blender/compositor/nodes/COM_OutputFileNode.h @@ -21,6 +21,8 @@ #include "COM_Node.h" #include "DNA_node_types.h" +namespace blender::compositor { + /** * \brief OutputFileNode * \ingroup Node @@ -28,5 +30,8 @@ class OutputFileNode : public Node { public: OutputFileNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_PixelateNode.cc b/source/blender/compositor/nodes/COM_PixelateNode.cc index f238f68727e..396f339e5a2 100644 --- a/source/blender/compositor/nodes/COM_PixelateNode.cc +++ b/source/blender/compositor/nodes/COM_PixelateNode.cc @@ -21,6 +21,8 @@ #include "COM_ExecutionSystem.h" #include "COM_PixelateOperation.h" +namespace blender::compositor { + PixelateNode::PixelateNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -44,3 +46,5 @@ void PixelateNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_PixelateNode.h b/source/blender/compositor/nodes/COM_PixelateNode.h index 87cb4df59e8..1a6555550cf 100644 --- a/source/blender/compositor/nodes/COM_PixelateNode.h +++ b/source/blender/compositor/nodes/COM_PixelateNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief PixelateNode * \ingroup Node @@ -27,5 +29,8 @@ class PixelateNode : public Node { public: PixelateNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.cc b/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.cc index 6b9b51631ec..54a0f4d0452 100644 --- a/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.cc +++ b/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.cc @@ -25,6 +25,8 @@ #include "BKE_node.h" #include "BKE_tracking.h" +namespace blender::compositor { + PlaneTrackDeformNode::PlaneTrackDeformNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -70,3 +72,5 @@ void PlaneTrackDeformNode::convertToOperations(NodeConverter &converter, converter.mapOutputSocket(output_plane, plane_mask_operation->getOutputSocket()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.h b/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.h index 36844bc1650..307738fcaf0 100644 --- a/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.h +++ b/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.h @@ -23,6 +23,8 @@ #include "DNA_movieclip_types.h" #include "DNA_node_types.h" +namespace blender::compositor { + /** * \brief PlaneTrackDeformNode * \ingroup Node @@ -30,5 +32,8 @@ class PlaneTrackDeformNode : public Node { public: PlaneTrackDeformNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_RenderLayersNode.cc b/source/blender/compositor/nodes/COM_RenderLayersNode.cc index ea3eeb13393..851d0366546 100644 --- a/source/blender/compositor/nodes/COM_RenderLayersNode.cc +++ b/source/blender/compositor/nodes/COM_RenderLayersNode.cc @@ -25,6 +25,8 @@ #include "COM_SetVectorOperation.h" #include "COM_TranslateOperation.h" +namespace blender::compositor { + RenderLayersNode::RenderLayersNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -72,9 +74,8 @@ void RenderLayersNode::testRenderLink(NodeConverter &converter, missingRenderLink(converter); return; } - const int num_outputs = this->getNumberOfOutputSockets(); - for (int i = 0; i < num_outputs; i++) { - NodeOutput *output = this->getOutputSocket(i); + + for (NodeOutput *output : getOutputSockets()) { NodeImageLayer *storage = (NodeImageLayer *)output->getbNodeSocket()->storage; RenderPass *rpass = (RenderPass *)BLI_findstring( &rl->passes, storage->pass_name, offsetof(RenderPass, name)); @@ -153,9 +154,7 @@ void RenderLayersNode::missingSocketLink(NodeConverter &converter, NodeOutput *o void RenderLayersNode::missingRenderLink(NodeConverter &converter) const { - const int num_outputs = this->getNumberOfOutputSockets(); - for (int i = 0; i < num_outputs; i++) { - NodeOutput *output = this->getOutputSocket(i); + for (NodeOutput *output : outputs) { missingSocketLink(converter, output); } } @@ -174,3 +173,5 @@ void RenderLayersNode::convertToOperations(NodeConverter &converter, missingRenderLink(converter); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_RenderLayersNode.h b/source/blender/compositor/nodes/COM_RenderLayersNode.h index 1ffd084ad1e..4eb2427c8e0 100644 --- a/source/blender/compositor/nodes/COM_RenderLayersNode.h +++ b/source/blender/compositor/nodes/COM_RenderLayersNode.h @@ -23,6 +23,7 @@ #include "DNA_node_types.h" struct Render; +namespace blender::compositor { /** * \brief RenderLayersNode @@ -31,7 +32,8 @@ struct Render; class RenderLayersNode : public Node { public: RenderLayersNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; private: void testSocketLink(NodeConverter &converter, @@ -48,3 +50,5 @@ class RenderLayersNode : public Node { void missingSocketLink(NodeConverter &converter, NodeOutput *output) const; void missingRenderLink(NodeConverter &converter) const; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_RotateNode.cc b/source/blender/compositor/nodes/COM_RotateNode.cc index cbade778bcb..af5baa733dc 100644 --- a/source/blender/compositor/nodes/COM_RotateNode.cc +++ b/source/blender/compositor/nodes/COM_RotateNode.cc @@ -22,6 +22,8 @@ #include "COM_RotateOperation.h" #include "COM_SetSamplerOperation.h" +namespace blender::compositor { + RotateNode::RotateNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -45,3 +47,5 @@ void RotateNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(inputDegreeSocket, operation->getInputSocket(1)); converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_RotateNode.h b/source/blender/compositor/nodes/COM_RotateNode.h index b75fdd52683..5d8bcb2e3e4 100644 --- a/source/blender/compositor/nodes/COM_RotateNode.h +++ b/source/blender/compositor/nodes/COM_RotateNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief RotateNode * \ingroup Node @@ -27,5 +29,8 @@ class RotateNode : public Node { public: RotateNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ScaleNode.cc b/source/blender/compositor/nodes/COM_ScaleNode.cc index 9ffcd5306b0..50d2902f375 100644 --- a/source/blender/compositor/nodes/COM_ScaleNode.cc +++ b/source/blender/compositor/nodes/COM_ScaleNode.cc @@ -24,6 +24,8 @@ #include "COM_SetSamplerOperation.h" #include "COM_SetValueOperation.h" +namespace blender::compositor { + ScaleNode::ScaleNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -79,7 +81,7 @@ void ScaleNode::convertToOperations(NodeConverter &converter, operation->setOffset(bnode->custom3, bnode->custom4); operation->setNewWidth(rd->xsch * render_size_factor); operation->setNewHeight(rd->ysch * render_size_factor); - operation->getInputSocket(0)->setResizeMode(COM_SC_NO_RESIZE); + operation->getInputSocket(0)->setResizeMode(ResizeMode::None); converter.addOperation(operation); converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); @@ -105,3 +107,5 @@ void ScaleNode::convertToOperations(NodeConverter &converter, } } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ScaleNode.h b/source/blender/compositor/nodes/COM_ScaleNode.h index c9a02411b1c..186ffa8bdce 100644 --- a/source/blender/compositor/nodes/COM_ScaleNode.h +++ b/source/blender/compositor/nodes/COM_ScaleNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief ScaleNode * \ingroup Node @@ -27,5 +29,8 @@ class ScaleNode : public Node { public: ScaleNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_SeparateColorNode.cc b/source/blender/compositor/nodes/COM_SeparateColorNode.cc index 203aa25c9e9..fcaf52c701d 100644 --- a/source/blender/compositor/nodes/COM_SeparateColorNode.cc +++ b/source/blender/compositor/nodes/COM_SeparateColorNode.cc @@ -20,6 +20,8 @@ #include "COM_ConvertOperation.h" +namespace blender::compositor { + SeparateColorNode::SeparateColorNode(bNode *editorNode) : Node(editorNode) { } @@ -119,3 +121,5 @@ NodeOperation *SeparateYUVANode::getColorConverter(const CompositorContext & /*c { return new ConvertRGBToYUVOperation(); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_SeparateColorNode.h b/source/blender/compositor/nodes/COM_SeparateColorNode.h index aaf86c6e22b..eaf543df51f 100644 --- a/source/blender/compositor/nodes/COM_SeparateColorNode.h +++ b/source/blender/compositor/nodes/COM_SeparateColorNode.h @@ -20,10 +20,13 @@ #include "COM_Node.h" +namespace blender::compositor { + class SeparateColorNode : public Node { public: SeparateColorNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; protected: virtual NodeOperation *getColorConverter(const CompositorContext &context) const = 0; @@ -35,7 +38,7 @@ class SeparateRGBANode : public SeparateColorNode { { } - NodeOperation *getColorConverter(const CompositorContext &context) const; + NodeOperation *getColorConverter(const CompositorContext &context) const override; }; class SeparateHSVANode : public SeparateColorNode { @@ -44,7 +47,7 @@ class SeparateHSVANode : public SeparateColorNode { { } - NodeOperation *getColorConverter(const CompositorContext &context) const; + NodeOperation *getColorConverter(const CompositorContext &context) const override; }; class SeparateYCCANode : public SeparateColorNode { @@ -53,7 +56,7 @@ class SeparateYCCANode : public SeparateColorNode { { } - NodeOperation *getColorConverter(const CompositorContext &context) const; + NodeOperation *getColorConverter(const CompositorContext &context) const override; }; class SeparateYUVANode : public SeparateColorNode { @@ -62,5 +65,7 @@ class SeparateYUVANode : public SeparateColorNode { { } - NodeOperation *getColorConverter(const CompositorContext &context) const; + NodeOperation *getColorConverter(const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_SetAlphaNode.cc b/source/blender/compositor/nodes/COM_SetAlphaNode.cc index 233a5e96ff4..dc41c126ba8 100644 --- a/source/blender/compositor/nodes/COM_SetAlphaNode.cc +++ b/source/blender/compositor/nodes/COM_SetAlphaNode.cc @@ -21,6 +21,8 @@ #include "COM_SetAlphaMultiplyOperation.h" #include "COM_SetAlphaReplaceOperation.h" +namespace blender::compositor { + void SetAlphaNode::convertToOperations(NodeConverter &converter, const CompositorContext & /*context*/) const { @@ -46,3 +48,5 @@ void SetAlphaNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_SetAlphaNode.h b/source/blender/compositor/nodes/COM_SetAlphaNode.h index 2e652539cec..c8d340eb64b 100644 --- a/source/blender/compositor/nodes/COM_SetAlphaNode.h +++ b/source/blender/compositor/nodes/COM_SetAlphaNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief SetAlphaNode * \ingroup Node @@ -29,5 +31,8 @@ class SetAlphaNode : public Node { SetAlphaNode(bNode *editorNode) : Node(editorNode) { } - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_SocketProxyNode.cc b/source/blender/compositor/nodes/COM_SocketProxyNode.cc index 93d8d399cad..b3aa1770551 100644 --- a/source/blender/compositor/nodes/COM_SocketProxyNode.cc +++ b/source/blender/compositor/nodes/COM_SocketProxyNode.cc @@ -25,6 +25,8 @@ #include "COM_SocketProxyOperation.h" #include "COM_WriteBufferOperation.h" +namespace blender::compositor { + SocketProxyNode::SocketProxyNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput, @@ -101,3 +103,5 @@ void SocketBufferNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(input, writeOperation->getInputSocket(0)); converter.mapOutputSocket(output, readOperation->getOutputSocket()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_SocketProxyNode.h b/source/blender/compositor/nodes/COM_SocketProxyNode.h index a0c0b63dafd..d19fb802767 100644 --- a/source/blender/compositor/nodes/COM_SocketProxyNode.h +++ b/source/blender/compositor/nodes/COM_SocketProxyNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief SocketProxyNode * \ingroup Node @@ -30,7 +32,8 @@ class SocketProxyNode : public Node { bNodeSocket *editorInput, bNodeSocket *editorOutput, bool use_conversion); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; bool getUseConversion() const { @@ -49,5 +52,8 @@ class SocketProxyNode : public Node { class SocketBufferNode : public Node { public: SocketBufferNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_SplitViewerNode.cc b/source/blender/compositor/nodes/COM_SplitViewerNode.cc index 681adeaf1d3..582c650f205 100644 --- a/source/blender/compositor/nodes/COM_SplitViewerNode.cc +++ b/source/blender/compositor/nodes/COM_SplitViewerNode.cc @@ -25,6 +25,8 @@ #include "COM_SplitOperation.h" #include "COM_ViewerOperation.h" +namespace blender::compositor { + SplitViewerNode::SplitViewerNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -73,3 +75,5 @@ void SplitViewerNode::convertToOperations(NodeConverter &converter, converter.registerViewer(viewerOperation); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_SplitViewerNode.h b/source/blender/compositor/nodes/COM_SplitViewerNode.h index c9ce5164ef4..8a42775eb0d 100644 --- a/source/blender/compositor/nodes/COM_SplitViewerNode.h +++ b/source/blender/compositor/nodes/COM_SplitViewerNode.h @@ -20,6 +20,9 @@ #include "COM_Node.h" #include "DNA_node_types.h" + +namespace blender::compositor { + /** * \brief SplitViewerNode * \ingroup Node @@ -27,5 +30,8 @@ class SplitViewerNode : public Node { public: SplitViewerNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_Stabilize2dNode.cc b/source/blender/compositor/nodes/COM_Stabilize2dNode.cc index 38db080a154..fc72b48eca2 100644 --- a/source/blender/compositor/nodes/COM_Stabilize2dNode.cc +++ b/source/blender/compositor/nodes/COM_Stabilize2dNode.cc @@ -28,6 +28,8 @@ #include "DNA_movieclip_types.h" +namespace blender::compositor { + Stabilize2dNode::Stabilize2dNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -111,3 +113,5 @@ void Stabilize2dNode::convertToOperations(NodeConverter &converter, converter.addLink(translateOperation->getOutputSocket(), psoperation->getInputSocket(0)); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_Stabilize2dNode.h b/source/blender/compositor/nodes/COM_Stabilize2dNode.h index cb46926a3f3..34ed8871e33 100644 --- a/source/blender/compositor/nodes/COM_Stabilize2dNode.h +++ b/source/blender/compositor/nodes/COM_Stabilize2dNode.h @@ -21,6 +21,8 @@ #include "COM_Node.h" #include "DNA_node_types.h" +namespace blender::compositor { + /** * \brief Stabilize2dNode * \ingroup Node @@ -28,5 +30,8 @@ class Stabilize2dNode : public Node { public: Stabilize2dNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_SunBeamsNode.cc b/source/blender/compositor/nodes/COM_SunBeamsNode.cc index d899a54c03c..1e5aa0b8020 100644 --- a/source/blender/compositor/nodes/COM_SunBeamsNode.cc +++ b/source/blender/compositor/nodes/COM_SunBeamsNode.cc @@ -18,6 +18,8 @@ #include "COM_SunBeamsNode.h" #include "COM_SunBeamsOperation.h" +namespace blender::compositor { + SunBeamsNode::SunBeamsNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -37,3 +39,5 @@ void SunBeamsNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_SunBeamsNode.h b/source/blender/compositor/nodes/COM_SunBeamsNode.h index 9a56fc1fcea..8b68d3f4cb5 100644 --- a/source/blender/compositor/nodes/COM_SunBeamsNode.h +++ b/source/blender/compositor/nodes/COM_SunBeamsNode.h @@ -19,6 +19,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief SunBeamsNode * \ingroup Node @@ -26,5 +28,8 @@ class SunBeamsNode : public Node { public: SunBeamsNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_SwitchNode.cc b/source/blender/compositor/nodes/COM_SwitchNode.cc index 947774e98ae..4006d10dafb 100644 --- a/source/blender/compositor/nodes/COM_SwitchNode.cc +++ b/source/blender/compositor/nodes/COM_SwitchNode.cc @@ -18,6 +18,8 @@ #include "COM_SwitchNode.h" +namespace blender::compositor { + SwitchNode::SwitchNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -38,3 +40,5 @@ void SwitchNode::convertToOperations(NodeConverter &converter, converter.mapOutputSocket(getOutputSocket(0), result); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_SwitchNode.h b/source/blender/compositor/nodes/COM_SwitchNode.h index d4d8dd23a98..aa6caa2e59f 100644 --- a/source/blender/compositor/nodes/COM_SwitchNode.h +++ b/source/blender/compositor/nodes/COM_SwitchNode.h @@ -21,6 +21,9 @@ #include "COM_Node.h" #include "COM_NodeOperation.h" #include "DNA_node_types.h" + +namespace blender::compositor { + /** * \brief SwitchNode * \ingroup Node @@ -28,5 +31,8 @@ class SwitchNode : public Node { public: SwitchNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_SwitchViewNode.cc b/source/blender/compositor/nodes/COM_SwitchViewNode.cc index e534ebfac9a..395122dd11b 100644 --- a/source/blender/compositor/nodes/COM_SwitchViewNode.cc +++ b/source/blender/compositor/nodes/COM_SwitchViewNode.cc @@ -19,6 +19,8 @@ #include "COM_SwitchViewNode.h" #include "BLI_listbase.h" +namespace blender::compositor { + SwitchViewNode::SwitchViewNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -38,3 +40,5 @@ void SwitchViewNode::convertToOperations(NodeConverter &converter, result = converter.addInputProxy(getInputSocket(nr), false); converter.mapOutputSocket(getOutputSocket(0), result); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_SwitchViewNode.h b/source/blender/compositor/nodes/COM_SwitchViewNode.h index 9423740f668..ce6de52182c 100644 --- a/source/blender/compositor/nodes/COM_SwitchViewNode.h +++ b/source/blender/compositor/nodes/COM_SwitchViewNode.h @@ -21,6 +21,9 @@ #include "COM_Node.h" #include "COM_NodeOperation.h" #include "DNA_node_types.h" + +namespace blender::compositor { + /** * \brief SwitchViewNode * \ingroup Node @@ -28,5 +31,8 @@ class SwitchViewNode : public Node { public: SwitchViewNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_TextureNode.cc b/source/blender/compositor/nodes/COM_TextureNode.cc index 3381b5098d7..317355b8c9a 100644 --- a/source/blender/compositor/nodes/COM_TextureNode.cc +++ b/source/blender/compositor/nodes/COM_TextureNode.cc @@ -20,6 +20,8 @@ #include "COM_ExecutionSystem.h" #include "COM_TextureOperation.h" +namespace blender::compositor { + TextureNode::TextureNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -54,3 +56,5 @@ void TextureNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(getInputSocket(1), alphaOperation->getInputSocket(1)); converter.mapOutputSocket(getOutputSocket(0), alphaOperation->getOutputSocket()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_TextureNode.h b/source/blender/compositor/nodes/COM_TextureNode.h index 4d780850190..b886e3b74e1 100644 --- a/source/blender/compositor/nodes/COM_TextureNode.h +++ b/source/blender/compositor/nodes/COM_TextureNode.h @@ -21,6 +21,8 @@ #include "COM_Node.h" #include "DNA_node_types.h" +namespace blender::compositor { + /** * \brief TextureNode * \ingroup Node @@ -28,5 +30,8 @@ class TextureNode : public Node { public: TextureNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_TimeNode.cc b/source/blender/compositor/nodes/COM_TimeNode.cc index 247e0d11df6..c14c5344eee 100644 --- a/source/blender/compositor/nodes/COM_TimeNode.cc +++ b/source/blender/compositor/nodes/COM_TimeNode.cc @@ -24,6 +24,8 @@ #include "BLI_utildefines.h" +namespace blender::compositor { + TimeNode::TimeNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -56,3 +58,5 @@ void TimeNode::convertToOperations(NodeConverter &converter, converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_TimeNode.h b/source/blender/compositor/nodes/COM_TimeNode.h index 78177014dc1..5688e2cff03 100644 --- a/source/blender/compositor/nodes/COM_TimeNode.h +++ b/source/blender/compositor/nodes/COM_TimeNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief TimeNode * \ingroup Node @@ -27,5 +29,8 @@ class TimeNode : public Node { public: TimeNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_TonemapNode.cc b/source/blender/compositor/nodes/COM_TonemapNode.cc index db329e56f9b..844fe3e8cb6 100644 --- a/source/blender/compositor/nodes/COM_TonemapNode.cc +++ b/source/blender/compositor/nodes/COM_TonemapNode.cc @@ -20,6 +20,8 @@ #include "COM_ExecutionSystem.h" #include "COM_TonemapOperation.h" +namespace blender::compositor { + TonemapNode::TonemapNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -38,3 +40,5 @@ void TonemapNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_TonemapNode.h b/source/blender/compositor/nodes/COM_TonemapNode.h index d934a1ede5b..cac9004c32a 100644 --- a/source/blender/compositor/nodes/COM_TonemapNode.h +++ b/source/blender/compositor/nodes/COM_TonemapNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief TonemapNode * \ingroup Node @@ -27,5 +29,8 @@ class TonemapNode : public Node { public: TonemapNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_TrackPositionNode.cc b/source/blender/compositor/nodes/COM_TrackPositionNode.cc index 52e7f7d832b..3fb5fc02f20 100644 --- a/source/blender/compositor/nodes/COM_TrackPositionNode.cc +++ b/source/blender/compositor/nodes/COM_TrackPositionNode.cc @@ -26,6 +26,8 @@ #include "BKE_node.h" +namespace blender::compositor { + TrackPositionNode::TrackPositionNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -109,3 +111,5 @@ void TrackPositionNode::convertToOperations(NodeConverter &converter, converter.addLink(operationMotionPostY->getOutputSocket(), combine_operation->getInputSocket(3)); converter.mapOutputSocket(outputSpeed, combine_operation->getOutputSocket()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_TrackPositionNode.h b/source/blender/compositor/nodes/COM_TrackPositionNode.h index 37d3d25d592..665ba36fe09 100644 --- a/source/blender/compositor/nodes/COM_TrackPositionNode.h +++ b/source/blender/compositor/nodes/COM_TrackPositionNode.h @@ -21,6 +21,8 @@ #include "COM_Node.h" #include "DNA_node_types.h" +namespace blender::compositor { + /** * \brief TrackPositionNode * \ingroup Node @@ -28,5 +30,8 @@ class TrackPositionNode : public Node { public: TrackPositionNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_TransformNode.cc b/source/blender/compositor/nodes/COM_TransformNode.cc index cd5ba8ba201..cd12939ab43 100644 --- a/source/blender/compositor/nodes/COM_TransformNode.cc +++ b/source/blender/compositor/nodes/COM_TransformNode.cc @@ -24,6 +24,8 @@ #include "COM_SetValueOperation.h" #include "COM_TranslateOperation.h" +namespace blender::compositor { + TransformNode::TransformNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -66,3 +68,5 @@ void TransformNode::convertToOperations(NodeConverter &converter, converter.mapOutputSocket(getOutputSocket(), translateOperation->getOutputSocket()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_TransformNode.h b/source/blender/compositor/nodes/COM_TransformNode.h index bd01808d662..137e162256d 100644 --- a/source/blender/compositor/nodes/COM_TransformNode.h +++ b/source/blender/compositor/nodes/COM_TransformNode.h @@ -21,6 +21,8 @@ #include "COM_Node.h" #include "DNA_node_types.h" +namespace blender::compositor { + /** * \brief TransformNode * \ingroup Node @@ -28,5 +30,8 @@ class TransformNode : public Node { public: TransformNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_TranslateNode.cc b/source/blender/compositor/nodes/COM_TranslateNode.cc index 13a73953ea0..922393f006a 100644 --- a/source/blender/compositor/nodes/COM_TranslateNode.cc +++ b/source/blender/compositor/nodes/COM_TranslateNode.cc @@ -23,6 +23,8 @@ #include "COM_WrapOperation.h" #include "COM_WriteBufferOperation.h" +namespace blender::compositor { + TranslateNode::TranslateNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -69,3 +71,5 @@ void TranslateNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_TranslateNode.h b/source/blender/compositor/nodes/COM_TranslateNode.h index d381274c0e5..0cea234bff8 100644 --- a/source/blender/compositor/nodes/COM_TranslateNode.h +++ b/source/blender/compositor/nodes/COM_TranslateNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief TranslateNode * \ingroup Node @@ -27,5 +29,8 @@ class TranslateNode : public Node { public: TranslateNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ValueNode.cc b/source/blender/compositor/nodes/COM_ValueNode.cc index 4227db0d10e..6b640fa2a3a 100644 --- a/source/blender/compositor/nodes/COM_ValueNode.cc +++ b/source/blender/compositor/nodes/COM_ValueNode.cc @@ -20,6 +20,8 @@ #include "COM_ExecutionSystem.h" #include "COM_SetValueOperation.h" +namespace blender::compositor { + ValueNode::ValueNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -35,3 +37,5 @@ void ValueNode::convertToOperations(NodeConverter &converter, converter.mapOutputSocket(output, operation->getOutputSocket()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ValueNode.h b/source/blender/compositor/nodes/COM_ValueNode.h index 5179e6828e4..1401b2c7e0a 100644 --- a/source/blender/compositor/nodes/COM_ValueNode.h +++ b/source/blender/compositor/nodes/COM_ValueNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief ValueNode * \ingroup Node @@ -27,5 +29,8 @@ class ValueNode : public Node { public: ValueNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_VectorBlurNode.cc b/source/blender/compositor/nodes/COM_VectorBlurNode.cc index a92991c8b49..7aa5f5668c9 100644 --- a/source/blender/compositor/nodes/COM_VectorBlurNode.cc +++ b/source/blender/compositor/nodes/COM_VectorBlurNode.cc @@ -20,6 +20,8 @@ #include "COM_VectorBlurOperation.h" #include "DNA_node_types.h" +namespace blender::compositor { + VectorBlurNode::VectorBlurNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -41,3 +43,5 @@ void VectorBlurNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); converter.mapOutputSocket(getOutputSocket(), operation->getOutputSocket()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_VectorBlurNode.h b/source/blender/compositor/nodes/COM_VectorBlurNode.h index f370c82a1ee..8c98a0b81a1 100644 --- a/source/blender/compositor/nodes/COM_VectorBlurNode.h +++ b/source/blender/compositor/nodes/COM_VectorBlurNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief VectorBlurNode * \ingroup Node @@ -27,5 +29,8 @@ class VectorBlurNode : public Node { public: VectorBlurNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_VectorCurveNode.cc b/source/blender/compositor/nodes/COM_VectorCurveNode.cc index 1201a9f9613..f2fd80cd93e 100644 --- a/source/blender/compositor/nodes/COM_VectorCurveNode.cc +++ b/source/blender/compositor/nodes/COM_VectorCurveNode.cc @@ -20,6 +20,8 @@ #include "COM_ExecutionSystem.h" #include "COM_VectorCurveOperation.h" +namespace blender::compositor { + VectorCurveNode::VectorCurveNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -35,3 +37,5 @@ void VectorCurveNode::convertToOperations(NodeConverter &converter, converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_VectorCurveNode.h b/source/blender/compositor/nodes/COM_VectorCurveNode.h index 4d7f92897a1..ee4df5d3a42 100644 --- a/source/blender/compositor/nodes/COM_VectorCurveNode.h +++ b/source/blender/compositor/nodes/COM_VectorCurveNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief VectorCurveNode * \ingroup Node @@ -27,5 +29,8 @@ class VectorCurveNode : public Node { public: VectorCurveNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ViewLevelsNode.cc b/source/blender/compositor/nodes/COM_ViewLevelsNode.cc index 7b86fb1d64d..dc454b95080 100644 --- a/source/blender/compositor/nodes/COM_ViewLevelsNode.cc +++ b/source/blender/compositor/nodes/COM_ViewLevelsNode.cc @@ -22,6 +22,8 @@ #include "COM_ExecutionSystem.h" #include "COM_SetValueOperation.h" +namespace blender::compositor { + ViewLevelsNode::ViewLevelsNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -59,3 +61,5 @@ void ViewLevelsNode::convertToOperations(NodeConverter &converter, converter.addOutputValue(getOutputSocket(1), 0.0f); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ViewLevelsNode.h b/source/blender/compositor/nodes/COM_ViewLevelsNode.h index 0e931fed055..055d871498e 100644 --- a/source/blender/compositor/nodes/COM_ViewLevelsNode.h +++ b/source/blender/compositor/nodes/COM_ViewLevelsNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief ViewLevelsNode * \ingroup Node @@ -27,5 +29,8 @@ class ViewLevelsNode : public Node { public: ViewLevelsNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ViewerNode.cc b/source/blender/compositor/nodes/COM_ViewerNode.cc index 359c3d3031d..3833a8d7ca8 100644 --- a/source/blender/compositor/nodes/COM_ViewerNode.cc +++ b/source/blender/compositor/nodes/COM_ViewerNode.cc @@ -25,6 +25,8 @@ #include "COM_ExecutionSystem.h" #include "COM_ViewerOperation.h" +namespace blender::compositor { + ViewerNode::ViewerNode(bNode *editorNode) : Node(editorNode) { /* pass */ @@ -82,3 +84,5 @@ void ViewerNode::convertToOperations(NodeConverter &converter, converter.registerViewer(viewerOperation); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ViewerNode.h b/source/blender/compositor/nodes/COM_ViewerNode.h index 74758417014..544a5e6a504 100644 --- a/source/blender/compositor/nodes/COM_ViewerNode.h +++ b/source/blender/compositor/nodes/COM_ViewerNode.h @@ -20,6 +20,9 @@ #include "COM_Node.h" #include "DNA_node_types.h" + +namespace blender::compositor { + /** * \brief ViewerNode * \ingroup Node @@ -27,5 +30,8 @@ class ViewerNode : public Node { public: ViewerNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ZCombineNode.cc b/source/blender/compositor/nodes/COM_ZCombineNode.cc index b61c018d029..a76049ff249 100644 --- a/source/blender/compositor/nodes/COM_ZCombineNode.cc +++ b/source/blender/compositor/nodes/COM_ZCombineNode.cc @@ -28,6 +28,8 @@ #include "DNA_material_types.h" /* the ramp types */ +namespace blender::compositor { + void ZCombineNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const { @@ -99,3 +101,5 @@ void ZCombineNode::convertToOperations(NodeConverter &converter, converter.mapOutputSocket(getOutputSocket(1), zoperation->getOutputSocket()); } } + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ZCombineNode.h b/source/blender/compositor/nodes/COM_ZCombineNode.h index ca54fd7fffa..82f2f30fb3c 100644 --- a/source/blender/compositor/nodes/COM_ZCombineNode.h +++ b/source/blender/compositor/nodes/COM_ZCombineNode.h @@ -20,6 +20,8 @@ #include "COM_Node.h" +namespace blender::compositor { + /** * \brief ZCombineNode * \ingroup Node @@ -29,5 +31,8 @@ class ZCombineNode : public Node { ZCombineNode(bNode *editorNode) : Node(editorNode) { } - void convertToOperations(NodeConverter &converter, const CompositorContext &context) const; + void convertToOperations(NodeConverter &converter, + const CompositorContext &context) const override; }; + +} // namespace blender::compositor 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 |