diff options
Diffstat (limited to 'source/blender')
456 files changed, 10905 insertions, 10762 deletions
diff --git a/source/blender/compositor/COM_compositor.h b/source/blender/compositor/COM_compositor.h index a7f9081f3fc..73e66ffeb03 100644 --- a/source/blender/compositor/COM_compositor.h +++ b/source/blender/compositor/COM_compositor.h @@ -74,8 +74,8 @@ extern "C" { * * during the preparation of the execution All ReadBufferOperation will receive an offset. * This offset is used during execution as an optimization trick - * Next all operations will be initialized for execution \see NodeOperation.initExecution - * Next all ExecutionGroup's will be initialized for execution \see ExecutionGroup.initExecution + * Next all operations will be initialized for execution \see NodeOperation.init_execution + * Next all ExecutionGroup's will be initialized for execution \see ExecutionGroup.init_execution * this all is controlled from \see ExecutionSystem.execute * * \section priority Render priority @@ -92,7 +92,7 @@ extern "C" { * When match the ExecutionGroup will be executed (this happens in serial) * * \see ExecutionSystem.execute control of the Render priority - * \see NodeOperation.getRenderPriority receive the render priority + * \see NodeOperation.get_render_priority receive the render priority * \see ExecutionGroup.execute the main loop to execute a whole ExecutionGroup * * \section order Chunk order @@ -121,7 +121,7 @@ extern "C" { * Chunk is finished. * * \see ExecutionGroup.execute - * \see ViewerOperation.getChunkOrder + * \see ViewerOperation.get_chunk_order * \see ChunkOrdering * * \section interest Area of interest @@ -152,13 +152,13 @@ extern "C" { * * In the above example ExecutionGroup B has an outputoperation (ViewerOperation) * and is being executed. - * The first chunk is evaluated [@ref ExecutionGroup.scheduleChunkWhenPossible], + * The first chunk is evaluated [@ref ExecutionGroup.schedule_chunk_when_possible], * but not all input chunks are available. * The relevant ExecutionGroup (that can calculate the missing chunks; ExecutionGroup A) * is asked to calculate the area ExecutionGroup B is missing. - * [@ref ExecutionGroup.scheduleAreaWhenPossible] + * [@ref ExecutionGroup.schedule_area_when_possible] * ExecutionGroup B checks what chunks the area spans, and tries to schedule these chunks. - * If all input data is available these chunks are scheduled [@ref ExecutionGroup.scheduleChunk] + * If all input data is available these chunks are scheduled [@ref ExecutionGroup.schedule_chunk] * * <pre> * @@ -171,18 +171,18 @@ extern "C" { * O------------------------------->O | * . O | * . O-------\ | - * . . | ExecutionGroup.scheduleChunkWhenPossible + * . . | ExecutionGroup.schedule_chunk_when_possible * . . O----/ (*) | * . . O | * . . O | - * . . O ExecutionGroup.scheduleAreaWhenPossible| + * . . O ExecutionGroup.schedule_area_when_possible| * . . O---------------------------------------->O - * . . . O----------\ ExecutionGroup.scheduleChunkWhenPossible + * . . . O----------\ ExecutionGroup.schedule_chunk_when_possible * . . . . | (*) * . . . . O-------/ * . . . . O * . . . . O - * . . . . O-------\ ExecutionGroup.scheduleChunk + * . . . . O-------\ ExecutionGroup.schedule_chunk * . . . . . | * . . . . . O----/ * . . . . O<=O @@ -198,7 +198,7 @@ extern "C" { * This happens until all chunks of (ExecutionGroup B) are finished executing or the user break's the process. * * NodeOperation like the ScaleOperation can influence the area of interest by reimplementing the - * [@ref NodeOperation.determineAreaOfInterest] method + * [@ref NodeOperation.determine_area_of_interest] method * * <pre> * @@ -221,13 +221,13 @@ extern "C" { * * \see ExecutionGroup.execute Execute a complete ExecutionGroup. * Halts until finished or breaked by user - * \see ExecutionGroup.scheduleChunkWhenPossible Tries to schedule a single chunk, + * \see ExecutionGroup.schedule_chunk_when_possible Tries to schedule a single chunk, * checks if all input data is available. Can trigger dependent chunks to be calculated - * \see ExecutionGroup.scheduleAreaWhenPossible + * \see ExecutionGroup.schedule_area_when_possible * Tries to schedule an area. This can be multiple chunks - * (is called from [@ref ExecutionGroup.scheduleChunkWhenPossible]) - * \see ExecutionGroup.scheduleChunk Schedule a chunk on the WorkScheduler - * \see NodeOperation.determineDependingAreaOfInterest Influence the area of interest of a chunk. + * (is called from [@ref ExecutionGroup.schedule_chunk_when_possible]) + * \see ExecutionGroup.schedule_chunk Schedule a chunk on the WorkScheduler + * \see NodeOperation.determine_depending_area_of_interest Influence the area of interest of a chunk. * \see WriteBufferOperation Operation to write to a MemoryProxy/MemoryBuffer * \see ReadBufferOperation Operation to read from a MemoryProxy/MemoryBuffer * \see MemoryProxy proxy for information about memory image @@ -283,16 +283,16 @@ extern "C" { * The OutputOperation of the ExecutionGroup is called to execute the area of the outputbuffer. * * \see ExecutionGroup - * \see NodeOperation.executeRegion executes a single chunk of a NodeOperation + * \see NodeOperation.execute_region executes a single chunk of a NodeOperation * \see CPUDevice.execute * * \subsection GPUDevice OpenCLDevice * * To be completed! - * \see NodeOperation.executeOpenCLRegion + * \see NodeOperation.execute_opencl_region * \see OpenCLDevice.execute * - * \section executePixel executing a pixel + * \section execute_pixel executing a pixel * Finally the last step, the node functionality :) */ @@ -312,10 +312,10 @@ extern "C" { * (true) or editing (false). * based on this setting the system will work differently: * - during rendering only Composite & the File output node will be calculated - * \see NodeOperation.isOutputProgram(int rendering) of the specific operations + * \see NodeOperation.is_output_program(int rendering) of the specific operations * * - during editing all output nodes will be calculated - * \see NodeOperation.isOutputProgram(int rendering) of the specific operations + * \see NodeOperation.is_output_program(int rendering) of the specific operations * * - another quality setting can be used bNodeTree. * The quality is determined by the bNodeTree fields. @@ -326,10 +326,10 @@ extern "C" { * - output nodes can have different priorities in the WorkScheduler. * This is implemented in the COM_execute function. * - * \param viewSettings: + * \param view_settings: * reference to view settings used for color management * - * \param displaySettings: + * \param display_settings: * reference to display settings used for color management * * OCIO_TODO: this options only used in rare cases, namely in output file node, @@ -343,13 +343,13 @@ void COM_execute(RenderData *render_data, Scene *scene, bNodeTree *node_tree, int rendering, - const ColorManagedViewSettings *viewSettings, - const ColorManagedDisplaySettings *displaySettings, - const char *viewName); + const ColorManagedViewSettings *view_settings, + const ColorManagedDisplaySettings *display_settings, + const char *view_name); /** * \brief Deinitialize the compositor caches and allocated memory. - * Use COM_clearCaches to only free the caches. + * Use COM_clear_caches to only free the caches. */ void COM_deinitialize(void); @@ -357,7 +357,7 @@ void COM_deinitialize(void); * \brief Clear all compositor caches. (Compositor system will still remain available). * To deinitialize the compositor use the COM_deinitialize method. */ -// void COM_clearCaches(void); // NOT YET WRITTEN +// void COM_clear_caches(void); // NOT YET WRITTEN #ifdef __cplusplus } diff --git a/source/blender/compositor/intern/COM_BufferOperation.cc b/source/blender/compositor/intern/COM_BufferOperation.cc index c6530cf6bd1..21238733925 100644 --- a/source/blender/compositor/intern/COM_BufferOperation.cc +++ b/source/blender/compositor/intern/COM_BufferOperation.cc @@ -25,7 +25,7 @@ BufferOperation::BufferOperation(MemoryBuffer *buffer, DataType data_type) buffer_ = buffer; inflated_buffer_ = nullptr; set_canvas(buffer->get_rect()); - addOutputSocket(data_type); + add_output_socket(data_type); flags.is_constant_operation = buffer_->is_a_single_elem(); flags.is_fullframe_operation = false; } @@ -33,39 +33,42 @@ BufferOperation::BufferOperation(MemoryBuffer *buffer, DataType data_type) const float *BufferOperation::get_constant_elem() { BLI_assert(buffer_->is_a_single_elem()); - return buffer_->getBuffer(); + return buffer_->get_buffer(); } -void BufferOperation::initExecution() +void BufferOperation::init_execution() { if (buffer_->is_a_single_elem()) { - initMutex(); + init_mutex(); } } -void *BufferOperation::initializeTileData(rcti * /*rect*/) +void *BufferOperation::initialize_tile_data(rcti * /*rect*/) { if (buffer_->is_a_single_elem() == false) { return buffer_; } - lockMutex(); + lock_mutex(); if (!inflated_buffer_) { inflated_buffer_ = buffer_->inflate(); } - unlockMutex(); + unlock_mutex(); return inflated_buffer_; } -void BufferOperation::deinitExecution() +void BufferOperation::deinit_execution() { if (buffer_->is_a_single_elem()) { - deinitMutex(); + deinit_mutex(); } delete inflated_buffer_; } -void BufferOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) +void BufferOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { switch (sampler) { case PixelSampler::Nearest: @@ -73,16 +76,16 @@ void BufferOperation::executePixelSampled(float output[4], float x, float y, Pix break; case PixelSampler::Bilinear: default: - buffer_->readBilinear(output, x, y); + buffer_->read_bilinear(output, x, y); break; case PixelSampler::Bicubic: /* No bicubic. Same implementation as ReadBufferOperation. */ - buffer_->readBilinear(output, x, y); + buffer_->read_bilinear(output, x, y); break; } } -void BufferOperation::executePixelFiltered( +void BufferOperation::execute_pixel_filtered( float output[4], float x, float y, float dx[2], float dy[2]) { const float uv[2] = {x, y}; diff --git a/source/blender/compositor/intern/COM_BufferOperation.h b/source/blender/compositor/intern/COM_BufferOperation.h index b4cbc0a56b6..4aba3a705dd 100644 --- a/source/blender/compositor/intern/COM_BufferOperation.h +++ b/source/blender/compositor/intern/COM_BufferOperation.h @@ -31,11 +31,12 @@ class BufferOperation : public ConstantOperation { BufferOperation(MemoryBuffer *buffer, DataType data_type); const float *get_constant_elem() override; - void *initializeTileData(rcti *rect) override; - void initExecution() override; - void deinitExecution() override; - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; - void executePixelFiltered(float output[4], float x, float y, float dx[2], float dy[2]) override; + void *initialize_tile_data(rcti *rect) override; + void init_execution() override; + void deinit_execution() override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_filtered( + float output[4], float x, float y, float dx[2], float dy[2]) override; }; } // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_CPUDevice.cc b/source/blender/compositor/intern/COM_CPUDevice.cc index 89aea47f4a6..ad7a807b8fd 100644 --- a/source/blender/compositor/intern/COM_CPUDevice.cc +++ b/source/blender/compositor/intern/COM_CPUDevice.cc @@ -31,11 +31,11 @@ void CPUDevice::execute(WorkPackage *work_package) { switch (work_package->type) { case eWorkPackageType::Tile: { - const unsigned int chunkNumber = work_package->chunk_number; - ExecutionGroup *executionGroup = work_package->execution_group; + const unsigned int chunk_number = work_package->chunk_number; + ExecutionGroup *execution_group = work_package->execution_group; - executionGroup->getOutputOperation()->executeRegion(&work_package->rect, chunkNumber); - executionGroup->finalizeChunkExecution(chunkNumber, nullptr); + execution_group->get_output_operation()->execute_region(&work_package->rect, chunk_number); + execution_group->finalize_chunk_execution(chunk_number, nullptr); break; } case eWorkPackageType::CustomFunction: { diff --git a/source/blender/compositor/intern/COM_CompositorContext.cc b/source/blender/compositor/intern/COM_CompositorContext.cc index 5e2e5ea295b..7b0f7b0f8fb 100644 --- a/source/blender/compositor/intern/COM_CompositorContext.cc +++ b/source/blender/compositor/intern/COM_CompositorContext.cc @@ -26,13 +26,13 @@ CompositorContext::CompositorContext() rd_ = nullptr; quality_ = eCompositorQuality::High; hasActiveOpenCLDevices_ = false; - fastCalculation_ = false; - viewSettings_ = nullptr; - displaySettings_ = nullptr; + fast_calculation_ = false; + view_settings_ = nullptr; + display_settings_ = nullptr; bnodetree_ = nullptr; } -int CompositorContext::getFramenumber() const +int CompositorContext::get_framenumber() const { BLI_assert(rd_); return rd_->cfra; @@ -40,8 +40,8 @@ int CompositorContext::getFramenumber() const Size2f CompositorContext::get_render_size() const { - return {getRenderData()->xsch * getRenderPercentageAsFactor(), - getRenderData()->ysch * getRenderPercentageAsFactor()}; + return {get_render_data()->xsch * get_render_percentage_as_factor(), + get_render_data()->ysch * get_render_percentage_as_factor()}; } eExecutionModel CompositorContext::get_execution_model() const diff --git a/source/blender/compositor/intern/COM_CompositorContext.h b/source/blender/compositor/intern/COM_CompositorContext.h index 9354551d66a..e41576b6f69 100644 --- a/source/blender/compositor/intern/COM_CompositorContext.h +++ b/source/blender/compositor/intern/COM_CompositorContext.h @@ -77,16 +77,16 @@ class CompositorContext { /** * \brief Skip slow nodes */ - bool fastCalculation_; + bool fast_calculation_; /* \brief color management settings */ - const ColorManagedViewSettings *viewSettings_; - const ColorManagedDisplaySettings *displaySettings_; + const ColorManagedViewSettings *view_settings_; + const ColorManagedDisplaySettings *display_settings_; /** * \brief active rendering view name */ - const char *viewName_; + const char *view_name_; public: /** @@ -97,7 +97,7 @@ class CompositorContext { /** * \brief set the rendering field of the context */ - void setRendering(bool rendering) + void set_rendering(bool rendering) { rendering_ = rendering; } @@ -105,7 +105,7 @@ class CompositorContext { /** * \brief get the rendering field of the context */ - bool isRendering() const + bool is_rendering() const { return rendering_; } @@ -113,7 +113,7 @@ class CompositorContext { /** * \brief set the scene of the context */ - void setRenderData(RenderData *rd) + void set_render_data(RenderData *rd) { rd_ = rd; } @@ -121,7 +121,7 @@ class CompositorContext { /** * \brief set the bnodetree of the context */ - void setbNodeTree(bNodeTree *bnodetree) + void set_bnodetree(bNodeTree *bnodetree) { bnodetree_ = bnodetree; } @@ -129,7 +129,7 @@ class CompositorContext { /** * \brief get the bnodetree of the context */ - const bNodeTree *getbNodeTree() const + const bNodeTree *get_bnodetree() const { return bnodetree_; } @@ -137,16 +137,16 @@ class CompositorContext { /** * \brief get the scene of the context */ - const RenderData *getRenderData() const + const RenderData *get_render_data() const { return rd_; } - void setScene(Scene *scene) + void set_scene(Scene *scene) { scene_ = scene; } - Scene *getScene() const + Scene *get_scene() const { return scene_; } @@ -154,7 +154,7 @@ class CompositorContext { /** * \brief set the preview image hash table */ - void setPreviewHash(bNodeInstanceHash *previews) + void set_preview_hash(bNodeInstanceHash *previews) { previews_ = previews; } @@ -162,7 +162,7 @@ class CompositorContext { /** * \brief get the preview image hash table */ - bNodeInstanceHash *getPreviewHash() const + bNodeInstanceHash *get_preview_hash() const { return previews_; } @@ -170,39 +170,39 @@ class CompositorContext { /** * \brief set view settings of color management */ - void setViewSettings(const ColorManagedViewSettings *viewSettings) + void set_view_settings(const ColorManagedViewSettings *view_settings) { - viewSettings_ = viewSettings; + view_settings_ = view_settings; } /** * \brief get view settings of color management */ - const ColorManagedViewSettings *getViewSettings() const + const ColorManagedViewSettings *get_view_settings() const { - return viewSettings_; + return view_settings_; } /** * \brief set display settings of color management */ - void setDisplaySettings(const ColorManagedDisplaySettings *displaySettings) + void set_display_settings(const ColorManagedDisplaySettings *display_settings) { - displaySettings_ = displaySettings; + display_settings_ = display_settings; } /** * \brief get display settings of color management */ - const ColorManagedDisplaySettings *getDisplaySettings() const + const ColorManagedDisplaySettings *get_display_settings() const { - return displaySettings_; + return display_settings_; } /** * \brief set the quality */ - void setQuality(eCompositorQuality quality) + void set_quality(eCompositorQuality quality) { quality_ = quality; } @@ -210,7 +210,7 @@ class CompositorContext { /** * \brief get the quality */ - eCompositorQuality getQuality() const + eCompositorQuality get_quality() const { return quality_; } @@ -218,18 +218,18 @@ class CompositorContext { /** * \brief get the current frame-number of the scene in this context */ - int getFramenumber() const; + int get_framenumber() const; /** - * \brief has this system active openclDevices? + * \brief has this system active opencl_devices? */ - bool getHasActiveOpenCLDevices() const + bool get_has_active_opencl_devices() const { return hasActiveOpenCLDevices_; } /** - * \brief set has this system active openclDevices? + * \brief set has this system active opencl_devices? */ void setHasActiveOpenCLDevices(bool hasAvtiveOpenCLDevices) { @@ -239,48 +239,48 @@ class CompositorContext { /** Whether it has a view with a specific name and not the default one. */ bool has_explicit_view() const { - return viewName_ && viewName_[0] != '\0'; + return view_name_ && view_name_[0] != '\0'; } /** * \brief get the active rendering view */ - const char *getViewName() const + const char *get_view_name() const { - return viewName_; + return view_name_; } /** * \brief set the active rendering view */ - void setViewName(const char *viewName) + void set_view_name(const char *view_name) { - viewName_ = viewName; + view_name_ = view_name; } - int getChunksize() const + int get_chunksize() const { - return this->getbNodeTree()->chunksize; + return this->get_bnodetree()->chunksize; } - void setFastCalculation(bool fastCalculation) + void set_fast_calculation(bool fast_calculation) { - fastCalculation_ = fastCalculation; + fast_calculation_ = fast_calculation; } - bool isFastCalculation() const + bool is_fast_calculation() const { - return fastCalculation_; + return fast_calculation_; } - bool isGroupnodeBufferEnabled() const + bool is_groupnode_buffer_enabled() const { - return (this->getbNodeTree()->flag & NTREE_COM_GROUPNODE_BUFFER) != 0; + return (this->get_bnodetree()->flag & NTREE_COM_GROUPNODE_BUFFER) != 0; } /** * \brief Get the render percentage as a factor. * The compositor uses a factor i.o. a percentage. */ - float getRenderPercentageAsFactor() const + float get_render_percentage_as_factor() const { return rd_->size * 0.01f; } diff --git a/source/blender/compositor/intern/COM_ConstantFolder.cc b/source/blender/compositor/intern/COM_ConstantFolder.cc index d3031765eae..2cf3ac001d1 100644 --- a/source/blender/compositor/intern/COM_ConstantFolder.cc +++ b/source/blender/compositor/intern/COM_ConstantFolder.cc @@ -44,7 +44,7 @@ ConstantFolder::ConstantFolder(NodeOperationBuilder &operations_builder) static bool is_constant_foldable(NodeOperation *operation) { if (operation->get_flags().can_be_constant && !operation->get_flags().is_constant_operation) { - for (int i = 0; i < operation->getNumberOfInputSockets(); i++) { + for (int i = 0; i < operation->get_number_of_input_sockets(); i++) { NodeOperation *input = operation->get_input_operation(i); if (!input->get_flags().is_constant_operation || !static_cast<ConstantOperation *>(input)->can_get_constant_elem()) { @@ -72,17 +72,17 @@ static ConstantOperation *create_constant_operation(DataType data_type, const fl switch (data_type) { case DataType::Color: { SetColorOperation *color_op = new SetColorOperation(); - color_op->setChannels(constant_elem); + color_op->set_channels(constant_elem); return color_op; } case DataType::Vector: { SetVectorOperation *vector_op = new SetVectorOperation(); - vector_op->setVector(constant_elem); + vector_op->set_vector(constant_elem); return vector_op; } case DataType::Value: { SetValueOperation *value_op = new SetValueOperation(); - value_op->setValue(*constant_elem); + value_op->set_value(*constant_elem); return value_op; } default: { @@ -94,7 +94,7 @@ static ConstantOperation *create_constant_operation(DataType data_type, const fl ConstantOperation *ConstantFolder::fold_operation(NodeOperation *operation) { - const DataType data_type = operation->getOutputSocket()->getDataType(); + const DataType data_type = operation->get_output_socket()->get_data_type(); MemoryBuffer fold_buf(data_type, first_elem_area_); Vector<MemoryBuffer *> input_bufs = get_constant_input_buffers(operation); operation->init_data(); @@ -102,7 +102,8 @@ ConstantOperation *ConstantFolder::fold_operation(NodeOperation *operation) MemoryBuffer *constant_buf = create_constant_buffer(data_type); constant_buf->copy_from(&fold_buf, first_elem_area_); - ConstantOperation *constant_op = create_constant_operation(data_type, constant_buf->getBuffer()); + ConstantOperation *constant_op = create_constant_operation(data_type, + constant_buf->get_buffer()); operations_builder_.replace_operation_with_constant(operation, constant_op); constant_buffers_.add_new(constant_op, constant_buf); return constant_op; @@ -117,14 +118,15 @@ MemoryBuffer *ConstantFolder::create_constant_buffer(const DataType data_type) Vector<MemoryBuffer *> ConstantFolder::get_constant_input_buffers(NodeOperation *operation) { - const int num_inputs = operation->getNumberOfInputSockets(); + const int num_inputs = operation->get_number_of_input_sockets(); Vector<MemoryBuffer *> inputs_bufs(num_inputs); for (int i = 0; i < num_inputs; i++) { BLI_assert(operation->get_input_operation(i)->get_flags().is_constant_operation); ConstantOperation *constant_op = static_cast<ConstantOperation *>( operation->get_input_operation(i)); MemoryBuffer *constant_buf = constant_buffers_.lookup_or_add_cb(constant_op, [=] { - MemoryBuffer *buf = create_constant_buffer(constant_op->getOutputSocket()->getDataType()); + MemoryBuffer *buf = create_constant_buffer( + constant_op->get_output_socket()->get_data_type()); constant_op->render(buf, {first_elem_area_}, {}); return buf; }); @@ -186,8 +188,8 @@ void ConstantFolder::get_operation_output_operations(NodeOperation *operation, { const Vector<Link> &links = operations_builder_.get_links(); for (const Link &link : links) { - if (&link.from()->getOperation() == operation) { - r_outputs.append(&link.to()->getOperation()); + if (&link.from()->get_operation() == operation) { + r_outputs.append(&link.to()->get_operation()); } } } diff --git a/source/blender/compositor/intern/COM_Converter.cc b/source/blender/compositor/intern/COM_Converter.cc index 346c3c4b600..0af4ff7d98d 100644 --- a/source/blender/compositor/intern/COM_Converter.cc +++ b/source/blender/compositor/intern/COM_Converter.cc @@ -433,8 +433,8 @@ Node *COM_convert_bnode(bNode *b_node) /* TODO(jbakker): make this an std::optional<NodeOperation>. */ NodeOperation *COM_convert_data_type(const NodeOperationOutput &from, const NodeOperationInput &to) { - const DataType src_data_type = from.getDataType(); - const DataType dst_data_type = to.getDataType(); + const DataType src_data_type = from.get_data_type(); + const DataType dst_data_type = to.get_data_type(); if (src_data_type == DataType::Value && dst_data_type == DataType::Color) { return new ConvertValueToColorOperation(); @@ -459,24 +459,24 @@ NodeOperation *COM_convert_data_type(const NodeOperationOutput &from, const Node } void COM_convert_canvas(NodeOperationBuilder &builder, - NodeOperationOutput *fromSocket, - NodeOperationInput *toSocket) + NodeOperationOutput *from_socket, + NodeOperationInput *to_socket) { /* Data type conversions are executed before resolutions to ensure convert operations have * resolution. This method have to ensure same datatypes are linked for new operations. */ - BLI_assert(fromSocket->getDataType() == toSocket->getDataType()); + BLI_assert(from_socket->get_data_type() == to_socket->get_data_type()); - ResizeMode mode = toSocket->getResizeMode(); + ResizeMode mode = to_socket->get_resize_mode(); BLI_assert(mode != ResizeMode::None); - NodeOperation *toOperation = &toSocket->getOperation(); - const float toWidth = toOperation->getWidth(); - const float toHeight = toOperation->getHeight(); - NodeOperation *fromOperation = &fromSocket->getOperation(); - const float fromWidth = fromOperation->getWidth(); - const float fromHeight = fromOperation->getHeight(); - bool doCenter = false; - bool doScale = false; + NodeOperation *to_operation = &to_socket->get_operation(); + const float to_width = to_operation->get_width(); + const float to_height = to_operation->get_height(); + NodeOperation *from_operation = &from_socket->get_operation(); + const float from_width = from_operation->get_width(); + const float from_height = from_operation->get_height(); + bool do_center = false; + bool do_scale = false; float scaleX = 0; float scaleY = 0; @@ -485,23 +485,23 @@ void COM_convert_canvas(NodeOperationBuilder &builder, case ResizeMode::Align: break; case ResizeMode::Center: - doCenter = true; + do_center = true; break; case ResizeMode::FitWidth: - doCenter = true; - doScale = true; - scaleX = scaleY = toWidth / fromWidth; + do_center = true; + do_scale = true; + scaleX = scaleY = to_width / from_width; break; case ResizeMode::FitHeight: - doCenter = true; - doScale = true; - scaleX = scaleY = toHeight / fromHeight; + do_center = true; + do_scale = true; + scaleX = scaleY = to_height / from_height; break; case ResizeMode::FitAny: - doCenter = true; - doScale = true; - scaleX = toWidth / fromWidth; - scaleY = toHeight / fromHeight; + do_center = true; + do_scale = true; + scaleX = to_width / from_width; + scaleY = to_height / from_height; if (scaleX < scaleY) { scaleX = scaleY; } @@ -510,81 +510,82 @@ void COM_convert_canvas(NodeOperationBuilder &builder, } break; case ResizeMode::Stretch: - doCenter = true; - doScale = true; - scaleX = toWidth / fromWidth; - scaleY = toHeight / fromHeight; + do_center = true; + do_scale = true; + scaleX = to_width / from_width; + scaleY = to_height / from_height; break; } - float addX = doCenter ? (toWidth - fromWidth) / 2.0f : 0.0f; - float addY = doCenter ? (toHeight - fromHeight) / 2.0f : 0.0f; + float addX = do_center ? (to_width - from_width) / 2.0f : 0.0f; + float addY = do_center ? (to_height - from_height) / 2.0f : 0.0f; NodeOperation *first = nullptr; - ScaleOperation *scaleOperation = nullptr; - if (doScale) { - scaleOperation = new ScaleRelativeOperation(fromSocket->getDataType()); - scaleOperation->getInputSocket(1)->setResizeMode(ResizeMode::None); - scaleOperation->getInputSocket(2)->setResizeMode(ResizeMode::None); - first = scaleOperation; + ScaleOperation *scale_operation = nullptr; + if (do_scale) { + scale_operation = new ScaleRelativeOperation(from_socket->get_data_type()); + scale_operation->get_input_socket(1)->set_resize_mode(ResizeMode::None); + scale_operation->get_input_socket(2)->set_resize_mode(ResizeMode::None); + first = scale_operation; SetValueOperation *sxop = new SetValueOperation(); - sxop->setValue(scaleX); - builder.addLink(sxop->getOutputSocket(), scaleOperation->getInputSocket(1)); + sxop->set_value(scaleX); + builder.add_link(sxop->get_output_socket(), scale_operation->get_input_socket(1)); SetValueOperation *syop = new SetValueOperation(); - syop->setValue(scaleY); - builder.addLink(syop->getOutputSocket(), scaleOperation->getInputSocket(2)); - builder.addOperation(sxop); - builder.addOperation(syop); + syop->set_value(scaleY); + builder.add_link(syop->get_output_socket(), scale_operation->get_input_socket(2)); + builder.add_operation(sxop); + builder.add_operation(syop); - rcti scale_canvas = fromOperation->get_canvas(); + rcti scale_canvas = from_operation->get_canvas(); if (builder.context().get_execution_model() == eExecutionModel::FullFrame) { ScaleOperation::scale_area(scale_canvas, scaleX, scaleY); - scale_canvas.xmax = scale_canvas.xmin + toOperation->getWidth(); - scale_canvas.ymax = scale_canvas.ymin + toOperation->getHeight(); + scale_canvas.xmax = scale_canvas.xmin + to_operation->get_width(); + scale_canvas.ymax = scale_canvas.ymin + to_operation->get_height(); addX = 0; addY = 0; } - scaleOperation->set_canvas(scale_canvas); + scale_operation->set_canvas(scale_canvas); sxop->set_canvas(scale_canvas); syop->set_canvas(scale_canvas); - builder.addOperation(scaleOperation); + builder.add_operation(scale_operation); } - TranslateOperation *translateOperation = new TranslateOperation(toSocket->getDataType()); - translateOperation->getInputSocket(1)->setResizeMode(ResizeMode::None); - translateOperation->getInputSocket(2)->setResizeMode(ResizeMode::None); + TranslateOperation *translate_operation = new TranslateOperation(to_socket->get_data_type()); + translate_operation->get_input_socket(1)->set_resize_mode(ResizeMode::None); + translate_operation->get_input_socket(2)->set_resize_mode(ResizeMode::None); if (!first) { - first = translateOperation; + first = translate_operation; } SetValueOperation *xop = new SetValueOperation(); - xop->setValue(addX); - builder.addLink(xop->getOutputSocket(), translateOperation->getInputSocket(1)); + xop->set_value(addX); + builder.add_link(xop->get_output_socket(), translate_operation->get_input_socket(1)); SetValueOperation *yop = new SetValueOperation(); - yop->setValue(addY); - builder.addLink(yop->getOutputSocket(), translateOperation->getInputSocket(2)); - builder.addOperation(xop); - builder.addOperation(yop); + yop->set_value(addY); + builder.add_link(yop->get_output_socket(), translate_operation->get_input_socket(2)); + builder.add_operation(xop); + builder.add_operation(yop); - rcti translate_canvas = toOperation->get_canvas(); + rcti translate_canvas = to_operation->get_canvas(); if (mode == ResizeMode::Align) { - translate_canvas.xmax = translate_canvas.xmin + fromWidth; - translate_canvas.ymax = translate_canvas.ymin + fromHeight; + translate_canvas.xmax = translate_canvas.xmin + from_width; + translate_canvas.ymax = translate_canvas.ymin + from_height; } - translateOperation->set_canvas(translate_canvas); + translate_operation->set_canvas(translate_canvas); xop->set_canvas(translate_canvas); yop->set_canvas(translate_canvas); - builder.addOperation(translateOperation); + builder.add_operation(translate_operation); - if (doScale) { - translateOperation->getInputSocket(0)->setResizeMode(ResizeMode::None); - builder.addLink(scaleOperation->getOutputSocket(), translateOperation->getInputSocket(0)); + if (do_scale) { + translate_operation->get_input_socket(0)->set_resize_mode(ResizeMode::None); + builder.add_link(scale_operation->get_output_socket(), + translate_operation->get_input_socket(0)); } /* remove previous link and replace */ - builder.removeInputLink(toSocket); - first->getInputSocket(0)->setResizeMode(ResizeMode::None); - toSocket->setResizeMode(ResizeMode::None); - builder.addLink(fromSocket, first->getInputSocket(0)); - builder.addLink(translateOperation->getOutputSocket(), toSocket); + builder.remove_input_link(to_socket); + first->get_input_socket(0)->set_resize_mode(ResizeMode::None); + to_socket->set_resize_mode(ResizeMode::None); + builder.add_link(from_socket, first->get_input_socket(0)); + builder.add_link(translate_operation->get_output_socket(), to_socket); } } // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_Converter.h b/source/blender/compositor/intern/COM_Converter.h index 9cb6b1862b2..39bd44e8a9f 100644 --- a/source/blender/compositor/intern/COM_Converter.h +++ b/source/blender/compositor/intern/COM_Converter.h @@ -65,7 +65,7 @@ NodeOperation *COM_convert_data_type(const NodeOperationOutput &from, * \see InputSocketResizeMode for the possible conversions. */ void COM_convert_canvas(NodeOperationBuilder &builder, - NodeOperationOutput *fromSocket, - NodeOperationInput *toSocket); + NodeOperationOutput *from_socket, + NodeOperationInput *to_socket); } // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_Debug.cc b/source/blender/compositor/intern/COM_Debug.cc index 023db368ac9..50a69e55b2b 100644 --- a/source/blender/compositor/intern/COM_Debug.cc +++ b/source/blender/compositor/intern/COM_Debug.cc @@ -80,14 +80,14 @@ int DebugInfo::graphviz_operation(const ExecutionSystem *system, std::string fillcolor = "gainsboro"; if (operation->get_flags().is_viewer_operation) { const ViewerOperation *viewer = (const ViewerOperation *)operation; - if (viewer->isActiveViewerOutput()) { + if (viewer->is_active_viewer_output()) { fillcolor = "lightskyblue1"; } else { fillcolor = "lightskyblue3"; } } - else if (operation->isOutputOperation(system->getContext().isRendering())) { + else if (operation->is_output_operation(system->get_context().is_rendering())) { fillcolor = "dodgerblue1"; } else if (operation->get_flags().is_set_operation) { @@ -112,16 +112,16 @@ int DebugInfo::graphviz_operation(const ExecutionSystem *system, " [fillcolor=%s,style=filled,shape=record,label=\"{", fillcolor.c_str()); - int totinputs = operation->getNumberOfInputSockets(); + int totinputs = operation->get_number_of_input_sockets(); if (totinputs != 0) { len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "{"); for (int k = 0; k < totinputs; k++) { - NodeOperationInput *socket = operation->getInputSocket(k); + NodeOperationInput *socket = operation->get_input_socket(k); if (k != 0) { len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "|"); } len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "<IN_%p>", socket); - switch (socket->getDataType()) { + switch (socket->get_data_type()) { case DataType::Value: len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "Value"); break; @@ -156,20 +156,20 @@ int DebugInfo::graphviz_operation(const ExecutionSystem *system, operation->get_id(), operation->get_canvas().xmin, operation->get_canvas().ymin, - operation->getWidth(), - operation->getHeight()); + operation->get_width(), + operation->get_height()); - int totoutputs = operation->getNumberOfOutputSockets(); + int totoutputs = operation->get_number_of_output_sockets(); if (totoutputs != 0) { len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "|"); len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "{"); for (int k = 0; k < totoutputs; k++) { - NodeOperationOutput *socket = operation->getOutputSocket(k); + NodeOperationOutput *socket = operation->get_output_socket(k); if (k != 0) { len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "|"); } len += snprintf(str + len, maxlen > len ? maxlen - len : 0, "<OUT_%p>", socket); - switch (socket->getDataType()) { + switch (socket->get_data_type()) { case DataType::Value: { ConstantOperation *constant = operation->get_flags().is_constant_operation ? static_cast<ConstantOperation *>(operation) : @@ -346,7 +346,7 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma for (NodeOperation *operation : system->operations_) { if (operation->get_flags().is_read_buffer_operation) { ReadBufferOperation *read = (ReadBufferOperation *)operation; - WriteBufferOperation *write = read->getMemoryProxy()->getWriteBufferOperation(); + WriteBufferOperation *write = read->get_memory_proxy()->get_write_buffer_operation(); std::vector<std::string> &read_groups = op_groups[read]; std::vector<std::string> &write_groups = op_groups[write]; @@ -366,14 +366,14 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma for (NodeOperation *op : system->operations_) { for (NodeOperationInput &to : op->inputs_) { - NodeOperationOutput *from = to.getLink(); + NodeOperationOutput *from = to.get_link(); if (!from) { continue; } std::string color; - switch (from->getDataType()) { + switch (from->get_data_type()) { case DataType::Value: color = "gray"; break; @@ -385,8 +385,8 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma break; } - NodeOperation *to_op = &to.getOperation(); - NodeOperation *from_op = &from->getOperation(); + NodeOperation *to_op = &to.get_operation(); + NodeOperation *from_op = &from->get_operation(); std::vector<std::string> &from_groups = op_groups[from_op]; std::vector<std::string> &to_groups = op_groups[to_op]; @@ -416,7 +416,7 @@ bool DebugInfo::graphviz_system(const ExecutionSystem *system, char *str, int ma } } - const bool has_execution_groups = system->getContext().get_execution_model() == + const bool has_execution_groups = system->get_context().get_execution_model() == eExecutionModel::Tiled && system->groups_.size() > 0; len += graphviz_legend(str + len, maxlen > len ? maxlen - len : 0, has_execution_groups); @@ -460,8 +460,8 @@ static std::string get_operations_export_dir() void DebugInfo::export_operation(const NodeOperation *op, MemoryBuffer *render) { - const int width = render->getWidth(); - const int height = render->getHeight(); + const int width = render->get_width(); + const int height = render->get_height(); const int num_channels = render->get_num_channels(); ImBuf *ibuf = IMB_allocImBuf(width, height, 8 * num_channels, IB_rectfloat); diff --git a/source/blender/compositor/intern/COM_Debug.h b/source/blender/compositor/intern/COM_Debug.h index f1edd3ea15f..021d6e744fb 100644 --- a/source/blender/compositor/intern/COM_Debug.h +++ b/source/blender/compositor/intern/COM_Debug.h @@ -89,7 +89,7 @@ class DebugInfo { static void node_added(const Node *node) { if (COM_EXPORT_GRAPHVIZ) { - node_names_[node] = std::string(node->getbNode() ? node->getbNode()->name : ""); + node_names_[node] = std::string(node->get_bnode() ? node->get_bnode()->name : ""); } } diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cc b/source/blender/compositor/intern/COM_ExecutionGroup.cc index a38a1cd0a6c..d2198fc14e8 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.cc +++ b/source/blender/compositor/intern/COM_ExecutionGroup.cc @@ -64,22 +64,22 @@ ExecutionGroup::ExecutionGroup(int id) y_chunks_len_ = 0; chunks_len_ = 0; chunks_finished_ = 0; - BLI_rcti_init(&viewerBorder_, 0, 0, 0, 0); - executionStartTime_ = 0; + BLI_rcti_init(&viewer_border_, 0, 0, 0, 0); + execution_start_time_ = 0; } std::ostream &operator<<(std::ostream &os, const ExecutionGroup &execution_group) { os << "ExecutionGroup(id=" << execution_group.get_id(); os << ",flags={" << execution_group.get_flags() << "}"; - os << ",operation=" << *execution_group.getOutputOperation() << ""; + os << ",operation=" << *execution_group.get_output_operation() << ""; os << ")"; return os; } -eCompositorPriority ExecutionGroup::getRenderPriority() +eCompositorPriority ExecutionGroup::get_render_priority() { - return this->getOutputOperation()->getRenderPriority(); + return this->get_output_operation()->get_render_priority(); } bool ExecutionGroup::can_contain(NodeOperation &operation) @@ -111,7 +111,7 @@ bool ExecutionGroup::can_contain(NodeOperation &operation) return true; } -bool ExecutionGroup::addOperation(NodeOperation *operation) +bool ExecutionGroup::add_operation(NodeOperation *operation) { if (!can_contain(*operation)) { return false; @@ -130,7 +130,7 @@ bool ExecutionGroup::addOperation(NodeOperation *operation) return true; } -NodeOperation *ExecutionGroup::getOutputOperation() const +NodeOperation *ExecutionGroup::get_output_operation() const { return this ->operations_[0]; /* the first operation of the group is always the output operation. */ @@ -146,7 +146,7 @@ void ExecutionGroup::init_work_packages() work_packages_[index].state = eWorkPackageState::NotScheduled; work_packages_[index].execution_group = this; work_packages_[index].chunk_number = index; - determineChunkRect(&work_packages_[index].rect, index); + determine_chunk_rect(&work_packages_[index].rect, index); } } } @@ -156,23 +156,23 @@ void ExecutionGroup::init_read_buffer_operations() unsigned int max_offset = 0; for (NodeOperation *operation : operations_) { if (operation->get_flags().is_read_buffer_operation) { - ReadBufferOperation *readOperation = static_cast<ReadBufferOperation *>(operation); - read_operations_.append(readOperation); - max_offset = MAX2(max_offset, readOperation->getOffset()); + ReadBufferOperation *read_operation = static_cast<ReadBufferOperation *>(operation); + read_operations_.append(read_operation); + max_offset = MAX2(max_offset, read_operation->get_offset()); } } max_offset++; max_read_buffer_offset_ = max_offset; } -void ExecutionGroup::initExecution() +void ExecutionGroup::init_execution() { init_number_of_chunks(); init_work_packages(); init_read_buffer_operations(); } -void ExecutionGroup::deinitExecution() +void ExecutionGroup::deinit_execution() { work_packages_.clear(); chunks_len_ = 0; @@ -182,13 +182,13 @@ void ExecutionGroup::deinitExecution() bTree_ = nullptr; } -void ExecutionGroup::determineResolution(unsigned int resolution[2]) +void ExecutionGroup::determine_resolution(unsigned int resolution[2]) { - NodeOperation *operation = this->getOutputOperation(); - resolution[0] = operation->getWidth(); - resolution[1] = operation->getHeight(); - this->setResolution(resolution); - BLI_rcti_init(&viewerBorder_, 0, width_, 0, height_); + NodeOperation *operation = this->get_output_operation(); + resolution[0] = operation->get_width(); + resolution[1] = operation->get_height(); + this->set_resolution(resolution); + BLI_rcti_init(&viewer_border_, 0, width_, 0, height_); } void ExecutionGroup::init_number_of_chunks() @@ -199,11 +199,11 @@ void ExecutionGroup::init_number_of_chunks() chunks_len_ = 1; } else { - const float chunkSizef = chunkSize_; - const int border_width = BLI_rcti_size_x(&viewerBorder_); - const int border_height = BLI_rcti_size_y(&viewerBorder_); - x_chunks_len_ = ceil(border_width / chunkSizef); - y_chunks_len_ = ceil(border_height / chunkSizef); + const float chunk_sizef = chunk_size_; + const int border_width = BLI_rcti_size_x(&viewer_border_); + const int border_height = BLI_rcti_size_y(&viewer_border_); + x_chunks_len_ = ceil(border_width / chunk_sizef); + y_chunks_len_ = ceil(border_height / chunk_sizef); chunks_len_ = x_chunks_len_ * y_chunks_len_; } } @@ -215,7 +215,7 @@ blender::Array<unsigned int> ExecutionGroup::get_execution_order() const chunk_order[chunk_index] = chunk_index; } - NodeOperation *operation = this->getOutputOperation(); + NodeOperation *operation = this->get_output_operation(); float centerX = 0.5f; float centerY = 0.5f; ChunkOrdering order_type = ChunkOrdering::Default; @@ -224,11 +224,11 @@ blender::Array<unsigned int> ExecutionGroup::get_execution_order() const ViewerOperation *viewer = (ViewerOperation *)operation; centerX = viewer->getCenterX(); centerY = viewer->getCenterY(); - order_type = viewer->getChunkOrder(); + order_type = viewer->get_chunk_order(); } - const int border_width = BLI_rcti_size_x(&viewerBorder_); - const int border_height = BLI_rcti_size_y(&viewerBorder_); + const int border_width = BLI_rcti_size_x(&viewer_border_); + const int border_height = BLI_rcti_size_y(&viewer_border_); int index; switch (order_type) { case ChunkOrdering::Random: { @@ -245,8 +245,8 @@ blender::Array<unsigned int> ExecutionGroup::get_execution_order() const for (index = 0; index < chunks_len_; index++) { const WorkPackage &work_package = work_packages_[index]; chunk_orders[index].index = index; - chunk_orders[index].x = work_package.rect.xmin - viewerBorder_.xmin; - chunk_orders[index].y = work_package.rect.ymin - viewerBorder_.ymin; + chunk_orders[index].x = work_package.rect.xmin - viewer_border_.xmin; + chunk_orders[index].y = work_package.rect.ymin - viewer_border_.ymin; chunk_orders[index].update_distance(&hotspot, 1); } @@ -282,8 +282,8 @@ blender::Array<unsigned int> ExecutionGroup::get_execution_order() const for (index = 0; index < chunks_len_; index++) { const WorkPackage &work_package = work_packages_[index]; chunk_orders[index].index = index; - chunk_orders[index].x = work_package.rect.xmin - viewerBorder_.xmin; - chunk_orders[index].y = work_package.rect.ymin - viewerBorder_.ymin; + chunk_orders[index].x = work_package.rect.xmin - viewer_border_.xmin; + chunk_orders[index].y = work_package.rect.ymin - viewer_border_.ymin; chunk_orders[index].update_distance(hotspots, 9); } @@ -308,8 +308,8 @@ blender::Array<unsigned int> ExecutionGroup::get_execution_order() const */ void ExecutionGroup::execute(ExecutionSystem *graph) { - const CompositorContext &context = graph->getContext(); - const bNodeTree *bTree = context.getbNodeTree(); + const CompositorContext &context = graph->get_context(); + const bNodeTree *bTree = context.get_bnodetree(); if (width_ == 0 || height_ == 0) { return; } /** \note Break out... no pixels to calculate. */ @@ -321,7 +321,7 @@ void ExecutionGroup::execute(ExecutionSystem *graph) } /** \note Early break out. */ unsigned int chunk_index; - executionStartTime_ = PIL_check_seconds_timer(); + execution_start_time_ = PIL_check_seconds_timer(); chunks_finished_ = 0; bTree_ = bTree; @@ -333,26 +333,26 @@ void ExecutionGroup::execute(ExecutionSystem *graph) bool breaked = false; bool finished = false; - unsigned int startIndex = 0; - const int maxNumberEvaluated = BLI_system_thread_count() * 2; + unsigned int start_index = 0; + const int max_number_evaluated = BLI_system_thread_count() * 2; while (!finished && !breaked) { - bool startEvaluated = false; + bool start_evaluated = false; finished = true; - int numberEvaluated = 0; + int number_evaluated = 0; - for (int index = startIndex; index < chunks_len_ && numberEvaluated < maxNumberEvaluated; + for (int index = start_index; index < chunks_len_ && number_evaluated < max_number_evaluated; index++) { chunk_index = chunk_order[index]; - int yChunk = chunk_index / x_chunks_len_; - int xChunk = chunk_index - (yChunk * x_chunks_len_); + int y_chunk = chunk_index / x_chunks_len_; + int x_chunk = chunk_index - (y_chunk * x_chunks_len_); const WorkPackage &work_package = work_packages_[chunk_index]; switch (work_package.state) { case eWorkPackageState::NotScheduled: { - scheduleChunkWhenPossible(graph, xChunk, yChunk); + schedule_chunk_when_possible(graph, x_chunk, y_chunk); finished = false; - startEvaluated = true; - numberEvaluated++; + start_evaluated = true; + number_evaluated++; if (bTree->update_draw) { bTree->update_draw(bTree->udh); @@ -361,13 +361,13 @@ void ExecutionGroup::execute(ExecutionSystem *graph) } case eWorkPackageState::Scheduled: { finished = false; - startEvaluated = true; - numberEvaluated++; + start_evaluated = true; + number_evaluated++; break; } case eWorkPackageState::Executed: { - if (!startEvaluated) { - startIndex = index + 1; + if (!start_evaluated) { + start_index = index + 1; } } }; @@ -383,51 +383,51 @@ void ExecutionGroup::execute(ExecutionSystem *graph) DebugInfo::graphviz(graph); } -MemoryBuffer **ExecutionGroup::getInputBuffersOpenCL(int chunkNumber) +MemoryBuffer **ExecutionGroup::get_input_buffers_opencl(int chunk_number) { - WorkPackage &work_package = work_packages_[chunkNumber]; + WorkPackage &work_package = work_packages_[chunk_number]; - MemoryBuffer **memoryBuffers = (MemoryBuffer **)MEM_callocN( + MemoryBuffer **memory_buffers = (MemoryBuffer **)MEM_callocN( sizeof(MemoryBuffer *) * max_read_buffer_offset_, __func__); rcti output; - for (ReadBufferOperation *readOperation : read_operations_) { - MemoryProxy *memoryProxy = readOperation->getMemoryProxy(); - this->determineDependingAreaOfInterest(&work_package.rect, readOperation, &output); - MemoryBuffer *memoryBuffer = memoryProxy->getExecutor()->constructConsolidatedMemoryBuffer( - *memoryProxy, output); - memoryBuffers[readOperation->getOffset()] = memoryBuffer; - } - return memoryBuffers; + for (ReadBufferOperation *read_operation : read_operations_) { + MemoryProxy *memory_proxy = read_operation->get_memory_proxy(); + this->determine_depending_area_of_interest(&work_package.rect, read_operation, &output); + MemoryBuffer *memory_buffer = + memory_proxy->get_executor()->construct_consolidated_memory_buffer(*memory_proxy, output); + memory_buffers[read_operation->get_offset()] = memory_buffer; + } + return memory_buffers; } -MemoryBuffer *ExecutionGroup::constructConsolidatedMemoryBuffer(MemoryProxy &memoryProxy, - rcti &rect) +MemoryBuffer *ExecutionGroup::construct_consolidated_memory_buffer(MemoryProxy &memory_proxy, + rcti &rect) { - MemoryBuffer *imageBuffer = memoryProxy.getBuffer(); - MemoryBuffer *result = new MemoryBuffer(&memoryProxy, rect, MemoryBufferState::Temporary); - result->fill_from(*imageBuffer); + MemoryBuffer *image_buffer = memory_proxy.get_buffer(); + MemoryBuffer *result = new MemoryBuffer(&memory_proxy, rect, MemoryBufferState::Temporary); + result->fill_from(*image_buffer); return result; } -void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memoryBuffers) +void ExecutionGroup::finalize_chunk_execution(int chunk_number, MemoryBuffer **memory_buffers) { - WorkPackage &work_package = work_packages_[chunkNumber]; + WorkPackage &work_package = work_packages_[chunk_number]; if (work_package.state == eWorkPackageState::Scheduled) { work_package.state = eWorkPackageState::Executed; } atomic_add_and_fetch_u(&chunks_finished_, 1); - if (memoryBuffers) { + if (memory_buffers) { for (unsigned int index = 0; index < max_read_buffer_offset_; index++) { - MemoryBuffer *buffer = memoryBuffers[index]; + MemoryBuffer *buffer = memory_buffers[index]; if (buffer) { - if (buffer->isTemporarily()) { - memoryBuffers[index] = nullptr; + if (buffer->is_temporarily()) { + memory_buffers[index] = nullptr; delete buffer; } } } - MEM_freeN(memoryBuffers); + MEM_freeN(memory_buffers); } if (bTree_) { /* Status report is only performed for top level Execution Groups. */ @@ -442,67 +442,67 @@ void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memo } } -inline void ExecutionGroup::determineChunkRect(rcti *r_rect, - const unsigned int xChunk, - const unsigned int yChunk) const +inline void ExecutionGroup::determine_chunk_rect(rcti *r_rect, + const unsigned int x_chunk, + const unsigned int y_chunk) const { - const int border_width = BLI_rcti_size_x(&viewerBorder_); - const int border_height = BLI_rcti_size_y(&viewerBorder_); + const int border_width = BLI_rcti_size_x(&viewer_border_); + const int border_height = BLI_rcti_size_y(&viewer_border_); if (flags_.single_threaded) { - BLI_rcti_init(r_rect, viewerBorder_.xmin, border_width, viewerBorder_.ymin, border_height); + BLI_rcti_init(r_rect, viewer_border_.xmin, border_width, viewer_border_.ymin, border_height); } else { - const unsigned int minx = xChunk * chunkSize_ + viewerBorder_.xmin; - const unsigned int miny = yChunk * chunkSize_ + viewerBorder_.ymin; - const unsigned int width = MIN2((unsigned int)viewerBorder_.xmax, width_); - const unsigned int height = MIN2((unsigned int)viewerBorder_.ymax, height_); + const unsigned int minx = x_chunk * chunk_size_ + viewer_border_.xmin; + const unsigned int miny = y_chunk * chunk_size_ + viewer_border_.ymin; + const unsigned int width = MIN2((unsigned int)viewer_border_.xmax, width_); + const unsigned int height = MIN2((unsigned int)viewer_border_.ymax, height_); BLI_rcti_init(r_rect, MIN2(minx, width_), - MIN2(minx + chunkSize_, width), + MIN2(minx + chunk_size_, width), MIN2(miny, height_), - MIN2(miny + chunkSize_, height)); + MIN2(miny + chunk_size_, height)); } } -void ExecutionGroup::determineChunkRect(rcti *r_rect, const unsigned int chunkNumber) const +void ExecutionGroup::determine_chunk_rect(rcti *r_rect, const unsigned int chunk_number) const { - const unsigned int yChunk = chunkNumber / x_chunks_len_; - const unsigned int xChunk = chunkNumber - (yChunk * x_chunks_len_); - determineChunkRect(r_rect, xChunk, yChunk); + const unsigned int y_chunk = chunk_number / x_chunks_len_; + const unsigned int x_chunk = chunk_number - (y_chunk * x_chunks_len_); + determine_chunk_rect(r_rect, x_chunk, y_chunk); } -MemoryBuffer *ExecutionGroup::allocateOutputBuffer(rcti &rect) +MemoryBuffer *ExecutionGroup::allocate_output_buffer(rcti &rect) { /* We assume that this method is only called from complex execution groups. */ - NodeOperation *operation = this->getOutputOperation(); + NodeOperation *operation = this->get_output_operation(); if (operation->get_flags().is_write_buffer_operation) { - WriteBufferOperation *writeOperation = (WriteBufferOperation *)operation; + WriteBufferOperation *write_operation = (WriteBufferOperation *)operation; MemoryBuffer *buffer = new MemoryBuffer( - writeOperation->getMemoryProxy(), rect, MemoryBufferState::Temporary); + write_operation->get_memory_proxy(), rect, MemoryBufferState::Temporary); return buffer; } return nullptr; } -bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem *graph, rcti *area) +bool ExecutionGroup::schedule_area_when_possible(ExecutionSystem *graph, rcti *area) { if (flags_.single_threaded) { - return scheduleChunkWhenPossible(graph, 0, 0); + return schedule_chunk_when_possible(graph, 0, 0); } /* Find all chunks inside the rect * determine `minxchunk`, `minychunk`, `maxxchunk`, `maxychunk` * where x and y are chunk-numbers. */ int indexx, indexy; - int minx = max_ii(area->xmin - viewerBorder_.xmin, 0); - int maxx = min_ii(area->xmax - viewerBorder_.xmin, viewerBorder_.xmax - viewerBorder_.xmin); - int miny = max_ii(area->ymin - viewerBorder_.ymin, 0); - int maxy = min_ii(area->ymax - viewerBorder_.ymin, viewerBorder_.ymax - viewerBorder_.ymin); - int minxchunk = minx / (int)chunkSize_; - int maxxchunk = (maxx + (int)chunkSize_ - 1) / (int)chunkSize_; - int minychunk = miny / (int)chunkSize_; - int maxychunk = (maxy + (int)chunkSize_ - 1) / (int)chunkSize_; + int minx = max_ii(area->xmin - viewer_border_.xmin, 0); + int maxx = min_ii(area->xmax - viewer_border_.xmin, viewer_border_.xmax - viewer_border_.xmin); + int miny = max_ii(area->ymin - viewer_border_.ymin, 0); + int maxy = min_ii(area->ymax - viewer_border_.ymin, viewer_border_.ymax - viewer_border_.ymin); + int minxchunk = minx / (int)chunk_size_; + int maxxchunk = (maxx + (int)chunk_size_ - 1) / (int)chunk_size_; + int minychunk = miny / (int)chunk_size_; + int maxychunk = (maxy + (int)chunk_size_ - 1) / (int)chunk_size_; minxchunk = max_ii(minxchunk, 0); minychunk = max_ii(minychunk, 0); maxxchunk = min_ii(maxxchunk, (int)x_chunks_len_); @@ -511,7 +511,7 @@ bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem *graph, rcti *area bool result = true; for (indexx = minxchunk; indexx < maxxchunk; indexx++) { for (indexy = minychunk; indexy < maxychunk; indexy++) { - if (!scheduleChunkWhenPossible(graph, indexx, indexy)) { + if (!schedule_chunk_when_possible(graph, indexx, indexy)) { result = false; } } @@ -520,9 +520,9 @@ bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem *graph, rcti *area return result; } -bool ExecutionGroup::scheduleChunk(unsigned int chunkNumber) +bool ExecutionGroup::schedule_chunk(unsigned int chunk_number) { - WorkPackage &work_package = work_packages_[chunkNumber]; + WorkPackage &work_package = work_packages_[chunk_number]; if (work_package.state == eWorkPackageState::NotScheduled) { work_package.state = eWorkPackageState::Scheduled; WorkScheduler::schedule(&work_package); @@ -531,9 +531,9 @@ bool ExecutionGroup::scheduleChunk(unsigned int chunkNumber) return false; } -bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem *graph, - const int chunk_x, - const int chunk_y) +bool ExecutionGroup::schedule_chunk_when_possible(ExecutionSystem *graph, + const int chunk_x, + const int chunk_y) { if (chunk_x < 0 || chunk_x >= (int)x_chunks_len_) { return true; @@ -557,42 +557,43 @@ bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem *graph, for (ReadBufferOperation *read_operation : read_operations_) { BLI_rcti_init(&area, 0, 0, 0, 0); - MemoryProxy *memory_proxy = read_operation->getMemoryProxy(); - determineDependingAreaOfInterest(&work_package.rect, read_operation, &area); - ExecutionGroup *group = memory_proxy->getExecutor(); + MemoryProxy *memory_proxy = read_operation->get_memory_proxy(); + determine_depending_area_of_interest(&work_package.rect, read_operation, &area); + ExecutionGroup *group = memory_proxy->get_executor(); - if (!group->scheduleAreaWhenPossible(graph, &area)) { + if (!group->schedule_area_when_possible(graph, &area)) { can_be_executed = false; } } if (can_be_executed) { - scheduleChunk(chunk_index); + schedule_chunk(chunk_index); } return false; } -void ExecutionGroup::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +void ExecutionGroup::determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) { - this->getOutputOperation()->determineDependingAreaOfInterest(input, readOperation, output); + this->get_output_operation()->determine_depending_area_of_interest( + input, read_operation, output); } -void ExecutionGroup::setViewerBorder(float xmin, float xmax, float ymin, float ymax) +void ExecutionGroup::set_viewer_border(float xmin, float xmax, float ymin, float ymax) { - const NodeOperation &operation = *this->getOutputOperation(); + const NodeOperation &operation = *this->get_output_operation(); if (operation.get_flags().use_viewer_border) { - BLI_rcti_init(&viewerBorder_, xmin * width_, xmax * width_, ymin * height_, ymax * height_); + BLI_rcti_init(&viewer_border_, xmin * width_, xmax * width_, ymin * height_, ymax * height_); } } -void ExecutionGroup::setRenderBorder(float xmin, float xmax, float ymin, float ymax) +void ExecutionGroup::set_render_border(float xmin, float xmax, float ymin, float ymax) { - const NodeOperation &operation = *this->getOutputOperation(); - if (operation.isOutputOperation(true) && operation.get_flags().use_render_border) { - BLI_rcti_init(&viewerBorder_, xmin * width_, xmax * width_, ymin * height_, ymax * height_); + const NodeOperation &operation = *this->get_output_operation(); + if (operation.is_output_operation(true) && operation.get_flags().use_render_border) { + BLI_rcti_init(&viewer_border_, xmin * width_, xmax * width_, ymin * height_, ymax * height_); } } diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.h b/source/blender/compositor/intern/COM_ExecutionGroup.h index c0737b2bc02..6d1520f9c24 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.h +++ b/source/blender/compositor/intern/COM_ExecutionGroup.h @@ -109,7 +109,7 @@ class ExecutionGroup { * \brief size of a single chunk, being Width or of height * a chunk is always a square, except at the edges of the MemoryBuffer */ - unsigned int chunkSize_; + unsigned int chunk_size_; /** * \brief number of chunks in the x-axis @@ -158,12 +158,12 @@ class ExecutionGroup { * \brief denotes boundary for border compositing * \note measured in pixel space */ - rcti viewerBorder_; + rcti viewer_border_; /** * \brief start time of execution */ - double executionStartTime_; + double execution_start_time_; // methods /** @@ -175,13 +175,14 @@ class ExecutionGroup { /** * \brief Determine the rect (minx, maxx, miny, maxy) of a chunk at a position. */ - void determineChunkRect(rcti *r_rect, - const unsigned int xChunk, - const unsigned int yChunk) const; + void determine_chunk_rect(rcti *r_rect, + const unsigned int x_chunk, + const unsigned int y_chunk) const; /** - * \brief determine the number of chunks, based on the chunkSize, width and height. - * \note The result are stored in the fields numberOfChunks, numberOfXChunks, numberOfYChunks + * \brief determine the number of chunks, based on the chunk_size, width and height. + * \note The result are stored in the fields number_of_chunks, number_of_xchunks, + * number_of_ychunks */ void init_number_of_chunks(); @@ -190,13 +191,13 @@ class ExecutionGroup { * \note scheduling succeeds when all input requirements are met and the chunks hasn't been * scheduled yet. * \param graph: - * \param xChunk: - * \param yChunk: + * \param x_chunk: + * \param y_chunk: * \return [true:false] * true: package(s) are scheduled * false: scheduling is deferred (depending workpackages are scheduled) */ - bool scheduleChunkWhenPossible(ExecutionSystem *graph, const int chunk_x, const int chunk_y); + bool schedule_chunk_when_possible(ExecutionSystem *graph, const int chunk_x, const int chunk_y); /** * \brief try to schedule a specific area. @@ -208,24 +209,24 @@ class ExecutionGroup { * true: package(s) are scheduled * false: scheduling is deferred (depending workpackages are scheduled) */ - bool scheduleAreaWhenPossible(ExecutionSystem *graph, rcti *area); + bool schedule_area_when_possible(ExecutionSystem *graph, rcti *area); /** * \brief add a chunk to the WorkScheduler. * \param chunknumber: */ - bool scheduleChunk(unsigned int chunkNumber); + bool schedule_chunk(unsigned int chunk_number); /** * \brief determine the area of interest of a certain input area * \note This method only evaluates a single ReadBufferOperation * \param input: the input area - * \param readOperation: The ReadBufferOperation where the area needs to be evaluated + * \param read_operation: The ReadBufferOperation where the area needs to be evaluated * \param output: the area needed of the ReadBufferOperation. Result */ - void determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output); + void determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output); /** * Return the execution order of the user visible chunks. @@ -258,13 +259,13 @@ class ExecutionGroup { * \param operation: * \return True if the operation was successfully added */ - bool addOperation(NodeOperation *operation); + bool add_operation(NodeOperation *operation); /** * \brief set whether this ExecutionGroup is an output - * \param isOutput: + * \param is_output: */ - void setOutputExecutionGroup(bool is_output) + void set_output_execution_group(bool is_output) { flags_.is_output = is_output; } @@ -273,13 +274,13 @@ class ExecutionGroup { * \brief determine the resolution of this ExecutionGroup * \param resolution: */ - void determineResolution(unsigned int resolution[2]); + void determine_resolution(unsigned int resolution[2]); /** * \brief set the resolution of this executiongroup * \param resolution: */ - void setResolution(unsigned int resolution[2]) + void set_resolution(unsigned int resolution[2]) { width_ = resolution[0]; height_ = resolution[1]; @@ -288,7 +289,7 @@ class ExecutionGroup { /** * \brief get the width of this execution group */ - unsigned int getWidth() const + unsigned int get_width() const { return width_; } @@ -296,7 +297,7 @@ class ExecutionGroup { /** * \brief get the height of this execution group */ - unsigned int getHeight() const + unsigned int get_height() const { return height_; } @@ -305,24 +306,24 @@ class ExecutionGroup { * \brief get the output operation of this ExecutionGroup * \return NodeOperation *output operation */ - NodeOperation *getOutputOperation() const; + NodeOperation *get_output_operation() const; /** * \brief compose multiple chunks into a single chunk * \return Memorybuffer *consolidated chunk */ - MemoryBuffer *constructConsolidatedMemoryBuffer(MemoryProxy &memoryProxy, rcti &rect); + MemoryBuffer *construct_consolidated_memory_buffer(MemoryProxy &memory_proxy, rcti &rect); /** - * \brief initExecution is called just before the execution of the whole graph will be done. - * \note The implementation will calculate the chunkSize of this execution group. + * \brief init_execution is called just before the execution of the whole graph will be done. + * \note The implementation will calculate the chunk_size of this execution group. */ - void initExecution(); + void init_execution(); /** * \brief get all inputbuffers needed to calculate an chunk * \note all inputbuffers must be executed - * \param chunkNumber: the chunk to be calculated + * \param chunk_number: the chunk to be calculated * \return (MemoryBuffer **) the inputbuffers */ MemoryBuffer **getInputBuffersCPU(); @@ -330,31 +331,31 @@ class ExecutionGroup { /** * \brief get all inputbuffers needed to calculate an chunk * \note all inputbuffers must be executed - * \param chunkNumber: the chunk to be calculated + * \param chunk_number: the chunk to be calculated * \return (MemoryBuffer **) the inputbuffers */ - MemoryBuffer **getInputBuffersOpenCL(int chunkNumber); + MemoryBuffer **get_input_buffers_opencl(int chunk_number); /** * \brief allocate the outputbuffer of a chunk - * \param chunkNumber: the number of the chunk in the ExecutionGroup + * \param chunk_number: the number of the chunk in the ExecutionGroup * \param rect: the rect of that chunk - * \see determineChunkRect + * \see determine_chunk_rect */ - MemoryBuffer *allocateOutputBuffer(rcti &rect); + MemoryBuffer *allocate_output_buffer(rcti &rect); /** * \brief after a chunk is executed the needed resources can be freed or unlocked. * \param chunknumber: * \param memorybuffers: */ - void finalizeChunkExecution(int chunkNumber, MemoryBuffer **memoryBuffers); + void finalize_chunk_execution(int chunk_number, MemoryBuffer **memory_buffers); /** - * \brief deinitExecution is called just after execution the whole graph. + * \brief deinit_execution is called just after execution the whole graph. * \note It will release all needed resources */ - void deinitExecution(); + void deinit_execution(); /** * \brief schedule an ExecutionGroup @@ -377,26 +378,26 @@ class ExecutionGroup { /** * \brief Determine the rect (minx, maxx, miny, maxy) of a chunk. */ - void determineChunkRect(rcti *r_rect, const unsigned int chunkNumber) const; + void determine_chunk_rect(rcti *r_rect, const unsigned int chunk_number) const; - void setChunksize(int chunksize) + void set_chunksize(int chunksize) { - chunkSize_ = chunksize; + chunk_size_ = chunksize; } /** * \brief get the Render priority of this ExecutionGroup * \see ExecutionSystem.execute */ - eCompositorPriority getRenderPriority(); + eCompositorPriority get_render_priority(); /** * \brief set border for viewer operation * \note all the coordinates are assumed to be in normalized space */ - void setViewerBorder(float xmin, float xmax, float ymin, float ymax); + void set_viewer_border(float xmin, float xmax, float ymin, float ymax); - void setRenderBorder(float xmin, float xmax, float ymin, float ymax); + void set_render_border(float xmin, float xmax, float ymin, float ymax); /* allow the DebugInfo class to look at internals */ friend class DebugInfo; diff --git a/source/blender/compositor/intern/COM_ExecutionModel.cc b/source/blender/compositor/intern/COM_ExecutionModel.cc index 0ac99152c9f..b319aaa4b21 100644 --- a/source/blender/compositor/intern/COM_ExecutionModel.cc +++ b/source/blender/compositor/intern/COM_ExecutionModel.cc @@ -24,7 +24,7 @@ namespace blender::compositor { ExecutionModel::ExecutionModel(CompositorContext &context, Span<NodeOperation *> operations) : context_(context), operations_(operations) { - const bNodeTree *node_tree = context_.getbNodeTree(); + const bNodeTree *node_tree = context_.get_bnodetree(); const rctf *viewer_border = &node_tree->viewer_border; border_.use_viewer_border = (node_tree->flag & NTREE_VIEWER_BORDER) && @@ -32,10 +32,10 @@ ExecutionModel::ExecutionModel(CompositorContext &context, Span<NodeOperation *> viewer_border->ymin < viewer_border->ymax; border_.viewer_border = viewer_border; - const RenderData *rd = context_.getRenderData(); + const RenderData *rd = context_.get_render_data(); /* Case when cropping to render border happens is handled in * compositor output and render layer nodes. */ - border_.use_render_border = context.isRendering() && (rd->mode & R_BORDER) && + border_.use_render_border = context.is_rendering() && (rd->mode & R_BORDER) && !(rd->mode & R_CROP); border_.render_border = &rd->border; } diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cc b/source/blender/compositor/intern/COM_ExecutionSystem.cc index 880383853d6..82821a1ddb1 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystem.cc +++ b/source/blender/compositor/intern/COM_ExecutionSystem.cc @@ -38,37 +38,37 @@ ExecutionSystem::ExecutionSystem(RenderData *rd, bNodeTree *editingtree, bool rendering, bool fastcalculation, - const ColorManagedViewSettings *viewSettings, - const ColorManagedDisplaySettings *displaySettings, - const char *viewName) + const ColorManagedViewSettings *view_settings, + const ColorManagedDisplaySettings *display_settings, + const char *view_name) { num_work_threads_ = WorkScheduler::get_num_cpu_threads(); - context_.setViewName(viewName); - context_.setScene(scene); - context_.setbNodeTree(editingtree); - context_.setPreviewHash(editingtree->previews); - context_.setFastCalculation(fastcalculation); + context_.set_view_name(view_name); + context_.set_scene(scene); + context_.set_bnodetree(editingtree); + context_.set_preview_hash(editingtree->previews); + context_.set_fast_calculation(fastcalculation); /* initialize the CompositorContext */ if (rendering) { - context_.setQuality((eCompositorQuality)editingtree->render_quality); + context_.set_quality((eCompositorQuality)editingtree->render_quality); } else { - context_.setQuality((eCompositorQuality)editingtree->edit_quality); + context_.set_quality((eCompositorQuality)editingtree->edit_quality); } - context_.setRendering(rendering); + context_.set_rendering(rendering); context_.setHasActiveOpenCLDevices(WorkScheduler::has_gpu_devices() && (editingtree->flag & NTREE_COM_OPENCL)); - context_.setRenderData(rd); - context_.setViewSettings(viewSettings); - context_.setDisplaySettings(displaySettings); + context_.set_render_data(rd); + context_.set_view_settings(view_settings); + context_.set_display_settings(display_settings); BLI_mutex_init(&work_mutex_); BLI_condition_init(&work_finished_cond_); { NodeOperationBuilder builder(&context_, editingtree, this); - builder.convertToOperations(this); + builder.convert_to_operations(this); } switch (context_.get_execution_model()) { @@ -184,7 +184,7 @@ void ExecutionSystem::execute_work(const rcti &work_rect, bool ExecutionSystem::is_breaked() const { - const bNodeTree *btree = context_.getbNodeTree(); + const bNodeTree *btree = context_.get_bnodetree(); return btree->test_break(btree->tbh); } diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.h b/source/blender/compositor/intern/COM_ExecutionSystem.h index 4a6a0f1bad8..4a3fecaca47 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystem.h +++ b/source/blender/compositor/intern/COM_ExecutionSystem.h @@ -64,8 +64,8 @@ namespace blender::compositor { * based on settings; like MixNode. based on the selected Mixtype a different operation will be * used. for more information see the page about creating new Nodes. [@subpage newnode] * - * \see ExecutionSystem.convertToOperations - * \see Node.convertToOperations + * \see ExecutionSystem.convert_to_operations + * \see Node.convert_to_operations * \see NodeOperation base class for all operations in the system * * \section EM_Step3 Step3: add additional conversions to the operation system @@ -89,7 +89,7 @@ namespace blender::compositor { * Bottom left of the images are aligned. * * \see COM_convert_data_type Datatype conversions - * \see Converter.convertResolution Image size conversions + * \see Converter.convert_resolution Image size conversions * * \section EM_Step4 Step4: group operations in executions groups * ExecutionGroup are groups of operations that are calculated as being one bigger operation. @@ -112,9 +112,9 @@ namespace blender::compositor { * |cFAA | |cFAA | |cFAA | |cFAA | * +------+ +------+ +-------+ +-------+ * </pre> - * \see ExecutionSystem.groupOperations method doing this step - * \see ExecutionSystem.addReadWriteBufferOperations - * \see NodeOperation.isComplex + * \see ExecutionSystem.group_operations method doing this step + * \see ExecutionSystem.add_read_write_buffer_operations + * \see NodeOperation.is_complex * \see ExecutionGroup class representing the ExecutionGroup */ @@ -175,9 +175,9 @@ class ExecutionSystem { bNodeTree *editingtree, bool rendering, bool fastcalculation, - const ColorManagedViewSettings *viewSettings, - const ColorManagedDisplaySettings *displaySettings, - const char *viewName); + const ColorManagedViewSettings *view_settings, + const ColorManagedDisplaySettings *display_settings, + const char *view_name); /** * Destructor @@ -198,7 +198,7 @@ class ExecutionSystem { /** * \brief get the reference to the compositor context */ - const CompositorContext &getContext() const + const CompositorContext &get_context() const { return context_; } diff --git a/source/blender/compositor/intern/COM_FullFrameExecutionModel.cc b/source/blender/compositor/intern/COM_FullFrameExecutionModel.cc index ce00fff5858..80c10aec00a 100644 --- a/source/blender/compositor/intern/COM_FullFrameExecutionModel.cc +++ b/source/blender/compositor/intern/COM_FullFrameExecutionModel.cc @@ -38,7 +38,7 @@ FullFrameExecutionModel::FullFrameExecutionModel(CompositorContext &context, num_operations_finished_(0) { priorities_.append(eCompositorPriority::High); - if (!context.isFastCalculation()) { + if (!context.is_fast_calculation()) { priorities_.append(eCompositorPriority::Medium); priorities_.append(eCompositorPriority::Low); } @@ -46,7 +46,7 @@ FullFrameExecutionModel::FullFrameExecutionModel(CompositorContext &context, void FullFrameExecutionModel::execute(ExecutionSystem &exec_system) { - const bNodeTree *node_tree = this->context_.getbNodeTree(); + const bNodeTree *node_tree = this->context_.get_bnodetree(); node_tree->stats_draw(node_tree->sdh, TIP_("Compositing | Initializing execution")); DebugInfo::graphviz(&exec_system, "compositor_prior_rendering"); @@ -57,14 +57,14 @@ void FullFrameExecutionModel::execute(ExecutionSystem &exec_system) void FullFrameExecutionModel::determine_areas_to_render_and_reads() { - const bool is_rendering = context_.isRendering(); - const bNodeTree *node_tree = context_.getbNodeTree(); + const bool is_rendering = context_.is_rendering(); + const bNodeTree *node_tree = context_.get_bnodetree(); rcti area; for (eCompositorPriority priority : priorities_) { for (NodeOperation *op : operations_) { - op->setbNodeTree(node_tree); - if (op->isOutputOperation(is_rendering) && op->getRenderPriority() == priority) { + op->set_bnodetree(node_tree); + if (op->is_output_operation(is_rendering) && op->get_render_priority() == priority) { get_output_render_area(op, area); determine_areas_to_render(op, area); determine_reads(op); @@ -81,7 +81,7 @@ Vector<MemoryBuffer *> FullFrameExecutionModel::get_input_buffers(NodeOperation const int output_x, const int output_y) { - const int num_inputs = op->getNumberOfInputSockets(); + const int num_inputs = op->get_number_of_input_sockets(); Vector<MemoryBuffer *> inputs_buffers(num_inputs); for (int i = 0; i < num_inputs; i++) { NodeOperation *input = op->get_input_operation(i); @@ -92,7 +92,7 @@ Vector<MemoryBuffer *> FullFrameExecutionModel::get_input_buffers(NodeOperation rcti rect = buf->get_rect(); BLI_rcti_translate(&rect, offset_x, offset_y); inputs_buffers[i] = new MemoryBuffer( - buf->getBuffer(), buf->get_num_channels(), rect, buf->is_a_single_elem()); + buf->get_buffer(), buf->get_num_channels(), rect, buf->is_a_single_elem()); } return inputs_buffers; } @@ -102,9 +102,10 @@ MemoryBuffer *FullFrameExecutionModel::create_operation_buffer(NodeOperation *op const int output_y) { rcti rect; - BLI_rcti_init(&rect, output_x, output_x + op->getWidth(), output_y, output_y + op->getHeight()); + BLI_rcti_init( + &rect, output_x, output_x + op->get_width(), output_y, output_y + op->get_height()); - const DataType data_type = op->getOutputSocket(0)->getDataType(); + const DataType data_type = op->get_output_socket(0)->get_data_type(); const bool is_a_single_elem = op->get_flags().is_constant_operation; return new MemoryBuffer(data_type, rect, is_a_single_elem); } @@ -115,9 +116,9 @@ void FullFrameExecutionModel::render_operation(NodeOperation *op) constexpr int output_x = 0; constexpr int output_y = 0; - const bool has_outputs = op->getNumberOfOutputSockets() > 0; + const bool has_outputs = op->get_number_of_output_sockets() > 0; MemoryBuffer *op_buf = has_outputs ? create_operation_buffer(op, output_x, output_y) : nullptr; - if (op->getWidth() > 0 && op->getHeight() > 0) { + if (op->get_width() > 0 && op->get_height() > 0) { Vector<MemoryBuffer *> input_bufs = get_input_buffers(op, output_x, output_y); const int op_offset_x = output_x - op->get_canvas().xmin; const int op_offset_y = output_y - op->get_canvas().ymin; @@ -141,19 +142,19 @@ void FullFrameExecutionModel::render_operation(NodeOperation *op) */ void FullFrameExecutionModel::render_operations() { - const bool is_rendering = context_.isRendering(); + const bool is_rendering = context_.is_rendering(); WorkScheduler::start(this->context_); for (eCompositorPriority priority : priorities_) { for (NodeOperation *op : operations_) { - const bool has_size = op->getWidth() > 0 && op->getHeight() > 0; - const bool is_priority_output = op->isOutputOperation(is_rendering) && - op->getRenderPriority() == priority; + const bool has_size = op->get_width() > 0 && op->get_height() > 0; + const bool is_priority_output = op->is_output_operation(is_rendering) && + op->get_render_priority() == priority; if (is_priority_output && has_size) { render_output_dependencies(op); render_operation(op); } - else if (is_priority_output && !has_size && op->isActiveViewerOutput()) { + else if (is_priority_output && !has_size && op->is_active_viewer_output()) { static_cast<ViewerOperation *>(op)->clear_display_buffer(); } } @@ -175,7 +176,7 @@ static Vector<NodeOperation *> get_operation_dependencies(NodeOperation *operati Vector<NodeOperation *> outputs(next_outputs); next_outputs.clear(); for (NodeOperation *output : outputs) { - for (int i = 0; i < output->getNumberOfInputSockets(); i++) { + for (int i = 0; i < output->get_number_of_input_sockets(); i++) { next_outputs.append(output->get_input_operation(i)); } } @@ -190,7 +191,7 @@ static Vector<NodeOperation *> get_operation_dependencies(NodeOperation *operati void FullFrameExecutionModel::render_output_dependencies(NodeOperation *output_op) { - BLI_assert(output_op->isOutputOperation(context_.isRendering())); + BLI_assert(output_op->is_output_operation(context_.is_rendering())); Vector<NodeOperation *> dependencies = get_operation_dependencies(output_op); for (NodeOperation *op : dependencies) { if (!active_buffers_.is_operation_rendered(op)) { @@ -205,7 +206,7 @@ void FullFrameExecutionModel::render_output_dependencies(NodeOperation *output_o void FullFrameExecutionModel::determine_areas_to_render(NodeOperation *output_op, const rcti &output_area) { - BLI_assert(output_op->isOutputOperation(context_.isRendering())); + BLI_assert(output_op->is_output_operation(context_.is_rendering())); Vector<std::pair<NodeOperation *, const rcti>> stack; stack.append({output_op, output_area}); @@ -220,7 +221,7 @@ void FullFrameExecutionModel::determine_areas_to_render(NodeOperation *output_op active_buffers_.register_area(operation, render_area); - const int num_inputs = operation->getNumberOfInputSockets(); + const int num_inputs = operation->get_number_of_input_sockets(); for (int i = 0; i < num_inputs; i++) { NodeOperation *input_op = operation->get_input_operation(i); rcti input_area; @@ -240,13 +241,13 @@ void FullFrameExecutionModel::determine_areas_to_render(NodeOperation *output_op */ void FullFrameExecutionModel::determine_reads(NodeOperation *output_op) { - BLI_assert(output_op->isOutputOperation(context_.isRendering())); + BLI_assert(output_op->is_output_operation(context_.is_rendering())); Vector<NodeOperation *> stack; stack.append(output_op); while (stack.size() > 0) { NodeOperation *operation = stack.pop_last(); - const int num_inputs = operation->getNumberOfInputSockets(); + const int num_inputs = operation->get_number_of_input_sockets(); for (int i = 0; i < num_inputs; i++) { NodeOperation *input_op = operation->get_input_operation(i); if (!active_buffers_.has_registered_reads(input_op)) { @@ -263,7 +264,7 @@ void FullFrameExecutionModel::determine_reads(NodeOperation *output_op) */ void FullFrameExecutionModel::get_output_render_area(NodeOperation *output_op, rcti &r_area) { - BLI_assert(output_op->isOutputOperation(context_.isRendering())); + BLI_assert(output_op->is_output_operation(context_.is_rendering())); /* By default return operation bounds (no border). */ rcti canvas = output_op->get_canvas(); @@ -278,8 +279,8 @@ void FullFrameExecutionModel::get_output_render_area(NodeOperation *output_op, r const rctf *norm_border = has_viewer_border ? border_.viewer_border : border_.render_border; /* Return de-normalized border within canvas. */ - const int w = output_op->getWidth(); - const int h = output_op->getHeight(); + const int w = output_op->get_width(); + const int h = output_op->get_height(); r_area.xmin = canvas.xmin + norm_border->xmin * w; r_area.xmax = canvas.xmin + norm_border->xmax * w; r_area.ymin = canvas.ymin + norm_border->ymin * h; @@ -290,7 +291,7 @@ void FullFrameExecutionModel::get_output_render_area(NodeOperation *output_op, r void FullFrameExecutionModel::operation_finished(NodeOperation *operation) { /* Report inputs reads so that buffers may be freed/reused. */ - const int num_inputs = operation->getNumberOfInputSockets(); + const int num_inputs = operation->get_number_of_input_sockets(); for (int i = 0; i < num_inputs; i++) { active_buffers_.read_finished(operation->get_input_operation(i)); } @@ -301,7 +302,7 @@ void FullFrameExecutionModel::operation_finished(NodeOperation *operation) void FullFrameExecutionModel::update_progress_bar() { - const bNodeTree *tree = context_.getbNodeTree(); + const bNodeTree *tree = context_.get_bnodetree(); if (tree) { const float progress = num_operations_finished_ / static_cast<float>(operations_.size()); tree->progress(tree->prh, progress); diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cc b/source/blender/compositor/intern/COM_MemoryBuffer.cc index 3aefe8a3e2f..96888ea1c96 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.cc +++ b/source/blender/compositor/intern/COM_MemoryBuffer.cc @@ -44,32 +44,32 @@ static rcti create_rect(const int width, const int height) return rect; } -MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, const rcti &rect, MemoryBufferState state) +MemoryBuffer::MemoryBuffer(MemoryProxy *memory_proxy, const rcti &rect, MemoryBufferState state) { rect_ = rect; is_a_single_elem_ = false; - memoryProxy_ = memoryProxy; - num_channels_ = COM_data_type_num_channels(memoryProxy->getDataType()); + memory_proxy_ = memory_proxy; + num_channels_ = COM_data_type_num_channels(memory_proxy->get_data_type()); buffer_ = (float *)MEM_mallocN_aligned( sizeof(float) * buffer_len() * num_channels_, 16, "COM_MemoryBuffer"); owns_data_ = true; state_ = state; - datatype_ = memoryProxy->getDataType(); + datatype_ = memory_proxy->get_data_type(); set_strides(); } -MemoryBuffer::MemoryBuffer(DataType dataType, const rcti &rect, bool is_a_single_elem) +MemoryBuffer::MemoryBuffer(DataType data_type, const rcti &rect, bool is_a_single_elem) { rect_ = rect; is_a_single_elem_ = is_a_single_elem; - memoryProxy_ = nullptr; - num_channels_ = COM_data_type_num_channels(dataType); + memory_proxy_ = nullptr; + num_channels_ = COM_data_type_num_channels(data_type); buffer_ = (float *)MEM_mallocN_aligned( sizeof(float) * buffer_len() * num_channels_, 16, "COM_MemoryBuffer"); owns_data_ = true; state_ = MemoryBufferState::Temporary; - datatype_ = dataType; + datatype_ = data_type; set_strides(); } @@ -95,7 +95,7 @@ MemoryBuffer::MemoryBuffer(float *buffer, { rect_ = rect; is_a_single_elem_ = is_a_single_elem; - memoryProxy_ = nullptr; + memory_proxy_ = nullptr; num_channels_ = num_channels; datatype_ = COM_num_channels_data_type(num_channels); buffer_ = buffer; @@ -107,7 +107,7 @@ MemoryBuffer::MemoryBuffer(float *buffer, MemoryBuffer::MemoryBuffer(const MemoryBuffer &src) : MemoryBuffer(src.datatype_, src.rect_, false) { - memoryProxy_ = src.memoryProxy_; + memory_proxy_ = src.memory_proxy_; /* src may be single elem buffer */ fill_from(src); } @@ -120,7 +120,7 @@ void MemoryBuffer::set_strides() } else { this->elem_stride = num_channels_; - this->row_stride = getWidth() * num_channels_; + this->row_stride = get_width() * num_channels_; } to_positive_x_stride_ = rect_.xmin < 0 ? -rect_.xmin + 1 : (rect_.xmin == 0 ? 1 : 0); to_positive_y_stride_ = rect_.ymin < 0 ? -rect_.ymin + 1 : (rect_.ymin == 0 ? 1 : 0); @@ -140,7 +140,7 @@ BuffersIterator<float> MemoryBuffer::iterate_with(Span<MemoryBuffer *> inputs, c { BuffersIteratorBuilder<float> builder(buffer_, rect_, area, elem_stride); for (MemoryBuffer *input : inputs) { - builder.add_input(input->getBuffer(), input->get_rect(), input->elem_stride); + builder.add_input(input->get_buffer(), input->get_rect(), input->elem_stride); } return builder.build(); } @@ -248,7 +248,7 @@ void MemoryBuffer::copy_from(const MemoryBuffer *src, void MemoryBuffer::copy_from(const uchar *src, const rcti &area) { const int elem_stride = this->get_num_channels(); - const int row_stride = elem_stride * getWidth(); + const int row_stride = elem_stride * get_width(); copy_from(src, area, 0, this->get_num_channels(), elem_stride, row_stride, 0); } @@ -307,7 +307,7 @@ static void colorspace_to_scene_linear(MemoryBuffer *buf, const rcti &area, Colo const int height = BLI_rcti_size_y(&area); float *out = buf->get_elem(area.xmin, area.ymin); /* If area allows continuous memory do conversion in one step. Otherwise per row. */ - if (buf->getWidth() == width) { + if (buf->get_width() == width) { IMB_colormanagement_colorspace_to_scene_linear( out, width, height, buf->get_num_channels(), colorspace, false); } @@ -404,7 +404,7 @@ void MemoryBuffer::fill_from(const MemoryBuffer &src) copy_from(&src, overlap); } -void MemoryBuffer::writePixel(int x, int y, const float color[4]) +void MemoryBuffer::write_pixel(int x, int y, const float color[4]) { if (x >= rect_.xmin && x < rect_.xmax && y >= rect_.ymin && y < rect_.ymax) { const int offset = get_coords_offset(x, y); @@ -412,7 +412,7 @@ void MemoryBuffer::writePixel(int x, int y, const float color[4]) } } -void MemoryBuffer::addPixel(int x, int y, const float color[4]) +void MemoryBuffer::add_pixel(int x, int y, const float color[4]) { if (x >= rect_.xmin && x < rect_.xmax && y >= rect_.ymin && y < rect_.ymax) { const int offset = get_coords_offset(x, y); @@ -437,7 +437,7 @@ void MemoryBuffer::read_elem_filtered( const float deriv[2][2] = {{dx[0], dx[1]}, {dy[0], dy[1]}}; - float inv_width = 1.0f / (float)this->getWidth(), inv_height = 1.0f / (float)this->getHeight(); + float inv_width = 1.0f / (float)this->get_width(), inv_height = 1.0f / (float)this->get_height(); /* TODO(sergey): Render pipeline uses normalized coordinates and derivatives, * but compositor uses pixel space. For now let's just divide the values and * switch compositor to normalized space for EWA later. @@ -446,8 +446,8 @@ void MemoryBuffer::read_elem_filtered( float du_normal[2] = {deriv[0][0] * inv_width, deriv[0][1] * inv_height}; float dv_normal[2] = {deriv[1][0] * inv_width, deriv[1][1] * inv_height}; - BLI_ewa_filter(this->getWidth(), - this->getHeight(), + BLI_ewa_filter(this->get_width(), + this->get_height(), false, true, uv_normal, @@ -473,7 +473,8 @@ void MemoryBuffer::readEWA(float *result, const float uv[2], const float derivat } else { BLI_assert(datatype_ == DataType::Color); - float inv_width = 1.0f / (float)this->getWidth(), inv_height = 1.0f / (float)this->getHeight(); + float inv_width = 1.0f / (float)this->get_width(), + inv_height = 1.0f / (float)this->get_height(); /* TODO(sergey): Render pipeline uses normalized coordinates and derivatives, * but compositor uses pixel space. For now let's just divide the values and * switch compositor to normalized space for EWA later. @@ -482,8 +483,8 @@ void MemoryBuffer::readEWA(float *result, const float uv[2], const float derivat float du_normal[2] = {derivatives[0][0] * inv_width, derivatives[0][1] * inv_height}; float dv_normal[2] = {derivatives[1][0] * inv_width, derivatives[1][1] * inv_height}; - BLI_ewa_filter(this->getWidth(), - this->getHeight(), + BLI_ewa_filter(this->get_width(), + this->get_height(), false, true, uv_normal, diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.h b/source/blender/compositor/intern/COM_MemoryBuffer.h index 984db4acc2a..33d78c99ca6 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.h +++ b/source/blender/compositor/intern/COM_MemoryBuffer.h @@ -77,7 +77,7 @@ class MemoryBuffer { /** * \brief proxy of the memory (same for all chunks in the same buffer) */ - MemoryProxy *memoryProxy_; + MemoryProxy *memory_proxy_; /** * \brief the type of buffer DataType::Value, DataType::Vector, DataType::Color @@ -125,12 +125,12 @@ class MemoryBuffer { /** * \brief construct new temporarily MemoryBuffer for an area */ - MemoryBuffer(MemoryProxy *memoryProxy, const rcti &rect, MemoryBufferState state); + MemoryBuffer(MemoryProxy *memory_proxy, const rcti &rect, MemoryBufferState state); /** * \brief construct new temporarily MemoryBuffer for an area */ - MemoryBuffer(DataType datatype, const rcti &rect, bool is_a_single_elem = false); + MemoryBuffer(DataType data_type, const rcti &rect, bool is_a_single_elem = false); MemoryBuffer( float *buffer, int num_channels, int width, int height, bool is_a_single_elem = false); @@ -159,14 +159,14 @@ class MemoryBuffer { float &operator[](int index) { BLI_assert(is_a_single_elem_ ? index < num_channels_ : - index < get_coords_offset(getWidth(), getHeight())); + index < get_coords_offset(get_width(), get_height())); return buffer_[index]; } const float &operator[](int index) const { BLI_assert(is_a_single_elem_ ? index < num_channels_ : - index < get_coords_offset(getWidth(), getHeight())); + index < get_coords_offset(get_width(), get_height())); return buffer_[index]; } @@ -231,7 +231,7 @@ class MemoryBuffer { } /* Do sampling at borders to smooth edges. */ - const float last_x = getWidth() - 1.0f; + const float last_x = get_width() - 1.0f; const float rel_x = get_relative_x(x); float single_x = 0.0f; if (rel_x < 0.0f) { @@ -241,7 +241,7 @@ class MemoryBuffer { single_x = rel_x - last_x; } - const float last_y = getHeight() - 1.0f; + const float last_y = get_height() - 1.0f; const float rel_y = get_relative_y(y); float single_y = 0.0f; if (rel_y < 0.0f) { @@ -257,8 +257,8 @@ class MemoryBuffer { BLI_bilinear_interpolation_fl(buffer_, out, - getWidth(), - getHeight(), + get_width(), + get_height(), num_channels_, get_relative_x(x), get_relative_y(y)); @@ -305,7 +305,7 @@ class MemoryBuffer { const float *get_row_end(int y) const { BLI_assert(has_y(y)); - return buffer_ + (is_a_single_elem() ? num_channels_ : get_coords_offset(getWidth(), y)); + return buffer_ + (is_a_single_elem() ? num_channels_ : get_coords_offset(get_width(), y)); } /** @@ -314,7 +314,7 @@ class MemoryBuffer { */ int get_memory_width() const { - return is_a_single_elem() ? 1 : getWidth(); + return is_a_single_elem() ? 1 : get_width(); } /** @@ -323,7 +323,7 @@ class MemoryBuffer { */ int get_memory_height() const { - return is_a_single_elem() ? 1 : getHeight(); + return is_a_single_elem() ? 1 : get_height(); } uint8_t get_num_channels() const @@ -351,12 +351,12 @@ class MemoryBuffer { BufferArea<float> get_buffer_area(const rcti &area) { - return BufferArea<float>(buffer_, getWidth(), area, elem_stride); + return BufferArea<float>(buffer_, get_width(), area, elem_stride); } BufferArea<const float> get_buffer_area(const rcti &area) const { - return BufferArea<const float>(buffer_, getWidth(), area, elem_stride); + return BufferArea<const float>(buffer_, get_width(), area, elem_stride); } BuffersIterator<float> iterate_with(Span<MemoryBuffer *> inputs); @@ -366,7 +366,7 @@ class MemoryBuffer { * \brief get the data of this MemoryBuffer * \note buffer should already be available in memory */ - float *getBuffer() + float *get_buffer() { return buffer_; } @@ -381,8 +381,8 @@ class MemoryBuffer { inline void wrap_pixel(int &x, int &y, MemoryBufferExtend extend_x, MemoryBufferExtend extend_y) { - const int w = getWidth(); - const int h = getHeight(); + const int w = get_width(); + const int h = get_height(); x = x - rect_.xmin; y = y - rect_.ymin; @@ -433,8 +433,8 @@ class MemoryBuffer { MemoryBufferExtend extend_x, MemoryBufferExtend extend_y) const { - const float w = (float)getWidth(); - const float h = (float)getHeight(); + const float w = (float)get_width(); + const float h = (float)get_height(); x = x - rect_.xmin; y = y - rect_.ymin; @@ -505,11 +505,11 @@ class MemoryBuffer { } /* TODO(manzanilla): to be removed with tiled implementation. */ - inline void readNoCheck(float *result, - int x, - int y, - MemoryBufferExtend extend_x = MemoryBufferExtend::Clip, - MemoryBufferExtend extend_y = MemoryBufferExtend::Clip) + inline void read_no_check(float *result, + int x, + int y, + MemoryBufferExtend extend_x = MemoryBufferExtend::Clip, + MemoryBufferExtend extend_y = MemoryBufferExtend::Clip) { int u = x; int v = y; @@ -525,19 +525,19 @@ class MemoryBuffer { memcpy(result, buffer, sizeof(float) * num_channels_); } - void writePixel(int x, int y, const float color[4]); - void addPixel(int x, int y, const float color[4]); - inline void readBilinear(float *result, - float x, - float y, - MemoryBufferExtend extend_x = MemoryBufferExtend::Clip, - MemoryBufferExtend extend_y = MemoryBufferExtend::Clip) const + void write_pixel(int x, int y, const float color[4]); + void add_pixel(int x, int y, const float color[4]); + inline void read_bilinear(float *result, + float x, + float y, + MemoryBufferExtend extend_x = MemoryBufferExtend::Clip, + MemoryBufferExtend extend_y = MemoryBufferExtend::Clip) const { float u = x; float v = y; this->wrap_pixel(u, v, extend_x, extend_y); - if ((extend_x != MemoryBufferExtend::Repeat && (u < 0.0f || u >= getWidth())) || - (extend_y != MemoryBufferExtend::Repeat && (v < 0.0f || v >= getHeight()))) { + if ((extend_x != MemoryBufferExtend::Repeat && (u < 0.0f || u >= get_width())) || + (extend_y != MemoryBufferExtend::Repeat && (v < 0.0f || v >= get_height()))) { copy_vn_fl(result, num_channels_, 0.0f); return; } @@ -547,8 +547,8 @@ class MemoryBuffer { else { BLI_bilinear_interpolation_wrap_fl(buffer_, result, - getWidth(), - getHeight(), + get_width(), + get_height(), num_channels_, u, v, @@ -562,7 +562,7 @@ class MemoryBuffer { /** * \brief is this MemoryBuffer a temporarily buffer (based on an area, not on a chunk) */ - inline bool isTemporarily() const + inline bool is_temporarily() const { return state_ == MemoryBufferState::Temporary; } @@ -617,8 +617,8 @@ class MemoryBuffer { void fill(const rcti &area, const float *value); void fill(const rcti &area, int channel_offset, const float *value, int value_size); /** - * \brief add the content from otherBuffer to this MemoryBuffer - * \param otherBuffer: source buffer + * \brief add the content from other_buffer to this MemoryBuffer + * \param other_buffer: source buffer * * \note take care when running this on a new buffer since it won't fill in * uninitialized values in areas where the buffers don't overlap. @@ -636,7 +636,7 @@ class MemoryBuffer { /** * \brief get the width of this MemoryBuffer */ - const int getWidth() const + const int get_width() const { return BLI_rcti_size_x(&rect_); } @@ -644,7 +644,7 @@ class MemoryBuffer { /** * \brief get the height of this MemoryBuffer */ - const int getHeight() const + const int get_height() const { return BLI_rcti_size_y(&rect_); } diff --git a/source/blender/compositor/intern/COM_MemoryProxy.cc b/source/blender/compositor/intern/COM_MemoryProxy.cc index 507caa25655..895990bc87f 100644 --- a/source/blender/compositor/intern/COM_MemoryProxy.cc +++ b/source/blender/compositor/intern/COM_MemoryProxy.cc @@ -23,7 +23,7 @@ namespace blender::compositor { MemoryProxy::MemoryProxy(DataType datatype) { - writeBufferOperation_ = nullptr; + write_buffer_operation_ = nullptr; executor_ = nullptr; datatype_ = datatype; } diff --git a/source/blender/compositor/intern/COM_MemoryProxy.h b/source/blender/compositor/intern/COM_MemoryProxy.h index cf262d72649..89149a47976 100644 --- a/source/blender/compositor/intern/COM_MemoryProxy.h +++ b/source/blender/compositor/intern/COM_MemoryProxy.h @@ -42,7 +42,7 @@ class MemoryProxy { /** * \brief reference to the output operation of the executiongroup */ - WriteBufferOperation *writeBufferOperation_; + WriteBufferOperation *write_buffer_operation_; /** * \brief reference to the executor. the Execution group that can fill a chunk @@ -66,7 +66,7 @@ class MemoryProxy { * \brief set the ExecutionGroup that can be scheduled to calculate a certain chunk. * \param group: the ExecutionGroup to set */ - void setExecutor(ExecutionGroup *executor) + void set_executor(ExecutionGroup *executor) { executor_ = executor; } @@ -74,7 +74,7 @@ class MemoryProxy { /** * \brief get the ExecutionGroup that can be scheduled to calculate a certain chunk. */ - ExecutionGroup *getExecutor() const + ExecutionGroup *get_executor() const { return executor_; } @@ -83,18 +83,18 @@ class MemoryProxy { * \brief set the WriteBufferOperation that is responsible for writing to this MemoryProxy * \param operation: */ - void setWriteBufferOperation(WriteBufferOperation *operation) + void set_write_buffer_operation(WriteBufferOperation *operation) { - writeBufferOperation_ = operation; + write_buffer_operation_ = operation; } /** * \brief get the WriteBufferOperation that is responsible for writing to this MemoryProxy * \return WriteBufferOperation */ - WriteBufferOperation *getWriteBufferOperation() const + WriteBufferOperation *get_write_buffer_operation() const { - return writeBufferOperation_; + return write_buffer_operation_; } /** @@ -110,12 +110,12 @@ class MemoryProxy { /** * \brief get the allocated memory */ - inline MemoryBuffer *getBuffer() + inline MemoryBuffer *get_buffer() { return buffer_; } - inline DataType getDataType() + inline DataType get_data_type() { return datatype_; } diff --git a/source/blender/compositor/intern/COM_MetaData.cc b/source/blender/compositor/intern/COM_MetaData.cc index 5775a7eab65..530634a6e41 100644 --- a/source/blender/compositor/intern/COM_MetaData.cc +++ b/source/blender/compositor/intern/COM_MetaData.cc @@ -29,9 +29,9 @@ void MetaData::add(const blender::StringRef key, const blender::StringRef value) entries_.add(key, value); } -void MetaData::addCryptomatteEntry(const blender::StringRef layer_name, - const blender::StringRefNull key, - const blender::StringRef value) +void MetaData::add_cryptomatte_entry(const blender::StringRef layer_name, + const blender::StringRefNull key, + const blender::StringRef value) { add(blender::bke::cryptomatte::BKE_cryptomatte_meta_data_key(layer_name, key), value); } @@ -40,7 +40,7 @@ void MetaData::addCryptomatteEntry(const blender::StringRef layer_name, * * When a conversion happens it will also add the cryptomatte name key with the given * `layer_name`. */ -void MetaData::replaceHashNeutralCryptomatteKeys(const blender::StringRef layer_name) +void MetaData::replace_hash_neutral_cryptomatte_keys(const blender::StringRef layer_name) { std::string cryptomatte_hash = entries_.pop_default(META_DATA_KEY_CRYPTOMATTE_HASH, ""); std::string cryptomatte_conversion = entries_.pop_default(META_DATA_KEY_CRYPTOMATTE_CONVERSION, @@ -49,27 +49,28 @@ void MetaData::replaceHashNeutralCryptomatteKeys(const blender::StringRef layer_ if (cryptomatte_hash.length() || cryptomatte_conversion.length() || cryptomatte_manifest.length()) { - addCryptomatteEntry(layer_name, "name", layer_name); + add_cryptomatte_entry(layer_name, "name", layer_name); } if (cryptomatte_hash.length()) { - addCryptomatteEntry(layer_name, "hash", cryptomatte_hash); + add_cryptomatte_entry(layer_name, "hash", cryptomatte_hash); } if (cryptomatte_conversion.length()) { - addCryptomatteEntry(layer_name, "conversion", cryptomatte_conversion); + add_cryptomatte_entry(layer_name, "conversion", cryptomatte_conversion); } if (cryptomatte_manifest.length()) { - addCryptomatteEntry(layer_name, "manifest", cryptomatte_manifest); + add_cryptomatte_entry(layer_name, "manifest", cryptomatte_manifest); } } -void MetaData::addToRenderResult(RenderResult *render_result) const +void MetaData::add_to_render_result(RenderResult *render_result) const { for (Map<std::string, std::string>::Item entry : entries_.items()) { BKE_render_result_stamp_data(render_result, entry.key.c_str(), entry.value.c_str()); } } -void MetaDataExtractCallbackData::addMetaData(blender::StringRef key, blender::StringRefNull value) +void MetaDataExtractCallbackData::add_meta_data(blender::StringRef key, + blender::StringRefNull value) { if (!meta_data) { meta_data = std::make_unique<MetaData>(); @@ -77,7 +78,7 @@ void MetaDataExtractCallbackData::addMetaData(blender::StringRef key, blender::S meta_data->add(key, value); } -void MetaDataExtractCallbackData::setCryptomatteKeys(blender::StringRef cryptomatte_layer_name) +void MetaDataExtractCallbackData::set_cryptomatte_keys(blender::StringRef cryptomatte_layer_name) { manifest_key = blender::bke::cryptomatte::BKE_cryptomatte_meta_data_key(cryptomatte_layer_name, "manifest"); @@ -95,13 +96,13 @@ void MetaDataExtractCallbackData::extract_cryptomatte_meta_data(void *_data, MetaDataExtractCallbackData *data = static_cast<MetaDataExtractCallbackData *>(_data); blender::StringRefNull key(propname); if (key == data->hash_key) { - data->addMetaData(META_DATA_KEY_CRYPTOMATTE_HASH, propvalue); + data->add_meta_data(META_DATA_KEY_CRYPTOMATTE_HASH, propvalue); } else if (key == data->conversion_key) { - data->addMetaData(META_DATA_KEY_CRYPTOMATTE_CONVERSION, propvalue); + data->add_meta_data(META_DATA_KEY_CRYPTOMATTE_CONVERSION, propvalue); } else if (key == data->manifest_key) { - data->addMetaData(META_DATA_KEY_CRYPTOMATTE_MANIFEST, propvalue); + data->add_meta_data(META_DATA_KEY_CRYPTOMATTE_MANIFEST, propvalue); } } diff --git a/source/blender/compositor/intern/COM_MetaData.h b/source/blender/compositor/intern/COM_MetaData.h index a76540dc3af..0bb014525c3 100644 --- a/source/blender/compositor/intern/COM_MetaData.h +++ b/source/blender/compositor/intern/COM_MetaData.h @@ -44,14 +44,14 @@ constexpr blender::StringRef META_DATA_KEY_CRYPTOMATTE_NAME("cryptomatte/{hash}/ class MetaData { private: Map<std::string, std::string> entries_; - void addCryptomatteEntry(const blender::StringRef layer_name, - const blender::StringRefNull key, - const blender::StringRef value); + void add_cryptomatte_entry(const blender::StringRef layer_name, + const blender::StringRefNull key, + const blender::StringRef value); public: void add(const blender::StringRef key, const blender::StringRef value); - void replaceHashNeutralCryptomatteKeys(const blender::StringRef layer_name); - void addToRenderResult(RenderResult *render_result) const; + void replace_hash_neutral_cryptomatte_keys(const blender::StringRef layer_name); + void add_to_render_result(RenderResult *render_result) const; #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("COM:MetaData") #endif @@ -63,8 +63,8 @@ struct MetaDataExtractCallbackData { std::string conversion_key; std::string manifest_key; - void addMetaData(blender::StringRef key, blender::StringRefNull value); - void setCryptomatteKeys(blender::StringRef cryptomatte_layer_name); + void add_meta_data(blender::StringRef key, blender::StringRefNull value); + void set_cryptomatte_keys(blender::StringRef cryptomatte_layer_name); /* C type callback function (StampCallback). */ static void extract_cryptomatte_meta_data(void *_data, const char *propname, diff --git a/source/blender/compositor/intern/COM_Node.cc b/source/blender/compositor/intern/COM_Node.cc index 7acf91df7d4..58b2b195579 100644 --- a/source/blender/compositor/intern/COM_Node.cc +++ b/source/blender/compositor/intern/COM_Node.cc @@ -28,14 +28,14 @@ namespace blender::compositor { **** Node **** **************/ -Node::Node(bNode *editorNode, bool create_sockets) - : editorNodeTree_(nullptr), - editorNode_(editorNode), - inActiveGroup_(false), - instanceKey_(NODE_INSTANCE_KEY_NONE) +Node::Node(bNode *editor_node, bool create_sockets) + : editor_node_tree_(nullptr), + editor_node_(editor_node), + in_active_group_(false), + instance_key_(NODE_INSTANCE_KEY_NONE) { if (create_sockets) { - bNodeSocket *input = (bNodeSocket *)editorNode->inputs.first; + bNodeSocket *input = (bNodeSocket *)editor_node->inputs.first; while (input != nullptr) { DataType dt = DataType::Value; if (input->type == SOCK_RGBA) { @@ -45,10 +45,10 @@ Node::Node(bNode *editorNode, bool create_sockets) dt = DataType::Vector; } - this->addInputSocket(dt, input); + this->add_input_socket(dt, input); input = input->next; } - bNodeSocket *output = (bNodeSocket *)editorNode->outputs.first; + bNodeSocket *output = (bNodeSocket *)editor_node->outputs.first; while (output != nullptr) { DataType dt = DataType::Value; if (output->type == SOCK_RGBA) { @@ -58,7 +58,7 @@ Node::Node(bNode *editorNode, bool create_sockets) dt = DataType::Vector; } - this->addOutputSocket(dt, output); + this->add_output_socket(dt, output); output = output->next; } } @@ -74,43 +74,43 @@ Node::~Node() } } -void Node::addInputSocket(DataType datatype) +void Node::add_input_socket(DataType datatype) { - this->addInputSocket(datatype, nullptr); + this->add_input_socket(datatype, nullptr); } -void Node::addInputSocket(DataType datatype, bNodeSocket *bSocket) +void Node::add_input_socket(DataType datatype, bNodeSocket *bSocket) { NodeInput *socket = new NodeInput(this, bSocket, datatype); this->inputs.append(socket); } -void Node::addOutputSocket(DataType datatype) +void Node::add_output_socket(DataType datatype) { - this->addOutputSocket(datatype, nullptr); + this->add_output_socket(datatype, nullptr); } -void Node::addOutputSocket(DataType datatype, bNodeSocket *bSocket) +void Node::add_output_socket(DataType datatype, bNodeSocket *bSocket) { NodeOutput *socket = new NodeOutput(this, bSocket, datatype); outputs.append(socket); } -NodeOutput *Node::getOutputSocket(unsigned int index) const +NodeOutput *Node::get_output_socket(unsigned int index) const { return outputs[index]; } -NodeInput *Node::getInputSocket(unsigned int index) const +NodeInput *Node::get_input_socket(unsigned int index) const { return inputs[index]; } -bNodeSocket *Node::getEditorInputSocket(int editorNodeInputSocketIndex) +bNodeSocket *Node::get_editor_input_socket(int editor_node_input_socket_index) { - bNodeSocket *bSock = (bNodeSocket *)this->getbNode()->inputs.first; + bNodeSocket *bSock = (bNodeSocket *)this->get_bnode()->inputs.first; int index = 0; while (bSock != nullptr) { - if (index == editorNodeInputSocketIndex) { + if (index == editor_node_input_socket_index) { return bSock; } index++; @@ -118,12 +118,12 @@ bNodeSocket *Node::getEditorInputSocket(int editorNodeInputSocketIndex) } return nullptr; } -bNodeSocket *Node::getEditorOutputSocket(int editorNodeOutputSocketIndex) +bNodeSocket *Node::get_editor_output_socket(int editor_node_output_socket_index) { - bNodeSocket *bSock = (bNodeSocket *)this->getbNode()->outputs.first; + bNodeSocket *bSock = (bNodeSocket *)this->get_bnode()->outputs.first; int index = 0; while (bSock != nullptr) { - if (index == editorNodeOutputSocketIndex) { + if (index == editor_node_output_socket_index) { return bSock; } index++; @@ -137,33 +137,33 @@ bNodeSocket *Node::getEditorOutputSocket(int editorNodeOutputSocketIndex) *******************/ NodeInput::NodeInput(Node *node, bNodeSocket *b_socket, DataType datatype) - : node_(node), editorSocket_(b_socket), datatype_(datatype), link_(nullptr) + : node_(node), editor_socket_(b_socket), datatype_(datatype), link_(nullptr) { } -void NodeInput::setLink(NodeOutput *link) +void NodeInput::set_link(NodeOutput *link) { link_ = link; } -float NodeInput::getEditorValueFloat() const +float NodeInput::get_editor_value_float() const { PointerRNA ptr; - RNA_pointer_create((ID *)getNode()->getbNodeTree(), &RNA_NodeSocket, getbNodeSocket(), &ptr); + RNA_pointer_create((ID *)get_node()->get_bnodetree(), &RNA_NodeSocket, get_bnode_socket(), &ptr); return RNA_float_get(&ptr, "default_value"); } -void NodeInput::getEditorValueColor(float *value) const +void NodeInput::get_editor_value_color(float *value) const { PointerRNA ptr; - RNA_pointer_create((ID *)getNode()->getbNodeTree(), &RNA_NodeSocket, getbNodeSocket(), &ptr); + RNA_pointer_create((ID *)get_node()->get_bnodetree(), &RNA_NodeSocket, get_bnode_socket(), &ptr); return RNA_float_get_array(&ptr, "default_value", value); } -void NodeInput::getEditorValueVector(float *value) const +void NodeInput::get_editor_value_vector(float *value) const { PointerRNA ptr; - RNA_pointer_create((ID *)getNode()->getbNodeTree(), &RNA_NodeSocket, getbNodeSocket(), &ptr); + RNA_pointer_create((ID *)get_node()->get_bnodetree(), &RNA_NodeSocket, get_bnode_socket(), &ptr); return RNA_float_get_array(&ptr, "default_value", value); } @@ -172,28 +172,28 @@ void NodeInput::getEditorValueVector(float *value) const ********************/ NodeOutput::NodeOutput(Node *node, bNodeSocket *b_socket, DataType datatype) - : node_(node), editorSocket_(b_socket), datatype_(datatype) + : node_(node), editor_socket_(b_socket), datatype_(datatype) { } -float NodeOutput::getEditorValueFloat() +float NodeOutput::get_editor_value_float() { PointerRNA ptr; - RNA_pointer_create((ID *)getNode()->getbNodeTree(), &RNA_NodeSocket, getbNodeSocket(), &ptr); + RNA_pointer_create((ID *)get_node()->get_bnodetree(), &RNA_NodeSocket, get_bnode_socket(), &ptr); return RNA_float_get(&ptr, "default_value"); } -void NodeOutput::getEditorValueColor(float *value) +void NodeOutput::get_editor_value_color(float *value) { PointerRNA ptr; - RNA_pointer_create((ID *)getNode()->getbNodeTree(), &RNA_NodeSocket, getbNodeSocket(), &ptr); + RNA_pointer_create((ID *)get_node()->get_bnodetree(), &RNA_NodeSocket, get_bnode_socket(), &ptr); return RNA_float_get_array(&ptr, "default_value", value); } -void NodeOutput::getEditorValueVector(float *value) +void NodeOutput::get_editor_value_vector(float *value) { PointerRNA ptr; - RNA_pointer_create((ID *)getNode()->getbNodeTree(), &RNA_NodeSocket, getbNodeSocket(), &ptr); + RNA_pointer_create((ID *)get_node()->get_bnodetree(), &RNA_NodeSocket, get_bnode_socket(), &ptr); return RNA_float_get_array(&ptr, "default_value", value); } diff --git a/source/blender/compositor/intern/COM_Node.h b/source/blender/compositor/intern/COM_Node.h index 3d9c62aca67..41283b821bb 100644 --- a/source/blender/compositor/intern/COM_Node.h +++ b/source/blender/compositor/intern/COM_Node.h @@ -41,22 +41,22 @@ class Node { /** * \brief stores the reference to the SDNA bNode struct */ - bNodeTree *editorNodeTree_; + bNodeTree *editor_node_tree_; /** * \brief stores the reference to the SDNA bNode struct */ - bNode *editorNode_; + bNode *editor_node_; /** * \brief Is this node part of the active group */ - bool inActiveGroup_; + bool in_active_group_; /** * \brief Instance key to identify the node in an instance hash table */ - bNodeInstanceKey instanceKey_; + bNodeInstanceKey instance_key_; protected: /** @@ -70,23 +70,23 @@ class Node { Vector<NodeOutput *> outputs; public: - Node(bNode *editorNode, bool create_sockets = true); + Node(bNode *editor_node, bool create_sockets = true); virtual ~Node(); /** * \brief get the reference to the SDNA bNode struct */ - bNode *getbNode() const + bNode *get_bnode() const { - return editorNode_; + return editor_node_; } /** * \brief get the reference to the SDNA bNodeTree struct */ - bNodeTree *getbNodeTree() const + bNodeTree *get_bnodetree() const { - return editorNodeTree_; + return editor_node_tree_; } /** @@ -95,24 +95,24 @@ class Node { * node for highlight during execution. * \param bNode: */ - void setbNode(bNode *node) + void set_bnode(bNode *node) { - editorNode_ = node; + editor_node_ = node; } /** * \brief set the reference to the bNodeTree * \param bNodeTree: */ - void setbNodeTree(bNodeTree *nodetree) + void set_bnodetree(bNodeTree *nodetree) { - editorNodeTree_ = nodetree; + editor_node_tree_ = nodetree; } /** * \brief get access to the vector of input sockets */ - const Vector<NodeInput *> &getInputSockets() const + const Vector<NodeInput *> &get_input_sockets() const { return this->inputs; } @@ -120,7 +120,7 @@ class Node { /** * \brief get access to the vector of input sockets */ - const Vector<NodeOutput *> &getOutputSockets() const + const Vector<NodeOutput *> &get_output_sockets() const { return this->outputs; } @@ -130,22 +130,22 @@ class Node { * \param index: * the index of the needed outputsocket */ - NodeOutput *getOutputSocket(const unsigned int index = 0) const; + NodeOutput *get_output_socket(const unsigned int index = 0) const; /** * get the reference to a certain inputsocket * \param index: * the index of the needed inputsocket */ - NodeInput *getInputSocket(const unsigned int index) const; + NodeInput *get_input_socket(const unsigned int index) const; /** * \brief Is this node in the active group (the group that is being edited) - * \param isInActiveGroup: + * \param is_in_active_group: */ - void setIsInActiveGroup(bool value) + void set_is_in_active_group(bool value) { - inActiveGroup_ = value; + in_active_group_ = value; } /** @@ -154,9 +154,9 @@ class Node { * the active group will be the main tree (all nodes that are not part of a group will be active) * \return bool [false:true] */ - inline bool isInActiveGroup() const + inline bool is_in_active_group() const { - return inActiveGroup_; + return in_active_group_; } /** @@ -167,16 +167,16 @@ class Node { * \param system: the ExecutionSystem where the operations need to be added * \param context: reference to the CompositorContext */ - virtual void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const = 0; + virtual void convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const = 0; - void setInstanceKey(bNodeInstanceKey instance_key) + void set_instance_key(bNodeInstanceKey instance_key) { - instanceKey_ = instance_key; + instance_key_ = instance_key; } - bNodeInstanceKey getInstanceKey() const + bNodeInstanceKey get_instance_key() const { - return instanceKey_; + return instance_key_; } protected: @@ -185,19 +185,19 @@ class Node { * \note may only be called in an constructor * \param socket: the NodeInput to add */ - void addInputSocket(DataType datatype); - void addInputSocket(DataType datatype, bNodeSocket *socket); + void add_input_socket(DataType datatype); + void add_input_socket(DataType datatype, bNodeSocket *socket); /** * \brief add an NodeOutput to the collection of output-sockets * \note may only be called in an constructor * \param socket: the NodeOutput to add */ - void addOutputSocket(DataType datatype); - void addOutputSocket(DataType datatype, bNodeSocket *socket); + void add_output_socket(DataType datatype); + void add_output_socket(DataType datatype, bNodeSocket *socket); - bNodeSocket *getEditorInputSocket(int editorNodeInputSocketIndex); - bNodeSocket *getEditorOutputSocket(int editorNodeOutputSocketIndex); + bNodeSocket *get_editor_input_socket(int editor_node_input_socket_index); + bNodeSocket *get_editor_output_socket(int editor_node_output_socket_index); }; /** @@ -207,7 +207,7 @@ class Node { class NodeInput { private: Node *node_; - bNodeSocket *editorSocket_; + bNodeSocket *editor_socket_; DataType datatype_; @@ -220,32 +220,32 @@ class NodeInput { public: NodeInput(Node *node, bNodeSocket *b_socket, DataType datatype); - Node *getNode() const + Node *get_node() const { return node_; } - DataType getDataType() const + DataType get_data_type() const { return datatype_; } - bNodeSocket *getbNodeSocket() const + bNodeSocket *get_bnode_socket() const { - return editorSocket_; + return editor_socket_; } - void setLink(NodeOutput *link); - bool isLinked() const + void set_link(NodeOutput *link); + bool is_linked() const { return link_; } - NodeOutput *getLink() + NodeOutput *get_link() { return link_; } - float getEditorValueFloat() const; - void getEditorValueColor(float *value) const; - void getEditorValueVector(float *value) const; + float get_editor_value_float() const; + void get_editor_value_color(float *value) const; + void get_editor_value_vector(float *value) const; }; /** @@ -255,29 +255,29 @@ class NodeInput { class NodeOutput { private: Node *node_; - bNodeSocket *editorSocket_; + bNodeSocket *editor_socket_; DataType datatype_; public: NodeOutput(Node *node, bNodeSocket *b_socket, DataType datatype); - Node *getNode() const + Node *get_node() const { return node_; } - DataType getDataType() const + DataType get_data_type() const { return datatype_; } - bNodeSocket *getbNodeSocket() const + bNodeSocket *get_bnode_socket() const { - return editorSocket_; + return editor_socket_; } - float getEditorValueFloat(); - void getEditorValueColor(float *value); - void getEditorValueVector(float *value); + float get_editor_value_float(); + void get_editor_value_color(float *value); + void get_editor_value_vector(float *value); }; } // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_NodeConverter.cc b/source/blender/compositor/intern/COM_NodeConverter.cc index 314b5e9572a..93ec559533b 100644 --- a/source/blender/compositor/intern/COM_NodeConverter.cc +++ b/source/blender/compositor/intern/COM_NodeConverter.cc @@ -33,127 +33,128 @@ NodeConverter::NodeConverter(NodeOperationBuilder *builder) : builder_(builder) { } -void NodeConverter::addOperation(NodeOperation *operation) +void NodeConverter::add_operation(NodeOperation *operation) { - builder_->addOperation(operation); + builder_->add_operation(operation); } -void NodeConverter::mapInputSocket(NodeInput *node_socket, NodeOperationInput *operation_socket) +void NodeConverter::map_input_socket(NodeInput *node_socket, NodeOperationInput *operation_socket) { - builder_->mapInputSocket(node_socket, operation_socket); + builder_->map_input_socket(node_socket, operation_socket); } -void NodeConverter::mapOutputSocket(NodeOutput *node_socket, NodeOperationOutput *operation_socket) +void NodeConverter::map_output_socket(NodeOutput *node_socket, + NodeOperationOutput *operation_socket) { - builder_->mapOutputSocket(node_socket, operation_socket); + builder_->map_output_socket(node_socket, operation_socket); } -void NodeConverter::addLink(NodeOperationOutput *from, NodeOperationInput *to) +void NodeConverter::add_link(NodeOperationOutput *from, NodeOperationInput *to) { - builder_->addLink(from, to); + builder_->add_link(from, to); } -void NodeConverter::addPreview(NodeOperationOutput *output) +void NodeConverter::add_preview(NodeOperationOutput *output) { - builder_->addPreview(output); + builder_->add_preview(output); } -void NodeConverter::addNodeInputPreview(NodeInput *input) +void NodeConverter::add_node_input_preview(NodeInput *input) { - builder_->addNodeInputPreview(input); + builder_->add_node_input_preview(input); } -NodeOperation *NodeConverter::setInvalidOutput(NodeOutput *output) +NodeOperation *NodeConverter::set_invalid_output(NodeOutput *output) { /* this is a really bad situation - bring on the pink! - so artists know this is bad */ const float warning_color[4] = {1.0f, 0.0f, 1.0f, 1.0f}; SetColorOperation *operation = new SetColorOperation(); - operation->setChannels(warning_color); + operation->set_channels(warning_color); - builder_->addOperation(operation); - builder_->mapOutputSocket(output, operation->getOutputSocket()); + builder_->add_operation(operation); + builder_->map_output_socket(output, operation->get_output_socket()); return operation; } -NodeOperationOutput *NodeConverter::addInputProxy(NodeInput *input, bool use_conversion) +NodeOperationOutput *NodeConverter::add_input_proxy(NodeInput *input, bool use_conversion) { - SocketProxyOperation *proxy = new SocketProxyOperation(input->getDataType(), use_conversion); - builder_->addOperation(proxy); + SocketProxyOperation *proxy = new SocketProxyOperation(input->get_data_type(), use_conversion); + builder_->add_operation(proxy); - builder_->mapInputSocket(input, proxy->getInputSocket(0)); + builder_->map_input_socket(input, proxy->get_input_socket(0)); - return proxy->getOutputSocket(); + return proxy->get_output_socket(); } -NodeOperationInput *NodeConverter::addOutputProxy(NodeOutput *output, bool use_conversion) +NodeOperationInput *NodeConverter::add_output_proxy(NodeOutput *output, bool use_conversion) { - SocketProxyOperation *proxy = new SocketProxyOperation(output->getDataType(), use_conversion); - builder_->addOperation(proxy); + SocketProxyOperation *proxy = new SocketProxyOperation(output->get_data_type(), use_conversion); + builder_->add_operation(proxy); - builder_->mapOutputSocket(output, proxy->getOutputSocket()); + builder_->map_output_socket(output, proxy->get_output_socket()); - return proxy->getInputSocket(0); + return proxy->get_input_socket(0); } -void NodeConverter::addInputValue(NodeOperationInput *input, float value) +void NodeConverter::add_input_value(NodeOperationInput *input, float value) { SetValueOperation *operation = new SetValueOperation(); - operation->setValue(value); + operation->set_value(value); - builder_->addOperation(operation); - builder_->addLink(operation->getOutputSocket(), input); + builder_->add_operation(operation); + builder_->add_link(operation->get_output_socket(), input); } -void NodeConverter::addInputColor(NodeOperationInput *input, const float value[4]) +void NodeConverter::add_input_color(NodeOperationInput *input, const float value[4]) { SetColorOperation *operation = new SetColorOperation(); - operation->setChannels(value); + operation->set_channels(value); - builder_->addOperation(operation); - builder_->addLink(operation->getOutputSocket(), input); + builder_->add_operation(operation); + builder_->add_link(operation->get_output_socket(), input); } -void NodeConverter::addInputVector(NodeOperationInput *input, const float value[3]) +void NodeConverter::add_input_vector(NodeOperationInput *input, const float value[3]) { SetVectorOperation *operation = new SetVectorOperation(); - operation->setVector(value); + operation->set_vector(value); - builder_->addOperation(operation); - builder_->addLink(operation->getOutputSocket(), input); + builder_->add_operation(operation); + builder_->add_link(operation->get_output_socket(), input); } -void NodeConverter::addOutputValue(NodeOutput *output, float value) +void NodeConverter::add_output_value(NodeOutput *output, float value) { SetValueOperation *operation = new SetValueOperation(); - operation->setValue(value); + operation->set_value(value); - builder_->addOperation(operation); - builder_->mapOutputSocket(output, operation->getOutputSocket()); + builder_->add_operation(operation); + builder_->map_output_socket(output, operation->get_output_socket()); } -void NodeConverter::addOutputColor(NodeOutput *output, const float value[4]) +void NodeConverter::add_output_color(NodeOutput *output, const float value[4]) { SetColorOperation *operation = new SetColorOperation(); - operation->setChannels(value); + operation->set_channels(value); - builder_->addOperation(operation); - builder_->mapOutputSocket(output, operation->getOutputSocket()); + builder_->add_operation(operation); + builder_->map_output_socket(output, operation->get_output_socket()); } -void NodeConverter::addOutputVector(NodeOutput *output, const float value[3]) +void NodeConverter::add_output_vector(NodeOutput *output, const float value[3]) { SetVectorOperation *operation = new SetVectorOperation(); - operation->setVector(value); + operation->set_vector(value); - builder_->addOperation(operation); - builder_->mapOutputSocket(output, operation->getOutputSocket()); + builder_->add_operation(operation); + builder_->map_output_socket(output, operation->get_output_socket()); } -void NodeConverter::registerViewer(ViewerOperation *viewer) +void NodeConverter::register_viewer(ViewerOperation *viewer) { - builder_->registerViewer(viewer); + builder_->register_viewer(viewer); } ViewerOperation *NodeConverter::active_viewer() const diff --git a/source/blender/compositor/intern/COM_NodeConverter.h b/source/blender/compositor/intern/COM_NodeConverter.h index afbd53fa67d..9193a28a77f 100644 --- a/source/blender/compositor/intern/COM_NodeConverter.h +++ b/source/blender/compositor/intern/COM_NodeConverter.h @@ -36,7 +36,7 @@ class ViewerOperation; /** * Interface type for converting a \a Node into \a NodeOperation. - * This is passed to \a Node::convertToOperation methods and allows them + * This is passed to \a Node::convert_to_operation methods and allows them * to register any number of operations, create links between them, * and map original node sockets to their inputs or outputs. */ @@ -48,7 +48,7 @@ class NodeConverter { * Insert a new operation into the operations graph. * The operation must be created by the node. */ - void addOperation(NodeOperation *operation); + void add_operation(NodeOperation *operation); /** * Map input socket of the node to an operation socket. @@ -57,7 +57,7 @@ class NodeConverter { * * \note A \a Node input can be mapped to multiple \a NodeOperation inputs. */ - void mapInputSocket(NodeInput *node_socket, NodeOperationInput *operation_socket); + void map_input_socket(NodeInput *node_socket, NodeOperationInput *operation_socket); /** * Map output socket of the node to an operation socket. * Links between nodes will then generate equivalent links between @@ -66,51 +66,51 @@ class NodeConverter { * \note A \a Node output can only be mapped to one \a NodeOperation output. * Any existing operation output mapping will be replaced. */ - void mapOutputSocket(NodeOutput *node_socket, NodeOperationOutput *operation_socket); + void map_output_socket(NodeOutput *node_socket, NodeOperationOutput *operation_socket); /** * Create a proxy operation for a node input. * This operation will be removed later and replaced * by direct links between the connected operations. */ - NodeOperationOutput *addInputProxy(NodeInput *input, bool use_conversion); + NodeOperationOutput *add_input_proxy(NodeInput *input, bool use_conversion); /** * Create a proxy operation for a node output. * This operation will be removed later and replaced * by direct links between the connected operations. */ - NodeOperationInput *addOutputProxy(NodeOutput *output, bool use_conversion); + NodeOperationInput *add_output_proxy(NodeOutput *output, bool use_conversion); /** Define a constant input value. */ - void addInputValue(NodeOperationInput *input, float value); + void add_input_value(NodeOperationInput *input, float value); /** Define a constant input color. */ - void addInputColor(NodeOperationInput *input, const float value[4]); + void add_input_color(NodeOperationInput *input, const float value[4]); /** Define a constant input vector. */ - void addInputVector(NodeOperationInput *input, const float value[3]); + void add_input_vector(NodeOperationInput *input, const float value[3]); /** Define a constant output value. */ - void addOutputValue(NodeOutput *output, float value); + void add_output_value(NodeOutput *output, float value); /** Define a constant output color. */ - void addOutputColor(NodeOutput *output, const float value[4]); + void add_output_color(NodeOutput *output, const float value[4]); /** Define a constant output vector. */ - void addOutputVector(NodeOutput *output, const float value[3]); + void add_output_vector(NodeOutput *output, const float value[3]); /** Add an explicit link between two operations. */ - void addLink(NodeOperationOutput *from, NodeOperationInput *to); + void add_link(NodeOperationOutput *from, NodeOperationInput *to); /** Add a preview operation for a operation output. */ - void addPreview(NodeOperationOutput *output); + void add_preview(NodeOperationOutput *output); /** Add a preview operation for a node input. */ - void addNodeInputPreview(NodeInput *input); + void add_node_input_preview(NodeInput *input); /** * When a node has no valid data * \note missing image / group pointer, or missing renderlayer from EXR */ - NodeOperation *setInvalidOutput(NodeOutput *output); + NodeOperation *set_invalid_output(NodeOutput *output); /** Define a viewer operation as the active output, if possible */ - void registerViewer(ViewerOperation *viewer); + void register_viewer(ViewerOperation *viewer); /** The currently active viewer output operation */ ViewerOperation *active_viewer() const; diff --git a/source/blender/compositor/intern/COM_NodeGraph.cc b/source/blender/compositor/intern/COM_NodeGraph.cc index a06c9349bb7..64684b772d9 100644 --- a/source/blender/compositor/intern/COM_NodeGraph.cc +++ b/source/blender/compositor/intern/COM_NodeGraph.cc @@ -71,21 +71,21 @@ void NodeGraph::add_node(Node *node, bNodeInstanceKey key, bool is_active_group) { - node->setbNodeTree(b_ntree); - node->setInstanceKey(key); - node->setIsInActiveGroup(is_active_group); + node->set_bnodetree(b_ntree); + node->set_instance_key(key); + node->set_is_in_active_group(is_active_group); nodes_.append(node); DebugInfo::node_added(node); } -void NodeGraph::add_link(NodeOutput *fromSocket, NodeInput *toSocket) +void NodeGraph::add_link(NodeOutput *from_socket, NodeInput *to_socket) { - links_.append(Link(fromSocket, toSocket)); + links_.append(Link(from_socket, to_socket)); /* register with the input */ - toSocket->setLink(fromSocket); + to_socket->set_link(from_socket); } void NodeGraph::add_bNodeTree(const CompositorContext &context, @@ -93,7 +93,7 @@ void NodeGraph::add_bNodeTree(const CompositorContext &context, bNodeTree *tree, bNodeInstanceKey parent_key) { - const bNodeTree *basetree = context.getbNodeTree(); + const bNodeTree *basetree = context.get_bnodetree(); /* Update viewers in the active edit-tree as well the base tree (for backdrop). */ bool is_active_group = (parent_key.value == basetree->active_viewer_key.value); @@ -124,7 +124,7 @@ void NodeGraph::add_bNode(const CompositorContext &context, } /* replace slow nodes with proxies for fast execution */ - if (context.isFastCalculation() && !COM_bnode_is_fast_node(*b_node)) { + if (context.is_fast_calculation() && !COM_bnode_is_fast_node(*b_node)) { add_proxies_skip(b_ntree, b_node, key, is_active_group); return; } @@ -149,8 +149,8 @@ NodeOutput *NodeGraph::find_output(const NodeRange &node_range, bNodeSocket *b_s { for (Vector<Node *>::iterator it = node_range.first; it != node_range.second; ++it) { Node *node = *it; - for (NodeOutput *output : node->getOutputSockets()) { - if (output->getbNodeSocket() == b_socket) { + for (NodeOutput *output : node->get_output_sockets()) { + if (output->get_bnode_socket() == b_socket) { return output; } } @@ -180,8 +180,8 @@ void NodeGraph::add_bNodeLink(const NodeRange &node_range, bNodeLink *b_nodelink for (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()) { + for (NodeInput *input : node->get_input_sockets()) { + if (input->get_bnode_socket() == b_nodelink->tosock && !input->is_linked()) { add_link(output, input); } } @@ -258,7 +258,7 @@ void NodeGraph::add_proxies_group_outputs(const CompositorContext &context, b_sock_io = b_sock_io->next) { bNodeSocket *b_sock_group = find_b_node_output(b_node, b_sock_io->identifier); if (b_sock_group) { - if (context.isGroupnodeBufferEnabled() && + if (context.is_groupnode_buffer_enabled() && context.get_execution_model() == eExecutionModel::Tiled) { SocketBufferNode *buffer = new SocketBufferNode(b_node_io, b_sock_io, b_sock_group); add_node(buffer, b_group_tree, key, is_active_group); @@ -279,7 +279,7 @@ void NodeGraph::add_proxies_group(const CompositorContext &context, /* missing node group datablock can happen with library linking */ if (!b_group_tree) { - /* This error case its handled in convertToOperations() + /* This error case its handled in convert_to_operations() * so we don't get un-converted sockets. */ return; } diff --git a/source/blender/compositor/intern/COM_NodeGraph.h b/source/blender/compositor/intern/COM_NodeGraph.h index cc628ebb724..476b99033c9 100644 --- a/source/blender/compositor/intern/COM_NodeGraph.h +++ b/source/blender/compositor/intern/COM_NodeGraph.h @@ -71,7 +71,7 @@ class NodeGraph { static bNodeSocket *find_b_node_output(bNode *b_node, const char *identifier); void add_node(Node *node, bNodeTree *b_ntree, bNodeInstanceKey key, bool is_active_group); - void add_link(NodeOutput *fromSocket, NodeInput *toSocket); + void add_link(NodeOutput *from_socket, NodeInput *to_socket); void add_bNodeTree(const CompositorContext &context, int nodes_start, diff --git a/source/blender/compositor/intern/COM_NodeOperation.cc b/source/blender/compositor/intern/COM_NodeOperation.cc index 0bfc088e4bf..41c645b9eea 100644 --- a/source/blender/compositor/intern/COM_NodeOperation.cc +++ b/source/blender/compositor/intern/COM_NodeOperation.cc @@ -40,7 +40,7 @@ NodeOperation::NodeOperation() /** Get constant value when operation is constant, otherwise return default_value. */ float NodeOperation::get_constant_value_default(float default_value) { - BLI_assert(outputs_.size() > 0 && getOutputSocket()->getDataType() == DataType::Value); + BLI_assert(outputs_.size() > 0 && get_output_socket()->get_data_type() == DataType::Value); return *get_constant_elem_default(&default_value); } @@ -74,23 +74,23 @@ std::optional<NodeOperationHash> NodeOperation::generate_hash() hash_params(canvas_.ymin, canvas_.ymax); if (outputs_.size() > 0) { BLI_assert(outputs_.size() == 1); - hash_param(this->getOutputSocket()->getDataType()); + hash_param(this->get_output_socket()->get_data_type()); } NodeOperationHash hash; hash.params_hash_ = params_hash_; hash.parents_hash_ = 0; for (NodeOperationInput &socket : inputs_) { - if (!socket.isConnected()) { + if (!socket.is_connected()) { continue; } - NodeOperation &input = socket.getLink()->getOperation(); + NodeOperation &input = socket.get_link()->get_operation(); const bool is_constant = input.get_flags().is_constant_operation; combine_hashes(hash.parents_hash_, get_default_hash(is_constant)); if (is_constant) { const float *elem = ((ConstantOperation *)&input)->get_constant_elem(); - const int num_channels = COM_data_type_num_channels(socket.getDataType()); + const int num_channels = COM_data_type_num_channels(socket.get_data_type()); for (const int i : IndexRange(num_channels)) { combine_hashes(hash.parents_hash_, get_default_hash(elem[i])); } @@ -106,22 +106,22 @@ std::optional<NodeOperationHash> NodeOperation::generate_hash() return hash; } -NodeOperationOutput *NodeOperation::getOutputSocket(unsigned int index) +NodeOperationOutput *NodeOperation::get_output_socket(unsigned int index) { return &outputs_[index]; } -NodeOperationInput *NodeOperation::getInputSocket(unsigned int index) +NodeOperationInput *NodeOperation::get_input_socket(unsigned int index) { return &inputs_[index]; } -void NodeOperation::addInputSocket(DataType datatype, ResizeMode resize_mode) +void NodeOperation::add_input_socket(DataType datatype, ResizeMode resize_mode) { inputs_.append(NodeOperationInput(this, datatype, resize_mode)); } -void NodeOperation::addOutputSocket(DataType datatype) +void NodeOperation::add_output_socket(DataType datatype) { outputs_.append(NodeOperationOutput(this, datatype)); } @@ -157,7 +157,7 @@ void NodeOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) continue; } NodeOperationInput &input = inputs_[index]; - if (input.isConnected()) { + if (input.is_connected()) { input.determine_canvas(local_preferred_area, unused_area); } } @@ -172,32 +172,32 @@ void NodeOperation::init_data() { /* Pass. */ } -void NodeOperation::initExecution() +void NodeOperation::init_execution() { /* pass */ } -void NodeOperation::initMutex() +void NodeOperation::init_mutex() { BLI_mutex_init(&mutex_); } -void NodeOperation::lockMutex() +void NodeOperation::lock_mutex() { BLI_mutex_lock(&mutex_); } -void NodeOperation::unlockMutex() +void NodeOperation::unlock_mutex() { BLI_mutex_unlock(&mutex_); } -void NodeOperation::deinitMutex() +void NodeOperation::deinit_mutex() { BLI_mutex_end(&mutex_); } -void NodeOperation::deinitExecution() +void NodeOperation::deinit_execution() { /* pass */ } @@ -223,48 +223,48 @@ void NodeOperation::unset_canvas() flags.is_canvas_set = false; } -SocketReader *NodeOperation::getInputSocketReader(unsigned int inputSocketIndex) +SocketReader *NodeOperation::get_input_socket_reader(unsigned int index) { - return this->getInputSocket(inputSocketIndex)->getReader(); + return this->get_input_socket(index)->get_reader(); } -NodeOperation *NodeOperation::getInputOperation(unsigned int inputSocketIndex) +NodeOperation *NodeOperation::get_input_operation(int index) { - NodeOperationInput *input = getInputSocket(inputSocketIndex); - if (input && input->isConnected()) { - return &input->getLink()->getOperation(); + NodeOperationInput *input = get_input_socket(index); + if (input && input->is_connected()) { + return &input->get_link()->get_operation(); } return nullptr; } -bool NodeOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool NodeOperation::determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) { if (inputs_.size() == 0) { BLI_rcti_init(output, input->xmin, input->xmax, input->ymin, input->ymax); return false; } - rcti tempOutput; + rcti temp_output; bool first = true; - for (int i = 0; i < getNumberOfInputSockets(); i++) { - NodeOperation *inputOperation = this->getInputOperation(i); - if (inputOperation && - inputOperation->determineDependingAreaOfInterest(input, readOperation, &tempOutput)) { + for (int i = 0; i < get_number_of_input_sockets(); i++) { + NodeOperation *input_operation = this->get_input_operation(i); + if (input_operation && input_operation->determine_depending_area_of_interest( + input, read_operation, &temp_output)) { if (first) { - output->xmin = tempOutput.xmin; - output->ymin = tempOutput.ymin; - output->xmax = tempOutput.xmax; - output->ymax = tempOutput.ymax; + output->xmin = temp_output.xmin; + output->ymin = temp_output.ymin; + output->xmax = temp_output.xmax; + output->ymax = temp_output.ymax; first = false; } else { - output->xmin = MIN2(output->xmin, tempOutput.xmin); - output->ymin = MIN2(output->ymin, tempOutput.ymin); - output->xmax = MAX2(output->xmax, tempOutput.xmax); - output->ymax = MAX2(output->ymax, tempOutput.ymax); + output->xmin = MIN2(output->xmin, temp_output.xmin); + output->ymin = MIN2(output->ymin, temp_output.ymin); + output->xmax = MAX2(output->xmax, temp_output.xmax); + output->ymax = MAX2(output->ymax, temp_output.ymax); } } } @@ -297,7 +297,7 @@ void NodeOperation::get_area_of_interest(const int input_idx, else { /* Non full-frame operations never implement this method. To ensure correctness assume * whole area is used. */ - NodeOperation *input_op = getInputOperation(input_idx); + NodeOperation *input_op = get_input_operation(input_idx); r_input_area = input_op->get_canvas(); } } @@ -306,8 +306,8 @@ void NodeOperation::get_area_of_interest(NodeOperation *input_op, const rcti &output_area, rcti &r_input_area) { - for (int i = 0; i < getNumberOfInputSockets(); i++) { - if (input_op == getInputOperation(i)) { + for (int i = 0; i < get_number_of_input_sockets(); i++) { + if (input_op == get_input_operation(i)) { get_area_of_interest(i, output_area, r_input_area); return; } @@ -340,11 +340,11 @@ void NodeOperation::render_full_frame(MemoryBuffer *output_buf, Span<rcti> areas, Span<MemoryBuffer *> inputs_bufs) { - initExecution(); + init_execution(); for (const rcti &area : areas) { update_memory_buffer(output_buf, area, inputs_bufs); } - deinitExecution(); + deinit_execution(); } /** @@ -356,18 +356,18 @@ void NodeOperation::render_full_frame_fallback(MemoryBuffer *output_buf, { Vector<NodeOperationOutput *> orig_input_links = replace_inputs_with_buffers(inputs_bufs); - initExecution(); - const bool is_output_operation = getNumberOfOutputSockets() == 0; + init_execution(); + const bool is_output_operation = get_number_of_output_sockets() == 0; if (!is_output_operation && output_buf->is_a_single_elem()) { float *output_elem = output_buf->get_elem(0, 0); - readSampled(output_elem, 0, 0, PixelSampler::Nearest); + read_sampled(output_elem, 0, 0, PixelSampler::Nearest); } else { for (const rcti &rect : areas) { exec_system_->execute_work(rect, [=](const rcti &split_rect) { rcti tile_rect = split_rect; if (is_output_operation) { - executeRegion(&tile_rect, 0); + execute_region(&tile_rect, 0); } else { render_tile(output_buf, &tile_rect); @@ -375,7 +375,7 @@ void NodeOperation::render_full_frame_fallback(MemoryBuffer *output_buf, }); } } - deinitExecution(); + deinit_execution(); remove_buffers_and_restore_original_inputs(orig_input_links); } @@ -383,7 +383,7 @@ void NodeOperation::render_full_frame_fallback(MemoryBuffer *output_buf, void NodeOperation::render_tile(MemoryBuffer *output_buf, rcti *tile_rect) { const bool is_complex = get_flags().complex; - void *tile_data = is_complex ? initializeTileData(tile_rect) : nullptr; + void *tile_data = is_complex ? initialize_tile_data(tile_rect) : nullptr; const int elem_stride = output_buf->elem_stride; for (int y = tile_rect->ymin; y < tile_rect->ymax; y++) { float *output_elem = output_buf->get_elem(tile_rect->xmin, y); @@ -395,13 +395,13 @@ void NodeOperation::render_tile(MemoryBuffer *output_buf, rcti *tile_rect) } else { for (int x = tile_rect->xmin; x < tile_rect->xmax; x++) { - readSampled(output_elem, x, y, PixelSampler::Nearest); + read_sampled(output_elem, x, y, PixelSampler::Nearest); output_elem += elem_stride; } } } if (tile_data) { - deinitializeTileData(tile_rect, tile_data); + deinitialize_tile_data(tile_rect, tile_data); } } @@ -411,14 +411,15 @@ void NodeOperation::render_tile(MemoryBuffer *output_buf, rcti *tile_rect) Vector<NodeOperationOutput *> NodeOperation::replace_inputs_with_buffers( Span<MemoryBuffer *> inputs_bufs) { - BLI_assert(inputs_bufs.size() == getNumberOfInputSockets()); + BLI_assert(inputs_bufs.size() == get_number_of_input_sockets()); Vector<NodeOperationOutput *> orig_links(inputs_bufs.size()); for (int i = 0; i < inputs_bufs.size(); i++) { - NodeOperationInput *input_socket = getInputSocket(i); - BufferOperation *buffer_op = new BufferOperation(inputs_bufs[i], input_socket->getDataType()); - orig_links[i] = input_socket->getLink(); - input_socket->setLink(buffer_op->getOutputSocket()); - buffer_op->initExecution(); + NodeOperationInput *input_socket = get_input_socket(i); + BufferOperation *buffer_op = new BufferOperation(inputs_bufs[i], + input_socket->get_data_type()); + orig_links[i] = input_socket->get_link(); + input_socket->set_link(buffer_op->get_output_socket()); + buffer_op->init_execution(); } return orig_links; } @@ -426,14 +427,14 @@ Vector<NodeOperationOutput *> NodeOperation::replace_inputs_with_buffers( void NodeOperation::remove_buffers_and_restore_original_inputs( Span<NodeOperationOutput *> original_inputs_links) { - BLI_assert(original_inputs_links.size() == getNumberOfInputSockets()); + BLI_assert(original_inputs_links.size() == get_number_of_input_sockets()); for (int i = 0; i < original_inputs_links.size(); i++) { NodeOperation *buffer_op = get_input_operation(i); BLI_assert(buffer_op != nullptr); BLI_assert(typeid(*buffer_op) == typeid(BufferOperation)); - buffer_op->deinitExecution(); - NodeOperationInput *input_socket = getInputSocket(i); - input_socket->setLink(original_inputs_links[i]); + buffer_op->deinit_execution(); + NodeOperationInput *input_socket = get_input_socket(i); + input_socket->set_link(original_inputs_links[i]); delete buffer_op; } } @@ -444,15 +445,17 @@ void NodeOperation::remove_buffers_and_restore_original_inputs( **** OpInput **** *****************/ -NodeOperationInput::NodeOperationInput(NodeOperation *op, DataType datatype, ResizeMode resizeMode) - : operation_(op), datatype_(datatype), resizeMode_(resizeMode), link_(nullptr) +NodeOperationInput::NodeOperationInput(NodeOperation *op, + DataType datatype, + ResizeMode resize_mode) + : operation_(op), datatype_(datatype), resize_mode_(resize_mode), link_(nullptr) { } -SocketReader *NodeOperationInput::getReader() +SocketReader *NodeOperationInput::get_reader() { - if (isConnected()) { - return &link_->getOperation(); + if (is_connected()) { + return &link_->get_operation(); } return nullptr; @@ -481,7 +484,7 @@ NodeOperationOutput::NodeOperationOutput(NodeOperation *op, DataType datatype) void NodeOperationOutput::determine_canvas(const rcti &preferred_area, rcti &r_area) { - NodeOperation &operation = getOperation(); + NodeOperation &operation = get_operation(); if (operation.get_flags().is_canvas_set) { r_area = operation.get_canvas(); } @@ -558,9 +561,9 @@ std::ostream &operator<<(std::ostream &os, const NodeOperation &node_operation) os << ",flags={" << flags << "}"; if (flags.is_read_buffer_operation) { const ReadBufferOperation *read_operation = (const ReadBufferOperation *)&node_operation; - const MemoryProxy *proxy = read_operation->getMemoryProxy(); + const MemoryProxy *proxy = read_operation->get_memory_proxy(); if (proxy) { - const WriteBufferOperation *write_operation = proxy->getWriteBufferOperation(); + const WriteBufferOperation *write_operation = proxy->get_write_buffer_operation(); if (write_operation) { os << ",write=" << (NodeOperation &)*write_operation; } diff --git a/source/blender/compositor/intern/COM_NodeOperation.h b/source/blender/compositor/intern/COM_NodeOperation.h index af9d62b4276..3c172faca50 100644 --- a/source/blender/compositor/intern/COM_NodeOperation.h +++ b/source/blender/compositor/intern/COM_NodeOperation.h @@ -91,7 +91,7 @@ class NodeOperationInput { DataType datatype_; /** Resize mode of this socket */ - ResizeMode resizeMode_; + ResizeMode resize_mode_; /** Connected output */ NodeOperationOutput *link_; @@ -99,40 +99,40 @@ class NodeOperationInput { public: NodeOperationInput(NodeOperation *op, DataType datatype, - ResizeMode resizeMode = ResizeMode::Center); + ResizeMode resize_mode = ResizeMode::Center); - NodeOperation &getOperation() const + NodeOperation &get_operation() const { return *operation_; } - DataType getDataType() const + DataType get_data_type() const { return datatype_; } - void setLink(NodeOperationOutput *link) + void set_link(NodeOperationOutput *link) { link_ = link; } - NodeOperationOutput *getLink() const + NodeOperationOutput *get_link() const { return link_; } - bool isConnected() const + bool is_connected() const { return link_; } - void setResizeMode(ResizeMode resizeMode) + void set_resize_mode(ResizeMode resize_mode) { - resizeMode_ = resizeMode; + resize_mode_ = resize_mode; } - ResizeMode getResizeMode() const + ResizeMode get_resize_mode() const { - return resizeMode_; + return resize_mode_; } - SocketReader *getReader(); + SocketReader *get_reader(); bool determine_canvas(const rcti &preferred_area, rcti &r_area); @@ -153,11 +153,11 @@ class NodeOperationOutput { public: NodeOperationOutput(NodeOperation *op, DataType datatype); - NodeOperation &getOperation() const + NodeOperation &get_operation() const { return *operation_; } - DataType getDataType() const + DataType get_data_type() const { return datatype_; } @@ -334,9 +334,9 @@ class NodeOperation { * \note only use when you really know what you are doing. * this mutex is used to share data among chunks in the same operation * \see TonemapOperation for an example of usage - * \see NodeOperation.initMutex initializes this mutex - * \see NodeOperation.deinitMutex deinitializes this mutex - * \see NodeOperation.getMutex retrieve a pointer to this mutex. + * \see NodeOperation.init_mutex initializes this mutex + * \see NodeOperation.deinit_mutex deinitializes this mutex + * \see NodeOperation.get_mutex retrieve a pointer to this mutex. */ ThreadMutex mutex_; @@ -395,28 +395,23 @@ class NodeOperation { std::optional<NodeOperationHash> generate_hash(); - unsigned int getNumberOfInputSockets() const + unsigned int get_number_of_input_sockets() const { return inputs_.size(); } - unsigned int getNumberOfOutputSockets() const + unsigned int get_number_of_output_sockets() const { return outputs_.size(); } - NodeOperationOutput *getOutputSocket(unsigned int index = 0); - NodeOperationInput *getInputSocket(unsigned int index); + NodeOperationOutput *get_output_socket(unsigned int index = 0); + NodeOperationInput *get_input_socket(unsigned int index); - NodeOperation *get_input_operation(int index) - { - /* TODO: Rename protected getInputOperation to get_input_operation and make it public replacing - * this method. */ - return getInputOperation(index); - } + NodeOperation *get_input_operation(int index); virtual void determine_canvas(const rcti &preferred_area, rcti &r_area); /** - * \brief isOutputOperation determines whether this operation is an output of the + * \brief is_output_operation 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 @@ -430,7 +425,7 @@ class NodeOperation { * * \return bool the result of this method */ - virtual bool isOutputOperation(bool /*rendering*/) const + virtual bool is_output_operation(bool /*rendering*/) const { return false; } @@ -440,7 +435,7 @@ class NodeOperation { execution_model_ = model; } - void setbNodeTree(const bNodeTree *tree) + void set_bnodetree(const bNodeTree *tree) { btree_ = tree; } @@ -452,20 +447,20 @@ class NodeOperation { /** * Initializes operation data needed after operations are linked and resolutions determined. For - * rendering heap memory data use initExecution(). + * rendering heap memory data use init_execution(). */ virtual void init_data(); - virtual void initExecution(); + virtual void init_execution(); /** * \brief when a chunk is executed by a CPUDevice, this method is called * \ingroup execution * \param rect: the rectangle of the chunk (location and size) - * \param chunkNumber: the chunkNumber to be calculated - * \param memoryBuffers: all input MemoryBuffer's needed + * \param chunk_number: the chunk_number to be calculated + * \param memory_buffers: all input MemoryBuffer's needed */ - virtual void executeRegion(rcti * /*rect*/, unsigned int /*chunkNumber*/) + virtual void execute_region(rcti * /*rect*/, unsigned int /*chunk_number*/) { } @@ -477,15 +472,15 @@ class NodeOperation { * \param program: the OpenCL program containing all compositor kernels * \param queue: the OpenCL command queue of the device the chunk is executed on * \param rect: the rectangle of the chunk (location and size) - * \param chunkNumber: the chunkNumber to be calculated - * \param memoryBuffers: all input MemoryBuffer's needed - * \param outputBuffer: the outputbuffer to write to + * \param chunk_number: the chunk_number to be calculated + * \param memory_buffers: all input MemoryBuffer's needed + * \param output_buffer: the outputbuffer to write to */ - virtual void executeOpenCLRegion(OpenCLDevice * /*device*/, - rcti * /*rect*/, - unsigned int /*chunkNumber*/, - MemoryBuffer ** /*memoryBuffers*/, - MemoryBuffer * /*outputBuffer*/) + virtual void execute_opencl_region(OpenCLDevice * /*device*/, + rcti * /*rect*/, + unsigned int /*chunk_number*/, + MemoryBuffer ** /*memory_buffers*/, + MemoryBuffer * /*output_buffer*/) { } @@ -496,23 +491,23 @@ class NodeOperation { * \param context: the OpenCL context * \param program: the OpenCL program containing all compositor kernels * \param queue: the OpenCL command queue of the device the chunk is executed on - * \param outputMemoryBuffer: the allocated memory buffer in main CPU memory - * \param clOutputBuffer: the allocated memory buffer in OpenCLDevice memory - * \param inputMemoryBuffers: all input MemoryBuffer's needed - * \param clMemToCleanUp: all created cl_mem references must be added to this list. + * \param output_memory_buffer: the allocated memory buffer in main CPU memory + * \param cl_output_buffer: the allocated memory buffer in OpenCLDevice memory + * \param input_memory_buffers: all input MemoryBuffer's needed + * \param cl_mem_to_clean_up: all created cl_mem references must be added to this list. * Framework will clean this after execution - * \param clKernelsToCleanUp: all created cl_kernel references must be added to this list. + * \param cl_kernels_to_clean_up: all created cl_kernel references must be added to this list. * Framework will clean this after execution */ - virtual void executeOpenCL(OpenCLDevice * /*device*/, - MemoryBuffer * /*outputMemoryBuffer*/, - cl_mem /*clOutputBuffer*/, - MemoryBuffer ** /*inputMemoryBuffers*/, - std::list<cl_mem> * /*clMemToCleanUp*/, - std::list<cl_kernel> * /*clKernelsToCleanUp*/) + virtual void execute_opencl(OpenCLDevice * /*device*/, + MemoryBuffer * /*output_memory_buffer*/, + cl_mem /*cl_output_buffer*/, + MemoryBuffer ** /*input_memory_buffers*/, + std::list<cl_mem> * /*cl_mem_to_clean_up*/, + std::list<cl_kernel> * /*cl_kernels_to_clean_up*/) { } - virtual void deinitExecution(); + virtual void deinit_execution(); void set_canvas(const rcti &canvas_area); const rcti &get_canvas() const; @@ -525,14 +520,14 @@ class NodeOperation { * \return [true:false] * \see BaseViewerOperation */ - virtual bool isActiveViewerOutput() const + virtual bool is_active_viewer_output() const { return false; } - virtual bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output); + virtual bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output); /** * \brief set the index of the input socket that will determine the canvas of this @@ -554,58 +549,58 @@ class NodeOperation { * \note only applicable for output operations like ViewerOperation * \return eCompositorPriority */ - virtual eCompositorPriority getRenderPriority() const + virtual eCompositorPriority get_render_priority() const { return eCompositorPriority::Low; } - inline bool isBraked() const + inline bool is_braked() const { return btree_->test_break(btree_->tbh); } - inline void updateDraw() + inline void update_draw() { if (btree_->update_draw) { btree_->update_draw(btree_->udh); } } - unsigned int getWidth() const + unsigned int get_width() const { return BLI_rcti_size_x(&get_canvas()); } - unsigned int getHeight() const + unsigned int get_height() const { return BLI_rcti_size_y(&get_canvas()); } - inline void readSampled(float result[4], float x, float y, PixelSampler sampler) + inline void read_sampled(float result[4], float x, float y, PixelSampler sampler) { - executePixelSampled(result, x, y, sampler); + execute_pixel_sampled(result, x, y, sampler); } - inline void readFiltered(float result[4], float x, float y, float dx[2], float dy[2]) + inline void read_filtered(float result[4], float x, float y, float dx[2], float dy[2]) { - executePixelFiltered(result, x, y, dx, dy); + execute_pixel_filtered(result, x, y, dx, dy); } - inline void read(float result[4], int x, int y, void *chunkData) + inline void read(float result[4], int x, int y, void *chunk_data) { - executePixel(result, x, y, chunkData); + execute_pixel(result, x, y, chunk_data); } - virtual void *initializeTileData(rcti * /*rect*/) + virtual void *initialize_tile_data(rcti * /*rect*/) { return 0; } - virtual void deinitializeTileData(rcti * /*rect*/, void * /*data*/) + virtual void deinitialize_tile_data(rcti * /*rect*/, void * /*data*/) { } - virtual MemoryBuffer *getInputMemoryBuffer(MemoryBuffer ** /*memoryBuffers*/) + virtual MemoryBuffer *get_input_memory_buffer(MemoryBuffer ** /*memory_buffers*/) { return 0; } @@ -614,7 +609,7 @@ class NodeOperation { * Return the meta data associated with this branch. * * The return parameter holds an instance or is an nullptr. */ - virtual std::unique_ptr<MetaData> getMetaData() + virtual std::unique_ptr<MetaData> get_meta_data() { return std::unique_ptr<MetaData>(); } @@ -672,28 +667,27 @@ class NodeOperation { combine_hashes(params_hash_, get_default_hash_3(param1, param2, param3)); } - void addInputSocket(DataType datatype, ResizeMode resize_mode = ResizeMode::Center); - void addOutputSocket(DataType datatype); + void add_input_socket(DataType datatype, ResizeMode resize_mode = ResizeMode::Center); + void add_output_socket(DataType datatype); /* TODO(manzanilla): to be removed with tiled implementation. */ - void setWidth(unsigned int width) + void set_width(unsigned int width) { canvas_.xmax = canvas_.xmin + width; this->flags.is_canvas_set = true; } - void setHeight(unsigned int height) + void set_height(unsigned int height) { canvas_.ymax = canvas_.ymin + height; this->flags.is_canvas_set = true; } - SocketReader *getInputSocketReader(unsigned int inputSocketindex); - NodeOperation *getInputOperation(unsigned int inputSocketindex); + SocketReader *get_input_socket_reader(unsigned int index); - void deinitMutex(); - void initMutex(); - void lockMutex(); - void unlockMutex(); + void deinit_mutex(); + void init_mutex(); + void lock_mutex(); + void unlock_mutex(); /** * \brief set whether this operation is complex @@ -701,7 +695,7 @@ class NodeOperation { * 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. */ - void setComplex(bool complex) + void set_complex(bool complex) { this->flags.complex = complex; } @@ -712,12 +706,12 @@ class NodeOperation { * \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 input_buffers: chunks that can be read by their ReadBufferOperation. */ - virtual void executePixelSampled(float /*output*/[4], - float /*x*/, - float /*y*/, - PixelSampler /*sampler*/) + virtual void execute_pixel_sampled(float /*output*/[4], + float /*x*/, + float /*y*/, + PixelSampler /*sampler*/) { } @@ -727,12 +721,12 @@ class NodeOperation { * \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. + * \param input_buffers: chunks that can be read by their ReadBufferOperation. + * \param chunk_data: chunk specific data a during execution time. */ - virtual void executePixel(float output[4], int x, int y, void * /*chunkData*/) + virtual void execute_pixel(float output[4], int x, int y, void * /*chunk_data*/) { - executePixelSampled(output, x, y, PixelSampler::Nearest); + execute_pixel_sampled(output, x, y, PixelSampler::Nearest); } /** @@ -743,9 +737,9 @@ class NodeOperation { * \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. + * \param input_buffers: chunks that can be read by their ReadBufferOperation. */ - virtual void executePixelFiltered( + virtual void execute_pixel_filtered( float /*output*/[4], float /*x*/, float /*y*/, float /*dx*/[2], float /*dy*/[2]) { } diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.cc b/source/blender/compositor/intern/COM_NodeOperationBuilder.cc index 708bda30636..5dc66fea670 100644 --- a/source/blender/compositor/intern/COM_NodeOperationBuilder.cc +++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.cc @@ -45,7 +45,7 @@ NodeOperationBuilder::NodeOperationBuilder(const CompositorContext *context, graph_.from_bNodeTree(*context, b_nodetree); } -void NodeOperationBuilder::convertToOperations(ExecutionSystem *system) +void NodeOperationBuilder::convert_to_operations(ExecutionSystem *system) { /* interface handle for nodes */ NodeConverter converter(this); @@ -54,7 +54,7 @@ void NodeOperationBuilder::convertToOperations(ExecutionSystem *system) current_node_ = node; DebugInfo::node_to_operations(node); - node->convertToOperations(converter, *context_); + node->convert_to_operations(converter, *context_); } current_node_ = nullptr; @@ -86,7 +86,7 @@ void NodeOperationBuilder::convertToOperations(ExecutionSystem *system) } for (NodeOperationInput *op_to : op_to_list) { - addLink(op_from, op_to); + add_link(op_from, op_to); } } @@ -130,12 +130,12 @@ void NodeOperationBuilder::convertToOperations(ExecutionSystem *system) system->set_operations(operations_, groups_); } -void NodeOperationBuilder::addOperation(NodeOperation *operation) +void NodeOperationBuilder::add_operation(NodeOperation *operation) { operation->set_id(operations_.size()); operations_.append(operation); if (current_node_) { - operation->set_name(current_node_->getbNode()->name); + operation->set_name(current_node_->get_bnode()->name); } operation->set_execution_model(context_->get_execution_model()); operation->set_execution_system(exec_system_); @@ -144,9 +144,9 @@ void NodeOperationBuilder::addOperation(NodeOperation *operation) void NodeOperationBuilder::replace_operation_with_constant(NodeOperation *operation, ConstantOperation *constant_operation) { - BLI_assert(constant_operation->getNumberOfInputSockets() == 0); + BLI_assert(constant_operation->get_number_of_input_sockets() == 0); unlink_inputs_and_relink_outputs(operation, constant_operation); - addOperation(constant_operation); + add_operation(constant_operation); } void NodeOperationBuilder::unlink_inputs_and_relink_outputs(NodeOperation *unlinked_op, @@ -155,61 +155,61 @@ void NodeOperationBuilder::unlink_inputs_and_relink_outputs(NodeOperation *unlin int i = 0; while (i < links_.size()) { Link &link = links_[i]; - if (&link.to()->getOperation() == unlinked_op) { - link.to()->setLink(nullptr); + if (&link.to()->get_operation() == unlinked_op) { + link.to()->set_link(nullptr); links_.remove(i); continue; } - if (&link.from()->getOperation() == unlinked_op) { - link.to()->setLink(linked_op->getOutputSocket()); - links_[i] = Link(linked_op->getOutputSocket(), link.to()); + if (&link.from()->get_operation() == unlinked_op) { + link.to()->set_link(linked_op->get_output_socket()); + links_[i] = Link(linked_op->get_output_socket(), link.to()); } i++; } } -void NodeOperationBuilder::mapInputSocket(NodeInput *node_socket, - NodeOperationInput *operation_socket) +void NodeOperationBuilder::map_input_socket(NodeInput *node_socket, + NodeOperationInput *operation_socket) { BLI_assert(current_node_); - BLI_assert(node_socket->getNode() == current_node_); + BLI_assert(node_socket->get_node() == current_node_); /* NOTE: this maps operation sockets to node sockets. - * for resolving links the map will be inverted first in convertToOperations, + * for resolving links the map will be inverted first in convert_to_operations, * to get a list of links for each node input socket. */ input_map_.add_new(operation_socket, node_socket); } -void NodeOperationBuilder::mapOutputSocket(NodeOutput *node_socket, - NodeOperationOutput *operation_socket) +void NodeOperationBuilder::map_output_socket(NodeOutput *node_socket, + NodeOperationOutput *operation_socket) { BLI_assert(current_node_); - BLI_assert(node_socket->getNode() == current_node_); + BLI_assert(node_socket->get_node() == current_node_); output_map_.add_new(node_socket, operation_socket); } -void NodeOperationBuilder::addLink(NodeOperationOutput *from, NodeOperationInput *to) +void NodeOperationBuilder::add_link(NodeOperationOutput *from, NodeOperationInput *to) { - if (to->isConnected()) { + if (to->is_connected()) { return; } links_.append(Link(from, to)); /* register with the input */ - to->setLink(from); + to->set_link(from); } -void NodeOperationBuilder::removeInputLink(NodeOperationInput *to) +void NodeOperationBuilder::remove_input_link(NodeOperationInput *to) { int index = 0; for (Link &link : links_) { if (link.to() == to) { /* unregister with the input */ - to->setLink(nullptr); + to->set_link(nullptr); links_.remove(index); return; @@ -222,67 +222,67 @@ PreviewOperation *NodeOperationBuilder::make_preview_operation() const { BLI_assert(current_node_); - if (!(current_node_->getbNode()->flag & NODE_PREVIEW)) { + if (!(current_node_->get_bnode()->flag & NODE_PREVIEW)) { return nullptr; } /* previews only in the active group */ - if (!current_node_->isInActiveGroup()) { + if (!current_node_->is_in_active_group()) { return nullptr; } /* do not calculate previews of hidden nodes */ - if (current_node_->getbNode()->flag & NODE_HIDDEN) { + if (current_node_->get_bnode()->flag & NODE_HIDDEN) { return nullptr; } - bNodeInstanceHash *previews = context_->getPreviewHash(); + bNodeInstanceHash *previews = context_->get_preview_hash(); if (previews) { - PreviewOperation *operation = new PreviewOperation(context_->getViewSettings(), - context_->getDisplaySettings(), - current_node_->getbNode()->preview_xsize, - current_node_->getbNode()->preview_ysize); - operation->setbNodeTree(context_->getbNodeTree()); - operation->verifyPreview(previews, current_node_->getInstanceKey()); + PreviewOperation *operation = new PreviewOperation(context_->get_view_settings(), + context_->get_display_settings(), + current_node_->get_bnode()->preview_xsize, + current_node_->get_bnode()->preview_ysize); + operation->set_bnodetree(context_->get_bnodetree()); + operation->verify_preview(previews, current_node_->get_instance_key()); return operation; } return nullptr; } -void NodeOperationBuilder::addPreview(NodeOperationOutput *output) +void NodeOperationBuilder::add_preview(NodeOperationOutput *output) { PreviewOperation *operation = make_preview_operation(); if (operation) { - addOperation(operation); + add_operation(operation); - addLink(output, operation->getInputSocket(0)); + add_link(output, operation->get_input_socket(0)); } } -void NodeOperationBuilder::addNodeInputPreview(NodeInput *input) +void NodeOperationBuilder::add_node_input_preview(NodeInput *input) { PreviewOperation *operation = make_preview_operation(); if (operation) { - addOperation(operation); + add_operation(operation); - mapInputSocket(input, operation->getInputSocket(0)); + map_input_socket(input, operation->get_input_socket(0)); } } -void NodeOperationBuilder::registerViewer(ViewerOperation *viewer) +void NodeOperationBuilder::register_viewer(ViewerOperation *viewer) { if (active_viewer_) { - if (current_node_->isInActiveGroup()) { + if (current_node_->is_in_active_group()) { /* deactivate previous viewer */ - active_viewer_->setActive(false); + active_viewer_->set_active(false); active_viewer_ = viewer; - viewer->setActive(true); + viewer->set_active(true); } } else { - if (current_node_->getbNodeTree() == context_->getbNodeTree()) { + if (current_node_->get_bnodetree() == context_->get_bnodetree()) { active_viewer_ = viewer; - viewer->setActive(true); + viewer->set_active(true); } } } @@ -296,25 +296,25 @@ void NodeOperationBuilder::add_datatype_conversions() Vector<Link> convert_links; for (const Link &link : links_) { /* proxy operations can skip data type conversion */ - NodeOperation *from_op = &link.from()->getOperation(); - NodeOperation *to_op = &link.to()->getOperation(); + NodeOperation *from_op = &link.from()->get_operation(); + NodeOperation *to_op = &link.to()->get_operation(); if (!(from_op->get_flags().use_datatype_conversion || to_op->get_flags().use_datatype_conversion)) { continue; } - if (link.from()->getDataType() != link.to()->getDataType()) { + if (link.from()->get_data_type() != link.to()->get_data_type()) { convert_links.append(link); } } for (const Link &link : convert_links) { NodeOperation *converter = COM_convert_data_type(*link.from(), *link.to()); if (converter) { - addOperation(converter); + add_operation(converter); - removeInputLink(link.to()); - addLink(link.from(), converter->getInputSocket(0)); - addLink(converter->getOutputSocket(0), link.to()); + remove_input_link(link.to()); + add_link(link.from(), converter->get_input_socket(0)); + add_link(converter->get_output_socket(0), link.to()); } } } @@ -326,9 +326,9 @@ void NodeOperationBuilder::add_operation_input_constants() */ Vector<NodeOperationInput *> pending_inputs; for (NodeOperation *op : operations_) { - for (int k = 0; k < op->getNumberOfInputSockets(); ++k) { - NodeOperationInput *input = op->getInputSocket(k); - if (!input->isConnected()) { + for (int k = 0; k < op->get_number_of_input_sockets(); ++k) { + NodeOperationInput *input = op->get_input_socket(k); + if (!input->is_connected()) { pending_inputs.append(input); } } @@ -341,50 +341,50 @@ void NodeOperationBuilder::add_operation_input_constants() void NodeOperationBuilder::add_input_constant_value(NodeOperationInput *input, const NodeInput *node_input) { - switch (input->getDataType()) { + switch (input->get_data_type()) { case DataType::Value: { float value; - if (node_input && node_input->getbNodeSocket()) { - value = node_input->getEditorValueFloat(); + if (node_input && node_input->get_bnode_socket()) { + value = node_input->get_editor_value_float(); } else { value = 0.0f; } SetValueOperation *op = new SetValueOperation(); - op->setValue(value); - addOperation(op); - addLink(op->getOutputSocket(), input); + op->set_value(value); + add_operation(op); + add_link(op->get_output_socket(), input); break; } case DataType::Color: { float value[4]; - if (node_input && node_input->getbNodeSocket()) { - node_input->getEditorValueColor(value); + if (node_input && node_input->get_bnode_socket()) { + node_input->get_editor_value_color(value); } else { zero_v4(value); } SetColorOperation *op = new SetColorOperation(); - op->setChannels(value); - addOperation(op); - addLink(op->getOutputSocket(), input); + op->set_channels(value); + add_operation(op); + add_link(op->get_output_socket(), input); break; } case DataType::Vector: { float value[3]; - if (node_input && node_input->getbNodeSocket()) { - node_input->getEditorValueVector(value); + if (node_input && node_input->get_bnode_socket()) { + node_input->get_editor_value_vector(value); } else { zero_v3(value); } SetVectorOperation *op = new SetVectorOperation(); - op->setVector(value); - addOperation(op); - addLink(op->getOutputSocket(), input); + op->set_vector(value); + add_operation(op); + add_link(op->get_output_socket(), input); break; } } @@ -395,8 +395,8 @@ void NodeOperationBuilder::resolve_proxies() Vector<Link> proxy_links; for (const Link &link : links_) { /* don't replace links from proxy to proxy, since we may need them for replacing others! */ - if (link.from()->getOperation().get_flags().is_proxy_operation && - !link.to()->getOperation().get_flags().is_proxy_operation) { + if (link.from()->get_operation().get_flags().is_proxy_operation && + !link.to()->get_operation().get_flags().is_proxy_operation) { proxy_links.append(link); } } @@ -406,15 +406,15 @@ void NodeOperationBuilder::resolve_proxies() NodeOperationOutput *from = link.from(); do { /* walk upstream bypassing the proxy operation */ - from = from->getOperation().getInputSocket(0)->getLink(); - } while (from && from->getOperation().get_flags().is_proxy_operation); + from = from->get_operation().get_input_socket(0)->get_link(); + } while (from && from->get_operation().get_flags().is_proxy_operation); - removeInputLink(to); + remove_input_link(to); /* we may not have a final proxy input link, * in that case it just gets dropped */ if (from) { - addLink(from, to); + add_link(from, to); } } } @@ -424,7 +424,8 @@ void NodeOperationBuilder::determine_canvases() /* Determine all canvas areas of the operations. */ const rcti &preferred_area = COM_AREA_NONE; for (NodeOperation *op : operations_) { - if (op->isOutputOperation(context_->isRendering()) && !op->get_flags().is_preview_operation) { + if (op->is_output_operation(context_->is_rendering()) && + !op->get_flags().is_preview_operation) { rcti canvas = COM_AREA_NONE; op->determine_canvas(preferred_area, canvas); op->set_canvas(canvas); @@ -432,7 +433,8 @@ void NodeOperationBuilder::determine_canvases() } for (NodeOperation *op : operations_) { - if (op->isOutputOperation(context_->isRendering()) && op->get_flags().is_preview_operation) { + if (op->is_output_operation(context_->is_rendering()) && + op->get_flags().is_preview_operation) { rcti canvas = COM_AREA_NONE; op->determine_canvas(preferred_area, canvas); op->set_canvas(canvas); @@ -443,12 +445,12 @@ void NodeOperationBuilder::determine_canvases() { Vector<Link> convert_links; for (const Link &link : links_) { - if (link.to()->getResizeMode() != ResizeMode::None) { - const rcti &from_canvas = link.from()->getOperation().get_canvas(); - const rcti &to_canvas = link.to()->getOperation().get_canvas(); + if (link.to()->get_resize_mode() != ResizeMode::None) { + const rcti &from_canvas = link.from()->get_operation().get_canvas(); + const rcti &to_canvas = link.to()->get_operation().get_canvas(); bool needs_conversion; - if (link.to()->getResizeMode() == ResizeMode::Align) { + if (link.to()->get_resize_mode() == ResizeMode::Align) { needs_conversion = from_canvas.xmin != to_canvas.xmin || from_canvas.ymin != to_canvas.ymin; } @@ -528,7 +530,7 @@ WriteBufferOperation *NodeOperationBuilder::find_attached_write_buffer_operation { for (const Link &link : links_) { if (link.from() == output) { - NodeOperation &op = link.to()->getOperation(); + NodeOperation &op = link.to()->get_operation(); if (op.get_flags().is_write_buffer_operation) { return (WriteBufferOperation *)(&op); } @@ -540,39 +542,39 @@ WriteBufferOperation *NodeOperationBuilder::find_attached_write_buffer_operation void NodeOperationBuilder::add_input_buffers(NodeOperation * /*operation*/, NodeOperationInput *input) { - if (!input->isConnected()) { + if (!input->is_connected()) { return; } - NodeOperationOutput *output = input->getLink(); - if (output->getOperation().get_flags().is_read_buffer_operation) { + NodeOperationOutput *output = input->get_link(); + if (output->get_operation().get_flags().is_read_buffer_operation) { /* input is already buffered, no need to add another */ return; } /* this link will be replaced below */ - removeInputLink(input); + remove_input_link(input); /* check of other end already has write operation, otherwise add a new one */ WriteBufferOperation *writeoperation = find_attached_write_buffer_operation(output); if (!writeoperation) { - writeoperation = new WriteBufferOperation(output->getDataType()); - writeoperation->setbNodeTree(context_->getbNodeTree()); - addOperation(writeoperation); + writeoperation = new WriteBufferOperation(output->get_data_type()); + writeoperation->set_bnodetree(context_->get_bnodetree()); + add_operation(writeoperation); - addLink(output, writeoperation->getInputSocket(0)); + add_link(output, writeoperation->get_input_socket(0)); - writeoperation->readResolutionFromInputSocket(); + writeoperation->read_resolution_from_input_socket(); } /* add readbuffer op for the input */ - ReadBufferOperation *readoperation = new ReadBufferOperation(output->getDataType()); - readoperation->setMemoryProxy(writeoperation->getMemoryProxy()); - this->addOperation(readoperation); + ReadBufferOperation *readoperation = new ReadBufferOperation(output->get_data_type()); + readoperation->set_memory_proxy(writeoperation->get_memory_proxy()); + this->add_operation(readoperation); - addLink(readoperation->getOutputSocket(), input); + add_link(readoperation->get_output_socket(), input); - readoperation->readResolutionFromWriteBuffer(); + readoperation->read_resolution_from_write_buffer(); } void NodeOperationBuilder::add_output_buffers(NodeOperation *operation, @@ -584,44 +586,44 @@ void NodeOperationBuilder::add_output_buffers(NodeOperation *operation, return; } - WriteBufferOperation *writeOperation = nullptr; + WriteBufferOperation *write_operation = nullptr; for (NodeOperationInput *target : targets) { /* try to find existing write buffer operation */ - 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()); + if (target->get_operation().get_flags().is_write_buffer_operation) { + BLI_assert(write_operation == nullptr); /* there should only be one write op connected */ + write_operation = (WriteBufferOperation *)(&target->get_operation()); } else { /* remove all links to other nodes */ - removeInputLink(target); + remove_input_link(target); } } /* if no write buffer operation exists yet, create a new one */ - if (!writeOperation) { - writeOperation = new WriteBufferOperation(operation->getOutputSocket()->getDataType()); - writeOperation->setbNodeTree(context_->getbNodeTree()); - addOperation(writeOperation); + if (!write_operation) { + write_operation = new WriteBufferOperation(operation->get_output_socket()->get_data_type()); + write_operation->set_bnodetree(context_->get_bnodetree()); + add_operation(write_operation); - addLink(output, writeOperation->getInputSocket(0)); + add_link(output, write_operation->get_input_socket(0)); } - writeOperation->readResolutionFromInputSocket(); + write_operation->read_resolution_from_input_socket(); /* add readbuffer op for every former connected input */ for (NodeOperationInput *target : targets) { - if (&target->getOperation() == writeOperation) { + if (&target->get_operation() == write_operation) { continue; /* skip existing write op links */ } ReadBufferOperation *readoperation = new ReadBufferOperation( - operation->getOutputSocket()->getDataType()); - readoperation->setMemoryProxy(writeOperation->getMemoryProxy()); - addOperation(readoperation); + operation->get_output_socket()->get_data_type()); + readoperation->set_memory_proxy(write_operation->get_memory_proxy()); + add_operation(readoperation); - addLink(readoperation->getOutputSocket(), target); + add_link(readoperation->get_output_socket(), target); - readoperation->readResolutionFromWriteBuffer(); + readoperation->read_resolution_from_write_buffer(); } } @@ -640,12 +642,12 @@ void NodeOperationBuilder::add_complex_operation_buffers() for (NodeOperation *op : complex_ops) { DebugInfo::operation_read_write_buffer(op); - for (int index = 0; index < op->getNumberOfInputSockets(); index++) { - add_input_buffers(op, op->getInputSocket(index)); + for (int index = 0; index < op->get_number_of_input_sockets(); index++) { + add_input_buffers(op, op->get_input_socket(index)); } - for (int index = 0; index < op->getNumberOfOutputSockets(); index++) { - add_output_buffers(op, op->getOutputSocket(index)); + for (int index = 0; index < op->get_number_of_output_sockets(); index++) { + add_output_buffers(op, op->get_output_socket(index)); } } } @@ -659,18 +661,18 @@ static void find_reachable_operations_recursive(Tags &reachable, NodeOperation * } reachable.insert(op); - for (int i = 0; i < op->getNumberOfInputSockets(); i++) { - NodeOperationInput *input = op->getInputSocket(i); - if (input->isConnected()) { - find_reachable_operations_recursive(reachable, &input->getLink()->getOperation()); + for (int i = 0; i < op->get_number_of_input_sockets(); i++) { + NodeOperationInput *input = op->get_input_socket(i); + if (input->is_connected()) { + find_reachable_operations_recursive(reachable, &input->get_link()->get_operation()); } } /* associated write-buffer operations are executed as well */ 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()); + MemoryProxy *memproxy = read_op->get_memory_proxy(); + find_reachable_operations_recursive(reachable, memproxy->get_write_buffer_operation()); } } @@ -679,7 +681,7 @@ void NodeOperationBuilder::prune_operations() Tags reachable; for (NodeOperation *op : operations_) { /* output operations are primary executed operations */ - if (op->isOutputOperation(context_->isRendering())) { + if (op->is_output_operation(context_->is_rendering())) { find_reachable_operations_recursive(reachable, op); } } @@ -708,10 +710,10 @@ static void sort_operations_recursive(Vector<NodeOperation *> &sorted, } visited.insert(op); - for (int i = 0; i < op->getNumberOfInputSockets(); i++) { - NodeOperationInput *input = op->getInputSocket(i); - if (input->isConnected()) { - sort_operations_recursive(sorted, visited, &input->getLink()->getOperation()); + for (int i = 0; i < op->get_number_of_input_sockets(); i++) { + NodeOperationInput *input = op->get_input_socket(i); + if (input->is_connected()) { + sort_operations_recursive(sorted, visited, &input->get_link()->get_operation()); } } @@ -738,15 +740,15 @@ static void add_group_operations_recursive(Tags &visited, NodeOperation *op, Exe } visited.insert(op); - if (!group->addOperation(op)) { + if (!group->add_operation(op)) { return; } /* add all eligible input ops to the group */ - for (int i = 0; i < op->getNumberOfInputSockets(); i++) { - NodeOperationInput *input = op->getInputSocket(i); - if (input->isConnected()) { - add_group_operations_recursive(visited, &input->getLink()->getOperation(), group); + for (int i = 0; i < op->get_number_of_input_sockets(); i++) { + NodeOperationInput *input = op->get_input_socket(i); + if (input->is_connected()) { + add_group_operations_recursive(visited, &input->get_link()->get_operation(), group); } } } @@ -765,19 +767,19 @@ ExecutionGroup *NodeOperationBuilder::make_group(NodeOperation *op) void NodeOperationBuilder::group_operations() { for (NodeOperation *op : operations_) { - if (op->isOutputOperation(context_->isRendering())) { + if (op->is_output_operation(context_->is_rendering())) { ExecutionGroup *group = make_group(op); - group->setOutputExecutionGroup(true); + group->set_output_execution_group(true); } /* add new groups for associated memory proxies where needed */ if (op->get_flags().is_read_buffer_operation) { ReadBufferOperation *read_op = (ReadBufferOperation *)op; - MemoryProxy *memproxy = read_op->getMemoryProxy(); + MemoryProxy *memproxy = read_op->get_memory_proxy(); - if (memproxy->getExecutor() == nullptr) { - ExecutionGroup *group = make_group(memproxy->getWriteBufferOperation()); - memproxy->setExecutor(group); + if (memproxy->get_executor() == nullptr) { + ExecutionGroup *group = make_group(memproxy->get_write_buffer_operation()); + memproxy->set_executor(group); } } } @@ -804,15 +806,15 @@ std::ostream &operator<<(std::ostream &os, const NodeOperationBuilder &builder) os << "\n"; for (const NodeOperationBuilder::Link &link : builder.get_links()) { - os << " op" << link.from()->getOperation().get_id() << " -> op" - << link.to()->getOperation().get_id() << ";\n"; + os << " op" << link.from()->get_operation().get_id() << " -> op" + << link.to()->get_operation().get_id() << ";\n"; } for (const NodeOperation *operation : builder.get_operations()) { if (operation->get_flags().is_read_buffer_operation) { const ReadBufferOperation &read_operation = static_cast<const ReadBufferOperation &>( *operation); const WriteBufferOperation &write_operation = - *read_operation.getMemoryProxy()->getWriteBufferOperation(); + *read_operation.get_memory_proxy()->get_write_buffer_operation(); os << " op" << write_operation.get_id() << " -> op" << read_operation.get_id() << ";\n"; } } @@ -824,7 +826,7 @@ std::ostream &operator<<(std::ostream &os, const NodeOperationBuilder &builder) std::ostream &operator<<(std::ostream &os, const NodeOperationBuilder::Link &link) { - os << link.from()->getOperation().get_id() << " -> " << link.to()->getOperation().get_id(); + os << link.from()->get_operation().get_id() << " -> " << link.to()->get_operation().get_id(); return os; } diff --git a/source/blender/compositor/intern/COM_NodeOperationBuilder.h b/source/blender/compositor/intern/COM_NodeOperationBuilder.h index 21e2f4ce95d..fcb2dd3800e 100644 --- a/source/blender/compositor/intern/COM_NodeOperationBuilder.h +++ b/source/blender/compositor/intern/COM_NodeOperationBuilder.h @@ -96,27 +96,27 @@ class NodeOperationBuilder { return *context_; } - void convertToOperations(ExecutionSystem *system); + void convert_to_operations(ExecutionSystem *system); - void addOperation(NodeOperation *operation); + void add_operation(NodeOperation *operation); void replace_operation_with_constant(NodeOperation *operation, ConstantOperation *constant_operation); /** Map input socket of the current node to an operation socket */ - void mapInputSocket(NodeInput *node_socket, NodeOperationInput *operation_socket); + void map_input_socket(NodeInput *node_socket, NodeOperationInput *operation_socket); /** Map output socket of the current node to an operation socket */ - void mapOutputSocket(NodeOutput *node_socket, NodeOperationOutput *operation_socket); + void map_output_socket(NodeOutput *node_socket, NodeOperationOutput *operation_socket); - void addLink(NodeOperationOutput *from, NodeOperationInput *to); - void removeInputLink(NodeOperationInput *to); + void add_link(NodeOperationOutput *from, NodeOperationInput *to); + void remove_input_link(NodeOperationInput *to); /** Add a preview operation for a operation output */ - void addPreview(NodeOperationOutput *output); + void add_preview(NodeOperationOutput *output); /** Add a preview operation for a node input */ - void addNodeInputPreview(NodeInput *input); + void add_node_input_preview(NodeInput *input); /** Define a viewer operation as the active output, if possible */ - void registerViewer(ViewerOperation *viewer); + void register_viewer(ViewerOperation *viewer); /** The currently active viewer output operation */ ViewerOperation *active_viewer() const { diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.cc b/source/blender/compositor/intern/COM_OpenCLDevice.cc index af55890cba7..9a274abf806 100644 --- a/source/blender/compositor/intern/COM_OpenCLDevice.cc +++ b/source/blender/compositor/intern/COM_OpenCLDevice.cc @@ -40,13 +40,13 @@ const cl_image_format IMAGE_FORMAT_VALUE = { OpenCLDevice::OpenCLDevice(cl_context context, cl_device_id device, cl_program program, - cl_int vendorId) + cl_int vendor_id) { device_ = device; context_ = context; program_ = program; queue_ = nullptr; - vendorID_ = vendorId; + vendor_id_ = vendor_id; cl_int error; queue_ = clCreateCommandQueue(context_, device_, 0, &error); @@ -57,7 +57,7 @@ OpenCLDevice::OpenCLDevice(OpenCLDevice &&other) noexcept device_(other.device_), program_(other.program_), queue_(other.queue_), - vendorID_(other.vendorID_) + vendor_id_(other.vendor_id_) { other.queue_ = nullptr; } @@ -71,37 +71,38 @@ OpenCLDevice::~OpenCLDevice() void OpenCLDevice::execute(WorkPackage *work_package) { - const unsigned int chunkNumber = work_package->chunk_number; - ExecutionGroup *executionGroup = work_package->execution_group; + const unsigned int chunk_number = work_package->chunk_number; + ExecutionGroup *execution_group = work_package->execution_group; - MemoryBuffer **inputBuffers = executionGroup->getInputBuffersOpenCL(chunkNumber); - MemoryBuffer *outputBuffer = executionGroup->allocateOutputBuffer(work_package->rect); + MemoryBuffer **input_buffers = execution_group->get_input_buffers_opencl(chunk_number); + MemoryBuffer *output_buffer = execution_group->allocate_output_buffer(work_package->rect); - executionGroup->getOutputOperation()->executeOpenCLRegion( - this, &work_package->rect, chunkNumber, inputBuffers, outputBuffer); + execution_group->get_output_operation()->execute_opencl_region( + this, &work_package->rect, chunk_number, input_buffers, output_buffer); - delete outputBuffer; + delete output_buffer; - executionGroup->finalizeChunkExecution(chunkNumber, inputBuffers); + execution_group->finalize_chunk_execution(chunk_number, input_buffers); } -cl_mem OpenCLDevice::COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel, - int parameterIndex, - int offsetIndex, - std::list<cl_mem> *cleanup, - MemoryBuffer **inputMemoryBuffers, - SocketReader *reader) +cl_mem OpenCLDevice::COM_cl_attach_memory_buffer_to_kernel_parameter( + cl_kernel kernel, + int parameter_index, + int offset_index, + std::list<cl_mem> *cleanup, + MemoryBuffer **input_memory_buffers, + SocketReader *reader) { - return COM_clAttachMemoryBufferToKernelParameter(kernel, - parameterIndex, - offsetIndex, - cleanup, - inputMemoryBuffers, - (ReadBufferOperation *)reader); + return COM_cl_attach_memory_buffer_to_kernel_parameter(kernel, + parameter_index, + offset_index, + cleanup, + input_memory_buffers, + (ReadBufferOperation *)reader); } -const cl_image_format *OpenCLDevice::determineImageFormat(MemoryBuffer *memoryBuffer) +const cl_image_format *OpenCLDevice::determine_image_format(MemoryBuffer *memory_buffer) { - switch (memoryBuffer->get_num_channels()) { + switch (memory_buffer->get_num_channels()) { case 1: return &IMAGE_FORMAT_VALUE; break; @@ -118,92 +119,91 @@ const cl_image_format *OpenCLDevice::determineImageFormat(MemoryBuffer *memoryBu return &IMAGE_FORMAT_COLOR; } -cl_mem OpenCLDevice::COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel, - int parameterIndex, - int offsetIndex, - std::list<cl_mem> *cleanup, - MemoryBuffer **inputMemoryBuffers, - ReadBufferOperation *reader) +cl_mem OpenCLDevice::COM_cl_attach_memory_buffer_to_kernel_parameter( + cl_kernel kernel, + int parameter_index, + int offset_index, + std::list<cl_mem> *cleanup, + MemoryBuffer **input_memory_buffers, + ReadBufferOperation *reader) { cl_int error; - MemoryBuffer *result = reader->getInputMemoryBuffer(inputMemoryBuffers); + MemoryBuffer *result = reader->get_input_memory_buffer(input_memory_buffers); - const cl_image_format *imageFormat = determineImageFormat(result); + const cl_image_format *image_format = determine_image_format(result); - cl_mem clBuffer = clCreateImage2D(context_, - CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, - imageFormat, - result->getWidth(), - result->getHeight(), - 0, - result->getBuffer(), - &error); + cl_mem cl_buffer = clCreateImage2D(context_, + CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, + image_format, + result->get_width(), + result->get_height(), + 0, + result->get_buffer(), + &error); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } if (error == CL_SUCCESS) { - cleanup->push_back(clBuffer); + cleanup->push_back(cl_buffer); } - error = clSetKernelArg(kernel, parameterIndex, sizeof(cl_mem), &clBuffer); + error = clSetKernelArg(kernel, parameter_index, sizeof(cl_mem), &cl_buffer); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } - COM_clAttachMemoryBufferOffsetToKernelParameter(kernel, offsetIndex, result); - return clBuffer; + COM_cl_attach_memory_buffer_offset_to_kernel_parameter(kernel, offset_index, result); + return cl_buffer; } -void OpenCLDevice::COM_clAttachMemoryBufferOffsetToKernelParameter(cl_kernel kernel, - int offsetIndex, - MemoryBuffer *memoryBuffer) +void OpenCLDevice::COM_cl_attach_memory_buffer_offset_to_kernel_parameter( + cl_kernel kernel, int offset_index, MemoryBuffer *memory_buffer) { - if (offsetIndex != -1) { + if (offset_index != -1) { cl_int error; - const rcti &rect = memoryBuffer->get_rect(); + const rcti &rect = memory_buffer->get_rect(); cl_int2 offset = {{rect.xmin, rect.ymin}}; - error = clSetKernelArg(kernel, offsetIndex, sizeof(cl_int2), &offset); + error = clSetKernelArg(kernel, offset_index, sizeof(cl_int2), &offset); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } } } -void OpenCLDevice::COM_clAttachSizeToKernelParameter(cl_kernel kernel, - int offsetIndex, - NodeOperation *operation) +void OpenCLDevice::COM_cl_attach_size_to_kernel_parameter(cl_kernel kernel, + int offset_index, + NodeOperation *operation) { - if (offsetIndex != -1) { + if (offset_index != -1) { cl_int error; - cl_int2 offset = {{(cl_int)operation->getWidth(), (cl_int)operation->getHeight()}}; + cl_int2 offset = {{(cl_int)operation->get_width(), (cl_int)operation->get_height()}}; - error = clSetKernelArg(kernel, offsetIndex, sizeof(cl_int2), &offset); + error = clSetKernelArg(kernel, offset_index, sizeof(cl_int2), &offset); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } } } -void OpenCLDevice::COM_clAttachOutputMemoryBufferToKernelParameter(cl_kernel kernel, - int parameterIndex, - cl_mem clOutputMemoryBuffer) +void OpenCLDevice::COM_cl_attach_output_memory_buffer_to_kernel_parameter( + cl_kernel kernel, int parameter_index, cl_mem cl_output_memory_buffer) { cl_int error; - error = clSetKernelArg(kernel, parameterIndex, sizeof(cl_mem), &clOutputMemoryBuffer); + error = clSetKernelArg(kernel, parameter_index, sizeof(cl_mem), &cl_output_memory_buffer); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } } -void OpenCLDevice::COM_clEnqueueRange(cl_kernel kernel, MemoryBuffer *outputMemoryBuffer) +void OpenCLDevice::COM_cl_enqueue_range(cl_kernel kernel, MemoryBuffer *output_memory_buffer) { cl_int error; const size_t size[] = { - (size_t)outputMemoryBuffer->getWidth(), - (size_t)outputMemoryBuffer->getHeight(), + (size_t)output_memory_buffer->get_width(), + (size_t)output_memory_buffer->get_height(), }; error = clEnqueueNDRangeKernel(queue_, kernel, 2, nullptr, size, nullptr, 0, nullptr, nullptr); @@ -212,44 +212,44 @@ void OpenCLDevice::COM_clEnqueueRange(cl_kernel kernel, MemoryBuffer *outputMemo } } -void OpenCLDevice::COM_clEnqueueRange(cl_kernel kernel, - MemoryBuffer *outputMemoryBuffer, - int offsetIndex, - NodeOperation *operation) +void OpenCLDevice::COM_cl_enqueue_range(cl_kernel kernel, + MemoryBuffer *output_memory_buffer, + int offset_index, + NodeOperation *operation) { cl_int error; - const int width = outputMemoryBuffer->getWidth(); - const int height = outputMemoryBuffer->getHeight(); + const int width = output_memory_buffer->get_width(); + const int height = output_memory_buffer->get_height(); int offsetx; int offsety; - int localSize = 1024; + int local_size = 1024; size_t size[2]; cl_int2 offset; - if (vendorID_ == NVIDIA) { - localSize = 32; + if (vendor_id_ == NVIDIA) { + local_size = 32; } bool breaked = false; - for (offsety = 0; offsety < height && (!breaked); offsety += localSize) { + for (offsety = 0; offsety < height && (!breaked); offsety += local_size) { offset.s[1] = offsety; - if (offsety + localSize < height) { - size[1] = localSize; + if (offsety + local_size < height) { + size[1] = local_size; } else { size[1] = height - offsety; } - for (offsetx = 0; offsetx < width && (!breaked); offsetx += localSize) { - if (offsetx + localSize < width) { - size[0] = localSize; + for (offsetx = 0; offsetx < width && (!breaked); offsetx += local_size) { + if (offsetx + local_size < width) { + size[0] = local_size; } else { size[0] = width - offsetx; } offset.s[0] = offsetx; - error = clSetKernelArg(kernel, offsetIndex, sizeof(cl_int2), &offset); + error = clSetKernelArg(kernel, offset_index, sizeof(cl_int2), &offset); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } @@ -259,15 +259,15 @@ void OpenCLDevice::COM_clEnqueueRange(cl_kernel kernel, printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } clFlush(queue_); - if (operation->isBraked()) { + if (operation->is_braked()) { breaked = false; } } } } -cl_kernel OpenCLDevice::COM_clCreateKernel(const char *kernelname, - std::list<cl_kernel> *clKernelsToCleanUp) +cl_kernel OpenCLDevice::COM_cl_create_kernel(const char *kernelname, + std::list<cl_kernel> *cl_kernels_to_clean_up) { cl_int error; cl_kernel kernel = clCreateKernel(program_, kernelname, &error); @@ -275,8 +275,8 @@ cl_kernel OpenCLDevice::COM_clCreateKernel(const char *kernelname, printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } else { - if (clKernelsToCleanUp) { - clKernelsToCleanUp->push_back(kernel); + if (cl_kernels_to_clean_up) { + cl_kernels_to_clean_up->push_back(kernel); } } return kernel; diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.h b/source/blender/compositor/intern/COM_OpenCLDevice.h index ca5a95f4a48..44a25747407 100644 --- a/source/blender/compositor/intern/COM_OpenCLDevice.h +++ b/source/blender/compositor/intern/COM_OpenCLDevice.h @@ -63,7 +63,7 @@ class OpenCLDevice : public Device { /** * \brief opencl vendor ID */ - cl_int vendorID_; + cl_int vendor_id_; public: /** @@ -73,7 +73,7 @@ class OpenCLDevice : public Device { * \param program: * \param vendorID: */ - OpenCLDevice(cl_context context, cl_device_id device, cl_program program, cl_int vendorId); + OpenCLDevice(cl_context context, cl_device_id device, cl_program program, cl_int vendor_id); OpenCLDevice(OpenCLDevice &&other) noexcept; @@ -89,45 +89,46 @@ class OpenCLDevice : public Device { * \brief determine an image format * \param memorybuffer: */ - static const cl_image_format *determineImageFormat(MemoryBuffer *memoryBuffer); + static const cl_image_format *determine_image_format(MemoryBuffer *memory_buffer); - cl_context getContext() + cl_context get_context() { return context_; } - cl_command_queue getQueue() + cl_command_queue get_queue() { return queue_; } - cl_mem COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel, - int parameterIndex, - int offsetIndex, - std::list<cl_mem> *cleanup, - MemoryBuffer **inputMemoryBuffers, - SocketReader *reader); - cl_mem COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel, - int parameterIndex, - int offsetIndex, - std::list<cl_mem> *cleanup, - MemoryBuffer **inputMemoryBuffers, - ReadBufferOperation *reader); - void COM_clAttachMemoryBufferOffsetToKernelParameter(cl_kernel kernel, - int offsetIndex, - MemoryBuffer *memoryBuffers); - void COM_clAttachOutputMemoryBufferToKernelParameter(cl_kernel kernel, - int parameterIndex, - cl_mem clOutputMemoryBuffer); - void COM_clAttachSizeToKernelParameter(cl_kernel kernel, - int offsetIndex, - NodeOperation *operation); - void COM_clEnqueueRange(cl_kernel kernel, MemoryBuffer *outputMemoryBuffer); - void COM_clEnqueueRange(cl_kernel kernel, - MemoryBuffer *outputMemoryBuffer, - int offsetIndex, - NodeOperation *operation); - cl_kernel COM_clCreateKernel(const char *kernelname, std::list<cl_kernel> *clKernelsToCleanUp); + cl_mem COM_cl_attach_memory_buffer_to_kernel_parameter(cl_kernel kernel, + int parameter_index, + int offset_index, + std::list<cl_mem> *cleanup, + MemoryBuffer **input_memory_buffers, + SocketReader *reader); + cl_mem COM_cl_attach_memory_buffer_to_kernel_parameter(cl_kernel kernel, + int parameter_index, + int offset_index, + std::list<cl_mem> *cleanup, + MemoryBuffer **input_memory_buffers, + ReadBufferOperation *reader); + void COM_cl_attach_memory_buffer_offset_to_kernel_parameter(cl_kernel kernel, + int offset_index, + MemoryBuffer *memory_buffers); + void COM_cl_attach_output_memory_buffer_to_kernel_parameter(cl_kernel kernel, + int parameter_index, + cl_mem cl_output_memory_buffer); + void COM_cl_attach_size_to_kernel_parameter(cl_kernel kernel, + int offset_index, + NodeOperation *operation); + void COM_cl_enqueue_range(cl_kernel kernel, MemoryBuffer *output_memory_buffer); + void COM_cl_enqueue_range(cl_kernel kernel, + MemoryBuffer *output_memory_buffer, + int offset_index, + NodeOperation *operation); + cl_kernel COM_cl_create_kernel(const char *kernelname, + std::list<cl_kernel> *cl_kernels_to_clean_up); }; } // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_SingleThreadedOperation.cc b/source/blender/compositor/intern/COM_SingleThreadedOperation.cc index 83e3f033b32..fab6c352a02 100644 --- a/source/blender/compositor/intern/COM_SingleThreadedOperation.cc +++ b/source/blender/compositor/intern/COM_SingleThreadedOperation.cc @@ -22,42 +22,42 @@ namespace blender::compositor { SingleThreadedOperation::SingleThreadedOperation() { - cachedInstance_ = nullptr; + cached_instance_ = nullptr; flags.complex = true; flags.single_threaded = true; } -void SingleThreadedOperation::initExecution() +void SingleThreadedOperation::init_execution() { - initMutex(); + init_mutex(); } -void SingleThreadedOperation::executePixel(float output[4], int x, int y, void * /*data*/) +void SingleThreadedOperation::execute_pixel(float output[4], int x, int y, void * /*data*/) { - cachedInstance_->readNoCheck(output, x, y); + cached_instance_->read_no_check(output, x, y); } -void SingleThreadedOperation::deinitExecution() +void SingleThreadedOperation::deinit_execution() { - deinitMutex(); - if (cachedInstance_) { - delete cachedInstance_; - cachedInstance_ = nullptr; + deinit_mutex(); + if (cached_instance_) { + delete cached_instance_; + cached_instance_ = nullptr; } } -void *SingleThreadedOperation::initializeTileData(rcti *rect) +void *SingleThreadedOperation::initialize_tile_data(rcti *rect) { - if (cachedInstance_) { - return cachedInstance_; + if (cached_instance_) { + return cached_instance_; } - lockMutex(); - if (cachedInstance_ == nullptr) { + lock_mutex(); + if (cached_instance_ == nullptr) { // - cachedInstance_ = createMemoryBuffer(rect); + cached_instance_ = create_memory_buffer(rect); } - unlockMutex(); - return cachedInstance_; + unlock_mutex(); + return cached_instance_; } } // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_SingleThreadedOperation.h b/source/blender/compositor/intern/COM_SingleThreadedOperation.h index 3f90ce96e00..7588e654f75 100644 --- a/source/blender/compositor/intern/COM_SingleThreadedOperation.h +++ b/source/blender/compositor/intern/COM_SingleThreadedOperation.h @@ -24,12 +24,12 @@ namespace blender::compositor { class SingleThreadedOperation : public NodeOperation { private: - MemoryBuffer *cachedInstance_; + MemoryBuffer *cached_instance_; protected: - inline bool isCached() + inline bool is_cached() { - return cachedInstance_ != nullptr; + return cached_instance_ != nullptr; } public: @@ -38,21 +38,21 @@ class SingleThreadedOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void *initializeTileData(rcti *rect) override; + void *initialize_tile_data(rcti *rect) override; - virtual MemoryBuffer *createMemoryBuffer(rcti *rect) = 0; + virtual MemoryBuffer *create_memory_buffer(rcti *rect) = 0; }; } // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_TiledExecutionModel.cc b/source/blender/compositor/intern/COM_TiledExecutionModel.cc index a081b80349d..e9f7310cead 100644 --- a/source/blender/compositor/intern/COM_TiledExecutionModel.cc +++ b/source/blender/compositor/intern/COM_TiledExecutionModel.cc @@ -35,24 +35,24 @@ TiledExecutionModel::TiledExecutionModel(CompositorContext &context, Span<ExecutionGroup *> groups) : ExecutionModel(context, operations), groups_(groups) { - const bNodeTree *node_tree = context.getbNodeTree(); + const bNodeTree *node_tree = context.get_bnodetree(); node_tree->stats_draw(node_tree->sdh, TIP_("Compositing | Determining resolution")); unsigned int resolution[2]; for (ExecutionGroup *group : groups_) { resolution[0] = 0; resolution[1] = 0; - group->determineResolution(resolution); + group->determine_resolution(resolution); if (border_.use_render_border) { const rctf *render_border = border_.render_border; - group->setRenderBorder( + group->set_render_border( render_border->xmin, render_border->xmax, render_border->ymin, render_border->ymax); } if (border_.use_viewer_border) { const rctf *viewer_border = border_.viewer_border; - group->setViewerBorder( + group->set_viewer_border( viewer_border->xmin, viewer_border->xmax, viewer_border->ymin, viewer_border->ymax); } } @@ -63,8 +63,8 @@ static void update_read_buffer_offset(Span<NodeOperation *> operations) unsigned int order = 0; for (NodeOperation *operation : operations) { if (operation->get_flags().is_read_buffer_operation) { - ReadBufferOperation *readOperation = (ReadBufferOperation *)operation; - readOperation->setOffset(order); + ReadBufferOperation *read_operation = (ReadBufferOperation *)operation; + read_operation->set_offset(order); order++; } } @@ -75,8 +75,8 @@ static void init_write_operations_for_execution(Span<NodeOperation *> operations { for (NodeOperation *operation : operations) { if (operation->get_flags().is_write_buffer_operation) { - operation->setbNodeTree(bTree); - operation->initExecution(); + operation->set_bnodetree(bTree); + operation->init_execution(); } } } @@ -85,8 +85,8 @@ static void link_write_buffers(Span<NodeOperation *> operations) { for (NodeOperation *operation : operations) { if (operation->get_flags().is_read_buffer_operation) { - ReadBufferOperation *readOperation = static_cast<ReadBufferOperation *>(operation); - readOperation->updateMemoryBuffer(); + ReadBufferOperation *read_operation = static_cast<ReadBufferOperation *>(operation); + read_operation->update_memory_buffer(); } } } @@ -96,8 +96,8 @@ static void init_non_write_operations_for_execution(Span<NodeOperation *> operat { for (NodeOperation *operation : operations) { if (!operation->get_flags().is_write_buffer_operation) { - operation->setbNodeTree(bTree); - operation->initExecution(); + operation->set_bnodetree(bTree); + operation->init_execution(); } } } @@ -106,27 +106,27 @@ static void init_execution_groups_for_execution(Span<ExecutionGroup *> groups, const int chunk_size) { for (ExecutionGroup *execution_group : groups) { - execution_group->setChunksize(chunk_size); - execution_group->initExecution(); + execution_group->set_chunksize(chunk_size); + execution_group->init_execution(); } } void TiledExecutionModel::execute(ExecutionSystem &exec_system) { - const bNodeTree *editingtree = this->context_.getbNodeTree(); + const bNodeTree *editingtree = this->context_.get_bnodetree(); editingtree->stats_draw(editingtree->sdh, TIP_("Compositing | Initializing execution")); update_read_buffer_offset(operations_); - init_write_operations_for_execution(operations_, context_.getbNodeTree()); + init_write_operations_for_execution(operations_, context_.get_bnodetree()); link_write_buffers(operations_); - init_non_write_operations_for_execution(operations_, context_.getbNodeTree()); - init_execution_groups_for_execution(groups_, context_.getChunksize()); + init_non_write_operations_for_execution(operations_, context_.get_bnodetree()); + init_execution_groups_for_execution(groups_, context_.get_chunksize()); WorkScheduler::start(context_); execute_groups(eCompositorPriority::High, exec_system); - if (!context_.isFastCalculation()) { + if (!context_.is_fast_calculation()) { execute_groups(eCompositorPriority::Medium, exec_system); execute_groups(eCompositorPriority::Low, exec_system); } @@ -136,11 +136,11 @@ void TiledExecutionModel::execute(ExecutionSystem &exec_system) editingtree->stats_draw(editingtree->sdh, TIP_("Compositing | De-initializing execution")); for (NodeOperation *operation : operations_) { - operation->deinitExecution(); + operation->deinit_execution(); } for (ExecutionGroup *execution_group : groups_) { - execution_group->deinitExecution(); + execution_group->deinit_execution(); } } @@ -149,7 +149,7 @@ void TiledExecutionModel::execute_groups(eCompositorPriority priority, { for (ExecutionGroup *execution_group : groups_) { if (execution_group->get_flags().is_output && - execution_group->getRenderPriority() == priority) { + execution_group->get_render_priority() == priority) { execution_group->execute(&exec_system); } } diff --git a/source/blender/compositor/intern/COM_WorkPackage.h b/source/blender/compositor/intern/COM_WorkPackage.h index 5ea3237d412..1fe50b9ecf3 100644 --- a/source/blender/compositor/intern/COM_WorkPackage.h +++ b/source/blender/compositor/intern/COM_WorkPackage.h @@ -43,7 +43,7 @@ struct WorkPackage { eWorkPackageState state = eWorkPackageState::NotScheduled; /** - * \brief executionGroup with the operations-setup to be evaluated + * \brief execution_group with the operations-setup to be evaluated */ ExecutionGroup *execution_group; diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cc b/source/blender/compositor/intern/COM_WorkScheduler.cc index 22f60ec17fe..c88cc556e72 100644 --- a/source/blender/compositor/intern/COM_WorkScheduler.cc +++ b/source/blender/compositor/intern/COM_WorkScheduler.cc @@ -104,10 +104,10 @@ static struct { /** \name OpenCL Scheduling * \{ */ -static void CL_CALLBACK clContextError(const char *errinfo, - const void * /*private_info*/, - size_t /*cb*/, - void * /*user_data*/) +static void CL_CALLBACK cl_context_error(const char *errinfo, + const void * /*private_info*/, + size_t /*cb*/, + void * /*user_data*/) { printf("OPENCL error: %s\n", errinfo); } @@ -126,7 +126,7 @@ static void *thread_execute_gpu(void *data) static void opencl_start(const CompositorContext &context) { - if (context.getHasActiveOpenCLDevices()) { + if (context.get_has_active_opencl_devices()) { g_work_scheduler.opencl.queue = BLI_thread_queue_init(); BLI_threadpool_init(&g_work_scheduler.opencl.threads, thread_execute_gpu, @@ -186,35 +186,35 @@ static void opencl_initialize(const bool use_opencl) } if (clCreateContextFromType) { - cl_uint numberOfPlatforms = 0; + cl_uint number_of_platforms = 0; cl_int error; - error = clGetPlatformIDs(0, nullptr, &numberOfPlatforms); + error = clGetPlatformIDs(0, nullptr, &number_of_platforms); if (error == -1001) { } /* GPU not supported */ else if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } if (G.f & G_DEBUG) { - printf("%u number of platforms\n", numberOfPlatforms); + printf("%u number of platforms\n", number_of_platforms); } cl_platform_id *platforms = (cl_platform_id *)MEM_mallocN( - sizeof(cl_platform_id) * numberOfPlatforms, __func__); - error = clGetPlatformIDs(numberOfPlatforms, platforms, nullptr); - unsigned int indexPlatform; - for (indexPlatform = 0; indexPlatform < numberOfPlatforms; indexPlatform++) { - cl_platform_id platform = platforms[indexPlatform]; - cl_uint numberOfDevices = 0; - clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, nullptr, &numberOfDevices); - if (numberOfDevices <= 0) { + sizeof(cl_platform_id) * number_of_platforms, __func__); + error = clGetPlatformIDs(number_of_platforms, platforms, nullptr); + unsigned int index_platform; + for (index_platform = 0; index_platform < number_of_platforms; index_platform++) { + cl_platform_id platform = platforms[index_platform]; + cl_uint number_of_devices = 0; + clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, nullptr, &number_of_devices); + if (number_of_devices <= 0) { continue; } cl_device_id *cldevices = (cl_device_id *)MEM_mallocN( - sizeof(cl_device_id) * numberOfDevices, __func__); - clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, numberOfDevices, cldevices, nullptr); + sizeof(cl_device_id) * number_of_devices, __func__); + clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, number_of_devices, cldevices, nullptr); g_work_scheduler.opencl.context = clCreateContext( - nullptr, numberOfDevices, cldevices, clContextError, nullptr, &error); + nullptr, number_of_devices, cldevices, cl_context_error, nullptr, &error); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } @@ -222,7 +222,7 @@ static void opencl_initialize(const bool use_opencl) g_work_scheduler.opencl.program = clCreateProgramWithSource( g_work_scheduler.opencl.context, 1, cl_str, nullptr, &error); error = clBuildProgram(g_work_scheduler.opencl.program, - numberOfDevices, + number_of_devices, cldevices, nullptr, nullptr, @@ -255,9 +255,9 @@ static void opencl_initialize(const bool use_opencl) MEM_freeN(build_log); } else { - unsigned int indexDevices; - for (indexDevices = 0; indexDevices < numberOfDevices; indexDevices++) { - cl_device_id device = cldevices[indexDevices]; + unsigned int index_devices; + for (index_devices = 0; index_devices < number_of_devices; index_devices++) { + cl_device_id device = cldevices[index_devices]; cl_int vendorID = 0; cl_int error2 = clGetDeviceInfo( device, CL_DEVICE_VENDOR_ID, sizeof(cl_int), &vendorID, nullptr); diff --git a/source/blender/compositor/intern/COM_WorkScheduler.h b/source/blender/compositor/intern/COM_WorkScheduler.h index d0fa3286a3b..2c60a6f2a8a 100644 --- a/source/blender/compositor/intern/COM_WorkScheduler.h +++ b/source/blender/compositor/intern/COM_WorkScheduler.h @@ -81,7 +81,7 @@ struct WorkScheduler { * \brief Are there OpenCL capable GPU devices initialized? * the result of this method is stored in the CompositorContext * A node can generate a different operation tree when OpenCLDevices exists. - * \see CompositorContext.getHasActiveOpenCLDevices + * \see CompositorContext.get_has_active_opencl_devices */ static bool has_gpu_devices(); diff --git a/source/blender/compositor/intern/COM_compositor.cc b/source/blender/compositor/intern/COM_compositor.cc index ed32a477384..be70ae792cb 100644 --- a/source/blender/compositor/intern/COM_compositor.cc +++ b/source/blender/compositor/intern/COM_compositor.cc @@ -64,9 +64,9 @@ void COM_execute(RenderData *render_data, Scene *scene, bNodeTree *node_tree, int rendering, - const ColorManagedViewSettings *viewSettings, - const ColorManagedDisplaySettings *displaySettings, - const char *viewName) + const ColorManagedViewSettings *view_settings, + const ColorManagedDisplaySettings *display_settings, + const char *view_name) { /* Initialize mutex, TODO: this mutex init is actually not thread safe and * should be done somewhere as part of blender startup, all the other @@ -95,8 +95,14 @@ void COM_execute(RenderData *render_data, /* Execute. */ const bool twopass = (node_tree->flag & NTREE_TWO_PASS) && !rendering; if (twopass) { - blender::compositor::ExecutionSystem fast_pass( - render_data, scene, node_tree, rendering, true, viewSettings, displaySettings, viewName); + blender::compositor::ExecutionSystem fast_pass(render_data, + scene, + node_tree, + rendering, + true, + view_settings, + display_settings, + view_name); fast_pass.execute(); if (node_tree->test_break(node_tree->tbh)) { @@ -106,7 +112,7 @@ void COM_execute(RenderData *render_data, } blender::compositor::ExecutionSystem system( - render_data, scene, node_tree, rendering, false, viewSettings, displaySettings, viewName); + render_data, scene, node_tree, rendering, false, view_settings, display_settings, view_name); system.execute(); BLI_mutex_unlock(&g_compositor.mutex); diff --git a/source/blender/compositor/nodes/COM_AlphaOverNode.cc b/source/blender/compositor/nodes/COM_AlphaOverNode.cc index 603f713a43f..42836d0a575 100644 --- a/source/blender/compositor/nodes/COM_AlphaOverNode.cc +++ b/source/blender/compositor/nodes/COM_AlphaOverNode.cc @@ -24,43 +24,43 @@ namespace blender::compositor { -void AlphaOverNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void AlphaOverNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *color1Socket = this->getInputSocket(1); - NodeInput *color2Socket = this->getInputSocket(2); - bNode *editorNode = this->getbNode(); + NodeInput *color1Socket = this->get_input_socket(1); + NodeInput *color2Socket = this->get_input_socket(2); + bNode *editor_node = this->get_bnode(); - MixBaseOperation *convertProg; - NodeTwoFloats *ntf = (NodeTwoFloats *)editorNode->storage; + MixBaseOperation *convert_prog; + NodeTwoFloats *ntf = (NodeTwoFloats *)editor_node->storage; if (ntf->x != 0.0f) { - AlphaOverMixedOperation *mixOperation = new AlphaOverMixedOperation(); - mixOperation->setX(ntf->x); - convertProg = mixOperation; + AlphaOverMixedOperation *mix_operation = new AlphaOverMixedOperation(); + mix_operation->setX(ntf->x); + convert_prog = mix_operation; } - else if (editorNode->custom1) { - convertProg = new AlphaOverKeyOperation(); + else if (editor_node->custom1) { + convert_prog = new AlphaOverKeyOperation(); } else { - convertProg = new AlphaOverPremultiplyOperation(); + convert_prog = new AlphaOverPremultiplyOperation(); } - convertProg->setUseValueAlphaMultiply(false); - if (color1Socket->isLinked()) { - convertProg->set_canvas_input_index(1); + convert_prog->set_use_value_alpha_multiply(false); + if (color1Socket->is_linked()) { + convert_prog->set_canvas_input_index(1); } - else if (color2Socket->isLinked()) { - convertProg->set_canvas_input_index(2); + else if (color2Socket->is_linked()) { + convert_prog->set_canvas_input_index(2); } else { - convertProg->set_canvas_input_index(0); + convert_prog->set_canvas_input_index(0); } - converter.addOperation(convertProg); - converter.mapInputSocket(getInputSocket(0), convertProg->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), convertProg->getInputSocket(1)); - converter.mapInputSocket(getInputSocket(2), convertProg->getInputSocket(2)); - converter.mapOutputSocket(getOutputSocket(0), convertProg->getOutputSocket(0)); + converter.add_operation(convert_prog); + converter.map_input_socket(get_input_socket(0), convert_prog->get_input_socket(0)); + converter.map_input_socket(get_input_socket(1), convert_prog->get_input_socket(1)); + converter.map_input_socket(get_input_socket(2), convert_prog->get_input_socket(2)); + converter.map_output_socket(get_output_socket(0), convert_prog->get_output_socket(0)); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_AlphaOverNode.h b/source/blender/compositor/nodes/COM_AlphaOverNode.h index 201c8ed5b6e..447570fe604 100644 --- a/source/blender/compositor/nodes/COM_AlphaOverNode.h +++ b/source/blender/compositor/nodes/COM_AlphaOverNode.h @@ -28,11 +28,11 @@ namespace blender::compositor { */ class AlphaOverNode : public Node { public: - AlphaOverNode(bNode *editorNode) : Node(editorNode) + AlphaOverNode(bNode *editor_node) : Node(editor_node) { } - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + void convert_to_operations(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 index 8cbb3994939..b11c57041d9 100644 --- a/source/blender/compositor/nodes/COM_AntiAliasingNode.cc +++ b/source/blender/compositor/nodes/COM_AntiAliasingNode.cc @@ -23,37 +23,37 @@ namespace blender::compositor { -void AntiAliasingNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void AntiAliasingNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *node = this->getbNode(); + bNode *node = this->get_bnode(); 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); + operation1->set_threshold(data->threshold); + operation1->set_local_contrast_adaptation_factor(data->contrast_limit); + converter.add_operation(operation1); - converter.mapInputSocket(getInputSocket(0), operation1->getInputSocket(0)); + converter.map_input_socket(get_input_socket(0), operation1->get_input_socket(0)); /* Blending Weight Calculation Pixel Shader (Second Pass) */ SMAABlendingWeightCalculationOperation *operation2 = new SMAABlendingWeightCalculationOperation(); - operation2->setCornerRounding(data->corner_rounding); - converter.addOperation(operation2); + operation2->set_corner_rounding(data->corner_rounding); + converter.add_operation(operation2); - converter.addLink(operation1->getOutputSocket(), operation2->getInputSocket(0)); + converter.add_link(operation1->get_output_socket(), operation2->get_input_socket(0)); /* Neighborhood Blending Pixel Shader (Third Pass) */ SMAANeighborhoodBlendingOperation *operation3 = new SMAANeighborhoodBlendingOperation(); - converter.addOperation(operation3); + converter.add_operation(operation3); - converter.mapInputSocket(getInputSocket(0), operation3->getInputSocket(0)); - converter.addLink(operation2->getOutputSocket(), operation3->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(0), operation3->getOutputSocket()); + converter.map_input_socket(get_input_socket(0), operation3->get_input_socket(0)); + converter.add_link(operation2->get_output_socket(), operation3->get_input_socket(1)); + converter.map_output_socket(get_output_socket(0), operation3->get_output_socket()); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_AntiAliasingNode.h b/source/blender/compositor/nodes/COM_AntiAliasingNode.h index 7d3dd750864..05c51d5856a 100644 --- a/source/blender/compositor/nodes/COM_AntiAliasingNode.h +++ b/source/blender/compositor/nodes/COM_AntiAliasingNode.h @@ -30,11 +30,11 @@ namespace blender::compositor { */ class AntiAliasingNode : public Node { public: - AntiAliasingNode(bNode *editorNode) : Node(editorNode) + AntiAliasingNode(bNode *editor_node) : Node(editor_node) { } - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + void convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const override; }; } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_BilateralBlurNode.cc b/source/blender/compositor/nodes/COM_BilateralBlurNode.cc index 40a70e37e4b..2390f6305b2 100644 --- a/source/blender/compositor/nodes/COM_BilateralBlurNode.cc +++ b/source/blender/compositor/nodes/COM_BilateralBlurNode.cc @@ -21,23 +21,23 @@ namespace blender::compositor { -BilateralBlurNode::BilateralBlurNode(bNode *editorNode) : Node(editorNode) +BilateralBlurNode::BilateralBlurNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void BilateralBlurNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void BilateralBlurNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - NodeBilateralBlurData *data = (NodeBilateralBlurData *)this->getbNode()->storage; + NodeBilateralBlurData *data = (NodeBilateralBlurData *)this->get_bnode()->storage; BilateralBlurOperation *operation = new BilateralBlurOperation(); - operation->setQuality(context.getQuality()); - operation->setData(data); + operation->set_quality(context.get_quality()); + operation->set_data(data); - converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.add_operation(operation); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0)); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_BilateralBlurNode.h b/source/blender/compositor/nodes/COM_BilateralBlurNode.h index fed2612ac02..6bef897f2ef 100644 --- a/source/blender/compositor/nodes/COM_BilateralBlurNode.h +++ b/source/blender/compositor/nodes/COM_BilateralBlurNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class BilateralBlurNode : public Node { public: - BilateralBlurNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + BilateralBlurNode(bNode *editor_node); + void convert_to_operations(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 5dfd5c8d0bc..97a7159de67 100644 --- a/source/blender/compositor/nodes/COM_BlurNode.cc +++ b/source/blender/compositor/nodes/COM_BlurNode.cc @@ -29,103 +29,103 @@ namespace blender::compositor { -BlurNode::BlurNode(bNode *editorNode) : Node(editorNode) +BlurNode::BlurNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void BlurNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void BlurNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *editorNode = this->getbNode(); - NodeBlurData *data = (NodeBlurData *)editorNode->storage; - NodeInput *inputSizeSocket = this->getInputSocket(1); - bool connectedSizeSocket = inputSizeSocket->isLinked(); + bNode *editor_node = this->get_bnode(); + NodeBlurData *data = (NodeBlurData *)editor_node->storage; + NodeInput *input_size_socket = this->get_input_socket(1); + bool connected_size_socket = input_size_socket->is_linked(); - const float size = this->getInputSocket(1)->getEditorValueFloat(); - const bool extend_bounds = (editorNode->custom1 & CMP_NODEFLAG_BLUR_EXTEND_BOUNDS) != 0; + const float size = this->get_input_socket(1)->get_editor_value_float(); + const bool extend_bounds = (editor_node->custom1 & CMP_NODEFLAG_BLUR_EXTEND_BOUNDS) != 0; - eCompositorQuality quality = context.getQuality(); + eCompositorQuality quality = context.get_quality(); NodeOperation *input_operation = nullptr, *output_operation = nullptr; if (data->filtertype == R_FILTER_FAST_GAUSS) { FastGaussianBlurOperation *operationfgb = new FastGaussianBlurOperation(); - operationfgb->setData(data); - operationfgb->setExtendBounds(extend_bounds); - converter.addOperation(operationfgb); + operationfgb->set_data(data); + operationfgb->set_extend_bounds(extend_bounds); + converter.add_operation(operationfgb); - converter.mapInputSocket(getInputSocket(1), operationfgb->getInputSocket(1)); + converter.map_input_socket(get_input_socket(1), operationfgb->get_input_socket(1)); input_operation = operationfgb; output_operation = operationfgb; } - else if (editorNode->custom1 & CMP_NODEFLAG_BLUR_VARIABLE_SIZE) { + else if (editor_node->custom1 & CMP_NODEFLAG_BLUR_VARIABLE_SIZE) { MathAddOperation *clamp = new MathAddOperation(); SetValueOperation *zero = new SetValueOperation(); - zero->setValue(0.0f); - clamp->setUseClamp(true); + zero->set_value(0.0f); + clamp->set_use_clamp(true); - converter.addOperation(clamp); - converter.addOperation(zero); - converter.mapInputSocket(getInputSocket(1), clamp->getInputSocket(0)); - converter.addLink(zero->getOutputSocket(), clamp->getInputSocket(1)); + converter.add_operation(clamp); + converter.add_operation(zero); + converter.map_input_socket(get_input_socket(1), clamp->get_input_socket(0)); + converter.add_link(zero->get_output_socket(), clamp->get_input_socket(1)); GaussianAlphaXBlurOperation *operationx = new GaussianAlphaXBlurOperation(); - operationx->setData(data); - operationx->setQuality(quality); - operationx->setSize(1.0f); - operationx->setFalloff(PROP_SMOOTH); - operationx->setSubtract(false); - operationx->setExtendBounds(extend_bounds); + operationx->set_data(data); + operationx->set_quality(quality); + operationx->set_size(1.0f); + operationx->set_falloff(PROP_SMOOTH); + operationx->set_subtract(false); + operationx->set_extend_bounds(extend_bounds); - converter.addOperation(operationx); - converter.addLink(clamp->getOutputSocket(), operationx->getInputSocket(0)); + converter.add_operation(operationx); + converter.add_link(clamp->get_output_socket(), operationx->get_input_socket(0)); GaussianAlphaYBlurOperation *operationy = new GaussianAlphaYBlurOperation(); - operationy->setData(data); - operationy->setQuality(quality); - operationy->setSize(1.0f); - operationy->setFalloff(PROP_SMOOTH); - operationy->setSubtract(false); - operationy->setExtendBounds(extend_bounds); + operationy->set_data(data); + operationy->set_quality(quality); + operationy->set_size(1.0f); + operationy->set_falloff(PROP_SMOOTH); + operationy->set_subtract(false); + operationy->set_extend_bounds(extend_bounds); - converter.addOperation(operationy); - converter.addLink(operationx->getOutputSocket(), operationy->getInputSocket(0)); + converter.add_operation(operationy); + converter.add_link(operationx->get_output_socket(), operationy->get_input_socket(0)); GaussianBlurReferenceOperation *operation = new GaussianBlurReferenceOperation(); - operation->setData(data); - operation->setQuality(quality); - operation->setExtendBounds(extend_bounds); + operation->set_data(data); + operation->set_quality(quality); + operation->set_extend_bounds(extend_bounds); - converter.addOperation(operation); - converter.addLink(operationy->getOutputSocket(), operation->getInputSocket(1)); + converter.add_operation(operation); + converter.add_link(operationy->get_output_socket(), operation->get_input_socket(1)); output_operation = operation; input_operation = operation; } else if (!data->bokeh) { GaussianXBlurOperation *operationx = new GaussianXBlurOperation(); - operationx->setData(data); - operationx->setQuality(quality); - operationx->checkOpenCL(); - operationx->setExtendBounds(extend_bounds); + operationx->set_data(data); + operationx->set_quality(quality); + operationx->check_opencl(); + operationx->set_extend_bounds(extend_bounds); - converter.addOperation(operationx); - converter.mapInputSocket(getInputSocket(1), operationx->getInputSocket(1)); + converter.add_operation(operationx); + converter.map_input_socket(get_input_socket(1), operationx->get_input_socket(1)); GaussianYBlurOperation *operationy = new GaussianYBlurOperation(); - operationy->setData(data); - operationy->setQuality(quality); - operationy->checkOpenCL(); - operationy->setExtendBounds(extend_bounds); - - converter.addOperation(operationy); - converter.mapInputSocket(getInputSocket(1), operationy->getInputSocket(1)); - converter.addLink(operationx->getOutputSocket(), operationy->getInputSocket(0)); - - if (!connectedSizeSocket) { - operationx->setSize(size); - operationy->setSize(size); + operationy->set_data(data); + operationy->set_quality(quality); + operationy->check_opencl(); + operationy->set_extend_bounds(extend_bounds); + + converter.add_operation(operationy); + converter.map_input_socket(get_input_socket(1), operationy->get_input_socket(1)); + converter.add_link(operationx->get_output_socket(), operationy->get_input_socket(0)); + + if (!connected_size_socket) { + operationx->set_size(size); + operationy->set_size(size); } input_operation = operationx; @@ -133,15 +133,15 @@ void BlurNode::convertToOperations(NodeConverter &converter, } else { GaussianBokehBlurOperation *operation = new GaussianBokehBlurOperation(); - operation->setData(data); - operation->setQuality(quality); - operation->setExtendBounds(extend_bounds); + operation->set_data(data); + operation->set_quality(quality); + operation->set_extend_bounds(extend_bounds); - converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); + converter.add_operation(operation); + converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1)); - if (!connectedSizeSocket) { - operation->setSize(size); + if (!connected_size_socket) { + operation->set_size(size); } input_operation = operation; @@ -151,21 +151,21 @@ void BlurNode::convertToOperations(NodeConverter &converter, if (data->gamma) { GammaCorrectOperation *correct = new GammaCorrectOperation(); GammaUncorrectOperation *inverse = new GammaUncorrectOperation(); - converter.addOperation(correct); - converter.addOperation(inverse); + converter.add_operation(correct); + converter.add_operation(inverse); - converter.mapInputSocket(getInputSocket(0), correct->getInputSocket(0)); - converter.addLink(correct->getOutputSocket(), input_operation->getInputSocket(0)); - converter.addLink(output_operation->getOutputSocket(), inverse->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(), inverse->getOutputSocket()); + converter.map_input_socket(get_input_socket(0), correct->get_input_socket(0)); + converter.add_link(correct->get_output_socket(), input_operation->get_input_socket(0)); + converter.add_link(output_operation->get_output_socket(), inverse->get_input_socket(0)); + converter.map_output_socket(get_output_socket(), inverse->get_output_socket()); - converter.addPreview(inverse->getOutputSocket()); + converter.add_preview(inverse->get_output_socket()); } else { - converter.mapInputSocket(getInputSocket(0), input_operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(), output_operation->getOutputSocket()); + converter.map_input_socket(get_input_socket(0), input_operation->get_input_socket(0)); + converter.map_output_socket(get_output_socket(), output_operation->get_output_socket()); - converter.addPreview(output_operation->getOutputSocket()); + converter.add_preview(output_operation->get_output_socket()); } } diff --git a/source/blender/compositor/nodes/COM_BlurNode.h b/source/blender/compositor/nodes/COM_BlurNode.h index 61cdc17f3a9..816f359cab1 100644 --- a/source/blender/compositor/nodes/COM_BlurNode.h +++ b/source/blender/compositor/nodes/COM_BlurNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class BlurNode : public Node { public: - BlurNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + BlurNode(bNode *editor_node); + void convert_to_operations(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 c18f6351cbd..8f71621c435 100644 --- a/source/blender/compositor/nodes/COM_BokehBlurNode.cc +++ b/source/blender/compositor/nodes/COM_BokehBlurNode.cc @@ -22,52 +22,52 @@ namespace blender::compositor { -BokehBlurNode::BokehBlurNode(bNode *editorNode) : Node(editorNode) +BokehBlurNode::BokehBlurNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void BokehBlurNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void BokehBlurNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *b_node = this->getbNode(); + bNode *b_node = this->get_bnode(); - NodeInput *inputSizeSocket = this->getInputSocket(2); + NodeInput *input_size_socket = this->get_input_socket(2); - bool connectedSizeSocket = inputSizeSocket->isLinked(); + bool connected_size_socket = input_size_socket->is_linked(); const bool extend_bounds = (b_node->custom1 & CMP_NODEFLAG_BLUR_EXTEND_BOUNDS) != 0; - if ((b_node->custom1 & CMP_NODEFLAG_BLUR_VARIABLE_SIZE) && connectedSizeSocket) { + if ((b_node->custom1 & CMP_NODEFLAG_BLUR_VARIABLE_SIZE) && connected_size_socket) { VariableSizeBokehBlurOperation *operation = new VariableSizeBokehBlurOperation(); - operation->setQuality(context.getQuality()); - operation->setThreshold(0.0f); - operation->setMaxBlur(b_node->custom4); - operation->setDoScaleSize(true); + operation->set_quality(context.get_quality()); + operation->set_threshold(0.0f); + operation->set_max_blur(b_node->custom4); + operation->set_do_scale_size(true); - converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); + converter.add_operation(operation); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1)); + converter.map_input_socket(get_input_socket(2), operation->get_input_socket(2)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket()); } else { BokehBlurOperation *operation = new BokehBlurOperation(); - operation->setQuality(context.getQuality()); - operation->setExtendBounds(extend_bounds); + operation->set_quality(context.get_quality()); + operation->set_extend_bounds(extend_bounds); - converter.addOperation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); + converter.add_operation(operation); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1)); /* NOTE: on the bokeh blur operation the sockets are switched. * for this reason the next two lines are correct. Fix for T43771. */ - converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(3)); - converter.mapInputSocket(getInputSocket(3), operation->getInputSocket(2)); + converter.map_input_socket(get_input_socket(2), operation->get_input_socket(3)); + converter.map_input_socket(get_input_socket(3), operation->get_input_socket(2)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket()); - if (!connectedSizeSocket) { - operation->setSize(this->getInputSocket(2)->getEditorValueFloat()); + if (!connected_size_socket) { + operation->set_size(this->get_input_socket(2)->get_editor_value_float()); } } } diff --git a/source/blender/compositor/nodes/COM_BokehBlurNode.h b/source/blender/compositor/nodes/COM_BokehBlurNode.h index 2c060936025..869eee44a6f 100644 --- a/source/blender/compositor/nodes/COM_BokehBlurNode.h +++ b/source/blender/compositor/nodes/COM_BokehBlurNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class BokehBlurNode : public Node { public: - BokehBlurNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + BokehBlurNode(bNode *editor_node); + void convert_to_operations(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 64237571e90..c860ef7a1c9 100644 --- a/source/blender/compositor/nodes/COM_BokehImageNode.cc +++ b/source/blender/compositor/nodes/COM_BokehImageNode.cc @@ -21,21 +21,21 @@ namespace blender::compositor { -BokehImageNode::BokehImageNode(bNode *editorNode) : Node(editorNode) +BokehImageNode::BokehImageNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void BokehImageNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void BokehImageNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { BokehImageOperation *operation = new BokehImageOperation(); - operation->setData((NodeBokehImage *)this->getbNode()->storage); + operation->set_data((NodeBokehImage *)this->get_bnode()->storage); - converter.addOperation(operation); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.add_operation(operation); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0)); - converter.addPreview(operation->getOutputSocket(0)); + converter.add_preview(operation->get_output_socket(0)); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_BokehImageNode.h b/source/blender/compositor/nodes/COM_BokehImageNode.h index 323561a7e4f..cb685c93237 100644 --- a/source/blender/compositor/nodes/COM_BokehImageNode.h +++ b/source/blender/compositor/nodes/COM_BokehImageNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class BokehImageNode : public Node { public: - BokehImageNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + BokehImageNode(bNode *editor_node); + void convert_to_operations(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 6fcaeada406..1cf05727a0a 100644 --- a/source/blender/compositor/nodes/COM_BoxMaskNode.cc +++ b/source/blender/compositor/nodes/COM_BoxMaskNode.cc @@ -24,52 +24,53 @@ namespace blender::compositor { -BoxMaskNode::BoxMaskNode(bNode *editorNode) : Node(editorNode) +BoxMaskNode::BoxMaskNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void BoxMaskNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void BoxMaskNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - NodeInput *inputSocket = this->getInputSocket(0); - NodeOutput *outputSocket = this->getOutputSocket(0); + NodeInput *input_socket = this->get_input_socket(0); + NodeOutput *output_socket = this->get_output_socket(0); BoxMaskOperation *operation; operation = new BoxMaskOperation(); - operation->setData((NodeBoxMask *)this->getbNode()->storage); - operation->setMaskType(this->getbNode()->custom1); - converter.addOperation(operation); + operation->set_data((NodeBoxMask *)this->get_bnode()->storage); + operation->set_mask_type(this->get_bnode()->custom1); + converter.add_operation(operation); - if (inputSocket->isLinked()) { - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket()); + if (input_socket->is_linked()) { + converter.map_input_socket(input_socket, operation->get_input_socket(0)); + converter.map_output_socket(output_socket, operation->get_output_socket()); } else { /* Value operation to produce original transparent image */ - SetValueOperation *valueOperation = new SetValueOperation(); - valueOperation->setValue(0.0f); - converter.addOperation(valueOperation); + SetValueOperation *value_operation = new SetValueOperation(); + value_operation->set_value(0.0f); + converter.add_operation(value_operation); /* Scale that image up to render resolution */ - const RenderData *rd = context.getRenderData(); - const float render_size_factor = context.getRenderPercentageAsFactor(); - ScaleFixedSizeOperation *scaleOperation = new ScaleFixedSizeOperation(); + const RenderData *rd = context.get_render_data(); + const float render_size_factor = context.get_render_percentage_as_factor(); + ScaleFixedSizeOperation *scale_operation = new ScaleFixedSizeOperation(); - scaleOperation->setIsAspect(false); - scaleOperation->setIsCrop(false); - scaleOperation->setOffset(0.0f, 0.0f); - scaleOperation->setNewWidth(rd->xsch * render_size_factor); - scaleOperation->setNewHeight(rd->ysch * render_size_factor); - scaleOperation->getInputSocket(0)->setResizeMode(ResizeMode::Align); - converter.addOperation(scaleOperation); + scale_operation->set_is_aspect(false); + scale_operation->set_is_crop(false); + scale_operation->set_offset(0.0f, 0.0f); + scale_operation->set_new_width(rd->xsch * render_size_factor); + scale_operation->set_new_height(rd->ysch * render_size_factor); + scale_operation->get_input_socket(0)->set_resize_mode(ResizeMode::Align); + converter.add_operation(scale_operation); - converter.addLink(valueOperation->getOutputSocket(0), scaleOperation->getInputSocket(0)); - converter.addLink(scaleOperation->getOutputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + converter.add_link(value_operation->get_output_socket(0), + scale_operation->get_input_socket(0)); + converter.add_link(scale_operation->get_output_socket(0), operation->get_input_socket(0)); + converter.map_output_socket(output_socket, operation->get_output_socket(0)); } - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); + converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1)); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_BoxMaskNode.h b/source/blender/compositor/nodes/COM_BoxMaskNode.h index 46cedf7af75..68d98f6c0ea 100644 --- a/source/blender/compositor/nodes/COM_BoxMaskNode.h +++ b/source/blender/compositor/nodes/COM_BoxMaskNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class BoxMaskNode : public Node { public: - BoxMaskNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + BoxMaskNode(bNode *editor_node); + void convert_to_operations(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 e01ec3d8729..0b87d5d3d49 100644 --- a/source/blender/compositor/nodes/COM_BrightnessNode.cc +++ b/source/blender/compositor/nodes/COM_BrightnessNode.cc @@ -21,23 +21,23 @@ namespace blender::compositor { -BrightnessNode::BrightnessNode(bNode *editorNode) : Node(editorNode) +BrightnessNode::BrightnessNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void BrightnessNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void BrightnessNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *bnode = this->getbNode(); + bNode *bnode = this->get_bnode(); BrightnessOperation *operation = new BrightnessOperation(); - operation->setUsePremultiply((bnode->custom1 & 1) != 0); - converter.addOperation(operation); + operation->set_use_premultiply((bnode->custom1 & 1) != 0); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1)); + converter.map_input_socket(get_input_socket(2), operation->get_input_socket(2)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0)); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_BrightnessNode.h b/source/blender/compositor/nodes/COM_BrightnessNode.h index 1084108b1c3..82a383557ba 100644 --- a/source/blender/compositor/nodes/COM_BrightnessNode.h +++ b/source/blender/compositor/nodes/COM_BrightnessNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class BrightnessNode : public Node { public: - BrightnessNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + BrightnessNode(bNode *editor_node); + void convert_to_operations(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 ed49d9c36a9..cf8e8a7392d 100644 --- a/source/blender/compositor/nodes/COM_ChannelMatteNode.cc +++ b/source/blender/compositor/nodes/COM_ChannelMatteNode.cc @@ -23,19 +23,19 @@ namespace blender::compositor { -ChannelMatteNode::ChannelMatteNode(bNode *editorNode) : Node(editorNode) +ChannelMatteNode::ChannelMatteNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void ChannelMatteNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void ChannelMatteNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *node = this->getbNode(); + bNode *node = this->get_bnode(); - NodeInput *inputSocketImage = this->getInputSocket(0); - NodeOutput *outputSocketImage = this->getOutputSocket(0); - NodeOutput *outputSocketMatte = this->getOutputSocket(1); + NodeInput *input_socket_image = this->get_input_socket(0); + NodeOutput *output_socket_image = this->get_output_socket(0); + NodeOutput *output_socket_matte = this->get_output_socket(1); NodeOperation *convert = nullptr, *inv_convert = nullptr; /* colorspace */ @@ -52,9 +52,9 @@ void ChannelMatteNode::convertToOperations(NodeConverter &converter, break; case CMP_NODE_CHANNEL_MATTE_CS_YCC: /* YCC */ convert = new ConvertRGBToYCCOperation(); - ((ConvertRGBToYCCOperation *)convert)->setMode(BLI_YCC_ITU_BT709); + ((ConvertRGBToYCCOperation *)convert)->set_mode(BLI_YCC_ITU_BT709); inv_convert = new ConvertYCCToRGBOperation(); - ((ConvertYCCToRGBOperation *)inv_convert)->setMode(BLI_YCC_ITU_BT709); + ((ConvertYCCToRGBOperation *)inv_convert)->set_mode(BLI_YCC_ITU_BT709); break; default: break; @@ -62,36 +62,36 @@ void ChannelMatteNode::convertToOperations(NodeConverter &converter, ChannelMatteOperation *operation = new ChannelMatteOperation(); /* pass the ui properties to the operation */ - operation->setSettings((NodeChroma *)node->storage, node->custom2); - converter.addOperation(operation); + operation->set_settings((NodeChroma *)node->storage, node->custom2); + converter.add_operation(operation); - SetAlphaMultiplyOperation *operationAlpha = new SetAlphaMultiplyOperation(); - converter.addOperation(operationAlpha); + SetAlphaMultiplyOperation *operation_alpha = new SetAlphaMultiplyOperation(); + converter.add_operation(operation_alpha); if (convert != nullptr) { - converter.addOperation(convert); + converter.add_operation(convert); - converter.mapInputSocket(inputSocketImage, convert->getInputSocket(0)); - converter.addLink(convert->getOutputSocket(), operation->getInputSocket(0)); - converter.addLink(convert->getOutputSocket(), operationAlpha->getInputSocket(0)); + converter.map_input_socket(input_socket_image, convert->get_input_socket(0)); + converter.add_link(convert->get_output_socket(), operation->get_input_socket(0)); + converter.add_link(convert->get_output_socket(), operation_alpha->get_input_socket(0)); } else { - converter.mapInputSocket(inputSocketImage, operation->getInputSocket(0)); - converter.mapInputSocket(inputSocketImage, operationAlpha->getInputSocket(0)); + converter.map_input_socket(input_socket_image, operation->get_input_socket(0)); + converter.map_input_socket(input_socket_image, operation_alpha->get_input_socket(0)); } - converter.mapOutputSocket(outputSocketMatte, operation->getOutputSocket(0)); - converter.addLink(operation->getOutputSocket(), operationAlpha->getInputSocket(1)); + converter.map_output_socket(output_socket_matte, operation->get_output_socket(0)); + converter.add_link(operation->get_output_socket(), operation_alpha->get_input_socket(1)); if (inv_convert != nullptr) { - converter.addOperation(inv_convert); - converter.addLink(operationAlpha->getOutputSocket(0), inv_convert->getInputSocket(0)); - converter.mapOutputSocket(outputSocketImage, inv_convert->getOutputSocket()); - converter.addPreview(inv_convert->getOutputSocket()); + converter.add_operation(inv_convert); + converter.add_link(operation_alpha->get_output_socket(0), inv_convert->get_input_socket(0)); + converter.map_output_socket(output_socket_image, inv_convert->get_output_socket()); + converter.add_preview(inv_convert->get_output_socket()); } else { - converter.mapOutputSocket(outputSocketImage, operationAlpha->getOutputSocket()); - converter.addPreview(operationAlpha->getOutputSocket()); + converter.map_output_socket(output_socket_image, operation_alpha->get_output_socket()); + converter.add_preview(operation_alpha->get_output_socket()); } } diff --git a/source/blender/compositor/nodes/COM_ChannelMatteNode.h b/source/blender/compositor/nodes/COM_ChannelMatteNode.h index 46100b3f7ea..c071c516e6d 100644 --- a/source/blender/compositor/nodes/COM_ChannelMatteNode.h +++ b/source/blender/compositor/nodes/COM_ChannelMatteNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class ChannelMatteNode : public Node { public: - ChannelMatteNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + ChannelMatteNode(bNode *editor_node); + void convert_to_operations(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 33516181152..8db96e0308d 100644 --- a/source/blender/compositor/nodes/COM_ChromaMatteNode.cc +++ b/source/blender/compositor/nodes/COM_ChromaMatteNode.cc @@ -23,46 +23,46 @@ namespace blender::compositor { -ChromaMatteNode::ChromaMatteNode(bNode *editorNode) : Node(editorNode) +ChromaMatteNode::ChromaMatteNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void ChromaMatteNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void ChromaMatteNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *editorsnode = getbNode(); + bNode *editorsnode = get_bnode(); - NodeInput *inputSocketImage = this->getInputSocket(0); - NodeInput *inputSocketKey = this->getInputSocket(1); - NodeOutput *outputSocketImage = this->getOutputSocket(0); - NodeOutput *outputSocketMatte = this->getOutputSocket(1); + NodeInput *input_socket_image = this->get_input_socket(0); + NodeInput *input_socket_key = this->get_input_socket(1); + NodeOutput *output_socket_image = this->get_output_socket(0); + NodeOutput *output_socket_matte = this->get_output_socket(1); ConvertRGBToYCCOperation *operationRGBToYCC_Image = new ConvertRGBToYCCOperation(); ConvertRGBToYCCOperation *operationRGBToYCC_Key = new ConvertRGBToYCCOperation(); - operationRGBToYCC_Image->setMode(BLI_YCC_ITU_BT709); - operationRGBToYCC_Key->setMode(BLI_YCC_ITU_BT709); - converter.addOperation(operationRGBToYCC_Image); - converter.addOperation(operationRGBToYCC_Key); + operationRGBToYCC_Image->set_mode(BLI_YCC_ITU_BT709); + operationRGBToYCC_Key->set_mode(BLI_YCC_ITU_BT709); + converter.add_operation(operationRGBToYCC_Image); + converter.add_operation(operationRGBToYCC_Key); ChromaMatteOperation *operation = new ChromaMatteOperation(); - operation->setSettings((NodeChroma *)editorsnode->storage); - converter.addOperation(operation); + operation->set_settings((NodeChroma *)editorsnode->storage); + converter.add_operation(operation); - SetAlphaMultiplyOperation *operationAlpha = new SetAlphaMultiplyOperation(); - converter.addOperation(operationAlpha); + SetAlphaMultiplyOperation *operation_alpha = new SetAlphaMultiplyOperation(); + converter.add_operation(operation_alpha); - converter.mapInputSocket(inputSocketImage, operationRGBToYCC_Image->getInputSocket(0)); - converter.mapInputSocket(inputSocketKey, operationRGBToYCC_Key->getInputSocket(0)); - converter.addLink(operationRGBToYCC_Image->getOutputSocket(), operation->getInputSocket(0)); - converter.addLink(operationRGBToYCC_Key->getOutputSocket(), operation->getInputSocket(1)); - converter.mapOutputSocket(outputSocketMatte, operation->getOutputSocket()); + converter.map_input_socket(input_socket_image, operationRGBToYCC_Image->get_input_socket(0)); + converter.map_input_socket(input_socket_key, operationRGBToYCC_Key->get_input_socket(0)); + converter.add_link(operationRGBToYCC_Image->get_output_socket(), operation->get_input_socket(0)); + converter.add_link(operationRGBToYCC_Key->get_output_socket(), operation->get_input_socket(1)); + converter.map_output_socket(output_socket_matte, operation->get_output_socket()); - converter.mapInputSocket(inputSocketImage, operationAlpha->getInputSocket(0)); - converter.addLink(operation->getOutputSocket(), operationAlpha->getInputSocket(1)); - converter.mapOutputSocket(outputSocketImage, operationAlpha->getOutputSocket()); + converter.map_input_socket(input_socket_image, operation_alpha->get_input_socket(0)); + converter.add_link(operation->get_output_socket(), operation_alpha->get_input_socket(1)); + converter.map_output_socket(output_socket_image, operation_alpha->get_output_socket()); - converter.addPreview(operationAlpha->getOutputSocket()); + converter.add_preview(operation_alpha->get_output_socket()); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ChromaMatteNode.h b/source/blender/compositor/nodes/COM_ChromaMatteNode.h index f3ddd013fa4..854c07c104b 100644 --- a/source/blender/compositor/nodes/COM_ChromaMatteNode.h +++ b/source/blender/compositor/nodes/COM_ChromaMatteNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class ChromaMatteNode : public Node { public: - ChromaMatteNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + ChromaMatteNode(bNode *editor_node); + void convert_to_operations(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 8f9d05ad1e1..e7c43161a00 100644 --- a/source/blender/compositor/nodes/COM_ColorBalanceNode.cc +++ b/source/blender/compositor/nodes/COM_ColorBalanceNode.cc @@ -22,20 +22,20 @@ namespace blender::compositor { -ColorBalanceNode::ColorBalanceNode(bNode *editorNode) : Node(editorNode) +ColorBalanceNode::ColorBalanceNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void ColorBalanceNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void ColorBalanceNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *node = this->getbNode(); + bNode *node = this->get_bnode(); NodeColorBalance *n = (NodeColorBalance *)node->storage; - NodeInput *inputSocket = this->getInputSocket(0); - NodeInput *inputImageSocket = this->getInputSocket(1); - NodeOutput *outputSocket = this->getOutputSocket(0); + NodeInput *input_socket = this->get_input_socket(0); + NodeInput *input_image_socket = this->get_input_socket(1); + NodeOutput *output_socket = this->get_output_socket(0); NodeOperation *operation; if (node->custom1 == 0) { @@ -47,9 +47,9 @@ void ColorBalanceNode::convertToOperations(NodeConverter &converter, gamma_inv[c] = (n->gamma[c] != 0.0f) ? 1.0f / n->gamma[c] : 1000000.0f; } - operationLGG->setGain(n->gain); - operationLGG->setLift(lift_lgg); - operationLGG->setGammaInv(gamma_inv); + operationLGG->set_gain(n->gain); + operationLGG->set_lift(lift_lgg); + operationLGG->set_gamma_inv(gamma_inv); operation = operationLGG; } else { @@ -59,16 +59,16 @@ void ColorBalanceNode::convertToOperations(NodeConverter &converter, copy_v3_fl(offset, n->offset_basis); add_v3_v3(offset, n->offset); - operationCDL->setOffset(offset); - operationCDL->setPower(n->power); - operationCDL->setSlope(n->slope); + operationCDL->set_offset(offset); + operationCDL->set_power(n->power); + operationCDL->set_slope(n->slope); operation = operationCDL; } - converter.addOperation(operation); + converter.add_operation(operation); - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.mapInputSocket(inputImageSocket, operation->getInputSocket(1)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + converter.map_input_socket(input_socket, operation->get_input_socket(0)); + converter.map_input_socket(input_image_socket, operation->get_input_socket(1)); + converter.map_output_socket(output_socket, operation->get_output_socket(0)); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ColorBalanceNode.h b/source/blender/compositor/nodes/COM_ColorBalanceNode.h index 243713b4912..3ac0b7cdee1 100644 --- a/source/blender/compositor/nodes/COM_ColorBalanceNode.h +++ b/source/blender/compositor/nodes/COM_ColorBalanceNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class ColorBalanceNode : public Node { public: - ColorBalanceNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + ColorBalanceNode(bNode *editor_node); + void convert_to_operations(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 b5bf118d7de..49d8a7fec98 100644 --- a/source/blender/compositor/nodes/COM_ColorCorrectionNode.cc +++ b/source/blender/compositor/nodes/COM_ColorCorrectionNode.cc @@ -21,26 +21,26 @@ namespace blender::compositor { -ColorCorrectionNode::ColorCorrectionNode(bNode *editorNode) : Node(editorNode) +ColorCorrectionNode::ColorCorrectionNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void ColorCorrectionNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void ColorCorrectionNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *editorNode = getbNode(); + bNode *editor_node = get_bnode(); ColorCorrectionOperation *operation = new ColorCorrectionOperation(); - operation->setData((NodeColorCorrection *)editorNode->storage); - operation->setRedChannelEnabled((editorNode->custom1 & 1) != 0); - operation->setGreenChannelEnabled((editorNode->custom1 & 2) != 0); - operation->setBlueChannelEnabled((editorNode->custom1 & 4) != 0); - converter.addOperation(operation); + operation->set_data((NodeColorCorrection *)editor_node->storage); + operation->set_red_channel_enabled((editor_node->custom1 & 1) != 0); + operation->set_green_channel_enabled((editor_node->custom1 & 2) != 0); + operation->set_blue_channel_enabled((editor_node->custom1 & 4) != 0); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0)); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ColorCorrectionNode.h b/source/blender/compositor/nodes/COM_ColorCorrectionNode.h index aee07ee07a3..6fe4212e428 100644 --- a/source/blender/compositor/nodes/COM_ColorCorrectionNode.h +++ b/source/blender/compositor/nodes/COM_ColorCorrectionNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class ColorCorrectionNode : public Node { public: - ColorCorrectionNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + ColorCorrectionNode(bNode *editor_node); + void convert_to_operations(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 4a82a42b036..5b59b2bee14 100644 --- a/source/blender/compositor/nodes/COM_ColorCurveNode.cc +++ b/source/blender/compositor/nodes/COM_ColorCurveNode.cc @@ -21,39 +21,39 @@ namespace blender::compositor { -ColorCurveNode::ColorCurveNode(bNode *editorNode) : Node(editorNode) +ColorCurveNode::ColorCurveNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void ColorCurveNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void ColorCurveNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - if (this->getInputSocket(2)->isLinked() || this->getInputSocket(3)->isLinked()) { + if (this->get_input_socket(2)->is_linked() || this->get_input_socket(3)->is_linked()) { ColorCurveOperation *operation = new ColorCurveOperation(); - operation->setCurveMapping((CurveMapping *)this->getbNode()->storage); - converter.addOperation(operation); + operation->set_curve_mapping((CurveMapping *)this->get_bnode()->storage); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); - converter.mapInputSocket(getInputSocket(3), operation->getInputSocket(3)); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1)); + converter.map_input_socket(get_input_socket(2), operation->get_input_socket(2)); + converter.map_input_socket(get_input_socket(3), operation->get_input_socket(3)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket()); } else { ConstantLevelColorCurveOperation *operation = new ConstantLevelColorCurveOperation(); float col[4]; - this->getInputSocket(2)->getEditorValueColor(col); - operation->setBlackLevel(col); - this->getInputSocket(3)->getEditorValueColor(col); - operation->setWhiteLevel(col); - operation->setCurveMapping((CurveMapping *)this->getbNode()->storage); - converter.addOperation(operation); - - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); + this->get_input_socket(2)->get_editor_value_color(col); + operation->set_black_level(col); + this->get_input_socket(3)->get_editor_value_color(col); + operation->set_white_level(col); + operation->set_curve_mapping((CurveMapping *)this->get_bnode()->storage); + converter.add_operation(operation); + + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket()); } } diff --git a/source/blender/compositor/nodes/COM_ColorCurveNode.h b/source/blender/compositor/nodes/COM_ColorCurveNode.h index 89786b47cf5..852f755bf95 100644 --- a/source/blender/compositor/nodes/COM_ColorCurveNode.h +++ b/source/blender/compositor/nodes/COM_ColorCurveNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class ColorCurveNode : public Node { public: - ColorCurveNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + ColorCurveNode(bNode *editor_node); + void convert_to_operations(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 83507395108..2f5e6b0a7bf 100644 --- a/source/blender/compositor/nodes/COM_ColorExposureNode.cc +++ b/source/blender/compositor/nodes/COM_ColorExposureNode.cc @@ -21,20 +21,20 @@ namespace blender::compositor { -ExposureNode::ExposureNode(bNode *editorNode) : Node(editorNode) +ExposureNode::ExposureNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void ExposureNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void ExposureNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { ExposureOperation *operation = new ExposureOperation(); - converter.addOperation(operation); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0)); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ColorExposureNode.h b/source/blender/compositor/nodes/COM_ColorExposureNode.h index df9bfc65f81..33b143e0676 100644 --- a/source/blender/compositor/nodes/COM_ColorExposureNode.h +++ b/source/blender/compositor/nodes/COM_ColorExposureNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class ExposureNode : public Node { public: - ExposureNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + ExposureNode(bNode *editor_node); + void convert_to_operations(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 345cdb3ecf7..629ae932eb7 100644 --- a/source/blender/compositor/nodes/COM_ColorMatteNode.cc +++ b/source/blender/compositor/nodes/COM_ColorMatteNode.cc @@ -23,44 +23,44 @@ namespace blender::compositor { -ColorMatteNode::ColorMatteNode(bNode *editorNode) : Node(editorNode) +ColorMatteNode::ColorMatteNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void ColorMatteNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void ColorMatteNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *editorsnode = getbNode(); + bNode *editorsnode = get_bnode(); - NodeInput *inputSocketImage = this->getInputSocket(0); - NodeInput *inputSocketKey = this->getInputSocket(1); - NodeOutput *outputSocketImage = this->getOutputSocket(0); - NodeOutput *outputSocketMatte = this->getOutputSocket(1); + NodeInput *input_socket_image = this->get_input_socket(0); + NodeInput *input_socket_key = this->get_input_socket(1); + NodeOutput *output_socket_image = this->get_output_socket(0); + NodeOutput *output_socket_matte = this->get_output_socket(1); ConvertRGBToHSVOperation *operationRGBToHSV_Image = new ConvertRGBToHSVOperation(); ConvertRGBToHSVOperation *operationRGBToHSV_Key = new ConvertRGBToHSVOperation(); - converter.addOperation(operationRGBToHSV_Image); - converter.addOperation(operationRGBToHSV_Key); + converter.add_operation(operationRGBToHSV_Image); + converter.add_operation(operationRGBToHSV_Key); ColorMatteOperation *operation = new ColorMatteOperation(); - operation->setSettings((NodeChroma *)editorsnode->storage); - converter.addOperation(operation); + operation->set_settings((NodeChroma *)editorsnode->storage); + converter.add_operation(operation); - SetAlphaMultiplyOperation *operationAlpha = new SetAlphaMultiplyOperation(); - converter.addOperation(operationAlpha); + SetAlphaMultiplyOperation *operation_alpha = new SetAlphaMultiplyOperation(); + converter.add_operation(operation_alpha); - converter.mapInputSocket(inputSocketImage, operationRGBToHSV_Image->getInputSocket(0)); - converter.mapInputSocket(inputSocketKey, operationRGBToHSV_Key->getInputSocket(0)); - converter.addLink(operationRGBToHSV_Image->getOutputSocket(), operation->getInputSocket(0)); - converter.addLink(operationRGBToHSV_Key->getOutputSocket(), operation->getInputSocket(1)); - converter.mapOutputSocket(outputSocketMatte, operation->getOutputSocket(0)); + converter.map_input_socket(input_socket_image, operationRGBToHSV_Image->get_input_socket(0)); + converter.map_input_socket(input_socket_key, operationRGBToHSV_Key->get_input_socket(0)); + converter.add_link(operationRGBToHSV_Image->get_output_socket(), operation->get_input_socket(0)); + converter.add_link(operationRGBToHSV_Key->get_output_socket(), operation->get_input_socket(1)); + converter.map_output_socket(output_socket_matte, operation->get_output_socket(0)); - converter.mapInputSocket(inputSocketImage, operationAlpha->getInputSocket(0)); - converter.addLink(operation->getOutputSocket(), operationAlpha->getInputSocket(1)); - converter.mapOutputSocket(outputSocketImage, operationAlpha->getOutputSocket()); + converter.map_input_socket(input_socket_image, operation_alpha->get_input_socket(0)); + converter.add_link(operation->get_output_socket(), operation_alpha->get_input_socket(1)); + converter.map_output_socket(output_socket_image, operation_alpha->get_output_socket()); - converter.addPreview(operationAlpha->getOutputSocket()); + converter.add_preview(operation_alpha->get_output_socket()); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ColorMatteNode.h b/source/blender/compositor/nodes/COM_ColorMatteNode.h index 9d70b6d8416..3e1bfd607e8 100644 --- a/source/blender/compositor/nodes/COM_ColorMatteNode.h +++ b/source/blender/compositor/nodes/COM_ColorMatteNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class ColorMatteNode : public Node { public: - ColorMatteNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + ColorMatteNode(bNode *editor_node); + void convert_to_operations(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 e79f2eb97af..2d875d703c7 100644 --- a/source/blender/compositor/nodes/COM_ColorNode.cc +++ b/source/blender/compositor/nodes/COM_ColorNode.cc @@ -21,22 +21,22 @@ namespace blender::compositor { -ColorNode::ColorNode(bNode *editorNode) : Node(editorNode) +ColorNode::ColorNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void ColorNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void ColorNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { SetColorOperation *operation = new SetColorOperation(); - NodeOutput *output = this->getOutputSocket(0); + NodeOutput *output = this->get_output_socket(0); float col[4]; - output->getEditorValueColor(col); - operation->setChannels(col); - converter.addOperation(operation); + output->get_editor_value_color(col); + operation->set_channels(col); + converter.add_operation(operation); - converter.mapOutputSocket(output, operation->getOutputSocket()); + converter.map_output_socket(output, operation->get_output_socket()); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ColorNode.h b/source/blender/compositor/nodes/COM_ColorNode.h index ae3bf575bb4..f5b932f6321 100644 --- a/source/blender/compositor/nodes/COM_ColorNode.h +++ b/source/blender/compositor/nodes/COM_ColorNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class ColorNode : public Node { public: - ColorNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + ColorNode(bNode *editor_node); + void convert_to_operations(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 e4346459dd4..7ae83be65c2 100644 --- a/source/blender/compositor/nodes/COM_ColorRampNode.cc +++ b/source/blender/compositor/nodes/COM_ColorRampNode.cc @@ -22,32 +22,32 @@ namespace blender::compositor { -ColorRampNode::ColorRampNode(bNode *editorNode) : Node(editorNode) +ColorRampNode::ColorRampNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void ColorRampNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void ColorRampNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *inputSocket = this->getInputSocket(0); - NodeOutput *outputSocket = this->getOutputSocket(0); - NodeOutput *outputSocketAlpha = this->getOutputSocket(1); - bNode *editorNode = this->getbNode(); + NodeInput *input_socket = this->get_input_socket(0); + NodeOutput *output_socket = this->get_output_socket(0); + NodeOutput *output_socket_alpha = this->get_output_socket(1); + bNode *editor_node = this->get_bnode(); ColorRampOperation *operation = new ColorRampOperation(); - operation->setColorBand((ColorBand *)editorNode->storage); - converter.addOperation(operation); + operation->set_color_band((ColorBand *)editor_node->storage); + converter.add_operation(operation); - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + converter.map_input_socket(input_socket, operation->get_input_socket(0)); + converter.map_output_socket(output_socket, operation->get_output_socket(0)); SeparateChannelOperation *operation2 = new SeparateChannelOperation(); - operation2->setChannel(3); - converter.addOperation(operation2); + operation2->set_channel(3); + converter.add_operation(operation2); - converter.addLink(operation->getOutputSocket(), operation2->getInputSocket(0)); - converter.mapOutputSocket(outputSocketAlpha, operation2->getOutputSocket()); + converter.add_link(operation->get_output_socket(), operation2->get_input_socket(0)); + converter.map_output_socket(output_socket_alpha, operation2->get_output_socket()); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ColorRampNode.h b/source/blender/compositor/nodes/COM_ColorRampNode.h index d0c0e43d56c..70e10311b2a 100644 --- a/source/blender/compositor/nodes/COM_ColorRampNode.h +++ b/source/blender/compositor/nodes/COM_ColorRampNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class ColorRampNode : public Node { public: - ColorRampNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + ColorRampNode(bNode *editor_node); + void convert_to_operations(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 d0bd4eb12ea..063c515b460 100644 --- a/source/blender/compositor/nodes/COM_ColorSpillNode.cc +++ b/source/blender/compositor/nodes/COM_ColorSpillNode.cc @@ -21,30 +21,30 @@ namespace blender::compositor { -ColorSpillNode::ColorSpillNode(bNode *editorNode) : Node(editorNode) +ColorSpillNode::ColorSpillNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void ColorSpillNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void ColorSpillNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *editorsnode = getbNode(); + bNode *editorsnode = get_bnode(); - NodeInput *inputSocketImage = this->getInputSocket(0); - NodeInput *inputSocketFac = this->getInputSocket(1); - NodeOutput *outputSocketImage = this->getOutputSocket(0); + NodeInput *input_socket_image = this->get_input_socket(0); + NodeInput *input_socket_fac = this->get_input_socket(1); + NodeOutput *output_socket_image = this->get_output_socket(0); ColorSpillOperation *operation; operation = new ColorSpillOperation(); - operation->setSettings((NodeColorspill *)editorsnode->storage); - operation->setSpillChannel(editorsnode->custom1 - 1); /* Channel for spilling */ - operation->setSpillMethod(editorsnode->custom2); /* Channel method */ - converter.addOperation(operation); - - converter.mapInputSocket(inputSocketImage, operation->getInputSocket(0)); - converter.mapInputSocket(inputSocketFac, operation->getInputSocket(1)); - converter.mapOutputSocket(outputSocketImage, operation->getOutputSocket()); + operation->set_settings((NodeColorspill *)editorsnode->storage); + operation->set_spill_channel(editorsnode->custom1 - 1); /* Channel for spilling */ + operation->set_spill_method(editorsnode->custom2); /* Channel method */ + converter.add_operation(operation); + + converter.map_input_socket(input_socket_image, operation->get_input_socket(0)); + converter.map_input_socket(input_socket_fac, operation->get_input_socket(1)); + converter.map_output_socket(output_socket_image, operation->get_output_socket()); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ColorSpillNode.h b/source/blender/compositor/nodes/COM_ColorSpillNode.h index 731a76e8811..3a9b0e665e8 100644 --- a/source/blender/compositor/nodes/COM_ColorSpillNode.h +++ b/source/blender/compositor/nodes/COM_ColorSpillNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class ColorSpillNode : public Node { public: - ColorSpillNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + ColorSpillNode(bNode *editor_node); + void convert_to_operations(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 ac051ab0d55..c021ee59b9e 100644 --- a/source/blender/compositor/nodes/COM_ColorToBWNode.cc +++ b/source/blender/compositor/nodes/COM_ColorToBWNode.cc @@ -22,22 +22,22 @@ namespace blender::compositor { -ColorToBWNode::ColorToBWNode(bNode *editorNode) : Node(editorNode) +ColorToBWNode::ColorToBWNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void ColorToBWNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void ColorToBWNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *colorSocket = this->getInputSocket(0); - NodeOutput *valueSocket = this->getOutputSocket(0); + NodeInput *color_socket = this->get_input_socket(0); + NodeOutput *value_socket = this->get_output_socket(0); - ConvertColorToBWOperation *convertProg = new ConvertColorToBWOperation(); - converter.addOperation(convertProg); + ConvertColorToBWOperation *convert_prog = new ConvertColorToBWOperation(); + converter.add_operation(convert_prog); - converter.mapInputSocket(colorSocket, convertProg->getInputSocket(0)); - converter.mapOutputSocket(valueSocket, convertProg->getOutputSocket(0)); + converter.map_input_socket(color_socket, convert_prog->get_input_socket(0)); + converter.map_output_socket(value_socket, convert_prog->get_output_socket(0)); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ColorToBWNode.h b/source/blender/compositor/nodes/COM_ColorToBWNode.h index 60c08a3c886..7018f30f559 100644 --- a/source/blender/compositor/nodes/COM_ColorToBWNode.h +++ b/source/blender/compositor/nodes/COM_ColorToBWNode.h @@ -29,9 +29,9 @@ namespace blender::compositor { */ class ColorToBWNode : public Node { public: - ColorToBWNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + ColorToBWNode(bNode *editor_node); + void convert_to_operations(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 dd68780dc19..a37fc6ad5fa 100644 --- a/source/blender/compositor/nodes/COM_CombineColorNode.cc +++ b/source/blender/compositor/nodes/COM_CombineColorNode.cc @@ -22,70 +22,70 @@ namespace blender::compositor { -CombineColorNode::CombineColorNode(bNode *editorNode) : Node(editorNode) +CombineColorNode::CombineColorNode(bNode *editor_node) : Node(editor_node) { } -void CombineColorNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void CombineColorNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - NodeInput *inputRSocket = this->getInputSocket(0); - NodeInput *inputGSocket = this->getInputSocket(1); - NodeInput *inputBSocket = this->getInputSocket(2); - NodeInput *inputASocket = this->getInputSocket(3); - NodeOutput *outputSocket = this->getOutputSocket(0); + NodeInput *input_rsocket = this->get_input_socket(0); + NodeInput *input_gsocket = this->get_input_socket(1); + NodeInput *input_bsocket = this->get_input_socket(2); + NodeInput *input_asocket = this->get_input_socket(3); + NodeOutput *output_socket = this->get_output_socket(0); CombineChannelsOperation *operation = new CombineChannelsOperation(); - if (inputRSocket->isLinked()) { + if (input_rsocket->is_linked()) { operation->set_canvas_input_index(0); } - else if (inputGSocket->isLinked()) { + else if (input_gsocket->is_linked()) { operation->set_canvas_input_index(1); } - else if (inputBSocket->isLinked()) { + else if (input_bsocket->is_linked()) { operation->set_canvas_input_index(2); } else { operation->set_canvas_input_index(3); } - converter.addOperation(operation); + converter.add_operation(operation); - converter.mapInputSocket(inputRSocket, operation->getInputSocket(0)); - converter.mapInputSocket(inputGSocket, operation->getInputSocket(1)); - converter.mapInputSocket(inputBSocket, operation->getInputSocket(2)); - converter.mapInputSocket(inputASocket, operation->getInputSocket(3)); + converter.map_input_socket(input_rsocket, operation->get_input_socket(0)); + converter.map_input_socket(input_gsocket, operation->get_input_socket(1)); + converter.map_input_socket(input_bsocket, operation->get_input_socket(2)); + converter.map_input_socket(input_asocket, operation->get_input_socket(3)); - NodeOperation *color_conv = getColorConverter(context); + NodeOperation *color_conv = get_color_converter(context); if (color_conv) { - converter.addOperation(color_conv); + converter.add_operation(color_conv); - converter.addLink(operation->getOutputSocket(), color_conv->getInputSocket(0)); - converter.mapOutputSocket(outputSocket, color_conv->getOutputSocket()); + converter.add_link(operation->get_output_socket(), color_conv->get_input_socket(0)); + converter.map_output_socket(output_socket, color_conv->get_output_socket()); } else { - converter.mapOutputSocket(outputSocket, operation->getOutputSocket()); + converter.map_output_socket(output_socket, operation->get_output_socket()); } } -NodeOperation *CombineRGBANode::getColorConverter(const CompositorContext & /*context*/) const +NodeOperation *CombineRGBANode::get_color_converter(const CompositorContext & /*context*/) const { return nullptr; /* no conversion needed */ } -NodeOperation *CombineHSVANode::getColorConverter(const CompositorContext & /*context*/) const +NodeOperation *CombineHSVANode::get_color_converter(const CompositorContext & /*context*/) const { return new ConvertHSVToRGBOperation(); } -NodeOperation *CombineYCCANode::getColorConverter(const CompositorContext & /*context*/) const +NodeOperation *CombineYCCANode::get_color_converter(const CompositorContext & /*context*/) const { ConvertYCCToRGBOperation *operation = new ConvertYCCToRGBOperation(); - bNode *editorNode = this->getbNode(); - operation->setMode(editorNode->custom1); + bNode *editor_node = this->get_bnode(); + operation->set_mode(editor_node->custom1); return operation; } -NodeOperation *CombineYUVANode::getColorConverter(const CompositorContext & /*context*/) const +NodeOperation *CombineYUVANode::get_color_converter(const CompositorContext & /*context*/) const { return new ConvertYUVToRGBOperation(); } diff --git a/source/blender/compositor/nodes/COM_CombineColorNode.h b/source/blender/compositor/nodes/COM_CombineColorNode.h index 29d3fa37817..3252fc779f4 100644 --- a/source/blender/compositor/nodes/COM_CombineColorNode.h +++ b/source/blender/compositor/nodes/COM_CombineColorNode.h @@ -24,48 +24,48 @@ namespace blender::compositor { class CombineColorNode : public Node { public: - CombineColorNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + CombineColorNode(bNode *editor_node); + void convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const override; protected: - virtual NodeOperation *getColorConverter(const CompositorContext &context) const = 0; + virtual NodeOperation *get_color_converter(const CompositorContext &context) const = 0; }; class CombineRGBANode : public CombineColorNode { public: - CombineRGBANode(bNode *editorNode) : CombineColorNode(editorNode) + CombineRGBANode(bNode *editor_node) : CombineColorNode(editor_node) { } - NodeOperation *getColorConverter(const CompositorContext &context) const override; + NodeOperation *get_color_converter(const CompositorContext &context) const override; }; class CombineHSVANode : public CombineColorNode { public: - CombineHSVANode(bNode *editorNode) : CombineColorNode(editorNode) + CombineHSVANode(bNode *editor_node) : CombineColorNode(editor_node) { } - NodeOperation *getColorConverter(const CompositorContext &context) const override; + NodeOperation *get_color_converter(const CompositorContext &context) const override; }; class CombineYCCANode : public CombineColorNode { public: - CombineYCCANode(bNode *editorNode) : CombineColorNode(editorNode) + CombineYCCANode(bNode *editor_node) : CombineColorNode(editor_node) { } - NodeOperation *getColorConverter(const CompositorContext &context) const override; + NodeOperation *get_color_converter(const CompositorContext &context) const override; }; class CombineYUVANode : public CombineColorNode { public: - CombineYUVANode(bNode *editorNode) : CombineColorNode(editorNode) + CombineYUVANode(bNode *editor_node) : CombineColorNode(editor_node) { } - NodeOperation *getColorConverter(const CompositorContext &context) const override; + NodeOperation *get_color_converter(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 10c87b8c886..5121a7cc123 100644 --- a/source/blender/compositor/nodes/COM_CompositorNode.cc +++ b/source/blender/compositor/nodes/COM_CompositorNode.cc @@ -21,44 +21,44 @@ namespace blender::compositor { -CompositorNode::CompositorNode(bNode *editorNode) : Node(editorNode) +CompositorNode::CompositorNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void CompositorNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void CompositorNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *editorNode = this->getbNode(); - bool is_active = (editorNode->flag & NODE_DO_OUTPUT_RECALC) || context.isRendering(); - bool ignore_alpha = (editorNode->custom2 & CMP_NODE_OUTPUT_IGNORE_ALPHA) != 0; + bNode *editor_node = this->get_bnode(); + bool is_active = (editor_node->flag & NODE_DO_OUTPUT_RECALC) || context.is_rendering(); + bool ignore_alpha = (editor_node->custom2 & CMP_NODE_OUTPUT_IGNORE_ALPHA) != 0; - NodeInput *imageSocket = this->getInputSocket(0); - NodeInput *alphaSocket = this->getInputSocket(1); - NodeInput *depthSocket = this->getInputSocket(2); + NodeInput *image_socket = this->get_input_socket(0); + NodeInput *alpha_socket = this->get_input_socket(1); + NodeInput *depth_socket = this->get_input_socket(2); - CompositorOperation *compositorOperation = new CompositorOperation(); - compositorOperation->setScene(context.getScene()); - compositorOperation->setSceneName(context.getScene()->id.name); - compositorOperation->setRenderData(context.getRenderData()); - compositorOperation->setViewName(context.getViewName()); - compositorOperation->setbNodeTree(context.getbNodeTree()); + CompositorOperation *compositor_operation = new CompositorOperation(); + compositor_operation->set_scene(context.get_scene()); + compositor_operation->set_scene_name(context.get_scene()->id.name); + compositor_operation->set_render_data(context.get_render_data()); + compositor_operation->set_view_name(context.get_view_name()); + compositor_operation->set_bnodetree(context.get_bnodetree()); /* alpha socket gives either 1 or a custom alpha value if "use alpha" is enabled */ - compositorOperation->setUseAlphaInput(ignore_alpha || alphaSocket->isLinked()); - compositorOperation->setActive(is_active); + compositor_operation->set_use_alpha_input(ignore_alpha || alpha_socket->is_linked()); + compositor_operation->set_active(is_active); - converter.addOperation(compositorOperation); - converter.mapInputSocket(imageSocket, compositorOperation->getInputSocket(0)); + converter.add_operation(compositor_operation); + converter.map_input_socket(image_socket, compositor_operation->get_input_socket(0)); /* only use alpha link if "use alpha" is enabled */ if (ignore_alpha) { - converter.addInputValue(compositorOperation->getInputSocket(1), 1.0f); + converter.add_input_value(compositor_operation->get_input_socket(1), 1.0f); } else { - converter.mapInputSocket(alphaSocket, compositorOperation->getInputSocket(1)); + converter.map_input_socket(alpha_socket, compositor_operation->get_input_socket(1)); } - converter.mapInputSocket(depthSocket, compositorOperation->getInputSocket(2)); + converter.map_input_socket(depth_socket, compositor_operation->get_input_socket(2)); - converter.addNodeInputPreview(imageSocket); + converter.add_node_input_preview(image_socket); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_CompositorNode.h b/source/blender/compositor/nodes/COM_CompositorNode.h index 4da9f9a766f..68005230ba2 100644 --- a/source/blender/compositor/nodes/COM_CompositorNode.h +++ b/source/blender/compositor/nodes/COM_CompositorNode.h @@ -29,9 +29,9 @@ namespace blender::compositor { */ class CompositorNode : public Node { public: - CompositorNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + CompositorNode(bNode *editor_node); + void convert_to_operations(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 649d851fe84..c2c4b989007 100644 --- a/source/blender/compositor/nodes/COM_ConvertAlphaNode.cc +++ b/source/blender/compositor/nodes/COM_ConvertAlphaNode.cc @@ -21,11 +21,11 @@ namespace blender::compositor { -void ConvertAlphaNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void ConvertAlphaNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { NodeOperation *operation = nullptr; - bNode *node = this->getbNode(); + bNode *node = this->get_bnode(); /* value hardcoded in rna_nodetree.c */ if (node->custom1 == 1) { @@ -35,10 +35,10 @@ void ConvertAlphaNode::convertToOperations(NodeConverter &converter, operation = new ConvertStraightToPremulOperation(); } - converter.addOperation(operation); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket()); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ConvertAlphaNode.h b/source/blender/compositor/nodes/COM_ConvertAlphaNode.h index f3d0ef2cd5b..8f26c82c110 100644 --- a/source/blender/compositor/nodes/COM_ConvertAlphaNode.h +++ b/source/blender/compositor/nodes/COM_ConvertAlphaNode.h @@ -28,11 +28,11 @@ namespace blender::compositor { */ class ConvertAlphaNode : public Node { public: - ConvertAlphaNode(bNode *editorNode) : Node(editorNode) + ConvertAlphaNode(bNode *editor_node) : Node(editor_node) { } - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + void convert_to_operations(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 fb188dc45f8..0f7b58db89d 100644 --- a/source/blender/compositor/nodes/COM_CornerPinNode.cc +++ b/source/blender/compositor/nodes/COM_CornerPinNode.cc @@ -21,14 +21,14 @@ namespace blender::compositor { -CornerPinNode::CornerPinNode(bNode *editorNode) : Node(editorNode) +CornerPinNode::CornerPinNode(bNode *editor_node) : Node(editor_node) { } -void CornerPinNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void CornerPinNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *input_image = this->getInputSocket(0); + NodeInput *input_image = this->get_input_socket(0); /* NOTE: socket order differs between UI node and operations: * bNode uses intuitive order following top-down layout: * upper-left, upper-right, lower-left, lower-right @@ -37,22 +37,22 @@ void CornerPinNode::convertToOperations(NodeConverter &converter, */ const int node_corner_index[4] = {3, 4, 2, 1}; - NodeOutput *output_warped_image = this->getOutputSocket(0); - NodeOutput *output_plane = this->getOutputSocket(1); + NodeOutput *output_warped_image = this->get_output_socket(0); + NodeOutput *output_plane = this->get_output_socket(1); PlaneCornerPinWarpImageOperation *warp_image_operation = new PlaneCornerPinWarpImageOperation(); - converter.addOperation(warp_image_operation); + converter.add_operation(warp_image_operation); PlaneCornerPinMaskOperation *plane_mask_operation = new PlaneCornerPinMaskOperation(); - converter.addOperation(plane_mask_operation); + converter.add_operation(plane_mask_operation); - converter.mapInputSocket(input_image, warp_image_operation->getInputSocket(0)); + converter.map_input_socket(input_image, warp_image_operation->get_input_socket(0)); for (int i = 0; i < 4; i++) { - NodeInput *corner_input = getInputSocket(node_corner_index[i]); - converter.mapInputSocket(corner_input, warp_image_operation->getInputSocket(i + 1)); - converter.mapInputSocket(corner_input, plane_mask_operation->getInputSocket(i)); + NodeInput *corner_input = get_input_socket(node_corner_index[i]); + converter.map_input_socket(corner_input, warp_image_operation->get_input_socket(i + 1)); + converter.map_input_socket(corner_input, plane_mask_operation->get_input_socket(i)); } - converter.mapOutputSocket(output_warped_image, warp_image_operation->getOutputSocket()); - converter.mapOutputSocket(output_plane, plane_mask_operation->getOutputSocket()); + converter.map_output_socket(output_warped_image, warp_image_operation->get_output_socket()); + converter.map_output_socket(output_plane, plane_mask_operation->get_output_socket()); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_CornerPinNode.h b/source/blender/compositor/nodes/COM_CornerPinNode.h index 779e057ebb5..a1b4d107126 100644 --- a/source/blender/compositor/nodes/COM_CornerPinNode.h +++ b/source/blender/compositor/nodes/COM_CornerPinNode.h @@ -29,9 +29,9 @@ namespace blender::compositor { */ class CornerPinNode : public Node { public: - CornerPinNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + CornerPinNode(bNode *editor_node); + void convert_to_operations(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 3f01062c789..e33af232f17 100644 --- a/source/blender/compositor/nodes/COM_CropNode.cc +++ b/source/blender/compositor/nodes/COM_CropNode.cc @@ -21,31 +21,31 @@ namespace blender::compositor { -CropNode::CropNode(bNode *editorNode) : Node(editorNode) +CropNode::CropNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void CropNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void CropNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *node = getbNode(); - NodeTwoXYs *cropSettings = (NodeTwoXYs *)node->storage; + bNode *node = get_bnode(); + NodeTwoXYs *crop_settings = (NodeTwoXYs *)node->storage; bool relative = (bool)node->custom2; - bool cropImage = (bool)node->custom1; + bool crop_image = (bool)node->custom1; CropBaseOperation *operation; - if (cropImage) { + if (crop_image) { operation = new CropImageOperation(); } else { operation = new CropOperation(); } - operation->setCropSettings(cropSettings); - operation->setRelative(relative); - converter.addOperation(operation); + operation->set_crop_settings(crop_settings); + operation->set_relative(relative); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(), operation->getOutputSocket()); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_output_socket(get_output_socket(), operation->get_output_socket()); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_CropNode.h b/source/blender/compositor/nodes/COM_CropNode.h index be3c9a268f9..55324bb37df 100644 --- a/source/blender/compositor/nodes/COM_CropNode.h +++ b/source/blender/compositor/nodes/COM_CropNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class CropNode : public Node { public: - CropNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + CropNode(bNode *editor_node); + void convert_to_operations(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 21596d5aebb..f54088627e1 100644 --- a/source/blender/compositor/nodes/COM_CryptomatteNode.cc +++ b/source/blender/compositor/nodes/COM_CryptomatteNode.cc @@ -30,41 +30,41 @@ namespace blender::compositor { /** \name Cryptomatte Base * \{ */ -void CryptomatteBaseNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void CryptomatteBaseNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - NodeOutput *output_image_socket = this->getOutputSocket(0); + NodeOutput *output_image_socket = this->get_output_socket(0); - bNode *node = this->getbNode(); + bNode *node = this->get_bnode(); NodeCryptomatte *cryptomatte_settings = static_cast<NodeCryptomatte *>(node->storage); CryptomatteOperation *cryptomatte_operation = create_cryptomatte_operation( converter, context, *node, cryptomatte_settings); - converter.addOperation(cryptomatte_operation); + converter.add_operation(cryptomatte_operation); - NodeOutput *output_matte_socket = this->getOutputSocket(1); + NodeOutput *output_matte_socket = this->get_output_socket(1); SeparateChannelOperation *extract_mask_operation = new SeparateChannelOperation; - extract_mask_operation->setChannel(3); - converter.addOperation(extract_mask_operation); - converter.addLink(cryptomatte_operation->getOutputSocket(0), - extract_mask_operation->getInputSocket(0)); - converter.mapOutputSocket(output_matte_socket, extract_mask_operation->getOutputSocket(0)); + extract_mask_operation->set_channel(3); + converter.add_operation(extract_mask_operation); + converter.add_link(cryptomatte_operation->get_output_socket(0), + extract_mask_operation->get_input_socket(0)); + converter.map_output_socket(output_matte_socket, extract_mask_operation->get_output_socket(0)); - NodeInput *input_image_socket = this->getInputSocket(0); + NodeInput *input_image_socket = this->get_input_socket(0); SetAlphaMultiplyOperation *apply_mask_operation = new SetAlphaMultiplyOperation(); - converter.mapInputSocket(input_image_socket, apply_mask_operation->getInputSocket(0)); - converter.addOperation(apply_mask_operation); - converter.addLink(extract_mask_operation->getOutputSocket(0), - apply_mask_operation->getInputSocket(1)); - converter.mapOutputSocket(output_image_socket, apply_mask_operation->getOutputSocket(0)); + converter.map_input_socket(input_image_socket, apply_mask_operation->get_input_socket(0)); + converter.add_operation(apply_mask_operation); + converter.add_link(extract_mask_operation->get_output_socket(0), + apply_mask_operation->get_input_socket(1)); + converter.map_output_socket(output_image_socket, apply_mask_operation->get_output_socket(0)); - NodeOutput *output_pick_socket = this->getOutputSocket(2); + NodeOutput *output_pick_socket = this->get_output_socket(2); SetAlphaMultiplyOperation *extract_pick_operation = new SetAlphaMultiplyOperation(); - converter.addOperation(extract_pick_operation); - converter.addInputValue(extract_pick_operation->getInputSocket(1), 1.0f); - converter.addLink(cryptomatte_operation->getOutputSocket(0), - extract_pick_operation->getInputSocket(0)); - converter.mapOutputSocket(output_pick_socket, extract_pick_operation->getOutputSocket(0)); + converter.add_operation(extract_pick_operation); + converter.add_input_value(extract_pick_operation->get_input_socket(1), 1.0f); + converter.add_link(cryptomatte_operation->get_output_socket(0), + extract_pick_operation->get_input_socket(0)); + converter.map_output_socket(output_pick_socket, extract_pick_operation->get_output_socket(0)); } /** \} */ @@ -76,7 +76,7 @@ void CryptomatteBaseNode::convertToOperations(NodeConverter &converter, static std::string prefix_from_node(const CompositorContext &context, const bNode &node) { char prefix[MAX_NAME]; - ntreeCompositCryptomatteLayerPrefix(context.getScene(), &node, prefix, sizeof(prefix)); + ntreeCompositCryptomatteLayerPrefix(context.get_scene(), &node, prefix, sizeof(prefix)); return std::string(prefix, BLI_strnlen(prefix, sizeof(prefix))); } @@ -120,7 +120,7 @@ void CryptomatteNode::input_operations_from_render_source( RenderLayer *render_layer = RE_GetRenderLayer(render_result, view_layer->name); if (render_layer) { LISTBASE_FOREACH (RenderPass *, render_pass, &render_layer->passes) { - if (context.has_explicit_view() && !STREQ(render_pass->view, context.getViewName())) { + if (context.has_explicit_view() && !STREQ(render_pass->view, context.get_view_name())) { continue; } @@ -128,10 +128,10 @@ void CryptomatteNode::input_operations_from_render_source( if (blender::StringRef(combined_name).startswith(prefix)) { RenderLayersProg *op = new RenderLayersProg( render_pass->name, DataType::Color, render_pass->channels); - op->setScene(scene); - op->setLayerId(view_layer_id); - op->setRenderData(context.getRenderData()); - op->setViewName(context.getViewName()); + op->set_scene(scene); + op->set_layer_id(view_layer_id); + op->set_render_data(context.get_render_data()); + op->set_view_name(context.get_view_name()); r_input_operations.append(op); } } @@ -157,7 +157,7 @@ void CryptomatteNode::input_operations_from_image_source( } ImageUser *iuser = &cryptomatte_settings->iuser; - BKE_image_user_frame_calc(image, iuser, context.getFramenumber()); + BKE_image_user_frame_calc(image, iuser, context.get_framenumber()); ImBuf *ibuf = BKE_image_acquire_ibuf(image, iuser, nullptr); if (image->rr) { @@ -167,7 +167,7 @@ void CryptomatteNode::input_operations_from_image_source( /* Heuristic to match image name with scene names, check if the view name exists in the * image. */ view = BLI_findstringindex( - &image->rr->views, context.getViewName(), offsetof(RenderView, name)); + &image->rr->views, context.get_view_name(), offsetof(RenderView, name)); if (view == -1) { view = 0; } @@ -189,10 +189,10 @@ void CryptomatteNode::input_operations_from_image_source( if (blender::StringRef(combined_name).startswith(prefix)) { MultilayerColorOperation *op = new MultilayerColorOperation( render_layer, render_pass, view); - op->setImage(image); - op->setImageUser(iuser); + op->set_image(image); + op->set_image_user(iuser); iuser->layer = layer_index; - op->setFramenumber(context.getFramenumber()); + op->set_framenumber(context.get_framenumber()); r_input_operations.append(op); } } @@ -217,10 +217,10 @@ Vector<NodeOperation *> CryptomatteNode::create_input_operations(const Composito if (input_operations.is_empty()) { SetColorOperation *op = new SetColorOperation(); - op->setChannel1(0.0f); - op->setChannel2(1.0f); - op->setChannel3(0.0f); - op->setChannel4(0.0f); + op->set_channel1(0.0f); + op->set_channel2(1.0f); + op->set_channel3(0.0f); + op->set_channel4(0.0f); input_operations.append(op); } return input_operations; @@ -234,11 +234,11 @@ CryptomatteOperation *CryptomatteNode::create_cryptomatte_operation( Vector<NodeOperation *> input_operations = create_input_operations(context, node); CryptomatteOperation *operation = new CryptomatteOperation(input_operations.size()); LISTBASE_FOREACH (CryptomatteEntry *, cryptomatte_entry, &cryptomatte_settings->entries) { - operation->addObjectIndex(cryptomatte_entry->encoded_hash); + operation->add_object_index(cryptomatte_entry->encoded_hash); } for (int i = 0; i < input_operations.size(); ++i) { - converter.addOperation(input_operations[i]); - converter.addLink(input_operations[i]->getOutputSocket(), operation->getInputSocket(i)); + converter.add_operation(input_operations[i]); + converter.add_link(input_operations[i]->get_output_socket(), operation->get_input_socket(i)); } return operation; } @@ -259,12 +259,12 @@ CryptomatteOperation *CryptomatteLegacyNode::create_cryptomatte_operation( CryptomatteOperation *operation = new CryptomatteOperation(num_inputs); if (cryptomatte_settings) { LISTBASE_FOREACH (CryptomatteEntry *, cryptomatte_entry, &cryptomatte_settings->entries) { - operation->addObjectIndex(cryptomatte_entry->encoded_hash); + operation->add_object_index(cryptomatte_entry->encoded_hash); } } for (int i = 0; i < num_inputs; i++) { - converter.mapInputSocket(this->getInputSocket(i + 1), operation->getInputSocket(i)); + converter.map_input_socket(this->get_input_socket(i + 1), operation->get_input_socket(i)); } return operation; diff --git a/source/blender/compositor/nodes/COM_CryptomatteNode.h b/source/blender/compositor/nodes/COM_CryptomatteNode.h index eacb49e2033..7ca1084886b 100644 --- a/source/blender/compositor/nodes/COM_CryptomatteNode.h +++ b/source/blender/compositor/nodes/COM_CryptomatteNode.h @@ -38,8 +38,8 @@ class CryptomatteBaseNode : public Node { } public: - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + void convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const override; protected: virtual CryptomatteOperation *create_cryptomatte_operation( diff --git a/source/blender/compositor/nodes/COM_DefocusNode.cc b/source/blender/compositor/nodes/COM_DefocusNode.cc index 6f1361df284..684f9014c3c 100644 --- a/source/blender/compositor/nodes/COM_DefocusNode.cc +++ b/source/blender/compositor/nodes/COM_DefocusNode.cc @@ -26,58 +26,58 @@ namespace blender::compositor { -DefocusNode::DefocusNode(bNode *editorNode) : Node(editorNode) +DefocusNode::DefocusNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void DefocusNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void DefocusNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *node = this->getbNode(); + bNode *node = this->get_bnode(); NodeDefocus *data = (NodeDefocus *)node->storage; - Scene *scene = node->id ? (Scene *)node->id : context.getScene(); + Scene *scene = node->id ? (Scene *)node->id : context.get_scene(); Object *camob = scene ? scene->camera : nullptr; - NodeOperation *radiusOperation; + NodeOperation *radius_operation; if (data->no_zbuf) { MathMultiplyOperation *multiply = new MathMultiplyOperation(); SetValueOperation *multiplier = new SetValueOperation(); - multiplier->setValue(data->scale); - SetValueOperation *maxRadius = new SetValueOperation(); - maxRadius->setValue(data->maxblur); + multiplier->set_value(data->scale); + SetValueOperation *max_radius = new SetValueOperation(); + max_radius->set_value(data->maxblur); MathMinimumOperation *minimize = new MathMinimumOperation(); - converter.addOperation(multiply); - converter.addOperation(multiplier); - converter.addOperation(maxRadius); - converter.addOperation(minimize); + converter.add_operation(multiply); + converter.add_operation(multiplier); + converter.add_operation(max_radius); + converter.add_operation(minimize); - converter.mapInputSocket(getInputSocket(1), multiply->getInputSocket(0)); - converter.addLink(multiplier->getOutputSocket(), multiply->getInputSocket(1)); - converter.addLink(multiply->getOutputSocket(), minimize->getInputSocket(0)); - converter.addLink(maxRadius->getOutputSocket(), minimize->getInputSocket(1)); + converter.map_input_socket(get_input_socket(1), multiply->get_input_socket(0)); + converter.add_link(multiplier->get_output_socket(), multiply->get_input_socket(1)); + converter.add_link(multiply->get_output_socket(), minimize->get_input_socket(0)); + converter.add_link(max_radius->get_output_socket(), minimize->get_input_socket(1)); - radiusOperation = minimize; + radius_operation = minimize; } else { ConvertDepthToRadiusOperation *radius_op = new ConvertDepthToRadiusOperation(); - radius_op->setCameraObject(camob); - radius_op->setfStop(data->fstop); - radius_op->setMaxRadius(data->maxblur); - converter.addOperation(radius_op); + radius_op->set_camera_object(camob); + radius_op->setf_stop(data->fstop); + radius_op->set_max_radius(data->maxblur); + converter.add_operation(radius_op); - converter.mapInputSocket(getInputSocket(1), radius_op->getInputSocket(0)); + converter.map_input_socket(get_input_socket(1), radius_op->get_input_socket(0)); FastGaussianBlurValueOperation *blur = new FastGaussianBlurValueOperation(); /* maintain close pixels so far Z values don't bleed into the foreground */ - blur->setOverlay(FAST_GAUSS_OVERLAY_MIN); - converter.addOperation(blur); + blur->set_overlay(FAST_GAUSS_OVERLAY_MIN); + converter.add_operation(blur); - converter.addLink(radius_op->getOutputSocket(0), blur->getInputSocket(0)); - radius_op->setPostBlur(blur); + converter.add_link(radius_op->get_output_socket(0), blur->get_input_socket(0)); + radius_op->set_post_blur(blur); - radiusOperation = blur; + radius_operation = blur; } NodeBokehImage *bokehdata = new NodeBokehImage(); @@ -92,49 +92,49 @@ void DefocusNode::convertToOperations(NodeConverter &converter, bokehdata->lensshift = 0.0f; BokehImageOperation *bokeh = new BokehImageOperation(); - bokeh->setData(bokehdata); - bokeh->deleteDataOnFinish(); - converter.addOperation(bokeh); + bokeh->set_data(bokehdata); + bokeh->delete_data_on_finish(); + converter.add_operation(bokeh); #ifdef COM_DEFOCUS_SEARCH InverseSearchRadiusOperation *search = new InverseSearchRadiusOperation(); - search->setMaxBlur(data->maxblur); - converter.addOperation(search); + search->set_max_blur(data->maxblur); + converter.add_operation(search); - converter.addLink(radiusOperation->getOutputSocket(0), search->getInputSocket(0)); + converter.add_link(radius_operation->get_output_socket(0), search->get_input_socket(0)); #endif VariableSizeBokehBlurOperation *operation = new VariableSizeBokehBlurOperation(); if (data->preview) { - operation->setQuality(eCompositorQuality::Low); + operation->set_quality(eCompositorQuality::Low); } else { - operation->setQuality(context.getQuality()); + operation->set_quality(context.get_quality()); } - operation->setMaxBlur(data->maxblur); - operation->setThreshold(data->bthresh); - converter.addOperation(operation); + operation->set_max_blur(data->maxblur); + operation->set_threshold(data->bthresh); + converter.add_operation(operation); - converter.addLink(bokeh->getOutputSocket(), operation->getInputSocket(1)); - converter.addLink(radiusOperation->getOutputSocket(), operation->getInputSocket(2)); + converter.add_link(bokeh->get_output_socket(), operation->get_input_socket(1)); + converter.add_link(radius_operation->get_output_socket(), operation->get_input_socket(2)); #ifdef COM_DEFOCUS_SEARCH - converter.addLink(search->getOutputSocket(), operation->getInputSocket(3)); + converter.add_link(search->get_output_socket(), operation->get_input_socket(3)); #endif if (data->gamco) { GammaCorrectOperation *correct = new GammaCorrectOperation(); - converter.addOperation(correct); + converter.add_operation(correct); GammaUncorrectOperation *inverse = new GammaUncorrectOperation(); - converter.addOperation(inverse); + converter.add_operation(inverse); - converter.mapInputSocket(getInputSocket(0), correct->getInputSocket(0)); - converter.addLink(correct->getOutputSocket(), operation->getInputSocket(0)); - converter.addLink(operation->getOutputSocket(), inverse->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(), inverse->getOutputSocket()); + converter.map_input_socket(get_input_socket(0), correct->get_input_socket(0)); + converter.add_link(correct->get_output_socket(), operation->get_input_socket(0)); + converter.add_link(operation->get_output_socket(), inverse->get_input_socket(0)); + converter.map_output_socket(get_output_socket(), inverse->get_output_socket()); } else { - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(), operation->getOutputSocket()); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_output_socket(get_output_socket(), operation->get_output_socket()); } } diff --git a/source/blender/compositor/nodes/COM_DefocusNode.h b/source/blender/compositor/nodes/COM_DefocusNode.h index 5e51a0ccd52..58993495bee 100644 --- a/source/blender/compositor/nodes/COM_DefocusNode.h +++ b/source/blender/compositor/nodes/COM_DefocusNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class DefocusNode : public Node { public: - DefocusNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + DefocusNode(bNode *editor_node); + void convert_to_operations(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 e576966626c..2ff8870f716 100644 --- a/source/blender/compositor/nodes/COM_DenoiseNode.cc +++ b/source/blender/compositor/nodes/COM_DenoiseNode.cc @@ -20,51 +20,51 @@ namespace blender::compositor { -DenoiseNode::DenoiseNode(bNode *editorNode) : Node(editorNode) +DenoiseNode::DenoiseNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void DenoiseNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void DenoiseNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { if (!COM_is_denoise_supported()) { - converter.mapOutputSocket(getOutputSocket(0), - converter.addInputProxy(getInputSocket(0), false)); + converter.map_output_socket(get_output_socket(0), + converter.add_input_proxy(get_input_socket(0), false)); return; } - bNode *node = this->getbNode(); + bNode *node = this->get_bnode(); NodeDenoise *denoise = (NodeDenoise *)node->storage; DenoiseOperation *operation = new DenoiseOperation(); - converter.addOperation(operation); - operation->setDenoiseSettings(denoise); + converter.add_operation(operation); + operation->set_denoise_settings(denoise); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); if (denoise && denoise->prefilter == CMP_NODE_DENOISE_PREFILTER_ACCURATE) { { DenoisePrefilterOperation *normal_prefilter = new DenoisePrefilterOperation( DataType::Vector); normal_prefilter->set_image_name("normal"); - converter.addOperation(normal_prefilter); - converter.mapInputSocket(getInputSocket(1), normal_prefilter->getInputSocket(0)); - converter.addLink(normal_prefilter->getOutputSocket(), operation->getInputSocket(1)); + converter.add_operation(normal_prefilter); + converter.map_input_socket(get_input_socket(1), normal_prefilter->get_input_socket(0)); + converter.add_link(normal_prefilter->get_output_socket(), operation->get_input_socket(1)); } { DenoisePrefilterOperation *albedo_prefilter = new DenoisePrefilterOperation(DataType::Color); albedo_prefilter->set_image_name("albedo"); - converter.addOperation(albedo_prefilter); - converter.mapInputSocket(getInputSocket(2), albedo_prefilter->getInputSocket(0)); - converter.addLink(albedo_prefilter->getOutputSocket(), operation->getInputSocket(2)); + converter.add_operation(albedo_prefilter); + converter.map_input_socket(get_input_socket(2), albedo_prefilter->get_input_socket(0)); + converter.add_link(albedo_prefilter->get_output_socket(), operation->get_input_socket(2)); } } else { - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); + converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1)); + converter.map_input_socket(get_input_socket(2), operation->get_input_socket(2)); } - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0)); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_DenoiseNode.h b/source/blender/compositor/nodes/COM_DenoiseNode.h index 91be8e3e3ad..7e18c22c1e9 100644 --- a/source/blender/compositor/nodes/COM_DenoiseNode.h +++ b/source/blender/compositor/nodes/COM_DenoiseNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class DenoiseNode : public Node { public: - DenoiseNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + DenoiseNode(bNode *editor_node); + void convert_to_operations(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 1a068112210..12c9d50f214 100644 --- a/source/blender/compositor/nodes/COM_DespeckleNode.cc +++ b/source/blender/compositor/nodes/COM_DespeckleNode.cc @@ -21,29 +21,29 @@ namespace blender::compositor { -DespeckleNode::DespeckleNode(bNode *editorNode) : Node(editorNode) +DespeckleNode::DespeckleNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void DespeckleNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void DespeckleNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *editorNode = this->getbNode(); - NodeInput *inputSocket = this->getInputSocket(0); - NodeInput *inputImageSocket = this->getInputSocket(1); - NodeOutput *outputSocket = this->getOutputSocket(0); + bNode *editor_node = this->get_bnode(); + NodeInput *input_socket = this->get_input_socket(0); + NodeInput *input_image_socket = this->get_input_socket(1); + NodeOutput *output_socket = this->get_output_socket(0); DespeckleOperation *operation = new DespeckleOperation(); - operation->setThreshold(editorNode->custom3); - operation->setThresholdNeighbor(editorNode->custom4); - converter.addOperation(operation); + operation->set_threshold(editor_node->custom3); + operation->set_threshold_neighbor(editor_node->custom4); + converter.add_operation(operation); - converter.mapInputSocket(inputImageSocket, operation->getInputSocket(0)); - converter.mapInputSocket(inputSocket, operation->getInputSocket(1)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket()); + converter.map_input_socket(input_image_socket, operation->get_input_socket(0)); + converter.map_input_socket(input_socket, operation->get_input_socket(1)); + converter.map_output_socket(output_socket, operation->get_output_socket()); - converter.addPreview(operation->getOutputSocket(0)); + converter.add_preview(operation->get_output_socket(0)); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_DespeckleNode.h b/source/blender/compositor/nodes/COM_DespeckleNode.h index 2f268e99e1b..2c3af600aed 100644 --- a/source/blender/compositor/nodes/COM_DespeckleNode.h +++ b/source/blender/compositor/nodes/COM_DespeckleNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class DespeckleNode : public Node { public: - DespeckleNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + DespeckleNode(bNode *editor_node); + void convert_to_operations(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 9700b761eca..ceb5be7bd08 100644 --- a/source/blender/compositor/nodes/COM_DifferenceMatteNode.cc +++ b/source/blender/compositor/nodes/COM_DifferenceMatteNode.cc @@ -22,36 +22,36 @@ namespace blender::compositor { -DifferenceMatteNode::DifferenceMatteNode(bNode *editorNode) : Node(editorNode) +DifferenceMatteNode::DifferenceMatteNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void DifferenceMatteNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void DifferenceMatteNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *inputSocket = this->getInputSocket(0); - NodeInput *inputSocket2 = this->getInputSocket(1); - NodeOutput *outputSocketImage = this->getOutputSocket(0); - NodeOutput *outputSocketMatte = this->getOutputSocket(1); - bNode *editorNode = this->getbNode(); + NodeInput *input_socket = this->get_input_socket(0); + NodeInput *input_socket2 = this->get_input_socket(1); + NodeOutput *output_socket_image = this->get_output_socket(0); + NodeOutput *output_socket_matte = this->get_output_socket(1); + bNode *editor_node = this->get_bnode(); - DifferenceMatteOperation *operationSet = new DifferenceMatteOperation(); - operationSet->setSettings((NodeChroma *)editorNode->storage); - converter.addOperation(operationSet); + DifferenceMatteOperation *operation_set = new DifferenceMatteOperation(); + operation_set->set_settings((NodeChroma *)editor_node->storage); + converter.add_operation(operation_set); - converter.mapInputSocket(inputSocket, operationSet->getInputSocket(0)); - converter.mapInputSocket(inputSocket2, operationSet->getInputSocket(1)); - converter.mapOutputSocket(outputSocketMatte, operationSet->getOutputSocket(0)); + converter.map_input_socket(input_socket, operation_set->get_input_socket(0)); + converter.map_input_socket(input_socket2, operation_set->get_input_socket(1)); + converter.map_output_socket(output_socket_matte, operation_set->get_output_socket(0)); SetAlphaMultiplyOperation *operation = new SetAlphaMultiplyOperation(); - converter.addOperation(operation); + converter.add_operation(operation); - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.addLink(operationSet->getOutputSocket(), operation->getInputSocket(1)); - converter.mapOutputSocket(outputSocketImage, operation->getOutputSocket()); + converter.map_input_socket(input_socket, operation->get_input_socket(0)); + converter.add_link(operation_set->get_output_socket(), operation->get_input_socket(1)); + converter.map_output_socket(output_socket_image, operation->get_output_socket()); - converter.addPreview(operation->getOutputSocket()); + converter.add_preview(operation->get_output_socket()); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_DifferenceMatteNode.h b/source/blender/compositor/nodes/COM_DifferenceMatteNode.h index a173c723192..f99d4022507 100644 --- a/source/blender/compositor/nodes/COM_DifferenceMatteNode.h +++ b/source/blender/compositor/nodes/COM_DifferenceMatteNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class DifferenceMatteNode : public Node { public: - DifferenceMatteNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + DifferenceMatteNode(bNode *editor_node); + void convert_to_operations(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 ea7ce396189..b121fcb3724 100644 --- a/source/blender/compositor/nodes/COM_DilateErodeNode.cc +++ b/source/blender/compositor/nodes/COM_DilateErodeNode.cc @@ -24,126 +24,126 @@ namespace blender::compositor { -DilateErodeNode::DilateErodeNode(bNode *editorNode) : Node(editorNode) +DilateErodeNode::DilateErodeNode(bNode *editor_node) : Node(editor_node) { /* initialize node data */ NodeBlurData *data = &alpha_blur_; memset(data, 0, sizeof(NodeBlurData)); data->filtertype = R_FILTER_GAUSS; - if (editorNode->custom2 > 0) { - data->sizex = data->sizey = editorNode->custom2; + if (editor_node->custom2 > 0) { + data->sizex = data->sizey = editor_node->custom2; } else { - data->sizex = data->sizey = -editorNode->custom2; + data->sizex = data->sizey = -editor_node->custom2; } } -void DilateErodeNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void DilateErodeNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *editorNode = this->getbNode(); - if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE_THRESH) { + bNode *editor_node = this->get_bnode(); + if (editor_node->custom1 == CMP_NODE_DILATEERODE_DISTANCE_THRESH) { DilateErodeThresholdOperation *operation = new DilateErodeThresholdOperation(); - operation->setDistance(editorNode->custom2); - operation->setInset(editorNode->custom3); - converter.addOperation(operation); + operation->set_distance(editor_node->custom2); + operation->set_inset(editor_node->custom3); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); - if (editorNode->custom3 < 2.0f) { - AntiAliasOperation *antiAlias = new AntiAliasOperation(); - converter.addOperation(antiAlias); + if (editor_node->custom3 < 2.0f) { + AntiAliasOperation *anti_alias = new AntiAliasOperation(); + converter.add_operation(anti_alias); - converter.addLink(operation->getOutputSocket(), antiAlias->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(0), antiAlias->getOutputSocket(0)); + converter.add_link(operation->get_output_socket(), anti_alias->get_input_socket(0)); + converter.map_output_socket(get_output_socket(0), anti_alias->get_output_socket(0)); } else { - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0)); } } - else if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE) { - if (editorNode->custom2 > 0) { + else if (editor_node->custom1 == CMP_NODE_DILATEERODE_DISTANCE) { + if (editor_node->custom2 > 0) { DilateDistanceOperation *operation = new DilateDistanceOperation(); - operation->setDistance(editorNode->custom2); - converter.addOperation(operation); + operation->set_distance(editor_node->custom2); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0)); } else { ErodeDistanceOperation *operation = new ErodeDistanceOperation(); - operation->setDistance(-editorNode->custom2); - converter.addOperation(operation); + operation->set_distance(-editor_node->custom2); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0)); } } - else if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE_FEATHER) { + else if (editor_node->custom1 == CMP_NODE_DILATEERODE_DISTANCE_FEATHER) { /* this uses a modified gaussian blur function otherwise its far too slow */ - eCompositorQuality quality = context.getQuality(); + eCompositorQuality quality = context.get_quality(); GaussianAlphaXBlurOperation *operationx = new GaussianAlphaXBlurOperation(); - operationx->setData(&alpha_blur_); - operationx->setQuality(quality); - operationx->setFalloff(PROP_SMOOTH); - converter.addOperation(operationx); + operationx->set_data(&alpha_blur_); + operationx->set_quality(quality); + operationx->set_falloff(PROP_SMOOTH); + converter.add_operation(operationx); - converter.mapInputSocket(getInputSocket(0), operationx->getInputSocket(0)); - // converter.mapInputSocket(getInputSocket(1), operationx->getInputSocket(1)); // no size input - // yet + converter.map_input_socket(get_input_socket(0), operationx->get_input_socket(0)); + // converter.map_input_socket(get_input_socket(1), operationx->get_input_socket(1)); // no size + // input yet GaussianAlphaYBlurOperation *operationy = new GaussianAlphaYBlurOperation(); - operationy->setData(&alpha_blur_); - operationy->setQuality(quality); - operationy->setFalloff(PROP_SMOOTH); - converter.addOperation(operationy); + operationy->set_data(&alpha_blur_); + operationy->set_quality(quality); + operationy->set_falloff(PROP_SMOOTH); + converter.add_operation(operationy); - converter.addLink(operationx->getOutputSocket(), operationy->getInputSocket(0)); - // converter.mapInputSocket(getInputSocket(1), operationy->getInputSocket(1)); // no size input - // yet - converter.mapOutputSocket(getOutputSocket(0), operationy->getOutputSocket()); + converter.add_link(operationx->get_output_socket(), operationy->get_input_socket(0)); + // converter.map_input_socket(get_input_socket(1), operationy->get_input_socket(1)); // no size + // input yet + converter.map_output_socket(get_output_socket(0), operationy->get_output_socket()); - converter.addPreview(operationy->getOutputSocket()); + converter.add_preview(operationy->get_output_socket()); /* TODO? */ /* see gaussian blue node for original usage */ #if 0 - if (!connectedSizeSocket) { - operationx->setSize(size); - operationy->setSize(size); + if (!connected_size_socket) { + operationx->set_size(size); + operationy->set_size(size); } #else - operationx->setSize(1.0f); - operationy->setSize(1.0f); + operationx->set_size(1.0f); + operationy->set_size(1.0f); #endif - operationx->setSubtract(editorNode->custom2 < 0); - operationy->setSubtract(editorNode->custom2 < 0); + operationx->set_subtract(editor_node->custom2 < 0); + operationy->set_subtract(editor_node->custom2 < 0); - if (editorNode->storage) { - NodeDilateErode *data_storage = (NodeDilateErode *)editorNode->storage; - operationx->setFalloff(data_storage->falloff); - operationy->setFalloff(data_storage->falloff); + if (editor_node->storage) { + NodeDilateErode *data_storage = (NodeDilateErode *)editor_node->storage; + operationx->set_falloff(data_storage->falloff); + operationy->set_falloff(data_storage->falloff); } } else { - if (editorNode->custom2 > 0) { + if (editor_node->custom2 > 0) { DilateStepOperation *operation = new DilateStepOperation(); - operation->setIterations(editorNode->custom2); - converter.addOperation(operation); + operation->set_iterations(editor_node->custom2); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0)); } else { ErodeStepOperation *operation = new ErodeStepOperation(); - operation->setIterations(-editorNode->custom2); - converter.addOperation(operation); + operation->set_iterations(-editor_node->custom2); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0)); } } } diff --git a/source/blender/compositor/nodes/COM_DilateErodeNode.h b/source/blender/compositor/nodes/COM_DilateErodeNode.h index 2a635a8b0a6..df6abe7a6b6 100644 --- a/source/blender/compositor/nodes/COM_DilateErodeNode.h +++ b/source/blender/compositor/nodes/COM_DilateErodeNode.h @@ -31,9 +31,9 @@ class DilateErodeNode : public Node { NodeBlurData alpha_blur_; public: - DilateErodeNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + DilateErodeNode(bNode *editor_node); + void convert_to_operations(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 dce2a1a7911..b8e3e44f41f 100644 --- a/source/blender/compositor/nodes/COM_DirectionalBlurNode.cc +++ b/source/blender/compositor/nodes/COM_DirectionalBlurNode.cc @@ -21,22 +21,22 @@ namespace blender::compositor { -DirectionalBlurNode::DirectionalBlurNode(bNode *editorNode) : Node(editorNode) +DirectionalBlurNode::DirectionalBlurNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void DirectionalBlurNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void DirectionalBlurNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - NodeDBlurData *data = (NodeDBlurData *)this->getbNode()->storage; + NodeDBlurData *data = (NodeDBlurData *)this->get_bnode()->storage; DirectionalBlurOperation *operation = new DirectionalBlurOperation(); - operation->setQuality(context.getQuality()); - operation->setData(data); - converter.addOperation(operation); + operation->set_quality(context.get_quality()); + operation->set_data(data); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket()); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_DirectionalBlurNode.h b/source/blender/compositor/nodes/COM_DirectionalBlurNode.h index ce3ef378aaf..96a5122d134 100644 --- a/source/blender/compositor/nodes/COM_DirectionalBlurNode.h +++ b/source/blender/compositor/nodes/COM_DirectionalBlurNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class DirectionalBlurNode : public Node { public: - DirectionalBlurNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + DirectionalBlurNode(bNode *editor_node); + void convert_to_operations(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 d13c0c347fb..06208fb7d89 100644 --- a/source/blender/compositor/nodes/COM_DisplaceNode.cc +++ b/source/blender/compositor/nodes/COM_DisplaceNode.cc @@ -22,28 +22,28 @@ namespace blender::compositor { -DisplaceNode::DisplaceNode(bNode *editorNode) : Node(editorNode) +DisplaceNode::DisplaceNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void DisplaceNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void DisplaceNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { NodeOperation *operation; - if (context.getQuality() == eCompositorQuality::Low) { + if (context.get_quality() == eCompositorQuality::Low) { operation = new DisplaceSimpleOperation(); } else { operation = new DisplaceOperation(); } - converter.addOperation(operation); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); - converter.mapInputSocket(getInputSocket(3), operation->getInputSocket(3)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1)); + converter.map_input_socket(get_input_socket(2), operation->get_input_socket(2)); + converter.map_input_socket(get_input_socket(3), operation->get_input_socket(3)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket()); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_DisplaceNode.h b/source/blender/compositor/nodes/COM_DisplaceNode.h index b2495839da3..394624e8f60 100644 --- a/source/blender/compositor/nodes/COM_DisplaceNode.h +++ b/source/blender/compositor/nodes/COM_DisplaceNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class DisplaceNode : public Node { public: - DisplaceNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + DisplaceNode(bNode *editor_node); + void convert_to_operations(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 26886a6580f..db78e60fbbe 100644 --- a/source/blender/compositor/nodes/COM_DistanceMatteNode.cc +++ b/source/blender/compositor/nodes/COM_DistanceMatteNode.cc @@ -23,77 +23,78 @@ namespace blender::compositor { -DistanceMatteNode::DistanceMatteNode(bNode *editorNode) : Node(editorNode) +DistanceMatteNode::DistanceMatteNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void DistanceMatteNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void DistanceMatteNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *editorsnode = getbNode(); + bNode *editorsnode = get_bnode(); NodeChroma *storage = (NodeChroma *)editorsnode->storage; - NodeInput *inputSocketImage = this->getInputSocket(0); - NodeInput *inputSocketKey = this->getInputSocket(1); - NodeOutput *outputSocketImage = this->getOutputSocket(0); - NodeOutput *outputSocketMatte = this->getOutputSocket(1); + NodeInput *input_socket_image = this->get_input_socket(0); + NodeInput *input_socket_key = this->get_input_socket(1); + NodeOutput *output_socket_image = this->get_output_socket(0); + NodeOutput *output_socket_matte = this->get_output_socket(1); - SetAlphaMultiplyOperation *operationAlpha = new SetAlphaMultiplyOperation(); - converter.addOperation(operationAlpha); + SetAlphaMultiplyOperation *operation_alpha = new SetAlphaMultiplyOperation(); + converter.add_operation(operation_alpha); /* work in RGB color space */ NodeOperation *operation; if (storage->channel == 1) { DistanceRGBMatteOperation *matte = new DistanceRGBMatteOperation(); - matte->setSettings(storage); - converter.addOperation(matte); + matte->set_settings(storage); + converter.add_operation(matte); - converter.mapInputSocket(inputSocketImage, matte->getInputSocket(0)); - converter.mapInputSocket(inputSocketImage, operationAlpha->getInputSocket(0)); + converter.map_input_socket(input_socket_image, matte->get_input_socket(0)); + converter.map_input_socket(input_socket_image, operation_alpha->get_input_socket(0)); - converter.mapInputSocket(inputSocketKey, matte->getInputSocket(1)); + converter.map_input_socket(input_socket_key, matte->get_input_socket(1)); operation = matte; } /* work in YCbCr color space */ else { DistanceYCCMatteOperation *matte = new DistanceYCCMatteOperation(); - matte->setSettings(storage); - converter.addOperation(matte); + matte->set_settings(storage); + converter.add_operation(matte); - ConvertRGBToYCCOperation *operationYCCImage = new ConvertRGBToYCCOperation(); - ConvertRGBToYCCOperation *operationYCCMatte = new ConvertRGBToYCCOperation(); - operationYCCImage->setMode(BLI_YCC_ITU_BT709); - operationYCCMatte->setMode(BLI_YCC_ITU_BT709); - converter.addOperation(operationYCCImage); - converter.addOperation(operationYCCMatte); + ConvertRGBToYCCOperation *operation_yccimage = new ConvertRGBToYCCOperation(); + ConvertRGBToYCCOperation *operation_yccmatte = new ConvertRGBToYCCOperation(); + operation_yccimage->set_mode(BLI_YCC_ITU_BT709); + operation_yccmatte->set_mode(BLI_YCC_ITU_BT709); + converter.add_operation(operation_yccimage); + converter.add_operation(operation_yccmatte); - converter.mapInputSocket(inputSocketImage, operationYCCImage->getInputSocket(0)); - converter.addLink(operationYCCImage->getOutputSocket(), matte->getInputSocket(0)); - converter.addLink(operationYCCImage->getOutputSocket(), operationAlpha->getInputSocket(0)); + converter.map_input_socket(input_socket_image, operation_yccimage->get_input_socket(0)); + converter.add_link(operation_yccimage->get_output_socket(), matte->get_input_socket(0)); + converter.add_link(operation_yccimage->get_output_socket(), + operation_alpha->get_input_socket(0)); - converter.mapInputSocket(inputSocketKey, operationYCCMatte->getInputSocket(0)); - converter.addLink(operationYCCMatte->getOutputSocket(), matte->getInputSocket(1)); + converter.map_input_socket(input_socket_key, operation_yccmatte->get_input_socket(0)); + converter.add_link(operation_yccmatte->get_output_socket(), matte->get_input_socket(1)); operation = matte; } - converter.mapOutputSocket(outputSocketMatte, operation->getOutputSocket(0)); - converter.addLink(operation->getOutputSocket(), operationAlpha->getInputSocket(1)); + converter.map_output_socket(output_socket_matte, operation->get_output_socket(0)); + converter.add_link(operation->get_output_socket(), operation_alpha->get_input_socket(1)); if (storage->channel != 1) { ConvertYCCToRGBOperation *inv_convert = new ConvertYCCToRGBOperation(); - inv_convert->setMode(BLI_YCC_ITU_BT709); + inv_convert->set_mode(BLI_YCC_ITU_BT709); - converter.addOperation(inv_convert); - converter.addLink(operationAlpha->getOutputSocket(0), inv_convert->getInputSocket(0)); - converter.mapOutputSocket(outputSocketImage, inv_convert->getOutputSocket()); - converter.addPreview(inv_convert->getOutputSocket()); + converter.add_operation(inv_convert); + converter.add_link(operation_alpha->get_output_socket(0), inv_convert->get_input_socket(0)); + converter.map_output_socket(output_socket_image, inv_convert->get_output_socket()); + converter.add_preview(inv_convert->get_output_socket()); } else { - converter.mapOutputSocket(outputSocketImage, operationAlpha->getOutputSocket()); - converter.addPreview(operationAlpha->getOutputSocket()); + converter.map_output_socket(output_socket_image, operation_alpha->get_output_socket()); + converter.add_preview(operation_alpha->get_output_socket()); } } diff --git a/source/blender/compositor/nodes/COM_DistanceMatteNode.h b/source/blender/compositor/nodes/COM_DistanceMatteNode.h index 0baa531b4d2..d12e69d8065 100644 --- a/source/blender/compositor/nodes/COM_DistanceMatteNode.h +++ b/source/blender/compositor/nodes/COM_DistanceMatteNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class DistanceMatteNode : public Node { public: - DistanceMatteNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + DistanceMatteNode(bNode *editor_node); + void convert_to_operations(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 273f0ee7026..b88348ccc60 100644 --- a/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cc +++ b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cc @@ -21,25 +21,25 @@ namespace blender::compositor { -DoubleEdgeMaskNode::DoubleEdgeMaskNode(bNode *editorNode) : Node(editorNode) +DoubleEdgeMaskNode::DoubleEdgeMaskNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void DoubleEdgeMaskNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void DoubleEdgeMaskNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { DoubleEdgeMaskOperation *operation; - bNode *bnode = this->getbNode(); + bNode *bnode = this->get_bnode(); operation = new DoubleEdgeMaskOperation(); - operation->setAdjecentOnly(bnode->custom1); - operation->setKeepInside(bnode->custom2); - converter.addOperation(operation); + operation->set_adjecent_only(bnode->custom1); + operation->set_keep_inside(bnode->custom2); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0)); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.h b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.h index 90e009747c1..99b3b1d0546 100644 --- a/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.h +++ b/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class DoubleEdgeMaskNode : public Node { public: - DoubleEdgeMaskNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + DoubleEdgeMaskNode(bNode *editor_node); + void convert_to_operations(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 4f3703dceb1..1f6e2ab2a6c 100644 --- a/source/blender/compositor/nodes/COM_EllipseMaskNode.cc +++ b/source/blender/compositor/nodes/COM_EllipseMaskNode.cc @@ -24,52 +24,53 @@ namespace blender::compositor { -EllipseMaskNode::EllipseMaskNode(bNode *editorNode) : Node(editorNode) +EllipseMaskNode::EllipseMaskNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void EllipseMaskNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void EllipseMaskNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - NodeInput *inputSocket = this->getInputSocket(0); - NodeOutput *outputSocket = this->getOutputSocket(0); + NodeInput *input_socket = this->get_input_socket(0); + NodeOutput *output_socket = this->get_output_socket(0); EllipseMaskOperation *operation; operation = new EllipseMaskOperation(); - operation->setData((NodeEllipseMask *)this->getbNode()->storage); - operation->setMaskType(this->getbNode()->custom1); - converter.addOperation(operation); + operation->set_data((NodeEllipseMask *)this->get_bnode()->storage); + operation->set_mask_type(this->get_bnode()->custom1); + converter.add_operation(operation); - if (inputSocket->isLinked()) { - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket()); + if (input_socket->is_linked()) { + converter.map_input_socket(input_socket, operation->get_input_socket(0)); + converter.map_output_socket(output_socket, operation->get_output_socket()); } else { /* Value operation to produce original transparent image */ - SetValueOperation *valueOperation = new SetValueOperation(); - valueOperation->setValue(0.0f); - converter.addOperation(valueOperation); + SetValueOperation *value_operation = new SetValueOperation(); + value_operation->set_value(0.0f); + converter.add_operation(value_operation); /* Scale that image up to render resolution */ - const RenderData *rd = context.getRenderData(); - const float render_size_factor = context.getRenderPercentageAsFactor(); - ScaleFixedSizeOperation *scaleOperation = new ScaleFixedSizeOperation(); + const RenderData *rd = context.get_render_data(); + const float render_size_factor = context.get_render_percentage_as_factor(); + ScaleFixedSizeOperation *scale_operation = new ScaleFixedSizeOperation(); - scaleOperation->setIsAspect(false); - scaleOperation->setIsCrop(false); - scaleOperation->setOffset(0.0f, 0.0f); - scaleOperation->setNewWidth(rd->xsch * render_size_factor); - scaleOperation->setNewHeight(rd->ysch * render_size_factor); - scaleOperation->getInputSocket(0)->setResizeMode(ResizeMode::Align); - converter.addOperation(scaleOperation); + scale_operation->set_is_aspect(false); + scale_operation->set_is_crop(false); + scale_operation->set_offset(0.0f, 0.0f); + scale_operation->set_new_width(rd->xsch * render_size_factor); + scale_operation->set_new_height(rd->ysch * render_size_factor); + scale_operation->get_input_socket(0)->set_resize_mode(ResizeMode::Align); + converter.add_operation(scale_operation); - converter.addLink(valueOperation->getOutputSocket(0), scaleOperation->getInputSocket(0)); - converter.addLink(scaleOperation->getOutputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + converter.add_link(value_operation->get_output_socket(0), + scale_operation->get_input_socket(0)); + converter.add_link(scale_operation->get_output_socket(0), operation->get_input_socket(0)); + converter.map_output_socket(output_socket, operation->get_output_socket(0)); } - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); + converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1)); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_EllipseMaskNode.h b/source/blender/compositor/nodes/COM_EllipseMaskNode.h index cbe189be9f6..4a582b63d91 100644 --- a/source/blender/compositor/nodes/COM_EllipseMaskNode.h +++ b/source/blender/compositor/nodes/COM_EllipseMaskNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class EllipseMaskNode : public Node { public: - EllipseMaskNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + EllipseMaskNode(bNode *editor_node); + void convert_to_operations(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 4cdb00a87f4..2108e68cbec 100644 --- a/source/blender/compositor/nodes/COM_FilterNode.cc +++ b/source/blender/compositor/nodes/COM_FilterNode.cc @@ -22,20 +22,20 @@ namespace blender::compositor { -FilterNode::FilterNode(bNode *editorNode) : Node(editorNode) +FilterNode::FilterNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void FilterNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void FilterNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *inputSocket = this->getInputSocket(0); - NodeInput *inputImageSocket = this->getInputSocket(1); - NodeOutput *outputSocket = this->getOutputSocket(0); + NodeInput *input_socket = this->get_input_socket(0); + NodeInput *input_image_socket = this->get_input_socket(1); + NodeOutput *output_socket = this->get_output_socket(0); ConvolutionFilterOperation *operation = nullptr; - switch (this->getbNode()->custom1) { + switch (this->get_bnode()->custom1) { case CMP_FILT_SOFT: operation = new ConvolutionFilterOperation(); operation->set3x3Filter(1 / 16.0f, @@ -85,13 +85,13 @@ void FilterNode::convertToOperations(NodeConverter &converter, operation->set3x3Filter(0, 0, 0, 0, 1, 0, 0, 0, 0); break; } - converter.addOperation(operation); + converter.add_operation(operation); - converter.mapInputSocket(inputImageSocket, operation->getInputSocket(0)); - converter.mapInputSocket(inputSocket, operation->getInputSocket(1)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket()); + converter.map_input_socket(input_image_socket, operation->get_input_socket(0)); + converter.map_input_socket(input_socket, operation->get_input_socket(1)); + converter.map_output_socket(output_socket, operation->get_output_socket()); - converter.addPreview(operation->getOutputSocket(0)); + converter.add_preview(operation->get_output_socket(0)); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_FilterNode.h b/source/blender/compositor/nodes/COM_FilterNode.h index f7f4176cea5..c160e11fd9f 100644 --- a/source/blender/compositor/nodes/COM_FilterNode.h +++ b/source/blender/compositor/nodes/COM_FilterNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class FilterNode : public Node { public: - FilterNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + FilterNode(bNode *editor_node); + void convert_to_operations(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 1c613bde674..ec9a4f9419b 100644 --- a/source/blender/compositor/nodes/COM_FlipNode.cc +++ b/source/blender/compositor/nodes/COM_FlipNode.cc @@ -22,18 +22,18 @@ namespace blender::compositor { -FlipNode::FlipNode(bNode *editorNode) : Node(editorNode) +FlipNode::FlipNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void FlipNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void FlipNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *inputSocket = this->getInputSocket(0); - NodeOutput *outputSocket = this->getOutputSocket(0); + NodeInput *input_socket = this->get_input_socket(0); + NodeOutput *output_socket = this->get_output_socket(0); FlipOperation *operation = new FlipOperation(); - switch (this->getbNode()->custom1) { + switch (this->get_bnode()->custom1) { case 0: /* TODO: I didn't find any constants in the old implementation, * should I introduce them. */ operation->setFlipX(true); @@ -49,9 +49,9 @@ void FlipNode::convertToOperations(NodeConverter &converter, break; } - converter.addOperation(operation); - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + converter.add_operation(operation); + converter.map_input_socket(input_socket, operation->get_input_socket(0)); + converter.map_output_socket(output_socket, operation->get_output_socket(0)); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_FlipNode.h b/source/blender/compositor/nodes/COM_FlipNode.h index ee61d09fbba..40dc44edbbe 100644 --- a/source/blender/compositor/nodes/COM_FlipNode.h +++ b/source/blender/compositor/nodes/COM_FlipNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class FlipNode : public Node { public: - FlipNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + FlipNode(bNode *editor_node); + void convert_to_operations(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 31253a90462..3c4e885ff76 100644 --- a/source/blender/compositor/nodes/COM_GammaNode.cc +++ b/source/blender/compositor/nodes/COM_GammaNode.cc @@ -21,20 +21,20 @@ namespace blender::compositor { -GammaNode::GammaNode(bNode *editorNode) : Node(editorNode) +GammaNode::GammaNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void GammaNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void GammaNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { GammaOperation *operation = new GammaOperation(); - converter.addOperation(operation); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0)); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_GammaNode.h b/source/blender/compositor/nodes/COM_GammaNode.h index 29c9ed170fa..3c7a8ee4983 100644 --- a/source/blender/compositor/nodes/COM_GammaNode.h +++ b/source/blender/compositor/nodes/COM_GammaNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class GammaNode : public Node { public: - GammaNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + GammaNode(bNode *editor_node); + void convert_to_operations(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 bbbbb7fa7ee..77b1162f7cc 100644 --- a/source/blender/compositor/nodes/COM_GlareNode.cc +++ b/source/blender/compositor/nodes/COM_GlareNode.cc @@ -27,15 +27,15 @@ namespace blender::compositor { -GlareNode::GlareNode(bNode *editorNode) : Node(editorNode) +GlareNode::GlareNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void GlareNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void GlareNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *node = this->getbNode(); + bNode *node = this->get_bnode(); NodeGlare *glare = (NodeGlare *)node->storage; GlareBaseOperation *glareoperation = nullptr; @@ -55,30 +55,31 @@ void GlareNode::convertToOperations(NodeConverter &converter, break; } BLI_assert(glareoperation); - glareoperation->setGlareSettings(glare); + glareoperation->set_glare_settings(glare); - GlareThresholdOperation *thresholdOperation = new GlareThresholdOperation(); - thresholdOperation->setGlareSettings(glare); + GlareThresholdOperation *threshold_operation = new GlareThresholdOperation(); + threshold_operation->set_glare_settings(glare); SetValueOperation *mixvalueoperation = new SetValueOperation(); - mixvalueoperation->setValue(glare->mix); + mixvalueoperation->set_value(glare->mix); MixGlareOperation *mixoperation = new MixGlareOperation(); mixoperation->set_canvas_input_index(1); - mixoperation->getInputSocket(2)->setResizeMode(ResizeMode::FitAny); + mixoperation->get_input_socket(2)->set_resize_mode(ResizeMode::FitAny); - converter.addOperation(glareoperation); - converter.addOperation(thresholdOperation); - converter.addOperation(mixvalueoperation); - converter.addOperation(mixoperation); + converter.add_operation(glareoperation); + converter.add_operation(threshold_operation); + converter.add_operation(mixvalueoperation); + converter.add_operation(mixoperation); - converter.mapInputSocket(getInputSocket(0), thresholdOperation->getInputSocket(0)); - converter.addLink(thresholdOperation->getOutputSocket(), glareoperation->getInputSocket(0)); + converter.map_input_socket(get_input_socket(0), threshold_operation->get_input_socket(0)); + converter.add_link(threshold_operation->get_output_socket(), + glareoperation->get_input_socket(0)); - converter.addLink(mixvalueoperation->getOutputSocket(), mixoperation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(0), mixoperation->getInputSocket(1)); - converter.addLink(glareoperation->getOutputSocket(), mixoperation->getInputSocket(2)); - converter.mapOutputSocket(getOutputSocket(), mixoperation->getOutputSocket()); + converter.add_link(mixvalueoperation->get_output_socket(), mixoperation->get_input_socket(0)); + converter.map_input_socket(get_input_socket(0), mixoperation->get_input_socket(1)); + converter.add_link(glareoperation->get_output_socket(), mixoperation->get_input_socket(2)); + converter.map_output_socket(get_output_socket(), mixoperation->get_output_socket()); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_GlareNode.h b/source/blender/compositor/nodes/COM_GlareNode.h index 7db5fa85e04..85e657984cd 100644 --- a/source/blender/compositor/nodes/COM_GlareNode.h +++ b/source/blender/compositor/nodes/COM_GlareNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class GlareNode : public Node { public: - GlareNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + GlareNode(bNode *editor_node); + void convert_to_operations(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 3cf4b218bb2..6cf9a5356c4 100644 --- a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cc +++ b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.cc @@ -24,41 +24,42 @@ namespace blender::compositor { -HueSaturationValueCorrectNode::HueSaturationValueCorrectNode(bNode *editorNode) : Node(editorNode) +HueSaturationValueCorrectNode::HueSaturationValueCorrectNode(bNode *editor_node) + : Node(editor_node) { /* pass */ } -void HueSaturationValueCorrectNode::convertToOperations( +void HueSaturationValueCorrectNode::convert_to_operations( NodeConverter &converter, const CompositorContext & /*context*/) const { - NodeInput *valueSocket = this->getInputSocket(0); - NodeInput *colorSocket = this->getInputSocket(1); - NodeOutput *outputSocket = this->getOutputSocket(0); - bNode *editorsnode = getbNode(); + NodeInput *value_socket = this->get_input_socket(0); + NodeInput *color_socket = this->get_input_socket(1); + NodeOutput *output_socket = this->get_output_socket(0); + bNode *editorsnode = get_bnode(); CurveMapping *storage = (CurveMapping *)editorsnode->storage; ConvertRGBToHSVOperation *rgbToHSV = new ConvertRGBToHSVOperation(); - converter.addOperation(rgbToHSV); + converter.add_operation(rgbToHSV); ConvertHSVToRGBOperation *hsvToRGB = new ConvertHSVToRGBOperation(); - converter.addOperation(hsvToRGB); + converter.add_operation(hsvToRGB); HueSaturationValueCorrectOperation *changeHSV = new HueSaturationValueCorrectOperation(); - changeHSV->setCurveMapping(storage); - converter.addOperation(changeHSV); + changeHSV->set_curve_mapping(storage); + converter.add_operation(changeHSV); MixBlendOperation *blend = new MixBlendOperation(); blend->set_canvas_input_index(1); - converter.addOperation(blend); + converter.add_operation(blend); - converter.mapInputSocket(colorSocket, rgbToHSV->getInputSocket(0)); - converter.addLink(rgbToHSV->getOutputSocket(), changeHSV->getInputSocket(0)); - converter.addLink(changeHSV->getOutputSocket(), hsvToRGB->getInputSocket(0)); - converter.addLink(hsvToRGB->getOutputSocket(), blend->getInputSocket(2)); - converter.mapInputSocket(colorSocket, blend->getInputSocket(1)); - converter.mapInputSocket(valueSocket, blend->getInputSocket(0)); - converter.mapOutputSocket(outputSocket, blend->getOutputSocket()); + converter.map_input_socket(color_socket, rgbToHSV->get_input_socket(0)); + converter.add_link(rgbToHSV->get_output_socket(), changeHSV->get_input_socket(0)); + converter.add_link(changeHSV->get_output_socket(), hsvToRGB->get_input_socket(0)); + converter.add_link(hsvToRGB->get_output_socket(), blend->get_input_socket(2)); + converter.map_input_socket(color_socket, blend->get_input_socket(1)); + converter.map_input_socket(value_socket, blend->get_input_socket(0)); + converter.map_output_socket(output_socket, blend->get_output_socket()); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.h b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.h index d75b2ba51ca..1f59c06cb9f 100644 --- a/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.h +++ b/source/blender/compositor/nodes/COM_HueSaturationValueCorrectNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class HueSaturationValueCorrectNode : public Node { public: - HueSaturationValueCorrectNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + HueSaturationValueCorrectNode(bNode *editor_node); + void convert_to_operations(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 7711c306f24..fa296f54d8f 100644 --- a/source/blender/compositor/nodes/COM_HueSaturationValueNode.cc +++ b/source/blender/compositor/nodes/COM_HueSaturationValueNode.cc @@ -24,44 +24,44 @@ namespace blender::compositor { -HueSaturationValueNode::HueSaturationValueNode(bNode *editorNode) : Node(editorNode) +HueSaturationValueNode::HueSaturationValueNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void HueSaturationValueNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void HueSaturationValueNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *colorSocket = this->getInputSocket(0); - NodeInput *hueSocket = this->getInputSocket(1); - NodeInput *saturationSocket = this->getInputSocket(2); - NodeInput *valueSocket = this->getInputSocket(3); - NodeInput *facSocket = this->getInputSocket(4); - NodeOutput *outputSocket = this->getOutputSocket(0); + NodeInput *color_socket = this->get_input_socket(0); + NodeInput *hue_socket = this->get_input_socket(1); + NodeInput *saturation_socket = this->get_input_socket(2); + NodeInput *value_socket = this->get_input_socket(3); + NodeInput *fac_socket = this->get_input_socket(4); + NodeOutput *output_socket = this->get_output_socket(0); ConvertRGBToHSVOperation *rgbToHSV = new ConvertRGBToHSVOperation(); - converter.addOperation(rgbToHSV); + converter.add_operation(rgbToHSV); ConvertHSVToRGBOperation *hsvToRGB = new ConvertHSVToRGBOperation(); - converter.addOperation(hsvToRGB); + converter.add_operation(hsvToRGB); ChangeHSVOperation *changeHSV = new ChangeHSVOperation(); - converter.mapInputSocket(hueSocket, changeHSV->getInputSocket(1)); - converter.mapInputSocket(saturationSocket, changeHSV->getInputSocket(2)); - converter.mapInputSocket(valueSocket, changeHSV->getInputSocket(3)); - converter.addOperation(changeHSV); + converter.map_input_socket(hue_socket, changeHSV->get_input_socket(1)); + converter.map_input_socket(saturation_socket, changeHSV->get_input_socket(2)); + converter.map_input_socket(value_socket, changeHSV->get_input_socket(3)); + converter.add_operation(changeHSV); MixBlendOperation *blend = new MixBlendOperation(); blend->set_canvas_input_index(1); - converter.addOperation(blend); + converter.add_operation(blend); - converter.mapInputSocket(colorSocket, rgbToHSV->getInputSocket(0)); - converter.addLink(rgbToHSV->getOutputSocket(), changeHSV->getInputSocket(0)); - converter.addLink(changeHSV->getOutputSocket(), hsvToRGB->getInputSocket(0)); - converter.addLink(hsvToRGB->getOutputSocket(), blend->getInputSocket(2)); - converter.mapInputSocket(colorSocket, blend->getInputSocket(1)); - converter.mapInputSocket(facSocket, blend->getInputSocket(0)); - converter.mapOutputSocket(outputSocket, blend->getOutputSocket()); + converter.map_input_socket(color_socket, rgbToHSV->get_input_socket(0)); + converter.add_link(rgbToHSV->get_output_socket(), changeHSV->get_input_socket(0)); + converter.add_link(changeHSV->get_output_socket(), hsvToRGB->get_input_socket(0)); + converter.add_link(hsvToRGB->get_output_socket(), blend->get_input_socket(2)); + converter.map_input_socket(color_socket, blend->get_input_socket(1)); + converter.map_input_socket(fac_socket, blend->get_input_socket(0)); + converter.map_output_socket(output_socket, blend->get_output_socket()); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueNode.h b/source/blender/compositor/nodes/COM_HueSaturationValueNode.h index 0b295158cc7..abb7d0afebe 100644 --- a/source/blender/compositor/nodes/COM_HueSaturationValueNode.h +++ b/source/blender/compositor/nodes/COM_HueSaturationValueNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class HueSaturationValueNode : public Node { public: - HueSaturationValueNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + HueSaturationValueNode(bNode *editor_node); + void convert_to_operations(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 0a7ed521afb..4d761f25fd3 100644 --- a/source/blender/compositor/nodes/COM_IDMaskNode.cc +++ b/source/blender/compositor/nodes/COM_IDMaskNode.cc @@ -22,46 +22,46 @@ namespace blender::compositor { -IDMaskNode::IDMaskNode(bNode *editorNode) : Node(editorNode) +IDMaskNode::IDMaskNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void IDMaskNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void IDMaskNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *bnode = this->getbNode(); + bNode *bnode = this->get_bnode(); IDMaskOperation *operation; operation = new IDMaskOperation(); - operation->setObjectIndex(bnode->custom1); - converter.addOperation(operation); + operation->set_object_index(bnode->custom1); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); if (bnode->custom2 == 0) { - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0)); } else { SMAAEdgeDetectionOperation *operation1 = nullptr; operation1 = new SMAAEdgeDetectionOperation(); - converter.addOperation(operation1); + converter.add_operation(operation1); - converter.addLink(operation->getOutputSocket(0), operation1->getInputSocket(0)); + converter.add_link(operation->get_output_socket(0), operation1->get_input_socket(0)); /* Blending Weight Calculation Pixel Shader (Second Pass). */ SMAABlendingWeightCalculationOperation *operation2 = new SMAABlendingWeightCalculationOperation(); - converter.addOperation(operation2); + converter.add_operation(operation2); - converter.addLink(operation1->getOutputSocket(), operation2->getInputSocket(0)); + converter.add_link(operation1->get_output_socket(), operation2->get_input_socket(0)); /* Neighborhood Blending Pixel Shader (Third Pass). */ SMAANeighborhoodBlendingOperation *operation3 = new SMAANeighborhoodBlendingOperation(); - converter.addOperation(operation3); + converter.add_operation(operation3); - converter.addLink(operation->getOutputSocket(0), operation3->getInputSocket(0)); - converter.addLink(operation2->getOutputSocket(), operation3->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(0), operation3->getOutputSocket()); + converter.add_link(operation->get_output_socket(0), operation3->get_input_socket(0)); + converter.add_link(operation2->get_output_socket(), operation3->get_input_socket(1)); + converter.map_output_socket(get_output_socket(0), operation3->get_output_socket()); } } diff --git a/source/blender/compositor/nodes/COM_IDMaskNode.h b/source/blender/compositor/nodes/COM_IDMaskNode.h index f702732a8ed..8eba2af715f 100644 --- a/source/blender/compositor/nodes/COM_IDMaskNode.h +++ b/source/blender/compositor/nodes/COM_IDMaskNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class IDMaskNode : public Node { public: - IDMaskNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + IDMaskNode(bNode *editor_node); + void convert_to_operations(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 992d5697109..928a7c735c7 100644 --- a/source/blender/compositor/nodes/COM_ImageNode.cc +++ b/source/blender/compositor/nodes/COM_ImageNode.cc @@ -26,21 +26,21 @@ namespace blender::compositor { -ImageNode::ImageNode(bNode *editorNode) : Node(editorNode) +ImageNode::ImageNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -NodeOperation *ImageNode::doMultilayerCheck(NodeConverter &converter, - RenderLayer *render_layer, - RenderPass *render_pass, - Image *image, - ImageUser *user, - int framenumber, - int outputsocketIndex, - int view, - DataType datatype) const +NodeOperation *ImageNode::do_multilayer_check(NodeConverter &converter, + RenderLayer *render_layer, + RenderPass *render_pass, + Image *image, + ImageUser *user, + int framenumber, + int outputsocket_index, + int view, + DataType datatype) const { - NodeOutput *outputSocket = this->getOutputSocket(outputsocketIndex); + NodeOutput *output_socket = this->get_output_socket(outputsocket_index); MultilayerBaseOperation *operation = nullptr; switch (datatype) { case DataType::Value: @@ -55,27 +55,27 @@ NodeOperation *ImageNode::doMultilayerCheck(NodeConverter &converter, default: break; } - operation->setImage(image); - operation->setImageUser(user); - operation->setFramenumber(framenumber); + operation->set_image(image); + operation->set_image_user(user); + operation->set_framenumber(framenumber); - converter.addOperation(operation); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket()); + converter.add_operation(operation); + converter.map_output_socket(output_socket, operation->get_output_socket()); return operation; } -void ImageNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void ImageNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { /** Image output */ - NodeOutput *outputImage = this->getOutputSocket(0); - bNode *editorNode = this->getbNode(); - Image *image = (Image *)editorNode->id; - ImageUser *imageuser = (ImageUser *)editorNode->storage; - int framenumber = context.getFramenumber(); - bool outputStraightAlpha = (editorNode->custom1 & CMP_NODE_IMAGE_USE_STRAIGHT_OUTPUT) != 0; - BKE_image_user_frame_calc(image, imageuser, context.getFramenumber()); + NodeOutput *output_image = this->get_output_socket(0); + bNode *editor_node = this->get_bnode(); + Image *image = (Image *)editor_node->id; + ImageUser *imageuser = (ImageUser *)editor_node->storage; + int framenumber = context.get_framenumber(); + bool output_straight_alpha = (editor_node->custom1 & CMP_NODE_IMAGE_USE_STRAIGHT_OUTPUT) != 0; + BKE_image_user_frame_calc(image, imageuser, context.get_framenumber()); /* force a load, we assume iuser index will be set OK anyway */ if (image && image->type == IMA_TYPE_MULTILAYER) { bool is_multilayer_ok = false; @@ -88,14 +88,14 @@ void ImageNode::convertToOperations(NodeConverter &converter, for (int64_t index = 0; index < outputs.size(); index++) { NodeOutput *socket = outputs[index]; NodeOperation *operation = nullptr; - bNodeSocket *bnodeSocket = socket->getbNodeSocket(); - NodeImageLayer *storage = (NodeImageLayer *)bnodeSocket->storage; + bNodeSocket *bnode_socket = socket->get_bnode_socket(); + NodeImageLayer *storage = (NodeImageLayer *)bnode_socket->storage; RenderPass *rpass = (RenderPass *)BLI_findstring( &rl->passes, storage->pass_name, offsetof(RenderPass, name)); int view = 0; if (STREQ(storage->pass_name, RE_PASSNAME_COMBINED) && - STREQ(bnodeSocket->name, "Alpha")) { + STREQ(bnode_socket->name, "Alpha")) { /* Alpha output is already handled with the associated combined output. */ continue; } @@ -109,7 +109,7 @@ void ImageNode::convertToOperations(NodeConverter &converter, /* heuristic to match image name with scene names * check if the view name exists in the image */ view = BLI_findstringindex( - &image->rr->views, context.getViewName(), offsetof(RenderView, name)); + &image->rr->views, context.get_view_name(), offsetof(RenderView, name)); if (view == -1) { view = 0; } @@ -122,64 +122,64 @@ void ImageNode::convertToOperations(NodeConverter &converter, if (rpass) { switch (rpass->channels) { case 1: - operation = doMultilayerCheck(converter, - rl, - rpass, - image, - imageuser, - framenumber, - index, - view, - DataType::Value); + operation = do_multilayer_check(converter, + rl, + rpass, + image, + imageuser, + framenumber, + index, + view, + DataType::Value); break; /* using image operations for both 3 and 4 channels (RGB and RGBA respectively) */ /* XXX any way to detect actual vector images? */ case 3: - operation = doMultilayerCheck(converter, - rl, - rpass, - image, - imageuser, - framenumber, - index, - view, - DataType::Vector); + operation = do_multilayer_check(converter, + rl, + rpass, + image, + imageuser, + framenumber, + index, + view, + DataType::Vector); break; case 4: - operation = doMultilayerCheck(converter, - rl, - rpass, - image, - imageuser, - framenumber, - index, - view, - DataType::Color); + operation = do_multilayer_check(converter, + rl, + rpass, + image, + imageuser, + framenumber, + index, + view, + DataType::Color); break; default: /* dummy operation is added below */ break; } if (index == 0 && operation) { - converter.addPreview(operation->getOutputSocket()); + converter.add_preview(operation->get_output_socket()); } - if (STREQ(rpass->name, RE_PASSNAME_COMBINED) && !(bnodeSocket->flag & SOCK_UNAVAIL)) { - for (NodeOutput *alphaSocket : getOutputSockets()) { - bNodeSocket *bnodeAlphaSocket = alphaSocket->getbNodeSocket(); - if (!STREQ(bnodeAlphaSocket->name, "Alpha")) { + if (STREQ(rpass->name, RE_PASSNAME_COMBINED) && !(bnode_socket->flag & SOCK_UNAVAIL)) { + for (NodeOutput *alpha_socket : get_output_sockets()) { + bNodeSocket *bnode_alpha_socket = alpha_socket->get_bnode_socket(); + if (!STREQ(bnode_alpha_socket->name, "Alpha")) { continue; } - NodeImageLayer *alphaStorage = (NodeImageLayer *)bnodeSocket->storage; - if (!STREQ(alphaStorage->pass_name, RE_PASSNAME_COMBINED)) { + NodeImageLayer *alpha_storage = (NodeImageLayer *)bnode_socket->storage; + if (!STREQ(alpha_storage->pass_name, RE_PASSNAME_COMBINED)) { continue; } SeparateChannelOperation *separate_operation; separate_operation = new SeparateChannelOperation(); - separate_operation->setChannel(3); - converter.addOperation(separate_operation); - converter.addLink(operation->getOutputSocket(), - separate_operation->getInputSocket(0)); - converter.mapOutputSocket(alphaSocket, separate_operation->getOutputSocket()); + separate_operation->set_channel(3); + converter.add_operation(separate_operation); + converter.add_link(operation->get_output_socket(), + separate_operation->get_input_socket(0)); + converter.map_output_socket(alpha_socket, separate_operation->get_output_socket()); break; } } @@ -187,7 +187,7 @@ void ImageNode::convertToOperations(NodeConverter &converter, /* In case we can't load the layer. */ if (operation == nullptr) { - converter.setInvalidOutput(getOutputSocket(index)); + converter.set_invalid_output(get_output_socket(index)); } } } @@ -196,69 +196,70 @@ void ImageNode::convertToOperations(NodeConverter &converter, /* without this, multilayer that fail to load will crash blender T32490. */ if (is_multilayer_ok == false) { - for (NodeOutput *output : getOutputSockets()) { - converter.setInvalidOutput(output); + for (NodeOutput *output : get_output_sockets()) { + converter.set_invalid_output(output); } } } else { - const int64_t numberOfOutputs = getOutputSockets().size(); - if (numberOfOutputs > 0) { + const int64_t number_of_outputs = get_output_sockets().size(); + if (number_of_outputs > 0) { ImageOperation *operation = new ImageOperation(); - operation->setImage(image); - operation->setImageUser(imageuser); - operation->setFramenumber(framenumber); - operation->setRenderData(context.getRenderData()); - operation->setViewName(context.getViewName()); - converter.addOperation(operation); + operation->set_image(image); + operation->set_image_user(imageuser); + operation->set_framenumber(framenumber); + operation->set_render_data(context.get_render_data()); + operation->set_view_name(context.get_view_name()); + converter.add_operation(operation); - if (outputStraightAlpha) { - NodeOperation *alphaConvertOperation = new ConvertPremulToStraightOperation(); + if (output_straight_alpha) { + NodeOperation *alpha_convert_operation = new ConvertPremulToStraightOperation(); - converter.addOperation(alphaConvertOperation); - converter.mapOutputSocket(outputImage, alphaConvertOperation->getOutputSocket()); - converter.addLink(operation->getOutputSocket(0), alphaConvertOperation->getInputSocket(0)); + converter.add_operation(alpha_convert_operation); + converter.map_output_socket(output_image, alpha_convert_operation->get_output_socket()); + converter.add_link(operation->get_output_socket(0), + alpha_convert_operation->get_input_socket(0)); } else { - converter.mapOutputSocket(outputImage, operation->getOutputSocket()); + converter.map_output_socket(output_image, operation->get_output_socket()); } - converter.addPreview(operation->getOutputSocket()); + converter.add_preview(operation->get_output_socket()); } - if (numberOfOutputs > 1) { - NodeOutput *alphaImage = this->getOutputSocket(1); - ImageAlphaOperation *alphaOperation = new ImageAlphaOperation(); - alphaOperation->setImage(image); - alphaOperation->setImageUser(imageuser); - alphaOperation->setFramenumber(framenumber); - alphaOperation->setRenderData(context.getRenderData()); - alphaOperation->setViewName(context.getViewName()); - converter.addOperation(alphaOperation); + if (number_of_outputs > 1) { + NodeOutput *alpha_image = this->get_output_socket(1); + ImageAlphaOperation *alpha_operation = new ImageAlphaOperation(); + alpha_operation->set_image(image); + alpha_operation->set_image_user(imageuser); + alpha_operation->set_framenumber(framenumber); + alpha_operation->set_render_data(context.get_render_data()); + alpha_operation->set_view_name(context.get_view_name()); + converter.add_operation(alpha_operation); - converter.mapOutputSocket(alphaImage, alphaOperation->getOutputSocket()); + converter.map_output_socket(alpha_image, alpha_operation->get_output_socket()); } - if (numberOfOutputs > 2) { - NodeOutput *depthImage = this->getOutputSocket(2); - ImageDepthOperation *depthOperation = new ImageDepthOperation(); - depthOperation->setImage(image); - depthOperation->setImageUser(imageuser); - depthOperation->setFramenumber(framenumber); - depthOperation->setRenderData(context.getRenderData()); - depthOperation->setViewName(context.getViewName()); - converter.addOperation(depthOperation); + if (number_of_outputs > 2) { + NodeOutput *depth_image = this->get_output_socket(2); + ImageDepthOperation *depth_operation = new ImageDepthOperation(); + depth_operation->set_image(image); + depth_operation->set_image_user(imageuser); + depth_operation->set_framenumber(framenumber); + depth_operation->set_render_data(context.get_render_data()); + depth_operation->set_view_name(context.get_view_name()); + converter.add_operation(depth_operation); - converter.mapOutputSocket(depthImage, depthOperation->getOutputSocket()); + converter.map_output_socket(depth_image, depth_operation->get_output_socket()); } - if (numberOfOutputs > 3) { + if (number_of_outputs > 3) { /* happens when unlinking image datablock from multilayer node */ - for (int i = 3; i < numberOfOutputs; i++) { - NodeOutput *output = this->getOutputSocket(i); + for (int i = 3; i < number_of_outputs; i++) { + NodeOutput *output = this->get_output_socket(i); NodeOperation *operation = nullptr; - switch (output->getDataType()) { + switch (output->get_data_type()) { case DataType::Value: { SetValueOperation *valueoperation = new SetValueOperation(); - valueoperation->setValue(0.0f); + valueoperation->set_value(0.0f); operation = valueoperation; break; } @@ -272,10 +273,10 @@ void ImageNode::convertToOperations(NodeConverter &converter, } case DataType::Color: { SetColorOperation *coloroperation = new SetColorOperation(); - coloroperation->setChannel1(0.0f); - coloroperation->setChannel2(0.0f); - coloroperation->setChannel3(0.0f); - coloroperation->setChannel4(0.0f); + coloroperation->set_channel1(0.0f); + coloroperation->set_channel2(0.0f); + coloroperation->set_channel3(0.0f); + coloroperation->set_channel4(0.0f); operation = coloroperation; break; } @@ -283,8 +284,8 @@ void ImageNode::convertToOperations(NodeConverter &converter, if (operation) { /* not supporting multiview for this generic case */ - converter.addOperation(operation); - converter.mapOutputSocket(output, operation->getOutputSocket()); + converter.add_operation(operation); + converter.map_output_socket(output, operation->get_output_socket()); } } } diff --git a/source/blender/compositor/nodes/COM_ImageNode.h b/source/blender/compositor/nodes/COM_ImageNode.h index 047cc496f83..7dd948be946 100644 --- a/source/blender/compositor/nodes/COM_ImageNode.h +++ b/source/blender/compositor/nodes/COM_ImageNode.h @@ -34,20 +34,20 @@ namespace blender::compositor { */ class ImageNode : public Node { private: - NodeOperation *doMultilayerCheck(NodeConverter &converter, - RenderLayer *render_layer, - RenderPass *render_pass, - Image *image, - ImageUser *user, - int framenumber, - int outputsocketIndex, - int view, - DataType datatype) const; + NodeOperation *do_multilayer_check(NodeConverter &converter, + RenderLayer *render_layer, + RenderPass *render_pass, + Image *image, + ImageUser *user, + int framenumber, + int outputsocket_index, + int view, + DataType datatype) const; public: - ImageNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + ImageNode(bNode *editor_node); + void convert_to_operations(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 93fb051090c..1feb618d47a 100644 --- a/source/blender/compositor/nodes/COM_InpaintNode.cc +++ b/source/blender/compositor/nodes/COM_InpaintNode.cc @@ -21,25 +21,25 @@ namespace blender::compositor { -InpaintNode::InpaintNode(bNode *editorNode) : Node(editorNode) +InpaintNode::InpaintNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void InpaintNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void InpaintNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *editorNode = this->getbNode(); + bNode *editor_node = this->get_bnode(); - /* if (editorNode->custom1 == CMP_NODE_INPAINT_SIMPLE) { */ + /* if (editor_node->custom1 == CMP_NODE_INPAINT_SIMPLE) { */ if (true) { InpaintSimpleOperation *operation = new InpaintSimpleOperation(); - operation->setIterations(editorNode->custom2); - converter.addOperation(operation); + operation->set_iterations(editor_node->custom2); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0)); } } diff --git a/source/blender/compositor/nodes/COM_InpaintNode.h b/source/blender/compositor/nodes/COM_InpaintNode.h index 3a10c11bf61..389ca1d56f4 100644 --- a/source/blender/compositor/nodes/COM_InpaintNode.h +++ b/source/blender/compositor/nodes/COM_InpaintNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class InpaintNode : public Node { public: - InpaintNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + InpaintNode(bNode *editor_node); + void convert_to_operations(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 cb15f3b28b0..ffde5b1e12e 100644 --- a/source/blender/compositor/nodes/COM_InvertNode.cc +++ b/source/blender/compositor/nodes/COM_InvertNode.cc @@ -22,23 +22,23 @@ namespace blender::compositor { -InvertNode::InvertNode(bNode *editorNode) : Node(editorNode) +InvertNode::InvertNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void InvertNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void InvertNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { InvertOperation *operation = new InvertOperation(); - bNode *node = this->getbNode(); - operation->setColor(node->custom1 & CMP_CHAN_RGB); - operation->setAlpha(node->custom1 & CMP_CHAN_A); - converter.addOperation(operation); + bNode *node = this->get_bnode(); + operation->set_color(node->custom1 & CMP_CHAN_RGB); + operation->set_alpha(node->custom1 & CMP_CHAN_A); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0)); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_InvertNode.h b/source/blender/compositor/nodes/COM_InvertNode.h index 1cc975b8236..8f2eb258ab5 100644 --- a/source/blender/compositor/nodes/COM_InvertNode.h +++ b/source/blender/compositor/nodes/COM_InvertNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class InvertNode : public Node { public: - InvertNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + InvertNode(bNode *editor_node); + void convert_to_operations(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 c928b55fbb0..d3130fdd2eb 100644 --- a/source/blender/compositor/nodes/COM_KeyingNode.cc +++ b/source/blender/compositor/nodes/COM_KeyingNode.cc @@ -37,112 +37,114 @@ namespace blender::compositor { -KeyingNode::KeyingNode(bNode *editorNode) : Node(editorNode) +KeyingNode::KeyingNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -NodeOperationOutput *KeyingNode::setupPreBlur(NodeConverter &converter, - NodeInput *inputImage, - int size) const +NodeOperationOutput *KeyingNode::setup_pre_blur(NodeConverter &converter, + NodeInput *input_image, + int size) const { ConvertRGBToYCCOperation *convertRGBToYCCOperation = new ConvertRGBToYCCOperation(); - convertRGBToYCCOperation->setMode(BLI_YCC_ITU_BT709); - converter.addOperation(convertRGBToYCCOperation); + convertRGBToYCCOperation->set_mode(BLI_YCC_ITU_BT709); + converter.add_operation(convertRGBToYCCOperation); - converter.mapInputSocket(inputImage, convertRGBToYCCOperation->getInputSocket(0)); + converter.map_input_socket(input_image, convertRGBToYCCOperation->get_input_socket(0)); - CombineChannelsOperation *combineOperation = new CombineChannelsOperation(); - converter.addOperation(combineOperation); + CombineChannelsOperation *combine_operation = new CombineChannelsOperation(); + converter.add_operation(combine_operation); for (int channel = 0; channel < 4; channel++) { - SeparateChannelOperation *separateOperation = new SeparateChannelOperation(); - separateOperation->setChannel(channel); - converter.addOperation(separateOperation); + SeparateChannelOperation *separate_operation = new SeparateChannelOperation(); + separate_operation->set_channel(channel); + converter.add_operation(separate_operation); - converter.addLink(convertRGBToYCCOperation->getOutputSocket(0), - separateOperation->getInputSocket(0)); + converter.add_link(convertRGBToYCCOperation->get_output_socket(0), + separate_operation->get_input_socket(0)); if (ELEM(channel, 0, 3)) { - converter.addLink(separateOperation->getOutputSocket(0), - combineOperation->getInputSocket(channel)); + converter.add_link(separate_operation->get_output_socket(0), + combine_operation->get_input_socket(channel)); } else { - KeyingBlurOperation *blurXOperation = new KeyingBlurOperation(); - blurXOperation->setSize(size); - blurXOperation->setAxis(KeyingBlurOperation::BLUR_AXIS_X); - converter.addOperation(blurXOperation); - - KeyingBlurOperation *blurYOperation = new KeyingBlurOperation(); - blurYOperation->setSize(size); - blurYOperation->setAxis(KeyingBlurOperation::BLUR_AXIS_Y); - converter.addOperation(blurYOperation); - - converter.addLink(separateOperation->getOutputSocket(), blurXOperation->getInputSocket(0)); - converter.addLink(blurXOperation->getOutputSocket(), blurYOperation->getInputSocket(0)); - converter.addLink(blurYOperation->getOutputSocket(0), - combineOperation->getInputSocket(channel)); + KeyingBlurOperation *blur_xoperation = new KeyingBlurOperation(); + blur_xoperation->set_size(size); + blur_xoperation->set_axis(KeyingBlurOperation::BLUR_AXIS_X); + converter.add_operation(blur_xoperation); + + KeyingBlurOperation *blur_yoperation = new KeyingBlurOperation(); + blur_yoperation->set_size(size); + blur_yoperation->set_axis(KeyingBlurOperation::BLUR_AXIS_Y); + converter.add_operation(blur_yoperation); + + converter.add_link(separate_operation->get_output_socket(), + blur_xoperation->get_input_socket(0)); + converter.add_link(blur_xoperation->get_output_socket(), + blur_yoperation->get_input_socket(0)); + converter.add_link(blur_yoperation->get_output_socket(0), + combine_operation->get_input_socket(channel)); } } ConvertYCCToRGBOperation *convertYCCToRGBOperation = new ConvertYCCToRGBOperation(); - convertYCCToRGBOperation->setMode(BLI_YCC_ITU_BT709); - converter.addOperation(convertYCCToRGBOperation); + convertYCCToRGBOperation->set_mode(BLI_YCC_ITU_BT709); + converter.add_operation(convertYCCToRGBOperation); - converter.addLink(combineOperation->getOutputSocket(0), - convertYCCToRGBOperation->getInputSocket(0)); + converter.add_link(combine_operation->get_output_socket(0), + convertYCCToRGBOperation->get_input_socket(0)); - return convertYCCToRGBOperation->getOutputSocket(0); + return convertYCCToRGBOperation->get_output_socket(0); } -NodeOperationOutput *KeyingNode::setupPostBlur(NodeConverter &converter, - NodeOperationOutput *postBlurInput, - int size) const +NodeOperationOutput *KeyingNode::setup_post_blur(NodeConverter &converter, + NodeOperationOutput *post_blur_input, + int size) const { - KeyingBlurOperation *blurXOperation = new KeyingBlurOperation(); - blurXOperation->setSize(size); - blurXOperation->setAxis(KeyingBlurOperation::BLUR_AXIS_X); - converter.addOperation(blurXOperation); + KeyingBlurOperation *blur_xoperation = new KeyingBlurOperation(); + blur_xoperation->set_size(size); + blur_xoperation->set_axis(KeyingBlurOperation::BLUR_AXIS_X); + converter.add_operation(blur_xoperation); - KeyingBlurOperation *blurYOperation = new KeyingBlurOperation(); - blurYOperation->setSize(size); - blurYOperation->setAxis(KeyingBlurOperation::BLUR_AXIS_Y); - converter.addOperation(blurYOperation); + KeyingBlurOperation *blur_yoperation = new KeyingBlurOperation(); + blur_yoperation->set_size(size); + blur_yoperation->set_axis(KeyingBlurOperation::BLUR_AXIS_Y); + converter.add_operation(blur_yoperation); - converter.addLink(postBlurInput, blurXOperation->getInputSocket(0)); - converter.addLink(blurXOperation->getOutputSocket(), blurYOperation->getInputSocket(0)); + converter.add_link(post_blur_input, blur_xoperation->get_input_socket(0)); + converter.add_link(blur_xoperation->get_output_socket(), blur_yoperation->get_input_socket(0)); - return blurYOperation->getOutputSocket(); + return blur_yoperation->get_output_socket(); } -NodeOperationOutput *KeyingNode::setupDilateErode(NodeConverter &converter, - NodeOperationOutput *dilateErodeInput, - int distance) const +NodeOperationOutput *KeyingNode::setup_dilate_erode(NodeConverter &converter, + NodeOperationOutput *dilate_erode_input, + int distance) const { - DilateDistanceOperation *dilateErodeOperation; + DilateDistanceOperation *dilate_erode_operation; if (distance > 0) { - dilateErodeOperation = new DilateDistanceOperation(); - dilateErodeOperation->setDistance(distance); + dilate_erode_operation = new DilateDistanceOperation(); + dilate_erode_operation->set_distance(distance); } else { - dilateErodeOperation = new ErodeDistanceOperation(); - dilateErodeOperation->setDistance(-distance); + dilate_erode_operation = new ErodeDistanceOperation(); + dilate_erode_operation->set_distance(-distance); } - converter.addOperation(dilateErodeOperation); + converter.add_operation(dilate_erode_operation); - converter.addLink(dilateErodeInput, dilateErodeOperation->getInputSocket(0)); + converter.add_link(dilate_erode_input, dilate_erode_operation->get_input_socket(0)); - return dilateErodeOperation->getOutputSocket(0); + return dilate_erode_operation->get_output_socket(0); } -NodeOperationOutput *KeyingNode::setupFeather(NodeConverter &converter, - const CompositorContext &context, - NodeOperationOutput *featherInput, - int falloff, - int distance) const +NodeOperationOutput *KeyingNode::setup_feather(NodeConverter &converter, + const CompositorContext &context, + NodeOperationOutput *feather_input, + int falloff, + int distance) const { /* this uses a modified gaussian blur function otherwise its far too slow */ - eCompositorQuality quality = context.getQuality(); + eCompositorQuality quality = context.get_quality(); /* initialize node data */ NodeBlurData data; @@ -156,196 +158,198 @@ NodeOperationOutput *KeyingNode::setupFeather(NodeConverter &converter, } GaussianAlphaXBlurOperation *operationx = new GaussianAlphaXBlurOperation(); - operationx->setData(&data); - operationx->setQuality(quality); - operationx->setSize(1.0f); - operationx->setSubtract(distance < 0); - operationx->setFalloff(falloff); - converter.addOperation(operationx); + operationx->set_data(&data); + operationx->set_quality(quality); + operationx->set_size(1.0f); + operationx->set_subtract(distance < 0); + operationx->set_falloff(falloff); + converter.add_operation(operationx); GaussianAlphaYBlurOperation *operationy = new GaussianAlphaYBlurOperation(); - operationy->setData(&data); - operationy->setQuality(quality); - operationy->setSize(1.0f); - operationy->setSubtract(distance < 0); - operationy->setFalloff(falloff); - converter.addOperation(operationy); + operationy->set_data(&data); + operationy->set_quality(quality); + operationy->set_size(1.0f); + operationy->set_subtract(distance < 0); + operationy->set_falloff(falloff); + converter.add_operation(operationy); - converter.addLink(featherInput, operationx->getInputSocket(0)); - converter.addLink(operationx->getOutputSocket(), operationy->getInputSocket(0)); + converter.add_link(feather_input, operationx->get_input_socket(0)); + converter.add_link(operationx->get_output_socket(), operationy->get_input_socket(0)); - return operationy->getOutputSocket(); + return operationy->get_output_socket(); } -NodeOperationOutput *KeyingNode::setupDespill(NodeConverter &converter, - NodeOperationOutput *despillInput, - NodeInput *inputScreen, - float factor, - float colorBalance) const +NodeOperationOutput *KeyingNode::setup_despill(NodeConverter &converter, + NodeOperationOutput *despill_input, + NodeInput *input_screen, + float factor, + float color_balance) const { - KeyingDespillOperation *despillOperation = new KeyingDespillOperation(); - despillOperation->setDespillFactor(factor); - despillOperation->setColorBalance(colorBalance); - converter.addOperation(despillOperation); + KeyingDespillOperation *despill_operation = new KeyingDespillOperation(); + despill_operation->set_despill_factor(factor); + despill_operation->set_color_balance(color_balance); + converter.add_operation(despill_operation); - converter.addLink(despillInput, despillOperation->getInputSocket(0)); - converter.mapInputSocket(inputScreen, despillOperation->getInputSocket(1)); + converter.add_link(despill_input, despill_operation->get_input_socket(0)); + converter.map_input_socket(input_screen, despill_operation->get_input_socket(1)); - return despillOperation->getOutputSocket(0); + return despill_operation->get_output_socket(0); } -NodeOperationOutput *KeyingNode::setupClip(NodeConverter &converter, - NodeOperationOutput *clipInput, - int kernelRadius, - float kernelTolerance, - float clipBlack, - float clipWhite, - bool edgeMatte) const +NodeOperationOutput *KeyingNode::setup_clip(NodeConverter &converter, + NodeOperationOutput *clip_input, + int kernel_radius, + float kernel_tolerance, + float clip_black, + float clip_white, + bool edge_matte) const { - KeyingClipOperation *clipOperation = new KeyingClipOperation(); - clipOperation->setKernelRadius(kernelRadius); - clipOperation->setKernelTolerance(kernelTolerance); - clipOperation->setClipBlack(clipBlack); - clipOperation->setClipWhite(clipWhite); - clipOperation->setIsEdgeMatte(edgeMatte); - converter.addOperation(clipOperation); + KeyingClipOperation *clip_operation = new KeyingClipOperation(); + clip_operation->set_kernel_radius(kernel_radius); + clip_operation->set_kernel_tolerance(kernel_tolerance); + clip_operation->set_clip_black(clip_black); + clip_operation->set_clip_white(clip_white); + clip_operation->set_is_edge_matte(edge_matte); + converter.add_operation(clip_operation); - converter.addLink(clipInput, clipOperation->getInputSocket(0)); + converter.add_link(clip_input, clip_operation->get_input_socket(0)); - return clipOperation->getOutputSocket(0); + return clip_operation->get_output_socket(0); } -void KeyingNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void KeyingNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *editorNode = this->getbNode(); - NodeKeyingData *keying_data = (NodeKeyingData *)editorNode->storage; - - NodeInput *inputImage = this->getInputSocket(0); - NodeInput *inputScreen = this->getInputSocket(1); - NodeInput *inputGarbageMatte = this->getInputSocket(2); - NodeInput *inputCoreMatte = this->getInputSocket(3); - NodeOutput *outputImage = this->getOutputSocket(0); - NodeOutput *outputMatte = this->getOutputSocket(1); - NodeOutput *outputEdges = this->getOutputSocket(2); - NodeOperationOutput *postprocessedMatte = nullptr, *postprocessedImage = nullptr, - *edgesMatte = nullptr; + bNode *editor_node = this->get_bnode(); + NodeKeyingData *keying_data = (NodeKeyingData *)editor_node->storage; + + NodeInput *input_image = this->get_input_socket(0); + NodeInput *input_screen = this->get_input_socket(1); + NodeInput *input_garbage_matte = this->get_input_socket(2); + NodeInput *input_core_matte = this->get_input_socket(3); + NodeOutput *output_image = this->get_output_socket(0); + NodeOutput *output_matte = this->get_output_socket(1); + NodeOutput *output_edges = this->get_output_socket(2); + NodeOperationOutput *postprocessed_matte = nullptr, *postprocessed_image = nullptr, + *edges_matte = nullptr; /* keying operation */ - KeyingOperation *keyingOperation = new KeyingOperation(); - keyingOperation->setScreenBalance(keying_data->screen_balance); - converter.addOperation(keyingOperation); + KeyingOperation *keying_operation = new KeyingOperation(); + keying_operation->set_screen_balance(keying_data->screen_balance); + converter.add_operation(keying_operation); - converter.mapInputSocket(inputScreen, keyingOperation->getInputSocket(1)); + converter.map_input_socket(input_screen, keying_operation->get_input_socket(1)); if (keying_data->blur_pre) { /* Chroma pre-blur operation for input of keying operation. */ - NodeOperationOutput *preBlurredImage = setupPreBlur( - converter, inputImage, keying_data->blur_pre); - converter.addLink(preBlurredImage, keyingOperation->getInputSocket(0)); + NodeOperationOutput *pre_blurred_image = setup_pre_blur( + converter, input_image, keying_data->blur_pre); + converter.add_link(pre_blurred_image, keying_operation->get_input_socket(0)); } else { - converter.mapInputSocket(inputImage, keyingOperation->getInputSocket(0)); + converter.map_input_socket(input_image, keying_operation->get_input_socket(0)); } - postprocessedMatte = keyingOperation->getOutputSocket(); + postprocessed_matte = keying_operation->get_output_socket(); /* black / white clipping */ if (keying_data->clip_black > 0.0f || keying_data->clip_white < 1.0f) { - postprocessedMatte = setupClip(converter, - postprocessedMatte, - keying_data->edge_kernel_radius, - keying_data->edge_kernel_tolerance, - keying_data->clip_black, - keying_data->clip_white, - false); + postprocessed_matte = setup_clip(converter, + postprocessed_matte, + keying_data->edge_kernel_radius, + keying_data->edge_kernel_tolerance, + keying_data->clip_black, + keying_data->clip_white, + false); } /* output edge matte */ - edgesMatte = setupClip(converter, - postprocessedMatte, - keying_data->edge_kernel_radius, - keying_data->edge_kernel_tolerance, - keying_data->clip_black, - keying_data->clip_white, - true); + edges_matte = setup_clip(converter, + postprocessed_matte, + keying_data->edge_kernel_radius, + keying_data->edge_kernel_tolerance, + keying_data->clip_black, + keying_data->clip_white, + true); /* apply garbage matte */ - if (inputGarbageMatte->isLinked()) { - SetValueOperation *valueOperation = new SetValueOperation(); - valueOperation->setValue(1.0f); - converter.addOperation(valueOperation); + if (input_garbage_matte->is_linked()) { + SetValueOperation *value_operation = new SetValueOperation(); + value_operation->set_value(1.0f); + converter.add_operation(value_operation); - MathSubtractOperation *subtractOperation = new MathSubtractOperation(); - converter.addOperation(subtractOperation); + MathSubtractOperation *subtract_operation = new MathSubtractOperation(); + converter.add_operation(subtract_operation); - MathMinimumOperation *minOperation = new MathMinimumOperation(); - converter.addOperation(minOperation); + MathMinimumOperation *min_operation = new MathMinimumOperation(); + converter.add_operation(min_operation); - converter.addLink(valueOperation->getOutputSocket(), subtractOperation->getInputSocket(0)); - converter.mapInputSocket(inputGarbageMatte, subtractOperation->getInputSocket(1)); + converter.add_link(value_operation->get_output_socket(), + subtract_operation->get_input_socket(0)); + converter.map_input_socket(input_garbage_matte, subtract_operation->get_input_socket(1)); - converter.addLink(subtractOperation->getOutputSocket(), minOperation->getInputSocket(0)); - converter.addLink(postprocessedMatte, minOperation->getInputSocket(1)); + converter.add_link(subtract_operation->get_output_socket(), + min_operation->get_input_socket(0)); + converter.add_link(postprocessed_matte, min_operation->get_input_socket(1)); - postprocessedMatte = minOperation->getOutputSocket(); + postprocessed_matte = min_operation->get_output_socket(); } /* apply core matte */ - if (inputCoreMatte->isLinked()) { - MathMaximumOperation *maxOperation = new MathMaximumOperation(); - converter.addOperation(maxOperation); + if (input_core_matte->is_linked()) { + MathMaximumOperation *max_operation = new MathMaximumOperation(); + converter.add_operation(max_operation); - converter.mapInputSocket(inputCoreMatte, maxOperation->getInputSocket(0)); - converter.addLink(postprocessedMatte, maxOperation->getInputSocket(1)); + converter.map_input_socket(input_core_matte, max_operation->get_input_socket(0)); + converter.add_link(postprocessed_matte, max_operation->get_input_socket(1)); - postprocessedMatte = maxOperation->getOutputSocket(); + postprocessed_matte = max_operation->get_output_socket(); } /* apply blur on matte if needed */ if (keying_data->blur_post) { - postprocessedMatte = setupPostBlur(converter, postprocessedMatte, keying_data->blur_post); + postprocessed_matte = setup_post_blur(converter, postprocessed_matte, keying_data->blur_post); } /* matte dilate/erode */ if (keying_data->dilate_distance != 0) { - postprocessedMatte = setupDilateErode( - converter, postprocessedMatte, keying_data->dilate_distance); + postprocessed_matte = setup_dilate_erode( + converter, postprocessed_matte, keying_data->dilate_distance); } /* matte feather */ if (keying_data->feather_distance != 0) { - postprocessedMatte = setupFeather(converter, - context, - postprocessedMatte, - keying_data->feather_falloff, - keying_data->feather_distance); + postprocessed_matte = setup_feather(converter, + context, + postprocessed_matte, + keying_data->feather_falloff, + keying_data->feather_distance); } /* set alpha channel to output image */ - SetAlphaMultiplyOperation *alphaOperation = new SetAlphaMultiplyOperation(); - converter.addOperation(alphaOperation); + SetAlphaMultiplyOperation *alpha_operation = new SetAlphaMultiplyOperation(); + converter.add_operation(alpha_operation); - converter.mapInputSocket(inputImage, alphaOperation->getInputSocket(0)); - converter.addLink(postprocessedMatte, alphaOperation->getInputSocket(1)); + converter.map_input_socket(input_image, alpha_operation->get_input_socket(0)); + converter.add_link(postprocessed_matte, alpha_operation->get_input_socket(1)); - postprocessedImage = alphaOperation->getOutputSocket(); + postprocessed_image = alpha_operation->get_output_socket(); /* despill output image */ if (keying_data->despill_factor > 0.0f) { - postprocessedImage = setupDespill(converter, - postprocessedImage, - inputScreen, - keying_data->despill_factor, - keying_data->despill_balance); + postprocessed_image = setup_despill(converter, + postprocessed_image, + input_screen, + keying_data->despill_factor, + keying_data->despill_balance); } /* connect result to output sockets */ - converter.mapOutputSocket(outputImage, postprocessedImage); - converter.mapOutputSocket(outputMatte, postprocessedMatte); + converter.map_output_socket(output_image, postprocessed_image); + converter.map_output_socket(output_matte, postprocessed_matte); - if (edgesMatte) { - converter.mapOutputSocket(outputEdges, edgesMatte); + if (edges_matte) { + converter.map_output_socket(output_edges, edges_matte); } } diff --git a/source/blender/compositor/nodes/COM_KeyingNode.h b/source/blender/compositor/nodes/COM_KeyingNode.h index 6d5e3ca1883..ed70433fea3 100644 --- a/source/blender/compositor/nodes/COM_KeyingNode.h +++ b/source/blender/compositor/nodes/COM_KeyingNode.h @@ -28,37 +28,37 @@ namespace blender::compositor { */ class KeyingNode : public Node { protected: - NodeOperationOutput *setupPreBlur(NodeConverter &converter, - NodeInput *inputImage, - int size) const; - NodeOperationOutput *setupPostBlur(NodeConverter &converter, - NodeOperationOutput *postBlurInput, - int size) const; - NodeOperationOutput *setupDilateErode(NodeConverter &converter, - NodeOperationOutput *dilateErodeInput, - int distance) const; - NodeOperationOutput *setupFeather(NodeConverter &converter, - const CompositorContext &context, - NodeOperationOutput *featherInput, - int falloff, - int distance) const; - NodeOperationOutput *setupDespill(NodeConverter &converter, - NodeOperationOutput *despillInput, - NodeInput *inputScreen, - float factor, - float colorBalance) const; - NodeOperationOutput *setupClip(NodeConverter &converter, - NodeOperationOutput *clipInput, - int kernelRadius, - float kernelTolerance, - float clipBlack, - float clipWhite, - bool edgeMatte) const; + NodeOperationOutput *setup_pre_blur(NodeConverter &converter, + NodeInput *input_image, + int size) const; + NodeOperationOutput *setup_post_blur(NodeConverter &converter, + NodeOperationOutput *post_blur_input, + int size) const; + NodeOperationOutput *setup_dilate_erode(NodeConverter &converter, + NodeOperationOutput *dilate_erode_input, + int distance) const; + NodeOperationOutput *setup_feather(NodeConverter &converter, + const CompositorContext &context, + NodeOperationOutput *feather_input, + int falloff, + int distance) const; + NodeOperationOutput *setup_despill(NodeConverter &converter, + NodeOperationOutput *despill_input, + NodeInput *input_screen, + float factor, + float color_balance) const; + NodeOperationOutput *setup_clip(NodeConverter &converter, + NodeOperationOutput *clip_input, + int kernel_radius, + float kernel_tolerance, + float clip_black, + float clip_white, + bool edge_matte) const; public: - KeyingNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + KeyingNode(bNode *editor_node); + void convert_to_operations(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 e405c01ddf2..bf5d7bb237a 100644 --- a/source/blender/compositor/nodes/COM_KeyingScreenNode.cc +++ b/source/blender/compositor/nodes/COM_KeyingScreenNode.cc @@ -21,28 +21,28 @@ namespace blender::compositor { -KeyingScreenNode::KeyingScreenNode(bNode *editorNode) : Node(editorNode) +KeyingScreenNode::KeyingScreenNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void KeyingScreenNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void KeyingScreenNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *editorNode = this->getbNode(); - MovieClip *clip = (MovieClip *)editorNode->id; - NodeKeyingScreenData *keyingscreen_data = (NodeKeyingScreenData *)editorNode->storage; + bNode *editor_node = this->get_bnode(); + MovieClip *clip = (MovieClip *)editor_node->id; + NodeKeyingScreenData *keyingscreen_data = (NodeKeyingScreenData *)editor_node->storage; - NodeOutput *outputScreen = this->getOutputSocket(0); + NodeOutput *output_screen = this->get_output_socket(0); /* Always connect the output image. */ KeyingScreenOperation *operation = new KeyingScreenOperation(); - operation->setMovieClip(clip); - operation->setTrackingObject(keyingscreen_data->tracking_object); - operation->setFramenumber(context.getFramenumber()); - converter.addOperation(operation); + operation->set_movie_clip(clip); + operation->set_tracking_object(keyingscreen_data->tracking_object); + operation->set_framenumber(context.get_framenumber()); + converter.add_operation(operation); - converter.mapOutputSocket(outputScreen, operation->getOutputSocket()); + converter.map_output_socket(output_screen, operation->get_output_socket()); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_KeyingScreenNode.h b/source/blender/compositor/nodes/COM_KeyingScreenNode.h index f2ad3b344f1..3704081041f 100644 --- a/source/blender/compositor/nodes/COM_KeyingScreenNode.h +++ b/source/blender/compositor/nodes/COM_KeyingScreenNode.h @@ -29,9 +29,9 @@ namespace blender::compositor { */ class KeyingScreenNode : public Node { public: - KeyingScreenNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + KeyingScreenNode(bNode *editor_node); + void convert_to_operations(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 46223c1f294..7cef21487df 100644 --- a/source/blender/compositor/nodes/COM_LensDistortionNode.cc +++ b/source/blender/compositor/nodes/COM_LensDistortionNode.cc @@ -22,42 +22,42 @@ namespace blender::compositor { -LensDistortionNode::LensDistortionNode(bNode *editorNode) : Node(editorNode) +LensDistortionNode::LensDistortionNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void LensDistortionNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void LensDistortionNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *editorNode = this->getbNode(); - NodeLensDist *data = (NodeLensDist *)editorNode->storage; + bNode *editor_node = this->get_bnode(); + NodeLensDist *data = (NodeLensDist *)editor_node->storage; if (data->proj) { ProjectorLensDistortionOperation *operation = new ProjectorLensDistortionOperation(); - converter.addOperation(operation); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_input_socket(get_input_socket(2), operation->get_input_socket(1)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0)); } else { ScreenLensDistortionOperation *operation = new ScreenLensDistortionOperation(); - operation->setFit(data->fit); - operation->setJitter(data->jit); + operation->set_fit(data->fit); + operation->set_jitter(data->jit); - if (!getInputSocket(1)->isLinked()) { - operation->setDistortion(getInputSocket(1)->getEditorValueFloat()); + if (!get_input_socket(1)->is_linked()) { + operation->set_distortion(get_input_socket(1)->get_editor_value_float()); } - if (!getInputSocket(2)->isLinked()) { - operation->setDispersion(getInputSocket(2)->getEditorValueFloat()); + if (!get_input_socket(2)->is_linked()) { + operation->set_dispersion(get_input_socket(2)->get_editor_value_float()); } - converter.addOperation(operation); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1)); + converter.map_input_socket(get_input_socket(2), operation->get_input_socket(2)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0)); } } diff --git a/source/blender/compositor/nodes/COM_LensDistortionNode.h b/source/blender/compositor/nodes/COM_LensDistortionNode.h index 4de1b0fe4da..154b8c20b86 100644 --- a/source/blender/compositor/nodes/COM_LensDistortionNode.h +++ b/source/blender/compositor/nodes/COM_LensDistortionNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class LensDistortionNode : public Node { public: - LensDistortionNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + LensDistortionNode(bNode *editor_node); + void convert_to_operations(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 e38aff91431..645cbe91fd2 100644 --- a/source/blender/compositor/nodes/COM_LuminanceMatteNode.cc +++ b/source/blender/compositor/nodes/COM_LuminanceMatteNode.cc @@ -22,34 +22,34 @@ namespace blender::compositor { -LuminanceMatteNode::LuminanceMatteNode(bNode *editorNode) : Node(editorNode) +LuminanceMatteNode::LuminanceMatteNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void LuminanceMatteNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void LuminanceMatteNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *editorsnode = getbNode(); - NodeInput *inputSocket = this->getInputSocket(0); - NodeOutput *outputSocketImage = this->getOutputSocket(0); - NodeOutput *outputSocketMatte = this->getOutputSocket(1); + bNode *editorsnode = get_bnode(); + NodeInput *input_socket = this->get_input_socket(0); + NodeOutput *output_socket_image = this->get_output_socket(0); + NodeOutput *output_socket_matte = this->get_output_socket(1); - LuminanceMatteOperation *operationSet = new LuminanceMatteOperation(); - operationSet->setSettings((NodeChroma *)editorsnode->storage); - converter.addOperation(operationSet); + LuminanceMatteOperation *operation_set = new LuminanceMatteOperation(); + operation_set->set_settings((NodeChroma *)editorsnode->storage); + converter.add_operation(operation_set); - converter.mapInputSocket(inputSocket, operationSet->getInputSocket(0)); - converter.mapOutputSocket(outputSocketMatte, operationSet->getOutputSocket(0)); + converter.map_input_socket(input_socket, operation_set->get_input_socket(0)); + converter.map_output_socket(output_socket_matte, operation_set->get_output_socket(0)); SetAlphaMultiplyOperation *operation = new SetAlphaMultiplyOperation(); - converter.addOperation(operation); + converter.add_operation(operation); - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.addLink(operationSet->getOutputSocket(), operation->getInputSocket(1)); - converter.mapOutputSocket(outputSocketImage, operation->getOutputSocket()); + converter.map_input_socket(input_socket, operation->get_input_socket(0)); + converter.add_link(operation_set->get_output_socket(), operation->get_input_socket(1)); + converter.map_output_socket(output_socket_image, operation->get_output_socket()); - converter.addPreview(operation->getOutputSocket()); + converter.add_preview(operation->get_output_socket()); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_LuminanceMatteNode.h b/source/blender/compositor/nodes/COM_LuminanceMatteNode.h index ef4ebc8ad92..1f934c73d1e 100644 --- a/source/blender/compositor/nodes/COM_LuminanceMatteNode.h +++ b/source/blender/compositor/nodes/COM_LuminanceMatteNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class LuminanceMatteNode : public Node { public: - LuminanceMatteNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + LuminanceMatteNode(bNode *editor_node); + void convert_to_operations(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 01288b779ec..45f3113ca9e 100644 --- a/source/blender/compositor/nodes/COM_MapRangeNode.cc +++ b/source/blender/compositor/nodes/COM_MapRangeNode.cc @@ -22,31 +22,31 @@ namespace blender::compositor { -MapRangeNode::MapRangeNode(bNode *editorNode) : Node(editorNode) +MapRangeNode::MapRangeNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void MapRangeNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void MapRangeNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *valueSocket = this->getInputSocket(0); - NodeInput *sourceMinSocket = this->getInputSocket(1); - NodeInput *sourceMaxSocket = this->getInputSocket(2); - NodeInput *destMinSocket = this->getInputSocket(3); - NodeInput *destMaxSocket = this->getInputSocket(4); - NodeOutput *outputSocket = this->getOutputSocket(0); + NodeInput *value_socket = this->get_input_socket(0); + NodeInput *source_min_socket = this->get_input_socket(1); + NodeInput *source_max_socket = this->get_input_socket(2); + NodeInput *dest_min_socket = this->get_input_socket(3); + NodeInput *dest_max_socket = this->get_input_socket(4); + NodeOutput *output_socket = this->get_output_socket(0); MapRangeOperation *operation = new MapRangeOperation(); - operation->setUseClamp(this->getbNode()->custom1); - converter.addOperation(operation); - - converter.mapInputSocket(valueSocket, operation->getInputSocket(0)); - converter.mapInputSocket(sourceMinSocket, operation->getInputSocket(1)); - converter.mapInputSocket(sourceMaxSocket, operation->getInputSocket(2)); - converter.mapInputSocket(destMinSocket, operation->getInputSocket(3)); - converter.mapInputSocket(destMaxSocket, operation->getInputSocket(4)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + operation->set_use_clamp(this->get_bnode()->custom1); + converter.add_operation(operation); + + converter.map_input_socket(value_socket, operation->get_input_socket(0)); + converter.map_input_socket(source_min_socket, operation->get_input_socket(1)); + converter.map_input_socket(source_max_socket, operation->get_input_socket(2)); + converter.map_input_socket(dest_min_socket, operation->get_input_socket(3)); + converter.map_input_socket(dest_max_socket, operation->get_input_socket(4)); + converter.map_output_socket(output_socket, operation->get_output_socket(0)); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_MapRangeNode.h b/source/blender/compositor/nodes/COM_MapRangeNode.h index ad6fd78a7d5..c9323ac00c2 100644 --- a/source/blender/compositor/nodes/COM_MapRangeNode.h +++ b/source/blender/compositor/nodes/COM_MapRangeNode.h @@ -29,9 +29,9 @@ namespace blender::compositor { */ class MapRangeNode : public Node { public: - MapRangeNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + MapRangeNode(bNode *editor_node); + void convert_to_operations(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 ddda1e2db1d..9c794165e0b 100644 --- a/source/blender/compositor/nodes/COM_MapUVNode.cc +++ b/source/blender/compositor/nodes/COM_MapUVNode.cc @@ -21,24 +21,24 @@ namespace blender::compositor { -MapUVNode::MapUVNode(bNode *editorNode) : Node(editorNode) +MapUVNode::MapUVNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void MapUVNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void MapUVNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bNode *node = this->getbNode(); + bNode *node = this->get_bnode(); MapUVOperation *operation = new MapUVOperation(); - operation->setAlpha((float)node->custom1); + operation->set_alpha((float)node->custom1); operation->set_canvas_input_index(1); - converter.addOperation(operation); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket()); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_MapUVNode.h b/source/blender/compositor/nodes/COM_MapUVNode.h index f7f4db167ea..eebfd0e66fa 100644 --- a/source/blender/compositor/nodes/COM_MapUVNode.h +++ b/source/blender/compositor/nodes/COM_MapUVNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class MapUVNode : public Node { public: - MapUVNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + MapUVNode(bNode *editor_node); + void convert_to_operations(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 9c6be55e93b..8c81a902863 100644 --- a/source/blender/compositor/nodes/COM_MapValueNode.cc +++ b/source/blender/compositor/nodes/COM_MapValueNode.cc @@ -22,25 +22,25 @@ namespace blender::compositor { -MapValueNode::MapValueNode(bNode *editorNode) : Node(editorNode) +MapValueNode::MapValueNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void MapValueNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void MapValueNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - TexMapping *storage = (TexMapping *)this->getbNode()->storage; + TexMapping *storage = (TexMapping *)this->get_bnode()->storage; - NodeInput *colorSocket = this->getInputSocket(0); - NodeOutput *valueSocket = this->getOutputSocket(0); + NodeInput *color_socket = this->get_input_socket(0); + NodeOutput *value_socket = this->get_output_socket(0); - MapValueOperation *convertProg = new MapValueOperation(); - convertProg->setSettings(storage); - converter.addOperation(convertProg); + MapValueOperation *convert_prog = new MapValueOperation(); + convert_prog->set_settings(storage); + converter.add_operation(convert_prog); - converter.mapInputSocket(colorSocket, convertProg->getInputSocket(0)); - converter.mapOutputSocket(valueSocket, convertProg->getOutputSocket(0)); + converter.map_input_socket(color_socket, convert_prog->get_input_socket(0)); + converter.map_output_socket(value_socket, convert_prog->get_output_socket(0)); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_MapValueNode.h b/source/blender/compositor/nodes/COM_MapValueNode.h index dcac1d6e3c5..4516d7eb016 100644 --- a/source/blender/compositor/nodes/COM_MapValueNode.h +++ b/source/blender/compositor/nodes/COM_MapValueNode.h @@ -29,9 +29,9 @@ namespace blender::compositor { */ class MapValueNode : public Node { public: - MapValueNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + MapValueNode(bNode *editor_node); + void convert_to_operations(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 27488c8a6c8..b1e0506089e 100644 --- a/source/blender/compositor/nodes/COM_MaskNode.cc +++ b/source/blender/compositor/nodes/COM_MaskNode.cc @@ -21,51 +21,51 @@ namespace blender::compositor { -MaskNode::MaskNode(bNode *editorNode) : Node(editorNode) +MaskNode::MaskNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void MaskNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void MaskNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - const RenderData *rd = context.getRenderData(); - const float render_size_factor = context.getRenderPercentageAsFactor(); + const RenderData *rd = context.get_render_data(); + const float render_size_factor = context.get_render_percentage_as_factor(); - NodeOutput *outputMask = this->getOutputSocket(0); + NodeOutput *output_mask = this->get_output_socket(0); - bNode *editorNode = this->getbNode(); - NodeMask *data = (NodeMask *)editorNode->storage; - Mask *mask = (Mask *)editorNode->id; + bNode *editor_node = this->get_bnode(); + NodeMask *data = (NodeMask *)editor_node->storage; + Mask *mask = (Mask *)editor_node->id; /* Always connect the output image. */ MaskOperation *operation = new MaskOperation(); - if (editorNode->custom1 & CMP_NODEFLAG_MASK_FIXED) { - operation->setMaskWidth(data->size_x); - operation->setMaskHeight(data->size_y); + if (editor_node->custom1 & CMP_NODEFLAG_MASK_FIXED) { + operation->set_mask_width(data->size_x); + operation->set_mask_height(data->size_y); } - else if (editorNode->custom1 & CMP_NODEFLAG_MASK_FIXED_SCENE) { - operation->setMaskWidth(data->size_x * render_size_factor); - operation->setMaskHeight(data->size_y * render_size_factor); + else if (editor_node->custom1 & CMP_NODEFLAG_MASK_FIXED_SCENE) { + operation->set_mask_width(data->size_x * render_size_factor); + operation->set_mask_height(data->size_y * render_size_factor); } else { - operation->setMaskWidth(rd->xsch * render_size_factor); - operation->setMaskHeight(rd->ysch * render_size_factor); + operation->set_mask_width(rd->xsch * render_size_factor); + operation->set_mask_height(rd->ysch * render_size_factor); } - operation->setMask(mask); - operation->setFramenumber(context.getFramenumber()); - operation->setFeather((bool)(editorNode->custom1 & CMP_NODEFLAG_MASK_NO_FEATHER) == 0); + operation->set_mask(mask); + operation->set_framenumber(context.get_framenumber()); + operation->set_feather((bool)(editor_node->custom1 & CMP_NODEFLAG_MASK_NO_FEATHER) == 0); - if ((editorNode->custom1 & CMP_NODEFLAG_MASK_MOTION_BLUR) && (editorNode->custom2 > 1) && - (editorNode->custom3 > FLT_EPSILON)) { - operation->setMotionBlurSamples(editorNode->custom2); - operation->setMotionBlurShutter(editorNode->custom3); + if ((editor_node->custom1 & CMP_NODEFLAG_MASK_MOTION_BLUR) && (editor_node->custom2 > 1) && + (editor_node->custom3 > FLT_EPSILON)) { + operation->set_motion_blur_samples(editor_node->custom2); + operation->set_motion_blur_shutter(editor_node->custom3); } - converter.addOperation(operation); - converter.mapOutputSocket(outputMask, operation->getOutputSocket()); + converter.add_operation(operation); + converter.map_output_socket(output_mask, operation->get_output_socket()); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_MaskNode.h b/source/blender/compositor/nodes/COM_MaskNode.h index 5890cf5957a..0d9d4284b27 100644 --- a/source/blender/compositor/nodes/COM_MaskNode.h +++ b/source/blender/compositor/nodes/COM_MaskNode.h @@ -29,9 +29,9 @@ namespace blender::compositor { */ class MaskNode : public Node { public: - MaskNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + MaskNode(bNode *editor_node); + void convert_to_operations(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 f8a1530fe29..6102aed0f88 100644 --- a/source/blender/compositor/nodes/COM_MathNode.cc +++ b/source/blender/compositor/nodes/COM_MathNode.cc @@ -21,12 +21,12 @@ namespace blender::compositor { -void MathNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void MathNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { MathBaseOperation *operation = nullptr; - switch (this->getbNode()->custom1) { + switch (this->get_bnode()->custom1) { case NODE_MATH_ADD: operation = new MathAddOperation(); break; @@ -150,14 +150,14 @@ void MathNode::convertToOperations(NodeConverter &converter, } if (operation) { - bool useClamp = getbNode()->custom2; - operation->setUseClamp(useClamp); - converter.addOperation(operation); + bool use_clamp = get_bnode()->custom2; + operation->set_use_clamp(use_clamp); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1)); + converter.map_input_socket(get_input_socket(2), operation->get_input_socket(2)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket()); } } diff --git a/source/blender/compositor/nodes/COM_MathNode.h b/source/blender/compositor/nodes/COM_MathNode.h index 5db59e62bab..7f60fc03fcd 100644 --- a/source/blender/compositor/nodes/COM_MathNode.h +++ b/source/blender/compositor/nodes/COM_MathNode.h @@ -28,11 +28,11 @@ namespace blender::compositor { */ class MathNode : public Node { public: - MathNode(bNode *editorNode) : Node(editorNode) + MathNode(bNode *editor_node) : Node(editor_node) { } - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + void convert_to_operations(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 9eb38783d6a..ae7736b4b67 100644 --- a/source/blender/compositor/nodes/COM_MixNode.cc +++ b/source/blender/compositor/nodes/COM_MixNode.cc @@ -24,91 +24,91 @@ namespace blender::compositor { -MixNode::MixNode(bNode *editorNode) : Node(editorNode) +MixNode::MixNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void MixNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void MixNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *valueSocket = this->getInputSocket(0); - NodeInput *color1Socket = this->getInputSocket(1); - NodeInput *color2Socket = this->getInputSocket(2); - NodeOutput *outputSocket = this->getOutputSocket(0); - bNode *editorNode = this->getbNode(); - bool useAlphaPremultiply = (this->getbNode()->custom2 & 1) != 0; - bool useClamp = (this->getbNode()->custom2 & 2) != 0; + NodeInput *value_socket = this->get_input_socket(0); + NodeInput *color1Socket = this->get_input_socket(1); + NodeInput *color2Socket = this->get_input_socket(2); + NodeOutput *output_socket = this->get_output_socket(0); + bNode *editor_node = this->get_bnode(); + bool use_alpha_premultiply = (this->get_bnode()->custom2 & 1) != 0; + bool use_clamp = (this->get_bnode()->custom2 & 2) != 0; - MixBaseOperation *convertProg; - switch (editorNode->custom1) { + MixBaseOperation *convert_prog; + switch (editor_node->custom1) { case MA_RAMP_ADD: - convertProg = new MixAddOperation(); + convert_prog = new MixAddOperation(); break; case MA_RAMP_MULT: - convertProg = new MixMultiplyOperation(); + convert_prog = new MixMultiplyOperation(); break; case MA_RAMP_LIGHT: - convertProg = new MixLightenOperation(); + convert_prog = new MixLightenOperation(); break; case MA_RAMP_BURN: - convertProg = new MixColorBurnOperation(); + convert_prog = new MixColorBurnOperation(); break; case MA_RAMP_HUE: - convertProg = new MixHueOperation(); + convert_prog = new MixHueOperation(); break; case MA_RAMP_COLOR: - convertProg = new MixColorOperation(); + convert_prog = new MixColorOperation(); break; case MA_RAMP_SOFT: - convertProg = new MixSoftLightOperation(); + convert_prog = new MixSoftLightOperation(); break; case MA_RAMP_SCREEN: - convertProg = new MixScreenOperation(); + convert_prog = new MixScreenOperation(); break; case MA_RAMP_LINEAR: - convertProg = new MixLinearLightOperation(); + convert_prog = new MixLinearLightOperation(); break; case MA_RAMP_DIFF: - convertProg = new MixDifferenceOperation(); + convert_prog = new MixDifferenceOperation(); break; case MA_RAMP_SAT: - convertProg = new MixSaturationOperation(); + convert_prog = new MixSaturationOperation(); break; case MA_RAMP_DIV: - convertProg = new MixDivideOperation(); + convert_prog = new MixDivideOperation(); break; case MA_RAMP_SUB: - convertProg = new MixSubtractOperation(); + convert_prog = new MixSubtractOperation(); break; case MA_RAMP_DARK: - convertProg = new MixDarkenOperation(); + convert_prog = new MixDarkenOperation(); break; case MA_RAMP_OVERLAY: - convertProg = new MixOverlayOperation(); + convert_prog = new MixOverlayOperation(); break; case MA_RAMP_VAL: - convertProg = new MixValueOperation(); + convert_prog = new MixValueOperation(); break; case MA_RAMP_DODGE: - convertProg = new MixDodgeOperation(); + convert_prog = new MixDodgeOperation(); break; case MA_RAMP_BLEND: default: - convertProg = new MixBlendOperation(); + convert_prog = new MixBlendOperation(); break; } - convertProg->setUseValueAlphaMultiply(useAlphaPremultiply); - convertProg->setUseClamp(useClamp); - converter.addOperation(convertProg); + convert_prog->set_use_value_alpha_multiply(use_alpha_premultiply); + convert_prog->set_use_clamp(use_clamp); + converter.add_operation(convert_prog); - converter.mapInputSocket(valueSocket, convertProg->getInputSocket(0)); - converter.mapInputSocket(color1Socket, convertProg->getInputSocket(1)); - converter.mapInputSocket(color2Socket, convertProg->getInputSocket(2)); - converter.mapOutputSocket(outputSocket, convertProg->getOutputSocket(0)); + converter.map_input_socket(value_socket, convert_prog->get_input_socket(0)); + converter.map_input_socket(color1Socket, convert_prog->get_input_socket(1)); + converter.map_input_socket(color2Socket, convert_prog->get_input_socket(2)); + converter.map_output_socket(output_socket, convert_prog->get_output_socket(0)); - converter.addPreview(convertProg->getOutputSocket(0)); + converter.add_preview(convert_prog->get_output_socket(0)); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_MixNode.h b/source/blender/compositor/nodes/COM_MixNode.h index 81f9c41871e..1a6bdf1cf57 100644 --- a/source/blender/compositor/nodes/COM_MixNode.h +++ b/source/blender/compositor/nodes/COM_MixNode.h @@ -29,9 +29,9 @@ namespace blender::compositor { */ class MixNode : public Node { public: - MixNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + MixNode(bNode *editor_node); + void convert_to_operations(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 9c2e3c95a03..b71e379304e 100644 --- a/source/blender/compositor/nodes/COM_MovieClipNode.cc +++ b/source/blender/compositor/nodes/COM_MovieClipNode.cc @@ -29,58 +29,58 @@ namespace blender::compositor { -MovieClipNode::MovieClipNode(bNode *editorNode) : Node(editorNode) +MovieClipNode::MovieClipNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void MovieClipNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void MovieClipNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - NodeOutput *outputMovieClip = this->getOutputSocket(0); - NodeOutput *alphaMovieClip = this->getOutputSocket(1); - NodeOutput *offsetXMovieClip = this->getOutputSocket(2); - NodeOutput *offsetYMovieClip = this->getOutputSocket(3); - NodeOutput *scaleMovieClip = this->getOutputSocket(4); - NodeOutput *angleMovieClip = this->getOutputSocket(5); - - bNode *editorNode = this->getbNode(); - MovieClip *movieClip = (MovieClip *)editorNode->id; - MovieClipUser *movieClipUser = (MovieClipUser *)editorNode->storage; - bool cacheFrame = !context.isRendering(); + NodeOutput *output_movie_clip = this->get_output_socket(0); + NodeOutput *alpha_movie_clip = this->get_output_socket(1); + NodeOutput *offset_xmovie_clip = this->get_output_socket(2); + NodeOutput *offset_ymovie_clip = this->get_output_socket(3); + NodeOutput *scale_movie_clip = this->get_output_socket(4); + NodeOutput *angle_movie_clip = this->get_output_socket(5); + + bNode *editor_node = this->get_bnode(); + MovieClip *movie_clip = (MovieClip *)editor_node->id; + MovieClipUser *movie_clip_user = (MovieClipUser *)editor_node->storage; + bool cache_frame = !context.is_rendering(); ImBuf *ibuf = nullptr; - if (movieClip) { - if (cacheFrame) { - ibuf = BKE_movieclip_get_ibuf(movieClip, movieClipUser); + if (movie_clip) { + if (cache_frame) { + ibuf = BKE_movieclip_get_ibuf(movie_clip, movie_clip_user); } else { ibuf = BKE_movieclip_get_ibuf_flag( - movieClip, movieClipUser, movieClip->flag, MOVIECLIP_CACHE_SKIP); + movie_clip, movie_clip_user, movie_clip->flag, MOVIECLIP_CACHE_SKIP); } } /* Always connect the output image. */ MovieClipOperation *operation = new MovieClipOperation(); - operation->setMovieClip(movieClip); - operation->setMovieClipUser(movieClipUser); - operation->setFramenumber(context.getFramenumber()); - operation->setCacheFrame(cacheFrame); + operation->set_movie_clip(movie_clip); + operation->set_movie_clip_user(movie_clip_user); + operation->set_framenumber(context.get_framenumber()); + operation->set_cache_frame(cache_frame); - converter.addOperation(operation); - converter.mapOutputSocket(outputMovieClip, operation->getOutputSocket()); - converter.addPreview(operation->getOutputSocket()); + converter.add_operation(operation); + converter.map_output_socket(output_movie_clip, operation->get_output_socket()); + converter.add_preview(operation->get_output_socket()); - MovieClipAlphaOperation *alphaOperation = new MovieClipAlphaOperation(); - alphaOperation->setMovieClip(movieClip); - alphaOperation->setMovieClipUser(movieClipUser); - alphaOperation->setFramenumber(context.getFramenumber()); - alphaOperation->setCacheFrame(cacheFrame); + MovieClipAlphaOperation *alpha_operation = new MovieClipAlphaOperation(); + alpha_operation->set_movie_clip(movie_clip); + alpha_operation->set_movie_clip_user(movie_clip_user); + alpha_operation->set_framenumber(context.get_framenumber()); + alpha_operation->set_cache_frame(cache_frame); - converter.addOperation(alphaOperation); - converter.mapOutputSocket(alphaMovieClip, alphaOperation->getOutputSocket()); + converter.add_operation(alpha_operation); + converter.map_output_socket(alpha_movie_clip, alpha_operation->get_output_socket()); - MovieTrackingStabilization *stab = &movieClip->tracking.stabilization; + MovieTrackingStabilization *stab = &movie_clip->tracking.stabilization; float loc[2], scale, angle; loc[0] = 0.0f; loc[1] = 0.0f; @@ -89,18 +89,18 @@ void MovieClipNode::convertToOperations(NodeConverter &converter, if (ibuf) { if (stab->flag & TRACKING_2D_STABILIZATION) { - int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(movieClip, - context.getFramenumber()); + int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(movie_clip, + context.get_framenumber()); BKE_tracking_stabilization_data_get( - movieClip, clip_framenr, ibuf->x, ibuf->y, loc, &scale, &angle); + movie_clip, clip_framenr, ibuf->x, ibuf->y, loc, &scale, &angle); } } - converter.addOutputValue(offsetXMovieClip, loc[0]); - converter.addOutputValue(offsetYMovieClip, loc[1]); - converter.addOutputValue(scaleMovieClip, scale); - converter.addOutputValue(angleMovieClip, angle); + converter.add_output_value(offset_xmovie_clip, loc[0]); + converter.add_output_value(offset_ymovie_clip, loc[1]); + converter.add_output_value(scale_movie_clip, scale); + converter.add_output_value(angle_movie_clip, angle); if (ibuf) { IMB_freeImBuf(ibuf); diff --git a/source/blender/compositor/nodes/COM_MovieClipNode.h b/source/blender/compositor/nodes/COM_MovieClipNode.h index a469ce9e2a4..cf9e7a3e01e 100644 --- a/source/blender/compositor/nodes/COM_MovieClipNode.h +++ b/source/blender/compositor/nodes/COM_MovieClipNode.h @@ -29,9 +29,9 @@ namespace blender::compositor { */ class MovieClipNode : public Node { public: - MovieClipNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + MovieClipNode(bNode *editor_node); + void convert_to_operations(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 c9155ee8ca3..03b780198cd 100644 --- a/source/blender/compositor/nodes/COM_MovieDistortionNode.cc +++ b/source/blender/compositor/nodes/COM_MovieDistortionNode.cc @@ -22,27 +22,27 @@ namespace blender::compositor { -MovieDistortionNode::MovieDistortionNode(bNode *editorNode) : Node(editorNode) +MovieDistortionNode::MovieDistortionNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void MovieDistortionNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void MovieDistortionNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *bnode = this->getbNode(); + bNode *bnode = this->get_bnode(); MovieClip *clip = (MovieClip *)bnode->id; - NodeInput *inputSocket = this->getInputSocket(0); - NodeOutput *outputSocket = this->getOutputSocket(0); + NodeInput *input_socket = this->get_input_socket(0); + NodeOutput *output_socket = this->get_output_socket(0); MovieDistortionOperation *operation = new MovieDistortionOperation(bnode->custom1 == 1); - operation->setMovieClip(clip); - operation->setFramenumber(context.getFramenumber()); - converter.addOperation(operation); + operation->set_movie_clip(clip); + operation->set_framenumber(context.get_framenumber()); + converter.add_operation(operation); - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + converter.map_input_socket(input_socket, operation->get_input_socket(0)); + converter.map_output_socket(output_socket, operation->get_output_socket(0)); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_MovieDistortionNode.h b/source/blender/compositor/nodes/COM_MovieDistortionNode.h index 0c1610aa3d3..530b0dd6f97 100644 --- a/source/blender/compositor/nodes/COM_MovieDistortionNode.h +++ b/source/blender/compositor/nodes/COM_MovieDistortionNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class MovieDistortionNode : public Node { public: - MovieDistortionNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + MovieDistortionNode(bNode *editor_node); + void convert_to_operations(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 5a05f4c89b5..f9875c6015c 100644 --- a/source/blender/compositor/nodes/COM_NormalNode.cc +++ b/source/blender/compositor/nodes/COM_NormalNode.cc @@ -22,37 +22,37 @@ namespace blender::compositor { -NormalNode::NormalNode(bNode *editorNode) : Node(editorNode) +NormalNode::NormalNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void NormalNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void NormalNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *inputSocket = this->getInputSocket(0); - NodeOutput *outputSocket = this->getOutputSocket(0); - NodeOutput *outputSocketDotproduct = this->getOutputSocket(1); + NodeInput *input_socket = this->get_input_socket(0); + NodeOutput *output_socket = this->get_output_socket(0); + NodeOutput *output_socket_dotproduct = this->get_output_socket(1); - SetVectorOperation *operationSet = new SetVectorOperation(); + SetVectorOperation *operation_set = new SetVectorOperation(); float normal[3]; - outputSocket->getEditorValueVector(normal); + output_socket->get_editor_value_vector(normal); /* animation can break normalization, this restores it */ normalize_v3(normal); - operationSet->setX(normal[0]); - operationSet->setY(normal[1]); - operationSet->setZ(normal[2]); - operationSet->setW(0.0f); - converter.addOperation(operationSet); + operation_set->setX(normal[0]); + operation_set->setY(normal[1]); + operation_set->setZ(normal[2]); + operation_set->setW(0.0f); + converter.add_operation(operation_set); - converter.mapOutputSocket(outputSocket, operationSet->getOutputSocket(0)); + converter.map_output_socket(output_socket, operation_set->get_output_socket(0)); DotproductOperation *operation = new DotproductOperation(); - converter.addOperation(operation); + converter.add_operation(operation); - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.addLink(operationSet->getOutputSocket(0), operation->getInputSocket(1)); - converter.mapOutputSocket(outputSocketDotproduct, operation->getOutputSocket(0)); + converter.map_input_socket(input_socket, operation->get_input_socket(0)); + converter.add_link(operation_set->get_output_socket(0), operation->get_input_socket(1)); + converter.map_output_socket(output_socket_dotproduct, operation->get_output_socket(0)); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_NormalNode.h b/source/blender/compositor/nodes/COM_NormalNode.h index 6d5cbb394a0..2fcbb280c20 100644 --- a/source/blender/compositor/nodes/COM_NormalNode.h +++ b/source/blender/compositor/nodes/COM_NormalNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class NormalNode : public Node { public: - NormalNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + NormalNode(bNode *editor_node); + void convert_to_operations(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 b42f8154ce0..0dbd9e1837c 100644 --- a/source/blender/compositor/nodes/COM_NormalizeNode.cc +++ b/source/blender/compositor/nodes/COM_NormalizeNode.cc @@ -21,19 +21,19 @@ namespace blender::compositor { -NormalizeNode::NormalizeNode(bNode *editorNode) : Node(editorNode) +NormalizeNode::NormalizeNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void NormalizeNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void NormalizeNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { NormalizeOperation *operation = new NormalizeOperation(); - converter.addOperation(operation); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0)); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_NormalizeNode.h b/source/blender/compositor/nodes/COM_NormalizeNode.h index 7770fc49b61..50d3b939b30 100644 --- a/source/blender/compositor/nodes/COM_NormalizeNode.h +++ b/source/blender/compositor/nodes/COM_NormalizeNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class NormalizeNode : public Node { public: - NormalizeNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + NormalizeNode(bNode *editor_node); + void convert_to_operations(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 772456da963..25d201fc9c4 100644 --- a/source/blender/compositor/nodes/COM_OutputFileNode.cc +++ b/source/blender/compositor/nodes/COM_OutputFileNode.cc @@ -20,7 +20,7 @@ namespace blender::compositor { -OutputFileNode::OutputFileNode(bNode *editorNode) : Node(editorNode) +OutputFileNode::OutputFileNode(bNode *editor_node) : Node(editor_node) { /* pass */ } @@ -29,34 +29,34 @@ void OutputFileNode::add_input_sockets(OutputOpenExrMultiLayerOperation &operati { for (NodeInput *input : inputs) { NodeImageMultiFileSocket *sockdata = - (NodeImageMultiFileSocket *)input->getbNodeSocket()->storage; + (NodeImageMultiFileSocket *)input->get_bnode_socket()->storage; /* NOTE: layer becomes an empty placeholder if the input is not linked. */ - operation.add_layer(sockdata->layer, input->getDataType(), input->isLinked()); + operation.add_layer(sockdata->layer, input->get_data_type(), input->is_linked()); } } void OutputFileNode::map_input_sockets(NodeConverter &converter, OutputOpenExrMultiLayerOperation &operation) const { - bool previewAdded = false; + bool preview_added = false; int index = 0; for (NodeInput *input : inputs) { - converter.mapInputSocket(input, operation.getInputSocket(index++)); + converter.map_input_socket(input, operation.get_input_socket(index++)); - if (!previewAdded) { - converter.addNodeInputPreview(input); - previewAdded = true; + if (!preview_added) { + converter.add_node_input_preview(input); + preview_added = true; } } } -void OutputFileNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void OutputFileNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - NodeImageMultiFile *storage = (NodeImageMultiFile *)this->getbNode()->storage; - const bool is_multiview = (context.getRenderData()->scemode & R_MULTIVIEW) != 0; + NodeImageMultiFile *storage = (NodeImageMultiFile *)this->get_bnode()->storage; + const bool is_multiview = (context.get_render_data()->scemode & R_MULTIVIEW) != 0; - if (!context.isRendering()) { + if (!context.is_rendering()) { /* only output files when rendering a sequence - * otherwise, it overwrites the output files just * scrubbing through the timeline when the compositor updates. @@ -67,40 +67,40 @@ void OutputFileNode::convertToOperations(NodeConverter &converter, if (storage->format.imtype == R_IMF_IMTYPE_MULTILAYER) { const bool use_half_float = (storage->format.depth == R_IMF_CHAN_DEPTH_16); /* single output operation for the multilayer file */ - OutputOpenExrMultiLayerOperation *outputOperation; + OutputOpenExrMultiLayerOperation *output_operation; if (is_multiview && storage->format.views_format == R_IMF_VIEWS_MULTIVIEW) { - outputOperation = new OutputOpenExrMultiLayerMultiViewOperation(context.getScene(), - context.getRenderData(), - context.getbNodeTree(), - storage->base_path, - storage->format.exr_codec, - use_half_float, - context.getViewName()); + output_operation = new OutputOpenExrMultiLayerMultiViewOperation(context.get_scene(), + context.get_render_data(), + context.get_bnodetree(), + storage->base_path, + storage->format.exr_codec, + use_half_float, + context.get_view_name()); } else { - outputOperation = new OutputOpenExrMultiLayerOperation(context.getScene(), - context.getRenderData(), - context.getbNodeTree(), - storage->base_path, - storage->format.exr_codec, - use_half_float, - context.getViewName()); + output_operation = new OutputOpenExrMultiLayerOperation(context.get_scene(), + context.get_render_data(), + context.get_bnodetree(), + storage->base_path, + storage->format.exr_codec, + use_half_float, + context.get_view_name()); } - converter.addOperation(outputOperation); + converter.add_operation(output_operation); /* First add all inputs. Inputs are stored in a Vector and can be moved to a different * memory address during this time. */ - add_input_sockets(*outputOperation); + add_input_sockets(*output_operation); /* After adding the sockets the memory addresses will stick. */ - map_input_sockets(converter, *outputOperation); + map_input_sockets(converter, *output_operation); } else { /* single layer format */ - bool previewAdded = false; + bool preview_added = false; for (NodeInput *input : inputs) { - if (input->isLinked()) { + if (input->is_linked()) { NodeImageMultiFileSocket *sockdata = - (NodeImageMultiFileSocket *)input->getbNodeSocket()->storage; + (NodeImageMultiFileSocket *)input->get_bnode_socket()->storage; ImageFormatData *format = (sockdata->use_node_format ? &storage->format : &sockdata->format); char path[FILE_MAX]; @@ -108,50 +108,50 @@ void OutputFileNode::convertToOperations(NodeConverter &converter, /* combine file path for the input */ BLI_join_dirfile(path, FILE_MAX, storage->base_path, sockdata->path); - NodeOperation *outputOperation = nullptr; + NodeOperation *output_operation = nullptr; if (is_multiview && format->views_format == R_IMF_VIEWS_MULTIVIEW) { - outputOperation = new OutputOpenExrSingleLayerMultiViewOperation( - context.getRenderData(), - context.getbNodeTree(), - input->getDataType(), + output_operation = new OutputOpenExrSingleLayerMultiViewOperation( + context.get_render_data(), + context.get_bnodetree(), + input->get_data_type(), format, path, - context.getViewSettings(), - context.getDisplaySettings(), - context.getViewName(), + context.get_view_settings(), + context.get_display_settings(), + context.get_view_name(), sockdata->save_as_render); } else if ((!is_multiview) || (format->views_format == R_IMF_VIEWS_INDIVIDUAL)) { - outputOperation = new OutputSingleLayerOperation(context.getRenderData(), - context.getbNodeTree(), - input->getDataType(), - format, - path, - context.getViewSettings(), - context.getDisplaySettings(), - context.getViewName(), - sockdata->save_as_render); + output_operation = new OutputSingleLayerOperation(context.get_render_data(), + context.get_bnodetree(), + input->get_data_type(), + format, + path, + context.get_view_settings(), + context.get_display_settings(), + context.get_view_name(), + sockdata->save_as_render); } else { /* R_IMF_VIEWS_STEREO_3D */ - outputOperation = new OutputStereoOperation(context.getRenderData(), - context.getbNodeTree(), - input->getDataType(), - format, - path, - sockdata->layer, - context.getViewSettings(), - context.getDisplaySettings(), - context.getViewName(), - sockdata->save_as_render); + output_operation = new OutputStereoOperation(context.get_render_data(), + context.get_bnodetree(), + input->get_data_type(), + format, + path, + sockdata->layer, + context.get_view_settings(), + context.get_display_settings(), + context.get_view_name(), + sockdata->save_as_render); } - converter.addOperation(outputOperation); - converter.mapInputSocket(input, outputOperation->getInputSocket(0)); + converter.add_operation(output_operation); + converter.map_input_socket(input, output_operation->get_input_socket(0)); - if (!previewAdded) { - converter.addNodeInputPreview(input); - previewAdded = true; + if (!preview_added) { + converter.add_node_input_preview(input); + preview_added = true; } } } diff --git a/source/blender/compositor/nodes/COM_OutputFileNode.h b/source/blender/compositor/nodes/COM_OutputFileNode.h index c64128a708f..4c5575cc6b9 100644 --- a/source/blender/compositor/nodes/COM_OutputFileNode.h +++ b/source/blender/compositor/nodes/COM_OutputFileNode.h @@ -32,9 +32,9 @@ namespace blender::compositor { */ class OutputFileNode : public Node { public: - OutputFileNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + OutputFileNode(bNode *editor_node); + void convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const override; private: void add_input_sockets(OutputOpenExrMultiLayerOperation &operation) const; diff --git a/source/blender/compositor/nodes/COM_PixelateNode.cc b/source/blender/compositor/nodes/COM_PixelateNode.cc index ae7169b2d98..251ef7b192a 100644 --- a/source/blender/compositor/nodes/COM_PixelateNode.cc +++ b/source/blender/compositor/nodes/COM_PixelateNode.cc @@ -22,28 +22,28 @@ namespace blender::compositor { -PixelateNode::PixelateNode(bNode *editorNode) : Node(editorNode) +PixelateNode::PixelateNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void PixelateNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void PixelateNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *inputSocket = this->getInputSocket(0); - NodeOutput *outputSocket = this->getOutputSocket(0); - DataType datatype = inputSocket->getDataType(); + NodeInput *input_socket = this->get_input_socket(0); + NodeOutput *output_socket = this->get_output_socket(0); + DataType datatype = input_socket->get_data_type(); - if (inputSocket->isLinked()) { - NodeOutput *link = inputSocket->getLink(); - datatype = link->getDataType(); + if (input_socket->is_linked()) { + NodeOutput *link = input_socket->get_link(); + datatype = link->get_data_type(); } PixelateOperation *operation = new PixelateOperation(datatype); - converter.addOperation(operation); + converter.add_operation(operation); - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + converter.map_input_socket(input_socket, operation->get_input_socket(0)); + converter.map_output_socket(output_socket, operation->get_output_socket(0)); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_PixelateNode.h b/source/blender/compositor/nodes/COM_PixelateNode.h index 1a6555550cf..c52a73cafa6 100644 --- a/source/blender/compositor/nodes/COM_PixelateNode.h +++ b/source/blender/compositor/nodes/COM_PixelateNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class PixelateNode : public Node { public: - PixelateNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + PixelateNode(bNode *editor_node); + void convert_to_operations(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 716392f8bcf..0d2623f6e8b 100644 --- a/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.cc +++ b/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.cc @@ -22,50 +22,50 @@ namespace blender::compositor { -PlaneTrackDeformNode::PlaneTrackDeformNode(bNode *editorNode) : Node(editorNode) +PlaneTrackDeformNode::PlaneTrackDeformNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void PlaneTrackDeformNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void PlaneTrackDeformNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *editorNode = this->getbNode(); - MovieClip *clip = (MovieClip *)editorNode->id; - NodePlaneTrackDeformData *data = (NodePlaneTrackDeformData *)editorNode->storage; + bNode *editor_node = this->get_bnode(); + MovieClip *clip = (MovieClip *)editor_node->id; + NodePlaneTrackDeformData *data = (NodePlaneTrackDeformData *)editor_node->storage; - int frame_number = context.getFramenumber(); + int frame_number = context.get_framenumber(); - NodeInput *input_image = this->getInputSocket(0); - NodeOutput *output_warped_image = this->getOutputSocket(0); - NodeOutput *output_plane = this->getOutputSocket(1); + NodeInput *input_image = this->get_input_socket(0); + NodeOutput *output_warped_image = this->get_output_socket(0); + NodeOutput *output_plane = this->get_output_socket(1); PlaneTrackWarpImageOperation *warp_image_operation = new PlaneTrackWarpImageOperation(); - warp_image_operation->setMovieClip(clip); - warp_image_operation->setTrackingObject(data->tracking_object); - warp_image_operation->setPlaneTrackName(data->plane_track_name); - warp_image_operation->setFramenumber(frame_number); + warp_image_operation->set_movie_clip(clip); + warp_image_operation->set_tracking_object(data->tracking_object); + warp_image_operation->set_plane_track_name(data->plane_track_name); + warp_image_operation->set_framenumber(frame_number); if (data->flag & CMP_NODEFLAG_PLANETRACKDEFORM_MOTION_BLUR) { - warp_image_operation->setMotionBlurSamples(data->motion_blur_samples); - warp_image_operation->setMotionBlurShutter(data->motion_blur_shutter); + warp_image_operation->set_motion_blur_samples(data->motion_blur_samples); + warp_image_operation->set_motion_blur_shutter(data->motion_blur_shutter); } - converter.addOperation(warp_image_operation); + converter.add_operation(warp_image_operation); - converter.mapInputSocket(input_image, warp_image_operation->getInputSocket(0)); - converter.mapOutputSocket(output_warped_image, warp_image_operation->getOutputSocket()); + converter.map_input_socket(input_image, warp_image_operation->get_input_socket(0)); + converter.map_output_socket(output_warped_image, warp_image_operation->get_output_socket()); PlaneTrackMaskOperation *plane_mask_operation = new PlaneTrackMaskOperation(); - plane_mask_operation->setMovieClip(clip); - plane_mask_operation->setTrackingObject(data->tracking_object); - plane_mask_operation->setPlaneTrackName(data->plane_track_name); - plane_mask_operation->setFramenumber(frame_number); + plane_mask_operation->set_movie_clip(clip); + plane_mask_operation->set_tracking_object(data->tracking_object); + plane_mask_operation->set_plane_track_name(data->plane_track_name); + plane_mask_operation->set_framenumber(frame_number); if (data->flag & CMP_NODEFLAG_PLANETRACKDEFORM_MOTION_BLUR) { - plane_mask_operation->setMotionBlurSamples(data->motion_blur_samples); - plane_mask_operation->setMotionBlurShutter(data->motion_blur_shutter); + plane_mask_operation->set_motion_blur_samples(data->motion_blur_samples); + plane_mask_operation->set_motion_blur_shutter(data->motion_blur_shutter); } - converter.addOperation(plane_mask_operation); + converter.add_operation(plane_mask_operation); - converter.mapOutputSocket(output_plane, plane_mask_operation->getOutputSocket()); + converter.map_output_socket(output_plane, plane_mask_operation->get_output_socket()); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.h b/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.h index 307738fcaf0..16367423454 100644 --- a/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.h +++ b/source/blender/compositor/nodes/COM_PlaneTrackDeformNode.h @@ -31,9 +31,9 @@ namespace blender::compositor { */ class PlaneTrackDeformNode : public Node { public: - PlaneTrackDeformNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + PlaneTrackDeformNode(bNode *editor_node); + void convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const override; }; } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_PosterizeNode.cc b/source/blender/compositor/nodes/COM_PosterizeNode.cc index a69e4f17250..c055a954c01 100644 --- a/source/blender/compositor/nodes/COM_PosterizeNode.cc +++ b/source/blender/compositor/nodes/COM_PosterizeNode.cc @@ -21,20 +21,20 @@ namespace blender::compositor { -PosterizeNode::PosterizeNode(bNode *editorNode) : Node(editorNode) +PosterizeNode::PosterizeNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void PosterizeNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void PosterizeNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { PosterizeOperation *operation = new PosterizeOperation(); - converter.addOperation(operation); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0)); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_PosterizeNode.h b/source/blender/compositor/nodes/COM_PosterizeNode.h index bb9bef2bdd0..d19e598632a 100644 --- a/source/blender/compositor/nodes/COM_PosterizeNode.h +++ b/source/blender/compositor/nodes/COM_PosterizeNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class PosterizeNode : public Node { public: - PosterizeNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + PosterizeNode(bNode *editor_node); + void convert_to_operations(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 87dccec7bfc..92033c3fbe8 100644 --- a/source/blender/compositor/nodes/COM_RenderLayersNode.cc +++ b/source/blender/compositor/nodes/COM_RenderLayersNode.cc @@ -23,66 +23,66 @@ namespace blender::compositor { -RenderLayersNode::RenderLayersNode(bNode *editorNode) : Node(editorNode) +RenderLayersNode::RenderLayersNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void RenderLayersNode::testSocketLink(NodeConverter &converter, - const CompositorContext &context, - NodeOutput *output, - RenderLayersProg *operation, - Scene *scene, - int layerId, - bool is_preview) const +void RenderLayersNode::test_socket_link(NodeConverter &converter, + const CompositorContext &context, + NodeOutput *output, + RenderLayersProg *operation, + Scene *scene, + int layer_id, + bool is_preview) const { - operation->setScene(scene); - operation->setLayerId(layerId); - operation->setRenderData(context.getRenderData()); - operation->setViewName(context.getViewName()); + operation->set_scene(scene); + operation->set_layer_id(layer_id); + operation->set_render_data(context.get_render_data()); + operation->set_view_name(context.get_view_name()); - converter.mapOutputSocket(output, operation->getOutputSocket()); - converter.addOperation(operation); + converter.map_output_socket(output, operation->get_output_socket()); + converter.add_operation(operation); if (is_preview) { /* only for image socket */ - converter.addPreview(operation->getOutputSocket()); + converter.add_preview(operation->get_output_socket()); } } -void RenderLayersNode::testRenderLink(NodeConverter &converter, - const CompositorContext &context, - Render *re) const +void RenderLayersNode::test_render_link(NodeConverter &converter, + const CompositorContext &context, + Render *re) const { - Scene *scene = (Scene *)this->getbNode()->id; - const short layerId = this->getbNode()->custom1; + Scene *scene = (Scene *)this->get_bnode()->id; + const short layer_id = this->get_bnode()->custom1; RenderResult *rr = RE_AcquireResultRead(re); if (rr == nullptr) { - missingRenderLink(converter); + missing_render_link(converter); return; } - ViewLayer *view_layer = (ViewLayer *)BLI_findlink(&scene->view_layers, layerId); + ViewLayer *view_layer = (ViewLayer *)BLI_findlink(&scene->view_layers, layer_id); if (view_layer == nullptr) { - missingRenderLink(converter); + missing_render_link(converter); return; } RenderLayer *rl = RE_GetRenderLayer(rr, view_layer->name); if (rl == nullptr) { - missingRenderLink(converter); + missing_render_link(converter); return; } - for (NodeOutput *output : getOutputSockets()) { - NodeImageLayer *storage = (NodeImageLayer *)output->getbNodeSocket()->storage; + for (NodeOutput *output : get_output_sockets()) { + NodeImageLayer *storage = (NodeImageLayer *)output->get_bnode_socket()->storage; RenderPass *rpass = (RenderPass *)BLI_findstring( &rl->passes, storage->pass_name, offsetof(RenderPass, name)); if (rpass == nullptr) { - missingSocketLink(converter, output); + missing_socket_link(converter, output); continue; } RenderLayersProg *operation; bool is_preview; if (STREQ(rpass->name, RE_PASSNAME_COMBINED) && - STREQ(output->getbNodeSocket()->name, "Alpha")) { + STREQ(output->get_bnode_socket()->name, "Alpha")) { operation = new RenderLayersAlphaProg(rpass->name, DataType::Value, rpass->channels); is_preview = false; } @@ -108,33 +108,33 @@ void RenderLayersNode::testRenderLink(NodeConverter &converter, break; } operation = new RenderLayersProg(rpass->name, type, rpass->channels); - is_preview = STREQ(output->getbNodeSocket()->name, "Image"); + is_preview = STREQ(output->get_bnode_socket()->name, "Image"); } - testSocketLink(converter, context, output, operation, scene, layerId, is_preview); + test_socket_link(converter, context, output, operation, scene, layer_id, is_preview); } } -void RenderLayersNode::missingSocketLink(NodeConverter &converter, NodeOutput *output) const +void RenderLayersNode::missing_socket_link(NodeConverter &converter, NodeOutput *output) const { NodeOperation *operation; - switch (output->getDataType()) { + switch (output->get_data_type()) { case DataType::Color: { const float color[4] = {0.0f, 0.0f, 0.0f, 0.0f}; SetColorOperation *color_operation = new SetColorOperation(); - color_operation->setChannels(color); + color_operation->set_channels(color); operation = color_operation; break; } case DataType::Vector: { const float vector[3] = {0.0f, 0.0f, 0.0f}; SetVectorOperation *vector_operation = new SetVectorOperation(); - vector_operation->setVector(vector); + vector_operation->set_vector(vector); operation = vector_operation; break; } case DataType::Value: { SetValueOperation *value_operation = new SetValueOperation(); - value_operation->setValue(0.0f); + value_operation->set_value(0.0f); operation = value_operation; break; } @@ -144,29 +144,29 @@ void RenderLayersNode::missingSocketLink(NodeConverter &converter, NodeOutput *o } } - converter.mapOutputSocket(output, operation->getOutputSocket()); - converter.addOperation(operation); + converter.map_output_socket(output, operation->get_output_socket()); + converter.add_operation(operation); } -void RenderLayersNode::missingRenderLink(NodeConverter &converter) const +void RenderLayersNode::missing_render_link(NodeConverter &converter) const { for (NodeOutput *output : outputs) { - missingSocketLink(converter, output); + missing_socket_link(converter, output); } } -void RenderLayersNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void RenderLayersNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - Scene *scene = (Scene *)this->getbNode()->id; + Scene *scene = (Scene *)this->get_bnode()->id; Render *re = (scene) ? RE_GetSceneRender(scene) : nullptr; if (re != nullptr) { - testRenderLink(converter, context, re); + test_render_link(converter, context, re); RE_ReleaseResult(re); } else { - missingRenderLink(converter); + missing_render_link(converter); } } diff --git a/source/blender/compositor/nodes/COM_RenderLayersNode.h b/source/blender/compositor/nodes/COM_RenderLayersNode.h index 4eb2427c8e0..33e61c58336 100644 --- a/source/blender/compositor/nodes/COM_RenderLayersNode.h +++ b/source/blender/compositor/nodes/COM_RenderLayersNode.h @@ -31,24 +31,24 @@ namespace blender::compositor { */ class RenderLayersNode : public Node { public: - RenderLayersNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + RenderLayersNode(bNode *editor_node); + void convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const override; private: - void testSocketLink(NodeConverter &converter, - const CompositorContext &context, - NodeOutput *output, - RenderLayersProg *operation, - Scene *scene, - int layerId, - bool is_preview) const; - void testRenderLink(NodeConverter &converter, - const CompositorContext &context, - Render *re) const; + void test_socket_link(NodeConverter &converter, + const CompositorContext &context, + NodeOutput *output, + RenderLayersProg *operation, + Scene *scene, + int layer_id, + bool is_preview) const; + void test_render_link(NodeConverter &converter, + const CompositorContext &context, + Render *re) const; - void missingSocketLink(NodeConverter &converter, NodeOutput *output) const; - void missingRenderLink(NodeConverter &converter) const; + void missing_socket_link(NodeConverter &converter, NodeOutput *output) const; + void missing_render_link(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 76c11a79d2f..64f49893335 100644 --- a/source/blender/compositor/nodes/COM_RotateNode.cc +++ b/source/blender/compositor/nodes/COM_RotateNode.cc @@ -23,39 +23,39 @@ namespace blender::compositor { -RotateNode::RotateNode(bNode *editorNode) : Node(editorNode) +RotateNode::RotateNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void RotateNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void RotateNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - NodeInput *inputSocket = this->getInputSocket(0); - NodeInput *inputDegreeSocket = this->getInputSocket(1); - NodeOutput *outputSocket = this->getOutputSocket(0); + NodeInput *input_socket = this->get_input_socket(0); + NodeInput *input_degree_socket = this->get_input_socket(1); + NodeOutput *output_socket = this->get_output_socket(0); RotateOperation *operation = new RotateOperation(); - converter.addOperation(operation); + converter.add_operation(operation); - PixelSampler sampler = (PixelSampler)this->getbNode()->custom1; + PixelSampler sampler = (PixelSampler)this->get_bnode()->custom1; switch (context.get_execution_model()) { case eExecutionModel::Tiled: { SetSamplerOperation *sampler_op = new SetSamplerOperation(); - sampler_op->setSampler(sampler); - converter.addOperation(sampler_op); - converter.addLink(sampler_op->getOutputSocket(), operation->getInputSocket(0)); - converter.mapInputSocket(inputSocket, sampler_op->getInputSocket(0)); + sampler_op->set_sampler(sampler); + converter.add_operation(sampler_op); + converter.add_link(sampler_op->get_output_socket(), operation->get_input_socket(0)); + converter.map_input_socket(input_socket, sampler_op->get_input_socket(0)); break; } case eExecutionModel::FullFrame: { operation->set_sampler(sampler); - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); + converter.map_input_socket(input_socket, operation->get_input_socket(0)); break; } } - converter.mapInputSocket(inputDegreeSocket, operation->getInputSocket(1)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + converter.map_input_socket(input_degree_socket, operation->get_input_socket(1)); + converter.map_output_socket(output_socket, operation->get_output_socket(0)); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_RotateNode.h b/source/blender/compositor/nodes/COM_RotateNode.h index 5d8bcb2e3e4..fa50cd1f689 100644 --- a/source/blender/compositor/nodes/COM_RotateNode.h +++ b/source/blender/compositor/nodes/COM_RotateNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class RotateNode : public Node { public: - RotateNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + RotateNode(bNode *editor_node); + void convert_to_operations(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 1e33a8688a9..56f1d998db8 100644 --- a/source/blender/compositor/nodes/COM_ScaleNode.cc +++ b/source/blender/compositor/nodes/COM_ScaleNode.cc @@ -24,70 +24,72 @@ namespace blender::compositor { -ScaleNode::ScaleNode(bNode *editorNode) : Node(editorNode) +ScaleNode::ScaleNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void ScaleNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void ScaleNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *bnode = this->getbNode(); + bNode *bnode = this->get_bnode(); - NodeInput *inputSocket = this->getInputSocket(0); - NodeInput *inputXSocket = this->getInputSocket(1); - NodeInput *inputYSocket = this->getInputSocket(2); - NodeOutput *outputSocket = this->getOutputSocket(0); + NodeInput *input_socket = this->get_input_socket(0); + NodeInput *input_xsocket = this->get_input_socket(1); + NodeInput *input_ysocket = this->get_input_socket(2); + NodeOutput *output_socket = this->get_output_socket(0); switch (bnode->custom1) { case CMP_SCALE_RELATIVE: { ScaleRelativeOperation *operation = new ScaleRelativeOperation(); - converter.addOperation(operation); + converter.add_operation(operation); - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.mapInputSocket(inputXSocket, operation->getInputSocket(1)); - converter.mapInputSocket(inputYSocket, operation->getInputSocket(2)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + converter.map_input_socket(input_socket, operation->get_input_socket(0)); + converter.map_input_socket(input_xsocket, operation->get_input_socket(1)); + converter.map_input_socket(input_ysocket, operation->get_input_socket(2)); + converter.map_output_socket(output_socket, operation->get_output_socket(0)); - operation->setVariableSize(inputXSocket->isLinked() || inputYSocket->isLinked()); + operation->set_variable_size(input_xsocket->is_linked() || input_ysocket->is_linked()); operation->set_scale_canvas_max_size(context.get_render_size() * 1.5f); break; } case CMP_SCALE_SCENEPERCENT: { - SetValueOperation *scaleFactorOperation = new SetValueOperation(); - scaleFactorOperation->setValue(context.getRenderPercentageAsFactor()); - converter.addOperation(scaleFactorOperation); + SetValueOperation *scale_factor_operation = new SetValueOperation(); + scale_factor_operation->set_value(context.get_render_percentage_as_factor()); + converter.add_operation(scale_factor_operation); ScaleRelativeOperation *operation = new ScaleRelativeOperation(); - converter.addOperation(operation); + converter.add_operation(operation); - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.addLink(scaleFactorOperation->getOutputSocket(), operation->getInputSocket(1)); - converter.addLink(scaleFactorOperation->getOutputSocket(), operation->getInputSocket(2)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + converter.map_input_socket(input_socket, operation->get_input_socket(0)); + converter.add_link(scale_factor_operation->get_output_socket(), + operation->get_input_socket(1)); + converter.add_link(scale_factor_operation->get_output_socket(), + operation->get_input_socket(2)); + converter.map_output_socket(output_socket, operation->get_output_socket(0)); - operation->setVariableSize(inputXSocket->isLinked() || inputYSocket->isLinked()); + operation->set_variable_size(input_xsocket->is_linked() || input_ysocket->is_linked()); operation->set_scale_canvas_max_size(context.get_render_size() * 1.5f); break; } case CMP_SCALE_RENDERPERCENT: { - const RenderData *rd = context.getRenderData(); - const float render_size_factor = context.getRenderPercentageAsFactor(); + const RenderData *rd = context.get_render_data(); + const float render_size_factor = context.get_render_percentage_as_factor(); ScaleFixedSizeOperation *operation = new ScaleFixedSizeOperation(); /* framing options */ - operation->setIsAspect((bnode->custom2 & CMP_SCALE_RENDERSIZE_FRAME_ASPECT) != 0); - operation->setIsCrop((bnode->custom2 & CMP_SCALE_RENDERSIZE_FRAME_CROP) != 0); - operation->setOffset(bnode->custom3, bnode->custom4); - operation->setNewWidth(rd->xsch * render_size_factor); - operation->setNewHeight(rd->ysch * render_size_factor); - converter.addOperation(operation); + operation->set_is_aspect((bnode->custom2 & CMP_SCALE_RENDERSIZE_FRAME_ASPECT) != 0); + operation->set_is_crop((bnode->custom2 & CMP_SCALE_RENDERSIZE_FRAME_CROP) != 0); + operation->set_offset(bnode->custom3, bnode->custom4); + operation->set_new_width(rd->xsch * render_size_factor); + operation->set_new_height(rd->ysch * render_size_factor); + converter.add_operation(operation); - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + converter.map_input_socket(input_socket, operation->get_input_socket(0)); + converter.map_output_socket(output_socket, operation->get_output_socket(0)); - operation->setVariableSize(inputXSocket->isLinked() || inputYSocket->isLinked()); + operation->set_variable_size(input_xsocket->is_linked() || input_ysocket->is_linked()); operation->set_scale_canvas_max_size(context.get_render_size() * 3.0f); break; @@ -95,14 +97,14 @@ void ScaleNode::convertToOperations(NodeConverter &converter, case CMP_SCALE_ABSOLUTE: { /* TODO: what is the use of this one.... perhaps some issues when the ui was updated... */ ScaleAbsoluteOperation *operation = new ScaleAbsoluteOperation(); - converter.addOperation(operation); + converter.add_operation(operation); - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.mapInputSocket(inputXSocket, operation->getInputSocket(1)); - converter.mapInputSocket(inputYSocket, operation->getInputSocket(2)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + converter.map_input_socket(input_socket, operation->get_input_socket(0)); + converter.map_input_socket(input_xsocket, operation->get_input_socket(1)); + converter.map_input_socket(input_ysocket, operation->get_input_socket(2)); + converter.map_output_socket(output_socket, operation->get_output_socket(0)); - operation->setVariableSize(inputXSocket->isLinked() || inputYSocket->isLinked()); + operation->set_variable_size(input_xsocket->is_linked() || input_ysocket->is_linked()); operation->set_scale_canvas_max_size(context.get_render_size() * 1.5f); break; diff --git a/source/blender/compositor/nodes/COM_ScaleNode.h b/source/blender/compositor/nodes/COM_ScaleNode.h index 186ffa8bdce..7800a7acb8b 100644 --- a/source/blender/compositor/nodes/COM_ScaleNode.h +++ b/source/blender/compositor/nodes/COM_ScaleNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class ScaleNode : public Node { public: - ScaleNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + ScaleNode(bNode *editor_node); + void convert_to_operations(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 fcaf52c701d..046a813895e 100644 --- a/source/blender/compositor/nodes/COM_SeparateColorNode.cc +++ b/source/blender/compositor/nodes/COM_SeparateColorNode.cc @@ -22,102 +22,102 @@ namespace blender::compositor { -SeparateColorNode::SeparateColorNode(bNode *editorNode) : Node(editorNode) +SeparateColorNode::SeparateColorNode(bNode *editor_node) : Node(editor_node) { } -void SeparateColorNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void SeparateColorNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - NodeInput *imageSocket = this->getInputSocket(0); - NodeOutput *outputRSocket = this->getOutputSocket(0); - NodeOutput *outputGSocket = this->getOutputSocket(1); - NodeOutput *outputBSocket = this->getOutputSocket(2); - NodeOutput *outputASocket = this->getOutputSocket(3); + NodeInput *image_socket = this->get_input_socket(0); + NodeOutput *output_rsocket = this->get_output_socket(0); + NodeOutput *output_gsocket = this->get_output_socket(1); + NodeOutput *output_bsocket = this->get_output_socket(2); + NodeOutput *output_asocket = this->get_output_socket(3); - NodeOperation *color_conv = getColorConverter(context); + NodeOperation *color_conv = get_color_converter(context); if (color_conv) { - converter.addOperation(color_conv); + converter.add_operation(color_conv); - converter.mapInputSocket(imageSocket, color_conv->getInputSocket(0)); + converter.map_input_socket(image_socket, color_conv->get_input_socket(0)); } { SeparateChannelOperation *operation = new SeparateChannelOperation(); - operation->setChannel(0); - converter.addOperation(operation); + operation->set_channel(0); + converter.add_operation(operation); if (color_conv) { - converter.addLink(color_conv->getOutputSocket(), operation->getInputSocket(0)); + converter.add_link(color_conv->get_output_socket(), operation->get_input_socket(0)); } else { - converter.mapInputSocket(imageSocket, operation->getInputSocket(0)); + converter.map_input_socket(image_socket, operation->get_input_socket(0)); } - converter.mapOutputSocket(outputRSocket, operation->getOutputSocket(0)); + converter.map_output_socket(output_rsocket, operation->get_output_socket(0)); } { SeparateChannelOperation *operation = new SeparateChannelOperation(); - operation->setChannel(1); - converter.addOperation(operation); + operation->set_channel(1); + converter.add_operation(operation); if (color_conv) { - converter.addLink(color_conv->getOutputSocket(), operation->getInputSocket(0)); + converter.add_link(color_conv->get_output_socket(), operation->get_input_socket(0)); } else { - converter.mapInputSocket(imageSocket, operation->getInputSocket(0)); + converter.map_input_socket(image_socket, operation->get_input_socket(0)); } - converter.mapOutputSocket(outputGSocket, operation->getOutputSocket(0)); + converter.map_output_socket(output_gsocket, operation->get_output_socket(0)); } { SeparateChannelOperation *operation = new SeparateChannelOperation(); - operation->setChannel(2); - converter.addOperation(operation); + operation->set_channel(2); + converter.add_operation(operation); if (color_conv) { - converter.addLink(color_conv->getOutputSocket(), operation->getInputSocket(0)); + converter.add_link(color_conv->get_output_socket(), operation->get_input_socket(0)); } else { - converter.mapInputSocket(imageSocket, operation->getInputSocket(0)); + converter.map_input_socket(image_socket, operation->get_input_socket(0)); } - converter.mapOutputSocket(outputBSocket, operation->getOutputSocket(0)); + converter.map_output_socket(output_bsocket, operation->get_output_socket(0)); } { SeparateChannelOperation *operation = new SeparateChannelOperation(); - operation->setChannel(3); - converter.addOperation(operation); + operation->set_channel(3); + converter.add_operation(operation); if (color_conv) { - converter.addLink(color_conv->getOutputSocket(), operation->getInputSocket(0)); + converter.add_link(color_conv->get_output_socket(), operation->get_input_socket(0)); } else { - converter.mapInputSocket(imageSocket, operation->getInputSocket(0)); + converter.map_input_socket(image_socket, operation->get_input_socket(0)); } - converter.mapOutputSocket(outputASocket, operation->getOutputSocket(0)); + converter.map_output_socket(output_asocket, operation->get_output_socket(0)); } } -NodeOperation *SeparateRGBANode::getColorConverter(const CompositorContext & /*context*/) const +NodeOperation *SeparateRGBANode::get_color_converter(const CompositorContext & /*context*/) const { return nullptr; /* no conversion needed */ } -NodeOperation *SeparateHSVANode::getColorConverter(const CompositorContext & /*context*/) const +NodeOperation *SeparateHSVANode::get_color_converter(const CompositorContext & /*context*/) const { return new ConvertRGBToHSVOperation(); } -NodeOperation *SeparateYCCANode::getColorConverter(const CompositorContext & /*context*/) const +NodeOperation *SeparateYCCANode::get_color_converter(const CompositorContext & /*context*/) const { ConvertRGBToYCCOperation *operation = new ConvertRGBToYCCOperation(); - bNode *editorNode = this->getbNode(); - operation->setMode(editorNode->custom1); + bNode *editor_node = this->get_bnode(); + operation->set_mode(editor_node->custom1); return operation; } -NodeOperation *SeparateYUVANode::getColorConverter(const CompositorContext & /*context*/) const +NodeOperation *SeparateYUVANode::get_color_converter(const CompositorContext & /*context*/) const { return new ConvertRGBToYUVOperation(); } diff --git a/source/blender/compositor/nodes/COM_SeparateColorNode.h b/source/blender/compositor/nodes/COM_SeparateColorNode.h index eaf543df51f..0dfcd676772 100644 --- a/source/blender/compositor/nodes/COM_SeparateColorNode.h +++ b/source/blender/compositor/nodes/COM_SeparateColorNode.h @@ -24,48 +24,48 @@ namespace blender::compositor { class SeparateColorNode : public Node { public: - SeparateColorNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + SeparateColorNode(bNode *editor_node); + void convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const override; protected: - virtual NodeOperation *getColorConverter(const CompositorContext &context) const = 0; + virtual NodeOperation *get_color_converter(const CompositorContext &context) const = 0; }; class SeparateRGBANode : public SeparateColorNode { public: - SeparateRGBANode(bNode *editorNode) : SeparateColorNode(editorNode) + SeparateRGBANode(bNode *editor_node) : SeparateColorNode(editor_node) { } - NodeOperation *getColorConverter(const CompositorContext &context) const override; + NodeOperation *get_color_converter(const CompositorContext &context) const override; }; class SeparateHSVANode : public SeparateColorNode { public: - SeparateHSVANode(bNode *editorNode) : SeparateColorNode(editorNode) + SeparateHSVANode(bNode *editor_node) : SeparateColorNode(editor_node) { } - NodeOperation *getColorConverter(const CompositorContext &context) const override; + NodeOperation *get_color_converter(const CompositorContext &context) const override; }; class SeparateYCCANode : public SeparateColorNode { public: - SeparateYCCANode(bNode *editorNode) : SeparateColorNode(editorNode) + SeparateYCCANode(bNode *editor_node) : SeparateColorNode(editor_node) { } - NodeOperation *getColorConverter(const CompositorContext &context) const override; + NodeOperation *get_color_converter(const CompositorContext &context) const override; }; class SeparateYUVANode : public SeparateColorNode { public: - SeparateYUVANode(bNode *editorNode) : SeparateColorNode(editorNode) + SeparateYUVANode(bNode *editor_node) : SeparateColorNode(editor_node) { } - NodeOperation *getColorConverter(const CompositorContext &context) const override; + NodeOperation *get_color_converter(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 a3a8472ccc9..58b8df98bc8 100644 --- a/source/blender/compositor/nodes/COM_SetAlphaNode.cc +++ b/source/blender/compositor/nodes/COM_SetAlphaNode.cc @@ -22,11 +22,11 @@ namespace blender::compositor { -void SetAlphaNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void SetAlphaNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - const bNode *editorNode = this->getbNode(); - const NodeSetAlpha *storage = static_cast<const NodeSetAlpha *>(editorNode->storage); + const bNode *editor_node = this->get_bnode(); + const NodeSetAlpha *storage = static_cast<const NodeSetAlpha *>(editor_node->storage); NodeOperation *operation = nullptr; switch (storage->mode) { case CMP_NODE_SETALPHA_MODE_APPLY: @@ -37,15 +37,15 @@ void SetAlphaNode::convertToOperations(NodeConverter &converter, break; } - if (!this->getInputSocket(0)->isLinked() && this->getInputSocket(1)->isLinked()) { + if (!this->get_input_socket(0)->is_linked() && this->get_input_socket(1)->is_linked()) { operation->set_canvas_input_index(1); } - converter.addOperation(operation); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket()); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_SetAlphaNode.h b/source/blender/compositor/nodes/COM_SetAlphaNode.h index c8d340eb64b..9e369838bbe 100644 --- a/source/blender/compositor/nodes/COM_SetAlphaNode.h +++ b/source/blender/compositor/nodes/COM_SetAlphaNode.h @@ -28,11 +28,11 @@ namespace blender::compositor { */ class SetAlphaNode : public Node { public: - SetAlphaNode(bNode *editorNode) : Node(editorNode) + SetAlphaNode(bNode *editor_node) : Node(editor_node) { } - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + void convert_to_operations(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 1109dbaf735..e7c8a90a48b 100644 --- a/source/blender/compositor/nodes/COM_SocketProxyNode.cc +++ b/source/blender/compositor/nodes/COM_SocketProxyNode.cc @@ -22,81 +22,82 @@ namespace blender::compositor { -SocketProxyNode::SocketProxyNode(bNode *editorNode, - bNodeSocket *editorInput, - bNodeSocket *editorOutput, +SocketProxyNode::SocketProxyNode(bNode *editor_node, + bNodeSocket *editor_input, + bNodeSocket *editor_output, bool use_conversion) - : Node(editorNode, false), use_conversion_(use_conversion) + : Node(editor_node, false), use_conversion_(use_conversion) { DataType dt; dt = DataType::Value; - if (editorInput->type == SOCK_RGBA) { + if (editor_input->type == SOCK_RGBA) { dt = DataType::Color; } - if (editorInput->type == SOCK_VECTOR) { + if (editor_input->type == SOCK_VECTOR) { dt = DataType::Vector; } - this->addInputSocket(dt, editorInput); + this->add_input_socket(dt, editor_input); dt = DataType::Value; - if (editorOutput->type == SOCK_RGBA) { + if (editor_output->type == SOCK_RGBA) { dt = DataType::Color; } - if (editorOutput->type == SOCK_VECTOR) { + if (editor_output->type == SOCK_VECTOR) { dt = DataType::Vector; } - this->addOutputSocket(dt, editorOutput); + this->add_output_socket(dt, editor_output); } -void SocketProxyNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void SocketProxyNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeOperationOutput *proxy_output = converter.addInputProxy(getInputSocket(0), use_conversion_); - converter.mapOutputSocket(getOutputSocket(), proxy_output); + NodeOperationOutput *proxy_output = converter.add_input_proxy(get_input_socket(0), + use_conversion_); + converter.map_output_socket(get_output_socket(), proxy_output); } -SocketBufferNode::SocketBufferNode(bNode *editorNode, - bNodeSocket *editorInput, - bNodeSocket *editorOutput) - : Node(editorNode, false) +SocketBufferNode::SocketBufferNode(bNode *editor_node, + bNodeSocket *editor_input, + bNodeSocket *editor_output) + : Node(editor_node, false) { DataType dt; dt = DataType::Value; - if (editorInput->type == SOCK_RGBA) { + if (editor_input->type == SOCK_RGBA) { dt = DataType::Color; } - if (editorInput->type == SOCK_VECTOR) { + if (editor_input->type == SOCK_VECTOR) { dt = DataType::Vector; } - this->addInputSocket(dt, editorInput); + this->add_input_socket(dt, editor_input); dt = DataType::Value; - if (editorOutput->type == SOCK_RGBA) { + if (editor_output->type == SOCK_RGBA) { dt = DataType::Color; } - if (editorOutput->type == SOCK_VECTOR) { + if (editor_output->type == SOCK_VECTOR) { dt = DataType::Vector; } - this->addOutputSocket(dt, editorOutput); + this->add_output_socket(dt, editor_output); } -void SocketBufferNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void SocketBufferNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeOutput *output = this->getOutputSocket(0); - NodeInput *input = this->getInputSocket(0); + NodeOutput *output = this->get_output_socket(0); + NodeInput *input = this->get_input_socket(0); - DataType datatype = output->getDataType(); - WriteBufferOperation *writeOperation = new WriteBufferOperation(datatype); - ReadBufferOperation *readOperation = new ReadBufferOperation(datatype); - readOperation->setMemoryProxy(writeOperation->getMemoryProxy()); - converter.addOperation(writeOperation); - converter.addOperation(readOperation); + DataType datatype = output->get_data_type(); + WriteBufferOperation *write_operation = new WriteBufferOperation(datatype); + ReadBufferOperation *read_operation = new ReadBufferOperation(datatype); + read_operation->set_memory_proxy(write_operation->get_memory_proxy()); + converter.add_operation(write_operation); + converter.add_operation(read_operation); - converter.mapInputSocket(input, writeOperation->getInputSocket(0)); - converter.mapOutputSocket(output, readOperation->getOutputSocket()); + converter.map_input_socket(input, write_operation->get_input_socket(0)); + converter.map_output_socket(output, read_operation->get_output_socket()); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_SocketProxyNode.h b/source/blender/compositor/nodes/COM_SocketProxyNode.h index 2b584b344f0..50079ed4718 100644 --- a/source/blender/compositor/nodes/COM_SocketProxyNode.h +++ b/source/blender/compositor/nodes/COM_SocketProxyNode.h @@ -28,18 +28,18 @@ namespace blender::compositor { */ class SocketProxyNode : public Node { public: - SocketProxyNode(bNode *editorNode, - bNodeSocket *editorInput, - bNodeSocket *editorOutput, + SocketProxyNode(bNode *editor_node, + bNodeSocket *editor_input, + bNodeSocket *editor_output, bool use_conversion); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + void convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const override; - bool getUseConversion() const + bool get_use_conversion() const { return use_conversion_; } - void setUseConversion(bool use_conversion) + void set_use_conversion(bool use_conversion) { use_conversion_ = use_conversion; } @@ -51,9 +51,9 @@ class SocketProxyNode : public Node { class SocketBufferNode : public Node { public: - SocketBufferNode(bNode *editorNode, bNodeSocket *editorInput, bNodeSocket *editorOutput); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + SocketBufferNode(bNode *editor_node, bNodeSocket *editor_input, bNodeSocket *editor_output); + void convert_to_operations(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 bdc927c59a5..c3234fad0fb 100644 --- a/source/blender/compositor/nodes/COM_SplitViewerNode.cc +++ b/source/blender/compositor/nodes/COM_SplitViewerNode.cc @@ -23,52 +23,53 @@ namespace blender::compositor { -SplitViewerNode::SplitViewerNode(bNode *editorNode) : Node(editorNode) +SplitViewerNode::SplitViewerNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void SplitViewerNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void SplitViewerNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *editorNode = this->getbNode(); - bool do_output = (editorNode->flag & NODE_DO_OUTPUT_RECALC || context.isRendering()) && - (editorNode->flag & NODE_DO_OUTPUT); + bNode *editor_node = this->get_bnode(); + bool do_output = (editor_node->flag & NODE_DO_OUTPUT_RECALC || context.is_rendering()) && + (editor_node->flag & NODE_DO_OUTPUT); - NodeInput *image1Socket = this->getInputSocket(0); - NodeInput *image2Socket = this->getInputSocket(1); - Image *image = (Image *)this->getbNode()->id; - ImageUser *imageUser = (ImageUser *)this->getbNode()->storage; + NodeInput *image1Socket = this->get_input_socket(0); + NodeInput *image2Socket = this->get_input_socket(1); + Image *image = (Image *)this->get_bnode()->id; + ImageUser *image_user = (ImageUser *)this->get_bnode()->storage; - SplitOperation *splitViewerOperation = new SplitOperation(); - splitViewerOperation->setSplitPercentage(this->getbNode()->custom1); - splitViewerOperation->setXSplit(!this->getbNode()->custom2); + SplitOperation *split_viewer_operation = new SplitOperation(); + split_viewer_operation->set_split_percentage(this->get_bnode()->custom1); + split_viewer_operation->set_xsplit(!this->get_bnode()->custom2); - converter.addOperation(splitViewerOperation); - converter.mapInputSocket(image1Socket, splitViewerOperation->getInputSocket(0)); - converter.mapInputSocket(image2Socket, splitViewerOperation->getInputSocket(1)); + converter.add_operation(split_viewer_operation); + converter.map_input_socket(image1Socket, split_viewer_operation->get_input_socket(0)); + converter.map_input_socket(image2Socket, split_viewer_operation->get_input_socket(1)); - ViewerOperation *viewerOperation = new ViewerOperation(); - viewerOperation->setImage(image); - viewerOperation->setImageUser(imageUser); - viewerOperation->setViewSettings(context.getViewSettings()); - viewerOperation->setDisplaySettings(context.getDisplaySettings()); - viewerOperation->setRenderData(context.getRenderData()); - viewerOperation->setViewName(context.getViewName()); + ViewerOperation *viewer_operation = new ViewerOperation(); + viewer_operation->set_image(image); + viewer_operation->set_image_user(image_user); + viewer_operation->set_view_settings(context.get_view_settings()); + viewer_operation->set_display_settings(context.get_display_settings()); + viewer_operation->set_render_data(context.get_render_data()); + viewer_operation->set_view_name(context.get_view_name()); /* defaults - the viewer node has these options but not exposed for split view * we could use the split to define an area of interest on one axis at least */ - viewerOperation->setChunkOrder(ChunkOrdering::Default); - viewerOperation->setCenterX(0.5f); - viewerOperation->setCenterY(0.5f); + viewer_operation->set_chunk_order(ChunkOrdering::Default); + viewer_operation->setCenterX(0.5f); + viewer_operation->setCenterY(0.5f); - converter.addOperation(viewerOperation); - converter.addLink(splitViewerOperation->getOutputSocket(), viewerOperation->getInputSocket(0)); + converter.add_operation(viewer_operation); + converter.add_link(split_viewer_operation->get_output_socket(), + viewer_operation->get_input_socket(0)); - converter.addPreview(splitViewerOperation->getOutputSocket()); + converter.add_preview(split_viewer_operation->get_output_socket()); if (do_output) { - converter.registerViewer(viewerOperation); + converter.register_viewer(viewer_operation); } } diff --git a/source/blender/compositor/nodes/COM_SplitViewerNode.h b/source/blender/compositor/nodes/COM_SplitViewerNode.h index 8a42775eb0d..579eca9d8e1 100644 --- a/source/blender/compositor/nodes/COM_SplitViewerNode.h +++ b/source/blender/compositor/nodes/COM_SplitViewerNode.h @@ -29,9 +29,9 @@ namespace blender::compositor { */ class SplitViewerNode : public Node { public: - SplitViewerNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + SplitViewerNode(bNode *editor_node); + void convert_to_operations(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 48eeb337842..9892c4f5c05 100644 --- a/source/blender/compositor/nodes/COM_Stabilize2dNode.cc +++ b/source/blender/compositor/nodes/COM_Stabilize2dNode.cc @@ -25,145 +25,160 @@ namespace blender::compositor { -Stabilize2dNode::Stabilize2dNode(bNode *editorNode) : Node(editorNode) +Stabilize2dNode::Stabilize2dNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void Stabilize2dNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void Stabilize2dNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *editorNode = this->getbNode(); - NodeInput *imageInput = this->getInputSocket(0); - MovieClip *clip = (MovieClip *)editorNode->id; - bool invert = (editorNode->custom2 & CMP_NODEFLAG_STABILIZE_INVERSE) != 0; - const PixelSampler sampler = (PixelSampler)editorNode->custom1; - - MovieClipAttributeOperation *scaleAttribute = new MovieClipAttributeOperation(); - MovieClipAttributeOperation *angleAttribute = new MovieClipAttributeOperation(); - MovieClipAttributeOperation *xAttribute = new MovieClipAttributeOperation(); - MovieClipAttributeOperation *yAttribute = new MovieClipAttributeOperation(); - - scaleAttribute->setAttribute(MCA_SCALE); - scaleAttribute->setFramenumber(context.getFramenumber()); - scaleAttribute->setMovieClip(clip); - scaleAttribute->setInvert(invert); - - angleAttribute->setAttribute(MCA_ANGLE); - angleAttribute->setFramenumber(context.getFramenumber()); - angleAttribute->setMovieClip(clip); - angleAttribute->setInvert(invert); - - xAttribute->setAttribute(MCA_X); - xAttribute->setFramenumber(context.getFramenumber()); - xAttribute->setMovieClip(clip); - xAttribute->setInvert(invert); - - yAttribute->setAttribute(MCA_Y); - yAttribute->setFramenumber(context.getFramenumber()); - yAttribute->setMovieClip(clip); - yAttribute->setInvert(invert); - - converter.addOperation(scaleAttribute); - converter.addOperation(angleAttribute); - converter.addOperation(xAttribute); - converter.addOperation(yAttribute); + bNode *editor_node = this->get_bnode(); + NodeInput *image_input = this->get_input_socket(0); + MovieClip *clip = (MovieClip *)editor_node->id; + bool invert = (editor_node->custom2 & CMP_NODEFLAG_STABILIZE_INVERSE) != 0; + const PixelSampler sampler = (PixelSampler)editor_node->custom1; + + MovieClipAttributeOperation *scale_attribute = new MovieClipAttributeOperation(); + MovieClipAttributeOperation *angle_attribute = new MovieClipAttributeOperation(); + MovieClipAttributeOperation *x_attribute = new MovieClipAttributeOperation(); + MovieClipAttributeOperation *y_attribute = new MovieClipAttributeOperation(); + + scale_attribute->set_attribute(MCA_SCALE); + scale_attribute->set_framenumber(context.get_framenumber()); + scale_attribute->set_movie_clip(clip); + scale_attribute->set_invert(invert); + + angle_attribute->set_attribute(MCA_ANGLE); + angle_attribute->set_framenumber(context.get_framenumber()); + angle_attribute->set_movie_clip(clip); + angle_attribute->set_invert(invert); + + x_attribute->set_attribute(MCA_X); + x_attribute->set_framenumber(context.get_framenumber()); + x_attribute->set_movie_clip(clip); + x_attribute->set_invert(invert); + + y_attribute->set_attribute(MCA_Y); + y_attribute->set_framenumber(context.get_framenumber()); + y_attribute->set_movie_clip(clip); + y_attribute->set_invert(invert); + + converter.add_operation(scale_attribute); + converter.add_operation(angle_attribute); + converter.add_operation(x_attribute); + converter.add_operation(y_attribute); switch (context.get_execution_model()) { case eExecutionModel::Tiled: { - ScaleRelativeOperation *scaleOperation = new ScaleRelativeOperation(); - scaleOperation->setSampler(sampler); - RotateOperation *rotateOperation = new RotateOperation(); - rotateOperation->setDoDegree2RadConversion(false); - TranslateOperation *translateOperation = new TranslateOperation(); + ScaleRelativeOperation *scale_operation = new ScaleRelativeOperation(); + scale_operation->set_sampler(sampler); + RotateOperation *rotate_operation = new RotateOperation(); + rotate_operation->set_do_degree2_rad_conversion(false); + TranslateOperation *translate_operation = new TranslateOperation(); SetSamplerOperation *psoperation = new SetSamplerOperation(); - psoperation->setSampler(sampler); + psoperation->set_sampler(sampler); - converter.addOperation(scaleOperation); - converter.addOperation(translateOperation); - converter.addOperation(rotateOperation); - converter.addOperation(psoperation); + converter.add_operation(scale_operation); + converter.add_operation(translate_operation); + converter.add_operation(rotate_operation); + converter.add_operation(psoperation); - converter.addLink(scaleAttribute->getOutputSocket(), scaleOperation->getInputSocket(1)); - converter.addLink(scaleAttribute->getOutputSocket(), scaleOperation->getInputSocket(2)); + converter.add_link(scale_attribute->get_output_socket(), + scale_operation->get_input_socket(1)); + converter.add_link(scale_attribute->get_output_socket(), + scale_operation->get_input_socket(2)); - converter.addLink(angleAttribute->getOutputSocket(), rotateOperation->getInputSocket(1)); + converter.add_link(angle_attribute->get_output_socket(), + rotate_operation->get_input_socket(1)); - converter.addLink(xAttribute->getOutputSocket(), translateOperation->getInputSocket(1)); - converter.addLink(yAttribute->getOutputSocket(), translateOperation->getInputSocket(2)); + converter.add_link(x_attribute->get_output_socket(), + translate_operation->get_input_socket(1)); + converter.add_link(y_attribute->get_output_socket(), + translate_operation->get_input_socket(2)); - converter.mapOutputSocket(getOutputSocket(), psoperation->getOutputSocket()); + converter.map_output_socket(get_output_socket(), psoperation->get_output_socket()); if (invert) { /* Translate -> Rotate -> Scale. */ - converter.mapInputSocket(imageInput, translateOperation->getInputSocket(0)); + converter.map_input_socket(image_input, translate_operation->get_input_socket(0)); - converter.addLink(translateOperation->getOutputSocket(), - rotateOperation->getInputSocket(0)); - converter.addLink(rotateOperation->getOutputSocket(), scaleOperation->getInputSocket(0)); + converter.add_link(translate_operation->get_output_socket(), + rotate_operation->get_input_socket(0)); + converter.add_link(rotate_operation->get_output_socket(), + scale_operation->get_input_socket(0)); - converter.addLink(scaleOperation->getOutputSocket(), psoperation->getInputSocket(0)); + converter.add_link(scale_operation->get_output_socket(), psoperation->get_input_socket(0)); } else { /* Scale -> Rotate -> Translate. */ - converter.mapInputSocket(imageInput, scaleOperation->getInputSocket(0)); + converter.map_input_socket(image_input, scale_operation->get_input_socket(0)); - converter.addLink(scaleOperation->getOutputSocket(), rotateOperation->getInputSocket(0)); - converter.addLink(rotateOperation->getOutputSocket(), - translateOperation->getInputSocket(0)); + converter.add_link(scale_operation->get_output_socket(), + rotate_operation->get_input_socket(0)); + converter.add_link(rotate_operation->get_output_socket(), + translate_operation->get_input_socket(0)); - converter.addLink(translateOperation->getOutputSocket(), psoperation->getInputSocket(0)); + converter.add_link(translate_operation->get_output_socket(), + psoperation->get_input_socket(0)); } break; } case eExecutionModel::FullFrame: { - ScaleRelativeOperation *scaleOperation = new ScaleRelativeOperation(); - scaleOperation->setSampler(sampler); - RotateOperation *rotateOperation = new RotateOperation(); - rotateOperation->setDoDegree2RadConversion(false); - rotateOperation->set_sampler(sampler); - TranslateOperation *translateOperation = new TranslateCanvasOperation(); - - converter.addOperation(scaleOperation); - converter.addOperation(translateOperation); - converter.addOperation(rotateOperation); - - converter.addLink(scaleAttribute->getOutputSocket(), scaleOperation->getInputSocket(1)); - converter.addLink(scaleAttribute->getOutputSocket(), scaleOperation->getInputSocket(2)); - - converter.addLink(angleAttribute->getOutputSocket(), rotateOperation->getInputSocket(1)); - - converter.addLink(xAttribute->getOutputSocket(), translateOperation->getInputSocket(1)); - converter.addLink(yAttribute->getOutputSocket(), translateOperation->getInputSocket(2)); + ScaleRelativeOperation *scale_operation = new ScaleRelativeOperation(); + scale_operation->set_sampler(sampler); + RotateOperation *rotate_operation = new RotateOperation(); + rotate_operation->set_do_degree2_rad_conversion(false); + rotate_operation->set_sampler(sampler); + TranslateOperation *translate_operation = new TranslateCanvasOperation(); + + converter.add_operation(scale_operation); + converter.add_operation(translate_operation); + converter.add_operation(rotate_operation); + + converter.add_link(scale_attribute->get_output_socket(), + scale_operation->get_input_socket(1)); + converter.add_link(scale_attribute->get_output_socket(), + scale_operation->get_input_socket(2)); + + converter.add_link(angle_attribute->get_output_socket(), + rotate_operation->get_input_socket(1)); + + converter.add_link(x_attribute->get_output_socket(), + translate_operation->get_input_socket(1)); + converter.add_link(y_attribute->get_output_socket(), + translate_operation->get_input_socket(2)); NodeOperationInput *stabilization_socket = nullptr; if (invert) { /* Translate -> Rotate -> Scale. */ - stabilization_socket = translateOperation->getInputSocket(0); - converter.mapInputSocket(imageInput, translateOperation->getInputSocket(0)); + stabilization_socket = translate_operation->get_input_socket(0); + converter.map_input_socket(image_input, translate_operation->get_input_socket(0)); - converter.addLink(translateOperation->getOutputSocket(), - rotateOperation->getInputSocket(0)); - converter.addLink(rotateOperation->getOutputSocket(), scaleOperation->getInputSocket(0)); + converter.add_link(translate_operation->get_output_socket(), + rotate_operation->get_input_socket(0)); + converter.add_link(rotate_operation->get_output_socket(), + scale_operation->get_input_socket(0)); - converter.mapOutputSocket(getOutputSocket(), scaleOperation->getOutputSocket()); + converter.map_output_socket(get_output_socket(), scale_operation->get_output_socket()); } else { /* Scale -> Rotate -> Translate. */ - stabilization_socket = scaleOperation->getInputSocket(0); - converter.mapInputSocket(imageInput, scaleOperation->getInputSocket(0)); + stabilization_socket = scale_operation->get_input_socket(0); + converter.map_input_socket(image_input, scale_operation->get_input_socket(0)); - converter.addLink(scaleOperation->getOutputSocket(), rotateOperation->getInputSocket(0)); - converter.addLink(rotateOperation->getOutputSocket(), - translateOperation->getInputSocket(0)); + converter.add_link(scale_operation->get_output_socket(), + rotate_operation->get_input_socket(0)); + converter.add_link(rotate_operation->get_output_socket(), + translate_operation->get_input_socket(0)); - converter.mapOutputSocket(getOutputSocket(), translateOperation->getOutputSocket()); + converter.map_output_socket(get_output_socket(), translate_operation->get_output_socket()); } - xAttribute->set_socket_input_resolution_for_stabilization(stabilization_socket); - yAttribute->set_socket_input_resolution_for_stabilization(stabilization_socket); - scaleAttribute->set_socket_input_resolution_for_stabilization(stabilization_socket); - angleAttribute->set_socket_input_resolution_for_stabilization(stabilization_socket); + x_attribute->set_socket_input_resolution_for_stabilization(stabilization_socket); + y_attribute->set_socket_input_resolution_for_stabilization(stabilization_socket); + scale_attribute->set_socket_input_resolution_for_stabilization(stabilization_socket); + angle_attribute->set_socket_input_resolution_for_stabilization(stabilization_socket); break; } } diff --git a/source/blender/compositor/nodes/COM_Stabilize2dNode.h b/source/blender/compositor/nodes/COM_Stabilize2dNode.h index 34ed8871e33..0c6afb272e9 100644 --- a/source/blender/compositor/nodes/COM_Stabilize2dNode.h +++ b/source/blender/compositor/nodes/COM_Stabilize2dNode.h @@ -29,9 +29,9 @@ namespace blender::compositor { */ class Stabilize2dNode : public Node { public: - Stabilize2dNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + Stabilize2dNode(bNode *editor_node); + void convert_to_operations(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 1e5aa0b8020..ba42b79f307 100644 --- a/source/blender/compositor/nodes/COM_SunBeamsNode.cc +++ b/source/blender/compositor/nodes/COM_SunBeamsNode.cc @@ -20,24 +20,24 @@ namespace blender::compositor { -SunBeamsNode::SunBeamsNode(bNode *editorNode) : Node(editorNode) +SunBeamsNode::SunBeamsNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void SunBeamsNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void SunBeamsNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *inputSocket = this->getInputSocket(0); - NodeOutput *outputSocket = this->getOutputSocket(0); - NodeSunBeams *data = (NodeSunBeams *)getbNode()->storage; + NodeInput *input_socket = this->get_input_socket(0); + NodeOutput *output_socket = this->get_output_socket(0); + NodeSunBeams *data = (NodeSunBeams *)get_bnode()->storage; SunBeamsOperation *operation = new SunBeamsOperation(); - operation->setData(*data); - converter.addOperation(operation); + operation->set_data(*data); + converter.add_operation(operation); - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + converter.map_input_socket(input_socket, operation->get_input_socket(0)); + converter.map_output_socket(output_socket, operation->get_output_socket(0)); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_SunBeamsNode.h b/source/blender/compositor/nodes/COM_SunBeamsNode.h index 8b68d3f4cb5..478b5ce39f8 100644 --- a/source/blender/compositor/nodes/COM_SunBeamsNode.h +++ b/source/blender/compositor/nodes/COM_SunBeamsNode.h @@ -27,9 +27,9 @@ namespace blender::compositor { */ class SunBeamsNode : public Node { public: - SunBeamsNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + SunBeamsNode(bNode *editor_node); + void convert_to_operations(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 4006d10dafb..d0bc0f6dea2 100644 --- a/source/blender/compositor/nodes/COM_SwitchNode.cc +++ b/source/blender/compositor/nodes/COM_SwitchNode.cc @@ -20,25 +20,25 @@ namespace blender::compositor { -SwitchNode::SwitchNode(bNode *editorNode) : Node(editorNode) +SwitchNode::SwitchNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void SwitchNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void SwitchNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - bool condition = this->getbNode()->custom1; + bool condition = this->get_bnode()->custom1; NodeOperationOutput *result; if (!condition) { - result = converter.addInputProxy(getInputSocket(0), false); + result = converter.add_input_proxy(get_input_socket(0), false); } else { - result = converter.addInputProxy(getInputSocket(1), false); + result = converter.add_input_proxy(get_input_socket(1), false); } - converter.mapOutputSocket(getOutputSocket(0), result); + converter.map_output_socket(get_output_socket(0), result); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_SwitchNode.h b/source/blender/compositor/nodes/COM_SwitchNode.h index aa6caa2e59f..eafdeb4ac74 100644 --- a/source/blender/compositor/nodes/COM_SwitchNode.h +++ b/source/blender/compositor/nodes/COM_SwitchNode.h @@ -30,9 +30,9 @@ namespace blender::compositor { */ class SwitchNode : public Node { public: - SwitchNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + SwitchNode(bNode *editor_node); + void convert_to_operations(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 5bf854bb0a0..735ccaf3513 100644 --- a/source/blender/compositor/nodes/COM_SwitchViewNode.cc +++ b/source/blender/compositor/nodes/COM_SwitchViewNode.cc @@ -20,24 +20,24 @@ namespace blender::compositor { -SwitchViewNode::SwitchViewNode(bNode *editorNode) : Node(editorNode) +SwitchViewNode::SwitchViewNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void SwitchViewNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void SwitchViewNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { NodeOperationOutput *result; - const char *viewName = context.getViewName(); - bNode *bnode = this->getbNode(); + const char *view_name = context.get_view_name(); + bNode *bnode = this->get_bnode(); /* get the internal index of the socket with a matching name */ - int nr = BLI_findstringindex(&bnode->inputs, viewName, offsetof(bNodeSocket, name)); + int nr = BLI_findstringindex(&bnode->inputs, view_name, offsetof(bNodeSocket, name)); nr = MAX2(nr, 0); - result = converter.addInputProxy(getInputSocket(nr), false); - converter.mapOutputSocket(getOutputSocket(0), result); + result = converter.add_input_proxy(get_input_socket(nr), false); + converter.map_output_socket(get_output_socket(0), result); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_SwitchViewNode.h b/source/blender/compositor/nodes/COM_SwitchViewNode.h index ce6de52182c..227c076f181 100644 --- a/source/blender/compositor/nodes/COM_SwitchViewNode.h +++ b/source/blender/compositor/nodes/COM_SwitchViewNode.h @@ -30,9 +30,9 @@ namespace blender::compositor { */ class SwitchViewNode : public Node { public: - SwitchViewNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + SwitchViewNode(bNode *editor_node); + void convert_to_operations(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 4063e4b4bce..ca57680781f 100644 --- a/source/blender/compositor/nodes/COM_TextureNode.cc +++ b/source/blender/compositor/nodes/COM_TextureNode.cc @@ -21,39 +21,39 @@ namespace blender::compositor { -TextureNode::TextureNode(bNode *editorNode) : Node(editorNode) +TextureNode::TextureNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void TextureNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void TextureNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *editorNode = this->getbNode(); - Tex *texture = (Tex *)editorNode->id; + bNode *editor_node = this->get_bnode(); + Tex *texture = (Tex *)editor_node->id; TextureOperation *operation = new TextureOperation(); - const ColorManagedDisplaySettings *displaySettings = context.getDisplaySettings(); - bool sceneColorManage = !STREQ(displaySettings->display_device, "None"); - operation->setTexture(texture); - operation->setRenderData(context.getRenderData()); - operation->setSceneColorManage(sceneColorManage); - converter.addOperation(operation); - - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(1), operation->getOutputSocket()); - - converter.addPreview(operation->getOutputSocket()); - - TextureAlphaOperation *alphaOperation = new TextureAlphaOperation(); - alphaOperation->setTexture(texture); - alphaOperation->setRenderData(context.getRenderData()); - alphaOperation->setSceneColorManage(sceneColorManage); - converter.addOperation(alphaOperation); - - converter.mapInputSocket(getInputSocket(0), alphaOperation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), alphaOperation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(0), alphaOperation->getOutputSocket()); + const ColorManagedDisplaySettings *display_settings = context.get_display_settings(); + bool scene_color_manage = !STREQ(display_settings->display_device, "None"); + operation->set_texture(texture); + operation->set_render_data(context.get_render_data()); + operation->set_scene_color_manage(scene_color_manage); + converter.add_operation(operation); + + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1)); + converter.map_output_socket(get_output_socket(1), operation->get_output_socket()); + + converter.add_preview(operation->get_output_socket()); + + TextureAlphaOperation *alpha_operation = new TextureAlphaOperation(); + alpha_operation->set_texture(texture); + alpha_operation->set_render_data(context.get_render_data()); + alpha_operation->set_scene_color_manage(scene_color_manage); + converter.add_operation(alpha_operation); + + converter.map_input_socket(get_input_socket(0), alpha_operation->get_input_socket(0)); + converter.map_input_socket(get_input_socket(1), alpha_operation->get_input_socket(1)); + converter.map_output_socket(get_output_socket(0), alpha_operation->get_output_socket()); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_TextureNode.h b/source/blender/compositor/nodes/COM_TextureNode.h index b886e3b74e1..bd477e6c6e6 100644 --- a/source/blender/compositor/nodes/COM_TextureNode.h +++ b/source/blender/compositor/nodes/COM_TextureNode.h @@ -29,9 +29,9 @@ namespace blender::compositor { */ class TextureNode : public Node { public: - TextureNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + TextureNode(bNode *editor_node); + void convert_to_operations(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 37236959366..0d1532f62f9 100644 --- a/source/blender/compositor/nodes/COM_TimeNode.cc +++ b/source/blender/compositor/nodes/COM_TimeNode.cc @@ -24,20 +24,20 @@ namespace blender::compositor { -TimeNode::TimeNode(bNode *editorNode) : Node(editorNode) +TimeNode::TimeNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void TimeNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void TimeNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { SetValueOperation *operation = new SetValueOperation(); - bNode *node = this->getbNode(); + bNode *node = this->get_bnode(); /* stack order output: fac */ float fac = 0.0f; - const int framenumber = context.getFramenumber(); + const int framenumber = context.get_framenumber(); if (framenumber < node->custom1) { fac = 0.0f; @@ -46,15 +46,15 @@ void TimeNode::convertToOperations(NodeConverter &converter, fac = 1.0f; } else if (node->custom1 < node->custom2) { - fac = (context.getFramenumber() - node->custom1) / (float)(node->custom2 - node->custom1); + fac = (context.get_framenumber() - node->custom1) / (float)(node->custom2 - node->custom1); } BKE_curvemapping_init((CurveMapping *)node->storage); fac = BKE_curvemapping_evaluateF((CurveMapping *)node->storage, 0, fac); - operation->setValue(clamp_f(fac, 0.0f, 1.0f)); - converter.addOperation(operation); + operation->set_value(clamp_f(fac, 0.0f, 1.0f)); + converter.add_operation(operation); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket()); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_TimeNode.h b/source/blender/compositor/nodes/COM_TimeNode.h index 5688e2cff03..5c5a0c98058 100644 --- a/source/blender/compositor/nodes/COM_TimeNode.h +++ b/source/blender/compositor/nodes/COM_TimeNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class TimeNode : public Node { public: - TimeNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + TimeNode(bNode *editor_node); + void convert_to_operations(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 a2b3e84b604..54ba84d46bd 100644 --- a/source/blender/compositor/nodes/COM_TonemapNode.cc +++ b/source/blender/compositor/nodes/COM_TonemapNode.cc @@ -21,23 +21,23 @@ namespace blender::compositor { -TonemapNode::TonemapNode(bNode *editorNode) : Node(editorNode) +TonemapNode::TonemapNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void TonemapNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void TonemapNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeTonemap *data = (NodeTonemap *)this->getbNode()->storage; + NodeTonemap *data = (NodeTonemap *)this->get_bnode()->storage; TonemapOperation *operation = data->type == 1 ? new PhotoreceptorTonemapOperation() : new TonemapOperation(); - operation->setData(data); - converter.addOperation(operation); + operation->set_data(data); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket(0)); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_TonemapNode.h b/source/blender/compositor/nodes/COM_TonemapNode.h index cac9004c32a..3c67472bf98 100644 --- a/source/blender/compositor/nodes/COM_TonemapNode.h +++ b/source/blender/compositor/nodes/COM_TonemapNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class TonemapNode : public Node { public: - TonemapNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + TonemapNode(bNode *editor_node); + void convert_to_operations(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 f683eeb61c2..ced09d8535f 100644 --- a/source/blender/compositor/nodes/COM_TrackPositionNode.cc +++ b/source/blender/compositor/nodes/COM_TrackPositionNode.cc @@ -27,7 +27,7 @@ namespace blender::compositor { -TrackPositionNode::TrackPositionNode(bNode *editorNode) : Node(editorNode) +TrackPositionNode::TrackPositionNode(bNode *editor_node) : Node(editor_node) { /* pass */ } @@ -40,58 +40,58 @@ static TrackPositionOperation *create_motion_operation(NodeConverter &converter, int delta) { TrackPositionOperation *operation = new TrackPositionOperation(); - operation->setMovieClip(clip); - operation->setTrackingObject(trackpos_data->tracking_object); - operation->setTrackName(trackpos_data->track_name); - operation->setFramenumber(frame_number); - operation->setAxis(axis); - operation->setPosition(CMP_TRACKPOS_ABSOLUTE); - operation->setRelativeFrame(frame_number + delta); - operation->setSpeedOutput(true); - converter.addOperation(operation); + operation->set_movie_clip(clip); + operation->set_tracking_object(trackpos_data->tracking_object); + operation->set_track_name(trackpos_data->track_name); + operation->set_framenumber(frame_number); + operation->set_axis(axis); + operation->set_position(CMP_TRACKPOS_ABSOLUTE); + operation->set_relative_frame(frame_number + delta); + operation->set_speed_output(true); + converter.add_operation(operation); return operation; } -void TrackPositionNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void TrackPositionNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *editorNode = this->getbNode(); - MovieClip *clip = (MovieClip *)editorNode->id; - NodeTrackPosData *trackpos_data = (NodeTrackPosData *)editorNode->storage; + bNode *editor_node = this->get_bnode(); + MovieClip *clip = (MovieClip *)editor_node->id; + NodeTrackPosData *trackpos_data = (NodeTrackPosData *)editor_node->storage; - NodeOutput *outputX = this->getOutputSocket(0); - NodeOutput *outputY = this->getOutputSocket(1); - NodeOutput *outputSpeed = this->getOutputSocket(2); + NodeOutput *outputX = this->get_output_socket(0); + NodeOutput *outputY = this->get_output_socket(1); + NodeOutput *output_speed = this->get_output_socket(2); int frame_number; - if (editorNode->custom1 == CMP_TRACKPOS_ABSOLUTE_FRAME) { - frame_number = editorNode->custom2; + if (editor_node->custom1 == CMP_TRACKPOS_ABSOLUTE_FRAME) { + frame_number = editor_node->custom2; } else { - frame_number = context.getFramenumber(); + frame_number = context.get_framenumber(); } TrackPositionOperation *operationX = new TrackPositionOperation(); - operationX->setMovieClip(clip); - operationX->setTrackingObject(trackpos_data->tracking_object); - operationX->setTrackName(trackpos_data->track_name); - operationX->setFramenumber(frame_number); - operationX->setAxis(0); - operationX->setPosition(editorNode->custom1); - operationX->setRelativeFrame(editorNode->custom2); - converter.addOperation(operationX); - converter.mapOutputSocket(outputX, operationX->getOutputSocket()); + operationX->set_movie_clip(clip); + operationX->set_tracking_object(trackpos_data->tracking_object); + operationX->set_track_name(trackpos_data->track_name); + operationX->set_framenumber(frame_number); + operationX->set_axis(0); + operationX->set_position(editor_node->custom1); + operationX->set_relative_frame(editor_node->custom2); + converter.add_operation(operationX); + converter.map_output_socket(outputX, operationX->get_output_socket()); TrackPositionOperation *operationY = new TrackPositionOperation(); - operationY->setMovieClip(clip); - operationY->setTrackingObject(trackpos_data->tracking_object); - operationY->setTrackName(trackpos_data->track_name); - operationY->setFramenumber(frame_number); - operationY->setAxis(1); - operationY->setPosition(editorNode->custom1); - operationY->setRelativeFrame(editorNode->custom2); - converter.addOperation(operationY); - converter.mapOutputSocket(outputY, operationY->getOutputSocket()); + operationY->set_movie_clip(clip); + operationY->set_tracking_object(trackpos_data->tracking_object); + operationY->set_track_name(trackpos_data->track_name); + operationY->set_framenumber(frame_number); + operationY->set_axis(1); + operationY->set_position(editor_node->custom1); + operationY->set_relative_frame(editor_node->custom2); + converter.add_operation(operationY); + converter.map_output_socket(outputY, operationY->get_output_socket()); TrackPositionOperation *operationMotionPreX = create_motion_operation( converter, clip, trackpos_data, 0, frame_number, -1); @@ -103,12 +103,16 @@ void TrackPositionNode::convertToOperations(NodeConverter &converter, converter, clip, trackpos_data, 1, frame_number, 1); CombineChannelsOperation *combine_operation = new CombineChannelsOperation(); - converter.addOperation(combine_operation); - converter.addLink(operationMotionPreX->getOutputSocket(), combine_operation->getInputSocket(0)); - converter.addLink(operationMotionPreY->getOutputSocket(), combine_operation->getInputSocket(1)); - converter.addLink(operationMotionPostX->getOutputSocket(), combine_operation->getInputSocket(2)); - converter.addLink(operationMotionPostY->getOutputSocket(), combine_operation->getInputSocket(3)); - converter.mapOutputSocket(outputSpeed, combine_operation->getOutputSocket()); + converter.add_operation(combine_operation); + converter.add_link(operationMotionPreX->get_output_socket(), + combine_operation->get_input_socket(0)); + converter.add_link(operationMotionPreY->get_output_socket(), + combine_operation->get_input_socket(1)); + converter.add_link(operationMotionPostX->get_output_socket(), + combine_operation->get_input_socket(2)); + converter.add_link(operationMotionPostY->get_output_socket(), + combine_operation->get_input_socket(3)); + converter.map_output_socket(output_speed, combine_operation->get_output_socket()); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_TrackPositionNode.h b/source/blender/compositor/nodes/COM_TrackPositionNode.h index 665ba36fe09..d0b1648b0c9 100644 --- a/source/blender/compositor/nodes/COM_TrackPositionNode.h +++ b/source/blender/compositor/nodes/COM_TrackPositionNode.h @@ -29,9 +29,9 @@ namespace blender::compositor { */ class TrackPositionNode : public Node { public: - TrackPositionNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + TrackPositionNode(bNode *editor_node); + void convert_to_operations(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 a5b3c41de80..cd60e8c17db 100644 --- a/source/blender/compositor/nodes/COM_TransformNode.cc +++ b/source/blender/compositor/nodes/COM_TransformNode.cc @@ -24,79 +24,85 @@ namespace blender::compositor { -TransformNode::TransformNode(bNode *editorNode) : Node(editorNode) +TransformNode::TransformNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void TransformNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void TransformNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - NodeInput *imageInput = this->getInputSocket(0); - NodeInput *xInput = this->getInputSocket(1); - NodeInput *yInput = this->getInputSocket(2); - NodeInput *angleInput = this->getInputSocket(3); - NodeInput *scaleInput = this->getInputSocket(4); + NodeInput *image_input = this->get_input_socket(0); + NodeInput *x_input = this->get_input_socket(1); + NodeInput *y_input = this->get_input_socket(2); + NodeInput *angle_input = this->get_input_socket(3); + NodeInput *scale_input = this->get_input_socket(4); switch (context.get_execution_model()) { case eExecutionModel::Tiled: { - ScaleRelativeOperation *scaleOperation = new ScaleRelativeOperation(); - converter.addOperation(scaleOperation); + ScaleRelativeOperation *scale_operation = new ScaleRelativeOperation(); + converter.add_operation(scale_operation); - RotateOperation *rotateOperation = new RotateOperation(); - rotateOperation->setDoDegree2RadConversion(false); - converter.addOperation(rotateOperation); + RotateOperation *rotate_operation = new RotateOperation(); + rotate_operation->set_do_degree2_rad_conversion(false); + converter.add_operation(rotate_operation); - TranslateOperation *translateOperation = new TranslateOperation(); - converter.addOperation(translateOperation); + TranslateOperation *translate_operation = new TranslateOperation(); + converter.add_operation(translate_operation); SetSamplerOperation *sampler = new SetSamplerOperation(); - sampler->setSampler((PixelSampler)this->getbNode()->custom1); - converter.addOperation(sampler); + sampler->set_sampler((PixelSampler)this->get_bnode()->custom1); + converter.add_operation(sampler); - converter.mapInputSocket(imageInput, sampler->getInputSocket(0)); - converter.addLink(sampler->getOutputSocket(), scaleOperation->getInputSocket(0)); - converter.mapInputSocket(scaleInput, scaleOperation->getInputSocket(1)); - converter.mapInputSocket(scaleInput, scaleOperation->getInputSocket(2)); // xscale = yscale + converter.map_input_socket(image_input, sampler->get_input_socket(0)); + converter.add_link(sampler->get_output_socket(), scale_operation->get_input_socket(0)); + converter.map_input_socket(scale_input, scale_operation->get_input_socket(1)); + converter.map_input_socket(scale_input, + scale_operation->get_input_socket(2)); // xscale = yscale - converter.addLink(scaleOperation->getOutputSocket(), rotateOperation->getInputSocket(0)); - converter.mapInputSocket(angleInput, rotateOperation->getInputSocket(1)); + converter.add_link(scale_operation->get_output_socket(), + rotate_operation->get_input_socket(0)); + converter.map_input_socket(angle_input, rotate_operation->get_input_socket(1)); - converter.addLink(rotateOperation->getOutputSocket(), translateOperation->getInputSocket(0)); - converter.mapInputSocket(xInput, translateOperation->getInputSocket(1)); - converter.mapInputSocket(yInput, translateOperation->getInputSocket(2)); + converter.add_link(rotate_operation->get_output_socket(), + translate_operation->get_input_socket(0)); + converter.map_input_socket(x_input, translate_operation->get_input_socket(1)); + converter.map_input_socket(y_input, translate_operation->get_input_socket(2)); - converter.mapOutputSocket(getOutputSocket(), translateOperation->getOutputSocket()); + converter.map_output_socket(get_output_socket(), translate_operation->get_output_socket()); break; } case eExecutionModel::FullFrame: { - ScaleRelativeOperation *scaleOperation = new ScaleRelativeOperation(); - converter.addOperation(scaleOperation); + ScaleRelativeOperation *scale_operation = new ScaleRelativeOperation(); + converter.add_operation(scale_operation); - RotateOperation *rotateOperation = new RotateOperation(); - rotateOperation->setDoDegree2RadConversion(false); - converter.addOperation(rotateOperation); + RotateOperation *rotate_operation = new RotateOperation(); + rotate_operation->set_do_degree2_rad_conversion(false); + converter.add_operation(rotate_operation); - TranslateOperation *translateOperation = new TranslateCanvasOperation(); - converter.addOperation(translateOperation); + TranslateOperation *translate_operation = new TranslateCanvasOperation(); + converter.add_operation(translate_operation); - PixelSampler sampler = (PixelSampler)this->getbNode()->custom1; - scaleOperation->setSampler(sampler); - rotateOperation->set_sampler(sampler); - scaleOperation->set_scale_canvas_max_size(context.get_render_size()); + PixelSampler sampler = (PixelSampler)this->get_bnode()->custom1; + scale_operation->set_sampler(sampler); + rotate_operation->set_sampler(sampler); + scale_operation->set_scale_canvas_max_size(context.get_render_size()); - converter.mapInputSocket(imageInput, scaleOperation->getInputSocket(0)); - converter.mapInputSocket(scaleInput, scaleOperation->getInputSocket(1)); - converter.mapInputSocket(scaleInput, scaleOperation->getInputSocket(2)); // xscale = yscale + converter.map_input_socket(image_input, scale_operation->get_input_socket(0)); + converter.map_input_socket(scale_input, scale_operation->get_input_socket(1)); + converter.map_input_socket(scale_input, + scale_operation->get_input_socket(2)); // xscale = yscale - converter.addLink(scaleOperation->getOutputSocket(), rotateOperation->getInputSocket(0)); - converter.mapInputSocket(angleInput, rotateOperation->getInputSocket(1)); + converter.add_link(scale_operation->get_output_socket(), + rotate_operation->get_input_socket(0)); + converter.map_input_socket(angle_input, rotate_operation->get_input_socket(1)); - converter.addLink(rotateOperation->getOutputSocket(), translateOperation->getInputSocket(0)); - converter.mapInputSocket(xInput, translateOperation->getInputSocket(1)); - converter.mapInputSocket(yInput, translateOperation->getInputSocket(2)); + converter.add_link(rotate_operation->get_output_socket(), + translate_operation->get_input_socket(0)); + converter.map_input_socket(x_input, translate_operation->get_input_socket(1)); + converter.map_input_socket(y_input, translate_operation->get_input_socket(2)); - converter.mapOutputSocket(getOutputSocket(), translateOperation->getOutputSocket()); + converter.map_output_socket(get_output_socket(), translate_operation->get_output_socket()); break; } } diff --git a/source/blender/compositor/nodes/COM_TransformNode.h b/source/blender/compositor/nodes/COM_TransformNode.h index 137e162256d..66255d63813 100644 --- a/source/blender/compositor/nodes/COM_TransformNode.h +++ b/source/blender/compositor/nodes/COM_TransformNode.h @@ -29,9 +29,9 @@ namespace blender::compositor { */ class TransformNode : public Node { public: - TransformNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + TransformNode(bNode *editor_node); + void convert_to_operations(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 6dbd350fabf..b9f96d92942 100644 --- a/source/blender/compositor/nodes/COM_TranslateNode.cc +++ b/source/blender/compositor/nodes/COM_TranslateNode.cc @@ -24,53 +24,53 @@ namespace blender::compositor { -TranslateNode::TranslateNode(bNode *editorNode) : Node(editorNode) +TranslateNode::TranslateNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void TranslateNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void TranslateNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *bnode = this->getbNode(); + bNode *bnode = this->get_bnode(); NodeTranslateData *data = (NodeTranslateData *)bnode->storage; - NodeInput *inputSocket = this->getInputSocket(0); - NodeInput *inputXSocket = this->getInputSocket(1); - NodeInput *inputYSocket = this->getInputSocket(2); - NodeOutput *outputSocket = this->getOutputSocket(0); + NodeInput *input_socket = this->get_input_socket(0); + NodeInput *input_xsocket = this->get_input_socket(1); + NodeInput *input_ysocket = this->get_input_socket(2); + NodeOutput *output_socket = this->get_output_socket(0); TranslateOperation *operation = context.get_execution_model() == eExecutionModel::Tiled ? new TranslateOperation() : new TranslateCanvasOperation(); operation->set_wrapping(data->wrap_axis); if (data->relative) { - const RenderData *rd = context.getRenderData(); - const float render_size_factor = context.getRenderPercentageAsFactor(); + const RenderData *rd = context.get_render_data(); + const float render_size_factor = context.get_render_percentage_as_factor(); float fx = rd->xsch * render_size_factor; float fy = rd->ysch * render_size_factor; operation->setFactorXY(fx, fy); } - converter.addOperation(operation); - converter.mapInputSocket(inputXSocket, operation->getInputSocket(1)); - converter.mapInputSocket(inputYSocket, operation->getInputSocket(2)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + converter.add_operation(operation); + converter.map_input_socket(input_xsocket, operation->get_input_socket(1)); + converter.map_input_socket(input_ysocket, operation->get_input_socket(2)); + converter.map_output_socket(output_socket, operation->get_output_socket(0)); if (data->wrap_axis && context.get_execution_model() != eExecutionModel::FullFrame) { /* TODO: To be removed with tiled implementation. */ - WriteBufferOperation *writeOperation = new WriteBufferOperation(DataType::Color); - WrapOperation *wrapOperation = new WrapOperation(DataType::Color); - wrapOperation->setMemoryProxy(writeOperation->getMemoryProxy()); - wrapOperation->setWrapping(data->wrap_axis); + WriteBufferOperation *write_operation = new WriteBufferOperation(DataType::Color); + WrapOperation *wrap_operation = new WrapOperation(DataType::Color); + wrap_operation->set_memory_proxy(write_operation->get_memory_proxy()); + wrap_operation->set_wrapping(data->wrap_axis); - converter.addOperation(writeOperation); - converter.addOperation(wrapOperation); - converter.mapInputSocket(inputSocket, writeOperation->getInputSocket(0)); - converter.addLink(wrapOperation->getOutputSocket(), operation->getInputSocket(0)); + converter.add_operation(write_operation); + converter.add_operation(wrap_operation); + converter.map_input_socket(input_socket, write_operation->get_input_socket(0)); + converter.add_link(wrap_operation->get_output_socket(), operation->get_input_socket(0)); } else { - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); + converter.map_input_socket(input_socket, operation->get_input_socket(0)); } } diff --git a/source/blender/compositor/nodes/COM_TranslateNode.h b/source/blender/compositor/nodes/COM_TranslateNode.h index 0cea234bff8..5ccbb01f3f0 100644 --- a/source/blender/compositor/nodes/COM_TranslateNode.h +++ b/source/blender/compositor/nodes/COM_TranslateNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class TranslateNode : public Node { public: - TranslateNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + TranslateNode(bNode *editor_node); + void convert_to_operations(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 611353fceba..892a68dabcc 100644 --- a/source/blender/compositor/nodes/COM_ValueNode.cc +++ b/source/blender/compositor/nodes/COM_ValueNode.cc @@ -21,20 +21,20 @@ namespace blender::compositor { -ValueNode::ValueNode(bNode *editorNode) : Node(editorNode) +ValueNode::ValueNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void ValueNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void ValueNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { SetValueOperation *operation = new SetValueOperation(); - NodeOutput *output = this->getOutputSocket(0); - operation->setValue(output->getEditorValueFloat()); - converter.addOperation(operation); + NodeOutput *output = this->get_output_socket(0); + operation->set_value(output->get_editor_value_float()); + converter.add_operation(operation); - converter.mapOutputSocket(output, operation->getOutputSocket()); + converter.map_output_socket(output, operation->get_output_socket()); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ValueNode.h b/source/blender/compositor/nodes/COM_ValueNode.h index 1401b2c7e0a..d70013c48af 100644 --- a/source/blender/compositor/nodes/COM_ValueNode.h +++ b/source/blender/compositor/nodes/COM_ValueNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class ValueNode : public Node { public: - ValueNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + ValueNode(bNode *editor_node); + void convert_to_operations(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 2bbfd3591c3..b3f32465a34 100644 --- a/source/blender/compositor/nodes/COM_VectorBlurNode.cc +++ b/source/blender/compositor/nodes/COM_VectorBlurNode.cc @@ -21,26 +21,26 @@ namespace blender::compositor { -VectorBlurNode::VectorBlurNode(bNode *editorNode) : Node(editorNode) +VectorBlurNode::VectorBlurNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void VectorBlurNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void VectorBlurNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *node = this->getbNode(); - NodeBlurData *vectorBlurSettings = (NodeBlurData *)node->storage; + bNode *node = this->get_bnode(); + NodeBlurData *vector_blur_settings = (NodeBlurData *)node->storage; VectorBlurOperation *operation = new VectorBlurOperation(); - operation->setVectorBlurSettings(vectorBlurSettings); - operation->setQuality(context.getQuality()); - converter.addOperation(operation); + operation->set_vector_blur_settings(vector_blur_settings); + operation->set_quality(context.get_quality()); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); - converter.mapOutputSocket(getOutputSocket(), operation->getOutputSocket()); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1)); + converter.map_input_socket(get_input_socket(2), operation->get_input_socket(2)); + converter.map_output_socket(get_output_socket(), operation->get_output_socket()); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_VectorBlurNode.h b/source/blender/compositor/nodes/COM_VectorBlurNode.h index 8c98a0b81a1..fb8a70ab2ec 100644 --- a/source/blender/compositor/nodes/COM_VectorBlurNode.h +++ b/source/blender/compositor/nodes/COM_VectorBlurNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class VectorBlurNode : public Node { public: - VectorBlurNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + VectorBlurNode(bNode *editor_node); + void convert_to_operations(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 2b26056296d..d064c5787fd 100644 --- a/source/blender/compositor/nodes/COM_VectorCurveNode.cc +++ b/source/blender/compositor/nodes/COM_VectorCurveNode.cc @@ -21,20 +21,20 @@ namespace blender::compositor { -VectorCurveNode::VectorCurveNode(bNode *editorNode) : Node(editorNode) +VectorCurveNode::VectorCurveNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void VectorCurveNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void VectorCurveNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { VectorCurveOperation *operation = new VectorCurveOperation(); - operation->setCurveMapping((CurveMapping *)this->getbNode()->storage); - converter.addOperation(operation); + operation->set_curve_mapping((CurveMapping *)this->get_bnode()->storage); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket()); } } // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_VectorCurveNode.h b/source/blender/compositor/nodes/COM_VectorCurveNode.h index ee4df5d3a42..901bd6f64b9 100644 --- a/source/blender/compositor/nodes/COM_VectorCurveNode.h +++ b/source/blender/compositor/nodes/COM_VectorCurveNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class VectorCurveNode : public Node { public: - VectorCurveNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + VectorCurveNode(bNode *editor_node); + void convert_to_operations(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 605ff9357ab..79d535fc58a 100644 --- a/source/blender/compositor/nodes/COM_ViewLevelsNode.cc +++ b/source/blender/compositor/nodes/COM_ViewLevelsNode.cc @@ -21,41 +21,41 @@ namespace blender::compositor { -ViewLevelsNode::ViewLevelsNode(bNode *editorNode) : Node(editorNode) +ViewLevelsNode::ViewLevelsNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void ViewLevelsNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void ViewLevelsNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - NodeInput *input = this->getInputSocket(0); - if (input->isLinked()) { + NodeInput *input = this->get_input_socket(0); + if (input->is_linked()) { /* Add preview to input-socket. */ /* calculate mean operation */ { CalculateMeanOperation *operation = new CalculateMeanOperation(); - operation->setSetting(this->getbNode()->custom1); + operation->set_setting(this->get_bnode()->custom1); - converter.addOperation(operation); - converter.mapInputSocket(input, operation->getInputSocket(0)); - converter.mapOutputSocket(this->getOutputSocket(0), operation->getOutputSocket()); + converter.add_operation(operation); + converter.map_input_socket(input, operation->get_input_socket(0)); + converter.map_output_socket(this->get_output_socket(0), operation->get_output_socket()); } /* calculate standard deviation operation */ { CalculateStandardDeviationOperation *operation = new CalculateStandardDeviationOperation(); - operation->setSetting(this->getbNode()->custom1); + operation->set_setting(this->get_bnode()->custom1); - converter.addOperation(operation); - converter.mapInputSocket(input, operation->getInputSocket(0)); - converter.mapOutputSocket(this->getOutputSocket(1), operation->getOutputSocket()); + converter.add_operation(operation); + converter.map_input_socket(input, operation->get_input_socket(0)); + converter.map_output_socket(this->get_output_socket(1), operation->get_output_socket()); } } else { - converter.addOutputValue(getOutputSocket(0), 0.0f); - converter.addOutputValue(getOutputSocket(1), 0.0f); + converter.add_output_value(get_output_socket(0), 0.0f); + converter.add_output_value(get_output_socket(1), 0.0f); } } diff --git a/source/blender/compositor/nodes/COM_ViewLevelsNode.h b/source/blender/compositor/nodes/COM_ViewLevelsNode.h index 055d871498e..5415bbb2ee9 100644 --- a/source/blender/compositor/nodes/COM_ViewLevelsNode.h +++ b/source/blender/compositor/nodes/COM_ViewLevelsNode.h @@ -28,9 +28,9 @@ namespace blender::compositor { */ class ViewLevelsNode : public Node { public: - ViewLevelsNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + ViewLevelsNode(bNode *editor_node); + void convert_to_operations(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 38ea37a28d6..7efb23b849d 100644 --- a/source/blender/compositor/nodes/COM_ViewerNode.cc +++ b/source/blender/compositor/nodes/COM_ViewerNode.cc @@ -22,61 +22,61 @@ namespace blender::compositor { -ViewerNode::ViewerNode(bNode *editorNode) : Node(editorNode) +ViewerNode::ViewerNode(bNode *editor_node) : Node(editor_node) { /* pass */ } -void ViewerNode::convertToOperations(NodeConverter &converter, - const CompositorContext &context) const +void ViewerNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *editorNode = this->getbNode(); - bool do_output = (editorNode->flag & NODE_DO_OUTPUT_RECALC || context.isRendering()) && - (editorNode->flag & NODE_DO_OUTPUT); - bool ignore_alpha = (editorNode->custom2 & CMP_NODE_OUTPUT_IGNORE_ALPHA) != 0; + bNode *editor_node = this->get_bnode(); + bool do_output = (editor_node->flag & NODE_DO_OUTPUT_RECALC || context.is_rendering()) && + (editor_node->flag & NODE_DO_OUTPUT); + bool ignore_alpha = (editor_node->custom2 & CMP_NODE_OUTPUT_IGNORE_ALPHA) != 0; - NodeInput *imageSocket = this->getInputSocket(0); - NodeInput *alphaSocket = this->getInputSocket(1); - NodeInput *depthSocket = this->getInputSocket(2); - Image *image = (Image *)this->getbNode()->id; - ImageUser *imageUser = (ImageUser *)this->getbNode()->storage; - ViewerOperation *viewerOperation = new ViewerOperation(); - viewerOperation->setbNodeTree(context.getbNodeTree()); - viewerOperation->setImage(image); - viewerOperation->setImageUser(imageUser); - viewerOperation->setChunkOrder((ChunkOrdering)editorNode->custom1); - viewerOperation->setCenterX(editorNode->custom3); - viewerOperation->setCenterY(editorNode->custom4); + NodeInput *image_socket = this->get_input_socket(0); + NodeInput *alpha_socket = this->get_input_socket(1); + NodeInput *depth_socket = this->get_input_socket(2); + Image *image = (Image *)this->get_bnode()->id; + ImageUser *image_user = (ImageUser *)this->get_bnode()->storage; + ViewerOperation *viewer_operation = new ViewerOperation(); + viewer_operation->set_bnodetree(context.get_bnodetree()); + viewer_operation->set_image(image); + viewer_operation->set_image_user(image_user); + viewer_operation->set_chunk_order((ChunkOrdering)editor_node->custom1); + viewer_operation->setCenterX(editor_node->custom3); + viewer_operation->setCenterY(editor_node->custom4); /* alpha socket gives either 1 or a custom alpha value if "use alpha" is enabled */ - viewerOperation->setUseAlphaInput(ignore_alpha || alphaSocket->isLinked()); - viewerOperation->setRenderData(context.getRenderData()); - viewerOperation->setViewName(context.getViewName()); + viewer_operation->set_use_alpha_input(ignore_alpha || alpha_socket->is_linked()); + viewer_operation->set_render_data(context.get_render_data()); + viewer_operation->set_view_name(context.get_view_name()); - viewerOperation->setViewSettings(context.getViewSettings()); - viewerOperation->setDisplaySettings(context.getDisplaySettings()); + viewer_operation->set_view_settings(context.get_view_settings()); + viewer_operation->set_display_settings(context.get_display_settings()); - viewerOperation->set_canvas_input_index(0); - if (!imageSocket->isLinked()) { - if (alphaSocket->isLinked()) { - viewerOperation->set_canvas_input_index(1); + viewer_operation->set_canvas_input_index(0); + if (!image_socket->is_linked()) { + if (alpha_socket->is_linked()) { + viewer_operation->set_canvas_input_index(1); } } - converter.addOperation(viewerOperation); - converter.mapInputSocket(imageSocket, viewerOperation->getInputSocket(0)); + converter.add_operation(viewer_operation); + converter.map_input_socket(image_socket, viewer_operation->get_input_socket(0)); /* only use alpha link if "use alpha" is enabled */ if (ignore_alpha) { - converter.addInputValue(viewerOperation->getInputSocket(1), 1.0f); + converter.add_input_value(viewer_operation->get_input_socket(1), 1.0f); } else { - converter.mapInputSocket(alphaSocket, viewerOperation->getInputSocket(1)); + converter.map_input_socket(alpha_socket, viewer_operation->get_input_socket(1)); } - converter.mapInputSocket(depthSocket, viewerOperation->getInputSocket(2)); + converter.map_input_socket(depth_socket, viewer_operation->get_input_socket(2)); - converter.addNodeInputPreview(imageSocket); + converter.add_node_input_preview(image_socket); if (do_output) { - converter.registerViewer(viewerOperation); + converter.register_viewer(viewer_operation); } } diff --git a/source/blender/compositor/nodes/COM_ViewerNode.h b/source/blender/compositor/nodes/COM_ViewerNode.h index 544a5e6a504..ce9076666bc 100644 --- a/source/blender/compositor/nodes/COM_ViewerNode.h +++ b/source/blender/compositor/nodes/COM_ViewerNode.h @@ -29,9 +29,9 @@ namespace blender::compositor { */ class ViewerNode : public Node { public: - ViewerNode(bNode *editorNode); - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + ViewerNode(bNode *editor_node); + void convert_to_operations(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 5f7fec53808..52cb1451ba1 100644 --- a/source/blender/compositor/nodes/COM_ZCombineNode.cc +++ b/source/blender/compositor/nodes/COM_ZCombineNode.cc @@ -24,31 +24,31 @@ namespace blender::compositor { -void ZCombineNode::convertToOperations(NodeConverter &converter, - const CompositorContext & /*context*/) const +void ZCombineNode::convert_to_operations(NodeConverter &converter, + const CompositorContext & /*context*/) const { - if (this->getbNode()->custom2) { + if (this->get_bnode()->custom2) { ZCombineOperation *operation = nullptr; - if (this->getbNode()->custom1) { + if (this->get_bnode()->custom1) { operation = new ZCombineAlphaOperation(); } else { operation = new ZCombineOperation(); } - converter.addOperation(operation); + converter.add_operation(operation); - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); - converter.mapInputSocket(getInputSocket(2), operation->getInputSocket(2)); - converter.mapInputSocket(getInputSocket(3), operation->getInputSocket(3)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); + converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0)); + converter.map_input_socket(get_input_socket(1), operation->get_input_socket(1)); + converter.map_input_socket(get_input_socket(2), operation->get_input_socket(2)); + converter.map_input_socket(get_input_socket(3), operation->get_input_socket(3)); + converter.map_output_socket(get_output_socket(0), operation->get_output_socket()); MathMinimumOperation *zoperation = new MathMinimumOperation(); - converter.addOperation(zoperation); + converter.add_operation(zoperation); - converter.mapInputSocket(getInputSocket(1), zoperation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(3), zoperation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(1), zoperation->getOutputSocket()); + converter.map_input_socket(get_input_socket(1), zoperation->get_input_socket(0)); + converter.map_input_socket(get_input_socket(3), zoperation->get_input_socket(1)); + converter.map_output_socket(get_output_socket(1), zoperation->get_output_socket()); } else { /* XXX custom1 is "use_alpha", what on earth is this supposed to do here?!? */ @@ -56,40 +56,42 @@ void ZCombineNode::convertToOperations(NodeConverter &converter, /* Step 1 create mask. */ NodeOperation *maskoperation; - if (this->getbNode()->custom1) { + if (this->get_bnode()->custom1) { maskoperation = new MathGreaterThanOperation(); } else { maskoperation = new MathLessThanOperation(); } - converter.addOperation(maskoperation); + converter.add_operation(maskoperation); - converter.mapInputSocket(getInputSocket(1), maskoperation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(3), maskoperation->getInputSocket(1)); + converter.map_input_socket(get_input_socket(1), maskoperation->get_input_socket(0)); + converter.map_input_socket(get_input_socket(3), maskoperation->get_input_socket(1)); /* Step 2 anti alias mask bit of an expensive operation, but does the trick. */ AntiAliasOperation *antialiasoperation = new AntiAliasOperation(); - converter.addOperation(antialiasoperation); + converter.add_operation(antialiasoperation); - converter.addLink(maskoperation->getOutputSocket(), antialiasoperation->getInputSocket(0)); + converter.add_link(maskoperation->get_output_socket(), + antialiasoperation->get_input_socket(0)); /* use mask to blend between the input colors. */ - ZCombineMaskOperation *zcombineoperation = this->getbNode()->custom1 ? + ZCombineMaskOperation *zcombineoperation = this->get_bnode()->custom1 ? new ZCombineMaskAlphaOperation() : new ZCombineMaskOperation(); - converter.addOperation(zcombineoperation); + converter.add_operation(zcombineoperation); - converter.addLink(antialiasoperation->getOutputSocket(), zcombineoperation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(0), zcombineoperation->getInputSocket(1)); - converter.mapInputSocket(getInputSocket(2), zcombineoperation->getInputSocket(2)); - converter.mapOutputSocket(getOutputSocket(0), zcombineoperation->getOutputSocket()); + converter.add_link(antialiasoperation->get_output_socket(), + zcombineoperation->get_input_socket(0)); + converter.map_input_socket(get_input_socket(0), zcombineoperation->get_input_socket(1)); + converter.map_input_socket(get_input_socket(2), zcombineoperation->get_input_socket(2)); + converter.map_output_socket(get_output_socket(0), zcombineoperation->get_output_socket()); MathMinimumOperation *zoperation = new MathMinimumOperation(); - converter.addOperation(zoperation); + converter.add_operation(zoperation); - converter.mapInputSocket(getInputSocket(1), zoperation->getInputSocket(0)); - converter.mapInputSocket(getInputSocket(3), zoperation->getInputSocket(1)); - converter.mapOutputSocket(getOutputSocket(1), zoperation->getOutputSocket()); + converter.map_input_socket(get_input_socket(1), zoperation->get_input_socket(0)); + converter.map_input_socket(get_input_socket(3), zoperation->get_input_socket(1)); + converter.map_output_socket(get_output_socket(1), zoperation->get_output_socket()); } } diff --git a/source/blender/compositor/nodes/COM_ZCombineNode.h b/source/blender/compositor/nodes/COM_ZCombineNode.h index 82f2f30fb3c..4761b336fc1 100644 --- a/source/blender/compositor/nodes/COM_ZCombineNode.h +++ b/source/blender/compositor/nodes/COM_ZCombineNode.h @@ -28,11 +28,11 @@ namespace blender::compositor { */ class ZCombineNode : public Node { public: - ZCombineNode(bNode *editorNode) : Node(editorNode) + ZCombineNode(bNode *editor_node) : Node(editor_node) { } - void convertToOperations(NodeConverter &converter, - const CompositorContext &context) const override; + void convert_to_operations(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 2e494d1adf3..3c5053d8357 100644 --- a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cc +++ b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cc @@ -25,33 +25,33 @@ AlphaOverKeyOperation::AlphaOverKeyOperation() this->flags.can_be_constant = true; } -void AlphaOverKeyOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void AlphaOverKeyOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor1[4]; - float inputOverColor[4]; + float input_color1[4]; + float input_over_color[4]; float value[4]; - inputValueOperation_->readSampled(value, x, y, sampler); - inputColor1Operation_->readSampled(inputColor1, x, y, sampler); - inputColor2Operation_->readSampled(inputOverColor, x, y, sampler); + input_value_operation_->read_sampled(value, x, y, sampler); + input_color1_operation_->read_sampled(input_color1, x, y, sampler); + input_color2_operation_->read_sampled(input_over_color, x, y, sampler); - if (inputOverColor[3] <= 0.0f) { - copy_v4_v4(output, inputColor1); + if (input_over_color[3] <= 0.0f) { + copy_v4_v4(output, input_color1); } - else if (value[0] == 1.0f && inputOverColor[3] >= 1.0f) { - copy_v4_v4(output, inputOverColor); + else if (value[0] == 1.0f && input_over_color[3] >= 1.0f) { + copy_v4_v4(output, input_over_color); } else { - float premul = value[0] * inputOverColor[3]; + float premul = value[0] * input_over_color[3]; float mul = 1.0f - premul; - output[0] = (mul * inputColor1[0]) + premul * inputOverColor[0]; - output[1] = (mul * inputColor1[1]) + premul * inputOverColor[1]; - output[2] = (mul * inputColor1[2]) + premul * inputOverColor[2]; - output[3] = (mul * inputColor1[3]) + value[0] * inputOverColor[3]; + output[0] = (mul * input_color1[0]) + premul * input_over_color[0]; + output[1] = (mul * input_color1[1]) + premul * input_over_color[1]; + output[2] = (mul * input_color1[2]) + premul * input_over_color[2]; + output[3] = (mul * input_color1[3]) + value[0] * input_over_color[3]; } } diff --git a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h index 960fbc98fe9..cfcb655ceca 100644 --- a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h +++ b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.h @@ -33,7 +33,7 @@ class AlphaOverKeyOperation : public MixBaseOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void update_memory_buffer_row(PixelCursor &p) override; }; diff --git a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cc b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cc index 1df74ffac8e..102d031d9be 100644 --- a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cc +++ b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cc @@ -26,34 +26,34 @@ AlphaOverMixedOperation::AlphaOverMixedOperation() this->flags.can_be_constant = true; } -void AlphaOverMixedOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void AlphaOverMixedOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor1[4]; - float inputOverColor[4]; + float input_color1[4]; + float input_over_color[4]; float value[4]; - inputValueOperation_->readSampled(value, x, y, sampler); - inputColor1Operation_->readSampled(inputColor1, x, y, sampler); - inputColor2Operation_->readSampled(inputOverColor, x, y, sampler); + input_value_operation_->read_sampled(value, x, y, sampler); + input_color1_operation_->read_sampled(input_color1, x, y, sampler); + input_color2_operation_->read_sampled(input_over_color, x, y, sampler); - if (inputOverColor[3] <= 0.0f) { - copy_v4_v4(output, inputColor1); + if (input_over_color[3] <= 0.0f) { + copy_v4_v4(output, input_color1); } - else if (value[0] == 1.0f && inputOverColor[3] >= 1.0f) { - copy_v4_v4(output, inputOverColor); + else if (value[0] == 1.0f && input_over_color[3] >= 1.0f) { + copy_v4_v4(output, input_over_color); } else { - float addfac = 1.0f - x_ + inputOverColor[3] * x_; + float addfac = 1.0f - x_ + input_over_color[3] * x_; float premul = value[0] * addfac; - float mul = 1.0f - value[0] * inputOverColor[3]; + float mul = 1.0f - value[0] * input_over_color[3]; - output[0] = (mul * inputColor1[0]) + premul * inputOverColor[0]; - output[1] = (mul * inputColor1[1]) + premul * inputOverColor[1]; - output[2] = (mul * inputColor1[2]) + premul * inputOverColor[2]; - output[3] = (mul * inputColor1[3]) + value[0] * inputOverColor[3]; + output[0] = (mul * input_color1[0]) + premul * input_over_color[0]; + output[1] = (mul * input_color1[1]) + premul * input_over_color[1]; + output[2] = (mul * input_color1[2]) + premul * input_over_color[2]; + output[3] = (mul * input_color1[3]) + value[0] * input_over_color[3]; } } diff --git a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h index 65967c03eb9..32ff77fdecd 100644 --- a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h +++ b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.h @@ -39,7 +39,7 @@ class AlphaOverMixedOperation : public MixBaseOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void setX(float x) { diff --git a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cc b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cc index 5af992c8809..2d04c22533b 100644 --- a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cc +++ b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cc @@ -25,33 +25,33 @@ AlphaOverPremultiplyOperation::AlphaOverPremultiplyOperation() this->flags.can_be_constant = true; } -void AlphaOverPremultiplyOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void AlphaOverPremultiplyOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor1[4]; - float inputOverColor[4]; + float input_color1[4]; + float input_over_color[4]; float value[4]; - inputValueOperation_->readSampled(value, x, y, sampler); - inputColor1Operation_->readSampled(inputColor1, x, y, sampler); - inputColor2Operation_->readSampled(inputOverColor, x, y, sampler); + input_value_operation_->read_sampled(value, x, y, sampler); + input_color1_operation_->read_sampled(input_color1, x, y, sampler); + input_color2_operation_->read_sampled(input_over_color, x, y, sampler); /* Zero alpha values should still permit an add of RGB data */ - if (inputOverColor[3] < 0.0f) { - copy_v4_v4(output, inputColor1); + if (input_over_color[3] < 0.0f) { + copy_v4_v4(output, input_color1); } - else if (value[0] == 1.0f && inputOverColor[3] >= 1.0f) { - copy_v4_v4(output, inputOverColor); + else if (value[0] == 1.0f && input_over_color[3] >= 1.0f) { + copy_v4_v4(output, input_over_color); } else { - float mul = 1.0f - value[0] * inputOverColor[3]; + float mul = 1.0f - value[0] * input_over_color[3]; - output[0] = (mul * inputColor1[0]) + value[0] * inputOverColor[0]; - output[1] = (mul * inputColor1[1]) + value[0] * inputOverColor[1]; - output[2] = (mul * inputColor1[2]) + value[0] * inputOverColor[2]; - output[3] = (mul * inputColor1[3]) + value[0] * inputOverColor[3]; + output[0] = (mul * input_color1[0]) + value[0] * input_over_color[0]; + output[1] = (mul * input_color1[1]) + value[0] * input_over_color[1]; + output[2] = (mul * input_color1[2]) + value[0] * input_over_color[2]; + output[3] = (mul * input_color1[3]) + value[0] * input_over_color[3]; } } diff --git a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h index 701bc07cc27..cc4cb615de8 100644 --- a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h +++ b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.h @@ -33,7 +33,7 @@ class AlphaOverPremultiplyOperation : public MixBaseOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void update_memory_buffer_row(PixelCursor &p) override; }; diff --git a/source/blender/compositor/operations/COM_AntiAliasOperation.cc b/source/blender/compositor/operations/COM_AntiAliasOperation.cc index 8a3b6f4df11..28fea7b406c 100644 --- a/source/blender/compositor/operations/COM_AntiAliasOperation.cc +++ b/source/blender/compositor/operations/COM_AntiAliasOperation.cc @@ -110,26 +110,26 @@ static int extrapolate9(float *E0, AntiAliasOperation::AntiAliasOperation() { - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Value); - valueReader_ = nullptr; + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Value); + value_reader_ = nullptr; this->flags.complex = true; } -void AntiAliasOperation::initExecution() +void AntiAliasOperation::init_execution() { - valueReader_ = this->getInputSocketReader(0); + value_reader_ = this->get_input_socket_reader(0); } -void AntiAliasOperation::executePixel(float output[4], int x, int y, void *data) +void AntiAliasOperation::execute_pixel(float output[4], int x, int y, void *data) { MemoryBuffer *input_buffer = (MemoryBuffer *)data; - const int buffer_width = input_buffer->getWidth(), buffer_height = input_buffer->getHeight(); + const int buffer_width = input_buffer->get_width(), buffer_height = input_buffer->get_height(); if (y < 0 || y >= buffer_height || x < 0 || x >= buffer_width) { output[0] = 0.0f; } else { - const float *buffer = input_buffer->getBuffer(); + const float *buffer = input_buffer->get_buffer(); const float *row_curr = &buffer[y * buffer_width]; if (x == 0 || x == buffer_width - 1 || y == 0 || y == buffer_height - 1) { output[0] = row_curr[x]; @@ -173,27 +173,27 @@ void AntiAliasOperation::executePixel(float output[4], int x, int y, void *data) } } -void AntiAliasOperation::deinitExecution() +void AntiAliasOperation::deinit_execution() { - valueReader_ = nullptr; + value_reader_ = nullptr; } -bool AntiAliasOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool AntiAliasOperation::determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) { - rcti imageInput; - NodeOperation *operation = getInputOperation(0); - imageInput.xmax = input->xmax + 1; - imageInput.xmin = input->xmin - 1; - imageInput.ymax = input->ymax + 1; - imageInput.ymin = input->ymin - 1; - return operation->determineDependingAreaOfInterest(&imageInput, readOperation, output); + rcti image_input; + NodeOperation *operation = get_input_operation(0); + image_input.xmax = input->xmax + 1; + image_input.xmin = input->xmin - 1; + image_input.ymax = input->ymax + 1; + image_input.ymin = input->ymin - 1; + return operation->determine_depending_area_of_interest(&image_input, read_operation, output); } -void *AntiAliasOperation::initializeTileData(rcti *rect) +void *AntiAliasOperation::initialize_tile_data(rcti *rect) { - return getInputOperation(0)->initializeTileData(rect); + return get_input_operation(0)->initialize_tile_data(rect); } void AntiAliasOperation::get_area_of_interest(const int input_idx, diff --git a/source/blender/compositor/operations/COM_AntiAliasOperation.h b/source/blender/compositor/operations/COM_AntiAliasOperation.h index 48ae03a1aaa..0a6a63bf57e 100644 --- a/source/blender/compositor/operations/COM_AntiAliasOperation.h +++ b/source/blender/compositor/operations/COM_AntiAliasOperation.h @@ -33,7 +33,7 @@ class AntiAliasOperation : public MultiThreadedOperation { /** * \brief Cached reference to the reader */ - SocketReader *valueReader_; + SocketReader *value_reader_; public: AntiAliasOperation(); @@ -41,22 +41,22 @@ class AntiAliasOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; - void *initializeTileData(rcti *rect) override; + void *initialize_tile_data(rcti *rect) override; /** * Deinitialize the execution */ - void deinitExecution() override; - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + void deinit_execution() override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; diff --git a/source/blender/compositor/operations/COM_BilateralBlurOperation.cc b/source/blender/compositor/operations/COM_BilateralBlurOperation.cc index 7368dcf0cad..5f7d2432f05 100644 --- a/source/blender/compositor/operations/COM_BilateralBlurOperation.cc +++ b/source/blender/compositor/operations/COM_BilateralBlurOperation.cc @@ -22,65 +22,65 @@ namespace blender::compositor { BilateralBlurOperation::BilateralBlurOperation() { - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); this->flags.complex = true; - inputColorProgram_ = nullptr; - inputDeterminatorProgram_ = nullptr; + input_color_program_ = nullptr; + input_determinator_program_ = nullptr; } -void BilateralBlurOperation::initExecution() +void BilateralBlurOperation::init_execution() { - inputColorProgram_ = getInputSocketReader(0); - inputDeterminatorProgram_ = getInputSocketReader(1); - QualityStepHelper::initExecution(COM_QH_INCREASE); + input_color_program_ = get_input_socket_reader(0); + input_determinator_program_ = get_input_socket_reader(1); + QualityStepHelper::init_execution(COM_QH_INCREASE); } -void BilateralBlurOperation::executePixel(float output[4], int x, int y, void *data) +void BilateralBlurOperation::execute_pixel(float output[4], int x, int y, void *data) { /* Read the determinator color at x, y, * this will be used as the reference color for the determinator. */ - float determinatorReferenceColor[4]; + float determinator_reference_color[4]; float determinator[4]; - float tempColor[4]; - float blurColor[4]; - float blurDivider; + float temp_color[4]; + float blur_color[4]; + float blur_divider; float space = space_; float sigmacolor = data_->sigma_color; int minx = floor(x - space); int maxx = ceil(x + space); int miny = floor(y - space); int maxy = ceil(y + space); - float deltaColor; - inputDeterminatorProgram_->read(determinatorReferenceColor, x, y, data); + float delta_color; + input_determinator_program_->read(determinator_reference_color, x, y, data); - zero_v4(blurColor); - blurDivider = 0.0f; + zero_v4(blur_color); + blur_divider = 0.0f; /* TODO(sergey): This isn't really good bilateral filter, it should be * using gaussian bell for weights. Also sigma_color doesn't seem to be * used correct at all. */ - for (int yi = miny; yi < maxy; yi += QualityStepHelper::getStep()) { - for (int xi = minx; xi < maxx; xi += QualityStepHelper::getStep()) { + for (int yi = miny; yi < maxy; yi += QualityStepHelper::get_step()) { + for (int xi = minx; xi < maxx; xi += QualityStepHelper::get_step()) { /* Read determinator. */ - inputDeterminatorProgram_->read(determinator, xi, yi, data); - deltaColor = (fabsf(determinatorReferenceColor[0] - determinator[0]) + - fabsf(determinatorReferenceColor[1] - determinator[1]) + - /* Do not take the alpha channel into account. */ - fabsf(determinatorReferenceColor[2] - determinator[2])); - if (deltaColor < sigmacolor) { + input_determinator_program_->read(determinator, xi, yi, data); + delta_color = (fabsf(determinator_reference_color[0] - determinator[0]) + + fabsf(determinator_reference_color[1] - determinator[1]) + + /* Do not take the alpha channel into account. */ + fabsf(determinator_reference_color[2] - determinator[2])); + if (delta_color < sigmacolor) { /* Add this to the blur. */ - inputColorProgram_->read(tempColor, xi, yi, data); - add_v4_v4(blurColor, tempColor); - blurDivider += 1.0f; + input_color_program_->read(temp_color, xi, yi, data); + add_v4_v4(blur_color, temp_color); + blur_divider += 1.0f; } } } - if (blurDivider > 0.0f) { - mul_v4_v4fl(output, blurColor, 1.0f / blurDivider); + if (blur_divider > 0.0f) { + mul_v4_v4fl(output, blur_color, 1.0f / blur_divider); } else { output[0] = 0.0f; @@ -90,25 +90,24 @@ void BilateralBlurOperation::executePixel(float output[4], int x, int y, void *d } } -void BilateralBlurOperation::deinitExecution() +void BilateralBlurOperation::deinit_execution() { - inputColorProgram_ = nullptr; - inputDeterminatorProgram_ = nullptr; + input_color_program_ = nullptr; + input_determinator_program_ = nullptr; } -bool BilateralBlurOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool BilateralBlurOperation::determine_depending_area_of_interest( + rcti *input, ReadBufferOperation *read_operation, rcti *output) { - rcti newInput; + rcti new_input; int add = ceil(space_) + 1; - newInput.xmax = input->xmax + (add); - newInput.xmin = input->xmin - (add); - newInput.ymax = input->ymax + (add); - newInput.ymin = input->ymin - (add); + new_input.xmax = input->xmax + (add); + new_input.xmin = input->xmin - (add); + new_input.ymax = input->ymax + (add); + new_input.ymin = input->ymin - (add); - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } void BilateralBlurOperation::get_area_of_interest(const int UNUSED(input_idx), @@ -173,7 +172,7 @@ void BilateralBlurOperation::update_memory_buffer_partial(MemoryBuffer *output, Span<MemoryBuffer *> inputs) { PixelCursor p = {}; - p.step = QualityStepHelper::getStep(); + p.step = QualityStepHelper::get_step(); p.sigma_color = data_->sigma_color; p.input_color = inputs[0]; p.input_determinator = inputs[1]; diff --git a/source/blender/compositor/operations/COM_BilateralBlurOperation.h b/source/blender/compositor/operations/COM_BilateralBlurOperation.h index aa94df1e254..42df82a5296 100644 --- a/source/blender/compositor/operations/COM_BilateralBlurOperation.h +++ b/source/blender/compositor/operations/COM_BilateralBlurOperation.h @@ -25,8 +25,8 @@ namespace blender::compositor { class BilateralBlurOperation : public MultiThreadedOperation, public QualityStepHelper { private: - SocketReader *inputColorProgram_; - SocketReader *inputDeterminatorProgram_; + SocketReader *input_color_program_; + SocketReader *input_determinator_program_; NodeBilateralBlurData *data_; float space_; @@ -36,23 +36,23 @@ class BilateralBlurOperation : public MultiThreadedOperation, public QualityStep /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; - void setData(NodeBilateralBlurData *data) + void set_data(NodeBilateralBlurData *data) { data_ = data; space_ = data->sigma_space + data->iter; diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.cc b/source/blender/compositor/operations/COM_BlurBaseOperation.cc index 3c43a16599b..15e2ce2d1e0 100644 --- a/source/blender/compositor/operations/COM_BlurBaseOperation.cc +++ b/source/blender/compositor/operations/COM_BlurBaseOperation.cc @@ -26,11 +26,11 @@ 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->add_input_socket(data_type); + this->add_input_socket(DataType::Value); + this->add_output_socket(data_type); this->flags.complex = true; - inputProgram_ = nullptr; + input_program_ = nullptr; memset(&data_, 0, sizeof(NodeBlurData)); size_ = 1.0f; sizeavailable_ = false; @@ -41,11 +41,11 @@ BlurBaseOperation::BlurBaseOperation(DataType data_type) void BlurBaseOperation::init_data() { if (execution_model_ == eExecutionModel::FullFrame) { - updateSize(); + update_size(); } - data_.image_in_width = this->getWidth(); - data_.image_in_height = this->getHeight(); + data_.image_in_width = this->get_width(); + data_.image_in_height = this->get_height(); if (data_.relative) { int sizex, sizey; switch (data_.aspect) { @@ -66,12 +66,12 @@ void BlurBaseOperation::init_data() } } -void BlurBaseOperation::initExecution() +void BlurBaseOperation::init_execution() { - inputProgram_ = this->getInputSocketReader(0); - inputSize_ = this->getInputSocketReader(1); + input_program_ = this->get_input_socket_reader(0); + input_size_ = this->get_input_socket_reader(1); - QualityStepHelper::initExecution(COM_QH_MULTIPLY); + QualityStepHelper::init_execution(COM_QH_MULTIPLY); } float *BlurBaseOperation::make_gausstab(float rad, int size) @@ -163,13 +163,13 @@ float *BlurBaseOperation::make_dist_fac_inverse(float rad, int size, int falloff return dist_fac_invert; } -void BlurBaseOperation::deinitExecution() +void BlurBaseOperation::deinit_execution() { - inputProgram_ = nullptr; - inputSize_ = nullptr; + input_program_ = nullptr; + input_size_ = nullptr; } -void BlurBaseOperation::setData(const NodeBlurData *data) +void BlurBaseOperation::set_data(const NodeBlurData *data) { memcpy(&data_, data, sizeof(NodeBlurData)); } @@ -185,7 +185,7 @@ int BlurBaseOperation::get_blur_size(eDimension dim) const return -1; } -void BlurBaseOperation::updateSize() +void BlurBaseOperation::update_size() { if (sizeavailable_ || use_variable_size_) { return; @@ -194,7 +194,7 @@ void BlurBaseOperation::updateSize() switch (execution_model_) { case eExecutionModel::Tiled: { float result[4]; - this->getInputSocketReader(1)->readSampled(result, 0, 0, PixelSampler::Nearest); + this->get_input_socket_reader(1)->read_sampled(result, 0, 0, PixelSampler::Nearest); size_ = result[0]; break; } diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.h b/source/blender/compositor/operations/COM_BlurBaseOperation.h index b1dad2e868f..ab378983100 100644 --- a/source/blender/compositor/operations/COM_BlurBaseOperation.h +++ b/source/blender/compositor/operations/COM_BlurBaseOperation.h @@ -43,13 +43,13 @@ class BlurBaseOperation : public MultiThreadedOperation, public QualityStepHelpe #endif float *make_dist_fac_inverse(float rad, int size, int falloff); - void updateSize(); + void update_size(); /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputProgram_; - SocketReader *inputSize_; + SocketReader *input_program_; + SocketReader *input_size_; NodeBlurData data_; float size_; @@ -63,22 +63,22 @@ class BlurBaseOperation : public MultiThreadedOperation, public QualityStepHelpe /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void setData(const NodeBlurData *data); + void set_data(const NodeBlurData *data); - void setSize(float size) + void set_size(float size) { size_ = size; sizeavailable_ = true; } - void setExtendBounds(bool extend_bounds) + void set_extend_bounds(bool extend_bounds) { extend_bounds_ = extend_bounds; } diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.cc b/source/blender/compositor/operations/COM_BokehBlurOperation.cc index d00a18baf7b..80e7390e02f 100644 --- a/source/blender/compositor/operations/COM_BokehBlurOperation.cc +++ b/source/blender/compositor/operations/COM_BokehBlurOperation.cc @@ -30,20 +30,20 @@ constexpr int SIZE_INPUT_INDEX = 3; BokehBlurOperation::BokehBlurOperation() { - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Color, ResizeMode::Align); - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Color, ResizeMode::Align); + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Color); flags.complex = true; flags.open_cl = true; size_ = 1.0f; sizeavailable_ = false; - inputProgram_ = nullptr; - inputBokehProgram_ = nullptr; - inputBoundingBoxReader_ = nullptr; + input_program_ = nullptr; + input_bokeh_program_ = nullptr; + input_bounding_box_reader_ = nullptr; extend_bounds_ = false; } @@ -51,88 +51,88 @@ BokehBlurOperation::BokehBlurOperation() void BokehBlurOperation::init_data() { if (execution_model_ == eExecutionModel::FullFrame) { - updateSize(); + update_size(); } NodeOperation *bokeh = get_input_operation(BOKEH_INPUT_INDEX); - const int width = bokeh->getWidth(); - const int height = bokeh->getHeight(); + const int width = bokeh->get_width(); + const int height = bokeh->get_height(); const float dimension = MIN2(width, height); - bokehMidX_ = width / 2.0f; - bokehMidY_ = height / 2.0f; + bokeh_mid_x_ = width / 2.0f; + bokeh_mid_y_ = height / 2.0f; bokehDimension_ = dimension / 2.0f; } -void *BokehBlurOperation::initializeTileData(rcti * /*rect*/) +void *BokehBlurOperation::initialize_tile_data(rcti * /*rect*/) { - lockMutex(); + lock_mutex(); if (!sizeavailable_) { - updateSize(); + update_size(); } - void *buffer = getInputOperation(0)->initializeTileData(nullptr); - unlockMutex(); + void *buffer = get_input_operation(0)->initialize_tile_data(nullptr); + unlock_mutex(); return buffer; } -void BokehBlurOperation::initExecution() +void BokehBlurOperation::init_execution() { - initMutex(); + init_mutex(); - inputProgram_ = getInputSocketReader(0); - inputBokehProgram_ = getInputSocketReader(1); - inputBoundingBoxReader_ = getInputSocketReader(2); + input_program_ = get_input_socket_reader(0); + input_bokeh_program_ = get_input_socket_reader(1); + input_bounding_box_reader_ = get_input_socket_reader(2); - QualityStepHelper::initExecution(COM_QH_INCREASE); + QualityStepHelper::init_execution(COM_QH_INCREASE); } -void BokehBlurOperation::executePixel(float output[4], int x, int y, void *data) +void BokehBlurOperation::execute_pixel(float output[4], int x, int y, void *data) { float color_accum[4]; - float tempBoundingBox[4]; + float temp_bounding_box[4]; float bokeh[4]; - inputBoundingBoxReader_->readSampled(tempBoundingBox, x, y, PixelSampler::Nearest); - if (tempBoundingBox[0] > 0.0f) { + input_bounding_box_reader_->read_sampled(temp_bounding_box, x, y, PixelSampler::Nearest); + if (temp_bounding_box[0] > 0.0f) { float multiplier_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f}; - MemoryBuffer *inputBuffer = (MemoryBuffer *)data; - const rcti &input_rect = inputBuffer->get_rect(); - float *buffer = inputBuffer->getBuffer(); - int bufferwidth = inputBuffer->getWidth(); + MemoryBuffer *input_buffer = (MemoryBuffer *)data; + const rcti &input_rect = input_buffer->get_rect(); + float *buffer = input_buffer->get_buffer(); + int bufferwidth = input_buffer->get_width(); int bufferstartx = input_rect.xmin; int bufferstarty = input_rect.ymin; - const float max_dim = MAX2(this->getWidth(), this->getHeight()); - int pixelSize = size_ * max_dim / 100.0f; + const float max_dim = MAX2(this->get_width(), this->get_height()); + int pixel_size = size_ * max_dim / 100.0f; zero_v4(color_accum); - if (pixelSize < 2) { - inputProgram_->readSampled(color_accum, x, y, PixelSampler::Nearest); + if (pixel_size < 2) { + input_program_->read_sampled(color_accum, x, y, PixelSampler::Nearest); multiplier_accum[0] = 1.0f; multiplier_accum[1] = 1.0f; multiplier_accum[2] = 1.0f; multiplier_accum[3] = 1.0f; } - int miny = y - pixelSize; - int maxy = y + pixelSize; - int minx = x - pixelSize; - int maxx = x + pixelSize; + int miny = y - pixel_size; + int maxy = y + pixel_size; + int minx = x - pixel_size; + int maxx = x + pixel_size; miny = MAX2(miny, input_rect.ymin); minx = MAX2(minx, input_rect.xmin); maxy = MIN2(maxy, input_rect.ymax); maxx = MIN2(maxx, input_rect.xmax); - int step = getStep(); - int offsetadd = getOffsetAdd() * COM_DATA_TYPE_COLOR_CHANNELS; + int step = get_step(); + int offsetadd = get_offset_add() * COM_DATA_TYPE_COLOR_CHANNELS; - float m = bokehDimension_ / pixelSize; + float m = bokehDimension_ / pixel_size; for (int ny = miny; ny < maxy; ny += step) { 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 = bokehMidX_ - (nx - x) * m; - float v = bokehMidY_ - (ny - y) * m; - inputBokehProgram_->readSampled(bokeh, u, v, PixelSampler::Nearest); + float u = bokeh_mid_x_ - (nx - x) * m; + float v = bokeh_mid_y_ - (ny - y) * m; + input_bokeh_program_->read_sampled(bokeh, u, v, PixelSampler::Nearest); madd_v4_v4v4(color_accum, bokeh, &buffer[bufferindex]); add_v4_v4(multiplier_accum, bokeh); bufferindex += offsetadd; @@ -144,100 +144,100 @@ void BokehBlurOperation::executePixel(float output[4], int x, int y, void *data) output[3] = color_accum[3] * (1.0f / multiplier_accum[3]); } else { - inputProgram_->readSampled(output, x, y, PixelSampler::Nearest); + input_program_->read_sampled(output, x, y, PixelSampler::Nearest); } } -void BokehBlurOperation::deinitExecution() +void BokehBlurOperation::deinit_execution() { - deinitMutex(); - inputProgram_ = nullptr; - inputBokehProgram_ = nullptr; - inputBoundingBoxReader_ = nullptr; + deinit_mutex(); + input_program_ = nullptr; + input_bokeh_program_ = nullptr; + input_bounding_box_reader_ = nullptr; } -bool BokehBlurOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool BokehBlurOperation::determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) { - rcti newInput; - rcti bokehInput; - const float max_dim = MAX2(this->getWidth(), this->getHeight()); + rcti new_input; + rcti bokeh_input; + const float max_dim = MAX2(this->get_width(), this->get_height()); if (sizeavailable_) { - newInput.xmax = input->xmax + (size_ * max_dim / 100.0f); - newInput.xmin = input->xmin - (size_ * max_dim / 100.0f); - newInput.ymax = input->ymax + (size_ * max_dim / 100.0f); - newInput.ymin = input->ymin - (size_ * max_dim / 100.0f); + new_input.xmax = input->xmax + (size_ * max_dim / 100.0f); + new_input.xmin = input->xmin - (size_ * max_dim / 100.0f); + new_input.ymax = input->ymax + (size_ * max_dim / 100.0f); + new_input.ymin = input->ymin - (size_ * max_dim / 100.0f); } else { - newInput.xmax = input->xmax + (10.0f * max_dim / 100.0f); - newInput.xmin = input->xmin - (10.0f * max_dim / 100.0f); - newInput.ymax = input->ymax + (10.0f * max_dim / 100.0f); - newInput.ymin = input->ymin - (10.0f * max_dim / 100.0f); + new_input.xmax = input->xmax + (10.0f * max_dim / 100.0f); + new_input.xmin = input->xmin - (10.0f * max_dim / 100.0f); + new_input.ymax = input->ymax + (10.0f * max_dim / 100.0f); + new_input.ymin = input->ymin - (10.0f * max_dim / 100.0f); } - NodeOperation *operation = getInputOperation(1); - bokehInput.xmax = operation->getWidth(); - bokehInput.xmin = 0; - bokehInput.ymax = operation->getHeight(); - bokehInput.ymin = 0; - if (operation->determineDependingAreaOfInterest(&bokehInput, readOperation, output)) { + NodeOperation *operation = get_input_operation(1); + bokeh_input.xmax = operation->get_width(); + bokeh_input.xmin = 0; + bokeh_input.ymax = operation->get_height(); + bokeh_input.ymin = 0; + if (operation->determine_depending_area_of_interest(&bokeh_input, read_operation, output)) { return true; } - operation = getInputOperation(0); - if (operation->determineDependingAreaOfInterest(&newInput, readOperation, output)) { + operation = get_input_operation(0); + if (operation->determine_depending_area_of_interest(&new_input, read_operation, output)) { return true; } - operation = getInputOperation(2); - if (operation->determineDependingAreaOfInterest(input, readOperation, output)) { + operation = get_input_operation(2); + if (operation->determine_depending_area_of_interest(input, read_operation, output)) { return true; } if (!sizeavailable_) { - rcti sizeInput; - sizeInput.xmin = 0; - sizeInput.ymin = 0; - sizeInput.xmax = 5; - sizeInput.ymax = 5; - operation = getInputOperation(3); - if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) { + rcti size_input; + size_input.xmin = 0; + size_input.ymin = 0; + size_input.xmax = 5; + size_input.ymax = 5; + operation = get_input_operation(3); + if (operation->determine_depending_area_of_interest(&size_input, read_operation, output)) { return true; } } return false; } -void BokehBlurOperation::executeOpenCL(OpenCLDevice *device, - MemoryBuffer *outputMemoryBuffer, - cl_mem clOutputBuffer, - MemoryBuffer **inputMemoryBuffers, - std::list<cl_mem> *clMemToCleanUp, - std::list<cl_kernel> * /*clKernelsToCleanUp*/) +void BokehBlurOperation::execute_opencl(OpenCLDevice *device, + MemoryBuffer *output_memory_buffer, + cl_mem cl_output_buffer, + MemoryBuffer **input_memory_buffers, + std::list<cl_mem> *cl_mem_to_clean_up, + std::list<cl_kernel> * /*cl_kernels_to_clean_up*/) { - cl_kernel kernel = device->COM_clCreateKernel("bokehBlurKernel", nullptr); + cl_kernel kernel = device->COM_cl_create_kernel("bokeh_blur_kernel", nullptr); if (!sizeavailable_) { - updateSize(); + update_size(); } - const float max_dim = MAX2(this->getWidth(), this->getHeight()); + const float max_dim = MAX2(this->get_width(), this->get_height()); cl_int radius = size_ * max_dim / 100.0f; - cl_int step = this->getStep(); - - device->COM_clAttachMemoryBufferToKernelParameter( - kernel, 0, -1, clMemToCleanUp, inputMemoryBuffers, inputBoundingBoxReader_); - device->COM_clAttachMemoryBufferToKernelParameter( - kernel, 1, 4, clMemToCleanUp, inputMemoryBuffers, inputProgram_); - device->COM_clAttachMemoryBufferToKernelParameter( - kernel, 2, -1, clMemToCleanUp, inputMemoryBuffers, inputBokehProgram_); - device->COM_clAttachOutputMemoryBufferToKernelParameter(kernel, 3, clOutputBuffer); - device->COM_clAttachMemoryBufferOffsetToKernelParameter(kernel, 5, outputMemoryBuffer); + cl_int step = this->get_step(); + + device->COM_cl_attach_memory_buffer_to_kernel_parameter( + kernel, 0, -1, cl_mem_to_clean_up, input_memory_buffers, input_bounding_box_reader_); + device->COM_cl_attach_memory_buffer_to_kernel_parameter( + kernel, 1, 4, cl_mem_to_clean_up, input_memory_buffers, input_program_); + device->COM_cl_attach_memory_buffer_to_kernel_parameter( + kernel, 2, -1, cl_mem_to_clean_up, input_memory_buffers, input_bokeh_program_); + device->COM_cl_attach_output_memory_buffer_to_kernel_parameter(kernel, 3, cl_output_buffer); + device->COM_cl_attach_memory_buffer_offset_to_kernel_parameter(kernel, 5, output_memory_buffer); clSetKernelArg(kernel, 6, sizeof(cl_int), &radius); clSetKernelArg(kernel, 7, sizeof(cl_int), &step); - device->COM_clAttachSizeToKernelParameter(kernel, 8, this); + device->COM_cl_attach_size_to_kernel_parameter(kernel, 8, this); - device->COM_clEnqueueRange(kernel, outputMemoryBuffer, 9, this); + device->COM_cl_enqueue_range(kernel, output_memory_buffer, 9, this); } -void BokehBlurOperation::updateSize() +void BokehBlurOperation::update_size() { if (sizeavailable_) { return; @@ -246,7 +246,7 @@ void BokehBlurOperation::updateSize() switch (execution_model_) { case eExecutionModel::Tiled: { float result[4]; - this->getInputSocketReader(3)->readSampled(result, 0, 0, PixelSampler::Nearest); + this->get_input_socket_reader(3)->read_sampled(result, 0, 0, PixelSampler::Nearest); size_ = result[0]; CLAMP(size_, 0.0f, 10.0f); break; @@ -298,7 +298,7 @@ void BokehBlurOperation::get_area_of_interest(const int input_idx, { switch (input_idx) { case IMAGE_INPUT_INDEX: { - const float max_dim = MAX2(this->getWidth(), this->getHeight()); + const float max_dim = MAX2(this->get_width(), this->get_height()); const float add_size = size_ * max_dim / 100.0f; r_input_area.xmin = output_area.xmin - add_size; r_input_area.xmax = output_area.xmax + add_size; @@ -307,7 +307,7 @@ void BokehBlurOperation::get_area_of_interest(const int input_idx, break; } case BOKEH_INPUT_INDEX: { - NodeOperation *bokeh_input = getInputOperation(BOKEH_INPUT_INDEX); + NodeOperation *bokeh_input = get_input_operation(BOKEH_INPUT_INDEX); r_input_area = bokeh_input->get_canvas(); break; } @@ -325,7 +325,7 @@ void BokehBlurOperation::update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span<MemoryBuffer *> inputs) { - const float max_dim = MAX2(this->getWidth(), this->getHeight()); + const float max_dim = MAX2(this->get_width(), this->get_height()); const int pixel_size = size_ * max_dim / 100.0f; const float m = bokehDimension_ / pixel_size; @@ -356,15 +356,15 @@ void BokehBlurOperation::update_memory_buffer_partial(MemoryBuffer *output, const int maxy = MIN2(y + pixel_size, image_rect.ymax); const int minx = MAX2(x - pixel_size, image_rect.xmin); const int maxx = MIN2(x + pixel_size, image_rect.xmax); - const int step = getStep(); + const int step = get_step(); const int elem_stride = image_input->elem_stride * step; const int row_stride = image_input->row_stride * step; const float *row_color = image_input->get_elem(minx, miny); for (int ny = miny; ny < maxy; ny += step, row_color += row_stride) { const float *color = row_color; - const float v = bokehMidY_ - (ny - y) * m; + const float v = bokeh_mid_y_ - (ny - y) * m; for (int nx = minx; nx < maxx; nx += step, color += elem_stride) { - const float u = bokehMidX_ - (nx - x) * m; + const float u = bokeh_mid_x_ - (nx - x) * m; float bokeh[4]; bokeh_input->read_elem_checked(u, v, bokeh); madd_v4_v4v4(color_accum, bokeh, color); diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.h b/source/blender/compositor/operations/COM_BokehBlurOperation.h index 0b70b7a714a..5f6a880f890 100644 --- a/source/blender/compositor/operations/COM_BokehBlurOperation.h +++ b/source/blender/compositor/operations/COM_BokehBlurOperation.h @@ -25,15 +25,15 @@ namespace blender::compositor { class BokehBlurOperation : public MultiThreadedOperation, public QualityStepHelper { private: - SocketReader *inputProgram_; - SocketReader *inputBokehProgram_; - SocketReader *inputBoundingBoxReader_; - void updateSize(); + SocketReader *input_program_; + SocketReader *input_bokeh_program_; + SocketReader *input_bounding_box_reader_; + void update_size(); float size_; bool sizeavailable_; - float bokehMidX_; - float bokehMidY_; + float bokeh_mid_x_; + float bokeh_mid_y_; float bokehDimension_; bool extend_bounds_; @@ -42,40 +42,40 @@ class BokehBlurOperation : public MultiThreadedOperation, public QualityStepHelp void init_data() override; - void *initializeTileData(rcti *rect) override; + void *initialize_tile_data(rcti *rect) override; /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; - void setSize(float size) + void set_size(float size) { size_ = size; sizeavailable_ = true; } - void executeOpenCL(OpenCLDevice *device, - MemoryBuffer *outputMemoryBuffer, - cl_mem clOutputBuffer, - MemoryBuffer **inputMemoryBuffers, - std::list<cl_mem> *clMemToCleanUp, - std::list<cl_kernel> *clKernelsToCleanUp) override; + void execute_opencl(OpenCLDevice *device, + MemoryBuffer *output_memory_buffer, + cl_mem cl_output_buffer, + MemoryBuffer **input_memory_buffers, + std::list<cl_mem> *cl_mem_to_clean_up, + std::list<cl_kernel> *cl_kernels_to_clean_up) override; - void setExtendBounds(bool extend_bounds) + void set_extend_bounds(bool extend_bounds) { extend_bounds_ = extend_bounds; } diff --git a/source/blender/compositor/operations/COM_BokehImageOperation.cc b/source/blender/compositor/operations/COM_BokehImageOperation.cc index 5389fa633b0..9e7c1162052 100644 --- a/source/blender/compositor/operations/COM_BokehImageOperation.cc +++ b/source/blender/compositor/operations/COM_BokehImageOperation.cc @@ -22,91 +22,91 @@ namespace blender::compositor { BokehImageOperation::BokehImageOperation() { - this->addOutputSocket(DataType::Color); - deleteData_ = false; + this->add_output_socket(DataType::Color); + delete_data_ = false; } -void BokehImageOperation::initExecution() +void BokehImageOperation::init_execution() { - center_[0] = getWidth() / 2; - center_[1] = getHeight() / 2; - inverseRounding_ = 1.0f - data_->rounding; - circularDistance_ = getWidth() / 2; - flapRad_ = (float)(M_PI * 2) / data_->flaps; - flapRadAdd_ = data_->angle; - while (flapRadAdd_ < 0.0f) { - flapRadAdd_ += (float)(M_PI * 2.0); + center_[0] = get_width() / 2; + center_[1] = get_height() / 2; + inverse_rounding_ = 1.0f - data_->rounding; + circular_distance_ = get_width() / 2; + flap_rad_ = (float)(M_PI * 2) / data_->flaps; + flap_rad_add_ = data_->angle; + while (flap_rad_add_ < 0.0f) { + flap_rad_add_ += (float)(M_PI * 2.0); } - while (flapRadAdd_ > (float)M_PI) { - flapRadAdd_ -= (float)(M_PI * 2.0); + while (flap_rad_add_ > (float)M_PI) { + flap_rad_add_ -= (float)(M_PI * 2.0); } } -void BokehImageOperation::detemineStartPointOfFlap(float r[2], int flapNumber, float distance) +void BokehImageOperation::detemine_start_point_of_flap(float r[2], int flap_number, float distance) { - r[0] = sinf(flapRad_ * flapNumber + flapRadAdd_) * distance + center_[0]; - r[1] = cosf(flapRad_ * flapNumber + flapRadAdd_) * distance + center_[1]; + r[0] = sinf(flap_rad_ * flap_number + flap_rad_add_) * distance + center_[0]; + r[1] = cosf(flap_rad_ * flap_number + flap_rad_add_) * distance + center_[1]; } -float BokehImageOperation::isInsideBokeh(float distance, float x, float y) +float BokehImageOperation::is_inside_bokeh(float distance, float x, float y) { - float insideBokeh = 0.0f; + float inside_bokeh = 0.0f; const float deltaX = x - center_[0]; const float deltaY = y - center_[1]; - float closestPoint[2]; - float lineP1[2]; - float lineP2[2]; + float closest_point[2]; + float line_p1[2]; + float line_p2[2]; float point[2]; point[0] = x; point[1] = y; - const float distanceToCenter = len_v2v2(point, center_); + const float distance_to_center = len_v2v2(point, center_); const float bearing = (atan2f(deltaX, deltaY) + (float)(M_PI * 2.0)); - int flapNumber = (int)((bearing - flapRadAdd_) / flapRad_); + int flap_number = (int)((bearing - flap_rad_add_) / flap_rad_); - detemineStartPointOfFlap(lineP1, flapNumber, distance); - detemineStartPointOfFlap(lineP2, flapNumber + 1, distance); - closest_to_line_v2(closestPoint, point, lineP1, lineP2); + detemine_start_point_of_flap(line_p1, flap_number, distance); + detemine_start_point_of_flap(line_p2, flap_number + 1, distance); + closest_to_line_v2(closest_point, point, line_p1, line_p2); - const float distanceLineToCenter = len_v2v2(center_, closestPoint); - const float distanceRoundingToCenter = inverseRounding_ * distanceLineToCenter + - data_->rounding * distance; + const float distance_line_to_center = len_v2v2(center_, closest_point); + const float distance_rounding_to_center = inverse_rounding_ * distance_line_to_center + + data_->rounding * distance; - const float catadioptricDistanceToCenter = distanceRoundingToCenter * data_->catadioptric; - if (distanceRoundingToCenter >= distanceToCenter && - catadioptricDistanceToCenter <= distanceToCenter) { - if (distanceRoundingToCenter - distanceToCenter < 1.0f) { - insideBokeh = (distanceRoundingToCenter - distanceToCenter); + const float catadioptric_distance_to_center = distance_rounding_to_center * data_->catadioptric; + if (distance_rounding_to_center >= distance_to_center && + catadioptric_distance_to_center <= distance_to_center) { + if (distance_rounding_to_center - distance_to_center < 1.0f) { + inside_bokeh = (distance_rounding_to_center - distance_to_center); } else if (data_->catadioptric != 0.0f && - distanceToCenter - catadioptricDistanceToCenter < 1.0f) { - insideBokeh = (distanceToCenter - catadioptricDistanceToCenter); + distance_to_center - catadioptric_distance_to_center < 1.0f) { + inside_bokeh = (distance_to_center - catadioptric_distance_to_center); } else { - insideBokeh = 1.0f; + inside_bokeh = 1.0f; } } - return insideBokeh; + return inside_bokeh; } -void BokehImageOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler /*sampler*/) +void BokehImageOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler /*sampler*/) { float shift = data_->lensshift; float shift2 = shift / 2.0f; - float distance = circularDistance_; - float insideBokehMax = isInsideBokeh(distance, x, y); - float insideBokehMed = isInsideBokeh(distance - fabsf(shift2 * distance), x, y); - float insideBokehMin = isInsideBokeh(distance - fabsf(shift * distance), x, y); + float distance = circular_distance_; + float inside_bokeh_max = is_inside_bokeh(distance, x, y); + float inside_bokeh_med = is_inside_bokeh(distance - fabsf(shift2 * distance), x, y); + float inside_bokeh_min = is_inside_bokeh(distance - fabsf(shift * distance), x, y); if (shift < 0) { - output[0] = insideBokehMax; - output[1] = insideBokehMed; - output[2] = insideBokehMin; + output[0] = inside_bokeh_max; + output[1] = inside_bokeh_med; + output[2] = inside_bokeh_min; } else { - output[0] = insideBokehMin; - output[1] = insideBokehMed; - output[2] = insideBokehMax; + output[0] = inside_bokeh_min; + output[1] = inside_bokeh_med; + output[2] = inside_bokeh_max; } - output[3] = (insideBokehMax + insideBokehMed + insideBokehMin) / 3.0f; + output[3] = (inside_bokeh_max + inside_bokeh_med + inside_bokeh_min) / 3.0f; } void BokehImageOperation::update_memory_buffer_partial(MemoryBuffer *output, @@ -115,28 +115,29 @@ void BokehImageOperation::update_memory_buffer_partial(MemoryBuffer *output, { const float shift = data_->lensshift; const float shift2 = shift / 2.0f; - const float distance = circularDistance_; + const float distance = circular_distance_; for (BuffersIterator<float> it = output->iterate_with({}, area); !it.is_end(); ++it) { - const float insideBokehMax = isInsideBokeh(distance, it.x, it.y); - const float insideBokehMed = isInsideBokeh(distance - fabsf(shift2 * distance), it.x, it.y); - const float insideBokehMin = isInsideBokeh(distance - fabsf(shift * distance), it.x, it.y); + const float inside_bokeh_max = is_inside_bokeh(distance, it.x, it.y); + const float inside_bokeh_med = is_inside_bokeh( + distance - fabsf(shift2 * distance), it.x, it.y); + const float inside_bokeh_min = is_inside_bokeh(distance - fabsf(shift * distance), it.x, it.y); if (shift < 0) { - it.out[0] = insideBokehMax; - it.out[1] = insideBokehMed; - it.out[2] = insideBokehMin; + it.out[0] = inside_bokeh_max; + it.out[1] = inside_bokeh_med; + it.out[2] = inside_bokeh_min; } else { - it.out[0] = insideBokehMin; - it.out[1] = insideBokehMed; - it.out[2] = insideBokehMax; + it.out[0] = inside_bokeh_min; + it.out[1] = inside_bokeh_med; + it.out[2] = inside_bokeh_max; } - it.out[3] = (insideBokehMax + insideBokehMed + insideBokehMin) / 3.0f; + it.out[3] = (inside_bokeh_max + inside_bokeh_med + inside_bokeh_min) / 3.0f; } } -void BokehImageOperation::deinitExecution() +void BokehImageOperation::deinit_execution() { - if (deleteData_) { + if (delete_data_) { if (data_) { delete data_; data_ = nullptr; diff --git a/source/blender/compositor/operations/COM_BokehImageOperation.h b/source/blender/compositor/operations/COM_BokehImageOperation.h index de1c05fe360..6c7818724b3 100644 --- a/source/blender/compositor/operations/COM_BokehImageOperation.h +++ b/source/blender/compositor/operations/COM_BokehImageOperation.h @@ -64,36 +64,36 @@ class BokehImageOperation : public MultiThreadedOperation { /** * \brief 1.0-rounding */ - float inverseRounding_; + float inverse_rounding_; /** * \brief distance of a full circle lens */ - float circularDistance_; + float circular_distance_; /** * \brief radius when the first flap starts */ - float flapRad_; + float flap_rad_; /** * \brief radians of a single flap */ - float flapRadAdd_; + float flap_rad_add_; /** * \brief should the data_ field by deleted when this operation is finished */ - bool deleteData_; + bool delete_data_; /** * \brief determine the coordinate of a flap corner. * * \param r: result in bokeh-image space are stored [x,y] - * \param flapNumber: the flap number to calculate + * \param flap_number: the flap number to calculate * \param distance: the lens distance is used to simulate lens shifts */ - void detemineStartPointOfFlap(float r[2], int flapNumber, float distance); + void detemine_start_point_of_flap(float r[2], int flap_number, float distance); /** * \brief Determine if a coordinate is inside the bokeh image @@ -104,7 +104,7 @@ class BokehImageOperation : public MultiThreadedOperation { * \param y: the y coordinate of the pixel to evaluate * \return float range 0..1 0 is completely outside */ - float isInsideBokeh(float distance, float x, float y); + float is_inside_bokeh(float distance, float x, float y); public: BokehImageOperation(); @@ -112,21 +112,21 @@ class BokehImageOperation : public MultiThreadedOperation { /** * \brief The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; /** * \brief Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * \brief Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; /** * \brief determine the resolution of this operation. currently fixed at [COM_BLUR_BOKEH_PIXELS, - * COM_BLUR_BOKEH_PIXELS] \param resolution: \param preferredResolution: + * COM_BLUR_BOKEH_PIXELS] \param resolution: \param preferred_resolution: */ void determine_canvas(const rcti &preferred_area, rcti &r_area) override; @@ -134,21 +134,21 @@ class BokehImageOperation : public MultiThreadedOperation { * \brief set the node data * \param data: */ - void setData(NodeBokehImage *data) + void set_data(NodeBokehImage *data) { data_ = data; } /** - * \brief deleteDataOnFinish + * \brief delete_data_on_finish * * There are cases that the compositor uses this operation on its own (see defocus node) - * the deleteDataOnFinish must only be called when the data has been created by the compositor. - *It should not be called when the data has been created by the node-editor/user. + * the delete_data_on_finish must only be called when the data has been created by the + *compositor. It should not be called when the data has been created by the node-editor/user. */ - void deleteDataOnFinish() + void delete_data_on_finish() { - deleteData_ = true; + delete_data_ = true; } void update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_BoxMaskOperation.cc b/source/blender/compositor/operations/COM_BoxMaskOperation.cc index 7263e6a1a59..adfe7fcd87a 100644 --- a/source/blender/compositor/operations/COM_BoxMaskOperation.cc +++ b/source/blender/compositor/operations/COM_BoxMaskOperation.cc @@ -22,66 +22,69 @@ namespace blender::compositor { BoxMaskOperation::BoxMaskOperation() { - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Value); - inputMask_ = nullptr; - inputValue_ = nullptr; + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Value); + input_mask_ = nullptr; + input_value_ = nullptr; cosine_ = 0.0f; sine_ = 0.0f; } -void BoxMaskOperation::initExecution() +void BoxMaskOperation::init_execution() { - inputMask_ = this->getInputSocketReader(0); - inputValue_ = this->getInputSocketReader(1); + input_mask_ = this->get_input_socket_reader(0); + input_value_ = this->get_input_socket_reader(1); const double rad = (double)data_->rotation; cosine_ = cos(rad); sine_ = sin(rad); - aspectRatio_ = ((float)this->getWidth()) / this->getHeight(); + aspect_ratio_ = ((float)this->get_width()) / this->get_height(); } -void BoxMaskOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) +void BoxMaskOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputMask[4]; - float inputValue[4]; + float input_mask[4]; + float input_value[4]; - float rx = x / this->getWidth(); - float ry = y / this->getHeight(); + float rx = x / this->get_width(); + float ry = y / this->get_height(); - const float dy = (ry - data_->y) / aspectRatio_; + const float dy = (ry - data_->y) / aspect_ratio_; const float dx = rx - data_->x; rx = data_->x + (cosine_ * dx + sine_ * dy); ry = data_->y + (-sine_ * dx + cosine_ * dy); - inputMask_->readSampled(inputMask, x, y, sampler); - inputValue_->readSampled(inputValue, x, y, sampler); + input_mask_->read_sampled(input_mask, x, y, sampler); + input_value_->read_sampled(input_value, x, y, sampler); - float halfHeight = data_->height / 2.0f; - float halfWidth = data_->width / 2.0f; - bool inside = (rx > data_->x - halfWidth && rx < data_->x + halfWidth && - ry > data_->y - halfHeight && ry < data_->y + halfHeight); + float half_height = data_->height / 2.0f; + float half_width = data_->width / 2.0f; + bool inside = (rx > data_->x - half_width && rx < data_->x + half_width && + ry > data_->y - half_height && ry < data_->y + half_height); - switch (maskType_) { + switch (mask_type_) { case CMP_NODE_MASKTYPE_ADD: if (inside) { - output[0] = MAX2(inputMask[0], inputValue[0]); + output[0] = MAX2(input_mask[0], input_value[0]); } else { - output[0] = inputMask[0]; + output[0] = input_mask[0]; } break; case CMP_NODE_MASKTYPE_SUBTRACT: if (inside) { - output[0] = inputMask[0] - inputValue[0]; + output[0] = input_mask[0] - input_value[0]; CLAMP(output[0], 0, 1); } else { - output[0] = inputMask[0]; + output[0] = input_mask[0]; } break; case CMP_NODE_MASKTYPE_MULTIPLY: if (inside) { - output[0] = inputMask[0] * inputValue[0]; + output[0] = input_mask[0] * input_value[0]; } else { output[0] = 0; @@ -89,15 +92,15 @@ void BoxMaskOperation::executePixelSampled(float output[4], float x, float y, Pi break; case CMP_NODE_MASKTYPE_NOT: if (inside) { - if (inputMask[0] > 0.0f) { + if (input_mask[0] > 0.0f) { output[0] = 0; } else { - output[0] = inputValue[0]; + output[0] = input_value[0]; } } else { - output[0] = inputMask[0]; + output[0] = input_mask[0]; } break; } @@ -108,7 +111,7 @@ void BoxMaskOperation::update_memory_buffer_partial(MemoryBuffer *output, Span<MemoryBuffer *> inputs) { MaskFunc mask_func; - switch (maskType_) { + switch (mask_type_) { case CMP_NODE_MASKTYPE_ADD: mask_func = [](const bool is_inside, const float *mask, const float *value) { return is_inside ? MAX2(mask[0], value[0]) : mask[0]; @@ -141,13 +144,13 @@ void BoxMaskOperation::apply_mask(MemoryBuffer *output, Span<MemoryBuffer *> inputs, MaskFunc mask_func) { - const float op_w = this->getWidth(); - const float op_h = this->getHeight(); + const float op_w = this->get_width(); + const float op_h = this->get_height(); const float half_w = data_->width / 2.0f; const float half_h = data_->height / 2.0f; for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) { const float op_ry = it.y / op_h; - const float dy = (op_ry - data_->y) / aspectRatio_; + const float dy = (op_ry - data_->y) / aspect_ratio_; const float op_rx = it.x / op_w; const float dx = op_rx - data_->x; const float rx = data_->x + (cosine_ * dx + sine_ * dy); @@ -161,10 +164,10 @@ void BoxMaskOperation::apply_mask(MemoryBuffer *output, } } -void BoxMaskOperation::deinitExecution() +void BoxMaskOperation::deinit_execution() { - inputMask_ = nullptr; - inputValue_ = nullptr; + input_mask_ = nullptr; + input_value_ = nullptr; } } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_BoxMaskOperation.h b/source/blender/compositor/operations/COM_BoxMaskOperation.h index 458cdf7ee16..4aee88556ee 100644 --- a/source/blender/compositor/operations/COM_BoxMaskOperation.h +++ b/source/blender/compositor/operations/COM_BoxMaskOperation.h @@ -27,15 +27,15 @@ class BoxMaskOperation : public MultiThreadedOperation { using MaskFunc = std::function<float(bool is_inside, const float *mask, const float *value)>; /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputMask_; - SocketReader *inputValue_; + SocketReader *input_mask_; + SocketReader *input_value_; float sine_; float cosine_; - float aspectRatio_; - int maskType_; + float aspect_ratio_; + int mask_type_; NodeBoxMask *data_; @@ -45,26 +45,26 @@ class BoxMaskOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void setData(NodeBoxMask *data) + void set_data(NodeBoxMask *data) { data_ = data; } - void setMaskType(int maskType) + void set_mask_type(int mask_type) { - maskType_ = maskType; + mask_type_ = mask_type; } void update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_BrightnessOperation.cc b/source/blender/compositor/operations/COM_BrightnessOperation.cc index 77f30331767..a445bb122c2 100644 --- a/source/blender/compositor/operations/COM_BrightnessOperation.cc +++ b/source/blender/compositor/operations/COM_BrightnessOperation.cc @@ -22,41 +22,41 @@ namespace blender::compositor { BrightnessOperation::BrightnessOperation() { - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Color); - inputProgram_ = nullptr; + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Color); + input_program_ = nullptr; use_premultiply_ = false; flags.can_be_constant = true; } -void BrightnessOperation::setUsePremultiply(bool use_premultiply) +void BrightnessOperation::set_use_premultiply(bool use_premultiply) { use_premultiply_ = use_premultiply; } -void BrightnessOperation::initExecution() +void BrightnessOperation::init_execution() { - inputProgram_ = this->getInputSocketReader(0); - inputBrightnessProgram_ = this->getInputSocketReader(1); - inputContrastProgram_ = this->getInputSocketReader(2); + input_program_ = this->get_input_socket_reader(0); + input_brightness_program_ = this->get_input_socket_reader(1); + input_contrast_program_ = this->get_input_socket_reader(2); } -void BrightnessOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void BrightnessOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue[4]; + float input_value[4]; float a, b; - float inputBrightness[4]; - float inputContrast[4]; - inputProgram_->readSampled(inputValue, x, y, sampler); - inputBrightnessProgram_->readSampled(inputBrightness, x, y, sampler); - inputContrastProgram_->readSampled(inputContrast, x, y, sampler); - float brightness = inputBrightness[0]; - float contrast = inputContrast[0]; + float input_brightness[4]; + float input_contrast[4]; + input_program_->read_sampled(input_value, x, y, sampler); + input_brightness_program_->read_sampled(input_brightness, x, y, sampler); + input_contrast_program_->read_sampled(input_contrast, x, y, sampler); + float brightness = input_brightness[0]; + float contrast = input_contrast[0]; brightness /= 100.0f; float delta = contrast / 200.0f; /* @@ -75,12 +75,12 @@ void BrightnessOperation::executePixelSampled(float output[4], b = a * brightness + delta; } if (use_premultiply_) { - premul_to_straight_v4(inputValue); + premul_to_straight_v4(input_value); } - output[0] = a * inputValue[0] + b; - output[1] = a * inputValue[1] + b; - output[2] = a * inputValue[2] + b; - output[3] = inputValue[3]; + output[0] = a * input_value[0] + b; + output[1] = a * input_value[1] + b; + output[2] = a * input_value[2] + b; + output[3] = input_value[3]; if (use_premultiply_) { straight_to_premul_v4(output); } @@ -130,11 +130,11 @@ void BrightnessOperation::update_memory_buffer_partial(MemoryBuffer *output, } } -void BrightnessOperation::deinitExecution() +void BrightnessOperation::deinit_execution() { - inputProgram_ = nullptr; - inputBrightnessProgram_ = nullptr; - inputContrastProgram_ = nullptr; + input_program_ = nullptr; + input_brightness_program_ = nullptr; + input_contrast_program_ = nullptr; } } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_BrightnessOperation.h b/source/blender/compositor/operations/COM_BrightnessOperation.h index 0ecb8473319..003baa96613 100644 --- a/source/blender/compositor/operations/COM_BrightnessOperation.h +++ b/source/blender/compositor/operations/COM_BrightnessOperation.h @@ -25,11 +25,11 @@ namespace blender::compositor { class BrightnessOperation : public MultiThreadedOperation { private: /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputProgram_; - SocketReader *inputBrightnessProgram_; - SocketReader *inputContrastProgram_; + SocketReader *input_program_; + SocketReader *input_brightness_program_; + SocketReader *input_contrast_program_; bool use_premultiply_; @@ -39,19 +39,19 @@ class BrightnessOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void setUsePremultiply(bool use_premultiply); + void set_use_premultiply(bool use_premultiply); void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, diff --git a/source/blender/compositor/operations/COM_CalculateMeanOperation.cc b/source/blender/compositor/operations/COM_CalculateMeanOperation.cc index ce2351cf759..f759ba5ccef 100644 --- a/source/blender/compositor/operations/COM_CalculateMeanOperation.cc +++ b/source/blender/compositor/operations/COM_CalculateMeanOperation.cc @@ -26,67 +26,66 @@ namespace blender::compositor { CalculateMeanOperation::CalculateMeanOperation() { - this->addInputSocket(DataType::Color, ResizeMode::Align); - this->addOutputSocket(DataType::Value); - imageReader_ = nullptr; + this->add_input_socket(DataType::Color, ResizeMode::Align); + this->add_output_socket(DataType::Value); + image_reader_ = nullptr; iscalculated_ = false; setting_ = 1; this->flags.complex = true; } -void CalculateMeanOperation::initExecution() +void CalculateMeanOperation::init_execution() { - imageReader_ = this->getInputSocketReader(0); + image_reader_ = this->get_input_socket_reader(0); iscalculated_ = false; - NodeOperation::initMutex(); + NodeOperation::init_mutex(); } -void CalculateMeanOperation::executePixel(float output[4], int /*x*/, int /*y*/, void * /*data*/) +void CalculateMeanOperation::execute_pixel(float output[4], int /*x*/, int /*y*/, void * /*data*/) { output[0] = result_; } -void CalculateMeanOperation::deinitExecution() +void CalculateMeanOperation::deinit_execution() { - imageReader_ = nullptr; - NodeOperation::deinitMutex(); + image_reader_ = nullptr; + NodeOperation::deinit_mutex(); } -bool CalculateMeanOperation::determineDependingAreaOfInterest(rcti * /*input*/, - ReadBufferOperation *readOperation, - rcti *output) +bool CalculateMeanOperation::determine_depending_area_of_interest( + rcti * /*input*/, ReadBufferOperation *read_operation, rcti *output) { - rcti imageInput; + rcti image_input; if (iscalculated_) { return false; } - NodeOperation *operation = getInputOperation(0); - imageInput.xmax = operation->getWidth(); - imageInput.xmin = 0; - imageInput.ymax = operation->getHeight(); - imageInput.ymin = 0; - if (operation->determineDependingAreaOfInterest(&imageInput, readOperation, output)) { + NodeOperation *operation = get_input_operation(0); + image_input.xmax = operation->get_width(); + image_input.xmin = 0; + image_input.ymax = operation->get_height(); + image_input.ymin = 0; + if (operation->determine_depending_area_of_interest(&image_input, read_operation, output)) { return true; } return false; } -void *CalculateMeanOperation::initializeTileData(rcti *rect) +void *CalculateMeanOperation::initialize_tile_data(rcti *rect) { - lockMutex(); + lock_mutex(); if (!iscalculated_) { - MemoryBuffer *tile = (MemoryBuffer *)imageReader_->initializeTileData(rect); - calculateMean(tile); + MemoryBuffer *tile = (MemoryBuffer *)image_reader_->initialize_tile_data(rect); + calculate_mean(tile); iscalculated_ = true; } - unlockMutex(); + unlock_mutex(); return nullptr; } -void CalculateMeanOperation::calculateMean(MemoryBuffer *tile) +void CalculateMeanOperation::calculate_mean(MemoryBuffer *tile) { result_ = 0.0f; - float *buffer = tile->getBuffer(); - int size = tile->getWidth() * tile->getHeight(); + float *buffer = tile->get_buffer(); + int size = tile->get_width() * tile->get_height(); int pixels = 0; float sum = 0.0f; for (int i = 0, offset = 0; i < size; i++, offset += 4) { @@ -128,7 +127,7 @@ void CalculateMeanOperation::calculateMean(MemoryBuffer *tile) result_ = sum / pixels; } -void CalculateMeanOperation::setSetting(int setting) +void CalculateMeanOperation::set_setting(int setting) { setting_ = setting; switch (setting) { diff --git a/source/blender/compositor/operations/COM_CalculateMeanOperation.h b/source/blender/compositor/operations/COM_CalculateMeanOperation.h index a34bab45211..7c4fafb2f27 100644 --- a/source/blender/compositor/operations/COM_CalculateMeanOperation.h +++ b/source/blender/compositor/operations/COM_CalculateMeanOperation.h @@ -39,7 +39,7 @@ class CalculateMeanOperation : public MultiThreadedOperation { /** * \brief Cached reference to the reader */ - SocketReader *imageReader_; + SocketReader *image_reader_; bool iscalculated_; float result_; @@ -52,24 +52,24 @@ class CalculateMeanOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; - void *initializeTileData(rcti *rect) override; + void *initialize_tile_data(rcti *rect) override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; - void setSetting(int setting); + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; + void set_setting(int setting); void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; @@ -82,7 +82,7 @@ class CalculateMeanOperation : public MultiThreadedOperation { Span<MemoryBuffer *> inputs) override; protected: - void calculateMean(MemoryBuffer *tile); + void calculate_mean(MemoryBuffer *tile); float calc_mean(const MemoryBuffer *input); private: diff --git a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cc b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cc index 3c8d7f21801..06b3114845e 100644 --- a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cc +++ b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cc @@ -24,23 +24,23 @@ namespace blender::compositor { -void CalculateStandardDeviationOperation::executePixel(float output[4], - int /*x*/, - int /*y*/, - void * /*data*/) +void CalculateStandardDeviationOperation::execute_pixel(float output[4], + int /*x*/, + int /*y*/, + void * /*data*/) { - output[0] = standardDeviation_; + output[0] = standard_deviation_; } -void *CalculateStandardDeviationOperation::initializeTileData(rcti *rect) +void *CalculateStandardDeviationOperation::initialize_tile_data(rcti *rect) { - lockMutex(); + lock_mutex(); if (!iscalculated_) { - MemoryBuffer *tile = (MemoryBuffer *)imageReader_->initializeTileData(rect); - CalculateMeanOperation::calculateMean(tile); - standardDeviation_ = 0.0f; - float *buffer = tile->getBuffer(); - int size = tile->getWidth() * tile->getHeight(); + MemoryBuffer *tile = (MemoryBuffer *)image_reader_->initialize_tile_data(rect); + CalculateMeanOperation::calculate_mean(tile); + standard_deviation_ = 0.0f; + float *buffer = tile->get_buffer(); + int size = tile->get_width() * tile->get_height(); int pixels = 0; float sum = 0.0f; float mean = result_; @@ -89,10 +89,10 @@ void *CalculateStandardDeviationOperation::initializeTileData(rcti *rect) } } } - standardDeviation_ = sqrt(sum / (float)(pixels - 1)); + standard_deviation_ = sqrt(sum / (float)(pixels - 1)); iscalculated_ = true; } - unlockMutex(); + unlock_mutex(); return nullptr; } @@ -112,8 +112,8 @@ void CalculateStandardDeviationOperation::update_memory_buffer_started( join.sum += chunk.sum; join.num_pixels += chunk.num_pixels; }); - standardDeviation_ = total.num_pixels <= 1 ? 0.0f : - sqrt(total.sum / (float)(total.num_pixels - 1)); + standard_deviation_ = total.num_pixels <= 1 ? 0.0f : + sqrt(total.sum / (float)(total.num_pixels - 1)); iscalculated_ = true; } } @@ -121,7 +121,7 @@ void CalculateStandardDeviationOperation::update_memory_buffer_started( void CalculateStandardDeviationOperation::update_memory_buffer_partial( MemoryBuffer *output, const rcti &area, Span<MemoryBuffer *> UNUSED(inputs)) { - output->fill(area, &standardDeviation_); + output->fill(area, &standard_deviation_); } using PixelsSum = CalculateMeanOperation::PixelsSum; diff --git a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.h b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.h index 29d9c45c986..95b9eb21982 100644 --- a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.h +++ b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.h @@ -31,15 +31,15 @@ namespace blender::compositor { */ class CalculateStandardDeviationOperation : public CalculateMeanOperation { protected: - float standardDeviation_; + float standard_deviation_; public: /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; - void *initializeTileData(rcti *rect) override; + void *initialize_tile_data(rcti *rect) override; void update_memory_buffer_started(MemoryBuffer *output, const rcti &area, diff --git a/source/blender/compositor/operations/COM_ChangeHSVOperation.cc b/source/blender/compositor/operations/COM_ChangeHSVOperation.cc index 7e240a0b95a..b4effc087b1 100644 --- a/source/blender/compositor/operations/COM_ChangeHSVOperation.cc +++ b/source/blender/compositor/operations/COM_ChangeHSVOperation.cc @@ -22,54 +22,54 @@ namespace blender::compositor { ChangeHSVOperation::ChangeHSVOperation() { - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Color); - inputOperation_ = nullptr; + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Color); + input_operation_ = nullptr; this->flags.can_be_constant = true; } -void ChangeHSVOperation::initExecution() +void ChangeHSVOperation::init_execution() { - inputOperation_ = getInputSocketReader(0); - hueOperation_ = getInputSocketReader(1); - saturationOperation_ = getInputSocketReader(2); - valueOperation_ = getInputSocketReader(3); + input_operation_ = get_input_socket_reader(0); + hue_operation_ = get_input_socket_reader(1); + saturation_operation_ = get_input_socket_reader(2); + value_operation_ = get_input_socket_reader(3); } -void ChangeHSVOperation::deinitExecution() +void ChangeHSVOperation::deinit_execution() { - inputOperation_ = nullptr; - hueOperation_ = nullptr; - saturationOperation_ = nullptr; - valueOperation_ = nullptr; + input_operation_ = nullptr; + hue_operation_ = nullptr; + saturation_operation_ = nullptr; + value_operation_ = nullptr; } -void ChangeHSVOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ChangeHSVOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor1[4]; + float input_color1[4]; float hue[4], saturation[4], value[4]; - inputOperation_->readSampled(inputColor1, x, y, sampler); - hueOperation_->readSampled(hue, x, y, sampler); - saturationOperation_->readSampled(saturation, x, y, sampler); - valueOperation_->readSampled(value, x, y, sampler); + input_operation_->read_sampled(input_color1, x, y, sampler); + hue_operation_->read_sampled(hue, x, y, sampler); + saturation_operation_->read_sampled(saturation, x, y, sampler); + value_operation_->read_sampled(value, x, y, sampler); - output[0] = inputColor1[0] + (hue[0] - 0.5f); + output[0] = input_color1[0] + (hue[0] - 0.5f); if (output[0] > 1.0f) { output[0] -= 1.0f; } else if (output[0] < 0.0f) { output[0] += 1.0f; } - output[1] = inputColor1[1] * saturation[0]; - output[2] = inputColor1[2] * value[0]; - output[3] = inputColor1[3]; + output[1] = input_color1[1] * saturation[0]; + output[2] = input_color1[2] * value[0]; + output[3] = input_color1[3]; } void ChangeHSVOperation::update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_ChangeHSVOperation.h b/source/blender/compositor/operations/COM_ChangeHSVOperation.h index 4b810a93816..35e606f63df 100644 --- a/source/blender/compositor/operations/COM_ChangeHSVOperation.h +++ b/source/blender/compositor/operations/COM_ChangeHSVOperation.h @@ -28,10 +28,10 @@ namespace blender::compositor { */ class ChangeHSVOperation : public MultiThreadedOperation { private: - SocketReader *inputOperation_; - SocketReader *hueOperation_; - SocketReader *saturationOperation_; - SocketReader *valueOperation_; + SocketReader *input_operation_; + SocketReader *hue_operation_; + SocketReader *saturation_operation_; + SocketReader *value_operation_; public: /** @@ -39,13 +39,13 @@ class ChangeHSVOperation : public MultiThreadedOperation { */ ChangeHSVOperation(); - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, diff --git a/source/blender/compositor/operations/COM_ChannelMatteOperation.cc b/source/blender/compositor/operations/COM_ChannelMatteOperation.cc index cbc6d078ac1..0a6b8255c42 100644 --- a/source/blender/compositor/operations/COM_ChannelMatteOperation.cc +++ b/source/blender/compositor/operations/COM_ChannelMatteOperation.cc @@ -22,16 +22,16 @@ namespace blender::compositor { ChannelMatteOperation::ChannelMatteOperation() { - addInputSocket(DataType::Color); - addOutputSocket(DataType::Value); + add_input_socket(DataType::Color); + add_output_socket(DataType::Value); - inputImageProgram_ = nullptr; + input_image_program_ = nullptr; flags.can_be_constant = true; } -void ChannelMatteOperation::initExecution() +void ChannelMatteOperation::init_execution() { - inputImageProgram_ = this->getInputSocketReader(0); + input_image_program_ = this->get_input_socket_reader(0); limit_range_ = limit_max_ - limit_min_; @@ -77,34 +77,34 @@ void ChannelMatteOperation::initExecution() } } -void ChannelMatteOperation::deinitExecution() +void ChannelMatteOperation::deinit_execution() { - inputImageProgram_ = nullptr; + input_image_program_ = nullptr; } -void ChannelMatteOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ChannelMatteOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inColor[4]; + float in_color[4]; float alpha; const float limit_max = limit_max_; const float limit_min = limit_min_; const float limit_range = limit_range_; - inputImageProgram_->readSampled(inColor, x, y, sampler); + input_image_program_->read_sampled(in_color, x, y, sampler); /* matte operation */ - alpha = inColor[ids_[0]] - MAX2(inColor[ids_[1]], inColor[ids_[2]]); + alpha = in_color[ids_[0]] - MAX2(in_color[ids_[1]], in_color[ids_[2]]); /* flip because 0.0 is transparent, not 1.0 */ alpha = 1.0f - alpha; /* test range */ if (alpha > limit_max) { - alpha = inColor[3]; /* Whatever it was prior. */ + alpha = in_color[3]; /* Whatever it was prior. */ } else if (alpha < limit_min) { alpha = 0.0f; @@ -118,7 +118,7 @@ void ChannelMatteOperation::executePixelSampled(float output[4], */ /* Don't make something that was more transparent less transparent. */ - output[0] = MIN2(alpha, inColor[3]); + output[0] = MIN2(alpha, in_color[3]); } void ChannelMatteOperation::update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_ChannelMatteOperation.h b/source/blender/compositor/operations/COM_ChannelMatteOperation.h index f7bf58b99c5..64b173885d5 100644 --- a/source/blender/compositor/operations/COM_ChannelMatteOperation.h +++ b/source/blender/compositor/operations/COM_ChannelMatteOperation.h @@ -28,7 +28,7 @@ namespace blender::compositor { */ class ChannelMatteOperation : public MultiThreadedOperation { private: - SocketReader *inputImageProgram_; + SocketReader *input_image_program_; /* int color_space_; */ /* node->custom1 */ /* UNUSED */ /* TODO ? */ int matte_channel_; /* node->custom2 */ @@ -58,17 +58,17 @@ class ChannelMatteOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; - void setSettings(NodeChroma *nodeChroma, const int custom2) + void set_settings(NodeChroma *node_chroma, const int custom2) { - limit_max_ = nodeChroma->t1; - limit_min_ = nodeChroma->t2; - limit_method_ = nodeChroma->algorithm; - limit_channel_ = nodeChroma->channel; + limit_max_ = node_chroma->t1; + limit_min_ = node_chroma->t2; + limit_method_ = node_chroma->algorithm; + limit_channel_ = node_chroma->channel; matte_channel_ = custom2; } diff --git a/source/blender/compositor/operations/COM_ChromaMatteOperation.cc b/source/blender/compositor/operations/COM_ChromaMatteOperation.cc index 172460e9203..fceb0ea1c23 100644 --- a/source/blender/compositor/operations/COM_ChromaMatteOperation.cc +++ b/source/blender/compositor/operations/COM_ChromaMatteOperation.cc @@ -22,34 +22,34 @@ namespace blender::compositor { ChromaMatteOperation::ChromaMatteOperation() { - addInputSocket(DataType::Color); - addInputSocket(DataType::Color); - addOutputSocket(DataType::Value); + add_input_socket(DataType::Color); + add_input_socket(DataType::Color); + add_output_socket(DataType::Value); - inputImageProgram_ = nullptr; - inputKeyProgram_ = nullptr; + input_image_program_ = nullptr; + input_key_program_ = nullptr; flags.can_be_constant = true; } -void ChromaMatteOperation::initExecution() +void ChromaMatteOperation::init_execution() { - inputImageProgram_ = this->getInputSocketReader(0); - inputKeyProgram_ = this->getInputSocketReader(1); + input_image_program_ = this->get_input_socket_reader(0); + input_key_program_ = this->get_input_socket_reader(1); } -void ChromaMatteOperation::deinitExecution() +void ChromaMatteOperation::deinit_execution() { - inputImageProgram_ = nullptr; - inputKeyProgram_ = nullptr; + input_image_program_ = nullptr; + input_key_program_ = nullptr; } -void ChromaMatteOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ChromaMatteOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inKey[4]; - float inImage[4]; + float in_key[4]; + float in_image[4]; const float acceptance = settings_->t1; /* in radians */ const float cutoff = settings_->t2; /* in radians */ @@ -59,8 +59,8 @@ void ChromaMatteOperation::executePixelSampled(float output[4], float theta, beta; float kfg; - inputKeyProgram_->readSampled(inKey, x, y, sampler); - inputImageProgram_->readSampled(inImage, x, y, sampler); + input_key_program_->read_sampled(in_key, x, y, sampler); + input_image_program_->read_sampled(in_image, x, y, sampler); /* Store matte(alpha) value in [0] to go with * #COM_SetAlphaMultiplyOperation and the Value output. */ @@ -69,19 +69,19 @@ void ChromaMatteOperation::executePixelSampled(float output[4], /* Find theta, the angle that the color space should be rotated based on key. */ /* rescale to -1.0..1.0 */ - // inImage[0] = (inImage[0] * 2.0f) - 1.0f; // UNUSED - inImage[1] = (inImage[1] * 2.0f) - 1.0f; - inImage[2] = (inImage[2] * 2.0f) - 1.0f; + // in_image[0] = (in_image[0] * 2.0f) - 1.0f; // UNUSED + in_image[1] = (in_image[1] * 2.0f) - 1.0f; + in_image[2] = (in_image[2] * 2.0f) - 1.0f; - // inKey[0] = (inKey[0] * 2.0f) - 1.0f; // UNUSED - inKey[1] = (inKey[1] * 2.0f) - 1.0f; - inKey[2] = (inKey[2] * 2.0f) - 1.0f; + // in_key[0] = (in_key[0] * 2.0f) - 1.0f; // UNUSED + in_key[1] = (in_key[1] * 2.0f) - 1.0f; + in_key[2] = (in_key[2] * 2.0f) - 1.0f; - theta = atan2(inKey[2], inKey[1]); + theta = atan2(in_key[2], in_key[1]); /* Rotate the cb and cr into x/z space. */ - x_angle = inImage[1] * cosf(theta) + inImage[2] * sinf(theta); - z_angle = inImage[2] * cosf(theta) - inImage[1] * sinf(theta); + x_angle = in_image[1] * cosf(theta) + in_image[2] * sinf(theta); + z_angle = in_image[2] * cosf(theta) - in_image[1] * sinf(theta); /* If within the acceptance angle. */ /* If kfg is <0 then the pixel is outside of the key color. */ @@ -98,15 +98,15 @@ void ChromaMatteOperation::executePixelSampled(float output[4], } /* don't make something that was more transparent less transparent */ - if (alpha < inImage[3]) { + if (alpha < in_image[3]) { output[0] = alpha; } else { - output[0] = inImage[3]; + output[0] = in_image[3]; } } - else { /* Pixel is outside key color. */ - output[0] = inImage[3]; /* Make pixel just as transparent as it was before. */ + else { /* Pixel is outside key color. */ + output[0] = in_image[3]; /* Make pixel just as transparent as it was before. */ } } diff --git a/source/blender/compositor/operations/COM_ChromaMatteOperation.h b/source/blender/compositor/operations/COM_ChromaMatteOperation.h index 913d0f27107..954daef1be7 100644 --- a/source/blender/compositor/operations/COM_ChromaMatteOperation.h +++ b/source/blender/compositor/operations/COM_ChromaMatteOperation.h @@ -29,8 +29,8 @@ namespace blender::compositor { class ChromaMatteOperation : public MultiThreadedOperation { private: NodeChroma *settings_; - SocketReader *inputImageProgram_; - SocketReader *inputKeyProgram_; + SocketReader *input_image_program_; + SocketReader *input_key_program_; public: /** @@ -41,14 +41,14 @@ class ChromaMatteOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; - void setSettings(NodeChroma *nodeChroma) + void set_settings(NodeChroma *node_chroma) { - settings_ = nodeChroma; + settings_ = node_chroma; } void update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cc b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cc index b6253c07f12..e12138c1f00 100644 --- a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cc +++ b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.cc @@ -34,43 +34,43 @@ inline float colorbalance_cdl(float in, float offset, float power, float slope) ColorBalanceASCCDLOperation::ColorBalanceASCCDLOperation() { - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); - inputValueOperation_ = nullptr; - inputColorOperation_ = nullptr; + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); + input_value_operation_ = nullptr; + input_color_operation_ = nullptr; this->set_canvas_input_index(1); flags.can_be_constant = true; } -void ColorBalanceASCCDLOperation::initExecution() +void ColorBalanceASCCDLOperation::init_execution() { - inputValueOperation_ = this->getInputSocketReader(0); - inputColorOperation_ = this->getInputSocketReader(1); + input_value_operation_ = this->get_input_socket_reader(0); + input_color_operation_ = this->get_input_socket_reader(1); } -void ColorBalanceASCCDLOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ColorBalanceASCCDLOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor[4]; + float input_color[4]; float value[4]; - inputValueOperation_->readSampled(value, x, y, sampler); - inputColorOperation_->readSampled(inputColor, x, y, sampler); + input_value_operation_->read_sampled(value, x, y, sampler); + input_color_operation_->read_sampled(input_color, x, y, sampler); float fac = value[0]; fac = MIN2(1.0f, fac); const float mfac = 1.0f - fac; - output[0] = mfac * inputColor[0] + - fac * colorbalance_cdl(inputColor[0], offset_[0], power_[0], slope_[0]); - output[1] = mfac * inputColor[1] + - fac * colorbalance_cdl(inputColor[1], offset_[1], power_[1], slope_[1]); - output[2] = mfac * inputColor[2] + - fac * colorbalance_cdl(inputColor[2], offset_[2], power_[2], slope_[2]); - output[3] = inputColor[3]; + output[0] = mfac * input_color[0] + + fac * colorbalance_cdl(input_color[0], offset_[0], power_[0], slope_[0]); + output[1] = mfac * input_color[1] + + fac * colorbalance_cdl(input_color[1], offset_[1], power_[1], slope_[1]); + output[2] = mfac * input_color[2] + + fac * colorbalance_cdl(input_color[2], offset_[2], power_[2], slope_[2]); + output[3] = input_color[3]; } void ColorBalanceASCCDLOperation::update_memory_buffer_row(PixelCursor &p) @@ -90,10 +90,10 @@ void ColorBalanceASCCDLOperation::update_memory_buffer_row(PixelCursor &p) } } -void ColorBalanceASCCDLOperation::deinitExecution() +void ColorBalanceASCCDLOperation::deinit_execution() { - inputValueOperation_ = nullptr; - inputColorOperation_ = nullptr; + input_value_operation_ = nullptr; + input_color_operation_ = nullptr; } } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h index 79c5cc1a047..64622e399d3 100644 --- a/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h +++ b/source/blender/compositor/operations/COM_ColorBalanceASCCDLOperation.h @@ -29,10 +29,10 @@ namespace blender::compositor { class ColorBalanceASCCDLOperation : public MultiThreadedRowOperation { protected: /** - * Prefetched reference to the inputProgram + * Prefetched reference to the input_program */ - SocketReader *inputValueOperation_; - SocketReader *inputColorOperation_; + SocketReader *input_value_operation_; + SocketReader *input_color_operation_; float offset_[3]; float power_[3]; @@ -47,27 +47,27 @@ class ColorBalanceASCCDLOperation : public MultiThreadedRowOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void setOffset(float offset[3]) + void set_offset(float offset[3]) { copy_v3_v3(offset_, offset); } - void setPower(float power[3]) + void set_power(float power[3]) { copy_v3_v3(power_, power); } - void setSlope(float slope[3]) + void set_slope(float slope[3]) { copy_v3_v3(slope_, slope); } diff --git a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cc b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cc index d7c7368a214..d9af1b0a074 100644 --- a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cc +++ b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.cc @@ -39,43 +39,43 @@ inline float colorbalance_lgg(float in, float lift_lgg, float gamma_inv, float g ColorBalanceLGGOperation::ColorBalanceLGGOperation() { - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); - inputValueOperation_ = nullptr; - inputColorOperation_ = nullptr; + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); + input_value_operation_ = nullptr; + input_color_operation_ = nullptr; this->set_canvas_input_index(1); flags.can_be_constant = true; } -void ColorBalanceLGGOperation::initExecution() +void ColorBalanceLGGOperation::init_execution() { - inputValueOperation_ = this->getInputSocketReader(0); - inputColorOperation_ = this->getInputSocketReader(1); + input_value_operation_ = this->get_input_socket_reader(0); + input_color_operation_ = this->get_input_socket_reader(1); } -void ColorBalanceLGGOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ColorBalanceLGGOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor[4]; + float input_color[4]; float value[4]; - inputValueOperation_->readSampled(value, x, y, sampler); - inputColorOperation_->readSampled(inputColor, x, y, sampler); + input_value_operation_->read_sampled(value, x, y, sampler); + input_color_operation_->read_sampled(input_color, x, y, sampler); float fac = value[0]; fac = MIN2(1.0f, fac); const float mfac = 1.0f - fac; - output[0] = mfac * inputColor[0] + - fac * colorbalance_lgg(inputColor[0], lift_[0], gamma_inv_[0], gain_[0]); - output[1] = mfac * inputColor[1] + - fac * colorbalance_lgg(inputColor[1], lift_[1], gamma_inv_[1], gain_[1]); - output[2] = mfac * inputColor[2] + - fac * colorbalance_lgg(inputColor[2], lift_[2], gamma_inv_[2], gain_[2]); - output[3] = inputColor[3]; + output[0] = mfac * input_color[0] + + fac * colorbalance_lgg(input_color[0], lift_[0], gamma_inv_[0], gain_[0]); + output[1] = mfac * input_color[1] + + fac * colorbalance_lgg(input_color[1], lift_[1], gamma_inv_[1], gain_[1]); + output[2] = mfac * input_color[2] + + fac * colorbalance_lgg(input_color[2], lift_[2], gamma_inv_[2], gain_[2]); + output[3] = input_color[3]; } void ColorBalanceLGGOperation::update_memory_buffer_row(PixelCursor &p) @@ -95,10 +95,10 @@ void ColorBalanceLGGOperation::update_memory_buffer_row(PixelCursor &p) } } -void ColorBalanceLGGOperation::deinitExecution() +void ColorBalanceLGGOperation::deinit_execution() { - inputValueOperation_ = nullptr; - inputColorOperation_ = nullptr; + input_value_operation_ = nullptr; + input_color_operation_ = nullptr; } } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h index 9393f635f9e..738669e71f9 100644 --- a/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h +++ b/source/blender/compositor/operations/COM_ColorBalanceLGGOperation.h @@ -29,10 +29,10 @@ namespace blender::compositor { class ColorBalanceLGGOperation : public MultiThreadedRowOperation { protected: /** - * Prefetched reference to the inputProgram + * Prefetched reference to the input_program */ - SocketReader *inputValueOperation_; - SocketReader *inputColorOperation_; + SocketReader *input_value_operation_; + SocketReader *input_color_operation_; float gain_[3]; float lift_[3]; @@ -47,27 +47,27 @@ class ColorBalanceLGGOperation : public MultiThreadedRowOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void setGain(const float gain[3]) + void set_gain(const float gain[3]) { copy_v3_v3(gain_, gain); } - void setLift(const float lift[3]) + void set_lift(const float lift[3]) { copy_v3_v3(lift_, lift); } - void setGammaInv(const float gamma_inv[3]) + void set_gamma_inv(const float gamma_inv[3]) { copy_v3_v3(gamma_inv_, gamma_inv); } diff --git a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cc b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cc index 128c7c80ea9..538227d899b 100644 --- a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cc +++ b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cc @@ -24,20 +24,20 @@ namespace blender::compositor { ColorCorrectionOperation::ColorCorrectionOperation() { - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Color); - inputImage_ = nullptr; - inputMask_ = nullptr; - redChannelEnabled_ = true; - greenChannelEnabled_ = true; - blueChannelEnabled_ = true; + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Color); + input_image_ = nullptr; + input_mask_ = nullptr; + red_channel_enabled_ = true; + green_channel_enabled_ = true; + blue_channel_enabled_ = true; flags.can_be_constant = true; } -void ColorCorrectionOperation::initExecution() +void ColorCorrectionOperation::init_execution() { - inputImage_ = this->getInputSocketReader(0); - inputMask_ = this->getInputSocketReader(1); + input_image_ = this->get_input_socket_reader(0); + input_mask_ = this->get_input_socket_reader(1); } /* Calculate x^y if the function is defined. Otherwise return the given fallback value. */ @@ -49,17 +49,17 @@ BLI_INLINE float color_correct_powf_safe(const float x, const float y, const flo return powf(x, y); } -void ColorCorrectionOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ColorCorrectionOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputImageColor[4]; - float inputMask[4]; - inputImage_->readSampled(inputImageColor, x, y, sampler); - inputMask_->readSampled(inputMask, x, y, sampler); + float input_image_color[4]; + float input_mask[4]; + input_image_->read_sampled(input_image_color, x, y, sampler); + input_mask_->read_sampled(input_mask, x, y, sampler); - float level = (inputImageColor[0] + inputImageColor[1] + inputImageColor[2]) / 3.0f; + float level = (input_image_color[0] + input_image_color[1] + input_image_color[2]) / 3.0f; float contrast = data_->master.contrast; float saturation = data_->master.saturation; float gamma = data_->master.gamma; @@ -67,53 +67,53 @@ void ColorCorrectionOperation::executePixelSampled(float output[4], float lift = data_->master.lift; float r, g, b; - float value = inputMask[0]; + float value = input_mask[0]; value = MIN2(1.0f, value); const float mvalue = 1.0f - value; - float levelShadows = 0.0; - float levelMidtones = 0.0; - float levelHighlights = 0.0; + float level_shadows = 0.0; + float level_midtones = 0.0; + float level_highlights = 0.0; #define MARGIN 0.10f #define MARGIN_DIV (0.5f / MARGIN) if (level < data_->startmidtones - MARGIN) { - levelShadows = 1.0f; + level_shadows = 1.0f; } else if (level < data_->startmidtones + MARGIN) { - levelMidtones = ((level - data_->startmidtones) * MARGIN_DIV) + 0.5f; - levelShadows = 1.0f - levelMidtones; + level_midtones = ((level - data_->startmidtones) * MARGIN_DIV) + 0.5f; + level_shadows = 1.0f - level_midtones; } else if (level < data_->endmidtones - MARGIN) { - levelMidtones = 1.0f; + level_midtones = 1.0f; } else if (level < data_->endmidtones + MARGIN) { - levelHighlights = ((level - data_->endmidtones) * MARGIN_DIV) + 0.5f; - levelMidtones = 1.0f - levelHighlights; + level_highlights = ((level - data_->endmidtones) * MARGIN_DIV) + 0.5f; + level_midtones = 1.0f - level_highlights; } else { - levelHighlights = 1.0f; + level_highlights = 1.0f; } #undef MARGIN #undef MARGIN_DIV - contrast *= (levelShadows * data_->shadows.contrast) + - (levelMidtones * data_->midtones.contrast) + - (levelHighlights * data_->highlights.contrast); - saturation *= (levelShadows * data_->shadows.saturation) + - (levelMidtones * data_->midtones.saturation) + - (levelHighlights * data_->highlights.saturation); - gamma *= (levelShadows * data_->shadows.gamma) + (levelMidtones * data_->midtones.gamma) + - (levelHighlights * data_->highlights.gamma); - gain *= (levelShadows * data_->shadows.gain) + (levelMidtones * data_->midtones.gain) + - (levelHighlights * data_->highlights.gain); - lift += (levelShadows * data_->shadows.lift) + (levelMidtones * data_->midtones.lift) + - (levelHighlights * data_->highlights.lift); + contrast *= (level_shadows * data_->shadows.contrast) + + (level_midtones * data_->midtones.contrast) + + (level_highlights * data_->highlights.contrast); + saturation *= (level_shadows * data_->shadows.saturation) + + (level_midtones * data_->midtones.saturation) + + (level_highlights * data_->highlights.saturation); + gamma *= (level_shadows * data_->shadows.gamma) + (level_midtones * data_->midtones.gamma) + + (level_highlights * data_->highlights.gamma); + gain *= (level_shadows * data_->shadows.gain) + (level_midtones * data_->midtones.gain) + + (level_highlights * data_->highlights.gain); + lift += (level_shadows * data_->shadows.lift) + (level_midtones * data_->midtones.lift) + + (level_highlights * data_->highlights.lift); float invgamma = 1.0f / gamma; - float luma = IMB_colormanagement_get_luminance(inputImageColor); + float luma = IMB_colormanagement_get_luminance(input_image_color); - r = inputImageColor[0]; - g = inputImageColor[1]; - b = inputImageColor[2]; + r = input_image_color[0]; + g = input_image_color[1]; + b = input_image_color[2]; r = (luma + saturation * (r - luma)); g = (luma + saturation * (g - luma)); @@ -129,29 +129,29 @@ void ColorCorrectionOperation::executePixelSampled(float output[4], b = color_correct_powf_safe(b * gain + lift, invgamma, b); /* Mix with mask. */ - r = mvalue * inputImageColor[0] + value * r; - g = mvalue * inputImageColor[1] + value * g; - b = mvalue * inputImageColor[2] + value * b; + r = mvalue * input_image_color[0] + value * r; + g = mvalue * input_image_color[1] + value * g; + b = mvalue * input_image_color[2] + value * b; - if (redChannelEnabled_) { + if (red_channel_enabled_) { output[0] = r; } else { - output[0] = inputImageColor[0]; + output[0] = input_image_color[0]; } - if (greenChannelEnabled_) { + if (green_channel_enabled_) { output[1] = g; } else { - output[1] = inputImageColor[1]; + output[1] = input_image_color[1]; } - if (blueChannelEnabled_) { + if (blue_channel_enabled_) { output[2] = b; } else { - output[2] = inputImageColor[2]; + output[2] = input_image_color[2]; } - output[3] = inputImageColor[3]; + output[3] = input_image_color[3]; } void ColorCorrectionOperation::update_memory_buffer_row(PixelCursor &p) @@ -224,17 +224,17 @@ void ColorCorrectionOperation::update_memory_buffer_row(PixelCursor &p) g = value_ * in_color[1] + value * g; b = value_ * in_color[2] + value * b; - p.out[0] = redChannelEnabled_ ? r : in_color[0]; - p.out[1] = greenChannelEnabled_ ? g : in_color[1]; - p.out[2] = blueChannelEnabled_ ? b : in_color[2]; + p.out[0] = red_channel_enabled_ ? r : in_color[0]; + p.out[1] = green_channel_enabled_ ? g : in_color[1]; + p.out[2] = blue_channel_enabled_ ? b : in_color[2]; p.out[3] = in_color[3]; } } -void ColorCorrectionOperation::deinitExecution() +void ColorCorrectionOperation::deinit_execution() { - inputImage_ = nullptr; - inputMask_ = nullptr; + input_image_ = nullptr; + input_mask_ = nullptr; } } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ColorCorrectionOperation.h b/source/blender/compositor/operations/COM_ColorCorrectionOperation.h index 157babd299b..b0d52507204 100644 --- a/source/blender/compositor/operations/COM_ColorCorrectionOperation.h +++ b/source/blender/compositor/operations/COM_ColorCorrectionOperation.h @@ -25,15 +25,15 @@ namespace blender::compositor { class ColorCorrectionOperation : public MultiThreadedRowOperation { private: /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputImage_; - SocketReader *inputMask_; + SocketReader *input_image_; + SocketReader *input_mask_; NodeColorCorrection *data_; - bool redChannelEnabled_; - bool greenChannelEnabled_; - bool blueChannelEnabled_; + bool red_channel_enabled_; + bool green_channel_enabled_; + bool blue_channel_enabled_; public: ColorCorrectionOperation(); @@ -41,33 +41,33 @@ class ColorCorrectionOperation : public MultiThreadedRowOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void setData(NodeColorCorrection *data) + void set_data(NodeColorCorrection *data) { data_ = data; } - void setRedChannelEnabled(bool enabled) + void set_red_channel_enabled(bool enabled) { - redChannelEnabled_ = enabled; + red_channel_enabled_ = enabled; } - void setGreenChannelEnabled(bool enabled) + void set_green_channel_enabled(bool enabled) { - greenChannelEnabled_ = enabled; + green_channel_enabled_ = enabled; } - void setBlueChannelEnabled(bool enabled) + void set_blue_channel_enabled(bool enabled) { - blueChannelEnabled_ = enabled; + blue_channel_enabled_ = enabled; } void update_memory_buffer_row(PixelCursor &p) override; diff --git a/source/blender/compositor/operations/COM_ColorCurveOperation.cc b/source/blender/compositor/operations/COM_ColorCurveOperation.cc index b88989ad224..7cfa1c09298 100644 --- a/source/blender/compositor/operations/COM_ColorCurveOperation.cc +++ b/source/blender/compositor/operations/COM_ColorCurveOperation.cc @@ -24,36 +24,36 @@ namespace blender::compositor { ColorCurveOperation::ColorCurveOperation() { - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); - inputFacProgram_ = nullptr; - inputImageProgram_ = nullptr; - inputBlackProgram_ = nullptr; - inputWhiteProgram_ = nullptr; + input_fac_program_ = nullptr; + input_image_program_ = nullptr; + input_black_program_ = nullptr; + input_white_program_ = nullptr; this->set_canvas_input_index(1); } -void ColorCurveOperation::initExecution() +void ColorCurveOperation::init_execution() { - CurveBaseOperation::initExecution(); - inputFacProgram_ = this->getInputSocketReader(0); - inputImageProgram_ = this->getInputSocketReader(1); - inputBlackProgram_ = this->getInputSocketReader(2); - inputWhiteProgram_ = this->getInputSocketReader(3); + CurveBaseOperation::init_execution(); + input_fac_program_ = this->get_input_socket_reader(0); + input_image_program_ = this->get_input_socket_reader(1); + input_black_program_ = this->get_input_socket_reader(2); + input_white_program_ = this->get_input_socket_reader(3); - BKE_curvemapping_premultiply(curveMapping_, 0); + BKE_curvemapping_premultiply(curve_mapping_, 0); } -void ColorCurveOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ColorCurveOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - CurveMapping *cumap = curveMapping_; + CurveMapping *cumap = curve_mapping_; float fac[4]; float image[4]; @@ -63,15 +63,15 @@ void ColorCurveOperation::executePixelSampled(float output[4], float white[4]; float bwmul[3]; - inputBlackProgram_->readSampled(black, x, y, sampler); - inputWhiteProgram_->readSampled(white, x, y, sampler); + input_black_program_->read_sampled(black, x, y, sampler); + input_white_program_->read_sampled(white, x, y, sampler); /* get our own local bwmul value, * since we can't be threadsafe and use cumap->bwmul & friends */ BKE_curvemapping_set_black_white_ex(black, white, bwmul); - inputFacProgram_->readSampled(fac, x, y, sampler); - inputImageProgram_->readSampled(image, x, y, sampler); + input_fac_program_->read_sampled(fac, x, y, sampler); + input_image_program_->read_sampled(image, x, y, sampler); if (*fac >= 1.0f) { BKE_curvemapping_evaluate_premulRGBF_ex(cumap, output, image, black, bwmul); @@ -87,20 +87,20 @@ void ColorCurveOperation::executePixelSampled(float output[4], output[3] = image[3]; } -void ColorCurveOperation::deinitExecution() +void ColorCurveOperation::deinit_execution() { - CurveBaseOperation::deinitExecution(); - inputFacProgram_ = nullptr; - inputImageProgram_ = nullptr; - inputBlackProgram_ = nullptr; - inputWhiteProgram_ = nullptr; + CurveBaseOperation::deinit_execution(); + input_fac_program_ = nullptr; + input_image_program_ = nullptr; + input_black_program_ = nullptr; + input_white_program_ = nullptr; } void ColorCurveOperation::update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span<MemoryBuffer *> inputs) { - CurveMapping *cumap = curveMapping_; + CurveMapping *cumap = curve_mapping_; float bwmul[3]; for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) { /* Local versions of `cumap->black` and `cumap->white`. */ @@ -130,63 +130,63 @@ void ColorCurveOperation::update_memory_buffer_partial(MemoryBuffer *output, ConstantLevelColorCurveOperation::ConstantLevelColorCurveOperation() { - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); - inputFacProgram_ = nullptr; - inputImageProgram_ = nullptr; + input_fac_program_ = nullptr; + input_image_program_ = nullptr; this->set_canvas_input_index(1); } -void ConstantLevelColorCurveOperation::initExecution() +void ConstantLevelColorCurveOperation::init_execution() { - CurveBaseOperation::initExecution(); - inputFacProgram_ = this->getInputSocketReader(0); - inputImageProgram_ = this->getInputSocketReader(1); + CurveBaseOperation::init_execution(); + input_fac_program_ = this->get_input_socket_reader(0); + input_image_program_ = this->get_input_socket_reader(1); - BKE_curvemapping_premultiply(curveMapping_, 0); + BKE_curvemapping_premultiply(curve_mapping_, 0); - BKE_curvemapping_set_black_white(curveMapping_, black_, white_); + BKE_curvemapping_set_black_white(curve_mapping_, black_, white_); } -void ConstantLevelColorCurveOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ConstantLevelColorCurveOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { float fac[4]; float image[4]; - inputFacProgram_->readSampled(fac, x, y, sampler); - inputImageProgram_->readSampled(image, x, y, sampler); + input_fac_program_->read_sampled(fac, x, y, sampler); + input_image_program_->read_sampled(image, x, y, sampler); if (*fac >= 1.0f) { - BKE_curvemapping_evaluate_premulRGBF(curveMapping_, output, image); + BKE_curvemapping_evaluate_premulRGBF(curve_mapping_, output, image); } else if (*fac <= 0.0f) { copy_v3_v3(output, image); } else { float col[4]; - BKE_curvemapping_evaluate_premulRGBF(curveMapping_, col, image); + BKE_curvemapping_evaluate_premulRGBF(curve_mapping_, col, image); interp_v3_v3v3(output, image, col, *fac); } output[3] = image[3]; } -void ConstantLevelColorCurveOperation::deinitExecution() +void ConstantLevelColorCurveOperation::deinit_execution() { - CurveBaseOperation::deinitExecution(); - inputFacProgram_ = nullptr; - inputImageProgram_ = nullptr; + CurveBaseOperation::deinit_execution(); + input_fac_program_ = nullptr; + input_image_program_ = nullptr; } void ConstantLevelColorCurveOperation::update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span<MemoryBuffer *> inputs) { - CurveMapping *cumap = curveMapping_; + CurveMapping *cumap = curve_mapping_; for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) { const float fac = *it.in(0); const float *image = it.in(1); diff --git a/source/blender/compositor/operations/COM_ColorCurveOperation.h b/source/blender/compositor/operations/COM_ColorCurveOperation.h index 6f16c45d11e..eaebf1f3ff6 100644 --- a/source/blender/compositor/operations/COM_ColorCurveOperation.h +++ b/source/blender/compositor/operations/COM_ColorCurveOperation.h @@ -25,12 +25,12 @@ namespace blender::compositor { class ColorCurveOperation : public CurveBaseOperation { private: /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputFacProgram_; - SocketReader *inputImageProgram_; - SocketReader *inputBlackProgram_; - SocketReader *inputWhiteProgram_; + SocketReader *input_fac_program_; + SocketReader *input_image_program_; + SocketReader *input_black_program_; + SocketReader *input_white_program_; public: ColorCurveOperation(); @@ -38,17 +38,17 @@ class ColorCurveOperation : public CurveBaseOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, @@ -58,10 +58,10 @@ class ColorCurveOperation : public CurveBaseOperation { class ConstantLevelColorCurveOperation : public CurveBaseOperation { private: /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputFacProgram_; - SocketReader *inputImageProgram_; + SocketReader *input_fac_program_; + SocketReader *input_image_program_; float black_[3]; float white_[3]; @@ -71,23 +71,23 @@ class ConstantLevelColorCurveOperation : public CurveBaseOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void setBlackLevel(float black[3]) + void set_black_level(float black[3]) { copy_v3_v3(black_, black); } - void setWhiteLevel(float white[3]) + void set_white_level(float white[3]) { copy_v3_v3(white_, white); } diff --git a/source/blender/compositor/operations/COM_ColorExposureOperation.cc b/source/blender/compositor/operations/COM_ColorExposureOperation.cc index f0e6abe67f9..9a785962bd5 100644 --- a/source/blender/compositor/operations/COM_ColorExposureOperation.cc +++ b/source/blender/compositor/operations/COM_ColorExposureOperation.cc @@ -22,35 +22,35 @@ namespace blender::compositor { ExposureOperation::ExposureOperation() { - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Color); - inputProgram_ = nullptr; + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Color); + input_program_ = nullptr; flags.can_be_constant = true; } -void ExposureOperation::initExecution() +void ExposureOperation::init_execution() { - inputProgram_ = this->getInputSocketReader(0); - inputExposureProgram_ = this->getInputSocketReader(1); + input_program_ = this->get_input_socket_reader(0); + input_exposure_program_ = this->get_input_socket_reader(1); } -void ExposureOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ExposureOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue[4]; - float inputExposure[4]; - inputProgram_->readSampled(inputValue, x, y, sampler); - inputExposureProgram_->readSampled(inputExposure, x, y, sampler); - const float exposure = pow(2, inputExposure[0]); + float input_value[4]; + float input_exposure[4]; + input_program_->read_sampled(input_value, x, y, sampler); + input_exposure_program_->read_sampled(input_exposure, x, y, sampler); + const float exposure = pow(2, input_exposure[0]); - output[0] = inputValue[0] * exposure; - output[1] = inputValue[1] * exposure; - output[2] = inputValue[2] * exposure; + output[0] = input_value[0] * exposure; + output[1] = input_value[1] * exposure; + output[2] = input_value[2] * exposure; - output[3] = inputValue[3]; + output[3] = input_value[3]; } void ExposureOperation::update_memory_buffer_row(PixelCursor &p) @@ -66,10 +66,10 @@ void ExposureOperation::update_memory_buffer_row(PixelCursor &p) } } -void ExposureOperation::deinitExecution() +void ExposureOperation::deinit_execution() { - inputProgram_ = nullptr; - inputExposureProgram_ = nullptr; + input_program_ = nullptr; + input_exposure_program_ = nullptr; } } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ColorExposureOperation.h b/source/blender/compositor/operations/COM_ColorExposureOperation.h index 1a0f912d6bd..6de93a24ddd 100644 --- a/source/blender/compositor/operations/COM_ColorExposureOperation.h +++ b/source/blender/compositor/operations/COM_ColorExposureOperation.h @@ -25,10 +25,10 @@ namespace blender::compositor { class ExposureOperation : public MultiThreadedRowOperation { private: /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputProgram_; - SocketReader *inputExposureProgram_; + SocketReader *input_program_; + SocketReader *input_exposure_program_; public: ExposureOperation(); @@ -36,17 +36,17 @@ class ExposureOperation : public MultiThreadedRowOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; void update_memory_buffer_row(PixelCursor &p) override; }; diff --git a/source/blender/compositor/operations/COM_ColorMatteOperation.cc b/source/blender/compositor/operations/COM_ColorMatteOperation.cc index c693e7d06e1..c4bf1bdf1cf 100644 --- a/source/blender/compositor/operations/COM_ColorMatteOperation.cc +++ b/source/blender/compositor/operations/COM_ColorMatteOperation.cc @@ -22,34 +22,34 @@ namespace blender::compositor { ColorMatteOperation::ColorMatteOperation() { - addInputSocket(DataType::Color); - addInputSocket(DataType::Color); - addOutputSocket(DataType::Value); + add_input_socket(DataType::Color); + add_input_socket(DataType::Color); + add_output_socket(DataType::Value); - inputImageProgram_ = nullptr; - inputKeyProgram_ = nullptr; + input_image_program_ = nullptr; + input_key_program_ = nullptr; flags.can_be_constant = true; } -void ColorMatteOperation::initExecution() +void ColorMatteOperation::init_execution() { - inputImageProgram_ = this->getInputSocketReader(0); - inputKeyProgram_ = this->getInputSocketReader(1); + input_image_program_ = this->get_input_socket_reader(0); + input_key_program_ = this->get_input_socket_reader(1); } -void ColorMatteOperation::deinitExecution() +void ColorMatteOperation::deinit_execution() { - inputImageProgram_ = nullptr; - inputKeyProgram_ = nullptr; + input_image_program_ = nullptr; + input_key_program_ = nullptr; } -void ColorMatteOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ColorMatteOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inColor[4]; - float inKey[4]; + float in_color[4]; + float in_key[4]; const float hue = settings_->t1; const float sat = settings_->t2; @@ -57,8 +57,8 @@ void ColorMatteOperation::executePixelSampled(float output[4], float h_wrap; - inputImageProgram_->readSampled(inColor, x, y, sampler); - inputKeyProgram_->readSampled(inKey, x, y, sampler); + input_image_program_->read_sampled(in_color, x, y, sampler); + input_key_program_->read_sampled(in_key, x, y, sampler); /* Store matte(alpha) value in [0] to go with * COM_SetAlphaMultiplyOperation and the Value output. @@ -67,18 +67,19 @@ void ColorMatteOperation::executePixelSampled(float output[4], if ( /* Do hue last because it needs to wrap, and does some more checks. */ - /* sat */ (fabsf(inColor[1] - inKey[1]) < sat) && - /* val */ (fabsf(inColor[2] - inKey[2]) < val) && + /* sat */ (fabsf(in_color[1] - in_key[1]) < sat) && + /* val */ (fabsf(in_color[2] - in_key[2]) < val) && /* multiply by 2 because it wraps on both sides of the hue, * otherwise 0.5 would key all hue's */ - /* hue */ ((h_wrap = 2.0f * fabsf(inColor[0] - inKey[0])) < hue || (2.0f - h_wrap) < hue)) { + /* hue */ + ((h_wrap = 2.0f * fabsf(in_color[0] - in_key[0])) < hue || (2.0f - h_wrap) < hue)) { output[0] = 0.0f; /* make transparent */ } - else { /* Pixel is outside key color. */ - output[0] = inColor[3]; /* Make pixel just as transparent as it was before. */ + else { /* Pixel is outside key color. */ + output[0] = in_color[3]; /* Make pixel just as transparent as it was before. */ } } diff --git a/source/blender/compositor/operations/COM_ColorMatteOperation.h b/source/blender/compositor/operations/COM_ColorMatteOperation.h index 2037fa0cdc3..97cf568621a 100644 --- a/source/blender/compositor/operations/COM_ColorMatteOperation.h +++ b/source/blender/compositor/operations/COM_ColorMatteOperation.h @@ -29,8 +29,8 @@ namespace blender::compositor { class ColorMatteOperation : public MultiThreadedOperation { private: NodeChroma *settings_; - SocketReader *inputImageProgram_; - SocketReader *inputKeyProgram_; + SocketReader *input_image_program_; + SocketReader *input_key_program_; public: /** @@ -41,14 +41,14 @@ class ColorMatteOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; - void setSettings(NodeChroma *nodeChroma) + void set_settings(NodeChroma *node_chroma) { - settings_ = nodeChroma; + settings_ = node_chroma; } void update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_ColorRampOperation.cc b/source/blender/compositor/operations/COM_ColorRampOperation.cc index 054bdcf5b04..bd86528d143 100644 --- a/source/blender/compositor/operations/COM_ColorRampOperation.cc +++ b/source/blender/compositor/operations/COM_ColorRampOperation.cc @@ -24,32 +24,32 @@ namespace blender::compositor { ColorRampOperation::ColorRampOperation() { - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Color); - inputProgram_ = nullptr; - colorBand_ = nullptr; + input_program_ = nullptr; + color_band_ = nullptr; this->flags.can_be_constant = true; } -void ColorRampOperation::initExecution() +void ColorRampOperation::init_execution() { - inputProgram_ = this->getInputSocketReader(0); + input_program_ = this->get_input_socket_reader(0); } -void ColorRampOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ColorRampOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { float values[4]; - inputProgram_->readSampled(values, x, y, sampler); - BKE_colorband_evaluate(colorBand_, values[0], output); + input_program_->read_sampled(values, x, y, sampler); + BKE_colorband_evaluate(color_band_, values[0], output); } -void ColorRampOperation::deinitExecution() +void ColorRampOperation::deinit_execution() { - inputProgram_ = nullptr; + input_program_ = nullptr; } void ColorRampOperation::update_memory_buffer_partial(MemoryBuffer *output, @@ -57,7 +57,7 @@ void ColorRampOperation::update_memory_buffer_partial(MemoryBuffer *output, Span<MemoryBuffer *> inputs) { for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) { - BKE_colorband_evaluate(colorBand_, *it.in(0), it.out); + BKE_colorband_evaluate(color_band_, *it.in(0), it.out); } } diff --git a/source/blender/compositor/operations/COM_ColorRampOperation.h b/source/blender/compositor/operations/COM_ColorRampOperation.h index 3cb5a7d83e1..2faaab4ba54 100644 --- a/source/blender/compositor/operations/COM_ColorRampOperation.h +++ b/source/blender/compositor/operations/COM_ColorRampOperation.h @@ -26,10 +26,10 @@ namespace blender::compositor { class ColorRampOperation : public MultiThreadedOperation { private: /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputProgram_; - ColorBand *colorBand_; + SocketReader *input_program_; + ColorBand *color_band_; public: ColorRampOperation(); @@ -37,21 +37,21 @@ class ColorRampOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void setColorBand(ColorBand *colorBand) + void set_color_band(ColorBand *color_band) { - colorBand_ = colorBand; + color_band_ = color_band; } void update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_ColorSpillOperation.cc b/source/blender/compositor/operations/COM_ColorSpillOperation.cc index 45197bf2b1d..39be05ece38 100644 --- a/source/blender/compositor/operations/COM_ColorSpillOperation.cc +++ b/source/blender/compositor/operations/COM_ColorSpillOperation.cc @@ -23,22 +23,22 @@ namespace blender::compositor { ColorSpillOperation::ColorSpillOperation() { - addInputSocket(DataType::Color); - addInputSocket(DataType::Value); - addOutputSocket(DataType::Color); + add_input_socket(DataType::Color); + add_input_socket(DataType::Value); + add_output_socket(DataType::Color); - inputImageReader_ = nullptr; - inputFacReader_ = nullptr; - spillChannel_ = 1; /* GREEN */ - spillMethod_ = 0; + input_image_reader_ = nullptr; + input_fac_reader_ = nullptr; + spill_channel_ = 1; /* GREEN */ + spill_method_ = 0; flags.can_be_constant = true; } -void ColorSpillOperation::initExecution() +void ColorSpillOperation::init_execution() { - inputImageReader_ = this->getInputSocketReader(0); - inputFacReader_ = this->getInputSocketReader(1); - if (spillChannel_ == 0) { + input_image_reader_ = this->get_input_socket_reader(0); + input_fac_reader_ = this->get_input_socket_reader(1); + if (spill_channel_ == 0) { rmut_ = -1.0f; gmut_ = 1.0f; bmut_ = 1.0f; @@ -50,7 +50,7 @@ void ColorSpillOperation::initExecution() settings_->uspillb = 0.0f; } } - else if (spillChannel_ == 1) { + else if (spill_channel_ == 1) { rmut_ = 1.0f; gmut_ = -1.0f; bmut_ = 1.0f; @@ -77,30 +77,30 @@ void ColorSpillOperation::initExecution() } } -void ColorSpillOperation::deinitExecution() +void ColorSpillOperation::deinit_execution() { - inputImageReader_ = nullptr; - inputFacReader_ = nullptr; + input_image_reader_ = nullptr; + input_fac_reader_ = nullptr; } -void ColorSpillOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ColorSpillOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { float fac[4]; float input[4]; - inputFacReader_->readSampled(fac, x, y, sampler); - inputImageReader_->readSampled(input, x, y, sampler); + input_fac_reader_->read_sampled(fac, x, y, sampler); + input_image_reader_->read_sampled(input, x, y, sampler); float rfac = MIN2(1.0f, fac[0]); float map; - switch (spillMethod_) { + switch (spill_method_) { case 0: /* simple */ - map = rfac * (input[spillChannel_] - (settings_->limscale * input[settings_->limchan])); + map = rfac * (input[spill_channel_] - (settings_->limscale * input[settings_->limchan])); break; default: /* average */ - map = rfac * (input[spillChannel_] - + map = rfac * (input[spill_channel_] - (settings_->limscale * AVG(input[channel2_], input[channel3_]))); break; } @@ -125,12 +125,12 @@ void ColorSpillOperation::update_memory_buffer_partial(MemoryBuffer *output, const float factor = MIN2(1.0f, *it.in(1)); float map; - switch (spillMethod_) { + switch (spill_method_) { case 0: /* simple */ - map = factor * (color[spillChannel_] - (settings_->limscale * color[settings_->limchan])); + map = factor * (color[spill_channel_] - (settings_->limscale * color[settings_->limchan])); break; default: /* average */ - map = factor * (color[spillChannel_] - + map = factor * (color[spill_channel_] - (settings_->limscale * AVG(color[channel2_], color[channel3_]))); break; } diff --git a/source/blender/compositor/operations/COM_ColorSpillOperation.h b/source/blender/compositor/operations/COM_ColorSpillOperation.h index aab74e68f41..bfb0c6c963f 100644 --- a/source/blender/compositor/operations/COM_ColorSpillOperation.h +++ b/source/blender/compositor/operations/COM_ColorSpillOperation.h @@ -29,10 +29,10 @@ namespace blender::compositor { class ColorSpillOperation : public MultiThreadedOperation { protected: NodeColorspill *settings_; - SocketReader *inputImageReader_; - SocketReader *inputFacReader_; - int spillChannel_; - int spillMethod_; + SocketReader *input_image_reader_; + SocketReader *input_fac_reader_; + int spill_channel_; + int spill_method_; int channel2_; int channel3_; float rmut_, gmut_, bmut_; @@ -46,25 +46,25 @@ class ColorSpillOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; - void setSettings(NodeColorspill *nodeColorSpill) + void set_settings(NodeColorspill *node_color_spill) { - settings_ = nodeColorSpill; + settings_ = node_color_spill; } - void setSpillChannel(int channel) + void set_spill_channel(int channel) { - spillChannel_ = channel; + spill_channel_ = channel; } - void setSpillMethod(int method) + void set_spill_method(int method) { - spillMethod_ = method; + spill_method_ = method; } - float calculateMapValue(float fac, float *input); + float calculate_map_value(float fac, float *input); void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cc b/source/blender/compositor/operations/COM_CompositorOperation.cc index 029dec8c371..e27fc971a87 100644 --- a/source/blender/compositor/operations/COM_CompositorOperation.cc +++ b/source/blender/compositor/operations/COM_CompositorOperation.cc @@ -27,76 +27,76 @@ namespace blender::compositor { CompositorOperation::CompositorOperation() { - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Value); - - this->setRenderData(nullptr); - outputBuffer_ = nullptr; - depthBuffer_ = nullptr; - imageInput_ = nullptr; - alphaInput_ = nullptr; - depthInput_ = nullptr; - - useAlphaInput_ = false; + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Value); + + this->set_render_data(nullptr); + output_buffer_ = nullptr; + depth_buffer_ = nullptr; + image_input_ = nullptr; + alpha_input_ = nullptr; + depth_input_ = nullptr; + + use_alpha_input_ = false; active_ = false; scene_ = nullptr; - sceneName_[0] = '\0'; - viewName_ = nullptr; + scene_name_[0] = '\0'; + view_name_ = nullptr; flags.use_render_border = true; } -void CompositorOperation::initExecution() +void CompositorOperation::init_execution() { if (!active_) { return; } /* When initializing the tree during initial load the width and height can be zero. */ - imageInput_ = getInputSocketReader(0); - alphaInput_ = getInputSocketReader(1); - depthInput_ = getInputSocketReader(2); - if (this->getWidth() * this->getHeight() != 0) { - outputBuffer_ = (float *)MEM_callocN(sizeof(float[4]) * this->getWidth() * this->getHeight(), - "CompositorOperation"); + image_input_ = get_input_socket_reader(0); + alpha_input_ = get_input_socket_reader(1); + depth_input_ = get_input_socket_reader(2); + if (this->get_width() * this->get_height() != 0) { + output_buffer_ = (float *)MEM_callocN( + sizeof(float[4]) * this->get_width() * this->get_height(), "CompositorOperation"); } - if (depthInput_ != nullptr) { - depthBuffer_ = (float *)MEM_callocN(sizeof(float) * this->getWidth() * this->getHeight(), - "CompositorOperation"); + if (depth_input_ != nullptr) { + depth_buffer_ = (float *)MEM_callocN(sizeof(float) * this->get_width() * this->get_height(), + "CompositorOperation"); } } -void CompositorOperation::deinitExecution() +void CompositorOperation::deinit_execution() { if (!active_) { return; } - if (!isBraked()) { + if (!is_braked()) { Render *re = RE_GetSceneRender(scene_); RenderResult *rr = RE_AcquireResultWrite(re); if (rr) { - RenderView *rv = RE_RenderViewGetByName(rr, viewName_); + RenderView *rv = RE_RenderViewGetByName(rr, view_name_); if (rv->rectf != nullptr) { MEM_freeN(rv->rectf); } - rv->rectf = outputBuffer_; + rv->rectf = output_buffer_; if (rv->rectz != nullptr) { MEM_freeN(rv->rectz); } - rv->rectz = depthBuffer_; + rv->rectz = depth_buffer_; rr->have_combined = true; } else { - if (outputBuffer_) { - MEM_freeN(outputBuffer_); + if (output_buffer_) { + MEM_freeN(output_buffer_); } - if (depthBuffer_) { - MEM_freeN(depthBuffer_); + if (depth_buffer_) { + MEM_freeN(depth_buffer_); } } @@ -113,26 +113,26 @@ void CompositorOperation::deinitExecution() BLI_thread_unlock(LOCK_DRAW_IMAGE); } else { - if (outputBuffer_) { - MEM_freeN(outputBuffer_); + if (output_buffer_) { + MEM_freeN(output_buffer_); } - if (depthBuffer_) { - MEM_freeN(depthBuffer_); + if (depth_buffer_) { + MEM_freeN(depth_buffer_); } } - outputBuffer_ = nullptr; - depthBuffer_ = nullptr; - imageInput_ = nullptr; - alphaInput_ = nullptr; - depthInput_ = nullptr; + output_buffer_ = nullptr; + depth_buffer_ = nullptr; + image_input_ = nullptr; + alpha_input_ = nullptr; + depth_input_ = nullptr; } -void CompositorOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/) +void CompositorOperation::execute_region(rcti *rect, unsigned int /*tile_number*/) { float color[8]; // 7 is enough - float *buffer = outputBuffer_; - float *zbuffer = depthBuffer_; + float *buffer = output_buffer_; + float *zbuffer = depth_buffer_; if (!buffer) { return; @@ -141,8 +141,8 @@ void CompositorOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/) int y1 = rect->ymin; int x2 = rect->xmax; int y2 = rect->ymax; - int offset = (y1 * this->getWidth() + x1); - int add = (this->getWidth() - (x2 - x1)); + int offset = (y1 * this->get_width() + x1); + int add = (this->get_width() - (x2 - x1)); int offset4 = offset * COM_DATA_TYPE_COLOR_CHANNELS; int x; int y; @@ -183,8 +183,8 @@ void CompositorOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/) int full_width = rd->xsch * rd->size / 100; int full_height = rd->ysch * rd->size / 100; - dx = rd->border.xmin * full_width - (full_width - this->getWidth()) / 2.0f; - dy = rd->border.ymin * full_height - (full_height - this->getHeight()) / 2.0f; + dx = rd->border.xmin * full_width - (full_width - this->get_width()) / 2.0f; + dy = rd->border.ymin * full_height - (full_height - this->get_height()) / 2.0f; } #endif @@ -192,18 +192,18 @@ void CompositorOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/) for (x = x1; x < x2 && (!breaked); x++) { int input_x = x + dx, input_y = y + dy; - imageInput_->readSampled(color, input_x, input_y, PixelSampler::Nearest); - if (useAlphaInput_) { - alphaInput_->readSampled(&(color[3]), input_x, input_y, PixelSampler::Nearest); + image_input_->read_sampled(color, input_x, input_y, PixelSampler::Nearest); + if (use_alpha_input_) { + alpha_input_->read_sampled(&(color[3]), input_x, input_y, PixelSampler::Nearest); } copy_v4_v4(buffer + offset4, color); - depthInput_->readSampled(color, input_x, input_y, PixelSampler::Nearest); + depth_input_->read_sampled(color, input_x, input_y, PixelSampler::Nearest); zbuffer[offset] = color[0]; offset4 += COM_DATA_TYPE_COLOR_CHANNELS; offset++; - if (isBraked()) { + if (is_braked()) { breaked = true; } } @@ -216,15 +216,15 @@ void CompositorOperation::update_memory_buffer_partial(MemoryBuffer *UNUSED(outp const rcti &area, Span<MemoryBuffer *> inputs) { - if (!outputBuffer_) { + if (!output_buffer_) { return; } - MemoryBuffer output_buf(outputBuffer_, COM_DATA_TYPE_COLOR_CHANNELS, getWidth(), getHeight()); + MemoryBuffer output_buf(output_buffer_, COM_DATA_TYPE_COLOR_CHANNELS, get_width(), get_height()); output_buf.copy_from(inputs[0], area); - if (useAlphaInput_) { + if (use_alpha_input_) { output_buf.copy_from(inputs[1], area, 0, COM_DATA_TYPE_VALUE_CHANNELS, 3); } - MemoryBuffer depth_buf(depthBuffer_, COM_DATA_TYPE_VALUE_CHANNELS, getWidth(), getHeight()); + MemoryBuffer depth_buf(depth_buffer_, COM_DATA_TYPE_VALUE_CHANNELS, get_width(), get_height()); depth_buf.copy_from(inputs[2], area); } diff --git a/source/blender/compositor/operations/COM_CompositorOperation.h b/source/blender/compositor/operations/COM_CompositorOperation.h index e9539ae66fd..a0960074708 100644 --- a/source/blender/compositor/operations/COM_CompositorOperation.h +++ b/source/blender/compositor/operations/COM_CompositorOperation.h @@ -33,7 +33,7 @@ class CompositorOperation : public MultiThreadedOperation { /** * \brief Scene name, used for getting the render output, includes 'SC' prefix. */ - char sceneName_[MAX_ID_NAME]; + char scene_name_[MAX_ID_NAME]; /** * \brief local reference to the scene @@ -43,32 +43,32 @@ class CompositorOperation : public MultiThreadedOperation { /** * \brief reference to the output float buffer */ - float *outputBuffer_; + float *output_buffer_; /** * \brief reference to the output depth float buffer */ - float *depthBuffer_; + float *depth_buffer_; /** * \brief local reference to the input image operation */ - SocketReader *imageInput_; + SocketReader *image_input_; /** * \brief local reference to the input alpha operation */ - SocketReader *alphaInput_; + SocketReader *alpha_input_; /** * \brief local reference to the depth operation */ - SocketReader *depthInput_; + SocketReader *depth_input_; /** * \brief Ignore any alpha input */ - bool useAlphaInput_; + bool use_alpha_input_; /** * \brief operation is active for calculating final compo result @@ -78,47 +78,47 @@ class CompositorOperation : public MultiThreadedOperation { /** * \brief View name, used for multiview */ - const char *viewName_; + const char *view_name_; public: CompositorOperation(); - bool isActiveCompositorOutput() const + bool is_active_compositor_output() const { return active_; } - void executeRegion(rcti *rect, unsigned int tileNumber) override; - void setScene(const struct Scene *scene) + void execute_region(rcti *rect, unsigned int tile_number) override; + void set_scene(const struct Scene *scene) { scene_ = scene; } - void setSceneName(const char *sceneName) + void set_scene_name(const char *scene_name) { - BLI_strncpy(sceneName_, sceneName, sizeof(sceneName_)); + BLI_strncpy(scene_name_, scene_name, sizeof(scene_name_)); } - void setViewName(const char *viewName) + void set_view_name(const char *view_name) { - viewName_ = viewName; + view_name_ = view_name; } - void setRenderData(const RenderData *rd) + void set_render_data(const RenderData *rd) { rd_ = rd; } - bool isOutputOperation(bool /*rendering*/) const override + bool is_output_operation(bool /*rendering*/) const override { - return this->isActiveCompositorOutput(); + return this->is_active_compositor_output(); } - void initExecution() override; - void deinitExecution() override; - eCompositorPriority getRenderPriority() const override + void init_execution() override; + void deinit_execution() override; + eCompositorPriority get_render_priority() const override { return eCompositorPriority::Medium; } void determine_canvas(const rcti &preferred_area, rcti &r_area) override; - void setUseAlphaInput(bool value) + void set_use_alpha_input(bool value) { - useAlphaInput_ = value; + use_alpha_input_ = value; } - void setActive(bool active) + void set_active(bool active) { active_ = active; } diff --git a/source/blender/compositor/operations/COM_ConstantOperation.h b/source/blender/compositor/operations/COM_ConstantOperation.h index d44d1939424..d0db1ef1366 100644 --- a/source/blender/compositor/operations/COM_ConstantOperation.h +++ b/source/blender/compositor/operations/COM_ConstantOperation.h @@ -22,7 +22,7 @@ namespace blender::compositor { -/* TODO(manzanilla): After removing tiled implementation, implement a default #determineResolution +/* TODO(manzanilla): After removing tiled implementation, implement a default #determine_resolution * for all constant operations and make all initialization and deinitilization methods final. */ /** * Base class for operations that are always constant. Operations that can be constant only when diff --git a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cc b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cc index 4f78c919695..db75b2724c4 100644 --- a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cc +++ b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.cc @@ -24,30 +24,31 @@ namespace blender::compositor { ConvertColorProfileOperation::ConvertColorProfileOperation() { - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); - inputOperation_ = nullptr; + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); + input_operation_ = nullptr; predivided_ = false; } -void ConvertColorProfileOperation::initExecution() +void ConvertColorProfileOperation::init_execution() { - inputOperation_ = this->getInputSocketReader(0); + input_operation_ = this->get_input_socket_reader(0); } -void ConvertColorProfileOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ConvertColorProfileOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { float color[4]; - inputOperation_->readSampled(color, x, y, sampler); - IMB_buffer_float_from_float(output, color, 4, toProfile_, fromProfile_, predivided_, 1, 1, 0, 0); + input_operation_->read_sampled(color, x, y, sampler); + IMB_buffer_float_from_float( + output, color, 4, to_profile_, from_profile_, predivided_, 1, 1, 0, 0); } -void ConvertColorProfileOperation::deinitExecution() +void ConvertColorProfileOperation::deinit_execution() { - inputOperation_ = nullptr; + input_operation_ = nullptr; } } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h index 532fad86091..960d267b906 100644 --- a/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h +++ b/source/blender/compositor/operations/COM_ConvertColorProfileOperation.h @@ -29,19 +29,19 @@ namespace blender::compositor { class ConvertColorProfileOperation : public NodeOperation { private: /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputOperation_; + SocketReader *input_operation_; /** * \brief color profile where to convert from */ - int fromProfile_; + int from_profile_; /** * \brief color profile where to convert to */ - int toProfile_; + int to_profile_; /** * \brief is color predivided @@ -57,27 +57,27 @@ class ConvertColorProfileOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void setFromColorProfile(int colorProfile) + void set_from_color_profile(int color_profile) { - fromProfile_ = colorProfile; + from_profile_ = color_profile; } - void setToColorProfile(int colorProfile) + void set_to_color_profile(int color_profile) { - toProfile_ = colorProfile; + to_profile_ = color_profile; } - void setPredivided(bool predivided) + void set_predivided(bool predivided) { predivided_ = predivided; } diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cc b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cc index fcd9d26c3f0..a781b3ea1ed 100644 --- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cc +++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cc @@ -24,65 +24,65 @@ namespace blender::compositor { ConvertDepthToRadiusOperation::ConvertDepthToRadiusOperation() { - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Value); - inputOperation_ = nullptr; - fStop_ = 128.0f; - cameraObject_ = nullptr; - maxRadius_ = 32.0f; - blurPostOperation_ = nullptr; + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Value); + input_operation_ = nullptr; + f_stop_ = 128.0f; + camera_object_ = nullptr; + max_radius_ = 32.0f; + blur_post_operation_ = nullptr; } -float ConvertDepthToRadiusOperation::determineFocalDistance() +float ConvertDepthToRadiusOperation::determine_focal_distance() { - if (cameraObject_ && cameraObject_->type == OB_CAMERA) { - Camera *camera = (Camera *)cameraObject_->data; + if (camera_object_ && camera_object_->type == OB_CAMERA) { + Camera *camera = (Camera *)camera_object_->data; cam_lens_ = camera->lens; - return BKE_camera_object_dof_distance(cameraObject_); + return BKE_camera_object_dof_distance(camera_object_); } return 10.0f; } -void ConvertDepthToRadiusOperation::initExecution() +void ConvertDepthToRadiusOperation::init_execution() { float cam_sensor = DEFAULT_SENSOR_WIDTH; Camera *camera = nullptr; - if (cameraObject_ && cameraObject_->type == OB_CAMERA) { - camera = (Camera *)cameraObject_->data; + if (camera_object_ && camera_object_->type == OB_CAMERA) { + camera = (Camera *)camera_object_->data; cam_sensor = BKE_camera_sensor_size(camera->sensor_fit, camera->sensor_x, camera->sensor_y); } - inputOperation_ = this->getInputSocketReader(0); - float focalDistance = determineFocalDistance(); - if (focalDistance == 0.0f) { - focalDistance = 1e10f; /* If the DOF is 0.0 then set it to be far away. */ + input_operation_ = this->get_input_socket_reader(0); + float focal_distance = determine_focal_distance(); + if (focal_distance == 0.0f) { + focal_distance = 1e10f; /* If the DOF is 0.0 then set it to be far away. */ } - inverseFocalDistance_ = 1.0f / focalDistance; - aspect_ = (this->getWidth() > this->getHeight()) ? - (this->getHeight() / (float)this->getWidth()) : - (this->getWidth() / (float)this->getHeight()); - aperture_ = 0.5f * (cam_lens_ / (aspect_ * cam_sensor)) / fStop_; - const float minsz = MIN2(getWidth(), getHeight()); + inverse_focal_distance_ = 1.0f / focal_distance; + aspect_ = (this->get_width() > this->get_height()) ? + (this->get_height() / (float)this->get_width()) : + (this->get_width() / (float)this->get_height()); + aperture_ = 0.5f * (cam_lens_ / (aspect_ * cam_sensor)) / f_stop_; + const float minsz = MIN2(get_width(), get_height()); dof_sp_ = minsz / ((cam_sensor / 2.0f) / cam_lens_); /* <- == `aspect * MIN2(img->x, img->y) / tan(0.5f * fov)` */ - if (blurPostOperation_) { - blurPostOperation_->setSigma(MIN2(aperture_ * 128.0f, maxRadius_)); + if (blur_post_operation_) { + blur_post_operation_->set_sigma(MIN2(aperture_ * 128.0f, max_radius_)); } } -void ConvertDepthToRadiusOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ConvertDepthToRadiusOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue[4]; + float input_value[4]; float z; float radius; - inputOperation_->readSampled(inputValue, x, y, sampler); - z = inputValue[0]; + input_operation_->read_sampled(input_value, x, y, sampler); + z = input_value[0]; if (z != 0.0f) { float iZ = (1.0f / z); @@ -92,14 +92,14 @@ void ConvertDepthToRadiusOperation::executePixelSampled(float output[4], /* Scale crad back to original maximum and blend. */ crad->rect[px] = bcrad + wts->rect[px] * (scf * crad->rect[px] - bcrad); #endif - radius = 0.5f * fabsf(aperture_ * (dof_sp_ * (inverseFocalDistance_ - iZ) - 1.0f)); + radius = 0.5f * fabsf(aperture_ * (dof_sp_ * (inverse_focal_distance_ - iZ) - 1.0f)); /* 'bug' T6615, limit minimum radius to 1 pixel, * not really a solution, but somewhat mitigates the problem. */ if (radius < 0.0f) { radius = 0.0f; } - if (radius > maxRadius_) { - radius = maxRadius_; + if (radius > max_radius_) { + radius = max_radius_; } output[0] = radius; } @@ -108,9 +108,9 @@ void ConvertDepthToRadiusOperation::executePixelSampled(float output[4], } } -void ConvertDepthToRadiusOperation::deinitExecution() +void ConvertDepthToRadiusOperation::deinit_execution() { - inputOperation_ = nullptr; + input_operation_ = nullptr; } void ConvertDepthToRadiusOperation::update_memory_buffer_partial(MemoryBuffer *output, @@ -133,10 +133,10 @@ void ConvertDepthToRadiusOperation::update_memory_buffer_partial(MemoryBuffer *o * `crad->rect[px] = bcrad + wts->rect[px] * (scf * crad->rect[px] - bcrad);` */ #endif const float radius = 0.5f * - fabsf(aperture_ * (dof_sp_ * (inverseFocalDistance_ - inv_z) - 1.0f)); + fabsf(aperture_ * (dof_sp_ * (inverse_focal_distance_ - inv_z) - 1.0f)); /* Bug T6615, limit minimum radius to 1 pixel, * not really a solution, but somewhat mitigates the problem. */ - *it.out = CLAMPIS(radius, 0.0f, maxRadius_); + *it.out = CLAMPIS(radius, 0.0f, max_radius_); } } diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h index d3beff60207..72d19eb3dd8 100644 --- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h +++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.h @@ -31,19 +31,19 @@ namespace blender::compositor { class ConvertDepthToRadiusOperation : public MultiThreadedOperation { private: /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputOperation_; - float fStop_; + SocketReader *input_operation_; + float f_stop_; float aspect_; - float maxRadius_; - float inverseFocalDistance_; + float max_radius_; + float inverse_focal_distance_; float aperture_; float cam_lens_; float dof_sp_; - Object *cameraObject_; + Object *camera_object_; - FastGaussianBlurValueOperation *blurPostOperation_; + FastGaussianBlurValueOperation *blur_post_operation_; public: /** @@ -54,34 +54,34 @@ class ConvertDepthToRadiusOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void setfStop(float fStop) + void setf_stop(float f_stop) { - fStop_ = fStop; + f_stop_ = f_stop; } - void setMaxRadius(float maxRadius) + void set_max_radius(float max_radius) { - maxRadius_ = maxRadius; + max_radius_ = max_radius; } - void setCameraObject(Object *camera) + void set_camera_object(Object *camera) { - cameraObject_ = camera; + camera_object_ = camera; } - float determineFocalDistance(); - void setPostBlur(FastGaussianBlurValueOperation *operation) + float determine_focal_distance(); + void set_post_blur(FastGaussianBlurValueOperation *operation) { - blurPostOperation_ = operation; + blur_post_operation_ = operation; } void update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_ConvertOperation.cc b/source/blender/compositor/operations/COM_ConvertOperation.cc index 88de54e8c41..7f1018ca71e 100644 --- a/source/blender/compositor/operations/COM_ConvertOperation.cc +++ b/source/blender/compositor/operations/COM_ConvertOperation.cc @@ -26,18 +26,18 @@ namespace blender::compositor { ConvertBaseOperation::ConvertBaseOperation() { - inputOperation_ = nullptr; + input_operation_ = nullptr; this->flags.can_be_constant = true; } -void ConvertBaseOperation::initExecution() +void ConvertBaseOperation::init_execution() { - inputOperation_ = this->getInputSocketReader(0); + input_operation_ = this->get_input_socket_reader(0); } -void ConvertBaseOperation::deinitExecution() +void ConvertBaseOperation::deinit_execution() { - inputOperation_ = nullptr; + input_operation_ = nullptr; } void ConvertBaseOperation::hash_output_params() @@ -56,17 +56,17 @@ void ConvertBaseOperation::update_memory_buffer_partial(MemoryBuffer *output, ConvertValueToColorOperation::ConvertValueToColorOperation() : ConvertBaseOperation() { - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Color); } -void ConvertValueToColorOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ConvertValueToColorOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { float value; - inputOperation_->readSampled(&value, x, y, sampler); + input_operation_->read_sampled(&value, x, y, sampler); output[0] = output[1] = output[2] = value; output[3] = 1.0f; } @@ -83,18 +83,18 @@ void ConvertValueToColorOperation::update_memory_buffer_partial(BuffersIterator< ConvertColorToValueOperation::ConvertColorToValueOperation() : ConvertBaseOperation() { - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Value); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Value); } -void ConvertColorToValueOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ConvertColorToValueOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor[4]; - inputOperation_->readSampled(inputColor, x, y, sampler); - output[0] = (inputColor[0] + inputColor[1] + inputColor[2]) / 3.0f; + float input_color[4]; + input_operation_->read_sampled(input_color, x, y, sampler); + output[0] = (input_color[0] + input_color[1] + input_color[2]) / 3.0f; } void ConvertColorToValueOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -109,18 +109,18 @@ void ConvertColorToValueOperation::update_memory_buffer_partial(BuffersIterator< ConvertColorToBWOperation::ConvertColorToBWOperation() : ConvertBaseOperation() { - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Value); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Value); } -void ConvertColorToBWOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ConvertColorToBWOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor[4]; - inputOperation_->readSampled(inputColor, x, y, sampler); - output[0] = IMB_colormanagement_get_luminance(inputColor); + float input_color[4]; + input_operation_->read_sampled(input_color, x, y, sampler); + output[0] = IMB_colormanagement_get_luminance(input_color); } void ConvertColorToBWOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -134,17 +134,17 @@ void ConvertColorToBWOperation::update_memory_buffer_partial(BuffersIterator<flo ConvertColorToVectorOperation::ConvertColorToVectorOperation() : ConvertBaseOperation() { - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Vector); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Vector); } -void ConvertColorToVectorOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ConvertColorToVectorOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { float color[4]; - inputOperation_->readSampled(color, x, y, sampler); + input_operation_->read_sampled(color, x, y, sampler); copy_v3_v3(output, color); } @@ -159,17 +159,17 @@ void ConvertColorToVectorOperation::update_memory_buffer_partial(BuffersIterator ConvertValueToVectorOperation::ConvertValueToVectorOperation() : ConvertBaseOperation() { - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Vector); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Vector); } -void ConvertValueToVectorOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ConvertValueToVectorOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { float value; - inputOperation_->readSampled(&value, x, y, sampler); + input_operation_->read_sampled(&value, x, y, sampler); output[0] = output[1] = output[2] = value; } @@ -184,16 +184,16 @@ void ConvertValueToVectorOperation::update_memory_buffer_partial(BuffersIterator ConvertVectorToColorOperation::ConvertVectorToColorOperation() : ConvertBaseOperation() { - this->addInputSocket(DataType::Vector); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Vector); + this->add_output_socket(DataType::Color); } -void ConvertVectorToColorOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ConvertVectorToColorOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - inputOperation_->readSampled(output, x, y, sampler); + input_operation_->read_sampled(output, x, y, sampler); output[3] = 1.0f; } @@ -209,17 +209,17 @@ void ConvertVectorToColorOperation::update_memory_buffer_partial(BuffersIterator ConvertVectorToValueOperation::ConvertVectorToValueOperation() : ConvertBaseOperation() { - this->addInputSocket(DataType::Vector); - this->addOutputSocket(DataType::Value); + this->add_input_socket(DataType::Vector); + this->add_output_socket(DataType::Value); } -void ConvertVectorToValueOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ConvertVectorToValueOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { float input[4]; - inputOperation_->readSampled(input, x, y, sampler); + input_operation_->read_sampled(input, x, y, sampler); output[0] = (input[0] + input[1] + input[2]) / 3.0f; } @@ -235,11 +235,11 @@ void ConvertVectorToValueOperation::update_memory_buffer_partial(BuffersIterator ConvertRGBToYCCOperation::ConvertRGBToYCCOperation() : ConvertBaseOperation() { - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); } -void ConvertRGBToYCCOperation::setMode(int mode) +void ConvertRGBToYCCOperation::set_mode(int mode) { switch (mode) { case 0: @@ -255,21 +255,22 @@ void ConvertRGBToYCCOperation::setMode(int mode) } } -void ConvertRGBToYCCOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ConvertRGBToYCCOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor[4]; + float input_color[4]; float color[3]; - inputOperation_->readSampled(inputColor, x, y, sampler); - rgb_to_ycc(inputColor[0], inputColor[1], inputColor[2], &color[0], &color[1], &color[2], mode_); + input_operation_->read_sampled(input_color, x, y, sampler); + rgb_to_ycc( + input_color[0], input_color[1], input_color[2], &color[0], &color[1], &color[2], mode_); /* divided by 255 to normalize for viewing in */ /* R,G,B --> Y,Cb,Cr */ mul_v3_v3fl(output, color, 1.0f / 255.0f); - output[3] = inputColor[3]; + output[3] = input_color[3]; } void ConvertRGBToYCCOperation::hash_output_params() @@ -294,11 +295,11 @@ void ConvertRGBToYCCOperation::update_memory_buffer_partial(BuffersIterator<floa ConvertYCCToRGBOperation::ConvertYCCToRGBOperation() : ConvertBaseOperation() { - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); } -void ConvertYCCToRGBOperation::setMode(int mode) +void ConvertYCCToRGBOperation::set_mode(int mode) { switch (mode) { case 0: @@ -314,21 +315,21 @@ void ConvertYCCToRGBOperation::setMode(int mode) } } -void ConvertYCCToRGBOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ConvertYCCToRGBOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor[4]; - inputOperation_->readSampled(inputColor, x, y, sampler); + float input_color[4]; + input_operation_->read_sampled(input_color, x, y, sampler); /* need to un-normalize the data */ /* R,G,B --> Y,Cb,Cr */ - mul_v3_fl(inputColor, 255.0f); + mul_v3_fl(input_color, 255.0f); ycc_to_rgb( - inputColor[0], inputColor[1], inputColor[2], &output[0], &output[1], &output[2], mode_); - output[3] = inputColor[3]; + input_color[0], input_color[1], input_color[2], &output[0], &output[1], &output[2], mode_); + output[3] = input_color[3]; } void ConvertYCCToRGBOperation::hash_output_params() @@ -352,25 +353,25 @@ void ConvertYCCToRGBOperation::update_memory_buffer_partial(BuffersIterator<floa ConvertRGBToYUVOperation::ConvertRGBToYUVOperation() : ConvertBaseOperation() { - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); } -void ConvertRGBToYUVOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ConvertRGBToYUVOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor[4]; - inputOperation_->readSampled(inputColor, x, y, sampler); - rgb_to_yuv(inputColor[0], - inputColor[1], - inputColor[2], + float input_color[4]; + input_operation_->read_sampled(input_color, x, y, sampler); + rgb_to_yuv(input_color[0], + input_color[1], + input_color[2], &output[0], &output[1], &output[2], BLI_YUV_ITU_BT709); - output[3] = inputColor[3]; + output[3] = input_color[3]; } void ConvertRGBToYUVOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -386,25 +387,25 @@ void ConvertRGBToYUVOperation::update_memory_buffer_partial(BuffersIterator<floa ConvertYUVToRGBOperation::ConvertYUVToRGBOperation() : ConvertBaseOperation() { - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); } -void ConvertYUVToRGBOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ConvertYUVToRGBOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor[4]; - inputOperation_->readSampled(inputColor, x, y, sampler); - yuv_to_rgb(inputColor[0], - inputColor[1], - inputColor[2], + float input_color[4]; + input_operation_->read_sampled(input_color, x, y, sampler); + yuv_to_rgb(input_color[0], + input_color[1], + input_color[2], &output[0], &output[1], &output[2], BLI_YUV_ITU_BT709); - output[3] = inputColor[3]; + output[3] = input_color[3]; } void ConvertYUVToRGBOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -420,19 +421,19 @@ void ConvertYUVToRGBOperation::update_memory_buffer_partial(BuffersIterator<floa ConvertRGBToHSVOperation::ConvertRGBToHSVOperation() : ConvertBaseOperation() { - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); } -void ConvertRGBToHSVOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ConvertRGBToHSVOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor[4]; - inputOperation_->readSampled(inputColor, x, y, sampler); - rgb_to_hsv_v(inputColor, output); - output[3] = inputColor[3]; + float input_color[4]; + input_operation_->read_sampled(input_color, x, y, sampler); + rgb_to_hsv_v(input_color, output); + output[3] = input_color[3]; } void ConvertRGBToHSVOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -448,22 +449,22 @@ void ConvertRGBToHSVOperation::update_memory_buffer_partial(BuffersIterator<floa ConvertHSVToRGBOperation::ConvertHSVToRGBOperation() : ConvertBaseOperation() { - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); } -void ConvertHSVToRGBOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ConvertHSVToRGBOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor[4]; - inputOperation_->readSampled(inputColor, x, y, sampler); - hsv_to_rgb_v(inputColor, output); + float input_color[4]; + input_operation_->read_sampled(input_color, x, y, sampler); + hsv_to_rgb_v(input_color, output); output[0] = max_ff(output[0], 0.0f); output[1] = max_ff(output[1], 0.0f); output[2] = max_ff(output[2], 0.0f); - output[3] = inputColor[3]; + output[3] = input_color[3]; } void ConvertHSVToRGBOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -482,17 +483,17 @@ void ConvertHSVToRGBOperation::update_memory_buffer_partial(BuffersIterator<floa ConvertPremulToStraightOperation::ConvertPremulToStraightOperation() : ConvertBaseOperation() { - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); } -void ConvertPremulToStraightOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ConvertPremulToStraightOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { ColorSceneLinear4f<eAlpha::Premultiplied> input; - inputOperation_->readSampled(input, x, y, sampler); + input_operation_->read_sampled(input, x, y, sampler); ColorSceneLinear4f<eAlpha::Straight> converted = input.unpremultiply_alpha(); copy_v4_v4(output, converted); } @@ -508,17 +509,17 @@ void ConvertPremulToStraightOperation::update_memory_buffer_partial(BuffersItera ConvertStraightToPremulOperation::ConvertStraightToPremulOperation() : ConvertBaseOperation() { - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); } -void ConvertStraightToPremulOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ConvertStraightToPremulOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { ColorSceneLinear4f<eAlpha::Straight> input; - inputOperation_->readSampled(input, x, y, sampler); + input_operation_->read_sampled(input, x, y, sampler); ColorSceneLinear4f<eAlpha::Premultiplied> converted = input.premultiply_alpha(); copy_v4_v4(output, converted); } @@ -534,27 +535,27 @@ void ConvertStraightToPremulOperation::update_memory_buffer_partial(BuffersItera SeparateChannelOperation::SeparateChannelOperation() { - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Value); - inputOperation_ = nullptr; + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Value); + input_operation_ = nullptr; } -void SeparateChannelOperation::initExecution() +void SeparateChannelOperation::init_execution() { - inputOperation_ = this->getInputSocketReader(0); + input_operation_ = this->get_input_socket_reader(0); } -void SeparateChannelOperation::deinitExecution() +void SeparateChannelOperation::deinit_execution() { - inputOperation_ = nullptr; + input_operation_ = nullptr; } -void SeparateChannelOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void SeparateChannelOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { float input[4]; - inputOperation_->readSampled(input, x, y, sampler); + input_operation_->read_sampled(input, x, y, sampler); output[0] = input[channel_]; } @@ -571,54 +572,54 @@ void SeparateChannelOperation::update_memory_buffer_partial(MemoryBuffer *output CombineChannelsOperation::CombineChannelsOperation() { - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Color); this->set_canvas_input_index(0); - inputChannel1Operation_ = nullptr; - inputChannel2Operation_ = nullptr; - inputChannel3Operation_ = nullptr; - inputChannel4Operation_ = nullptr; + input_channel1_operation_ = nullptr; + input_channel2_operation_ = nullptr; + input_channel3_operation_ = nullptr; + input_channel4_operation_ = nullptr; } -void CombineChannelsOperation::initExecution() +void CombineChannelsOperation::init_execution() { - inputChannel1Operation_ = this->getInputSocketReader(0); - inputChannel2Operation_ = this->getInputSocketReader(1); - inputChannel3Operation_ = this->getInputSocketReader(2); - inputChannel4Operation_ = this->getInputSocketReader(3); + input_channel1_operation_ = this->get_input_socket_reader(0); + input_channel2_operation_ = this->get_input_socket_reader(1); + input_channel3_operation_ = this->get_input_socket_reader(2); + input_channel4_operation_ = this->get_input_socket_reader(3); } -void CombineChannelsOperation::deinitExecution() +void CombineChannelsOperation::deinit_execution() { - inputChannel1Operation_ = nullptr; - inputChannel2Operation_ = nullptr; - inputChannel3Operation_ = nullptr; - inputChannel4Operation_ = nullptr; + input_channel1_operation_ = nullptr; + input_channel2_operation_ = nullptr; + input_channel3_operation_ = nullptr; + input_channel4_operation_ = nullptr; } -void CombineChannelsOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void CombineChannelsOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { float input[4]; - if (inputChannel1Operation_) { - inputChannel1Operation_->readSampled(input, x, y, sampler); + if (input_channel1_operation_) { + input_channel1_operation_->read_sampled(input, x, y, sampler); output[0] = input[0]; } - if (inputChannel2Operation_) { - inputChannel2Operation_->readSampled(input, x, y, sampler); + if (input_channel2_operation_) { + input_channel2_operation_->read_sampled(input, x, y, sampler); output[1] = input[0]; } - if (inputChannel3Operation_) { - inputChannel3Operation_->readSampled(input, x, y, sampler); + if (input_channel3_operation_) { + input_channel3_operation_->read_sampled(input, x, y, sampler); output[2] = input[0]; } - if (inputChannel4Operation_) { - inputChannel4Operation_->readSampled(input, x, y, sampler); + if (input_channel4_operation_) { + input_channel4_operation_->read_sampled(input, x, y, sampler); output[3] = input[0]; } } diff --git a/source/blender/compositor/operations/COM_ConvertOperation.h b/source/blender/compositor/operations/COM_ConvertOperation.h index 9d4539c8faa..3c4ce358eec 100644 --- a/source/blender/compositor/operations/COM_ConvertOperation.h +++ b/source/blender/compositor/operations/COM_ConvertOperation.h @@ -24,13 +24,13 @@ namespace blender::compositor { class ConvertBaseOperation : public MultiThreadedOperation { protected: - SocketReader *inputOperation_; + SocketReader *input_operation_; public: ConvertBaseOperation(); - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, @@ -45,7 +45,7 @@ class ConvertValueToColorOperation : public ConvertBaseOperation { public: ConvertValueToColorOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -55,7 +55,7 @@ class ConvertColorToValueOperation : public ConvertBaseOperation { public: ConvertColorToValueOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -65,7 +65,7 @@ class ConvertColorToBWOperation : public ConvertBaseOperation { public: ConvertColorToBWOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -75,7 +75,7 @@ class ConvertColorToVectorOperation : public ConvertBaseOperation { public: ConvertColorToVectorOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -85,7 +85,7 @@ class ConvertValueToVectorOperation : public ConvertBaseOperation { public: ConvertValueToVectorOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -95,7 +95,7 @@ class ConvertVectorToColorOperation : public ConvertBaseOperation { public: ConvertVectorToColorOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -105,7 +105,7 @@ class ConvertVectorToValueOperation : public ConvertBaseOperation { public: ConvertVectorToValueOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -119,10 +119,10 @@ class ConvertRGBToYCCOperation : public ConvertBaseOperation { public: ConvertRGBToYCCOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; /** Set the YCC mode */ - void setMode(int mode); + void set_mode(int mode); protected: void hash_output_params() override; @@ -137,10 +137,10 @@ class ConvertYCCToRGBOperation : public ConvertBaseOperation { public: ConvertYCCToRGBOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; /** Set the YCC mode */ - void setMode(int mode); + void set_mode(int mode); protected: void hash_output_params() override; @@ -151,7 +151,7 @@ class ConvertRGBToYUVOperation : public ConvertBaseOperation { public: ConvertRGBToYUVOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -161,7 +161,7 @@ class ConvertYUVToRGBOperation : public ConvertBaseOperation { public: ConvertYUVToRGBOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -171,7 +171,7 @@ class ConvertRGBToHSVOperation : public ConvertBaseOperation { public: ConvertRGBToHSVOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -181,7 +181,7 @@ class ConvertHSVToRGBOperation : public ConvertBaseOperation { public: ConvertHSVToRGBOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -191,7 +191,7 @@ class ConvertPremulToStraightOperation : public ConvertBaseOperation { public: ConvertPremulToStraightOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -201,7 +201,7 @@ class ConvertStraightToPremulOperation : public ConvertBaseOperation { public: ConvertStraightToPremulOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -209,17 +209,17 @@ class ConvertStraightToPremulOperation : public ConvertBaseOperation { class SeparateChannelOperation : public MultiThreadedOperation { private: - SocketReader *inputOperation_; + SocketReader *input_operation_; int channel_; public: SeparateChannelOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; - void setChannel(int channel) + void set_channel(int channel) { channel_ = channel; } @@ -231,17 +231,17 @@ class SeparateChannelOperation : public MultiThreadedOperation { class CombineChannelsOperation : public MultiThreadedOperation { private: - SocketReader *inputChannel1Operation_; - SocketReader *inputChannel2Operation_; - SocketReader *inputChannel3Operation_; - SocketReader *inputChannel4Operation_; + SocketReader *input_channel1_operation_; + SocketReader *input_channel2_operation_; + SocketReader *input_channel3_operation_; + SocketReader *input_channel4_operation_; public: CombineChannelsOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, diff --git a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cc b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cc index 343cc32b625..7ba1f0bbe14 100644 --- a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cc +++ b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.cc @@ -20,7 +20,7 @@ namespace blender::compositor { -void ConvolutionEdgeFilterOperation::executePixel(float output[4], int x, int y, void * /*data*/) +void ConvolutionEdgeFilterOperation::execute_pixel(float output[4], int x, int y, void * /*data*/) { float in1[4], in2[4], res1[4] = {0.0}, res2[4] = {0.0}; @@ -30,50 +30,50 @@ void ConvolutionEdgeFilterOperation::executePixel(float output[4], int x, int y, int y1 = y - 1; int y2 = y; int y3 = y + 1; - CLAMP(x1, 0, getWidth() - 1); - CLAMP(x2, 0, getWidth() - 1); - CLAMP(x3, 0, getWidth() - 1); - CLAMP(y1, 0, getHeight() - 1); - CLAMP(y2, 0, getHeight() - 1); - CLAMP(y3, 0, getHeight() - 1); + CLAMP(x1, 0, get_width() - 1); + CLAMP(x2, 0, get_width() - 1); + CLAMP(x3, 0, get_width() - 1); + CLAMP(y1, 0, get_height() - 1); + CLAMP(y2, 0, get_height() - 1); + CLAMP(y3, 0, get_height() - 1); float value[4]; - inputValueOperation_->read(value, x2, y2, nullptr); + input_value_operation_->read(value, x2, y2, nullptr); float mval = 1.0f - value[0]; - inputOperation_->read(in1, x1, y1, nullptr); + input_operation_->read(in1, x1, y1, nullptr); madd_v3_v3fl(res1, in1, filter_[0]); madd_v3_v3fl(res2, in1, filter_[0]); - inputOperation_->read(in1, x2, y1, nullptr); + input_operation_->read(in1, x2, y1, nullptr); madd_v3_v3fl(res1, in1, filter_[1]); madd_v3_v3fl(res2, in1, filter_[3]); - inputOperation_->read(in1, x3, y1, nullptr); + input_operation_->read(in1, x3, y1, nullptr); madd_v3_v3fl(res1, in1, filter_[2]); madd_v3_v3fl(res2, in1, filter_[6]); - inputOperation_->read(in1, x1, y2, nullptr); + input_operation_->read(in1, x1, y2, nullptr); madd_v3_v3fl(res1, in1, filter_[3]); madd_v3_v3fl(res2, in1, filter_[1]); - inputOperation_->read(in2, x2, y2, nullptr); + input_operation_->read(in2, x2, y2, nullptr); madd_v3_v3fl(res1, in2, filter_[4]); madd_v3_v3fl(res2, in2, filter_[4]); - inputOperation_->read(in1, x3, y2, nullptr); + input_operation_->read(in1, x3, y2, nullptr); madd_v3_v3fl(res1, in1, filter_[5]); madd_v3_v3fl(res2, in1, filter_[7]); - inputOperation_->read(in1, x1, y3, nullptr); + input_operation_->read(in1, x1, y3, nullptr); madd_v3_v3fl(res1, in1, filter_[6]); madd_v3_v3fl(res2, in1, filter_[2]); - inputOperation_->read(in1, x2, y3, nullptr); + input_operation_->read(in1, x2, y3, nullptr); madd_v3_v3fl(res1, in1, filter_[7]); madd_v3_v3fl(res2, in1, filter_[5]); - inputOperation_->read(in1, x3, y3, nullptr); + input_operation_->read(in1, x3, y3, nullptr); madd_v3_v3fl(res1, in1, filter_[8]); madd_v3_v3fl(res2, in1, filter_[8]); @@ -99,8 +99,8 @@ void ConvolutionEdgeFilterOperation::update_memory_buffer_partial(MemoryBuffer * Span<MemoryBuffer *> inputs) { const MemoryBuffer *image = inputs[IMAGE_INPUT_INDEX]; - const int last_x = getWidth() - 1; - const int last_y = getHeight() - 1; + const int last_x = get_width() - 1; + const int last_y = get_height() - 1; for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) { const int left_offset = (it.x == 0) ? 0 : -image->elem_stride; const int right_offset = (it.x == last_x) ? 0 : image->elem_stride; diff --git a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h index bd38e27165a..a89a9412cf2 100644 --- a/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h +++ b/source/blender/compositor/operations/COM_ConvolutionEdgeFilterOperation.h @@ -24,7 +24,7 @@ namespace blender::compositor { class ConvolutionEdgeFilterOperation : public ConvolutionFilterOperation { public: - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, diff --git a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cc b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cc index a4ef88e7a33..6ee5a1c86f9 100644 --- a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cc +++ b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.cc @@ -22,17 +22,17 @@ namespace blender::compositor { ConvolutionFilterOperation::ConvolutionFilterOperation() { - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Color); this->set_canvas_input_index(0); - inputOperation_ = nullptr; + input_operation_ = nullptr; this->flags.complex = true; } -void ConvolutionFilterOperation::initExecution() +void ConvolutionFilterOperation::init_execution() { - inputOperation_ = this->getInputSocketReader(0); - inputValueOperation_ = this->getInputSocketReader(1); + input_operation_ = this->get_input_socket_reader(0); + input_value_operation_ = this->get_input_socket_reader(1); } void ConvolutionFilterOperation::set3x3Filter( @@ -47,17 +47,17 @@ void ConvolutionFilterOperation::set3x3Filter( filter_[6] = f7; filter_[7] = f8; filter_[8] = f9; - filterHeight_ = 3; - filterWidth_ = 3; + filter_height_ = 3; + filter_width_ = 3; } -void ConvolutionFilterOperation::deinitExecution() +void ConvolutionFilterOperation::deinit_execution() { - inputOperation_ = nullptr; - inputValueOperation_ = nullptr; + input_operation_ = nullptr; + input_value_operation_ = nullptr; } -void ConvolutionFilterOperation::executePixel(float output[4], int x, int y, void * /*data*/) +void ConvolutionFilterOperation::execute_pixel(float output[4], int x, int y, void * /*data*/) { float in1[4]; float in2[4]; @@ -67,34 +67,34 @@ void ConvolutionFilterOperation::executePixel(float output[4], int x, int y, voi int y1 = y - 1; int y2 = y; int y3 = y + 1; - CLAMP(x1, 0, getWidth() - 1); - CLAMP(x2, 0, getWidth() - 1); - CLAMP(x3, 0, getWidth() - 1); - CLAMP(y1, 0, getHeight() - 1); - CLAMP(y2, 0, getHeight() - 1); - CLAMP(y3, 0, getHeight() - 1); + CLAMP(x1, 0, get_width() - 1); + CLAMP(x2, 0, get_width() - 1); + CLAMP(x3, 0, get_width() - 1); + CLAMP(y1, 0, get_height() - 1); + CLAMP(y2, 0, get_height() - 1); + CLAMP(y3, 0, get_height() - 1); float value[4]; - inputValueOperation_->read(value, x2, y2, nullptr); + input_value_operation_->read(value, x2, y2, nullptr); const float mval = 1.0f - value[0]; zero_v4(output); - inputOperation_->read(in1, x1, y1, nullptr); + input_operation_->read(in1, x1, y1, nullptr); madd_v4_v4fl(output, in1, filter_[0]); - inputOperation_->read(in1, x2, y1, nullptr); + input_operation_->read(in1, x2, y1, nullptr); madd_v4_v4fl(output, in1, filter_[1]); - inputOperation_->read(in1, x3, y1, nullptr); + input_operation_->read(in1, x3, y1, nullptr); madd_v4_v4fl(output, in1, filter_[2]); - inputOperation_->read(in1, x1, y2, nullptr); + input_operation_->read(in1, x1, y2, nullptr); madd_v4_v4fl(output, in1, filter_[3]); - inputOperation_->read(in2, x2, y2, nullptr); + input_operation_->read(in2, x2, y2, nullptr); madd_v4_v4fl(output, in2, filter_[4]); - inputOperation_->read(in1, x3, y2, nullptr); + input_operation_->read(in1, x3, y2, nullptr); madd_v4_v4fl(output, in1, filter_[5]); - inputOperation_->read(in1, x1, y3, nullptr); + input_operation_->read(in1, x1, y3, nullptr); madd_v4_v4fl(output, in1, filter_[6]); - inputOperation_->read(in1, x2, y3, nullptr); + input_operation_->read(in1, x2, y3, nullptr); madd_v4_v4fl(output, in1, filter_[7]); - inputOperation_->read(in1, x3, y3, nullptr); + input_operation_->read(in1, x3, y3, nullptr); madd_v4_v4fl(output, in1, filter_[8]); output[0] = output[0] * value[0] + in2[0] * mval; @@ -109,18 +109,18 @@ void ConvolutionFilterOperation::executePixel(float output[4], int x, int y, voi output[3] = MAX2(output[3], 0.0f); } -bool ConvolutionFilterOperation::determineDependingAreaOfInterest( - rcti *input, ReadBufferOperation *readOperation, rcti *output) +bool ConvolutionFilterOperation::determine_depending_area_of_interest( + rcti *input, ReadBufferOperation *read_operation, rcti *output) { - rcti newInput; - int addx = (filterWidth_ - 1) / 2 + 1; - int addy = (filterHeight_ - 1) / 2 + 1; - newInput.xmax = input->xmax + addx; - newInput.xmin = input->xmin - addx; - newInput.ymax = input->ymax + addy; - newInput.ymin = input->ymin - addy; - - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + rcti new_input; + int addx = (filter_width_ - 1) / 2 + 1; + int addy = (filter_height_ - 1) / 2 + 1; + new_input.xmax = input->xmax + addx; + new_input.xmin = input->xmin - addx; + new_input.ymax = input->ymax + addy; + new_input.ymin = input->ymin - addy; + + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } void ConvolutionFilterOperation::get_area_of_interest(const int input_idx, @@ -129,8 +129,8 @@ void ConvolutionFilterOperation::get_area_of_interest(const int input_idx, { switch (input_idx) { case IMAGE_INPUT_INDEX: { - const int add_x = (filterWidth_ - 1) / 2 + 1; - const int add_y = (filterHeight_ - 1) / 2 + 1; + const int add_x = (filter_width_ - 1) / 2 + 1; + const int add_y = (filter_height_ - 1) / 2 + 1; r_input_area.xmin = output_area.xmin - add_x; r_input_area.xmax = output_area.xmax + add_x; r_input_area.ymin = output_area.ymin - add_y; @@ -149,8 +149,8 @@ void ConvolutionFilterOperation::update_memory_buffer_partial(MemoryBuffer *outp Span<MemoryBuffer *> inputs) { const MemoryBuffer *image = inputs[IMAGE_INPUT_INDEX]; - const int last_x = getWidth() - 1; - const int last_y = getHeight() - 1; + const int last_x = get_width() - 1; + const int last_y = get_height() - 1; for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) { const int left_offset = (it.x == 0) ? 0 : -image->elem_stride; const int right_offset = (it.x == last_x) ? 0 : image->elem_stride; diff --git a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h index 7000a0f69d6..d764c7c9081 100644 --- a/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h +++ b/source/blender/compositor/operations/COM_ConvolutionFilterOperation.h @@ -28,25 +28,25 @@ class ConvolutionFilterOperation : public MultiThreadedOperation { static constexpr int FACTOR_INPUT_INDEX = 1; private: - int filterWidth_; - int filterHeight_; + int filter_width_; + int filter_height_; protected: - SocketReader *inputOperation_; - SocketReader *inputValueOperation_; + SocketReader *input_operation_; + SocketReader *input_value_operation_; float filter_[9]; public: ConvolutionFilterOperation(); void set3x3Filter( float f1, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9); - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; - void executePixel(float output[4], int x, int y, void *data) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; + void execute_pixel(float output[4], int x, int y, void *data) override; - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) final; virtual void update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_CropOperation.cc b/source/blender/compositor/operations/COM_CropOperation.cc index d8a402cc582..5d78ed9d41a 100644 --- a/source/blender/compositor/operations/COM_CropOperation.cc +++ b/source/blender/compositor/operations/COM_CropOperation.cc @@ -22,17 +22,17 @@ namespace blender::compositor { CropBaseOperation::CropBaseOperation() { - this->addInputSocket(DataType::Color, ResizeMode::Align); - this->addOutputSocket(DataType::Color); - inputOperation_ = nullptr; + this->add_input_socket(DataType::Color, ResizeMode::Align); + this->add_output_socket(DataType::Color); + input_operation_ = nullptr; settings_ = nullptr; } -void CropBaseOperation::updateArea() +void CropBaseOperation::update_area() { - SocketReader *inputReference = this->getInputSocketReader(0); - float width = inputReference->getWidth(); - float height = inputReference->getHeight(); + SocketReader *input_reference = this->get_input_socket_reader(0); + float width = input_reference->get_width(); + float height = input_reference->get_height(); NodeTwoXYs local_settings = *settings_; if (width > 0.0f && height > 0.0f) { @@ -68,15 +68,15 @@ void CropBaseOperation::updateArea() } } -void CropBaseOperation::initExecution() +void CropBaseOperation::init_execution() { - inputOperation_ = this->getInputSocketReader(0); - updateArea(); + input_operation_ = this->get_input_socket_reader(0); + update_area(); } -void CropBaseOperation::deinitExecution() +void CropBaseOperation::deinit_execution() { - inputOperation_ = nullptr; + input_operation_ = nullptr; } CropOperation::CropOperation() : CropBaseOperation() @@ -84,10 +84,10 @@ CropOperation::CropOperation() : CropBaseOperation() /* pass */ } -void CropOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) +void CropOperation::execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) { if ((x < xmax_ && x >= xmin_) && (y < ymax_ && y >= ymin_)) { - inputOperation_->readSampled(output, x, y, sampler); + input_operation_->read_sampled(output, x, y, sampler); } else { zero_v4(output); @@ -115,18 +115,18 @@ CropImageOperation::CropImageOperation() : CropBaseOperation() /* pass */ } -bool CropImageOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool CropImageOperation::determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) { - rcti newInput; + rcti new_input; - newInput.xmax = input->xmax + xmin_; - newInput.xmin = input->xmin + xmin_; - newInput.ymax = input->ymax + ymin_; - newInput.ymin = input->ymin + ymin_; + new_input.xmax = input->xmax + xmin_; + new_input.xmin = input->xmin + xmin_; + new_input.ymax = input->ymax + ymin_; + new_input.ymin = input->ymin + ymin_; - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } void CropImageOperation::get_area_of_interest(const int input_idx, @@ -144,18 +144,18 @@ void CropImageOperation::get_area_of_interest(const int input_idx, void CropImageOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) { NodeOperation::determine_canvas(preferred_area, r_area); - updateArea(); + update_area(); r_area.xmax = r_area.xmin + (xmax_ - xmin_); r_area.ymax = r_area.ymin + (ymax_ - ymin_); } -void CropImageOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void CropImageOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - if (x >= 0 && x < getWidth() && y >= 0 && y < getHeight()) { - inputOperation_->readSampled(output, (x + xmin_), (y + ymin_), sampler); + if (x >= 0 && x < get_width() && y >= 0 && y < get_height()) { + input_operation_->read_sampled(output, (x + xmin_), (y + ymin_), sampler); } else { zero_v4(output); @@ -167,7 +167,7 @@ void CropImageOperation::update_memory_buffer_partial(MemoryBuffer *output, Span<MemoryBuffer *> inputs) { rcti op_area; - BLI_rcti_init(&op_area, 0, getWidth(), 0, getHeight()); + BLI_rcti_init(&op_area, 0, get_width(), 0, get_height()); const MemoryBuffer *input = inputs[0]; for (BuffersIterator<float> it = output->iterate_with({}, area); !it.is_end(); ++it) { if (BLI_rcti_isect_pt(&op_area, it.x, it.y)) { diff --git a/source/blender/compositor/operations/COM_CropOperation.h b/source/blender/compositor/operations/COM_CropOperation.h index 50d4d3c5126..69bfd72b052 100644 --- a/source/blender/compositor/operations/COM_CropOperation.h +++ b/source/blender/compositor/operations/COM_CropOperation.h @@ -24,7 +24,7 @@ namespace blender::compositor { class CropBaseOperation : public MultiThreadedOperation { protected: - SocketReader *inputOperation_; + SocketReader *input_operation_; NodeTwoXYs *settings_; bool relative_; int xmax_; @@ -32,17 +32,17 @@ class CropBaseOperation : public MultiThreadedOperation { int ymax_; int ymin_; - void updateArea(); + void update_area(); public: CropBaseOperation(); - void initExecution() override; - void deinitExecution() override; - void setCropSettings(NodeTwoXYs *settings) + void init_execution() override; + void deinit_execution() override; + void set_crop_settings(NodeTwoXYs *settings) { settings_ = settings; } - void setRelative(bool rel) + void set_relative(bool rel) { relative_ = rel; } @@ -52,7 +52,7 @@ class CropOperation : public CropBaseOperation { private: public: CropOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, @@ -63,11 +63,11 @@ class CropImageOperation : public CropBaseOperation { private: public: CropImageOperation(); - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; void determine_canvas(const rcti &preferred_area, rcti &r_area) override; - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; void update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_CryptomatteOperation.cc b/source/blender/compositor/operations/COM_CryptomatteOperation.cc index a6b9e2c2ee4..078ec9b6dfe 100644 --- a/source/blender/compositor/operations/COM_CryptomatteOperation.cc +++ b/source/blender/compositor/operations/COM_CryptomatteOperation.cc @@ -24,27 +24,27 @@ CryptomatteOperation::CryptomatteOperation(size_t num_inputs) { inputs.resize(num_inputs); for (size_t i = 0; i < num_inputs; i++) { - this->addInputSocket(DataType::Color); + this->add_input_socket(DataType::Color); } - this->addOutputSocket(DataType::Color); + this->add_output_socket(DataType::Color); this->flags.complex = true; } -void CryptomatteOperation::initExecution() +void CryptomatteOperation::init_execution() { for (size_t i = 0; i < inputs.size(); i++) { - inputs[i] = this->getInputSocketReader(i); + inputs[i] = this->get_input_socket_reader(i); } } -void CryptomatteOperation::addObjectIndex(float objectIndex) +void CryptomatteOperation::add_object_index(float object_index) { - if (objectIndex != 0.0f) { - objectIndex_.append(objectIndex); + if (object_index != 0.0f) { + object_index_.append(object_index); } } -void CryptomatteOperation::executePixel(float output[4], int x, int y, void *data) +void CryptomatteOperation::execute_pixel(float output[4], int x, int y, void *data) { float input[4]; output[0] = output[1] = output[2] = output[3] = 0.0f; @@ -60,7 +60,7 @@ 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 (float hash : objectIndex_) { + for (float hash : object_index_) { if (input[0] == hash) { output[3] += input[1]; } @@ -89,7 +89,7 @@ void CryptomatteOperation::update_memory_buffer_partial(MemoryBuffer *output, it.out[1] = ((float)(m3hash << 8) / (float)UINT32_MAX); it.out[2] = ((float)(m3hash << 16) / (float)UINT32_MAX); } - for (const float hash : objectIndex_) { + for (const float hash : object_index_) { if (input[0] == hash) { it.out[3] += input[1]; } diff --git a/source/blender/compositor/operations/COM_CryptomatteOperation.h b/source/blender/compositor/operations/COM_CryptomatteOperation.h index 039b4e3b07a..2fa6fbc8390 100644 --- a/source/blender/compositor/operations/COM_CryptomatteOperation.h +++ b/source/blender/compositor/operations/COM_CryptomatteOperation.h @@ -24,17 +24,17 @@ namespace blender::compositor { class CryptomatteOperation : public MultiThreadedOperation { private: - Vector<float> objectIndex_; + Vector<float> object_index_; public: Vector<SocketReader *> inputs; CryptomatteOperation(size_t num_inputs = 6); - void initExecution() override; - void executePixel(float output[4], int x, int y, void *data) override; + void init_execution() override; + void execute_pixel(float output[4], int x, int y, void *data) override; - void addObjectIndex(float objectIndex); + void add_object_index(float object_index); void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, diff --git a/source/blender/compositor/operations/COM_CurveBaseOperation.cc b/source/blender/compositor/operations/COM_CurveBaseOperation.cc index 9ae4cad73d3..c65a1a45750 100644 --- a/source/blender/compositor/operations/COM_CurveBaseOperation.cc +++ b/source/blender/compositor/operations/COM_CurveBaseOperation.cc @@ -24,37 +24,37 @@ namespace blender::compositor { CurveBaseOperation::CurveBaseOperation() { - curveMapping_ = nullptr; + curve_mapping_ = nullptr; this->flags.can_be_constant = true; } CurveBaseOperation::~CurveBaseOperation() { - if (curveMapping_) { - BKE_curvemapping_free(curveMapping_); - curveMapping_ = nullptr; + if (curve_mapping_) { + BKE_curvemapping_free(curve_mapping_); + curve_mapping_ = nullptr; } } -void CurveBaseOperation::initExecution() +void CurveBaseOperation::init_execution() { - BKE_curvemapping_init(curveMapping_); + BKE_curvemapping_init(curve_mapping_); } -void CurveBaseOperation::deinitExecution() +void CurveBaseOperation::deinit_execution() { - if (curveMapping_) { - BKE_curvemapping_free(curveMapping_); - curveMapping_ = nullptr; + if (curve_mapping_) { + BKE_curvemapping_free(curve_mapping_); + curve_mapping_ = nullptr; } } -void CurveBaseOperation::setCurveMapping(CurveMapping *mapping) +void CurveBaseOperation::set_curve_mapping(CurveMapping *mapping) { /* duplicate the curve to avoid glitches while drawing, see bug T32374. */ - if (curveMapping_) { - BKE_curvemapping_free(curveMapping_); + if (curve_mapping_) { + BKE_curvemapping_free(curve_mapping_); } - curveMapping_ = BKE_curvemapping_copy(mapping); + curve_mapping_ = 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 70e9fa9da76..d3548c36870 100644 --- a/source/blender/compositor/operations/COM_CurveBaseOperation.h +++ b/source/blender/compositor/operations/COM_CurveBaseOperation.h @@ -27,9 +27,9 @@ namespace blender::compositor { class CurveBaseOperation : public MultiThreadedOperation { protected: /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - CurveMapping *curveMapping_; + CurveMapping *curve_mapping_; public: CurveBaseOperation(); @@ -38,10 +38,10 @@ class CurveBaseOperation : public MultiThreadedOperation { /** * Initialize the execution */ - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; - void setCurveMapping(CurveMapping *mapping); + void set_curve_mapping(CurveMapping *mapping); }; } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_DenoiseOperation.cc b/source/blender/compositor/operations/COM_DenoiseOperation.cc index 2e41181559e..dd8e6df69fc 100644 --- a/source/blender/compositor/operations/COM_DenoiseOperation.cc +++ b/source/blender/compositor/operations/COM_DenoiseOperation.cc @@ -81,10 +81,10 @@ class DenoiseFilter { BLI_assert(initialized_); BLI_assert(!buffer->is_a_single_elem()); filter.setImage(name.data(), - buffer->getBuffer(), + buffer->get_buffer(), oidn::Format::Float3, - buffer->getWidth(), - buffer->getHeight(), + buffer->get_width(), + buffer->get_height(), 0, buffer->get_elem_bytes_len()); } @@ -131,20 +131,19 @@ DenoiseBaseOperation::DenoiseBaseOperation() output_rendered_ = false; } -bool DenoiseBaseOperation::determineDependingAreaOfInterest(rcti * /*input*/, - ReadBufferOperation *readOperation, - rcti *output) +bool DenoiseBaseOperation::determine_depending_area_of_interest( + rcti * /*input*/, ReadBufferOperation *read_operation, rcti *output) { - if (isCached()) { + if (is_cached()) { return false; } - rcti newInput; - newInput.xmax = this->getWidth(); - newInput.xmin = 0; - newInput.ymax = this->getHeight(); - newInput.ymin = 0; - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + rcti new_input; + new_input.xmax = this->get_width(); + new_input.xmin = 0; + new_input.ymax = this->get_height(); + new_input.ymin = 0; + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } void DenoiseBaseOperation::get_area_of_interest(const int UNUSED(input_idx), @@ -156,26 +155,26 @@ void DenoiseBaseOperation::get_area_of_interest(const int UNUSED(input_idx), DenoiseOperation::DenoiseOperation() { - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Vector); - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Vector); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); settings_ = nullptr; } -void DenoiseOperation::initExecution() +void DenoiseOperation::init_execution() { - SingleThreadedOperation::initExecution(); - inputProgramColor_ = getInputSocketReader(0); - inputProgramNormal_ = getInputSocketReader(1); - inputProgramAlbedo_ = getInputSocketReader(2); + SingleThreadedOperation::init_execution(); + input_program_color_ = get_input_socket_reader(0); + input_program_normal_ = get_input_socket_reader(1); + input_program_albedo_ = get_input_socket_reader(2); } -void DenoiseOperation::deinitExecution() +void DenoiseOperation::deinit_execution() { - inputProgramColor_ = nullptr; - inputProgramNormal_ = nullptr; - inputProgramAlbedo_ = nullptr; - SingleThreadedOperation::deinitExecution(); + input_program_color_ = nullptr; + input_program_normal_ = nullptr; + input_program_albedo_ = nullptr; + SingleThreadedOperation::deinit_execution(); } static bool are_guiding_passes_noise_free(NodeDenoise *settings) @@ -197,29 +196,29 @@ void DenoiseOperation::hash_output_params() } } -MemoryBuffer *DenoiseOperation::createMemoryBuffer(rcti *rect2) +MemoryBuffer *DenoiseOperation::create_memory_buffer(rcti *rect2) { - MemoryBuffer *tileColor = (MemoryBuffer *)inputProgramColor_->initializeTileData(rect2); - MemoryBuffer *tileNormal = (MemoryBuffer *)inputProgramNormal_->initializeTileData(rect2); - MemoryBuffer *tileAlbedo = (MemoryBuffer *)inputProgramAlbedo_->initializeTileData(rect2); + MemoryBuffer *tile_color = (MemoryBuffer *)input_program_color_->initialize_tile_data(rect2); + MemoryBuffer *tile_normal = (MemoryBuffer *)input_program_normal_->initialize_tile_data(rect2); + MemoryBuffer *tile_albedo = (MemoryBuffer *)input_program_albedo_->initialize_tile_data(rect2); rcti rect; rect.xmin = 0; rect.ymin = 0; - rect.xmax = getWidth(); - rect.ymax = getHeight(); + rect.xmax = get_width(); + rect.ymax = get_height(); MemoryBuffer *result = new MemoryBuffer(DataType::Color, rect); - this->generateDenoise(result, tileColor, tileNormal, tileAlbedo, settings_); + this->generate_denoise(result, tile_color, tile_normal, tile_albedo, settings_); return result; } -void DenoiseOperation::generateDenoise(MemoryBuffer *output, - MemoryBuffer *input_color, - MemoryBuffer *input_normal, - MemoryBuffer *input_albedo, - NodeDenoise *settings) +void DenoiseOperation::generate_denoise(MemoryBuffer *output, + MemoryBuffer *input_color, + MemoryBuffer *input_normal, + MemoryBuffer *input_albedo, + NodeDenoise *settings) { - BLI_assert(input_color->getBuffer()); - if (!input_color->getBuffer()) { + BLI_assert(input_color->get_buffer()); + if (!input_color->get_buffer()) { return; } @@ -244,7 +243,7 @@ void DenoiseOperation::generateDenoise(MemoryBuffer *output, if (settings) { filter.set("hdr", settings->hdr); filter.set("srgb", false); - filter.set("cleanAux", are_guiding_passes_noise_free(settings)); + filter.set("clean_aux", are_guiding_passes_noise_free(settings)); } filter.execute(); @@ -270,15 +269,15 @@ void DenoiseOperation::update_memory_buffer(MemoryBuffer *output, Span<MemoryBuffer *> inputs) { if (!output_rendered_) { - this->generateDenoise(output, inputs[0], inputs[1], inputs[2], settings_); + this->generate_denoise(output, inputs[0], inputs[1], inputs[2], settings_); output_rendered_ = true; } } DenoisePrefilterOperation::DenoisePrefilterOperation(DataType data_type) { - this->addInputSocket(data_type); - this->addOutputSocket(data_type); + this->add_input_socket(data_type); + this->add_output_socket(data_type); image_name_ = ""; } @@ -287,13 +286,13 @@ void DenoisePrefilterOperation::hash_output_params() hash_param(image_name_); } -MemoryBuffer *DenoisePrefilterOperation::createMemoryBuffer(rcti *rect2) +MemoryBuffer *DenoisePrefilterOperation::create_memory_buffer(rcti *rect2) { - MemoryBuffer *input = (MemoryBuffer *)this->get_input_operation(0)->initializeTileData(rect2); + MemoryBuffer *input = (MemoryBuffer *)this->get_input_operation(0)->initialize_tile_data(rect2); rcti rect; - BLI_rcti_init(&rect, 0, getWidth(), 0, getHeight()); + BLI_rcti_init(&rect, 0, get_width(), 0, get_height()); - MemoryBuffer *result = new MemoryBuffer(getOutputSocket()->getDataType(), rect); + MemoryBuffer *result = new MemoryBuffer(get_output_socket()->get_data_type(), rect); generate_denoise(result, input); return result; diff --git a/source/blender/compositor/operations/COM_DenoiseOperation.h b/source/blender/compositor/operations/COM_DenoiseOperation.h index 24852009e6d..a3eb1f57f2f 100644 --- a/source/blender/compositor/operations/COM_DenoiseOperation.h +++ b/source/blender/compositor/operations/COM_DenoiseOperation.h @@ -33,9 +33,9 @@ class DenoiseBaseOperation : public SingleThreadedOperation { DenoiseBaseOperation(); public: - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; }; @@ -45,9 +45,9 @@ class DenoiseOperation : public DenoiseBaseOperation { /** * \brief Cached reference to the input programs */ - SocketReader *inputProgramColor_; - SocketReader *inputProgramAlbedo_; - SocketReader *inputProgramNormal_; + SocketReader *input_program_color_; + SocketReader *input_program_albedo_; + SocketReader *input_program_normal_; /** * \brief settings of the denoise node. @@ -59,14 +59,14 @@ class DenoiseOperation : public DenoiseBaseOperation { /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void setDenoiseSettings(NodeDenoise *settings) + void set_denoise_settings(NodeDenoise *settings) { settings_ = settings; } @@ -77,13 +77,13 @@ class DenoiseOperation : public DenoiseBaseOperation { protected: void hash_output_params() override; - void generateDenoise(MemoryBuffer *output, - MemoryBuffer *input_color, - MemoryBuffer *input_normal, - MemoryBuffer *input_albedo, - NodeDenoise *settings); + void generate_denoise(MemoryBuffer *output, + MemoryBuffer *input_color, + MemoryBuffer *input_normal, + MemoryBuffer *input_albedo, + NodeDenoise *settings); - MemoryBuffer *createMemoryBuffer(rcti *rect) override; + MemoryBuffer *create_memory_buffer(rcti *rect) override; }; class DenoisePrefilterOperation : public DenoiseBaseOperation { @@ -104,7 +104,7 @@ class DenoisePrefilterOperation : public DenoiseBaseOperation { protected: void hash_output_params() override; - MemoryBuffer *createMemoryBuffer(rcti *rect) override; + MemoryBuffer *create_memory_buffer(rcti *rect) override; private: void generate_denoise(MemoryBuffer *output, MemoryBuffer *input); diff --git a/source/blender/compositor/operations/COM_DespeckleOperation.cc b/source/blender/compositor/operations/COM_DespeckleOperation.cc index f655c17fdf2..be0dc06b8ec 100644 --- a/source/blender/compositor/operations/COM_DespeckleOperation.cc +++ b/source/blender/compositor/operations/COM_DespeckleOperation.cc @@ -24,23 +24,23 @@ namespace blender::compositor { DespeckleOperation::DespeckleOperation() { - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Color); this->set_canvas_input_index(0); - inputOperation_ = nullptr; + input_operation_ = nullptr; this->flags.complex = true; } -void DespeckleOperation::initExecution() +void DespeckleOperation::init_execution() { - inputOperation_ = this->getInputSocketReader(0); - inputValueOperation_ = this->getInputSocketReader(1); + input_operation_ = this->get_input_socket_reader(0); + input_value_operation_ = this->get_input_socket_reader(1); } -void DespeckleOperation::deinitExecution() +void DespeckleOperation::deinit_execution() { - inputOperation_ = nullptr; - inputValueOperation_ = nullptr; + input_operation_ = nullptr; + input_value_operation_ = nullptr; } BLI_INLINE int color_diff(const float a[3], const float b[3], const float threshold) @@ -49,7 +49,7 @@ BLI_INLINE int color_diff(const float a[3], const float b[3], const float thresh (fabsf(a[2] - b[2]) > threshold)); } -void DespeckleOperation::executePixel(float output[4], int x, int y, void * /*data*/) +void DespeckleOperation::execute_pixel(float output[4], int x, int y, void * /*data*/) { float w = 0.0f; float color_org[4]; @@ -62,17 +62,17 @@ void DespeckleOperation::executePixel(float output[4], int x, int y, void * /*da int y1 = y - 1; int y2 = y; int y3 = y + 1; - CLAMP(x1, 0, getWidth() - 1); - CLAMP(x2, 0, getWidth() - 1); - CLAMP(x3, 0, getWidth() - 1); - CLAMP(y1, 0, getHeight() - 1); - CLAMP(y2, 0, getHeight() - 1); - CLAMP(y3, 0, getHeight() - 1); + CLAMP(x1, 0, get_width() - 1); + CLAMP(x2, 0, get_width() - 1); + CLAMP(x3, 0, get_width() - 1); + CLAMP(y1, 0, get_height() - 1); + CLAMP(y2, 0, get_height() - 1); + CLAMP(y3, 0, get_height() - 1); float value[4]; - inputValueOperation_->read(value, x2, y2, nullptr); + input_value_operation_->read(value, x2, y2, nullptr); // const float mval = 1.0f - value[0]; - inputOperation_->read(color_org, x2, y2, nullptr); + input_operation_->read(color_org, x2, y2, nullptr); #define TOT_DIV_ONE 1.0f #define TOT_DIV_CNR (float)M_SQRT1_2 @@ -91,27 +91,27 @@ void DespeckleOperation::executePixel(float output[4], int x, int y, void * /*da zero_v4(color_mid); zero_v4(color_mid_ok); - inputOperation_->read(in1, x1, y1, nullptr); + input_operation_->read(in1, x1, y1, nullptr); COLOR_ADD(TOT_DIV_CNR) - inputOperation_->read(in1, x2, y1, nullptr); + input_operation_->read(in1, x2, y1, nullptr); COLOR_ADD(TOT_DIV_ONE) - inputOperation_->read(in1, x3, y1, nullptr); + input_operation_->read(in1, x3, y1, nullptr); COLOR_ADD(TOT_DIV_CNR) - inputOperation_->read(in1, x1, y2, nullptr); + input_operation_->read(in1, x1, y2, nullptr); COLOR_ADD(TOT_DIV_ONE) #if 0 - inputOperation_->read(in2, x2, y2, nullptr); + input_operation_->read(in2, x2, y2, nullptr); madd_v4_v4fl(color_mid, in2, filter_[4]); #endif - inputOperation_->read(in1, x3, y2, nullptr); + input_operation_->read(in1, x3, y2, nullptr); COLOR_ADD(TOT_DIV_ONE) - inputOperation_->read(in1, x1, y3, nullptr); + input_operation_->read(in1, x1, y3, nullptr); COLOR_ADD(TOT_DIV_CNR) - inputOperation_->read(in1, x2, y3, nullptr); + input_operation_->read(in1, x2, y3, nullptr); COLOR_ADD(TOT_DIV_ONE) - inputOperation_->read(in1, x3, y3, nullptr); + input_operation_->read(in1, x3, y3, nullptr); COLOR_ADD(TOT_DIV_CNR) mul_v4_fl(color_mid, 1.0f / (4.0f + (4.0f * (float)M_SQRT1_2))); @@ -132,19 +132,19 @@ void DespeckleOperation::executePixel(float output[4], int x, int y, void * /*da #undef COLOR_ADD } -bool DespeckleOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool DespeckleOperation::determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) { - rcti newInput; - int addx = 2; //(filterWidth_ - 1) / 2 + 1; - int addy = 2; //(filterHeight_ - 1) / 2 + 1; - newInput.xmax = input->xmax + addx; - newInput.xmin = input->xmin - addx; - newInput.ymax = input->ymax + addy; - newInput.ymin = input->ymin - addy; - - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + rcti new_input; + int addx = 2; //(filter_width_ - 1) / 2 + 1; + int addy = 2; //(filter_height_ - 1) / 2 + 1; + new_input.xmax = input->xmax + addx; + new_input.xmin = input->xmin - addx; + new_input.ymax = input->ymax + addy; + new_input.ymin = input->ymin - addy; + + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } void DespeckleOperation::get_area_of_interest(const int input_idx, @@ -153,8 +153,8 @@ void DespeckleOperation::get_area_of_interest(const int input_idx, { switch (input_idx) { case IMAGE_INPUT_INDEX: { - const int add_x = 2; //(filterWidth_ - 1) / 2 + 1; - const int add_y = 2; //(filterHeight_ - 1) / 2 + 1; + const int add_x = 2; //(filter_width_ - 1) / 2 + 1; + const int add_y = 2; //(filter_height_ - 1) / 2 + 1; r_input_area.xmin = output_area.xmin - add_x; r_input_area.xmax = output_area.xmax + add_x; r_input_area.ymin = output_area.ymin - add_y; @@ -173,8 +173,8 @@ void DespeckleOperation::update_memory_buffer_partial(MemoryBuffer *output, Span<MemoryBuffer *> inputs) { const MemoryBuffer *image = inputs[IMAGE_INPUT_INDEX]; - const int last_x = getWidth() - 1; - const int last_y = getHeight() - 1; + const int last_x = get_width() - 1; + const int last_y = get_height() - 1; for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) { const int x1 = MAX2(it.x - 1, 0); const int x2 = it.x; diff --git a/source/blender/compositor/operations/COM_DespeckleOperation.h b/source/blender/compositor/operations/COM_DespeckleOperation.h index 9aca01000a7..bb5b012a330 100644 --- a/source/blender/compositor/operations/COM_DespeckleOperation.h +++ b/source/blender/compositor/operations/COM_DespeckleOperation.h @@ -30,31 +30,31 @@ class DespeckleOperation : public MultiThreadedOperation { float threshold_; float threshold_neighbor_; - // int filterWidth_; - // int filterHeight_; + // int filter_width_; + // int filter_height_; protected: - SocketReader *inputOperation_; - SocketReader *inputValueOperation_; + SocketReader *input_operation_; + SocketReader *input_value_operation_; public: DespeckleOperation(); - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; - void executePixel(float output[4], int x, int y, void *data) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; + void execute_pixel(float output[4], int x, int y, void *data) override; - void setThreshold(float threshold) + void set_threshold(float threshold) { threshold_ = threshold; } - void setThresholdNeighbor(float threshold) + void set_threshold_neighbor(float threshold) { threshold_neighbor_ = threshold; } - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; void update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cc b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cc index d5f11ff8e35..8391bbb799a 100644 --- a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cc +++ b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cc @@ -22,44 +22,44 @@ namespace blender::compositor { DifferenceMatteOperation::DifferenceMatteOperation() { - addInputSocket(DataType::Color); - addInputSocket(DataType::Color); - addOutputSocket(DataType::Value); + add_input_socket(DataType::Color); + add_input_socket(DataType::Color); + add_output_socket(DataType::Value); - inputImage1Program_ = nullptr; - inputImage2Program_ = nullptr; + input_image1_program_ = nullptr; + input_image2_program_ = nullptr; flags.can_be_constant = true; } -void DifferenceMatteOperation::initExecution() +void DifferenceMatteOperation::init_execution() { - inputImage1Program_ = this->getInputSocketReader(0); - inputImage2Program_ = this->getInputSocketReader(1); + input_image1_program_ = this->get_input_socket_reader(0); + input_image2_program_ = this->get_input_socket_reader(1); } -void DifferenceMatteOperation::deinitExecution() +void DifferenceMatteOperation::deinit_execution() { - inputImage1Program_ = nullptr; - inputImage2Program_ = nullptr; + input_image1_program_ = nullptr; + input_image2_program_ = nullptr; } -void DifferenceMatteOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void DifferenceMatteOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inColor1[4]; - float inColor2[4]; + float in_color1[4]; + float in_color2[4]; const float tolerance = settings_->t1; const float falloff = settings_->t2; float difference; float alpha; - inputImage1Program_->readSampled(inColor1, x, y, sampler); - inputImage2Program_->readSampled(inColor2, x, y, sampler); + input_image1_program_->read_sampled(in_color1, x, y, sampler); + input_image2_program_->read_sampled(in_color2, x, y, sampler); - difference = (fabsf(inColor2[0] - inColor1[0]) + fabsf(inColor2[1] - inColor1[1]) + - fabsf(inColor2[2] - inColor1[2])); + difference = (fabsf(in_color2[0] - in_color1[0]) + fabsf(in_color2[1] - in_color1[1]) + + fabsf(in_color2[2] - in_color1[2])); /* average together the distances */ difference = difference / 3.0f; @@ -73,16 +73,16 @@ void DifferenceMatteOperation::executePixelSampled(float output[4], difference = difference - tolerance; alpha = difference / falloff; /* Only change if more transparent than before. */ - if (alpha < inColor1[3]) { + if (alpha < in_color1[3]) { output[0] = alpha; } else { /* leave as before */ - output[0] = inColor1[3]; + output[0] = in_color1[3]; } } else { /* foreground object */ - output[0] = inColor1[3]; + output[0] = in_color1[3]; } } diff --git a/source/blender/compositor/operations/COM_DifferenceMatteOperation.h b/source/blender/compositor/operations/COM_DifferenceMatteOperation.h index 31ce0d3dbe5..700dabc9b8d 100644 --- a/source/blender/compositor/operations/COM_DifferenceMatteOperation.h +++ b/source/blender/compositor/operations/COM_DifferenceMatteOperation.h @@ -29,8 +29,8 @@ namespace blender::compositor { class DifferenceMatteOperation : public MultiThreadedOperation { private: NodeChroma *settings_; - SocketReader *inputImage1Program_; - SocketReader *inputImage2Program_; + SocketReader *input_image1_program_; + SocketReader *input_image2_program_; public: /** @@ -41,14 +41,14 @@ class DifferenceMatteOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; - void setSettings(NodeChroma *nodeChroma) + void set_settings(NodeChroma *node_chroma) { - settings_ = nodeChroma; + settings_ = node_chroma; } void update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.cc b/source/blender/compositor/operations/COM_DilateErodeOperation.cc index 1366eb43776..7fc186df35f 100644 --- a/source/blender/compositor/operations/COM_DilateErodeOperation.cc +++ b/source/blender/compositor/operations/COM_DilateErodeOperation.cc @@ -24,10 +24,10 @@ namespace blender::compositor { /* DilateErode Distance Threshold */ DilateErodeThresholdOperation::DilateErodeThresholdOperation() { - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Value); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Value); this->flags.complex = true; - inputProgram_ = nullptr; + input_program_ = nullptr; inset_ = 0.0f; switch_ = 0.5f; distance_ = 0.0f; @@ -51,20 +51,20 @@ void DilateErodeThresholdOperation::init_data() } } -void DilateErodeThresholdOperation::initExecution() +void DilateErodeThresholdOperation::init_execution() { - inputProgram_ = this->getInputSocketReader(0); + input_program_ = this->get_input_socket_reader(0); } -void *DilateErodeThresholdOperation::initializeTileData(rcti * /*rect*/) +void *DilateErodeThresholdOperation::initialize_tile_data(rcti * /*rect*/) { - void *buffer = inputProgram_->initializeTileData(nullptr); + void *buffer = input_program_->initialize_tile_data(nullptr); return buffer; } -void DilateErodeThresholdOperation::executePixel(float output[4], int x, int y, void *data) +void DilateErodeThresholdOperation::execute_pixel(float output[4], int x, int y, void *data) { - float inputValue[4]; + float input_value[4]; const float sw = switch_; const float distance = distance_; float pixelvalue; @@ -72,21 +72,21 @@ void DilateErodeThresholdOperation::executePixel(float output[4], int x, int y, const float inset = inset_; float mindist = rd * 2; - MemoryBuffer *inputBuffer = (MemoryBuffer *)data; - float *buffer = inputBuffer->getBuffer(); - const rcti &input_rect = inputBuffer->get_rect(); + MemoryBuffer *input_buffer = (MemoryBuffer *)data; + float *buffer = input_buffer->get_buffer(); + const rcti &input_rect = input_buffer->get_rect(); const int minx = MAX2(x - scope_, input_rect.xmin); const int miny = MAX2(y - scope_, input_rect.ymin); const int maxx = MIN2(x + scope_, input_rect.xmax); const int maxy = MIN2(y + scope_, input_rect.ymax); - const int bufferWidth = inputBuffer->getWidth(); + const int buffer_width = input_buffer->get_width(); int offset; - inputBuffer->read(inputValue, x, y); - if (inputValue[0] > sw) { + input_buffer->read(input_value, x, y); + if (input_value[0] > sw) { for (int yi = miny; yi < maxy; yi++) { const float dy = yi - y; - offset = ((yi - input_rect.ymin) * bufferWidth + (minx - input_rect.xmin)); + offset = ((yi - input_rect.ymin) * buffer_width + (minx - input_rect.xmin)); for (int xi = minx; xi < maxx; xi++) { if (buffer[offset] < sw) { const float dx = xi - x; @@ -101,7 +101,7 @@ void DilateErodeThresholdOperation::executePixel(float output[4], int x, int y, else { for (int yi = miny; yi < maxy; yi++) { const float dy = yi - y; - offset = ((yi - input_rect.ymin) * bufferWidth + (minx - input_rect.xmin)); + offset = ((yi - input_rect.ymin) * buffer_width + (minx - input_rect.xmin)); for (int xi = minx; xi < maxx; xi++) { if (buffer[offset] > sw) { const float dx = xi - x; @@ -144,22 +144,22 @@ void DilateErodeThresholdOperation::executePixel(float output[4], int x, int y, } } -void DilateErodeThresholdOperation::deinitExecution() +void DilateErodeThresholdOperation::deinit_execution() { - inputProgram_ = nullptr; + input_program_ = nullptr; } -bool DilateErodeThresholdOperation::determineDependingAreaOfInterest( - rcti *input, ReadBufferOperation *readOperation, rcti *output) +bool DilateErodeThresholdOperation::determine_depending_area_of_interest( + rcti *input, ReadBufferOperation *read_operation, rcti *output) { - rcti newInput; + rcti new_input; - newInput.xmax = input->xmax + scope_; - newInput.xmin = input->xmin - scope_; - newInput.ymax = input->ymax + scope_; - newInput.ymin = input->ymin - scope_; + new_input.xmax = input->xmax + scope_; + new_input.xmin = input->xmin - scope_; + new_input.ymax = input->ymax + scope_; + new_input.ymin = input->ymin - scope_; - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } void DilateErodeThresholdOperation::get_area_of_interest(const int input_idx, @@ -271,9 +271,9 @@ void DilateErodeThresholdOperation::update_memory_buffer_partial(MemoryBuffer *o /* Dilate Distance. */ DilateDistanceOperation::DilateDistanceOperation() { - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Value); - inputProgram_ = nullptr; + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Value); + input_program_ = nullptr; distance_ = 0.0f; flags.complex = true; flags.open_cl = true; @@ -287,37 +287,37 @@ void DilateDistanceOperation::init_data() } } -void DilateDistanceOperation::initExecution() +void DilateDistanceOperation::init_execution() { - inputProgram_ = this->getInputSocketReader(0); + input_program_ = this->get_input_socket_reader(0); } -void *DilateDistanceOperation::initializeTileData(rcti * /*rect*/) +void *DilateDistanceOperation::initialize_tile_data(rcti * /*rect*/) { - void *buffer = inputProgram_->initializeTileData(nullptr); + void *buffer = input_program_->initialize_tile_data(nullptr); return buffer; } -void DilateDistanceOperation::executePixel(float output[4], int x, int y, void *data) +void DilateDistanceOperation::execute_pixel(float output[4], int x, int y, void *data) { const float distance = distance_; const float mindist = distance * distance; - MemoryBuffer *inputBuffer = (MemoryBuffer *)data; - float *buffer = inputBuffer->getBuffer(); - const rcti &input_rect = inputBuffer->get_rect(); + MemoryBuffer *input_buffer = (MemoryBuffer *)data; + float *buffer = input_buffer->get_buffer(); + const rcti &input_rect = input_buffer->get_rect(); const int minx = MAX2(x - scope_, input_rect.xmin); const int miny = MAX2(y - scope_, input_rect.ymin); const int maxx = MIN2(x + scope_, input_rect.xmax); const int maxy = MIN2(y + scope_, input_rect.ymax); - const int bufferWidth = inputBuffer->getWidth(); + const int buffer_width = input_buffer->get_width(); int offset; float value = 0.0f; for (int yi = miny; yi < maxy; yi++) { const float dy = yi - y; - offset = ((yi - input_rect.ymin) * bufferWidth + (minx - input_rect.xmin)); + offset = ((yi - input_rect.ymin) * buffer_width + (minx - input_rect.xmin)); for (int xi = minx; xi < maxx; xi++) { const float dx = xi - x; const float dis = dx * dx + dy * dy; @@ -330,45 +330,46 @@ void DilateDistanceOperation::executePixel(float output[4], int x, int y, void * output[0] = value; } -void DilateDistanceOperation::deinitExecution() +void DilateDistanceOperation::deinit_execution() { - inputProgram_ = nullptr; + input_program_ = nullptr; } -bool DilateDistanceOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool DilateDistanceOperation::determine_depending_area_of_interest( + rcti *input, ReadBufferOperation *read_operation, rcti *output) { - rcti newInput; + rcti new_input; - newInput.xmax = input->xmax + scope_; - newInput.xmin = input->xmin - scope_; - newInput.ymax = input->ymax + scope_; - newInput.ymin = input->ymin - scope_; + new_input.xmax = input->xmax + scope_; + new_input.xmin = input->xmin - scope_; + new_input.ymax = input->ymax + scope_; + new_input.ymin = input->ymin - scope_; - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } -void DilateDistanceOperation::executeOpenCL(OpenCLDevice *device, - MemoryBuffer *outputMemoryBuffer, - cl_mem clOutputBuffer, - MemoryBuffer **inputMemoryBuffers, - std::list<cl_mem> *clMemToCleanUp, - std::list<cl_kernel> * /*clKernelsToCleanUp*/) +void DilateDistanceOperation::execute_opencl(OpenCLDevice *device, + MemoryBuffer *output_memory_buffer, + cl_mem cl_output_buffer, + MemoryBuffer **input_memory_buffers, + std::list<cl_mem> *cl_mem_to_clean_up, + std::list<cl_kernel> * /*cl_kernels_to_clean_up*/) { - cl_kernel dilateKernel = device->COM_clCreateKernel("dilateKernel", nullptr); + cl_kernel dilate_kernel = device->COM_cl_create_kernel("dilate_kernel", nullptr); - cl_int distanceSquared = distance_ * distance_; + cl_int distance_squared = distance_ * distance_; cl_int scope = scope_; - device->COM_clAttachMemoryBufferToKernelParameter( - dilateKernel, 0, 2, clMemToCleanUp, inputMemoryBuffers, inputProgram_); - device->COM_clAttachOutputMemoryBufferToKernelParameter(dilateKernel, 1, clOutputBuffer); - device->COM_clAttachMemoryBufferOffsetToKernelParameter(dilateKernel, 3, outputMemoryBuffer); - clSetKernelArg(dilateKernel, 4, sizeof(cl_int), &scope); - clSetKernelArg(dilateKernel, 5, sizeof(cl_int), &distanceSquared); - device->COM_clAttachSizeToKernelParameter(dilateKernel, 6, this); - device->COM_clEnqueueRange(dilateKernel, outputMemoryBuffer, 7, this); + device->COM_cl_attach_memory_buffer_to_kernel_parameter( + dilate_kernel, 0, 2, cl_mem_to_clean_up, input_memory_buffers, input_program_); + device->COM_cl_attach_output_memory_buffer_to_kernel_parameter( + dilate_kernel, 1, cl_output_buffer); + device->COM_cl_attach_memory_buffer_offset_to_kernel_parameter( + dilate_kernel, 3, output_memory_buffer); + clSetKernelArg(dilate_kernel, 4, sizeof(cl_int), &scope); + clSetKernelArg(dilate_kernel, 5, sizeof(cl_int), &distance_squared); + device->COM_cl_attach_size_to_kernel_parameter(dilate_kernel, 6, this); + device->COM_cl_enqueue_range(dilate_kernel, output_memory_buffer, 7, this); } void DilateDistanceOperation::get_area_of_interest(const int input_idx, @@ -463,26 +464,26 @@ ErodeDistanceOperation::ErodeDistanceOperation() : DilateDistanceOperation() /* pass */ } -void ErodeDistanceOperation::executePixel(float output[4], int x, int y, void *data) +void ErodeDistanceOperation::execute_pixel(float output[4], int x, int y, void *data) { const float distance = distance_; const float mindist = distance * distance; - MemoryBuffer *inputBuffer = (MemoryBuffer *)data; - float *buffer = inputBuffer->getBuffer(); - const rcti &input_rect = inputBuffer->get_rect(); + MemoryBuffer *input_buffer = (MemoryBuffer *)data; + float *buffer = input_buffer->get_buffer(); + const rcti &input_rect = input_buffer->get_rect(); const int minx = MAX2(x - scope_, input_rect.xmin); const int miny = MAX2(y - scope_, input_rect.ymin); const int maxx = MIN2(x + scope_, input_rect.xmax); const int maxy = MIN2(y + scope_, input_rect.ymax); - const int bufferWidth = inputBuffer->getWidth(); + const int buffer_width = input_buffer->get_width(); int offset; float value = 1.0f; for (int yi = miny; yi < maxy; yi++) { const float dy = yi - y; - offset = ((yi - input_rect.ymin) * bufferWidth + (minx - input_rect.xmin)); + offset = ((yi - input_rect.ymin) * buffer_width + (minx - input_rect.xmin)); for (int xi = minx; xi < maxx; xi++) { const float dx = xi - x; const float dis = dx * dx + dy * dy; @@ -495,26 +496,28 @@ void ErodeDistanceOperation::executePixel(float output[4], int x, int y, void *d output[0] = value; } -void ErodeDistanceOperation::executeOpenCL(OpenCLDevice *device, - MemoryBuffer *outputMemoryBuffer, - cl_mem clOutputBuffer, - MemoryBuffer **inputMemoryBuffers, - std::list<cl_mem> *clMemToCleanUp, - std::list<cl_kernel> * /*clKernelsToCleanUp*/) +void ErodeDistanceOperation::execute_opencl(OpenCLDevice *device, + MemoryBuffer *output_memory_buffer, + cl_mem cl_output_buffer, + MemoryBuffer **input_memory_buffers, + std::list<cl_mem> *cl_mem_to_clean_up, + std::list<cl_kernel> * /*cl_kernels_to_clean_up*/) { - cl_kernel erodeKernel = device->COM_clCreateKernel("erodeKernel", nullptr); + cl_kernel erode_kernel = device->COM_cl_create_kernel("erode_kernel", nullptr); - cl_int distanceSquared = distance_ * distance_; + cl_int distance_squared = distance_ * distance_; cl_int scope = scope_; - device->COM_clAttachMemoryBufferToKernelParameter( - erodeKernel, 0, 2, clMemToCleanUp, inputMemoryBuffers, inputProgram_); - device->COM_clAttachOutputMemoryBufferToKernelParameter(erodeKernel, 1, clOutputBuffer); - device->COM_clAttachMemoryBufferOffsetToKernelParameter(erodeKernel, 3, outputMemoryBuffer); - clSetKernelArg(erodeKernel, 4, sizeof(cl_int), &scope); - clSetKernelArg(erodeKernel, 5, sizeof(cl_int), &distanceSquared); - device->COM_clAttachSizeToKernelParameter(erodeKernel, 6, this); - device->COM_clEnqueueRange(erodeKernel, outputMemoryBuffer, 7, this); + device->COM_cl_attach_memory_buffer_to_kernel_parameter( + erode_kernel, 0, 2, cl_mem_to_clean_up, input_memory_buffers, input_program_); + device->COM_cl_attach_output_memory_buffer_to_kernel_parameter( + erode_kernel, 1, cl_output_buffer); + device->COM_cl_attach_memory_buffer_offset_to_kernel_parameter( + erode_kernel, 3, output_memory_buffer); + clSetKernelArg(erode_kernel, 4, sizeof(cl_int), &scope); + clSetKernelArg(erode_kernel, 5, sizeof(cl_int), &distance_squared); + device->COM_cl_attach_size_to_kernel_parameter(erode_kernel, 6, this); + device->COM_cl_enqueue_range(erode_kernel, output_memory_buffer, 7, this); } void ErodeDistanceOperation::update_memory_buffer_partial(MemoryBuffer *output, @@ -531,17 +534,17 @@ void ErodeDistanceOperation::update_memory_buffer_partial(MemoryBuffer *output, /* Dilate step */ DilateStepOperation::DilateStepOperation() { - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Value); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Value); this->flags.complex = true; - inputProgram_ = nullptr; + input_program_ = nullptr; } -void DilateStepOperation::initExecution() +void DilateStepOperation::init_execution() { - inputProgram_ = this->getInputSocketReader(0); + input_program_ = this->get_input_socket_reader(0); } -/* Small helper to pass data from initializeTileData to executePixel. */ +/* Small helper to pass data from initialize_tile_data to execute_pixel. */ struct tile_info { rcti rect; int width; @@ -561,13 +564,13 @@ static tile_info *create_cache(int xmin, int xmax, int ymin, int ymax) return result; } -void *DilateStepOperation::initializeTileData(rcti *rect) +void *DilateStepOperation::initialize_tile_data(rcti *rect) { - MemoryBuffer *tile = (MemoryBuffer *)inputProgram_->initializeTileData(nullptr); + MemoryBuffer *tile = (MemoryBuffer *)input_program_->initialize_tile_data(nullptr); int x, y, i; - int width = tile->getWidth(); - int height = tile->getHeight(); - float *buffer = tile->getBuffer(); + int width = tile->get_width(); + int height = tile->get_height(); + float *buffer = tile->get_buffer(); int half_window = iterations_; int window = half_window * 2 + 1; @@ -651,7 +654,7 @@ void *DilateStepOperation::initializeTileData(rcti *rect) return result; } -void DilateStepOperation::executePixel(float output[4], int x, int y, void *data) +void DilateStepOperation::execute_pixel(float output[4], int x, int y, void *data) { tile_info *tile = (tile_info *)data; int nx = x - tile->rect.xmin; @@ -659,30 +662,30 @@ void DilateStepOperation::executePixel(float output[4], int x, int y, void *data output[0] = tile->buffer[tile->width * ny + nx]; } -void DilateStepOperation::deinitExecution() +void DilateStepOperation::deinit_execution() { - inputProgram_ = nullptr; + input_program_ = nullptr; } -void DilateStepOperation::deinitializeTileData(rcti * /*rect*/, void *data) +void DilateStepOperation::deinitialize_tile_data(rcti * /*rect*/, void *data) { tile_info *tile = (tile_info *)data; MEM_freeN(tile->buffer); MEM_freeN(tile); } -bool DilateStepOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool DilateStepOperation::determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) { - rcti newInput; + rcti new_input; int it = iterations_; - newInput.xmax = input->xmax + it; - newInput.xmin = input->xmin - it; - newInput.ymax = input->ymax + it; - newInput.ymin = input->ymin - it; + new_input.xmax = input->xmax + it; + new_input.xmin = input->xmin - it; + new_input.ymax = input->ymax + it; + new_input.ymin = input->ymin - it; - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } void DilateStepOperation::get_area_of_interest(const int input_idx, @@ -706,8 +709,8 @@ static void step_update_memory_buffer(MemoryBuffer *output, { TCompareSelector selector; - const int width = output->getWidth(); - const int height = output->getHeight(); + const int width = output->get_width(); + const int height = output->get_height(); const int half_window = num_iterations; const int window = half_window * 2 + 1; @@ -812,13 +815,13 @@ ErodeStepOperation::ErodeStepOperation() : DilateStepOperation() /* pass */ } -void *ErodeStepOperation::initializeTileData(rcti *rect) +void *ErodeStepOperation::initialize_tile_data(rcti *rect) { - MemoryBuffer *tile = (MemoryBuffer *)inputProgram_->initializeTileData(nullptr); + MemoryBuffer *tile = (MemoryBuffer *)input_program_->initialize_tile_data(nullptr); int x, y, i; - int width = tile->getWidth(); - int height = tile->getHeight(); - float *buffer = tile->getBuffer(); + int width = tile->get_width(); + int height = tile->get_height(); + float *buffer = tile->get_buffer(); int half_window = iterations_; int window = half_window * 2 + 1; diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.h b/source/blender/compositor/operations/COM_DilateErodeOperation.h index 1919c926710..04d25a1fca6 100644 --- a/source/blender/compositor/operations/COM_DilateErodeOperation.h +++ b/source/blender/compositor/operations/COM_DilateErodeOperation.h @@ -28,9 +28,9 @@ class DilateErodeThresholdOperation : public MultiThreadedOperation { private: /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputProgram_; + SocketReader *input_program_; float distance_; float switch_; @@ -48,36 +48,36 @@ class DilateErodeThresholdOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; void init_data() override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; - void *initializeTileData(rcti *rect) override; + void *initialize_tile_data(rcti *rect) override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void setDistance(float distance) + void set_distance(float distance) { distance_ = distance; } - void setSwitch(float sw) + void set_switch(float sw) { switch_ = sw; } - void setInset(float inset) + void set_inset(float inset) { inset_ = inset; } - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; void update_memory_buffer_partial(MemoryBuffer *output, @@ -91,9 +91,9 @@ class DilateDistanceOperation : public MultiThreadedOperation { protected: /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputProgram_; + SocketReader *input_program_; float distance_; int scope_; @@ -103,34 +103,34 @@ class DilateDistanceOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; void init_data() override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; - void *initializeTileData(rcti *rect) override; + void *initialize_tile_data(rcti *rect) override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void setDistance(float distance) + void set_distance(float distance) { distance_ = distance; } - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; - void executeOpenCL(OpenCLDevice *device, - MemoryBuffer *outputMemoryBuffer, - cl_mem clOutputBuffer, - MemoryBuffer **inputMemoryBuffers, - std::list<cl_mem> *clMemToCleanUp, - std::list<cl_kernel> *clKernelsToCleanUp) override; + void execute_opencl(OpenCLDevice *device, + MemoryBuffer *output_memory_buffer, + cl_mem cl_output_buffer, + MemoryBuffer **input_memory_buffers, + std::list<cl_mem> *cl_mem_to_clean_up, + std::list<cl_kernel> *cl_kernels_to_clean_up) override; void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) final; virtual void update_memory_buffer_partial(MemoryBuffer *output, @@ -145,14 +145,14 @@ class ErodeDistanceOperation : public DilateDistanceOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(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) override; + void execute_opencl(OpenCLDevice *device, + MemoryBuffer *output_memory_buffer, + cl_mem cl_output_buffer, + MemoryBuffer **input_memory_buffers, + std::list<cl_mem> *cl_mem_to_clean_up, + std::list<cl_kernel> *cl_kernels_to_clean_up) override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, @@ -162,9 +162,9 @@ class ErodeDistanceOperation : public DilateDistanceOperation { class DilateStepOperation : public MultiThreadedOperation { protected: /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputProgram_; + SocketReader *input_program_; int iterations_; @@ -174,28 +174,28 @@ class DilateStepOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; - void *initializeTileData(rcti *rect) override; + void *initialize_tile_data(rcti *rect) override; /** * Deinitialize the execution */ - void deinitExecution() override; - void deinitializeTileData(rcti *rect, void *data) override; + void deinit_execution() override; + void deinitialize_tile_data(rcti *rect, void *data) override; - void setIterations(int iterations) + void set_iterations(int iterations) { iterations_ = iterations; } - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) final; virtual void update_memory_buffer_partial(MemoryBuffer *output, @@ -207,7 +207,7 @@ class ErodeStepOperation : public DilateStepOperation { public: ErodeStepOperation(); - void *initializeTileData(rcti *rect) override; + void *initialize_tile_data(rcti *rect) override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span<MemoryBuffer *> inputs) override; diff --git a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cc b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cc index 3cf3ee3b0c8..eff7fa84475 100644 --- a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cc +++ b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cc @@ -23,17 +23,17 @@ namespace blender::compositor { DirectionalBlurOperation::DirectionalBlurOperation() { - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); flags.complex = true; flags.open_cl = true; - inputProgram_ = nullptr; + input_program_ = nullptr; } -void DirectionalBlurOperation::initExecution() +void DirectionalBlurOperation::init_execution() { - inputProgram_ = getInputSocketReader(0); - QualityStepHelper::initExecution(COM_QH_INCREASE); + input_program_ = get_input_socket_reader(0); + QualityStepHelper::init_execution(COM_QH_INCREASE); const float angle = data_->angle; const float zoom = data_->zoom; const float spin = data_->spin; @@ -41,8 +41,8 @@ void DirectionalBlurOperation::initExecution() const float distance = data_->distance; const float center_x = data_->center_x; const float center_y = data_->center_y; - const float width = getWidth(); - const float height = getHeight(); + const float width = get_width(); + const float height = get_height(); const float a = angle; const float itsc = 1.0f / powf(2.0f, (float)iterations); @@ -58,12 +58,12 @@ void DirectionalBlurOperation::initExecution() rot_ = itsc * spin; } -void DirectionalBlurOperation::executePixel(float output[4], int x, int y, void * /*data*/) +void DirectionalBlurOperation::execute_pixel(float output[4], int x, int y, void * /*data*/) { const int iterations = pow(2.0f, data_->iter); float col[4] = {0.0f, 0.0f, 0.0f, 0.0f}; float col2[4] = {0.0f, 0.0f, 0.0f, 0.0f}; - inputProgram_->readSampled(col2, x, y, PixelSampler::Bilinear); + input_program_->read_sampled(col2, x, y, PixelSampler::Bilinear); float ltx = tx_; float lty = ty_; float lsc = sc_; @@ -76,10 +76,10 @@ void DirectionalBlurOperation::executePixel(float output[4], int x, int y, void const float v = isc * (y - center_y_pix_) + lty; const float u = isc * (x - center_x_pix_) + ltx; - inputProgram_->readSampled(col, - cs * u + ss * v + center_x_pix_, - cs * v - ss * u + center_y_pix_, - PixelSampler::Bilinear); + input_program_->read_sampled(col, + cs * u + ss * v + center_x_pix_, + cs * v - ss * u + center_y_pix_, + PixelSampler::Bilinear); add_v4_v4(col2, col); @@ -93,14 +93,15 @@ void DirectionalBlurOperation::executePixel(float output[4], int x, int y, void mul_v4_v4fl(output, col2, 1.0f / (iterations + 1)); } -void DirectionalBlurOperation::executeOpenCL(OpenCLDevice *device, - MemoryBuffer *outputMemoryBuffer, - cl_mem clOutputBuffer, - MemoryBuffer **inputMemoryBuffers, - std::list<cl_mem> *clMemToCleanUp, - std::list<cl_kernel> * /*clKernelsToCleanUp*/) +void DirectionalBlurOperation::execute_opencl(OpenCLDevice *device, + MemoryBuffer *output_memory_buffer, + cl_mem cl_output_buffer, + MemoryBuffer **input_memory_buffers, + std::list<cl_mem> *cl_mem_to_clean_up, + std::list<cl_kernel> * /*cl_kernels_to_clean_up*/) { - cl_kernel directionalBlurKernel = device->COM_clCreateKernel("directionalBlurKernel", nullptr); + cl_kernel directional_blur_kernel = device->COM_cl_create_kernel("directional_blur_kernel", + nullptr); cl_int iterations = pow(2.0f, data_->iter); cl_float2 ltxy = {{tx_, ty_}}; @@ -108,38 +109,37 @@ void DirectionalBlurOperation::executeOpenCL(OpenCLDevice *device, cl_float lsc = sc_; cl_float lrot = rot_; - device->COM_clAttachMemoryBufferToKernelParameter( - directionalBlurKernel, 0, -1, clMemToCleanUp, inputMemoryBuffers, inputProgram_); - device->COM_clAttachOutputMemoryBufferToKernelParameter( - directionalBlurKernel, 1, clOutputBuffer); - device->COM_clAttachMemoryBufferOffsetToKernelParameter( - directionalBlurKernel, 2, outputMemoryBuffer); - clSetKernelArg(directionalBlurKernel, 3, sizeof(cl_int), &iterations); - clSetKernelArg(directionalBlurKernel, 4, sizeof(cl_float), &lsc); - clSetKernelArg(directionalBlurKernel, 5, sizeof(cl_float), &lrot); - clSetKernelArg(directionalBlurKernel, 6, sizeof(cl_float2), <xy); - clSetKernelArg(directionalBlurKernel, 7, sizeof(cl_float2), ¢erpix); - - device->COM_clEnqueueRange(directionalBlurKernel, outputMemoryBuffer, 8, this); + device->COM_cl_attach_memory_buffer_to_kernel_parameter( + directional_blur_kernel, 0, -1, cl_mem_to_clean_up, input_memory_buffers, input_program_); + device->COM_cl_attach_output_memory_buffer_to_kernel_parameter( + directional_blur_kernel, 1, cl_output_buffer); + device->COM_cl_attach_memory_buffer_offset_to_kernel_parameter( + directional_blur_kernel, 2, output_memory_buffer); + clSetKernelArg(directional_blur_kernel, 3, sizeof(cl_int), &iterations); + clSetKernelArg(directional_blur_kernel, 4, sizeof(cl_float), &lsc); + clSetKernelArg(directional_blur_kernel, 5, sizeof(cl_float), &lrot); + clSetKernelArg(directional_blur_kernel, 6, sizeof(cl_float2), <xy); + clSetKernelArg(directional_blur_kernel, 7, sizeof(cl_float2), ¢erpix); + + device->COM_cl_enqueue_range(directional_blur_kernel, output_memory_buffer, 8, this); } -void DirectionalBlurOperation::deinitExecution() +void DirectionalBlurOperation::deinit_execution() { - inputProgram_ = nullptr; + input_program_ = nullptr; } -bool DirectionalBlurOperation::determineDependingAreaOfInterest(rcti * /*input*/, - ReadBufferOperation *readOperation, - rcti *output) +bool DirectionalBlurOperation::determine_depending_area_of_interest( + rcti * /*input*/, ReadBufferOperation *read_operation, rcti *output) { - rcti newInput; + rcti new_input; - newInput.xmax = this->getWidth(); - newInput.xmin = 0; - newInput.ymax = this->getHeight(); - newInput.ymin = 0; + new_input.xmax = this->get_width(); + new_input.xmin = 0; + new_input.ymax = this->get_height(); + new_input.ymin = 0; - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } void DirectionalBlurOperation::get_area_of_interest(const int input_idx, diff --git a/source/blender/compositor/operations/COM_DirectionalBlurOperation.h b/source/blender/compositor/operations/COM_DirectionalBlurOperation.h index 0687ff4ae5d..2dd2fc98ccd 100644 --- a/source/blender/compositor/operations/COM_DirectionalBlurOperation.h +++ b/source/blender/compositor/operations/COM_DirectionalBlurOperation.h @@ -25,7 +25,7 @@ namespace blender::compositor { class DirectionalBlurOperation : public MultiThreadedOperation, public QualityStepHelper { private: - SocketReader *inputProgram_; + SocketReader *input_program_; NodeDBlurData *data_; float center_x_pix_, center_y_pix_; @@ -38,33 +38,33 @@ class DirectionalBlurOperation : public MultiThreadedOperation, public QualitySt /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; - void setData(NodeDBlurData *data) + void set_data(NodeDBlurData *data) { data_ = data; } - void executeOpenCL(OpenCLDevice *device, - MemoryBuffer *outputMemoryBuffer, - cl_mem clOutputBuffer, - MemoryBuffer **inputMemoryBuffers, - std::list<cl_mem> *clMemToCleanUp, - std::list<cl_kernel> *clKernelsToCleanUp) override; + void execute_opencl(OpenCLDevice *device, + MemoryBuffer *output_memory_buffer, + cl_mem cl_output_buffer, + MemoryBuffer **input_memory_buffers, + std::list<cl_mem> *cl_mem_to_clean_up, + std::list<cl_kernel> *cl_kernels_to_clean_up) override; void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; void update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_DisplaceOperation.cc b/source/blender/compositor/operations/COM_DisplaceOperation.cc index 8476db73b32..0c5b8dea2e6 100644 --- a/source/blender/compositor/operations/COM_DisplaceOperation.cc +++ b/source/blender/compositor/operations/COM_DisplaceOperation.cc @@ -22,55 +22,55 @@ namespace blender::compositor { DisplaceOperation::DisplaceOperation() { - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Vector); - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Vector); + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Color); this->flags.complex = true; - inputColorProgram_ = nullptr; + input_color_program_ = nullptr; } -void DisplaceOperation::initExecution() +void DisplaceOperation::init_execution() { - inputColorProgram_ = this->getInputSocketReader(0); - NodeOperation *vector = this->getInputSocketReader(1); - NodeOperation *scale_x = this->getInputSocketReader(2); - NodeOperation *scale_y = this->getInputSocketReader(3); + input_color_program_ = this->get_input_socket_reader(0); + NodeOperation *vector = this->get_input_socket_reader(1); + NodeOperation *scale_x = this->get_input_socket_reader(2); + NodeOperation *scale_y = this->get_input_socket_reader(3); if (execution_model_ == eExecutionModel::Tiled) { vector_read_fn_ = [=](float x, float y, float *out) { - vector->readSampled(out, x, y, PixelSampler::Bilinear); + vector->read_sampled(out, x, y, PixelSampler::Bilinear); }; scale_x_read_fn_ = [=](float x, float y, float *out) { - scale_x->readSampled(out, x, y, PixelSampler::Nearest); + scale_x->read_sampled(out, x, y, PixelSampler::Nearest); }; scale_y_read_fn_ = [=](float x, float y, float *out) { - scale_y->readSampled(out, x, y, PixelSampler::Nearest); + scale_y->read_sampled(out, x, y, PixelSampler::Nearest); }; } - width_x4_ = this->getWidth() * 4; - height_x4_ = this->getHeight() * 4; - input_vector_width_ = vector->getWidth(); - input_vector_height_ = vector->getHeight(); + width_x4_ = this->get_width() * 4; + height_x4_ = this->get_height() * 4; + input_vector_width_ = vector->get_width(); + input_vector_height_ = vector->get_height(); } -void DisplaceOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler /*sampler*/) +void DisplaceOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler /*sampler*/) { float xy[2] = {x, y}; float uv[2], deriv[2][2]; - pixelTransform(xy, uv, deriv); + pixel_transform(xy, uv, deriv); if (is_zero_v2(deriv[0]) && is_zero_v2(deriv[1])) { - inputColorProgram_->readSampled(output, uv[0], uv[1], PixelSampler::Bilinear); + input_color_program_->read_sampled(output, uv[0], uv[1], PixelSampler::Bilinear); } else { /* EWA filtering (without nearest it gets blurry with NO distortion) */ - inputColorProgram_->readFiltered(output, uv[0], uv[1], deriv[0], deriv[1]); + input_color_program_->read_filtered(output, uv[0], uv[1], deriv[0], deriv[1]); } } @@ -92,7 +92,7 @@ bool DisplaceOperation::read_displacement( return true; } -void DisplaceOperation::pixelTransform(const float xy[2], float r_uv[2], float r_deriv[2][2]) +void DisplaceOperation::pixel_transform(const float xy[2], float r_uv[2], float r_deriv[2][2]) { float col[4]; float uv[2]; /* temporary variables for derivative estimation */ @@ -151,52 +151,52 @@ void DisplaceOperation::pixelTransform(const float xy[2], float r_uv[2], float r } } -void DisplaceOperation::deinitExecution() +void DisplaceOperation::deinit_execution() { - inputColorProgram_ = nullptr; + input_color_program_ = nullptr; vector_read_fn_ = nullptr; scale_x_read_fn_ = nullptr; scale_y_read_fn_ = nullptr; } -bool DisplaceOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool DisplaceOperation::determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) { - rcti colorInput; - rcti vectorInput; + rcti color_input; + rcti vector_input; NodeOperation *operation = nullptr; /* the vector buffer only needs a 2x2 buffer. The image needs whole buffer */ /* image */ - operation = getInputOperation(0); - colorInput.xmax = operation->getWidth(); - colorInput.xmin = 0; - colorInput.ymax = operation->getHeight(); - colorInput.ymin = 0; - if (operation->determineDependingAreaOfInterest(&colorInput, readOperation, output)) { + operation = get_input_operation(0); + color_input.xmax = operation->get_width(); + color_input.xmin = 0; + color_input.ymax = operation->get_height(); + color_input.ymin = 0; + if (operation->determine_depending_area_of_interest(&color_input, read_operation, output)) { return true; } /* vector */ - operation = getInputOperation(1); - vectorInput.xmax = input->xmax + 1; - vectorInput.xmin = input->xmin - 1; - vectorInput.ymax = input->ymax + 1; - vectorInput.ymin = input->ymin - 1; - if (operation->determineDependingAreaOfInterest(&vectorInput, readOperation, output)) { + operation = get_input_operation(1); + vector_input.xmax = input->xmax + 1; + vector_input.xmin = input->xmin - 1; + vector_input.ymax = input->ymax + 1; + vector_input.ymin = input->ymin - 1; + if (operation->determine_depending_area_of_interest(&vector_input, read_operation, output)) { return true; } /* scale x */ - operation = getInputOperation(2); - if (operation->determineDependingAreaOfInterest(input, readOperation, output)) { + operation = get_input_operation(2); + if (operation->determine_depending_area_of_interest(input, read_operation, output)) { return true; } /* scale y */ - operation = getInputOperation(3); - if (operation->determineDependingAreaOfInterest(input, readOperation, output)) { + operation = get_input_operation(3); + if (operation->determine_depending_area_of_interest(input, read_operation, output)) { return true; } @@ -209,7 +209,7 @@ void DisplaceOperation::get_area_of_interest(const int input_idx, { switch (input_idx) { case 0: { - r_input_area = getInputOperation(input_idx)->get_canvas(); + r_input_area = get_input_operation(input_idx)->get_canvas(); break; } case 1: { @@ -246,7 +246,7 @@ void DisplaceOperation::update_memory_buffer_partial(MemoryBuffer *output, float uv[2]; float deriv[2][2]; - pixelTransform(xy, uv, deriv); + pixel_transform(xy, uv, deriv); if (is_zero_v2(deriv[0]) && is_zero_v2(deriv[1])) { input_color->read_elem_bilinear(uv[0], uv[1], it.out); } diff --git a/source/blender/compositor/operations/COM_DisplaceOperation.h b/source/blender/compositor/operations/COM_DisplaceOperation.h index 56cd1c1f2a6..a6f6927407f 100644 --- a/source/blender/compositor/operations/COM_DisplaceOperation.h +++ b/source/blender/compositor/operations/COM_DisplaceOperation.h @@ -25,9 +25,9 @@ namespace blender::compositor { class DisplaceOperation : public MultiThreadedOperation { private: /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputColorProgram_; + SocketReader *input_color_program_; float width_x4_; float height_x4_; @@ -45,26 +45,26 @@ class DisplaceOperation : public MultiThreadedOperation { /** * we need a 2x2 differential filter for Vector Input and full buffer for the image */ - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(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]); + void pixel_transform(const float xy[2], float r_uv[2], float r_deriv[2][2]); /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; void update_memory_buffer_started(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cc b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cc index 77d7831c680..729b01d924d 100644 --- a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cc +++ b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cc @@ -22,108 +22,107 @@ namespace blender::compositor { DisplaceSimpleOperation::DisplaceSimpleOperation() { - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Vector); - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Color); - - inputColorProgram_ = nullptr; - inputVectorProgram_ = nullptr; - inputScaleXProgram_ = nullptr; - inputScaleYProgram_ = nullptr; + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Vector); + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Color); + + input_color_program_ = nullptr; + input_vector_program_ = nullptr; + input_scale_xprogram_ = nullptr; + input_scale_yprogram_ = nullptr; } -void DisplaceSimpleOperation::initExecution() +void DisplaceSimpleOperation::init_execution() { - inputColorProgram_ = this->getInputSocketReader(0); - inputVectorProgram_ = this->getInputSocketReader(1); - inputScaleXProgram_ = this->getInputSocketReader(2); - inputScaleYProgram_ = this->getInputSocketReader(3); + input_color_program_ = this->get_input_socket_reader(0); + input_vector_program_ = this->get_input_socket_reader(1); + input_scale_xprogram_ = this->get_input_socket_reader(2); + input_scale_yprogram_ = this->get_input_socket_reader(3); - width_x4_ = this->getWidth() * 4; - height_x4_ = this->getHeight() * 4; + width_x4_ = this->get_width() * 4; + height_x4_ = this->get_height() * 4; } /* minimum distance (in pixels) a pixel has to be displaced * in order to take effect */ // #define DISPLACE_EPSILON 0.01f -void DisplaceSimpleOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void DisplaceSimpleOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inVector[4]; - float inScale[4]; + float in_vector[4]; + float in_scale[4]; float p_dx, p_dy; /* main displacement in pixel space */ float u, v; - inputScaleXProgram_->readSampled(inScale, x, y, sampler); - float xs = inScale[0]; - inputScaleYProgram_->readSampled(inScale, x, y, sampler); - float ys = inScale[0]; + input_scale_xprogram_->read_sampled(in_scale, x, y, sampler); + float xs = in_scale[0]; + input_scale_yprogram_->read_sampled(in_scale, x, y, sampler); + float ys = in_scale[0]; /* clamp x and y displacement to triple image resolution - * to prevent hangs from huge values mistakenly plugged in eg. z buffers */ CLAMP(xs, -width_x4_, width_x4_); CLAMP(ys, -height_x4_, height_x4_); - inputVectorProgram_->readSampled(inVector, x, y, sampler); - p_dx = inVector[0] * xs; - p_dy = inVector[1] * ys; + input_vector_program_->read_sampled(in_vector, x, y, sampler); + p_dx = in_vector[0] * xs; + p_dy = in_vector[1] * ys; /* displaced pixel in uv coords, for image sampling */ /* clamp nodes to avoid glitches */ u = x - p_dx + 0.5f; v = y - p_dy + 0.5f; - CLAMP(u, 0.0f, this->getWidth() - 1.0f); - CLAMP(v, 0.0f, this->getHeight() - 1.0f); + CLAMP(u, 0.0f, this->get_width() - 1.0f); + CLAMP(v, 0.0f, this->get_height() - 1.0f); - inputColorProgram_->readSampled(output, u, v, sampler); + input_color_program_->read_sampled(output, u, v, sampler); } -void DisplaceSimpleOperation::deinitExecution() +void DisplaceSimpleOperation::deinit_execution() { - inputColorProgram_ = nullptr; - inputVectorProgram_ = nullptr; - inputScaleXProgram_ = nullptr; - inputScaleYProgram_ = nullptr; + input_color_program_ = nullptr; + input_vector_program_ = nullptr; + input_scale_xprogram_ = nullptr; + input_scale_yprogram_ = nullptr; } -bool DisplaceSimpleOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool DisplaceSimpleOperation::determine_depending_area_of_interest( + rcti *input, ReadBufferOperation *read_operation, rcti *output) { - rcti colorInput; + rcti color_input; NodeOperation *operation = nullptr; /* the vector buffer only needs a 2x2 buffer. The image needs whole buffer */ /* image */ - operation = getInputOperation(0); - colorInput.xmax = operation->getWidth(); - colorInput.xmin = 0; - colorInput.ymax = operation->getHeight(); - colorInput.ymin = 0; - if (operation->determineDependingAreaOfInterest(&colorInput, readOperation, output)) { + operation = get_input_operation(0); + color_input.xmax = operation->get_width(); + color_input.xmin = 0; + color_input.ymax = operation->get_height(); + color_input.ymin = 0; + if (operation->determine_depending_area_of_interest(&color_input, read_operation, output)) { return true; } /* vector */ - if (operation->determineDependingAreaOfInterest(input, readOperation, output)) { + if (operation->determine_depending_area_of_interest(input, read_operation, output)) { return true; } /* scale x */ - operation = getInputOperation(2); - if (operation->determineDependingAreaOfInterest(input, readOperation, output)) { + operation = get_input_operation(2); + if (operation->determine_depending_area_of_interest(input, read_operation, output)) { return true; } /* scale y */ - operation = getInputOperation(3); - if (operation->determineDependingAreaOfInterest(input, readOperation, output)) { + operation = get_input_operation(3); + if (operation->determine_depending_area_of_interest(input, read_operation, output)) { return true; } @@ -150,8 +149,8 @@ void DisplaceSimpleOperation::update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span<MemoryBuffer *> inputs) { - const float width = this->getWidth(); - const float height = this->getHeight(); + const float width = this->get_width(); + const float height = this->get_height(); const MemoryBuffer *input_color = inputs[0]; for (BuffersIterator<float> it = output->iterate_with(inputs.drop_front(1), area); !it.is_end(); ++it) { diff --git a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h index 1baf8c8275c..c16146dc464 100644 --- a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h +++ b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.h @@ -25,12 +25,12 @@ namespace blender::compositor { class DisplaceSimpleOperation : public MultiThreadedOperation { private: /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputColorProgram_; - SocketReader *inputVectorProgram_; - SocketReader *inputScaleXProgram_; - SocketReader *inputScaleYProgram_; + SocketReader *input_color_program_; + SocketReader *input_vector_program_; + SocketReader *input_scale_xprogram_; + SocketReader *input_scale_yprogram_; float width_x4_; float height_x4_; @@ -41,24 +41,24 @@ class DisplaceSimpleOperation : public MultiThreadedOperation { /** * we need a full buffer for the image */ - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; void update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cc b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cc index e076bf4ae7d..95593d7d49f 100644 --- a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cc +++ b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cc @@ -22,39 +22,39 @@ namespace blender::compositor { DistanceRGBMatteOperation::DistanceRGBMatteOperation() { - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Value); + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Value); - inputImageProgram_ = nullptr; - inputKeyProgram_ = nullptr; + input_image_program_ = nullptr; + input_key_program_ = nullptr; flags.can_be_constant = true; } -void DistanceRGBMatteOperation::initExecution() +void DistanceRGBMatteOperation::init_execution() { - inputImageProgram_ = this->getInputSocketReader(0); - inputKeyProgram_ = this->getInputSocketReader(1); + input_image_program_ = this->get_input_socket_reader(0); + input_key_program_ = this->get_input_socket_reader(1); } -void DistanceRGBMatteOperation::deinitExecution() +void DistanceRGBMatteOperation::deinit_execution() { - inputImageProgram_ = nullptr; - inputKeyProgram_ = nullptr; + input_image_program_ = nullptr; + input_key_program_ = nullptr; } -float DistanceRGBMatteOperation::calculateDistance(const float key[4], const float image[4]) +float DistanceRGBMatteOperation::calculate_distance(const float key[4], const float image[4]) { return len_v3v3(key, image); } -void DistanceRGBMatteOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void DistanceRGBMatteOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inKey[4]; - float inImage[4]; + float in_key[4]; + float in_image[4]; const float tolerance = settings_->t1; const float falloff = settings_->t2; @@ -62,10 +62,10 @@ void DistanceRGBMatteOperation::executePixelSampled(float output[4], float distance; float alpha; - inputKeyProgram_->readSampled(inKey, x, y, sampler); - inputImageProgram_->readSampled(inImage, x, y, sampler); + input_key_program_->read_sampled(in_key, x, y, sampler); + input_image_program_->read_sampled(in_image, x, y, sampler); - distance = this->calculateDistance(inKey, inImage); + distance = this->calculate_distance(in_key, in_image); /* Store matte(alpha) value in [0] to go with * COM_SetAlphaMultiplyOperation and the Value output. @@ -80,16 +80,16 @@ void DistanceRGBMatteOperation::executePixelSampled(float output[4], distance = distance - tolerance; alpha = distance / falloff; /* Only change if more transparent than before. */ - if (alpha < inImage[3]) { + if (alpha < in_image[3]) { output[0] = alpha; } else { /* leave as before */ - output[0] = inImage[3]; + output[0] = in_image[3]; } } else { /* leave as before */ - output[0] = inImage[3]; + output[0] = in_image[3]; } } @@ -101,7 +101,7 @@ void DistanceRGBMatteOperation::update_memory_buffer_partial(MemoryBuffer *outpu const float *in_image = it.in(0); const float *in_key = it.in(1); - float distance = this->calculateDistance(in_key, in_image); + float distance = this->calculate_distance(in_key, in_image); const float tolerance = settings_->t1; const float falloff = settings_->t2; diff --git a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h index e741a9b80d5..306a4e316f5 100644 --- a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h +++ b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.h @@ -29,10 +29,10 @@ namespace blender::compositor { class DistanceRGBMatteOperation : public MultiThreadedOperation { protected: NodeChroma *settings_; - SocketReader *inputImageProgram_; - SocketReader *inputKeyProgram_; + SocketReader *input_image_program_; + SocketReader *input_key_program_; - virtual float calculateDistance(const float key[4], const float image[4]); + virtual float calculate_distance(const float key[4], const float image[4]); public: /** @@ -43,14 +43,14 @@ class DistanceRGBMatteOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; - void setSettings(NodeChroma *nodeChroma) + void set_settings(NodeChroma *node_chroma) { - settings_ = nodeChroma; + settings_ = node_chroma; } void update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.cc b/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.cc index 9903b80ce02..682c01a63d5 100644 --- a/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.cc +++ b/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.cc @@ -20,7 +20,7 @@ namespace blender::compositor { -float DistanceYCCMatteOperation::calculateDistance(const float key[4], const float image[4]) +float DistanceYCCMatteOperation::calculate_distance(const float key[4], const float image[4]) { /* only measure the second 2 values */ return len_v2v2(key + 1, image + 1); diff --git a/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.h b/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.h index 0e178fddc39..1d5ed9f0de1 100644 --- a/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.h +++ b/source/blender/compositor/operations/COM_DistanceYCCMatteOperation.h @@ -29,7 +29,7 @@ namespace blender::compositor { */ class DistanceYCCMatteOperation : public DistanceRGBMatteOperation { protected: - float calculateDistance(const float key[4], const float image[4]) override; + float calculate_distance(const float key[4], const float image[4]) override; }; } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_DotproductOperation.cc b/source/blender/compositor/operations/COM_DotproductOperation.cc index ef309392d4d..9507f991b52 100644 --- a/source/blender/compositor/operations/COM_DotproductOperation.cc +++ b/source/blender/compositor/operations/COM_DotproductOperation.cc @@ -22,21 +22,21 @@ namespace blender::compositor { DotproductOperation::DotproductOperation() { - this->addInputSocket(DataType::Vector); - this->addInputSocket(DataType::Vector); - this->addOutputSocket(DataType::Value); + this->add_input_socket(DataType::Vector); + this->add_input_socket(DataType::Vector); + this->add_output_socket(DataType::Value); this->set_canvas_input_index(0); input1Operation_ = nullptr; input2Operation_ = nullptr; flags.can_be_constant = true; } -void DotproductOperation::initExecution() +void DotproductOperation::init_execution() { - input1Operation_ = this->getInputSocketReader(0); - input2Operation_ = this->getInputSocketReader(1); + input1Operation_ = this->get_input_socket_reader(0); + input2Operation_ = this->get_input_socket_reader(1); } -void DotproductOperation::deinitExecution() +void DotproductOperation::deinit_execution() { input1Operation_ = nullptr; input2Operation_ = nullptr; @@ -44,15 +44,15 @@ void DotproductOperation::deinitExecution() /** \todo current implementation is the inverse of a dot-product. not 'logically' correct */ -void DotproductOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void DotproductOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { float input1[4]; float input2[4]; - input1Operation_->readSampled(input1, x, y, sampler); - input2Operation_->readSampled(input2, x, y, sampler); + input1Operation_->read_sampled(input1, x, y, sampler); + input2Operation_->read_sampled(input2, x, y, sampler); output[0] = -(input1[0] * input2[0] + input1[1] * input2[1] + input1[2] * input2[2]); } diff --git a/source/blender/compositor/operations/COM_DotproductOperation.h b/source/blender/compositor/operations/COM_DotproductOperation.h index 5190a161533..f9e5d4d39c4 100644 --- a/source/blender/compositor/operations/COM_DotproductOperation.h +++ b/source/blender/compositor/operations/COM_DotproductOperation.h @@ -29,10 +29,10 @@ class DotproductOperation : public MultiThreadedOperation { public: DotproductOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cc b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cc index 2ae33d5451f..559df4abb0c 100644 --- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cc +++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cc @@ -945,8 +945,8 @@ static void do_createEdgeLocationBuffer(unsigned int t, const unsigned int *lres, float *res, unsigned short *gbuf, - unsigned int *innerEdgeOffset, - unsigned int *outerEdgeOffset, + unsigned int *inner_edge_offset, + unsigned int *outer_edge_offset, unsigned int isz, unsigned int gsz) { @@ -956,14 +956,14 @@ static void do_createEdgeLocationBuffer(unsigned int t, unsigned int dmin; /* Minimum edge distance. */ unsigned int rsl; /* Long used for finding fast `1.0/sqrt`. */ - unsigned int gradientFillOffset; + unsigned int gradient_fill_offset; /* For looping inner edge pixel indexes, represents current position from offset. */ - unsigned int innerAccum = 0; + unsigned int inner_accum = 0; /* For looping outer edge pixel indexes, represents current position from offset. */ - unsigned int outerAccum = 0; + unsigned int outer_accum = 0; /* For looping gradient pixel indexes, represents current position from offset. */ - unsigned int gradientAccum = 0; + unsigned int gradient_accum = 0; /* Disable clang-format to prevent line-wrapping. */ /* clang-format off */ @@ -996,7 +996,7 @@ static void do_createEdgeLocationBuffer(unsigned int t, * ..oooo... * .oggggo.. * .oggiggo. - * .ogiFigo. + * .ogi_figo. * .oggiggo. * .oggggo.. * ..oooo... @@ -1009,7 +1009,7 @@ static void do_createEdgeLocationBuffer(unsigned int t, * * The memory in gbuf[] after filling will look like this: * - * gradientFillOffset (0 pixels) innerEdgeOffset (18 pixels) outerEdgeOffset (22 pixels) + * gradient_fill_offset (0 pixels) inner_edge_offset (18 pixels) outer_edge_offset (22 pixels) * / / / * / / / * |X Y X Y X Y X Y > <X Y X Y > <X Y X Y X Y > <X Y X Y | <- (x,y) @@ -1020,7 +1020,7 @@ static void do_createEdgeLocationBuffer(unsigned int t, * / / / * / / / * / / / - * +---------- gradientAccum (18) ---------+ +--- innerAccum (22) ---+ +--- outerAccum (40) ---+ + * +---------- gradient_accum (18) ---------+ +--- inner_accum (22) ---+ +--- outer_accum (40) ---+ * * * Ultimately we do need the pixel's memory buffer index to set the output @@ -1030,36 +1030,36 @@ static void do_createEdgeLocationBuffer(unsigned int t, */ /* clang-format on */ - gradientFillOffset = 0; /* Since there are likely "more" of these, put it first. :). */ - *innerEdgeOffset = gradientFillOffset + gsz; /* Set start of inner edge indexes. */ - *outerEdgeOffset = (*innerEdgeOffset) + isz; /* Set start of outer edge indexes. */ - /* Set the accumulators to correct positions */ /* Set up some accumulator variables for loops. - */ - gradientAccum = gradientFillOffset; /* Each accumulator variable starts at its respective. */ - innerAccum = *innerEdgeOffset; /* Section's offset so when we start filling, each. */ - outerAccum = *outerEdgeOffset; /* Section fills up its allocated space in gbuf. */ + gradient_fill_offset = 0; /* Since there are likely "more" of these, put it first. :). */ + *inner_edge_offset = gradient_fill_offset + gsz; /* Set start of inner edge indexes. */ + *outer_edge_offset = (*inner_edge_offset) + isz; /* Set start of outer edge indexes. */ + /* Set the accumulators to correct positions */ /* Set up some accumulator variables for loops. + */ + gradient_accum = gradient_fill_offset; /* Each accumulator variable starts at its respective. */ + inner_accum = *inner_edge_offset; /* Section's offset so when we start filling, each. */ + outer_accum = *outer_edge_offset; /* Section fills up its allocated space in gbuf. */ /* Uses `dmin=row`, `rsl=col`. */ for (x = 0, dmin = 0; x < t; x += rw, dmin++) { for (rsl = 0; rsl < rw; rsl++) { a = x + rsl; - if (lres[a] == 2) { /* It is a gradient pixel flagged by 2. */ - ud = gradientAccum << 1; /* Double the index to reach correct unsigned short location. */ - gbuf[ud] = dmin; /* Insert pixel's row into gradient pixel location buffer. */ - gbuf[ud + 1] = rsl; /* Insert pixel's column into gradient pixel location buffer. */ - gradientAccum++; /* Increment gradient index buffer pointer. */ + if (lres[a] == 2) { /* It is a gradient pixel flagged by 2. */ + ud = gradient_accum << 1; /* Double the index to reach correct unsigned short location. */ + gbuf[ud] = dmin; /* Insert pixel's row into gradient pixel location buffer. */ + gbuf[ud + 1] = rsl; /* Insert pixel's column into gradient pixel location buffer. */ + gradient_accum++; /* Increment gradient index buffer pointer. */ } else if (lres[a] == 3) { /* It is an outer edge pixel flagged by 3. */ - ud = outerAccum << 1; /* Double the index to reach correct unsigned short location. */ + ud = outer_accum << 1; /* Double the index to reach correct unsigned short location. */ gbuf[ud] = dmin; /* Insert pixel's row into outer edge pixel location buffer. */ gbuf[ud + 1] = rsl; /* Insert pixel's column into outer edge pixel location buffer. */ - outerAccum++; /* Increment outer edge index buffer pointer. */ + outer_accum++; /* Increment outer edge index buffer pointer. */ res[a] = 0.0f; /* Set output pixel intensity now since it won't change later. */ } else if (lres[a] == 4) { /* It is an inner edge pixel flagged by 4. */ - ud = innerAccum << 1; /* Double int index to reach correct unsigned short location. */ + ud = inner_accum << 1; /* Double int index to reach correct unsigned short location. */ gbuf[ud] = dmin; /* Insert pixel's row into inner edge pixel location buffer. */ gbuf[ud + 1] = rsl; /* Insert pixel's column into inner edge pixel location buffer. */ - innerAccum++; /* Increment inner edge index buffer pointer. */ + inner_accum++; /* Increment inner edge index buffer pointer. */ res[a] = 1.0f; /* Set output pixel intensity now since it won't change later. */ } } @@ -1072,8 +1072,8 @@ static void do_fillGradientBuffer(unsigned int rw, unsigned int isz, unsigned int osz, unsigned int gsz, - unsigned int innerEdgeOffset, - unsigned int outerEdgeOffset) + unsigned int inner_edge_offset, + unsigned int outer_edge_offset) { int x; /* Pixel loop counter. */ int a; /* Temporary pixel index buffer loop counter. */ @@ -1082,7 +1082,7 @@ static void do_fillGradientBuffer(unsigned int rw, float rsf; /* Float used for finding fast `1.0/sqrt`. */ const float rsopf = 1.5f; /* Constant float used for finding fast `1.0/sqrt`. */ - unsigned int gradientFillOffset; + unsigned int gradient_fill_offset; unsigned int t; unsigned int ud; /* Unscaled edge distance. */ unsigned int dmin; /* Minimum edge distance. */ @@ -1151,11 +1151,11 @@ static void do_fillGradientBuffer(unsigned int rw, */ for (x = gsz - 1; x >= 0; x--) { - gradientFillOffset = x << 1; - t = gbuf[gradientFillOffset]; /* Calculate column of pixel indexed by `gbuf[x]`. */ - fsz = gbuf[gradientFillOffset + 1]; /* Calculate row of pixel indexed by `gbuf[x]`. */ - dmin = 0xffffffff; /* Reset min distance to edge pixel. */ - for (a = outerEdgeOffset + osz - 1; a >= outerEdgeOffset; + gradient_fill_offset = x << 1; + t = gbuf[gradient_fill_offset]; /* Calculate column of pixel indexed by `gbuf[x]`. */ + fsz = gbuf[gradient_fill_offset + 1]; /* Calculate row of pixel indexed by `gbuf[x]`. */ + dmin = 0xffffffff; /* Reset min distance to edge pixel. */ + for (a = outer_edge_offset + osz - 1; a >= outer_edge_offset; a--) { /* Loop through all outer edge buffer pixels. */ ud = a << 1; dy = t - gbuf[ud]; /* Set dx to gradient pixel column - outer edge pixel row. */ @@ -1173,7 +1173,7 @@ static void do_fillGradientBuffer(unsigned int rw, odist = odist * (rsopf - (rsf * odist * odist)); /* -- This line can be iterated for more accuracy. -- */ dmin = 0xffffffff; /* Reset min distance to edge pixel. */ - for (a = innerEdgeOffset + isz - 1; a >= innerEdgeOffset; + for (a = inner_edge_offset + isz - 1; a >= inner_edge_offset; a--) { /* Loop through all inside edge pixels. */ ud = a << 1; dy = t - gbuf[ud]; /* Compute delta in Y from gradient pixel to inside edge pixel. */ @@ -1201,14 +1201,14 @@ static void do_fillGradientBuffer(unsigned int rw, /* Here we reconstruct the pixel's memory location in the CompBuf by * `Pixel Index = Pixel Column + ( Pixel Row * Row Width )`. */ - res[gbuf[gradientFillOffset + 1] + (gbuf[gradientFillOffset] * rw)] = + res[gbuf[gradient_fill_offset + 1] + (gbuf[gradient_fill_offset] * rw)] = (idist / (idist + odist)); /* Set intensity. */ } } /* End of copy. */ -void DoubleEdgeMaskOperation::doDoubleEdgeMask(float *imask, float *omask, float *res) +void DoubleEdgeMaskOperation::do_double_edge_mask(float *imask, float *omask, float *res) { unsigned int *lres; /* Pointer to output pixel buffer (for bit operations). */ unsigned int *limask; /* Pointer to inner mask (for bit operations). */ @@ -1222,17 +1222,17 @@ void DoubleEdgeMaskOperation::doDoubleEdgeMask(float *imask, float *omask, float unsigned int osz = 0; /* Size (in pixels) of outside edge pixel index buffer. */ unsigned int gsz = 0; /* Size (in pixels) of gradient pixel index buffer. */ unsigned int rsize[3]; /* Size storage to pass to helper functions. */ - unsigned int innerEdgeOffset = + unsigned int inner_edge_offset = 0; /* Offset into final buffer where inner edge pixel indexes start. */ - unsigned int outerEdgeOffset = + unsigned int outer_edge_offset = 0; /* Offset into final buffer where outer edge pixel indexes start. */ unsigned short *gbuf; /* Gradient/inner/outer pixel location index buffer. */ if (true) { /* If both input sockets have some data coming in... */ - rw = this->getWidth(); /* Width of a row of pixels. */ - t = (rw * this->getHeight()) - 1; /* Determine size of the frame. */ + rw = this->get_width(); /* Width of a row of pixels. */ + t = (rw * this->get_height()) - 1; /* Determine size of the frame. */ memset(res, 0, sizeof(float) * @@ -1267,8 +1267,8 @@ void DoubleEdgeMaskOperation::doDoubleEdgeMask(float *imask, float *omask, float * * Each version has slightly different criteria for detecting an edge pixel. */ - if (adjacentOnly_) { /* If "adjacent only" inner edge mode is turned on. */ - if (keepInside_) { /* If "keep inside" buffer edge mode is turned on. */ + if (adjacent_only_) { /* If "adjacent only" inner edge mode is turned on. */ + if (keep_inside_) { /* If "keep inside" buffer edge mode is turned on. */ do_adjacentKeepBorders(t, rw, limask, lomask, lres, res, rsize); } else { /* "bleed out" buffer edge mode is turned on. */ @@ -1281,8 +1281,8 @@ void DoubleEdgeMaskOperation::doDoubleEdgeMask(float *imask, float *omask, float /* Detect edges in all non-border pixels in the buffer. */ do_adjacentEdgeDetection(t, rw, limask, lomask, lres, res, rsize, isz, osz, gsz); } - else { /* "all" inner edge mode is turned on. */ - if (keepInside_) { /* If "keep inside" buffer edge mode is turned on. */ + else { /* "all" inner edge mode is turned on. */ + if (keep_inside_) { /* If "keep inside" buffer edge mode is turned on. */ do_allKeepBorders(t, rw, limask, lomask, lres, res, rsize); } else { /* "bleed out" buffer edge mode is turned on. */ @@ -1309,8 +1309,8 @@ void DoubleEdgeMaskOperation::doDoubleEdgeMask(float *imask, float *omask, float gbuf = (unsigned short *)MEM_callocN(sizeof(unsigned short) * fsz * 2, "DEM"); do_createEdgeLocationBuffer( - t, rw, lres, res, gbuf, &innerEdgeOffset, &outerEdgeOffset, isz, gsz); - do_fillGradientBuffer(rw, res, gbuf, isz, osz, gsz, innerEdgeOffset, outerEdgeOffset); + t, rw, lres, res, gbuf, &inner_edge_offset, &outer_edge_offset, isz, gsz); + do_fillGradientBuffer(rw, res, gbuf, isz, osz, gsz, inner_edge_offset, outer_edge_offset); /* Free the gradient index buffer. */ MEM_freeN(gbuf); @@ -1319,76 +1319,75 @@ void DoubleEdgeMaskOperation::doDoubleEdgeMask(float *imask, float *omask, float DoubleEdgeMaskOperation::DoubleEdgeMaskOperation() { - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Value); - inputInnerMask_ = nullptr; - inputOuterMask_ = nullptr; - adjacentOnly_ = false; - keepInside_ = false; + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Value); + input_inner_mask_ = nullptr; + input_outer_mask_ = nullptr; + adjacent_only_ = false; + keep_inside_ = false; this->flags.complex = true; is_output_rendered_ = false; } -bool DoubleEdgeMaskOperation::determineDependingAreaOfInterest(rcti * /*input*/, - ReadBufferOperation *readOperation, - rcti *output) +bool DoubleEdgeMaskOperation::determine_depending_area_of_interest( + rcti * /*input*/, ReadBufferOperation *read_operation, rcti *output) { - if (cachedInstance_ == nullptr) { - rcti newInput; - newInput.xmax = this->getWidth(); - newInput.xmin = 0; - newInput.ymax = this->getHeight(); - newInput.ymin = 0; - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + if (cached_instance_ == nullptr) { + rcti new_input; + new_input.xmax = this->get_width(); + new_input.xmin = 0; + new_input.ymax = this->get_height(); + new_input.ymin = 0; + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } return false; } -void DoubleEdgeMaskOperation::initExecution() +void DoubleEdgeMaskOperation::init_execution() { - inputInnerMask_ = this->getInputSocketReader(0); - inputOuterMask_ = this->getInputSocketReader(1); - initMutex(); - cachedInstance_ = nullptr; + input_inner_mask_ = this->get_input_socket_reader(0); + input_outer_mask_ = this->get_input_socket_reader(1); + init_mutex(); + cached_instance_ = nullptr; } -void *DoubleEdgeMaskOperation::initializeTileData(rcti *rect) +void *DoubleEdgeMaskOperation::initialize_tile_data(rcti *rect) { - if (cachedInstance_) { - return cachedInstance_; + if (cached_instance_) { + return cached_instance_; } - lockMutex(); - if (cachedInstance_ == nullptr) { - MemoryBuffer *innerMask = (MemoryBuffer *)inputInnerMask_->initializeTileData(rect); - MemoryBuffer *outerMask = (MemoryBuffer *)inputOuterMask_->initializeTileData(rect); - float *data = (float *)MEM_mallocN(sizeof(float) * this->getWidth() * this->getHeight(), + lock_mutex(); + if (cached_instance_ == nullptr) { + MemoryBuffer *inner_mask = (MemoryBuffer *)input_inner_mask_->initialize_tile_data(rect); + MemoryBuffer *outer_mask = (MemoryBuffer *)input_outer_mask_->initialize_tile_data(rect); + float *data = (float *)MEM_mallocN(sizeof(float) * this->get_width() * this->get_height(), __func__); - float *imask = innerMask->getBuffer(); - float *omask = outerMask->getBuffer(); - doDoubleEdgeMask(imask, omask, data); - cachedInstance_ = data; + float *imask = inner_mask->get_buffer(); + float *omask = outer_mask->get_buffer(); + do_double_edge_mask(imask, omask, data); + cached_instance_ = data; } - unlockMutex(); - return cachedInstance_; + unlock_mutex(); + return cached_instance_; } -void DoubleEdgeMaskOperation::executePixel(float output[4], int x, int y, void *data) +void DoubleEdgeMaskOperation::execute_pixel(float output[4], int x, int y, void *data) { float *buffer = (float *)data; - int index = (y * this->getWidth() + x); + int index = (y * this->get_width() + x); output[0] = buffer[index]; } -void DoubleEdgeMaskOperation::deinitExecution() +void DoubleEdgeMaskOperation::deinit_execution() { - inputInnerMask_ = nullptr; - inputOuterMask_ = nullptr; - deinitMutex(); - if (cachedInstance_) { - MEM_freeN(cachedInstance_); - cachedInstance_ = nullptr; + input_inner_mask_ = nullptr; + input_outer_mask_ = nullptr; + deinit_mutex(); + if (cached_instance_) { + MEM_freeN(cached_instance_); + cached_instance_ = nullptr; } } @@ -1412,11 +1411,11 @@ void DoubleEdgeMaskOperation::update_memory_buffer(MemoryBuffer *output, MemoryBuffer *outer_mask = input_outer_mask->is_a_single_elem() ? input_outer_mask->inflate() : input_outer_mask; - BLI_assert(output->getWidth() == this->getWidth()); - BLI_assert(output->getHeight() == this->getHeight()); + BLI_assert(output->get_width() == this->get_width()); + BLI_assert(output->get_height() == this->get_height()); /* TODO(manzanilla): Once tiled implementation is removed, use execution system to run * multi-threaded where possible. */ - doDoubleEdgeMask(inner_mask->getBuffer(), outer_mask->getBuffer(), output->getBuffer()); + do_double_edge_mask(inner_mask->get_buffer(), outer_mask->get_buffer(), output->get_buffer()); is_output_rendered_ = true; if (inner_mask != input_inner_mask) { diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h index 29cb40c29af..f2086d9ebd4 100644 --- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h +++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.h @@ -25,50 +25,50 @@ namespace blender::compositor { class DoubleEdgeMaskOperation : public NodeOperation { private: /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputOuterMask_; - SocketReader *inputInnerMask_; - bool adjacentOnly_; - bool keepInside_; + SocketReader *input_outer_mask_; + SocketReader *input_inner_mask_; + bool adjacent_only_; + bool keep_inside_; /* TODO(manzanilla): To be removed with tiled implementation. */ - float *cachedInstance_; + float *cached_instance_; bool is_output_rendered_; public: DoubleEdgeMaskOperation(); - void doDoubleEdgeMask(float *imask, float *omask, float *res); + void do_double_edge_mask(float *imask, float *omask, float *res); /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void *initializeTileData(rcti *rect) override; + void *initialize_tile_data(rcti *rect) override; - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; - void setAdjecentOnly(bool adjacentOnly) + void set_adjecent_only(bool adjacent_only) { - adjacentOnly_ = adjacentOnly; + adjacent_only_ = adjacent_only; } - void setKeepInside(bool keepInside) + void set_keep_inside(bool keep_inside) { - keepInside_ = keepInside; + keep_inside_ = keep_inside; } void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; diff --git a/source/blender/compositor/operations/COM_EllipseMaskOperation.cc b/source/blender/compositor/operations/COM_EllipseMaskOperation.cc index 57cd3cb1423..19497c38131 100644 --- a/source/blender/compositor/operations/COM_EllipseMaskOperation.cc +++ b/source/blender/compositor/operations/COM_EllipseMaskOperation.cc @@ -22,75 +22,75 @@ namespace blender::compositor { EllipseMaskOperation::EllipseMaskOperation() { - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Value); - inputMask_ = nullptr; - inputValue_ = nullptr; + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Value); + input_mask_ = nullptr; + input_value_ = nullptr; cosine_ = 0.0f; sine_ = 0.0f; } -void EllipseMaskOperation::initExecution() +void EllipseMaskOperation::init_execution() { - inputMask_ = this->getInputSocketReader(0); - inputValue_ = this->getInputSocketReader(1); + input_mask_ = this->get_input_socket_reader(0); + input_value_ = this->get_input_socket_reader(1); const double rad = (double)data_->rotation; cosine_ = cos(rad); sine_ = sin(rad); - aspectRatio_ = ((float)this->getWidth()) / this->getHeight(); + aspect_ratio_ = ((float)this->get_width()) / this->get_height(); } -void EllipseMaskOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void EllipseMaskOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputMask[4]; - float inputValue[4]; + float input_mask[4]; + float input_value[4]; - float rx = x / this->getWidth(); - float ry = y / this->getHeight(); + float rx = x / this->get_width(); + float ry = y / this->get_height(); - const float dy = (ry - data_->y) / aspectRatio_; + const float dy = (ry - data_->y) / aspect_ratio_; const float dx = rx - data_->x; rx = data_->x + (cosine_ * dx + sine_ * dy); ry = data_->y + (-sine_ * dx + cosine_ * dy); - inputMask_->readSampled(inputMask, x, y, sampler); - inputValue_->readSampled(inputValue, x, y, sampler); + input_mask_->read_sampled(input_mask, x, y, sampler); + input_value_->read_sampled(input_value, x, y, sampler); - const float halfHeight = (data_->height) / 2.0f; - const float halfWidth = data_->width / 2.0f; + const float half_height = (data_->height) / 2.0f; + const float half_width = data_->width / 2.0f; float sx = rx - data_->x; sx *= sx; - const float tx = halfWidth * halfWidth; + const float tx = half_width * half_width; float sy = ry - data_->y; sy *= sy; - const float ty = halfHeight * halfHeight; + const float ty = half_height * half_height; bool inside = ((sx / tx) + (sy / ty)) < 1.0f; - switch (maskType_) { + switch (mask_type_) { case CMP_NODE_MASKTYPE_ADD: if (inside) { - output[0] = MAX2(inputMask[0], inputValue[0]); + output[0] = MAX2(input_mask[0], input_value[0]); } else { - output[0] = inputMask[0]; + output[0] = input_mask[0]; } break; case CMP_NODE_MASKTYPE_SUBTRACT: if (inside) { - output[0] = inputMask[0] - inputValue[0]; + output[0] = input_mask[0] - input_value[0]; CLAMP(output[0], 0, 1); } else { - output[0] = inputMask[0]; + output[0] = input_mask[0]; } break; case CMP_NODE_MASKTYPE_MULTIPLY: if (inside) { - output[0] = inputMask[0] * inputValue[0]; + output[0] = input_mask[0] * input_value[0]; } else { output[0] = 0; @@ -98,15 +98,15 @@ void EllipseMaskOperation::executePixelSampled(float output[4], break; case CMP_NODE_MASKTYPE_NOT: if (inside) { - if (inputMask[0] > 0.0f) { + if (input_mask[0] > 0.0f) { output[0] = 0; } else { - output[0] = inputValue[0]; + output[0] = input_value[0]; } } else { - output[0] = inputMask[0]; + output[0] = input_mask[0]; } break; } @@ -117,7 +117,7 @@ void EllipseMaskOperation::update_memory_buffer_partial(MemoryBuffer *output, Span<MemoryBuffer *> inputs) { MaskFunc mask_func; - switch (maskType_) { + switch (mask_type_) { case CMP_NODE_MASKTYPE_ADD: mask_func = [](const bool is_inside, const float *mask, const float *value) { return is_inside ? MAX2(mask[0], value[0]) : mask[0]; @@ -152,15 +152,15 @@ void EllipseMaskOperation::apply_mask(MemoryBuffer *output, { const MemoryBuffer *input_mask = inputs[0]; const MemoryBuffer *input_value = inputs[1]; - const float op_w = this->getWidth(); - const float op_h = this->getHeight(); + const float op_w = this->get_width(); + const float op_h = this->get_height(); const float half_w = data_->width / 2.0f; const float half_h = data_->height / 2.0f; const float tx = half_w * half_w; const float ty = half_h * half_h; for (int y = area.ymin; y < area.ymax; y++) { const float op_ry = y / op_h; - const float dy = (op_ry - data_->y) / aspectRatio_; + const float dy = (op_ry - data_->y) / aspect_ratio_; float *out = output->get_elem(area.xmin, y); const float *mask = input_mask->get_elem(area.xmin, y); const float *value = input_value->get_elem(area.xmin, y); @@ -183,10 +183,10 @@ void EllipseMaskOperation::apply_mask(MemoryBuffer *output, } } -void EllipseMaskOperation::deinitExecution() +void EllipseMaskOperation::deinit_execution() { - inputMask_ = nullptr; - inputValue_ = nullptr; + input_mask_ = nullptr; + input_value_ = nullptr; } } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_EllipseMaskOperation.h b/source/blender/compositor/operations/COM_EllipseMaskOperation.h index ec6fb4624f7..7a6f96ab1b1 100644 --- a/source/blender/compositor/operations/COM_EllipseMaskOperation.h +++ b/source/blender/compositor/operations/COM_EllipseMaskOperation.h @@ -27,15 +27,15 @@ class EllipseMaskOperation : public MultiThreadedOperation { using MaskFunc = std::function<float(bool is_inside, const float *mask, const float *value)>; /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputMask_; - SocketReader *inputValue_; + SocketReader *input_mask_; + SocketReader *input_value_; float sine_; float cosine_; - float aspectRatio_; - int maskType_; + float aspect_ratio_; + int mask_type_; NodeEllipseMask *data_; @@ -45,26 +45,26 @@ class EllipseMaskOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void setData(NodeEllipseMask *data) + void set_data(NodeEllipseMask *data) { data_ = data; } - void setMaskType(int maskType) + void set_mask_type(int mask_type) { - maskType_ = maskType; + mask_type_ = mask_type; } void update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc index b1843a225e0..e39db9e06eb 100644 --- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc +++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cc @@ -27,24 +27,24 @@ FastGaussianBlurOperation::FastGaussianBlurOperation() : BlurBaseOperation(DataT iirgaus_ = nullptr; } -void FastGaussianBlurOperation::executePixel(float output[4], int x, int y, void *data) +void FastGaussianBlurOperation::execute_pixel(float output[4], int x, int y, void *data) { - MemoryBuffer *newData = (MemoryBuffer *)data; - newData->read(output, x, y); + MemoryBuffer *new_data = (MemoryBuffer *)data; + new_data->read(output, x, y); } -bool FastGaussianBlurOperation::determineDependingAreaOfInterest( - rcti * /*input*/, ReadBufferOperation *readOperation, rcti *output) +bool FastGaussianBlurOperation::determine_depending_area_of_interest( + rcti * /*input*/, ReadBufferOperation *read_operation, rcti *output) { - rcti newInput; - rcti sizeInput; - sizeInput.xmin = 0; - sizeInput.ymin = 0; - sizeInput.xmax = 5; - sizeInput.ymax = 5; - - NodeOperation *operation = this->getInputOperation(1); - if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) { + rcti new_input; + rcti size_input; + size_input.xmin = 0; + size_input.ymin = 0; + size_input.xmax = 5; + size_input.ymax = 5; + + NodeOperation *operation = this->get_input_operation(1); + if (operation->determine_depending_area_of_interest(&size_input, read_operation, output)) { return true; } @@ -52,12 +52,12 @@ bool FastGaussianBlurOperation::determineDependingAreaOfInterest( return false; } - newInput.xmin = 0; - newInput.ymin = 0; - newInput.xmax = this->getWidth(); - newInput.ymax = this->getHeight(); + new_input.xmin = 0; + new_input.ymin = 0; + new_input.xmax = this->get_width(); + new_input.ymax = this->get_height(); - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } void FastGaussianBlurOperation::init_data() @@ -67,28 +67,28 @@ void FastGaussianBlurOperation::init_data() sy_ = data_.sizey * size_ / 2.0f; } -void FastGaussianBlurOperation::initExecution() +void FastGaussianBlurOperation::init_execution() { - BlurBaseOperation::initExecution(); - BlurBaseOperation::initMutex(); + BlurBaseOperation::init_execution(); + BlurBaseOperation::init_mutex(); } -void FastGaussianBlurOperation::deinitExecution() +void FastGaussianBlurOperation::deinit_execution() { if (iirgaus_) { delete iirgaus_; iirgaus_ = nullptr; } - BlurBaseOperation::deinitMutex(); + BlurBaseOperation::deinit_mutex(); } -void *FastGaussianBlurOperation::initializeTileData(rcti *rect) +void *FastGaussianBlurOperation::initialize_tile_data(rcti *rect) { - lockMutex(); + lock_mutex(); if (!iirgaus_) { - MemoryBuffer *newBuf = (MemoryBuffer *)inputProgram_->initializeTileData(rect); - MemoryBuffer *copy = new MemoryBuffer(*newBuf); - updateSize(); + MemoryBuffer *new_buf = (MemoryBuffer *)input_program_->initialize_tile_data(rect); + MemoryBuffer *copy = new MemoryBuffer(*new_buf); + update_size(); int c; sx_ = data_.sizex * size_ / 2.0f; @@ -113,7 +113,7 @@ void *FastGaussianBlurOperation::initializeTileData(rcti *rect) } iirgaus_ = copy; } - unlockMutex(); + unlock_mutex(); return iirgaus_; } @@ -125,11 +125,11 @@ void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, BLI_assert(!src->is_a_single_elem()); double q, q2, sc, cf[4], tsM[9], tsu[3], tsv[3]; double *X, *Y, *W; - const unsigned int src_width = src->getWidth(); - const unsigned int src_height = src->getHeight(); + const unsigned int src_width = src->get_width(); + const unsigned int src_height = src->get_height(); unsigned int x, y, sz; unsigned int i; - float *buffer = src->getBuffer(); + float *buffer = src->get_buffer(); const uint8_t num_channels = src->get_num_channels(); /* <0.5 not valid, though can have a possibly useful sort of sharpening effect. */ @@ -290,7 +290,7 @@ void FastGaussianBlurOperation::update_memory_buffer_started(MemoryBuffer *outpu image = output; } else { - image = new MemoryBuffer(getOutputSocket()->getDataType(), area); + image = new MemoryBuffer(get_output_socket()->get_data_type(), area); } image->copy_from(input, area); @@ -320,8 +320,8 @@ void FastGaussianBlurOperation::update_memory_buffer_started(MemoryBuffer *outpu FastGaussianBlurValueOperation::FastGaussianBlurValueOperation() { - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Value); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Value); iirgaus_ = nullptr; inputprogram_ = nullptr; sigma_ = 1.0f; @@ -329,56 +329,56 @@ FastGaussianBlurValueOperation::FastGaussianBlurValueOperation() flags.complex = true; } -void FastGaussianBlurValueOperation::executePixel(float output[4], int x, int y, void *data) +void FastGaussianBlurValueOperation::execute_pixel(float output[4], int x, int y, void *data) { - MemoryBuffer *newData = (MemoryBuffer *)data; - newData->read(output, x, y); + MemoryBuffer *new_data = (MemoryBuffer *)data; + new_data->read(output, x, y); } -bool FastGaussianBlurValueOperation::determineDependingAreaOfInterest( - rcti * /*input*/, ReadBufferOperation *readOperation, rcti *output) +bool FastGaussianBlurValueOperation::determine_depending_area_of_interest( + rcti * /*input*/, ReadBufferOperation *read_operation, rcti *output) { - rcti newInput; + rcti new_input; if (iirgaus_) { return false; } - newInput.xmin = 0; - newInput.ymin = 0; - newInput.xmax = this->getWidth(); - newInput.ymax = this->getHeight(); + new_input.xmin = 0; + new_input.ymin = 0; + new_input.xmax = this->get_width(); + new_input.ymax = this->get_height(); - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } -void FastGaussianBlurValueOperation::initExecution() +void FastGaussianBlurValueOperation::init_execution() { - inputprogram_ = getInputSocketReader(0); - initMutex(); + inputprogram_ = get_input_socket_reader(0); + init_mutex(); } -void FastGaussianBlurValueOperation::deinitExecution() +void FastGaussianBlurValueOperation::deinit_execution() { if (iirgaus_) { delete iirgaus_; iirgaus_ = nullptr; } - deinitMutex(); + deinit_mutex(); } -void *FastGaussianBlurValueOperation::initializeTileData(rcti *rect) +void *FastGaussianBlurValueOperation::initialize_tile_data(rcti *rect) { - lockMutex(); + lock_mutex(); if (!iirgaus_) { - MemoryBuffer *newBuf = (MemoryBuffer *)inputprogram_->initializeTileData(rect); - MemoryBuffer *copy = new MemoryBuffer(*newBuf); + MemoryBuffer *new_buf = (MemoryBuffer *)inputprogram_->initialize_tile_data(rect); + MemoryBuffer *copy = new MemoryBuffer(*new_buf); FastGaussianBlurOperation::IIR_gauss(copy, sigma_, 0, 3); if (overlay_ == FAST_GAUSS_OVERLAY_MIN) { - float *src = newBuf->getBuffer(); - float *dst = copy->getBuffer(); - for (int i = copy->getWidth() * copy->getHeight(); i != 0; + float *src = new_buf->get_buffer(); + float *dst = copy->get_buffer(); + for (int i = copy->get_width() * copy->get_height(); i != 0; i--, src += COM_DATA_TYPE_VALUE_CHANNELS, dst += COM_DATA_TYPE_VALUE_CHANNELS) { if (*src < *dst) { *dst = *src; @@ -386,9 +386,9 @@ void *FastGaussianBlurValueOperation::initializeTileData(rcti *rect) } } else if (overlay_ == FAST_GAUSS_OVERLAY_MAX) { - float *src = newBuf->getBuffer(); - float *dst = copy->getBuffer(); - for (int i = copy->getWidth() * copy->getHeight(); i != 0; + float *src = new_buf->get_buffer(); + float *dst = copy->get_buffer(); + for (int i = copy->get_width() * copy->get_height(); i != 0; i--, src += COM_DATA_TYPE_VALUE_CHANNELS, dst += COM_DATA_TYPE_VALUE_CHANNELS) { if (*src > *dst) { *dst = *src; @@ -398,7 +398,7 @@ void *FastGaussianBlurValueOperation::initializeTileData(rcti *rect) iirgaus_ = copy; } - unlockMutex(); + unlock_mutex(); return iirgaus_; } diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h index 2a0ed078612..8d33e5ef244 100644 --- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h +++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.h @@ -31,16 +31,16 @@ class FastGaussianBlurOperation : public BlurBaseOperation { public: FastGaussianBlurOperation(); - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; - void executePixel(float output[4], int x, int y, void *data) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; + void execute_pixel(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) override; + void *initialize_tile_data(rcti *rect) override; void init_data() override; - void deinitExecution() override; - void initExecution() override; + void deinit_execution() override; + void init_execution() override; void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; void update_memory_buffer_started(MemoryBuffer *output, @@ -73,21 +73,21 @@ class FastGaussianBlurValueOperation : public MultiThreadedOperation { public: FastGaussianBlurValueOperation(); - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; - void executePixel(float output[4], int x, int y, void *data) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; + void execute_pixel(float output[4], int x, int y, void *data) override; - void *initializeTileData(rcti *rect) override; - void deinitExecution() override; - void initExecution() override; - void setSigma(float sigma) + void *initialize_tile_data(rcti *rect) override; + void deinit_execution() override; + void init_execution() override; + void set_sigma(float sigma) { sigma_ = sigma; } /* used for DOF blurring ZBuffer */ - void setOverlay(int overlay) + void set_overlay(int overlay) { overlay_ = overlay; } diff --git a/source/blender/compositor/operations/COM_FlipOperation.cc b/source/blender/compositor/operations/COM_FlipOperation.cc index ae2aa21131a..7ca12a504b7 100644 --- a/source/blender/compositor/operations/COM_FlipOperation.cc +++ b/source/blender/compositor/operations/COM_FlipOperation.cc @@ -22,57 +22,57 @@ namespace blender::compositor { FlipOperation::FlipOperation() { - this->addInputSocket(DataType::Color, ResizeMode::None); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color, ResizeMode::None); + this->add_output_socket(DataType::Color); this->set_canvas_input_index(0); - inputOperation_ = nullptr; - flipX_ = true; - flipY_ = false; + input_operation_ = nullptr; + flip_x_ = true; + flip_y_ = false; } -void FlipOperation::initExecution() +void FlipOperation::init_execution() { - inputOperation_ = this->getInputSocketReader(0); + input_operation_ = this->get_input_socket_reader(0); } -void FlipOperation::deinitExecution() +void FlipOperation::deinit_execution() { - inputOperation_ = nullptr; + input_operation_ = nullptr; } -void FlipOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) +void FlipOperation::execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) { - float nx = flipX_ ? ((int)this->getWidth() - 1) - x : x; - float ny = flipY_ ? ((int)this->getHeight() - 1) - y : y; + float nx = flip_x_ ? ((int)this->get_width() - 1) - x : x; + float ny = flip_y_ ? ((int)this->get_height() - 1) - y : y; - inputOperation_->readSampled(output, nx, ny, sampler); + input_operation_->read_sampled(output, nx, ny, sampler); } -bool FlipOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool FlipOperation::determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) { - rcti newInput; + rcti new_input; - if (flipX_) { - const int w = (int)this->getWidth() - 1; - newInput.xmax = (w - input->xmin) + 1; - newInput.xmin = (w - input->xmax) - 1; + if (flip_x_) { + const int w = (int)this->get_width() - 1; + new_input.xmax = (w - input->xmin) + 1; + new_input.xmin = (w - input->xmax) - 1; } else { - newInput.xmin = input->xmin; - newInput.xmax = input->xmax; + new_input.xmin = input->xmin; + new_input.xmax = input->xmax; } - if (flipY_) { - const int h = (int)this->getHeight() - 1; - newInput.ymax = (h - input->ymin) + 1; - newInput.ymin = (h - input->ymax) - 1; + if (flip_y_) { + const int h = (int)this->get_height() - 1; + new_input.ymax = (h - input->ymin) + 1; + new_input.ymin = (h - input->ymax) - 1; } else { - newInput.ymin = input->ymin; - newInput.ymax = input->ymax; + new_input.ymin = input->ymin; + new_input.ymax = input->ymax; } - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } void FlipOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) @@ -80,12 +80,12 @@ void FlipOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) NodeOperation::determine_canvas(preferred_area, r_area); if (execution_model_ == eExecutionModel::FullFrame) { rcti input_area = r_area; - if (flipX_) { + if (flip_x_) { const int width = BLI_rcti_size_x(&input_area) - 1; r_area.xmax = (width - input_area.xmin) + 1; r_area.xmin = (width - input_area.xmax) + 1; } - if (flipY_) { + if (flip_y_) { const int height = BLI_rcti_size_y(&input_area) - 1; r_area.ymax = (height - input_area.ymin) + 1; r_area.ymin = (height - input_area.ymax) + 1; @@ -99,8 +99,8 @@ void FlipOperation::get_area_of_interest(const int input_idx, { BLI_assert(input_idx == 0); UNUSED_VARS_NDEBUG(input_idx); - if (flipX_) { - const int w = (int)this->getWidth() - 1; + if (flip_x_) { + const int w = (int)this->get_width() - 1; r_input_area.xmax = (w - output_area.xmin) + 1; r_input_area.xmin = (w - output_area.xmax) + 1; } @@ -108,8 +108,8 @@ void FlipOperation::get_area_of_interest(const int input_idx, r_input_area.xmin = output_area.xmin; r_input_area.xmax = output_area.xmax; } - if (flipY_) { - const int h = (int)this->getHeight() - 1; + if (flip_y_) { + const int h = (int)this->get_height() - 1; r_input_area.ymax = (h - output_area.ymin) + 1; r_input_area.ymin = (h - output_area.ymax) + 1; } @@ -127,8 +127,8 @@ void FlipOperation::update_memory_buffer_partial(MemoryBuffer *output, const int input_offset_x = input_img->get_rect().xmin; const int input_offset_y = input_img->get_rect().ymin; for (BuffersIterator<float> it = output->iterate_with({}, area); !it.is_end(); ++it) { - const int nx = flipX_ ? ((int)this->getWidth() - 1) - it.x : it.x; - const int ny = flipY_ ? ((int)this->getHeight() - 1) - it.y : it.y; + const int nx = flip_x_ ? ((int)this->get_width() - 1) - it.x : it.x; + const int ny = flip_y_ ? ((int)this->get_height() - 1) - it.y : it.y; input_img->read_elem(input_offset_x + nx, input_offset_y + ny, it.out); } } diff --git a/source/blender/compositor/operations/COM_FlipOperation.h b/source/blender/compositor/operations/COM_FlipOperation.h index 3310819051a..001fd652740 100644 --- a/source/blender/compositor/operations/COM_FlipOperation.h +++ b/source/blender/compositor/operations/COM_FlipOperation.h @@ -24,26 +24,26 @@ namespace blender::compositor { class FlipOperation : public MultiThreadedOperation { private: - SocketReader *inputOperation_; - bool flipX_; - bool flipY_; + SocketReader *input_operation_; + bool flip_x_; + bool flip_y_; public: FlipOperation(); - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; void setFlipX(bool flipX) { - flipX_ = flipX; + flip_x_ = flipX; } void setFlipY(bool flipY) { - flipY_ = flipY; + flip_y_ = flipY; } void determine_canvas(const rcti &preferred_area, rcti &r_area) override; diff --git a/source/blender/compositor/operations/COM_GammaCorrectOperation.cc b/source/blender/compositor/operations/COM_GammaCorrectOperation.cc index 9a51c789943..0271e57b2c4 100644 --- a/source/blender/compositor/operations/COM_GammaCorrectOperation.cc +++ b/source/blender/compositor/operations/COM_GammaCorrectOperation.cc @@ -22,39 +22,39 @@ namespace blender::compositor { GammaCorrectOperation::GammaCorrectOperation() { - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); - inputProgram_ = nullptr; + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); + input_program_ = nullptr; flags.can_be_constant = true; } -void GammaCorrectOperation::initExecution() +void GammaCorrectOperation::init_execution() { - inputProgram_ = this->getInputSocketReader(0); + input_program_ = this->get_input_socket_reader(0); } -void GammaCorrectOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void GammaCorrectOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor[4]; - inputProgram_->readSampled(inputColor, x, y, sampler); - if (inputColor[3] > 0.0f) { - inputColor[0] /= inputColor[3]; - inputColor[1] /= inputColor[3]; - inputColor[2] /= inputColor[3]; + float input_color[4]; + input_program_->read_sampled(input_color, x, y, sampler); + if (input_color[3] > 0.0f) { + input_color[0] /= input_color[3]; + input_color[1] /= input_color[3]; + input_color[2] /= input_color[3]; } /* check for negative to avoid nan's */ - output[0] = inputColor[0] > 0.0f ? inputColor[0] * inputColor[0] : 0.0f; - output[1] = inputColor[1] > 0.0f ? inputColor[1] * inputColor[1] : 0.0f; - output[2] = inputColor[2] > 0.0f ? inputColor[2] * inputColor[2] : 0.0f; - output[3] = inputColor[3]; - - if (inputColor[3] > 0.0f) { - output[0] *= inputColor[3]; - output[1] *= inputColor[3]; - output[2] *= inputColor[3]; + output[0] = input_color[0] > 0.0f ? input_color[0] * input_color[0] : 0.0f; + output[1] = input_color[1] > 0.0f ? input_color[1] * input_color[1] : 0.0f; + output[2] = input_color[2] > 0.0f ? input_color[2] * input_color[2] : 0.0f; + output[3] = input_color[3]; + + if (input_color[3] > 0.0f) { + output[0] *= input_color[3]; + output[1] *= input_color[3]; + output[2] *= input_color[3]; } } @@ -86,46 +86,46 @@ void GammaCorrectOperation::update_memory_buffer_partial(MemoryBuffer *output, } } -void GammaCorrectOperation::deinitExecution() +void GammaCorrectOperation::deinit_execution() { - inputProgram_ = nullptr; + input_program_ = nullptr; } GammaUncorrectOperation::GammaUncorrectOperation() { - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); - inputProgram_ = nullptr; + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); + input_program_ = nullptr; flags.can_be_constant = true; } -void GammaUncorrectOperation::initExecution() +void GammaUncorrectOperation::init_execution() { - inputProgram_ = this->getInputSocketReader(0); + input_program_ = this->get_input_socket_reader(0); } -void GammaUncorrectOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void GammaUncorrectOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor[4]; - inputProgram_->readSampled(inputColor, x, y, sampler); + float input_color[4]; + input_program_->read_sampled(input_color, x, y, sampler); - if (inputColor[3] > 0.0f) { - inputColor[0] /= inputColor[3]; - inputColor[1] /= inputColor[3]; - inputColor[2] /= inputColor[3]; + if (input_color[3] > 0.0f) { + input_color[0] /= input_color[3]; + input_color[1] /= input_color[3]; + input_color[2] /= input_color[3]; } - output[0] = inputColor[0] > 0.0f ? sqrtf(inputColor[0]) : 0.0f; - output[1] = inputColor[1] > 0.0f ? sqrtf(inputColor[1]) : 0.0f; - output[2] = inputColor[2] > 0.0f ? sqrtf(inputColor[2]) : 0.0f; - output[3] = inputColor[3]; + output[0] = input_color[0] > 0.0f ? sqrtf(input_color[0]) : 0.0f; + output[1] = input_color[1] > 0.0f ? sqrtf(input_color[1]) : 0.0f; + output[2] = input_color[2] > 0.0f ? sqrtf(input_color[2]) : 0.0f; + output[3] = input_color[3]; - if (inputColor[3] > 0.0f) { - output[0] *= inputColor[3]; - output[1] *= inputColor[3]; - output[2] *= inputColor[3]; + if (input_color[3] > 0.0f) { + output[0] *= input_color[3]; + output[1] *= input_color[3]; + output[2] *= input_color[3]; } } @@ -156,9 +156,9 @@ void GammaUncorrectOperation::update_memory_buffer_partial(MemoryBuffer *output, } } -void GammaUncorrectOperation::deinitExecution() +void GammaUncorrectOperation::deinit_execution() { - inputProgram_ = nullptr; + input_program_ = nullptr; } } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GammaCorrectOperation.h b/source/blender/compositor/operations/COM_GammaCorrectOperation.h index 5c6307fe6d0..e13d96184ad 100644 --- a/source/blender/compositor/operations/COM_GammaCorrectOperation.h +++ b/source/blender/compositor/operations/COM_GammaCorrectOperation.h @@ -25,9 +25,9 @@ namespace blender::compositor { class GammaCorrectOperation : public MultiThreadedOperation { private: /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputProgram_; + SocketReader *input_program_; public: GammaCorrectOperation(); @@ -35,17 +35,17 @@ class GammaCorrectOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, @@ -55,9 +55,9 @@ class GammaCorrectOperation : public MultiThreadedOperation { class GammaUncorrectOperation : public MultiThreadedOperation { private: /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputProgram_; + SocketReader *input_program_; public: GammaUncorrectOperation(); @@ -65,17 +65,17 @@ class GammaUncorrectOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, diff --git a/source/blender/compositor/operations/COM_GammaOperation.cc b/source/blender/compositor/operations/COM_GammaOperation.cc index a809b16f523..fb8f18bcc28 100644 --- a/source/blender/compositor/operations/COM_GammaOperation.cc +++ b/source/blender/compositor/operations/COM_GammaOperation.cc @@ -22,33 +22,33 @@ namespace blender::compositor { GammaOperation::GammaOperation() { - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Color); - inputProgram_ = nullptr; - inputGammaProgram_ = nullptr; + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Color); + input_program_ = nullptr; + input_gamma_program_ = nullptr; flags.can_be_constant = true; } -void GammaOperation::initExecution() +void GammaOperation::init_execution() { - inputProgram_ = this->getInputSocketReader(0); - inputGammaProgram_ = this->getInputSocketReader(1); + input_program_ = this->get_input_socket_reader(0); + input_gamma_program_ = this->get_input_socket_reader(1); } -void GammaOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) +void GammaOperation::execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) { - float inputValue[4]; - float inputGamma[4]; + float input_value[4]; + float input_gamma[4]; - inputProgram_->readSampled(inputValue, x, y, sampler); - inputGammaProgram_->readSampled(inputGamma, x, y, sampler); - const float gamma = inputGamma[0]; + input_program_->read_sampled(input_value, x, y, sampler); + input_gamma_program_->read_sampled(input_gamma, x, y, sampler); + const float gamma = input_gamma[0]; /* check for negative to avoid nan's */ - output[0] = inputValue[0] > 0.0f ? powf(inputValue[0], gamma) : inputValue[0]; - output[1] = inputValue[1] > 0.0f ? powf(inputValue[1], gamma) : inputValue[1]; - output[2] = inputValue[2] > 0.0f ? powf(inputValue[2], gamma) : inputValue[2]; + output[0] = input_value[0] > 0.0f ? powf(input_value[0], gamma) : input_value[0]; + output[1] = input_value[1] > 0.0f ? powf(input_value[1], gamma) : input_value[1]; + output[2] = input_value[2] > 0.0f ? powf(input_value[2], gamma) : input_value[2]; - output[3] = inputValue[3]; + output[3] = input_value[3]; } void GammaOperation::update_memory_buffer_row(PixelCursor &p) @@ -65,10 +65,10 @@ void GammaOperation::update_memory_buffer_row(PixelCursor &p) } } -void GammaOperation::deinitExecution() +void GammaOperation::deinit_execution() { - inputProgram_ = nullptr; - inputGammaProgram_ = nullptr; + input_program_ = nullptr; + input_gamma_program_ = nullptr; } } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GammaOperation.h b/source/blender/compositor/operations/COM_GammaOperation.h index 9b68a2c8a1b..d8703a0a19a 100644 --- a/source/blender/compositor/operations/COM_GammaOperation.h +++ b/source/blender/compositor/operations/COM_GammaOperation.h @@ -25,10 +25,10 @@ namespace blender::compositor { class GammaOperation : public MultiThreadedRowOperation { private: /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputProgram_; - SocketReader *inputGammaProgram_; + SocketReader *input_program_; + SocketReader *input_gamma_program_; public: GammaOperation(); @@ -36,17 +36,17 @@ class GammaOperation : public MultiThreadedRowOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; void update_memory_buffer_row(PixelCursor &p) override; }; diff --git a/source/blender/compositor/operations/COM_GaussianAlphaBlurBaseOperation.cc b/source/blender/compositor/operations/COM_GaussianAlphaBlurBaseOperation.cc index fa742775f24..1a8c000cdd8 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaBlurBaseOperation.cc +++ b/source/blender/compositor/operations/COM_GaussianAlphaBlurBaseOperation.cc @@ -39,18 +39,18 @@ void GaussianAlphaBlurBaseOperation::init_data() } } -void GaussianAlphaBlurBaseOperation::initExecution() +void GaussianAlphaBlurBaseOperation::init_execution() { - BlurBaseOperation::initExecution(); + BlurBaseOperation::init_execution(); if (execution_model_ == eExecutionModel::FullFrame) { gausstab_ = BlurBaseOperation::make_gausstab(rad_, filtersize_); distbuf_inv_ = BlurBaseOperation::make_dist_fac_inverse(rad_, filtersize_, falloff_); } } -void GaussianAlphaBlurBaseOperation::deinitExecution() +void GaussianAlphaBlurBaseOperation::deinit_execution() { - BlurBaseOperation::deinitExecution(); + BlurBaseOperation::deinit_execution(); if (gausstab_) { MEM_freeN(gausstab_); @@ -133,7 +133,7 @@ void GaussianAlphaBlurBaseOperation::update_memory_buffer_partial(MemoryBuffer * float value_max = finv_test(*it.in(0), do_invert); float distfacinv_max = 1.0f; /* 0 to 1 */ - const int step = QualityStepHelper::getStep(); + const int step = QualityStepHelper::get_step(); const float *in = it.in(0) + ((intptr_t)coord_min - coord) * elem_stride; const int in_stride = elem_stride * step; int index = (coord_min - coord) + filtersize_; diff --git a/source/blender/compositor/operations/COM_GaussianAlphaBlurBaseOperation.h b/source/blender/compositor/operations/COM_GaussianAlphaBlurBaseOperation.h index 307d8b0dff5..0f83a67cef7 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaBlurBaseOperation.h +++ b/source/blender/compositor/operations/COM_GaussianAlphaBlurBaseOperation.h @@ -36,8 +36,8 @@ class GaussianAlphaBlurBaseOperation : public BlurBaseOperation { GaussianAlphaBlurBaseOperation(eDimension dim); virtual void init_data() override; - virtual void initExecution() override; - virtual void deinitExecution() override; + virtual void init_execution() override; + virtual void deinit_execution() override; void get_area_of_interest(const int input_idx, const rcti &output_area, @@ -49,11 +49,11 @@ class GaussianAlphaBlurBaseOperation : public BlurBaseOperation { /** * Set subtract for Dilate/Erode functionality */ - void setSubtract(bool subtract) + void set_subtract(bool subtract) { do_subtract_ = subtract; } - void setFalloff(int falloff) + void set_falloff(int falloff) { falloff_ = falloff; } diff --git a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cc b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cc index b854ea736b3..de0010fcb58 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cc +++ b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cc @@ -25,22 +25,22 @@ GaussianAlphaXBlurOperation::GaussianAlphaXBlurOperation() { } -void *GaussianAlphaXBlurOperation::initializeTileData(rcti * /*rect*/) +void *GaussianAlphaXBlurOperation::initialize_tile_data(rcti * /*rect*/) { - lockMutex(); + lock_mutex(); if (!sizeavailable_) { - updateGauss(); + update_gauss(); } - void *buffer = getInputOperation(0)->initializeTileData(nullptr); - unlockMutex(); + void *buffer = get_input_operation(0)->initialize_tile_data(nullptr); + unlock_mutex(); return buffer; } -void GaussianAlphaXBlurOperation::initExecution() +void GaussianAlphaXBlurOperation::init_execution() { - GaussianAlphaBlurBaseOperation::initExecution(); + GaussianAlphaBlurBaseOperation::init_execution(); - initMutex(); + init_mutex(); if (sizeavailable_ && execution_model_ == eExecutionModel::Tiled) { float rad = max_ff(size_ * data_.sizex, 0.0f); @@ -51,10 +51,10 @@ void GaussianAlphaXBlurOperation::initExecution() } } -void GaussianAlphaXBlurOperation::updateGauss() +void GaussianAlphaXBlurOperation::update_gauss() { if (gausstab_ == nullptr) { - updateSize(); + update_size(); float rad = max_ff(size_ * data_.sizex, 0.0f); filtersize_ = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); @@ -62,7 +62,7 @@ void GaussianAlphaXBlurOperation::updateGauss() } if (distbuf_inv_ == nullptr) { - updateSize(); + update_size(); float rad = max_ff(size_ * data_.sizex, 0.0f); rad = min_ff(rad, MAX_GAUSSTAB_RADIUS); filtersize_ = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); @@ -76,23 +76,23 @@ BLI_INLINE float finv_test(const float f, const bool test) return (LIKELY(test == false)) ? f : 1.0f - f; } -void GaussianAlphaXBlurOperation::executePixel(float output[4], int x, int y, void *data) +void GaussianAlphaXBlurOperation::execute_pixel(float output[4], int x, int y, void *data) { const bool do_invert = do_subtract_; - MemoryBuffer *inputBuffer = (MemoryBuffer *)data; - float *buffer = inputBuffer->getBuffer(); - int bufferwidth = inputBuffer->getWidth(); - const rcti &input_rect = inputBuffer->get_rect(); + MemoryBuffer *input_buffer = (MemoryBuffer *)data; + float *buffer = input_buffer->get_buffer(); + int bufferwidth = input_buffer->get_width(); + const rcti &input_rect = input_buffer->get_rect(); int bufferstartx = input_rect.xmin; int bufferstarty = input_rect.ymin; - const rcti &rect = inputBuffer->get_rect(); + const rcti &rect = input_buffer->get_rect(); int xmin = max_ii(x - filtersize_, rect.xmin); int xmax = min_ii(x + filtersize_ + 1, rect.xmax); int ymin = max_ii(y, rect.ymin); /* *** this is the main part which is different to 'GaussianXBlurOperation' *** */ - int step = getStep(); + int step = get_step(); int bufferindex = ((xmin - bufferstartx)) + ((ymin - bufferstarty) * bufferwidth); /* gauss */ @@ -135,9 +135,9 @@ void GaussianAlphaXBlurOperation::executePixel(float output[4], int x, int y, vo output[0] = finv_test(value_final, do_invert); } -void GaussianAlphaXBlurOperation::deinitExecution() +void GaussianAlphaXBlurOperation::deinit_execution() { - GaussianAlphaBlurBaseOperation::deinitExecution(); + GaussianAlphaBlurBaseOperation::deinit_execution(); if (gausstab_) { MEM_freeN(gausstab_); @@ -149,40 +149,40 @@ void GaussianAlphaXBlurOperation::deinitExecution() distbuf_inv_ = nullptr; } - deinitMutex(); + deinit_mutex(); } -bool GaussianAlphaXBlurOperation::determineDependingAreaOfInterest( - rcti *input, ReadBufferOperation *readOperation, rcti *output) +bool GaussianAlphaXBlurOperation::determine_depending_area_of_interest( + rcti *input, ReadBufferOperation *read_operation, rcti *output) { - rcti newInput; + rcti new_input; #if 0 /* until we add size input */ - rcti sizeInput; - sizeInput.xmin = 0; - sizeInput.ymin = 0; - sizeInput.xmax = 5; - sizeInput.ymax = 5; - - NodeOperation *operation = this->getInputOperation(1); - if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) { + rcti size_input; + size_input.xmin = 0; + size_input.ymin = 0; + size_input.xmax = 5; + size_input.ymax = 5; + + NodeOperation *operation = this->get_input_operation(1); + if (operation->determine_depending_area_of_interest(&size_input, read_operation, output)) { return true; } else #endif { if (sizeavailable_ && gausstab_ != nullptr) { - newInput.xmax = input->xmax + filtersize_ + 1; - newInput.xmin = input->xmin - filtersize_ - 1; - newInput.ymax = input->ymax; - newInput.ymin = input->ymin; + new_input.xmax = input->xmax + filtersize_ + 1; + new_input.xmin = input->xmin - filtersize_ - 1; + new_input.ymax = input->ymax; + new_input.ymin = input->ymin; } else { - newInput.xmax = this->getWidth(); - newInput.xmin = 0; - newInput.ymax = this->getHeight(); - newInput.ymin = 0; + new_input.xmax = this->get_width(); + new_input.xmin = 0; + new_input.ymax = this->get_height(); + new_input.ymin = 0; } - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } } diff --git a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h index 2a44c639665..31b4a582c4b 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h @@ -25,7 +25,7 @@ namespace blender::compositor { /* TODO(manzanilla): everything to be removed with tiled implementation except the constructor. */ class GaussianAlphaXBlurOperation : public GaussianAlphaBlurBaseOperation { private: - void updateGauss(); + void update_gauss(); public: GaussianAlphaXBlurOperation(); @@ -33,22 +33,22 @@ class GaussianAlphaXBlurOperation : public GaussianAlphaBlurBaseOperation { /** * \brief The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; /** * \brief initialize the execution */ - void initExecution() override; + void init_execution() override; /** * \brief Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void *initializeTileData(rcti *rect) override; - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + void *initialize_tile_data(rcti *rect) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; }; } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cc b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cc index eaf3abc18cd..90a80e6779a 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cc +++ b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cc @@ -25,23 +25,23 @@ GaussianAlphaYBlurOperation::GaussianAlphaYBlurOperation() { } -void *GaussianAlphaYBlurOperation::initializeTileData(rcti * /*rect*/) +void *GaussianAlphaYBlurOperation::initialize_tile_data(rcti * /*rect*/) { - lockMutex(); + lock_mutex(); if (!sizeavailable_) { - updateGauss(); + update_gauss(); } - void *buffer = getInputOperation(0)->initializeTileData(nullptr); - unlockMutex(); + void *buffer = get_input_operation(0)->initialize_tile_data(nullptr); + unlock_mutex(); return buffer; } /* TODO(manzanilla): to be removed with tiled implementation. */ -void GaussianAlphaYBlurOperation::initExecution() +void GaussianAlphaYBlurOperation::init_execution() { - GaussianAlphaBlurBaseOperation::initExecution(); + GaussianAlphaBlurBaseOperation::init_execution(); - initMutex(); + init_mutex(); if (sizeavailable_ && execution_model_ == eExecutionModel::Tiled) { float rad = max_ff(size_ * data_.sizey, 0.0f); @@ -53,10 +53,10 @@ void GaussianAlphaYBlurOperation::initExecution() } /* TODO(manzanilla): to be removed with tiled implementation. */ -void GaussianAlphaYBlurOperation::updateGauss() +void GaussianAlphaYBlurOperation::update_gauss() { if (gausstab_ == nullptr) { - updateSize(); + update_size(); float rad = max_ff(size_ * data_.sizey, 0.0f); rad = min_ff(rad, MAX_GAUSSTAB_RADIUS); filtersize_ = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); @@ -65,7 +65,7 @@ void GaussianAlphaYBlurOperation::updateGauss() } if (distbuf_inv_ == nullptr) { - updateSize(); + update_size(); float rad = max_ff(size_ * data_.sizey, 0.0f); filtersize_ = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); @@ -78,13 +78,13 @@ BLI_INLINE float finv_test(const float f, const bool test) return (LIKELY(test == false)) ? f : 1.0f - f; } -void GaussianAlphaYBlurOperation::executePixel(float output[4], int x, int y, void *data) +void GaussianAlphaYBlurOperation::execute_pixel(float output[4], int x, int y, void *data) { const bool do_invert = do_subtract_; - MemoryBuffer *inputBuffer = (MemoryBuffer *)data; - const rcti &input_rect = inputBuffer->get_rect(); - float *buffer = inputBuffer->getBuffer(); - int bufferwidth = inputBuffer->getWidth(); + MemoryBuffer *input_buffer = (MemoryBuffer *)data; + const rcti &input_rect = input_buffer->get_rect(); + float *buffer = input_buffer->get_buffer(); + int bufferwidth = input_buffer->get_width(); int bufferstartx = input_rect.xmin; int bufferstarty = input_rect.ymin; @@ -93,7 +93,7 @@ void GaussianAlphaYBlurOperation::executePixel(float output[4], int x, int y, vo int ymax = min_ii(y + filtersize_ + 1, input_rect.ymax); /* *** this is the main part which is different to 'GaussianYBlurOperation' *** */ - int step = getStep(); + int step = get_step(); /* gauss */ float alpha_accum = 0.0f; @@ -136,9 +136,9 @@ void GaussianAlphaYBlurOperation::executePixel(float output[4], int x, int y, vo output[0] = finv_test(value_final, do_invert); } -void GaussianAlphaYBlurOperation::deinitExecution() +void GaussianAlphaYBlurOperation::deinit_execution() { - GaussianAlphaBlurBaseOperation::deinitExecution(); + GaussianAlphaBlurBaseOperation::deinit_execution(); if (gausstab_) { MEM_freeN(gausstab_); @@ -150,40 +150,40 @@ void GaussianAlphaYBlurOperation::deinitExecution() distbuf_inv_ = nullptr; } - deinitMutex(); + deinit_mutex(); } -bool GaussianAlphaYBlurOperation::determineDependingAreaOfInterest( - rcti *input, ReadBufferOperation *readOperation, rcti *output) +bool GaussianAlphaYBlurOperation::determine_depending_area_of_interest( + rcti *input, ReadBufferOperation *read_operation, rcti *output) { - rcti newInput; + rcti new_input; #if 0 /* until we add size input */ - rcti sizeInput; - sizeInput.xmin = 0; - sizeInput.ymin = 0; - sizeInput.xmax = 5; - sizeInput.ymax = 5; - - NodeOperation *operation = this->getInputOperation(1); - if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) { + rcti size_input; + size_input.xmin = 0; + size_input.ymin = 0; + size_input.xmax = 5; + size_input.ymax = 5; + + NodeOperation *operation = this->get_input_operation(1); + if (operation->determine_depending_area_of_interest(&size_input, read_operation, output)) { return true; } else #endif { if (sizeavailable_ && gausstab_ != nullptr) { - newInput.xmax = input->xmax; - newInput.xmin = input->xmin; - newInput.ymax = input->ymax + filtersize_ + 1; - newInput.ymin = input->ymin - filtersize_ - 1; + new_input.xmax = input->xmax; + new_input.xmin = input->xmin; + new_input.ymax = input->ymax + filtersize_ + 1; + new_input.ymin = input->ymin - filtersize_ - 1; } else { - newInput.xmax = this->getWidth(); - newInput.xmin = 0; - newInput.ymax = this->getHeight(); - newInput.ymin = 0; + new_input.xmax = this->get_width(); + new_input.xmin = 0; + new_input.ymax = this->get_height(); + new_input.ymin = 0; } - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } } diff --git a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h index ef01f7e0f92..28dc289c445 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h @@ -25,7 +25,7 @@ namespace blender::compositor { /* TODO(manzanilla): everything to be removed with tiled implementation except the constructor. */ class GaussianAlphaYBlurOperation : public GaussianAlphaBlurBaseOperation { private: - void updateGauss(); + void update_gauss(); public: GaussianAlphaYBlurOperation(); @@ -33,22 +33,22 @@ class GaussianAlphaYBlurOperation : public GaussianAlphaBlurBaseOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; /** * \brief initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void *initializeTileData(rcti *rect) override; - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + void *initialize_tile_data(rcti *rect) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; }; } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_GaussianBlurBaseOperation.cc b/source/blender/compositor/operations/COM_GaussianBlurBaseOperation.cc index e6d3b3d4424..9f4ee376fbf 100644 --- a/source/blender/compositor/operations/COM_GaussianBlurBaseOperation.cc +++ b/source/blender/compositor/operations/COM_GaussianBlurBaseOperation.cc @@ -42,9 +42,9 @@ void GaussianBlurBaseOperation::init_data() } } -void GaussianBlurBaseOperation::initExecution() +void GaussianBlurBaseOperation::init_execution() { - BlurBaseOperation::initExecution(); + BlurBaseOperation::init_execution(); if (execution_model_ == eExecutionModel::FullFrame) { gausstab_ = BlurBaseOperation::make_gausstab(rad_, filtersize_); #ifdef BLI_HAVE_SSE2 @@ -53,9 +53,9 @@ void GaussianBlurBaseOperation::initExecution() } } -void GaussianBlurBaseOperation::deinitExecution() +void GaussianBlurBaseOperation::deinit_execution() { - BlurBaseOperation::deinitExecution(); + BlurBaseOperation::deinit_execution(); if (gausstab_) { MEM_freeN(gausstab_); @@ -126,7 +126,7 @@ void GaussianBlurBaseOperation::update_memory_buffer_partial(MemoryBuffer *outpu float ATTR_ALIGN(16) color_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f}; float multiplier_accum = 0.0f; - const int step = QualityStepHelper::getStep(); + const int step = QualityStepHelper::get_step(); const float *in = it.in(0) + ((intptr_t)coord_min - coord) * elem_stride; const int in_stride = elem_stride * step; int gauss_idx = (coord_min - coord) + filtersize_; diff --git a/source/blender/compositor/operations/COM_GaussianBlurBaseOperation.h b/source/blender/compositor/operations/COM_GaussianBlurBaseOperation.h index 0e3a86e63ec..31b045241f8 100644 --- a/source/blender/compositor/operations/COM_GaussianBlurBaseOperation.h +++ b/source/blender/compositor/operations/COM_GaussianBlurBaseOperation.h @@ -36,8 +36,8 @@ class GaussianBlurBaseOperation : public BlurBaseOperation { GaussianBlurBaseOperation(eDimension dim); virtual void init_data() override; - virtual void initExecution() override; - virtual void deinitExecution() override; + virtual void init_execution() override; + virtual void deinit_execution() override; void get_area_of_interest(const int input_idx, const rcti &output_area, diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cc b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cc index b5d6aa69423..db5f9c7c35d 100644 --- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cc +++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cc @@ -27,25 +27,25 @@ GaussianBokehBlurOperation::GaussianBokehBlurOperation() : BlurBaseOperation(Dat gausstab_ = nullptr; } -void *GaussianBokehBlurOperation::initializeTileData(rcti * /*rect*/) +void *GaussianBokehBlurOperation::initialize_tile_data(rcti * /*rect*/) { - lockMutex(); + lock_mutex(); if (!sizeavailable_) { - updateGauss(); + update_gauss(); } - void *buffer = getInputOperation(0)->initializeTileData(nullptr); - unlockMutex(); + void *buffer = get_input_operation(0)->initialize_tile_data(nullptr); + unlock_mutex(); return buffer; } void GaussianBokehBlurOperation::init_data() { BlurBaseOperation::init_data(); - const float width = this->getWidth(); - const float height = this->getHeight(); + const float width = this->get_width(); + const float height = this->get_height(); if (!sizeavailable_) { - updateSize(); + update_size(); } radxf_ = size_ * (float)data_.sizex; @@ -59,18 +59,18 @@ void GaussianBokehBlurOperation::init_data() rady_ = ceil(radyf_); } -void GaussianBokehBlurOperation::initExecution() +void GaussianBokehBlurOperation::init_execution() { - BlurBaseOperation::initExecution(); + BlurBaseOperation::init_execution(); - initMutex(); + init_mutex(); if (sizeavailable_) { - updateGauss(); + update_gauss(); } } -void GaussianBokehBlurOperation::updateGauss() +void GaussianBokehBlurOperation::update_gauss() { if (gausstab_ == nullptr) { int ddwidth = 2 * radx_ + 1; @@ -109,18 +109,18 @@ void GaussianBokehBlurOperation::updateGauss() } } -void GaussianBokehBlurOperation::executePixel(float output[4], int x, int y, void *data) +void GaussianBokehBlurOperation::execute_pixel(float output[4], int x, int y, void *data) { - float tempColor[4]; - tempColor[0] = 0; - tempColor[1] = 0; - tempColor[2] = 0; - tempColor[3] = 0; + float temp_color[4]; + temp_color[0] = 0; + temp_color[1] = 0; + temp_color[2] = 0; + temp_color[3] = 0; float multiplier_accum = 0; - MemoryBuffer *inputBuffer = (MemoryBuffer *)data; - float *buffer = inputBuffer->getBuffer(); - int bufferwidth = inputBuffer->getWidth(); - const rcti &input_rect = inputBuffer->get_rect(); + MemoryBuffer *input_buffer = (MemoryBuffer *)data; + float *buffer = input_buffer->get_buffer(); + int bufferwidth = input_buffer->get_width(); + const rcti &input_rect = input_buffer->get_rect(); int bufferstartx = input_rect.xmin; int bufferstarty = input_rect.ymin; @@ -130,67 +130,68 @@ void GaussianBokehBlurOperation::executePixel(float output[4], int x, int y, voi int xmax = min_ii(x + radx_ + 1, input_rect.xmax); int index; - int step = QualityStepHelper::getStep(); - int offsetadd = QualityStepHelper::getOffsetAdd(); - const int addConst = (xmin - x + radx_); - const int mulConst = (radx_ * 2 + 1); + int step = QualityStepHelper::get_step(); + int offsetadd = QualityStepHelper::get_offset_add(); + const int add_const = (xmin - x + radx_); + const int mul_const = (radx_ * 2 + 1); for (int ny = ymin; ny < ymax; ny += step) { - index = ((ny - y) + rady_) * mulConst + addConst; + index = ((ny - y) + rady_) * mul_const + add_const; int bufferindex = ((xmin - bufferstartx) * 4) + ((ny - bufferstarty) * 4 * bufferwidth); for (int nx = xmin; nx < xmax; nx += step) { const float multiplier = gausstab_[index]; - madd_v4_v4fl(tempColor, &buffer[bufferindex], multiplier); + madd_v4_v4fl(temp_color, &buffer[bufferindex], multiplier); multiplier_accum += multiplier; index += step; bufferindex += offsetadd; } } - mul_v4_v4fl(output, tempColor, 1.0f / multiplier_accum); + mul_v4_v4fl(output, temp_color, 1.0f / multiplier_accum); } -void GaussianBokehBlurOperation::deinitExecution() +void GaussianBokehBlurOperation::deinit_execution() { - BlurBaseOperation::deinitExecution(); + BlurBaseOperation::deinit_execution(); if (gausstab_) { MEM_freeN(gausstab_); gausstab_ = nullptr; } - deinitMutex(); + deinit_mutex(); } -bool GaussianBokehBlurOperation::determineDependingAreaOfInterest( - rcti *input, ReadBufferOperation *readOperation, rcti *output) +bool GaussianBokehBlurOperation::determine_depending_area_of_interest( + rcti *input, ReadBufferOperation *read_operation, rcti *output) { - rcti newInput; - rcti sizeInput; - sizeInput.xmin = 0; - sizeInput.ymin = 0; - sizeInput.xmax = 5; - sizeInput.ymax = 5; - NodeOperation *operation = this->getInputOperation(1); - - if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) { + rcti new_input; + rcti size_input; + size_input.xmin = 0; + size_input.ymin = 0; + size_input.xmax = 5; + size_input.ymax = 5; + NodeOperation *operation = this->get_input_operation(1); + + if (operation->determine_depending_area_of_interest(&size_input, read_operation, output)) { return true; } if (sizeavailable_ && gausstab_ != nullptr) { - newInput.xmin = 0; - newInput.ymin = 0; - newInput.xmax = this->getWidth(); - newInput.ymax = this->getHeight(); + new_input.xmin = 0; + new_input.ymin = 0; + new_input.xmax = this->get_width(); + new_input.ymax = this->get_height(); } else { int addx = radx_; int addy = rady_; - newInput.xmax = input->xmax + addx; - newInput.xmin = input->xmin - addx; - newInput.ymax = input->ymax + addy; - newInput.ymin = input->ymin - addy; + new_input.xmax = input->xmax + addx; + new_input.xmin = input->xmin - addx; + new_input.ymax = input->ymax + addy; + new_input.ymin = input->ymin - addy; } - return BlurBaseOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return BlurBaseOperation::determine_depending_area_of_interest( + &new_input, read_operation, output); } void GaussianBokehBlurOperation::get_area_of_interest(const int input_idx, @@ -224,9 +225,9 @@ void GaussianBokehBlurOperation::update_memory_buffer_partial(MemoryBuffer *outp const int xmin = max_ii(x - radx_, input_rect.xmin); const int xmax = min_ii(x + radx_ + 1, input_rect.xmax); - float tempColor[4] = {0}; + float temp_color[4] = {0}; float multiplier_accum = 0; - const int step = QualityStepHelper::getStep(); + const int step = QualityStepHelper::get_step(); const int elem_step = step * input->elem_stride; const int add_const = (xmin - x + radx_); const int mul_const = (radx_ * 2 + 1); @@ -236,12 +237,12 @@ void GaussianBokehBlurOperation::update_memory_buffer_partial(MemoryBuffer *outp const int gauss_end = gauss_index + (xmax - xmin); for (; gauss_index < gauss_end; gauss_index += step, color += elem_step) { const float multiplier = gausstab_[gauss_index]; - madd_v4_v4fl(tempColor, color, multiplier); + madd_v4_v4fl(temp_color, color, multiplier); multiplier_accum += multiplier; } } - mul_v4_v4fl(it.out, tempColor, 1.0f / multiplier_accum); + mul_v4_v4fl(it.out, temp_color, 1.0f / multiplier_accum); } } @@ -256,8 +257,8 @@ GaussianBlurReferenceOperation::GaussianBlurReferenceOperation() void GaussianBlurReferenceOperation::init_data() { /* Setup variables for gausstab and area of interest. */ - data_.image_in_width = this->getWidth(); - data_.image_in_height = this->getHeight(); + data_.image_in_width = this->get_width(); + data_.image_in_height = this->get_height(); if (data_.relative) { switch (data_.aspect) { case CMP_NODE_BLUR_ASPECT_NONE: @@ -277,7 +278,7 @@ void GaussianBlurReferenceOperation::init_data() /* Horizontal. */ filtersizex_ = (float)data_.sizex; - int imgx = getWidth() / 2; + int imgx = get_width() / 2; if (filtersizex_ > imgx) { filtersizex_ = imgx; } @@ -288,7 +289,7 @@ void GaussianBlurReferenceOperation::init_data() /* Vertical. */ filtersizey_ = (float)data_.sizey; - int imgy = getHeight() / 2; + int imgy = get_height() / 2; if (filtersizey_ > imgy) { filtersizey_ = imgy; } @@ -298,20 +299,20 @@ void GaussianBlurReferenceOperation::init_data() rady_ = (float)filtersizey_; } -void *GaussianBlurReferenceOperation::initializeTileData(rcti * /*rect*/) +void *GaussianBlurReferenceOperation::initialize_tile_data(rcti * /*rect*/) { - void *buffer = getInputOperation(0)->initializeTileData(nullptr); + void *buffer = get_input_operation(0)->initialize_tile_data(nullptr); return buffer; } -void GaussianBlurReferenceOperation::initExecution() +void GaussianBlurReferenceOperation::init_execution() { - BlurBaseOperation::initExecution(); + BlurBaseOperation::init_execution(); - updateGauss(); + update_gauss(); } -void GaussianBlurReferenceOperation::updateGauss() +void GaussianBlurReferenceOperation::update_gauss() { int i; int x = MAX2(filtersizex_, filtersizey_); @@ -321,23 +322,23 @@ void GaussianBlurReferenceOperation::updateGauss() } } -void GaussianBlurReferenceOperation::executePixel(float output[4], int x, int y, void *data) +void GaussianBlurReferenceOperation::execute_pixel(float output[4], int x, int y, void *data) { MemoryBuffer *memorybuffer = (MemoryBuffer *)data; - float *buffer = memorybuffer->getBuffer(); + float *buffer = memorybuffer->get_buffer(); float *gausstabx, *gausstabcenty; float *gausstaby, *gausstabcentx; int i, j; float *src; float sum, val; float rval, gval, bval, aval; - int imgx = getWidth(); - int imgy = getHeight(); - float tempSize[4]; - inputSize_->read(tempSize, x, y, data); - float refSize = tempSize[0]; - int refradx = (int)(refSize * radx_); - int refrady = (int)(refSize * rady_); + int imgx = get_width(); + int imgy = get_height(); + float temp_size[4]; + input_size_->read(temp_size, x, y, data); + float ref_size = temp_size[0]; + int refradx = (int)(ref_size * radx_); + int refrady = (int)(ref_size * rady_); if (refradx > filtersizex_) { refradx = filtersizex_; } @@ -352,7 +353,7 @@ void GaussianBlurReferenceOperation::executePixel(float output[4], int x, int y, } if (refradx == 1 && refrady == 1) { - memorybuffer->readNoCheck(output, x, y); + memorybuffer->read_no_check(output, x, y); } else { int minxr = x - refradx < 0 ? -x : -refradx; @@ -388,7 +389,7 @@ void GaussianBlurReferenceOperation::executePixel(float output[4], int x, int y, } } -void GaussianBlurReferenceOperation::deinitExecution() +void GaussianBlurReferenceOperation::deinit_execution() { int x, i; x = MAX2(filtersizex_, filtersizey_); @@ -396,26 +397,26 @@ void GaussianBlurReferenceOperation::deinitExecution() MEM_freeN(maintabs_[i]); } MEM_freeN(maintabs_); - BlurBaseOperation::deinitExecution(); + BlurBaseOperation::deinit_execution(); } -bool GaussianBlurReferenceOperation::determineDependingAreaOfInterest( - rcti *input, ReadBufferOperation *readOperation, rcti *output) +bool GaussianBlurReferenceOperation::determine_depending_area_of_interest( + rcti *input, ReadBufferOperation *read_operation, rcti *output) { - rcti newInput; - NodeOperation *operation = this->getInputOperation(1); + rcti new_input; + NodeOperation *operation = this->get_input_operation(1); - if (operation->determineDependingAreaOfInterest(input, readOperation, output)) { + if (operation->determine_depending_area_of_interest(input, read_operation, output)) { return true; } int addx = data_.sizex + 2; int addy = data_.sizey + 2; - newInput.xmax = input->xmax + addx; - newInput.xmin = input->xmin - addx; - newInput.ymax = input->ymax + addy; - newInput.ymin = input->ymin - addy; - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + new_input.xmax = input->xmax + addx; + new_input.xmin = input->xmin - addx; + new_input.ymax = input->ymax + addy; + new_input.ymin = input->ymin - addy; + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } void GaussianBlurReferenceOperation::get_area_of_interest(const int input_idx, @@ -465,8 +466,8 @@ void GaussianBlurReferenceOperation::update_memory_buffer_partial(MemoryBuffer * continue; } - const int w = getWidth(); - const int height = getHeight(); + const int w = get_width(); + const int height = get_height(); const int minxr = x - ref_radx < 0 ? -x : -ref_radx; const int maxxr = x + ref_radx > w ? w - x : ref_radx; const int minyr = y - ref_rady < 0 ? -y : -ref_rady; diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h index 5e6eeefa512..923daf7a447 100644 --- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h @@ -30,26 +30,26 @@ class GaussianBokehBlurOperation : public BlurBaseOperation { int radx_, rady_; float radxf_; float radyf_; - void updateGauss(); + void update_gauss(); public: GaussianBokehBlurOperation(); void init_data() override; - void initExecution() override; - void *initializeTileData(rcti *rect) override; + void init_execution() override; + void *initialize_tile_data(rcti *rect) override; /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; void get_area_of_interest(const int input_idx, const rcti &output_area, @@ -63,7 +63,7 @@ class GaussianBlurReferenceOperation : public BlurBaseOperation { private: float **maintabs_; - void updateGauss(); + void update_gauss(); int filtersizex_; int filtersizey_; float radx_; @@ -72,21 +72,21 @@ class GaussianBlurReferenceOperation : public BlurBaseOperation { public: GaussianBlurReferenceOperation(); void init_data() override; - void initExecution() override; - void *initializeTileData(rcti *rect) override; + void init_execution() override; + void *initialize_tile_data(rcti *rect) override; /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; void get_area_of_interest(const int input_idx, const rcti &output_area, diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cc b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cc index 4720b3f69d0..b43db5ba664 100644 --- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cc +++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cc @@ -25,23 +25,23 @@ GaussianXBlurOperation::GaussianXBlurOperation() : GaussianBlurBaseOperation(eDi { } -void *GaussianXBlurOperation::initializeTileData(rcti * /*rect*/) +void *GaussianXBlurOperation::initialize_tile_data(rcti * /*rect*/) { - lockMutex(); + lock_mutex(); if (!sizeavailable_) { - updateGauss(); + update_gauss(); } - void *buffer = getInputOperation(0)->initializeTileData(nullptr); - unlockMutex(); + void *buffer = get_input_operation(0)->initialize_tile_data(nullptr); + unlock_mutex(); return buffer; } /* TODO(manzanilla): to be removed with tiled implementation. */ -void GaussianXBlurOperation::initExecution() +void GaussianXBlurOperation::init_execution() { - GaussianBlurBaseOperation::initExecution(); + GaussianBlurBaseOperation::init_execution(); - initMutex(); + init_mutex(); if (sizeavailable_ && execution_model_ == eExecutionModel::Tiled) { float rad = max_ff(size_ * data_.sizex, 0.0f); @@ -56,10 +56,10 @@ void GaussianXBlurOperation::initExecution() } /* TODO(manzanilla): to be removed with tiled implementation. */ -void GaussianXBlurOperation::updateGauss() +void GaussianXBlurOperation::update_gauss() { if (gausstab_ == nullptr) { - updateSize(); + update_size(); float rad = max_ff(size_ * data_.sizex, 0.0f); rad = min_ff(rad, MAX_GAUSSTAB_RADIUS); filtersize_ = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); @@ -71,14 +71,14 @@ void GaussianXBlurOperation::updateGauss() } } -void GaussianXBlurOperation::executePixel(float output[4], int x, int y, void *data) +void GaussianXBlurOperation::execute_pixel(float output[4], int x, int y, void *data) { float ATTR_ALIGN(16) color_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f}; float multiplier_accum = 0.0f; - MemoryBuffer *inputBuffer = (MemoryBuffer *)data; - const rcti &input_rect = inputBuffer->get_rect(); - float *buffer = inputBuffer->getBuffer(); - int bufferwidth = inputBuffer->getWidth(); + MemoryBuffer *input_buffer = (MemoryBuffer *)data; + const rcti &input_rect = input_buffer->get_rect(); + float *buffer = input_buffer->get_buffer(); + int bufferwidth = input_buffer->get_width(); int bufferstartx = input_rect.xmin; int bufferstarty = input_rect.ymin; @@ -86,8 +86,8 @@ void GaussianXBlurOperation::executePixel(float output[4], int x, int y, void *d int xmax = min_ii(x + filtersize_ + 1, input_rect.xmax); int ymin = max_ii(y, input_rect.ymin); - int step = getStep(); - int offsetadd = getOffsetAdd(); + int step = get_step(); + int offsetadd = get_offset_add(); int bufferindex = ((xmin - bufferstartx) * 4) + ((ymin - bufferstarty) * 4 * bufferwidth); #ifdef BLI_HAVE_SSE2 @@ -111,41 +111,45 @@ void GaussianXBlurOperation::executePixel(float output[4], int x, int y, void *d mul_v4_v4fl(output, color_accum, 1.0f / multiplier_accum); } -void GaussianXBlurOperation::executeOpenCL(OpenCLDevice *device, - MemoryBuffer *outputMemoryBuffer, - cl_mem clOutputBuffer, - MemoryBuffer **inputMemoryBuffers, - std::list<cl_mem> *clMemToCleanUp, - std::list<cl_kernel> * /*clKernelsToCleanUp*/) +void GaussianXBlurOperation::execute_opencl(OpenCLDevice *device, + MemoryBuffer *output_memory_buffer, + cl_mem cl_output_buffer, + MemoryBuffer **input_memory_buffers, + std::list<cl_mem> *cl_mem_to_clean_up, + std::list<cl_kernel> * /*cl_kernels_to_clean_up*/) { - cl_kernel gaussianXBlurOperationKernel = device->COM_clCreateKernel( - "gaussianXBlurOperationKernel", nullptr); + cl_kernel gaussian_xblur_operation_kernel = device->COM_cl_create_kernel( + "gaussian_xblur_operation_kernel", nullptr); cl_int filter_size = filtersize_; - cl_mem gausstab = clCreateBuffer(device->getContext(), + cl_mem gausstab = clCreateBuffer(device->get_context(), CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR, sizeof(float) * (filtersize_ * 2 + 1), gausstab_, nullptr); - device->COM_clAttachMemoryBufferToKernelParameter( - gaussianXBlurOperationKernel, 0, 1, clMemToCleanUp, inputMemoryBuffers, inputProgram_); - device->COM_clAttachOutputMemoryBufferToKernelParameter( - gaussianXBlurOperationKernel, 2, clOutputBuffer); - device->COM_clAttachMemoryBufferOffsetToKernelParameter( - gaussianXBlurOperationKernel, 3, outputMemoryBuffer); - clSetKernelArg(gaussianXBlurOperationKernel, 4, sizeof(cl_int), &filter_size); - device->COM_clAttachSizeToKernelParameter(gaussianXBlurOperationKernel, 5, this); - clSetKernelArg(gaussianXBlurOperationKernel, 6, sizeof(cl_mem), &gausstab); - - device->COM_clEnqueueRange(gaussianXBlurOperationKernel, outputMemoryBuffer, 7, this); + device->COM_cl_attach_memory_buffer_to_kernel_parameter(gaussian_xblur_operation_kernel, + 0, + 1, + cl_mem_to_clean_up, + input_memory_buffers, + input_program_); + device->COM_cl_attach_output_memory_buffer_to_kernel_parameter( + gaussian_xblur_operation_kernel, 2, cl_output_buffer); + device->COM_cl_attach_memory_buffer_offset_to_kernel_parameter( + gaussian_xblur_operation_kernel, 3, output_memory_buffer); + clSetKernelArg(gaussian_xblur_operation_kernel, 4, sizeof(cl_int), &filter_size); + device->COM_cl_attach_size_to_kernel_parameter(gaussian_xblur_operation_kernel, 5, this); + clSetKernelArg(gaussian_xblur_operation_kernel, 6, sizeof(cl_mem), &gausstab); + + device->COM_cl_enqueue_range(gaussian_xblur_operation_kernel, output_memory_buffer, 7, this); clReleaseMemObject(gausstab); } -void GaussianXBlurOperation::deinitExecution() +void GaussianXBlurOperation::deinit_execution() { - GaussianBlurBaseOperation::deinitExecution(); + GaussianBlurBaseOperation::deinit_execution(); if (gausstab_) { MEM_freeN(gausstab_); @@ -158,40 +162,39 @@ void GaussianXBlurOperation::deinitExecution() } #endif - deinitMutex(); + deinit_mutex(); } -bool GaussianXBlurOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool GaussianXBlurOperation::determine_depending_area_of_interest( + rcti *input, ReadBufferOperation *read_operation, rcti *output) { - rcti newInput; + rcti new_input; if (!sizeavailable_) { - rcti sizeInput; - sizeInput.xmin = 0; - sizeInput.ymin = 0; - sizeInput.xmax = 5; - sizeInput.ymax = 5; - NodeOperation *operation = this->getInputOperation(1); - if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) { + rcti size_input; + size_input.xmin = 0; + size_input.ymin = 0; + size_input.xmax = 5; + size_input.ymax = 5; + NodeOperation *operation = this->get_input_operation(1); + if (operation->determine_depending_area_of_interest(&size_input, read_operation, output)) { return true; } } { if (sizeavailable_ && gausstab_ != nullptr) { - newInput.xmax = input->xmax + filtersize_ + 1; - newInput.xmin = input->xmin - filtersize_ - 1; - newInput.ymax = input->ymax; - newInput.ymin = input->ymin; + new_input.xmax = input->xmax + filtersize_ + 1; + new_input.xmin = input->xmin - filtersize_ - 1; + new_input.ymax = input->ymax; + new_input.ymin = input->ymin; } else { - newInput.xmax = this->getWidth(); - newInput.xmin = 0; - newInput.ymax = this->getHeight(); - newInput.ymin = 0; + new_input.xmax = this->get_width(); + new_input.xmin = 0; + new_input.ymax = this->get_height(); + new_input.ymin = 0; } - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } } diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.h b/source/blender/compositor/operations/COM_GaussianXBlurOperation.h index 1bb77031056..b9bbe1df900 100644 --- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.h @@ -25,7 +25,7 @@ namespace blender::compositor { /* TODO(manzanilla): everything to be removed with tiled implementation except the constructor. */ class GaussianXBlurOperation : public GaussianBlurBaseOperation { private: - void updateGauss(); + void update_gauss(); public: GaussianXBlurOperation(); @@ -33,31 +33,31 @@ class GaussianXBlurOperation : public GaussianBlurBaseOperation { /** * \brief The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(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) override; + void execute_opencl(OpenCLDevice *device, + MemoryBuffer *output_memory_buffer, + cl_mem cl_output_buffer, + MemoryBuffer **input_memory_buffers, + std::list<cl_mem> *cl_mem_to_clean_up, + std::list<cl_kernel> *cl_kernels_to_clean_up) override; /** * \brief initialize the execution */ - void initExecution() override; + void init_execution() override; /** * \brief Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void *initializeTileData(rcti *rect) override; - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + void *initialize_tile_data(rcti *rect) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; - void checkOpenCL() + void check_opencl() { flags.open_cl = (data_.sizex >= 128); } diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cc b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cc index 50edc0bea29..639536ebcc1 100644 --- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cc +++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cc @@ -25,22 +25,22 @@ GaussianYBlurOperation::GaussianYBlurOperation() : GaussianBlurBaseOperation(eDi { } -void *GaussianYBlurOperation::initializeTileData(rcti * /*rect*/) +void *GaussianYBlurOperation::initialize_tile_data(rcti * /*rect*/) { - lockMutex(); + lock_mutex(); if (!sizeavailable_) { - updateGauss(); + update_gauss(); } - void *buffer = getInputOperation(0)->initializeTileData(nullptr); - unlockMutex(); + void *buffer = get_input_operation(0)->initialize_tile_data(nullptr); + unlock_mutex(); return buffer; } -void GaussianYBlurOperation::initExecution() +void GaussianYBlurOperation::init_execution() { - GaussianBlurBaseOperation::initExecution(); + GaussianBlurBaseOperation::init_execution(); - initMutex(); + init_mutex(); if (sizeavailable_ && execution_model_ == eExecutionModel::Tiled) { float rad = max_ff(size_ * data_.sizey, 0.0f); @@ -53,10 +53,10 @@ void GaussianYBlurOperation::initExecution() } } -void GaussianYBlurOperation::updateGauss() +void GaussianYBlurOperation::update_gauss() { if (gausstab_ == nullptr) { - updateSize(); + update_size(); float rad = max_ff(size_ * data_.sizey, 0.0f); rad = min_ff(rad, MAX_GAUSSTAB_RADIUS); filtersize_ = min_ii(ceil(rad), MAX_GAUSSTAB_RADIUS); @@ -68,14 +68,14 @@ void GaussianYBlurOperation::updateGauss() } } -void GaussianYBlurOperation::executePixel(float output[4], int x, int y, void *data) +void GaussianYBlurOperation::execute_pixel(float output[4], int x, int y, void *data) { float ATTR_ALIGN(16) color_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f}; float multiplier_accum = 0.0f; - MemoryBuffer *inputBuffer = (MemoryBuffer *)data; - const rcti &input_rect = inputBuffer->get_rect(); - float *buffer = inputBuffer->getBuffer(); - int bufferwidth = inputBuffer->getWidth(); + MemoryBuffer *input_buffer = (MemoryBuffer *)data; + const rcti &input_rect = input_buffer->get_rect(); + float *buffer = input_buffer->get_buffer(); + int bufferwidth = input_buffer->get_width(); int bufferstartx = input_rect.xmin; int bufferstarty = input_rect.ymin; @@ -84,14 +84,14 @@ void GaussianYBlurOperation::executePixel(float output[4], int x, int y, void *d int ymax = min_ii(y + filtersize_ + 1, input_rect.ymax); int index; - int step = getStep(); - const int bufferIndexx = ((xmin - bufferstartx) * 4); + int step = get_step(); + const int buffer_indexx = ((xmin - bufferstartx) * 4); #ifdef BLI_HAVE_SSE2 __m128 accum_r = _mm_load_ps(color_accum); for (int ny = ymin; ny < ymax; ny += step) { index = (ny - y) + filtersize_; - int bufferindex = bufferIndexx + ((ny - bufferstarty) * 4 * bufferwidth); + int bufferindex = buffer_indexx + ((ny - bufferstarty) * 4 * bufferwidth); const float multiplier = gausstab_[index]; __m128 reg_a = _mm_load_ps(&buffer[bufferindex]); reg_a = _mm_mul_ps(reg_a, gausstab_sse_[index]); @@ -102,7 +102,7 @@ void GaussianYBlurOperation::executePixel(float output[4], int x, int y, void *d #else for (int ny = ymin; ny < ymax; ny += step) { index = (ny - y) + filtersize_; - int bufferindex = bufferIndexx + ((ny - bufferstarty) * 4 * bufferwidth); + int bufferindex = buffer_indexx + ((ny - bufferstarty) * 4 * bufferwidth); const float multiplier = gausstab_[index]; madd_v4_v4fl(color_accum, &buffer[bufferindex], multiplier); multiplier_accum += multiplier; @@ -111,41 +111,45 @@ void GaussianYBlurOperation::executePixel(float output[4], int x, int y, void *d mul_v4_v4fl(output, color_accum, 1.0f / multiplier_accum); } -void GaussianYBlurOperation::executeOpenCL(OpenCLDevice *device, - MemoryBuffer *outputMemoryBuffer, - cl_mem clOutputBuffer, - MemoryBuffer **inputMemoryBuffers, - std::list<cl_mem> *clMemToCleanUp, - std::list<cl_kernel> * /*clKernelsToCleanUp*/) +void GaussianYBlurOperation::execute_opencl(OpenCLDevice *device, + MemoryBuffer *output_memory_buffer, + cl_mem cl_output_buffer, + MemoryBuffer **input_memory_buffers, + std::list<cl_mem> *cl_mem_to_clean_up, + std::list<cl_kernel> * /*cl_kernels_to_clean_up*/) { - cl_kernel gaussianYBlurOperationKernel = device->COM_clCreateKernel( - "gaussianYBlurOperationKernel", nullptr); + cl_kernel gaussian_yblur_operation_kernel = device->COM_cl_create_kernel( + "gaussian_yblur_operation_kernel", nullptr); cl_int filter_size = filtersize_; - cl_mem gausstab = clCreateBuffer(device->getContext(), + cl_mem gausstab = clCreateBuffer(device->get_context(), CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR, sizeof(float) * (filtersize_ * 2 + 1), gausstab_, nullptr); - device->COM_clAttachMemoryBufferToKernelParameter( - gaussianYBlurOperationKernel, 0, 1, clMemToCleanUp, inputMemoryBuffers, inputProgram_); - device->COM_clAttachOutputMemoryBufferToKernelParameter( - gaussianYBlurOperationKernel, 2, clOutputBuffer); - device->COM_clAttachMemoryBufferOffsetToKernelParameter( - gaussianYBlurOperationKernel, 3, outputMemoryBuffer); - clSetKernelArg(gaussianYBlurOperationKernel, 4, sizeof(cl_int), &filter_size); - device->COM_clAttachSizeToKernelParameter(gaussianYBlurOperationKernel, 5, this); - clSetKernelArg(gaussianYBlurOperationKernel, 6, sizeof(cl_mem), &gausstab); - - device->COM_clEnqueueRange(gaussianYBlurOperationKernel, outputMemoryBuffer, 7, this); + device->COM_cl_attach_memory_buffer_to_kernel_parameter(gaussian_yblur_operation_kernel, + 0, + 1, + cl_mem_to_clean_up, + input_memory_buffers, + input_program_); + device->COM_cl_attach_output_memory_buffer_to_kernel_parameter( + gaussian_yblur_operation_kernel, 2, cl_output_buffer); + device->COM_cl_attach_memory_buffer_offset_to_kernel_parameter( + gaussian_yblur_operation_kernel, 3, output_memory_buffer); + clSetKernelArg(gaussian_yblur_operation_kernel, 4, sizeof(cl_int), &filter_size); + device->COM_cl_attach_size_to_kernel_parameter(gaussian_yblur_operation_kernel, 5, this); + clSetKernelArg(gaussian_yblur_operation_kernel, 6, sizeof(cl_mem), &gausstab); + + device->COM_cl_enqueue_range(gaussian_yblur_operation_kernel, output_memory_buffer, 7, this); clReleaseMemObject(gausstab); } -void GaussianYBlurOperation::deinitExecution() +void GaussianYBlurOperation::deinit_execution() { - GaussianBlurBaseOperation::deinitExecution(); + GaussianBlurBaseOperation::deinit_execution(); if (gausstab_) { MEM_freeN(gausstab_); @@ -158,40 +162,39 @@ void GaussianYBlurOperation::deinitExecution() } #endif - deinitMutex(); + deinit_mutex(); } -bool GaussianYBlurOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool GaussianYBlurOperation::determine_depending_area_of_interest( + rcti *input, ReadBufferOperation *read_operation, rcti *output) { - rcti newInput; + rcti new_input; if (!sizeavailable_) { - rcti sizeInput; - sizeInput.xmin = 0; - sizeInput.ymin = 0; - sizeInput.xmax = 5; - sizeInput.ymax = 5; - NodeOperation *operation = this->getInputOperation(1); - if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) { + rcti size_input; + size_input.xmin = 0; + size_input.ymin = 0; + size_input.xmax = 5; + size_input.ymax = 5; + NodeOperation *operation = this->get_input_operation(1); + if (operation->determine_depending_area_of_interest(&size_input, read_operation, output)) { return true; } } { if (sizeavailable_ && gausstab_ != nullptr) { - newInput.xmax = input->xmax; - newInput.xmin = input->xmin; - newInput.ymax = input->ymax + filtersize_ + 1; - newInput.ymin = input->ymin - filtersize_ - 1; + new_input.xmax = input->xmax; + new_input.xmin = input->xmin; + new_input.ymax = input->ymax + filtersize_ + 1; + new_input.ymin = input->ymin - filtersize_ - 1; } else { - newInput.xmax = this->getWidth(); - newInput.xmin = 0; - newInput.ymax = this->getHeight(); - newInput.ymin = 0; + new_input.xmax = this->get_width(); + new_input.xmin = 0; + new_input.ymax = this->get_height(); + new_input.ymin = 0; } - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } } diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.h b/source/blender/compositor/operations/COM_GaussianYBlurOperation.h index 92c2d71f487..4390c9544e4 100644 --- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.h @@ -25,7 +25,7 @@ namespace blender::compositor { /* TODO(manzanilla): everything to be removed with tiled implementation except the constructor. */ class GaussianYBlurOperation : public GaussianBlurBaseOperation { private: - void updateGauss(); + void update_gauss(); public: GaussianYBlurOperation(); @@ -33,31 +33,31 @@ class GaussianYBlurOperation : public GaussianBlurBaseOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(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) override; + void execute_opencl(OpenCLDevice *device, + MemoryBuffer *output_memory_buffer, + cl_mem cl_output_buffer, + MemoryBuffer **input_memory_buffers, + std::list<cl_mem> *cl_mem_to_clean_up, + std::list<cl_kernel> *cl_kernels_to_clean_up) override; /** * \brief initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void *initializeTileData(rcti *rect) override; - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + void *initialize_tile_data(rcti *rect) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; - void checkOpenCL() + void check_opencl() { flags.open_cl = (data_.sizex >= 128); } diff --git a/source/blender/compositor/operations/COM_GlareBaseOperation.cc b/source/blender/compositor/operations/COM_GlareBaseOperation.cc index 0987f0efb31..37082f29579 100644 --- a/source/blender/compositor/operations/COM_GlareBaseOperation.cc +++ b/source/blender/compositor/operations/COM_GlareBaseOperation.cc @@ -22,52 +22,52 @@ namespace blender::compositor { GlareBaseOperation::GlareBaseOperation() { - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); settings_ = nullptr; flags.is_fullframe_operation = true; is_output_rendered_ = false; } -void GlareBaseOperation::initExecution() +void GlareBaseOperation::init_execution() { - SingleThreadedOperation::initExecution(); - inputProgram_ = getInputSocketReader(0); + SingleThreadedOperation::init_execution(); + input_program_ = get_input_socket_reader(0); } -void GlareBaseOperation::deinitExecution() +void GlareBaseOperation::deinit_execution() { - inputProgram_ = nullptr; - SingleThreadedOperation::deinitExecution(); + input_program_ = nullptr; + SingleThreadedOperation::deinit_execution(); } -MemoryBuffer *GlareBaseOperation::createMemoryBuffer(rcti *rect2) +MemoryBuffer *GlareBaseOperation::create_memory_buffer(rcti *rect2) { - MemoryBuffer *tile = (MemoryBuffer *)inputProgram_->initializeTileData(rect2); + MemoryBuffer *tile = (MemoryBuffer *)input_program_->initialize_tile_data(rect2); rcti rect; rect.xmin = 0; rect.ymin = 0; - rect.xmax = getWidth(); - rect.ymax = getHeight(); + rect.xmax = get_width(); + rect.ymax = get_height(); MemoryBuffer *result = new MemoryBuffer(DataType::Color, rect); - float *data = result->getBuffer(); - this->generateGlare(data, tile, settings_); + float *data = result->get_buffer(); + this->generate_glare(data, tile, settings_); return result; } -bool GlareBaseOperation::determineDependingAreaOfInterest(rcti * /*input*/, - ReadBufferOperation *readOperation, - rcti *output) +bool GlareBaseOperation::determine_depending_area_of_interest(rcti * /*input*/, + ReadBufferOperation *read_operation, + rcti *output) { - if (isCached()) { + if (is_cached()) { return false; } - rcti newInput; - newInput.xmax = this->getWidth(); - newInput.xmin = 0; - newInput.ymax = this->getHeight(); - newInput.ymin = 0; - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + rcti new_input; + new_input.xmax = this->get_width(); + new_input.xmin = 0; + new_input.ymax = this->get_height(); + new_input.ymin = 0; + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } void GlareBaseOperation::get_area_of_interest(const int input_idx, @@ -77,9 +77,9 @@ void GlareBaseOperation::get_area_of_interest(const int input_idx, BLI_assert(input_idx == 0); UNUSED_VARS_NDEBUG(input_idx); r_input_area.xmin = 0; - r_input_area.xmax = this->getWidth(); + r_input_area.xmax = this->get_width(); r_input_area.ymin = 0; - r_input_area.ymax = this->getHeight(); + r_input_area.ymax = this->get_height(); } void GlareBaseOperation::update_memory_buffer(MemoryBuffer *output, @@ -93,7 +93,7 @@ void GlareBaseOperation::update_memory_buffer(MemoryBuffer *output, input = input->inflate(); } - this->generateGlare(output->getBuffer(), input, settings_); + this->generate_glare(output->get_buffer(), input, settings_); is_output_rendered_ = true; if (is_input_inflated) { diff --git a/source/blender/compositor/operations/COM_GlareBaseOperation.h b/source/blender/compositor/operations/COM_GlareBaseOperation.h index a50042f1ff4..09db5efcec9 100644 --- a/source/blender/compositor/operations/COM_GlareBaseOperation.h +++ b/source/blender/compositor/operations/COM_GlareBaseOperation.h @@ -40,9 +40,9 @@ typedef float fRGB[4]; class GlareBaseOperation : public SingleThreadedOperation { private: /** - * \brief Cached reference to the inputProgram + * \brief Cached reference to the input_program */ - SocketReader *inputProgram_; + SocketReader *input_program_; /** * \brief settings of the glare node. @@ -55,20 +55,20 @@ class GlareBaseOperation : public SingleThreadedOperation { /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void setGlareSettings(NodeGlare *settings) + void set_glare_settings(NodeGlare *settings) { settings_ = settings; } - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; void get_area_of_interest(const int input_idx, const rcti &output_area, @@ -81,9 +81,9 @@ class GlareBaseOperation : public SingleThreadedOperation { protected: GlareBaseOperation(); - virtual void generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings) = 0; + virtual void generate_glare(float *data, MemoryBuffer *input_tile, NodeGlare *settings) = 0; - MemoryBuffer *createMemoryBuffer(rcti *rect) override; + MemoryBuffer *create_memory_buffer(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 2142a1b822e..fa2e2597452 100644 --- a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc +++ b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cc @@ -27,7 +27,7 @@ namespace blender::compositor { using fREAL = float; /* Returns next highest power of 2 of x, as well its log2 in L2. */ -static unsigned int nextPow2(unsigned int x, unsigned int *L2) +static unsigned int next_pow2(unsigned int x, unsigned int *L2) { unsigned int pw, x_notpow2 = x & (x - 1); *L2 = 0; @@ -262,24 +262,24 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) int x, y, ch; int xbl, ybl, nxb, nyb, xbsz, ybsz; bool in2done = false; - const unsigned int kernelWidth = in2->getWidth(); - const unsigned int kernelHeight = in2->getHeight(); - const unsigned int imageWidth = in1->getWidth(); - const unsigned int imageHeight = in1->getHeight(); - float *kernelBuffer = in2->getBuffer(); - float *imageBuffer = in1->getBuffer(); + const unsigned int kernel_width = in2->get_width(); + const unsigned int kernel_height = in2->get_height(); + const unsigned int image_width = in1->get_width(); + const unsigned int image_height = in1->get_height(); + float *kernel_buffer = in2->get_buffer(); + float *image_buffer = in1->get_buffer(); MemoryBuffer *rdst = new MemoryBuffer(DataType::Color, in1->get_rect()); - memset(rdst->getBuffer(), + memset(rdst->get_buffer(), 0, - rdst->getWidth() * rdst->getHeight() * COM_DATA_TYPE_COLOR_CHANNELS * sizeof(float)); + rdst->get_width() * rdst->get_height() * COM_DATA_TYPE_COLOR_CHANNELS * sizeof(float)); /* Convolution result width & height. */ - w2 = 2 * kernelWidth - 1; - h2 = 2 * kernelHeight - 1; + w2 = 2 * kernel_width - 1; + h2 = 2 * kernel_height - 1; /* FFT pow2 required size & log2. */ - w2 = nextPow2(w2, &log2_w); - h2 = nextPow2(h2, &log2_h); + w2 = next_pow2(w2, &log2_w); + h2 = next_pow2(h2, &log2_h); /* Allocate space. */ data1 = (fREAL *)MEM_callocN(3 * w2 * h2 * sizeof(fREAL), "convolve_fast FHT data1"); @@ -287,9 +287,9 @@ 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_DATA_TYPE_COLOR_CHANNELS]; - for (x = 0; x < kernelWidth; x++) { + for (y = 0; y < kernel_height; y++) { + colp = (fRGB *)&kernel_buffer[y * kernel_width * COM_DATA_TYPE_COLOR_CHANNELS]; + for (x = 0; x < kernel_width; x++) { add_v3_v3(wt, colp[x]); } } @@ -302,9 +302,9 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) if (wt[2] != 0.0f) { wt[2] = 1.0f / wt[2]; } - for (y = 0; y < kernelHeight; y++) { - colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_DATA_TYPE_COLOR_CHANNELS]; - for (x = 0; x < kernelWidth; x++) { + for (y = 0; y < kernel_height; y++) { + colp = (fRGB *)&kernel_buffer[y * kernel_width * COM_DATA_TYPE_COLOR_CHANNELS]; + for (x = 0; x < kernel_width; x++) { mul_v3_v3(colp[x], wt); } } @@ -313,16 +313,16 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) * only need to calc data1 once. */ /* Block add-overlap. */ - hw = kernelWidth >> 1; - hh = kernelHeight >> 1; - xbsz = (w2 + 1) - kernelWidth; - ybsz = (h2 + 1) - kernelHeight; - nxb = imageWidth / xbsz; - if (imageWidth % xbsz) { + hw = kernel_width >> 1; + hh = kernel_height >> 1; + xbsz = (w2 + 1) - kernel_width; + ybsz = (h2 + 1) - kernel_height; + nxb = image_width / xbsz; + if (image_width % xbsz) { nxb++; } - nyb = imageHeight / ybsz; - if (imageHeight % ybsz) { + nyb = image_height / ybsz; + if (image_height % ybsz) { nyb++; } for (ybl = 0; ybl < nyb; ybl++) { @@ -335,10 +335,10 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) /* Only need to calc fht data from in2 once, can re-use for every block. */ if (!in2done) { /* in2, channel ch -> data1 */ - for (y = 0; y < kernelHeight; y++) { + for (y = 0; y < kernel_height; y++) { fp = &data1ch[y * w2]; - colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_DATA_TYPE_COLOR_CHANNELS]; - for (x = 0; x < kernelWidth; x++) { + colp = (fRGB *)&kernel_buffer[y * kernel_width * COM_DATA_TYPE_COLOR_CHANNELS]; + for (x = 0; x < kernel_width; x++) { fp[x] = colp[x][ch]; } } @@ -348,14 +348,14 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) memset(data2, 0, w2 * h2 * sizeof(fREAL)); for (y = 0; y < ybsz; y++) { int yy = ybl * ybsz + y; - if (yy >= imageHeight) { + if (yy >= image_height) { continue; } fp = &data2[y * w2]; - colp = (fRGB *)&imageBuffer[yy * imageWidth * COM_DATA_TYPE_COLOR_CHANNELS]; + colp = (fRGB *)&image_buffer[yy * image_width * COM_DATA_TYPE_COLOR_CHANNELS]; for (x = 0; x < xbsz; x++) { int xx = xbl * xbsz + x; - if (xx >= imageWidth) { + if (xx >= image_width) { continue; } fp[x] = colp[xx][ch]; @@ -365,9 +365,9 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) /* Forward FHT * zero pad data start is different for each == height+1. */ if (!in2done) { - FHT2D(data1ch, log2_w, log2_h, kernelHeight + 1, 0); + FHT2D(data1ch, log2_w, log2_h, kernel_height + 1, 0); } - FHT2D(data2, log2_w, log2_h, kernelHeight + 1, 0); + FHT2D(data2, log2_w, log2_h, kernel_height + 1, 0); /* FHT2D transposed data, row/col now swapped * convolve & inverse FHT. */ @@ -378,14 +378,14 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) /* Overlap-add result. */ for (y = 0; y < (int)h2; y++) { const int yy = ybl * ybsz + y - hh; - if ((yy < 0) || (yy >= imageHeight)) { + if ((yy < 0) || (yy >= image_height)) { continue; } fp = &data2[y * w2]; - colp = (fRGB *)&rdst->getBuffer()[yy * imageWidth * COM_DATA_TYPE_COLOR_CHANNELS]; + colp = (fRGB *)&rdst->get_buffer()[yy * image_width * COM_DATA_TYPE_COLOR_CHANNELS]; for (x = 0; x < (int)w2; x++) { const int xx = xbl * xbsz + x - hw; - if ((xx < 0) || (xx >= imageWidth)) { + if ((xx < 0) || (xx >= image_width)) { continue; } colp[xx][ch] += fp[x]; @@ -399,14 +399,14 @@ static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2) MEM_freeN(data2); MEM_freeN(data1); memcpy(dst, - rdst->getBuffer(), - sizeof(float) * imageWidth * imageHeight * COM_DATA_TYPE_COLOR_CHANNELS); + rdst->get_buffer(), + sizeof(float) * image_width * image_height * COM_DATA_TYPE_COLOR_CHANNELS); delete (rdst); } -void GlareFogGlowOperation::generateGlare(float *data, - MemoryBuffer *inputTile, - NodeGlare *settings) +void GlareFogGlowOperation::generate_glare(float *data, + MemoryBuffer *input_tile, + NodeGlare *settings) { int x, y; float scale, u, v, r, w, d; @@ -417,9 +417,9 @@ void GlareFogGlowOperation::generateGlare(float *data, /* Temp. src image * make the convolution kernel. */ - rcti kernelRect; - BLI_rcti_init(&kernelRect, 0, sz, 0, sz); - ckrn = new MemoryBuffer(DataType::Color, kernelRect); + rcti kernel_rect; + BLI_rcti_init(&kernel_rect, 0, sz, 0, sz); + ckrn = new MemoryBuffer(DataType::Color, kernel_rect); scale = 0.25f * sqrtf((float)(sz * sz)); @@ -437,11 +437,11 @@ void GlareFogGlowOperation::generateGlare(float *data, * actually, Hanning window is ok, `cos^2` for some reason is slower. */ w = (0.5f + 0.5f * cosf(u * (float)M_PI)) * (0.5f + 0.5f * cosf(v * (float)M_PI)); mul_v3_fl(fcol, w); - ckrn->writePixel(x, y, fcol); + ckrn->write_pixel(x, y, fcol); } } - convolve(data, inputTile, ckrn); + convolve(data, input_tile, ckrn); delete ckrn; } diff --git a/source/blender/compositor/operations/COM_GlareFogGlowOperation.h b/source/blender/compositor/operations/COM_GlareFogGlowOperation.h index 5701f76ab13..648351fa692 100644 --- a/source/blender/compositor/operations/COM_GlareFogGlowOperation.h +++ b/source/blender/compositor/operations/COM_GlareFogGlowOperation.h @@ -31,7 +31,7 @@ class GlareFogGlowOperation : public GlareBaseOperation { } protected: - void generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings) override; + void generate_glare(float *data, MemoryBuffer *input_tile, 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 c5ecfed024c..930c723e94e 100644 --- a/source/blender/compositor/operations/COM_GlareGhostOperation.cc +++ b/source/blender/compositor/operations/COM_GlareGhostOperation.cc @@ -21,7 +21,7 @@ namespace blender::compositor { -static float smoothMask(float x, float y) +static float smooth_mask(float x, float y) { float t; x = 2.0f * x - 1.0f; @@ -33,7 +33,9 @@ static float smoothMask(float x, float y) return 0.0f; } -void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings) +void GlareGhostOperation::generate_glare(float *data, + MemoryBuffer *input_tile, + NodeGlare *settings) { const int qt = 1 << settings->quality; const float s1 = 4.0f / (float)qt, s2 = 2.0f * s1; @@ -42,8 +44,8 @@ void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, No float sc, isc, u, v, sm, s, t, ofs, scalef[64]; const float cmo = 1.0f - settings->colmod; - MemoryBuffer gbuf(*inputTile); - MemoryBuffer tbuf1(*inputTile); + MemoryBuffer gbuf(*input_tile); + MemoryBuffer tbuf1(*input_tile); bool breaked = false; @@ -51,7 +53,7 @@ void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, No if (!breaked) { FastGaussianBlurOperation::IIR_gauss(&tbuf1, s1, 1, 3); } - if (isBraked()) { + if (is_braked()) { breaked = true; } if (!breaked) { @@ -60,19 +62,19 @@ void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, No MemoryBuffer tbuf2(tbuf1); - if (isBraked()) { + if (is_braked()) { breaked = true; } if (!breaked) { FastGaussianBlurOperation::IIR_gauss(&tbuf2, s2, 0, 3); } - if (isBraked()) { + if (is_braked()) { breaked = true; } if (!breaked) { FastGaussianBlurOperation::IIR_gauss(&tbuf2, s2, 1, 3); } - if (isBraked()) { + if (is_braked()) { breaked = true; } if (!breaked) { @@ -100,59 +102,59 @@ void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, No sc = 2.13; isc = -0.97; - for (y = 0; y < gbuf.getHeight() && (!breaked); y++) { - v = ((float)y + 0.5f) / (float)gbuf.getHeight(); - for (x = 0; x < gbuf.getWidth(); x++) { - u = ((float)x + 0.5f) / (float)gbuf.getWidth(); + for (y = 0; y < gbuf.get_height() && (!breaked); y++) { + v = ((float)y + 0.5f) / (float)gbuf.get_height(); + for (x = 0; x < gbuf.get_width(); x++) { + u = ((float)x + 0.5f) / (float)gbuf.get_width(); s = (u - 0.5f) * sc + 0.5f; t = (v - 0.5f) * sc + 0.5f; - tbuf1.readBilinear(c, s * gbuf.getWidth(), t * gbuf.getHeight()); - sm = smoothMask(s, t); + tbuf1.read_bilinear(c, s * gbuf.get_width(), t * gbuf.get_height()); + sm = smooth_mask(s, t); mul_v3_fl(c, sm); s = (u - 0.5f) * isc + 0.5f; t = (v - 0.5f) * isc + 0.5f; - tbuf2.readBilinear(tc, s * gbuf.getWidth() - 0.5f, t * gbuf.getHeight() - 0.5f); - sm = smoothMask(s, t); + tbuf2.read_bilinear(tc, s * gbuf.get_width() - 0.5f, t * gbuf.get_height() - 0.5f); + sm = smooth_mask(s, t); madd_v3_v3fl(c, tc, sm); - gbuf.writePixel(x, y, c); + gbuf.write_pixel(x, y, c); } - if (isBraked()) { + if (is_braked()) { breaked = true; } } - memset(tbuf1.getBuffer(), + memset(tbuf1.get_buffer(), 0, - tbuf1.getWidth() * tbuf1.getHeight() * COM_DATA_TYPE_COLOR_CHANNELS * sizeof(float)); + tbuf1.get_width() * tbuf1.get_height() * 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(); - for (x = 0; x < gbuf.getWidth(); x++) { - u = ((float)x + 0.5f) / (float)gbuf.getWidth(); + for (y = 0; y < gbuf.get_height() && (!breaked); y++) { + v = ((float)y + 0.5f) / (float)gbuf.get_height(); + for (x = 0; x < gbuf.get_width(); x++) { + u = ((float)x + 0.5f) / (float)gbuf.get_width(); tc[0] = tc[1] = tc[2] = 0.0f; for (p = 0; p < 4; p++) { np = (n << 2) + p; s = (u - 0.5f) * scalef[np] + 0.5f; t = (v - 0.5f) * scalef[np] + 0.5f; - gbuf.readBilinear(c, s * gbuf.getWidth() - 0.5f, t * gbuf.getHeight() - 0.5f); + gbuf.read_bilinear(c, s * gbuf.get_width() - 0.5f, t * gbuf.get_height() - 0.5f); mul_v3_v3(c, cm[np]); - sm = smoothMask(s, t) * 0.25f; + sm = smooth_mask(s, t) * 0.25f; madd_v3_v3fl(tc, c, sm); } - tbuf1.addPixel(x, y, tc); + tbuf1.add_pixel(x, y, tc); } - if (isBraked()) { + if (is_braked()) { breaked = true; } } - memcpy(gbuf.getBuffer(), - tbuf1.getBuffer(), - tbuf1.getWidth() * tbuf1.getHeight() * COM_DATA_TYPE_COLOR_CHANNELS * sizeof(float)); + memcpy(gbuf.get_buffer(), + tbuf1.get_buffer(), + tbuf1.get_width() * tbuf1.get_height() * COM_DATA_TYPE_COLOR_CHANNELS * sizeof(float)); } memcpy(data, - gbuf.getBuffer(), - gbuf.getWidth() * gbuf.getHeight() * COM_DATA_TYPE_COLOR_CHANNELS * sizeof(float)); + gbuf.get_buffer(), + gbuf.get_width() * gbuf.get_height() * 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 60256d8e0ef..e84084c3f6e 100644 --- a/source/blender/compositor/operations/COM_GlareGhostOperation.h +++ b/source/blender/compositor/operations/COM_GlareGhostOperation.h @@ -31,7 +31,7 @@ class GlareGhostOperation : public GlareBaseOperation { } protected: - void generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings) override; + void generate_glare(float *data, MemoryBuffer *input_tile, 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 cc24a50a307..5d8dca055aa 100644 --- a/source/blender/compositor/operations/COM_GlareSimpleStarOperation.cc +++ b/source/blender/compositor/operations/COM_GlareSimpleStarOperation.cc @@ -20,26 +20,26 @@ namespace blender::compositor { -void GlareSimpleStarOperation::generateGlare(float *data, - MemoryBuffer *inputTile, - NodeGlare *settings) +void GlareSimpleStarOperation::generate_glare(float *data, + MemoryBuffer *input_tile, + NodeGlare *settings) { int i, x, y, ym, yp, xm, xp; float c[4] = {0, 0, 0, 0}, tc[4] = {0, 0, 0, 0}; const float f1 = 1.0f - settings->fade; const float f2 = (1.0f - f1) * 0.5f; - MemoryBuffer tbuf1(*inputTile); - MemoryBuffer tbuf2(*inputTile); + MemoryBuffer tbuf1(*input_tile); + MemoryBuffer tbuf2(*input_tile); bool breaked = false; for (i = 0; i < settings->iter && (!breaked); i++) { // // (x || x-1, y-1) to (x || x+1, y+1) // // F - for (y = 0; y < this->getHeight() && (!breaked); y++) { + for (y = 0; y < this->get_height() && (!breaked); y++) { ym = y - i; yp = y + i; - for (x = 0; x < this->getWidth(); x++) { + for (x = 0; x < this->get_width(); x++) { xm = x - i; xp = x + i; tbuf1.read(c, x, y); @@ -49,7 +49,7 @@ void GlareSimpleStarOperation::generateGlare(float *data, tbuf1.read(tc, (settings->star_45 ? xp : x), yp); madd_v3_v3fl(c, tc, f2); c[3] = 1.0f; - tbuf1.writePixel(x, y, c); + tbuf1.write_pixel(x, y, c); tbuf2.read(c, x, y); mul_v3_fl(c, f1); @@ -58,17 +58,17 @@ void GlareSimpleStarOperation::generateGlare(float *data, tbuf2.read(tc, xp, (settings->star_45 ? ym : y)); madd_v3_v3fl(c, tc, f2); c[3] = 1.0f; - tbuf2.writePixel(x, y, c); + tbuf2.write_pixel(x, y, c); } - if (isBraked()) { + if (is_braked()) { breaked = true; } } // // B - for (y = this->getHeight() - 1; y >= 0 && (!breaked); y--) { + for (y = this->get_height() - 1; y >= 0 && (!breaked); y--) { ym = y - i; yp = y + i; - for (x = this->getWidth() - 1; x >= 0; x--) { + for (x = this->get_width() - 1; x >= 0; x--) { xm = x - i; xp = x + i; tbuf1.read(c, x, y); @@ -78,7 +78,7 @@ void GlareSimpleStarOperation::generateGlare(float *data, tbuf1.read(tc, (settings->star_45 ? xp : x), yp); madd_v3_v3fl(c, tc, f2); c[3] = 1.0f; - tbuf1.writePixel(x, y, c); + tbuf1.write_pixel(x, y, c); tbuf2.read(c, x, y); mul_v3_fl(c, f1); @@ -87,16 +87,16 @@ void GlareSimpleStarOperation::generateGlare(float *data, tbuf2.read(tc, xp, (settings->star_45 ? ym : y)); madd_v3_v3fl(c, tc, f2); c[3] = 1.0f; - tbuf2.writePixel(x, y, c); + tbuf2.write_pixel(x, y, c); } - if (isBraked()) { + if (is_braked()) { breaked = true; } } } - for (i = 0; i < this->getWidth() * this->getHeight() * 4; i++) { - data[i] = tbuf1.getBuffer()[i] + tbuf2.getBuffer()[i]; + for (i = 0; i < this->get_width() * this->get_height() * 4; i++) { + data[i] = tbuf1.get_buffer()[i] + tbuf2.get_buffer()[i]; } } diff --git a/source/blender/compositor/operations/COM_GlareSimpleStarOperation.h b/source/blender/compositor/operations/COM_GlareSimpleStarOperation.h index 4a074f53e7b..be162bbda44 100644 --- a/source/blender/compositor/operations/COM_GlareSimpleStarOperation.h +++ b/source/blender/compositor/operations/COM_GlareSimpleStarOperation.h @@ -31,7 +31,7 @@ class GlareSimpleStarOperation : public GlareBaseOperation { } protected: - void generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings) override; + void generate_glare(float *data, MemoryBuffer *input_tile, 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 8ffe44d9a36..f4d9b588917 100644 --- a/source/blender/compositor/operations/COM_GlareStreaksOperation.cc +++ b/source/blender/compositor/operations/COM_GlareStreaksOperation.cc @@ -20,22 +20,22 @@ namespace blender::compositor { -void GlareStreaksOperation::generateGlare(float *data, - MemoryBuffer *inputTile, - NodeGlare *settings) +void GlareStreaksOperation::generate_glare(float *data, + MemoryBuffer *input_tile, + NodeGlare *settings) { int x, y, n; unsigned int nump = 0; float c1[4], c2[4], c3[4], c4[4]; float a, ang = DEG2RADF(360.0f) / (float)settings->streaks; - int size = inputTile->getWidth() * inputTile->getHeight(); + int size = input_tile->get_width() * input_tile->get_height(); int size4 = size * 4; bool breaked = false; - MemoryBuffer tsrc(*inputTile); - MemoryBuffer tdst(DataType::Color, inputTile->get_rect()); + MemoryBuffer tsrc(*input_tile); + MemoryBuffer tdst(DataType::Color, input_tile->get_rect()); tdst.clear(); memset(data, 0, size4 * sizeof(float)); @@ -50,9 +50,9 @@ void GlareStreaksOperation::generateGlare(float *data, /* Color-modulation amount relative to current pass. */ const float cmo = 1.0f - (float)pow((double)settings->colmod, (double)n + 1); - float *tdstcol = tdst.getBuffer(); - for (y = 0; y < tsrc.getHeight() && (!breaked); y++) { - for (x = 0; x < tsrc.getWidth(); x++, tdstcol += 4) { + float *tdstcol = tdst.get_buffer(); + for (y = 0; y < tsrc.get_height() && (!breaked); y++) { + for (x = 0; x < tsrc.get_width(); x++, tdstcol += 4) { /* First pass no offset, always same for every pass, exact copy, * otherwise results in uneven brightness, only need once. */ if (n == 0) { @@ -61,9 +61,9 @@ void GlareStreaksOperation::generateGlare(float *data, else { c1[0] = c1[1] = c1[2] = 0; } - tsrc.readBilinear(c2, x + vxp, y + vyp); - tsrc.readBilinear(c3, x + vxp * 2.0f, y + vyp * 2.0f); - tsrc.readBilinear(c4, x + vxp * 3.0f, y + vyp * 3.0f); + tsrc.read_bilinear(c2, x + vxp, y + vyp); + tsrc.read_bilinear(c3, x + vxp * 2.0f, y + vyp * 2.0f); + tsrc.read_bilinear(c4, x + vxp * 3.0f, y + vyp * 3.0f); /* Modulate color to look vaguely similar to a color spectrum. */ c2[1] *= cmo; c2[2] *= cmo; @@ -79,14 +79,14 @@ void GlareStreaksOperation::generateGlare(float *data, tdstcol[2] = 0.5f * (tdstcol[2] + c1[2] + wt * (c2[2] + wt * (c3[2] + wt * c4[2]))); tdstcol[3] = 1.0f; } - if (isBraked()) { + if (is_braked()) { breaked = true; } } - memcpy(tsrc.getBuffer(), tdst.getBuffer(), sizeof(float) * size4); + memcpy(tsrc.get_buffer(), tdst.get_buffer(), sizeof(float) * size4); } - float *sourcebuffer = tsrc.getBuffer(); + float *sourcebuffer = tsrc.get_buffer(); float factor = 1.0f / (float)(6 - settings->iter); for (int i = 0; i < size4; i += 4) { madd_v3_v3fl(&data[i], &sourcebuffer[i], factor); @@ -94,7 +94,7 @@ void GlareStreaksOperation::generateGlare(float *data, } tdst.clear(); - memcpy(tsrc.getBuffer(), inputTile->getBuffer(), sizeof(float) * size4); + memcpy(tsrc.get_buffer(), input_tile->get_buffer(), sizeof(float) * size4); nump++; } } diff --git a/source/blender/compositor/operations/COM_GlareStreaksOperation.h b/source/blender/compositor/operations/COM_GlareStreaksOperation.h index 487c910960a..bad73687afd 100644 --- a/source/blender/compositor/operations/COM_GlareStreaksOperation.h +++ b/source/blender/compositor/operations/COM_GlareStreaksOperation.h @@ -31,7 +31,7 @@ class GlareStreaksOperation : public GlareBaseOperation { } protected: - void generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings) override; + void generate_glare(float *data, MemoryBuffer *input_tile, 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 7135155cb68..0538b4e48a0 100644 --- a/source/blender/compositor/operations/COM_GlareThresholdOperation.cc +++ b/source/blender/compositor/operations/COM_GlareThresholdOperation.cc @@ -24,9 +24,9 @@ namespace blender::compositor { GlareThresholdOperation::GlareThresholdOperation() { - this->addInputSocket(DataType::Color, ResizeMode::FitAny); - this->addOutputSocket(DataType::Color); - inputProgram_ = nullptr; + this->add_input_socket(DataType::Color, ResizeMode::FitAny); + this->add_output_socket(DataType::Color); + input_program_ = nullptr; } void GlareThresholdOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) @@ -38,19 +38,19 @@ void GlareThresholdOperation::determine_canvas(const rcti &preferred_area, rcti r_area.ymax = r_area.ymin + height; } -void GlareThresholdOperation::initExecution() +void GlareThresholdOperation::init_execution() { - inputProgram_ = this->getInputSocketReader(0); + input_program_ = this->get_input_socket_reader(0); } -void GlareThresholdOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void GlareThresholdOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { const float threshold = settings_->threshold; - inputProgram_->readSampled(output, x, y, sampler); + input_program_->read_sampled(output, x, y, sampler); if (IMB_colormanagement_get_luminance(output) >= threshold) { output[0] -= threshold; output[1] -= threshold; @@ -65,9 +65,9 @@ void GlareThresholdOperation::executePixelSampled(float output[4], } } -void GlareThresholdOperation::deinitExecution() +void GlareThresholdOperation::deinit_execution() { - inputProgram_ = nullptr; + input_program_ = nullptr; } void GlareThresholdOperation::update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_GlareThresholdOperation.h b/source/blender/compositor/operations/COM_GlareThresholdOperation.h index f37020b61a8..41eac34375d 100644 --- a/source/blender/compositor/operations/COM_GlareThresholdOperation.h +++ b/source/blender/compositor/operations/COM_GlareThresholdOperation.h @@ -26,9 +26,9 @@ namespace blender::compositor { class GlareThresholdOperation : public MultiThreadedOperation { private: /** - * \brief Cached reference to the inputProgram + * \brief Cached reference to the input_program */ - SocketReader *inputProgram_; + SocketReader *input_program_; /** * \brief settings of the glare node. @@ -41,19 +41,19 @@ class GlareThresholdOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void setGlareSettings(NodeGlare *settings) + void set_glare_settings(NodeGlare *settings) { settings_ = settings; } diff --git a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cc b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cc index e2f4552c69c..d1fad29498a 100644 --- a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cc +++ b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.cc @@ -26,36 +26,36 @@ namespace blender::compositor { HueSaturationValueCorrectOperation::HueSaturationValueCorrectOperation() { - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); - inputProgram_ = nullptr; + input_program_ = nullptr; } -void HueSaturationValueCorrectOperation::initExecution() +void HueSaturationValueCorrectOperation::init_execution() { - CurveBaseOperation::initExecution(); - inputProgram_ = this->getInputSocketReader(0); + CurveBaseOperation::init_execution(); + input_program_ = this->get_input_socket_reader(0); } -void HueSaturationValueCorrectOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void HueSaturationValueCorrectOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { float hsv[4], f; - inputProgram_->readSampled(hsv, x, y, sampler); + input_program_->read_sampled(hsv, x, y, sampler); /* adjust hue, scaling returned default 0.5 up to 1 */ - f = BKE_curvemapping_evaluateF(curveMapping_, 0, hsv[0]); + f = BKE_curvemapping_evaluateF(curve_mapping_, 0, hsv[0]); hsv[0] += f - 0.5f; /* adjust saturation, scaling returned default 0.5 up to 1 */ - f = BKE_curvemapping_evaluateF(curveMapping_, 1, hsv[0]); + f = BKE_curvemapping_evaluateF(curve_mapping_, 1, hsv[0]); hsv[1] *= (f * 2.0f); /* adjust value, scaling returned default 0.5 up to 1 */ - f = BKE_curvemapping_evaluateF(curveMapping_, 2, hsv[0]); + f = BKE_curvemapping_evaluateF(curve_mapping_, 2, hsv[0]); hsv[2] *= (f * 2.0f); hsv[0] = hsv[0] - floorf(hsv[0]); /* mod 1.0 */ @@ -67,10 +67,10 @@ void HueSaturationValueCorrectOperation::executePixelSampled(float output[4], output[3] = hsv[3]; } -void HueSaturationValueCorrectOperation::deinitExecution() +void HueSaturationValueCorrectOperation::deinit_execution() { - CurveBaseOperation::deinitExecution(); - inputProgram_ = nullptr; + CurveBaseOperation::deinit_execution(); + input_program_ = nullptr; } void HueSaturationValueCorrectOperation::update_memory_buffer_partial(MemoryBuffer *output, @@ -82,15 +82,15 @@ void HueSaturationValueCorrectOperation::update_memory_buffer_partial(MemoryBuff copy_v4_v4(hsv, it.in(0)); /* Adjust hue, scaling returned default 0.5 up to 1. */ - float f = BKE_curvemapping_evaluateF(curveMapping_, 0, hsv[0]); + float f = BKE_curvemapping_evaluateF(curve_mapping_, 0, hsv[0]); hsv[0] += f - 0.5f; /* Adjust saturation, scaling returned default 0.5 up to 1. */ - f = BKE_curvemapping_evaluateF(curveMapping_, 1, hsv[0]); + f = BKE_curvemapping_evaluateF(curve_mapping_, 1, hsv[0]); hsv[1] *= (f * 2.0f); /* Adjust value, scaling returned default 0.5 up to 1. */ - f = BKE_curvemapping_evaluateF(curveMapping_, 2, hsv[0]); + f = BKE_curvemapping_evaluateF(curve_mapping_, 2, hsv[0]); hsv[2] *= (f * 2.0f); hsv[0] = hsv[0] - floorf(hsv[0]); /* Mod 1.0. */ diff --git a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h index 26792a54d26..ac64d31e494 100644 --- a/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h +++ b/source/blender/compositor/operations/COM_HueSaturationValueCorrectOperation.h @@ -26,9 +26,9 @@ namespace blender::compositor { class HueSaturationValueCorrectOperation : public CurveBaseOperation { private: /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputProgram_; + SocketReader *input_program_; public: HueSaturationValueCorrectOperation(); @@ -36,17 +36,17 @@ class HueSaturationValueCorrectOperation : public CurveBaseOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, diff --git a/source/blender/compositor/operations/COM_IDMaskOperation.cc b/source/blender/compositor/operations/COM_IDMaskOperation.cc index 677d0a8ccff..5837cb1fda9 100644 --- a/source/blender/compositor/operations/COM_IDMaskOperation.cc +++ b/source/blender/compositor/operations/COM_IDMaskOperation.cc @@ -22,25 +22,25 @@ namespace blender::compositor { IDMaskOperation::IDMaskOperation() { - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Value); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Value); this->flags.complex = true; flags.can_be_constant = true; } -void *IDMaskOperation::initializeTileData(rcti *rect) +void *IDMaskOperation::initialize_tile_data(rcti *rect) { - void *buffer = getInputOperation(0)->initializeTileData(rect); + void *buffer = get_input_operation(0)->initialize_tile_data(rect); return buffer; } -void IDMaskOperation::executePixel(float output[4], int x, int y, void *data) +void IDMaskOperation::execute_pixel(float output[4], int x, int y, void *data) { MemoryBuffer *input_buffer = (MemoryBuffer *)data; - const int buffer_width = input_buffer->getWidth(); - float *buffer = input_buffer->getBuffer(); + const int buffer_width = input_buffer->get_width(); + float *buffer = input_buffer->get_buffer(); int buffer_index = (y * buffer_width + x); - output[0] = (roundf(buffer[buffer_index]) == objectIndex_) ? 1.0f : 0.0f; + output[0] = (roundf(buffer[buffer_index]) == object_index_) ? 1.0f : 0.0f; } void IDMaskOperation::update_memory_buffer_partial(MemoryBuffer *output, @@ -54,7 +54,7 @@ void IDMaskOperation::update_memory_buffer_partial(MemoryBuffer *output, const float *in = input->get_elem(area.xmin, y); const float *row_end = out + width * output->elem_stride; while (out < row_end) { - out[0] = (roundf(in[0]) == objectIndex_) ? 1.0f : 0.0f; + out[0] = (roundf(in[0]) == object_index_) ? 1.0f : 0.0f; in += input->elem_stride; out += output->elem_stride; } diff --git a/source/blender/compositor/operations/COM_IDMaskOperation.h b/source/blender/compositor/operations/COM_IDMaskOperation.h index 333f9eeee98..3a7ceec8c49 100644 --- a/source/blender/compositor/operations/COM_IDMaskOperation.h +++ b/source/blender/compositor/operations/COM_IDMaskOperation.h @@ -24,17 +24,17 @@ namespace blender::compositor { class IDMaskOperation : public MultiThreadedOperation { private: - float objectIndex_; + float object_index_; public: IDMaskOperation(); - void *initializeTileData(rcti *rect) override; - void executePixel(float output[4], int x, int y, void *data) override; + void *initialize_tile_data(rcti *rect) override; + void execute_pixel(float output[4], int x, int y, void *data) override; - void setObjectIndex(float objectIndex) + void set_object_index(float object_index) { - objectIndex_ = objectIndex; + object_index_ = object_index; } void update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_ImageOperation.cc b/source/blender/compositor/operations/COM_ImageOperation.cc index 84c5b9654ce..e32343cfbf2 100644 --- a/source/blender/compositor/operations/COM_ImageOperation.cc +++ b/source/blender/compositor/operations/COM_ImageOperation.cc @@ -30,35 +30,35 @@ BaseImageOperation::BaseImageOperation() { image_ = nullptr; buffer_ = nullptr; - imageFloatBuffer_ = nullptr; - imageByteBuffer_ = nullptr; - imageUser_ = nullptr; + image_float_buffer_ = nullptr; + image_byte_buffer_ = nullptr; + image_user_ = nullptr; imagewidth_ = 0; imageheight_ = 0; framenumber_ = 0; - depthBuffer_ = nullptr; + image_depth_buffer_ = nullptr; depth_buffer_ = nullptr; - numberOfChannels_ = 0; + number_of_channels_ = 0; rd_ = nullptr; - viewName_ = nullptr; + view_name_ = nullptr; } ImageOperation::ImageOperation() : BaseImageOperation() { - this->addOutputSocket(DataType::Color); + this->add_output_socket(DataType::Color); } ImageAlphaOperation::ImageAlphaOperation() : BaseImageOperation() { - this->addOutputSocket(DataType::Value); + this->add_output_socket(DataType::Value); } ImageDepthOperation::ImageDepthOperation() : BaseImageOperation() { - this->addOutputSocket(DataType::Value); + this->add_output_socket(DataType::Value); } -ImBuf *BaseImageOperation::getImBuf() +ImBuf *BaseImageOperation::get_im_buf() { ImBuf *ibuf; - ImageUser iuser = *imageUser_; + ImageUser iuser = *image_user_; if (image_ == nullptr) { return nullptr; @@ -66,7 +66,7 @@ ImBuf *BaseImageOperation::getImBuf() /* local changes to the original ImageUser */ if (BKE_image_is_multilayer(image_) == false) { - iuser.multi_index = BKE_scene_multiview_view_id_get(rd_, viewName_); + iuser.multi_index = BKE_scene_multiview_view_id_get(rd_, view_name_); } ibuf = BKE_image_acquire_ibuf(image_, &iuser, nullptr); @@ -77,27 +77,27 @@ ImBuf *BaseImageOperation::getImBuf() return ibuf; } -void BaseImageOperation::initExecution() +void BaseImageOperation::init_execution() { - ImBuf *stackbuf = getImBuf(); + ImBuf *stackbuf = get_im_buf(); buffer_ = stackbuf; if (stackbuf) { - imageFloatBuffer_ = stackbuf->rect_float; - imageByteBuffer_ = stackbuf->rect; - depthBuffer_ = stackbuf->zbuf_float; + image_float_buffer_ = stackbuf->rect_float; + image_byte_buffer_ = stackbuf->rect; + image_depth_buffer_ = stackbuf->zbuf_float; if (stackbuf->zbuf_float) { depth_buffer_ = new MemoryBuffer(stackbuf->zbuf_float, 1, stackbuf->x, stackbuf->y); } imagewidth_ = stackbuf->x; imageheight_ = stackbuf->y; - numberOfChannels_ = stackbuf->channels; + number_of_channels_ = stackbuf->channels; } } -void BaseImageOperation::deinitExecution() +void BaseImageOperation::deinit_execution() { - imageFloatBuffer_ = nullptr; - imageByteBuffer_ = nullptr; + image_float_buffer_ = nullptr; + image_byte_buffer_ = nullptr; BKE_image_release_ibuf(image_, buffer_, nullptr); if (depth_buffer_) { delete depth_buffer_; @@ -107,7 +107,7 @@ void BaseImageOperation::deinitExecution() void BaseImageOperation::determine_canvas(const rcti &UNUSED(preferred_area), rcti &r_area) { - ImBuf *stackbuf = getImBuf(); + ImBuf *stackbuf = get_im_buf(); r_area = COM_AREA_NONE; @@ -118,7 +118,7 @@ void BaseImageOperation::determine_canvas(const rcti &UNUSED(preferred_area), rc BKE_image_release_ibuf(image_, stackbuf, nullptr); } -static void sampleImageAtLocation( +static void sample_image_at_location( ImBuf *ibuf, float x, float y, PixelSampler sampler, bool make_linear_rgb, float color[4]) { if (ibuf->rect_float) { @@ -154,17 +154,17 @@ static void sampleImageAtLocation( } } -void ImageOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) +void ImageOperation::execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) { int ix = x, iy = y; - if (imageFloatBuffer_ == nullptr && imageByteBuffer_ == nullptr) { + if (image_float_buffer_ == nullptr && image_byte_buffer_ == nullptr) { zero_v4(output); } else if (ix < 0 || iy < 0 || ix >= buffer_->x || iy >= buffer_->y) { zero_v4(output); } else { - sampleImageAtLocation(buffer_, x, y, sampler, true, output); + sample_image_at_location(buffer_, x, y, sampler, true, output); } } @@ -175,19 +175,19 @@ void ImageOperation::update_memory_buffer_partial(MemoryBuffer *output, output->copy_from(buffer_, area, true); } -void ImageAlphaOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ImageAlphaOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { float tempcolor[4]; - if (imageFloatBuffer_ == nullptr && imageByteBuffer_ == nullptr) { + if (image_float_buffer_ == nullptr && image_byte_buffer_ == nullptr) { output[0] = 0.0f; } else { tempcolor[3] = 1.0f; - sampleImageAtLocation(buffer_, x, y, sampler, false, tempcolor); + sample_image_at_location(buffer_, x, y, sampler, false, tempcolor); output[0] = tempcolor[3]; } } @@ -199,21 +199,21 @@ void ImageAlphaOperation::update_memory_buffer_partial(MemoryBuffer *output, output->copy_from(buffer_, area, 3, COM_DATA_TYPE_VALUE_CHANNELS, 0); } -void ImageDepthOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler /*sampler*/) +void ImageDepthOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler /*sampler*/) { - if (depthBuffer_ == nullptr) { + if (image_depth_buffer_ == nullptr) { output[0] = 0.0f; } else { - if (x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight()) { + if (x < 0 || y < 0 || x >= this->get_width() || y >= this->get_height()) { output[0] = 0.0f; } else { - int offset = y * getWidth() + x; - output[0] = depthBuffer_[offset]; + int offset = y * get_width() + x; + output[0] = image_depth_buffer_[offset]; } } } diff --git a/source/blender/compositor/operations/COM_ImageOperation.h b/source/blender/compositor/operations/COM_ImageOperation.h index 40ef9f38f79..054398604b6 100644 --- a/source/blender/compositor/operations/COM_ImageOperation.h +++ b/source/blender/compositor/operations/COM_ImageOperation.h @@ -36,19 +36,19 @@ class BaseImageOperation : public MultiThreadedOperation { protected: ImBuf *buffer_; Image *image_; - ImageUser *imageUser_; + ImageUser *image_user_; /* TODO: Remove raw buffers when removing Tiled implementation. */ - float *imageFloatBuffer_; - unsigned int *imageByteBuffer_; - float *depthBuffer_; + float *image_float_buffer_; + unsigned int *image_byte_buffer_; + float *image_depth_buffer_; MemoryBuffer *depth_buffer_; int imageheight_; int imagewidth_; int framenumber_; - int numberOfChannels_; + int number_of_channels_; const RenderData *rd_; - const char *viewName_; + const char *view_name_; BaseImageOperation(); /** @@ -56,28 +56,28 @@ class BaseImageOperation : public MultiThreadedOperation { */ void determine_canvas(const rcti &preferred_area, rcti &r_area) override; - virtual ImBuf *getImBuf(); + virtual ImBuf *get_im_buf(); public: - void initExecution() override; - void deinitExecution() override; - void setImage(Image *image) + void init_execution() override; + void deinit_execution() override; + void set_image(Image *image) { image_ = image; } - void setImageUser(ImageUser *imageuser) + void set_image_user(ImageUser *imageuser) { - imageUser_ = imageuser; + image_user_ = imageuser; } - void setRenderData(const RenderData *rd) + void set_render_data(const RenderData *rd) { rd_ = rd; } - void setViewName(const char *viewName) + void set_view_name(const char *view_name) { - viewName_ = viewName; + view_name_ = view_name; } - void setFramenumber(int framenumber) + void set_framenumber(int framenumber) { framenumber_ = framenumber; } @@ -88,7 +88,7 @@ class ImageOperation : public BaseImageOperation { * Constructor */ ImageOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, @@ -100,7 +100,7 @@ class ImageAlphaOperation : public BaseImageOperation { * Constructor */ ImageAlphaOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, @@ -112,7 +112,7 @@ class ImageDepthOperation : public BaseImageOperation { * Constructor */ ImageDepthOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, diff --git a/source/blender/compositor/operations/COM_InpaintOperation.cc b/source/blender/compositor/operations/COM_InpaintOperation.cc index 45b163c7e8b..96cd0043470 100644 --- a/source/blender/compositor/operations/COM_InpaintOperation.cc +++ b/source/blender/compositor/operations/COM_InpaintOperation.cc @@ -23,37 +23,37 @@ namespace blender::compositor { #define ASSERT_XY_RANGE(x, y) \ - BLI_assert(x >= 0 && x < this->getWidth() && y >= 0 && y < this->getHeight()) + BLI_assert(x >= 0 && x < this->get_width() && y >= 0 && y < this->get_height()) /* In-paint (simple convolve using average of known pixels). */ InpaintSimpleOperation::InpaintSimpleOperation() { - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); this->flags.complex = true; - inputImageProgram_ = nullptr; + input_image_program_ = nullptr; pixelorder_ = nullptr; manhattan_distance_ = nullptr; cached_buffer_ = nullptr; cached_buffer_ready_ = false; flags.is_fullframe_operation = true; } -void InpaintSimpleOperation::initExecution() +void InpaintSimpleOperation::init_execution() { - inputImageProgram_ = this->getInputSocketReader(0); + input_image_program_ = this->get_input_socket_reader(0); pixelorder_ = nullptr; manhattan_distance_ = nullptr; cached_buffer_ = nullptr; cached_buffer_ready_ = false; - this->initMutex(); + this->init_mutex(); } void InpaintSimpleOperation::clamp_xy(int &x, int &y) { - int width = this->getWidth(); - int height = this->getHeight(); + int width = this->get_width(); + int height = this->get_height(); if (x < 0) { x = 0; @@ -72,7 +72,7 @@ void InpaintSimpleOperation::clamp_xy(int &x, int &y) float *InpaintSimpleOperation::get_pixel(int x, int y) { - int width = this->getWidth(); + int width = this->get_width(); ASSERT_XY_RANGE(x, y); @@ -82,7 +82,7 @@ float *InpaintSimpleOperation::get_pixel(int x, int y) int InpaintSimpleOperation::mdist(int x, int y) { - int width = this->getWidth(); + int width = this->get_width(); ASSERT_XY_RANGE(x, y); @@ -91,7 +91,7 @@ int InpaintSimpleOperation::mdist(int x, int y) bool InpaintSimpleOperation::next_pixel(int &x, int &y, int &curr, int iters) { - int width = this->getWidth(); + int width = this->get_width(); if (curr >= area_size_) { return false; @@ -111,8 +111,8 @@ bool InpaintSimpleOperation::next_pixel(int &x, int &y, int &curr, int iters) void InpaintSimpleOperation::calc_manhattan_distance() { - int width = this->getWidth(); - int height = this->getHeight(); + int width = this->get_width(); + int height = this->get_height(); short *m = manhattan_distance_ = (short *)MEM_mallocN(sizeof(short) * width * height, __func__); int *offsets; @@ -213,15 +213,15 @@ void InpaintSimpleOperation::pix_step(int x, int y) } } -void *InpaintSimpleOperation::initializeTileData(rcti *rect) +void *InpaintSimpleOperation::initialize_tile_data(rcti *rect) { if (cached_buffer_ready_) { return cached_buffer_; } - lockMutex(); + lock_mutex(); if (!cached_buffer_ready_) { - MemoryBuffer *buf = (MemoryBuffer *)inputImageProgram_->initializeTileData(rect); - cached_buffer_ = (float *)MEM_dupallocN(buf->getBuffer()); + MemoryBuffer *buf = (MemoryBuffer *)input_image_program_->initialize_tile_data(rect); + cached_buffer_ = (float *)MEM_dupallocN(buf->get_buffer()); this->calc_manhattan_distance(); @@ -234,20 +234,20 @@ void *InpaintSimpleOperation::initializeTileData(rcti *rect) cached_buffer_ready_ = true; } - unlockMutex(); + unlock_mutex(); return cached_buffer_; } -void InpaintSimpleOperation::executePixel(float output[4], int x, int y, void * /*data*/) +void InpaintSimpleOperation::execute_pixel(float output[4], int x, int y, void * /*data*/) { this->clamp_xy(x, y); copy_v4_v4(output, this->get_pixel(x, y)); } -void InpaintSimpleOperation::deinitExecution() +void InpaintSimpleOperation::deinit_execution() { - inputImageProgram_ = nullptr; - this->deinitMutex(); + input_image_program_ = nullptr; + this->deinit_mutex(); if (cached_buffer_) { MEM_freeN(cached_buffer_); cached_buffer_ = nullptr; @@ -265,22 +265,21 @@ void InpaintSimpleOperation::deinitExecution() cached_buffer_ready_ = false; } -bool InpaintSimpleOperation::determineDependingAreaOfInterest(rcti * /*input*/, - ReadBufferOperation *readOperation, - rcti *output) +bool InpaintSimpleOperation::determine_depending_area_of_interest( + rcti * /*input*/, ReadBufferOperation *read_operation, rcti *output) { if (cached_buffer_ready_) { return false; } - rcti newInput; + rcti new_input; - newInput.xmax = getWidth(); - newInput.xmin = 0; - newInput.ymax = getHeight(); - newInput.ymin = 0; + new_input.xmax = get_width(); + new_input.xmin = 0; + new_input.ymax = get_height(); + new_input.ymin = 0; - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } void InpaintSimpleOperation::get_area_of_interest(const int input_idx, @@ -305,7 +304,7 @@ void InpaintSimpleOperation::update_memory_buffer(MemoryBuffer *output, delete tmp; } else { - cached_buffer_ = (float *)MEM_dupallocN(input->getBuffer()); + cached_buffer_ = (float *)MEM_dupallocN(input->get_buffer()); } this->calc_manhattan_distance(); @@ -318,8 +317,8 @@ void InpaintSimpleOperation::update_memory_buffer(MemoryBuffer *output, cached_buffer_ready_ = true; } - const int num_channels = COM_data_type_num_channels(getOutputSocket()->getDataType()); - MemoryBuffer buf(cached_buffer_, num_channels, input->getWidth(), input->getHeight()); + const int num_channels = COM_data_type_num_channels(get_output_socket()->get_data_type()); + MemoryBuffer buf(cached_buffer_, num_channels, input->get_width(), input->get_height()); output->copy_from(&buf, area); } diff --git a/source/blender/compositor/operations/COM_InpaintOperation.h b/source/blender/compositor/operations/COM_InpaintOperation.h index 4187099f346..b0d44e22b85 100644 --- a/source/blender/compositor/operations/COM_InpaintOperation.h +++ b/source/blender/compositor/operations/COM_InpaintOperation.h @@ -25,9 +25,9 @@ namespace blender::compositor { class InpaintSimpleOperation : public NodeOperation { protected: /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputImageProgram_; + SocketReader *input_image_program_; int iterations_; @@ -44,27 +44,27 @@ class InpaintSimpleOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; - void *initializeTileData(rcti *rect) override; + void *initialize_tile_data(rcti *rect) override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void setIterations(int iterations) + void set_iterations(int iterations) { iterations_ = iterations; } - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; void get_area_of_interest(const int input_idx, const rcti &output_area, diff --git a/source/blender/compositor/operations/COM_InvertOperation.cc b/source/blender/compositor/operations/COM_InvertOperation.cc index ba36dd35e47..cbc15c95f46 100644 --- a/source/blender/compositor/operations/COM_InvertOperation.cc +++ b/source/blender/compositor/operations/COM_InvertOperation.cc @@ -22,53 +22,56 @@ namespace blender::compositor { InvertOperation::InvertOperation() { - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); - inputValueProgram_ = nullptr; - inputColorProgram_ = nullptr; + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); + input_value_program_ = nullptr; + input_color_program_ = nullptr; color_ = true; alpha_ = false; set_canvas_input_index(1); this->flags.can_be_constant = true; } -void InvertOperation::initExecution() +void InvertOperation::init_execution() { - inputValueProgram_ = this->getInputSocketReader(0); - inputColorProgram_ = this->getInputSocketReader(1); + input_value_program_ = this->get_input_socket_reader(0); + input_color_program_ = this->get_input_socket_reader(1); } -void InvertOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) +void InvertOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue[4]; - float inputColor[4]; - inputValueProgram_->readSampled(inputValue, x, y, sampler); - inputColorProgram_->readSampled(inputColor, x, y, sampler); + float input_value[4]; + float input_color[4]; + input_value_program_->read_sampled(input_value, x, y, sampler); + input_color_program_->read_sampled(input_color, x, y, sampler); - const float value = inputValue[0]; - const float invertedValue = 1.0f - value; + const float value = input_value[0]; + const float inverted_value = 1.0f - value; if (color_) { - output[0] = (1.0f - inputColor[0]) * value + inputColor[0] * invertedValue; - output[1] = (1.0f - inputColor[1]) * value + inputColor[1] * invertedValue; - output[2] = (1.0f - inputColor[2]) * value + inputColor[2] * invertedValue; + output[0] = (1.0f - input_color[0]) * value + input_color[0] * inverted_value; + output[1] = (1.0f - input_color[1]) * value + input_color[1] * inverted_value; + output[2] = (1.0f - input_color[2]) * value + input_color[2] * inverted_value; } else { - copy_v3_v3(output, inputColor); + copy_v3_v3(output, input_color); } if (alpha_) { - output[3] = (1.0f - inputColor[3]) * value + inputColor[3] * invertedValue; + output[3] = (1.0f - input_color[3]) * value + input_color[3] * inverted_value; } else { - output[3] = inputColor[3]; + output[3] = input_color[3]; } } -void InvertOperation::deinitExecution() +void InvertOperation::deinit_execution() { - inputValueProgram_ = nullptr; - inputColorProgram_ = nullptr; + input_value_program_ = nullptr; + input_color_program_ = nullptr; } void InvertOperation::update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_InvertOperation.h b/source/blender/compositor/operations/COM_InvertOperation.h index 7db0394ad7a..19abca968c0 100644 --- a/source/blender/compositor/operations/COM_InvertOperation.h +++ b/source/blender/compositor/operations/COM_InvertOperation.h @@ -25,10 +25,10 @@ namespace blender::compositor { class InvertOperation : public MultiThreadedOperation { private: /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputValueProgram_; - SocketReader *inputColorProgram_; + SocketReader *input_value_program_; + SocketReader *input_color_program_; bool alpha_; bool color_; @@ -39,23 +39,23 @@ class InvertOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void setColor(bool color) + void set_color(bool color) { color_ = color; } - void setAlpha(bool alpha) + void set_alpha(bool alpha) { alpha_ = alpha; } diff --git a/source/blender/compositor/operations/COM_KeyingBlurOperation.cc b/source/blender/compositor/operations/COM_KeyingBlurOperation.cc index fcf304de174..bb82e74f92a 100644 --- a/source/blender/compositor/operations/COM_KeyingBlurOperation.cc +++ b/source/blender/compositor/operations/COM_KeyingBlurOperation.cc @@ -22,8 +22,8 @@ namespace blender::compositor { KeyingBlurOperation::KeyingBlurOperation() { - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Value); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Value); size_ = 0; axis_ = BLUR_AXIS_X; @@ -31,34 +31,34 @@ KeyingBlurOperation::KeyingBlurOperation() this->flags.complex = true; } -void *KeyingBlurOperation::initializeTileData(rcti *rect) +void *KeyingBlurOperation::initialize_tile_data(rcti *rect) { - void *buffer = getInputOperation(0)->initializeTileData(rect); + void *buffer = get_input_operation(0)->initialize_tile_data(rect); return buffer; } -void KeyingBlurOperation::executePixel(float output[4], int x, int y, void *data) +void KeyingBlurOperation::execute_pixel(float output[4], int x, int y, void *data) { - MemoryBuffer *inputBuffer = (MemoryBuffer *)data; - const int bufferWidth = inputBuffer->getWidth(); - float *buffer = inputBuffer->getBuffer(); + MemoryBuffer *input_buffer = (MemoryBuffer *)data; + const int buffer_width = input_buffer->get_width(); + float *buffer = input_buffer->get_buffer(); int count = 0; float average = 0.0f; if (axis_ == 0) { - const int start = MAX2(0, x - size_ + 1), end = MIN2(bufferWidth, x + size_); + const int start = MAX2(0, x - size_ + 1), end = MIN2(buffer_width, x + size_); for (int cx = start; cx < end; cx++) { - int bufferIndex = (y * bufferWidth + cx); - average += buffer[bufferIndex]; + int buffer_index = (y * buffer_width + cx); + average += buffer[buffer_index]; count++; } } else { - const int start = MAX2(0, y - size_ + 1), end = MIN2(inputBuffer->getHeight(), y + size_); + const int start = MAX2(0, y - size_ + 1), end = MIN2(input_buffer->get_height(), y + size_); for (int cy = start; cy < end; cy++) { - int bufferIndex = (cy * bufferWidth + x); - average += buffer[bufferIndex]; + int buffer_index = (cy * buffer_width + x); + average += buffer[buffer_index]; count++; } } @@ -68,26 +68,26 @@ void KeyingBlurOperation::executePixel(float output[4], int x, int y, void *data output[0] = average; } -bool KeyingBlurOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool KeyingBlurOperation::determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) { - rcti newInput; + rcti new_input; if (axis_ == BLUR_AXIS_X) { - newInput.xmin = input->xmin - size_; - newInput.ymin = input->ymin; - newInput.xmax = input->xmax + size_; - newInput.ymax = input->ymax; + new_input.xmin = input->xmin - size_; + new_input.ymin = input->ymin; + new_input.xmax = input->xmax + size_; + new_input.ymax = input->ymax; } else { - newInput.xmin = input->xmin; - newInput.ymin = input->ymin - size_; - newInput.xmax = input->xmax; - newInput.ymax = input->ymax + size_; + new_input.xmin = input->xmin; + new_input.ymin = input->ymin - size_; + new_input.xmax = input->xmax; + new_input.ymax = input->ymax + size_; } - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } void KeyingBlurOperation::get_area_of_interest(const int UNUSED(input_idx), @@ -126,12 +126,12 @@ void KeyingBlurOperation::update_memory_buffer_partial(MemoryBuffer *output, switch (axis_) { case BLUR_AXIS_X: get_current_coord = [&] { return it.x; }; - coord_max = this->getWidth(); + coord_max = this->get_width(); elem_stride = input->elem_stride; break; case BLUR_AXIS_Y: get_current_coord = [&] { return it.y; }; - coord_max = this->getHeight(); + coord_max = this->get_height(); elem_stride = input->row_stride; break; } diff --git a/source/blender/compositor/operations/COM_KeyingBlurOperation.h b/source/blender/compositor/operations/COM_KeyingBlurOperation.h index 56fa0f84880..11fde5f5436 100644 --- a/source/blender/compositor/operations/COM_KeyingBlurOperation.h +++ b/source/blender/compositor/operations/COM_KeyingBlurOperation.h @@ -38,22 +38,22 @@ class KeyingBlurOperation : public MultiThreadedOperation { KeyingBlurOperation(); - void setSize(int value) + void set_size(int value) { size_ = value; } - void setAxis(int value) + void set_axis(int value) { axis_ = value; } - void *initializeTileData(rcti *rect) override; + void *initialize_tile_data(rcti *rect) override; - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; void get_area_of_interest(const int input_idx, const rcti &output_area, diff --git a/source/blender/compositor/operations/COM_KeyingClipOperation.cc b/source/blender/compositor/operations/COM_KeyingClipOperation.cc index e6097dd71a6..03e3f0611c0 100644 --- a/source/blender/compositor/operations/COM_KeyingClipOperation.cc +++ b/source/blender/compositor/operations/COM_KeyingClipOperation.cc @@ -22,47 +22,47 @@ namespace blender::compositor { KeyingClipOperation::KeyingClipOperation() { - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Value); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Value); - kernelRadius_ = 3; - kernelTolerance_ = 0.1f; + kernel_radius_ = 3; + kernel_tolerance_ = 0.1f; - clipBlack_ = 0.0f; - clipWhite_ = 1.0f; + clip_black_ = 0.0f; + clip_white_ = 1.0f; - isEdgeMatte_ = false; + is_edge_matte_ = false; this->flags.complex = true; } -void *KeyingClipOperation::initializeTileData(rcti *rect) +void *KeyingClipOperation::initialize_tile_data(rcti *rect) { - void *buffer = getInputOperation(0)->initializeTileData(rect); + void *buffer = get_input_operation(0)->initialize_tile_data(rect); return buffer; } -void KeyingClipOperation::executePixel(float output[4], int x, int y, void *data) +void KeyingClipOperation::execute_pixel(float output[4], int x, int y, void *data) { - const int delta = kernelRadius_; - const float tolerance = kernelTolerance_; + const int delta = kernel_radius_; + const float tolerance = kernel_tolerance_; - MemoryBuffer *inputBuffer = (MemoryBuffer *)data; - float *buffer = inputBuffer->getBuffer(); + MemoryBuffer *input_buffer = (MemoryBuffer *)data; + float *buffer = input_buffer->get_buffer(); - int bufferWidth = inputBuffer->getWidth(); - int bufferHeight = inputBuffer->getHeight(); + int buffer_width = input_buffer->get_width(); + int buffer_height = input_buffer->get_height(); - float value = buffer[(y * bufferWidth + x)]; + float value = buffer[(y * buffer_width + x)]; bool ok = false; int start_x = max_ff(0, x - delta + 1), start_y = max_ff(0, y - delta + 1), - end_x = min_ff(x + delta - 1, bufferWidth - 1), - end_y = min_ff(y + delta - 1, bufferHeight - 1); + end_x = min_ff(x + delta - 1, buffer_width - 1), + end_y = min_ff(y + delta - 1, buffer_height - 1); - int count = 0, totalCount = (end_x - start_x + 1) * (end_y - start_y + 1) - 1; - int thresholdCount = ceil((float)totalCount * 0.9f); + int count = 0, total_count = (end_x - start_x + 1) * (end_y - start_y + 1) - 1; + int threshold_count = ceil((float)total_count * 0.9f); if (delta == 0) { ok = true; @@ -74,19 +74,19 @@ void KeyingClipOperation::executePixel(float output[4], int x, int y, void *data continue; } - int bufferIndex = (cy * bufferWidth + cx); - float currentValue = buffer[bufferIndex]; + int buffer_index = (cy * buffer_width + cx); + float current_value = buffer[buffer_index]; - if (fabsf(currentValue - value) < tolerance) { + if (fabsf(current_value - value) < tolerance) { count++; - if (count >= thresholdCount) { + if (count >= threshold_count) { ok = true; } } } } - if (isEdgeMatte_) { + if (is_edge_matte_) { if (ok) { output[0] = 0.0f; } @@ -98,31 +98,31 @@ void KeyingClipOperation::executePixel(float output[4], int x, int y, void *data output[0] = value; if (ok) { - if (output[0] < clipBlack_) { + if (output[0] < clip_black_) { output[0] = 0.0f; } - else if (output[0] >= clipWhite_) { + else if (output[0] >= clip_white_) { output[0] = 1.0f; } else { - output[0] = (output[0] - clipBlack_) / (clipWhite_ - clipBlack_); + output[0] = (output[0] - clip_black_) / (clip_white_ - clip_black_); } } } } -bool KeyingClipOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool KeyingClipOperation::determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) { - rcti newInput; + rcti new_input; - newInput.xmin = input->xmin - kernelRadius_; - newInput.ymin = input->ymin - kernelRadius_; - newInput.xmax = input->xmax + kernelRadius_; - newInput.ymax = input->ymax + kernelRadius_; + new_input.xmin = input->xmin - kernel_radius_; + new_input.ymin = input->ymin - kernel_radius_; + new_input.xmax = input->xmax + kernel_radius_; + new_input.ymax = input->ymax + kernel_radius_; - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } void KeyingClipOperation::get_area_of_interest(const int input_idx, @@ -131,10 +131,10 @@ void KeyingClipOperation::get_area_of_interest(const int input_idx, { BLI_assert(input_idx == 0); UNUSED_VARS_NDEBUG(input_idx); - r_input_area.xmin = output_area.xmin - kernelRadius_; - r_input_area.xmax = output_area.xmax + kernelRadius_; - r_input_area.ymin = output_area.ymin - kernelRadius_; - r_input_area.ymax = output_area.ymax + kernelRadius_; + r_input_area.xmin = output_area.xmin - kernel_radius_; + r_input_area.xmax = output_area.xmax + kernel_radius_; + r_input_area.ymin = output_area.ymin - kernel_radius_; + r_input_area.ymax = output_area.ymax + kernel_radius_; } void KeyingClipOperation::update_memory_buffer_partial(MemoryBuffer *output, @@ -144,10 +144,10 @@ void KeyingClipOperation::update_memory_buffer_partial(MemoryBuffer *output, const MemoryBuffer *input = inputs[0]; BuffersIterator<float> it = output->iterate_with(inputs, area); - const int delta = kernelRadius_; - const float tolerance = kernelTolerance_; - const int width = this->getWidth(); - const int height = this->getHeight(); + const int delta = kernel_radius_; + const float tolerance = kernel_tolerance_; + const int width = this->get_width(); + const int height = this->get_height(); const int row_stride = input->row_stride; const int elem_stride = input->elem_stride; for (; !it.is_end(); ++it) { @@ -190,21 +190,21 @@ void KeyingClipOperation::update_memory_buffer_partial(MemoryBuffer *output, } } - if (isEdgeMatte_) { + if (is_edge_matte_) { *it.out = ok ? 0.0f : 1.0f; } else { if (!ok) { *it.out = value; } - else if (value < clipBlack_) { + else if (value < clip_black_) { *it.out = 0.0f; } - else if (value >= clipWhite_) { + else if (value >= clip_white_) { *it.out = 1.0f; } else { - *it.out = (value - clipBlack_) / (clipWhite_ - clipBlack_); + *it.out = (value - clip_black_) / (clip_white_ - clip_black_); } } } diff --git a/source/blender/compositor/operations/COM_KeyingClipOperation.h b/source/blender/compositor/operations/COM_KeyingClipOperation.h index 422d79597ce..3bdc7281683 100644 --- a/source/blender/compositor/operations/COM_KeyingClipOperation.h +++ b/source/blender/compositor/operations/COM_KeyingClipOperation.h @@ -27,47 +27,47 @@ namespace blender::compositor { */ class KeyingClipOperation : public MultiThreadedOperation { protected: - float clipBlack_; - float clipWhite_; + float clip_black_; + float clip_white_; - int kernelRadius_; - float kernelTolerance_; + int kernel_radius_; + float kernel_tolerance_; - bool isEdgeMatte_; + bool is_edge_matte_; public: KeyingClipOperation(); - void setClipBlack(float value) + void set_clip_black(float value) { - clipBlack_ = value; + clip_black_ = value; } - void setClipWhite(float value) + void set_clip_white(float value) { - clipWhite_ = value; + clip_white_ = value; } - void setKernelRadius(int value) + void set_kernel_radius(int value) { - kernelRadius_ = value; + kernel_radius_ = value; } - void setKernelTolerance(float value) + void set_kernel_tolerance(float value) { - kernelTolerance_ = value; + kernel_tolerance_ = value; } - void setIsEdgeMatte(bool value) + void set_is_edge_matte(bool value) { - isEdgeMatte_ = value; + is_edge_matte_ = value; } - void *initializeTileData(rcti *rect) override; + void *initialize_tile_data(rcti *rect) override; - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; void get_area_of_interest(const int input_idx, const rcti &output_area, diff --git a/source/blender/compositor/operations/COM_KeyingDespillOperation.cc b/source/blender/compositor/operations/COM_KeyingDespillOperation.cc index 8b090d5dc38..f819a39e9e0 100644 --- a/source/blender/compositor/operations/COM_KeyingDespillOperation.cc +++ b/source/blender/compositor/operations/COM_KeyingDespillOperation.cc @@ -22,42 +22,42 @@ namespace blender::compositor { KeyingDespillOperation::KeyingDespillOperation() { - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); - despillFactor_ = 0.5f; - colorBalance_ = 0.5f; + despill_factor_ = 0.5f; + color_balance_ = 0.5f; - pixelReader_ = nullptr; - screenReader_ = nullptr; + pixel_reader_ = nullptr; + screen_reader_ = nullptr; flags.can_be_constant = true; } -void KeyingDespillOperation::initExecution() +void KeyingDespillOperation::init_execution() { - pixelReader_ = this->getInputSocketReader(0); - screenReader_ = this->getInputSocketReader(1); + pixel_reader_ = this->get_input_socket_reader(0); + screen_reader_ = this->get_input_socket_reader(1); } -void KeyingDespillOperation::deinitExecution() +void KeyingDespillOperation::deinit_execution() { - pixelReader_ = nullptr; - screenReader_ = nullptr; + pixel_reader_ = nullptr; + screen_reader_ = nullptr; } -void KeyingDespillOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void KeyingDespillOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float pixelColor[4]; - float screenColor[4]; + float pixel_color[4]; + float screen_color[4]; - pixelReader_->readSampled(pixelColor, x, y, sampler); - screenReader_->readSampled(screenColor, x, y, sampler); + pixel_reader_->read_sampled(pixel_color, x, y, sampler); + screen_reader_->read_sampled(screen_color, x, y, sampler); - const int screen_primary_channel = max_axis_v3(screenColor); + const int screen_primary_channel = max_axis_v3(screen_color); const int other_1 = (screen_primary_channel + 1) % 3; const int other_2 = (screen_primary_channel + 2) % 3; @@ -66,15 +66,15 @@ void KeyingDespillOperation::executePixelSampled(float output[4], float average_value, amount; - average_value = colorBalance_ * pixelColor[min_channel] + - (1.0f - colorBalance_) * pixelColor[max_channel]; - amount = (pixelColor[screen_primary_channel] - average_value); + average_value = color_balance_ * pixel_color[min_channel] + + (1.0f - color_balance_) * pixel_color[max_channel]; + amount = (pixel_color[screen_primary_channel] - average_value); - copy_v4_v4(output, pixelColor); + copy_v4_v4(output, pixel_color); - const float amount_despill = despillFactor_ * amount; + const float amount_despill = despill_factor_ * amount; if (amount_despill > 0.0f) { - output[screen_primary_channel] = pixelColor[screen_primary_channel] - amount_despill; + output[screen_primary_channel] = pixel_color[screen_primary_channel] - amount_despill; } } @@ -93,13 +93,13 @@ void KeyingDespillOperation::update_memory_buffer_partial(MemoryBuffer *output, const int min_channel = MIN2(other_1, other_2); const int max_channel = MAX2(other_1, other_2); - const float average_value = colorBalance_ * pixel_color[min_channel] + - (1.0f - colorBalance_) * pixel_color[max_channel]; + const float average_value = color_balance_ * pixel_color[min_channel] + + (1.0f - color_balance_) * pixel_color[max_channel]; const float amount = (pixel_color[screen_primary_channel] - average_value); copy_v4_v4(it.out, pixel_color); - const float amount_despill = despillFactor_ * amount; + const float amount_despill = despill_factor_ * amount; if (amount_despill > 0.0f) { it.out[screen_primary_channel] = pixel_color[screen_primary_channel] - amount_despill; } diff --git a/source/blender/compositor/operations/COM_KeyingDespillOperation.h b/source/blender/compositor/operations/COM_KeyingDespillOperation.h index 51efa44ce1c..b57fbd09e74 100644 --- a/source/blender/compositor/operations/COM_KeyingDespillOperation.h +++ b/source/blender/compositor/operations/COM_KeyingDespillOperation.h @@ -27,27 +27,27 @@ namespace blender::compositor { */ class KeyingDespillOperation : public MultiThreadedOperation { protected: - SocketReader *pixelReader_; - SocketReader *screenReader_; - float despillFactor_; - float colorBalance_; + SocketReader *pixel_reader_; + SocketReader *screen_reader_; + float despill_factor_; + float color_balance_; public: KeyingDespillOperation(); - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; - void setDespillFactor(float value) + void set_despill_factor(float value) { - despillFactor_ = value; + despill_factor_ = value; } - void setColorBalance(float value) + void set_color_balance(float value) { - colorBalance_ = value; + color_balance_ = value; } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, diff --git a/source/blender/compositor/operations/COM_KeyingOperation.cc b/source/blender/compositor/operations/COM_KeyingOperation.cc index 7a7fe716fb5..c7ab3aca2e2 100644 --- a/source/blender/compositor/operations/COM_KeyingOperation.cc +++ b/source/blender/compositor/operations/COM_KeyingOperation.cc @@ -20,7 +20,7 @@ namespace blender::compositor { -static float get_pixel_saturation(const float pixelColor[4], +static float get_pixel_saturation(const float pixel_color[4], float screen_balance, int primary_channel) { @@ -30,43 +30,46 @@ static float get_pixel_saturation(const float pixelColor[4], const int min_channel = MIN2(other_1, other_2); const int max_channel = MAX2(other_1, other_2); - const float val = screen_balance * pixelColor[min_channel] + - (1.0f - screen_balance) * pixelColor[max_channel]; + const float val = screen_balance * pixel_color[min_channel] + + (1.0f - screen_balance) * pixel_color[max_channel]; - return (pixelColor[primary_channel] - val) * fabsf(1.0f - val); + return (pixel_color[primary_channel] - val) * fabsf(1.0f - val); } KeyingOperation::KeyingOperation() { - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Value); + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Value); - screenBalance_ = 0.5f; + screen_balance_ = 0.5f; - pixelReader_ = nullptr; - screenReader_ = nullptr; + pixel_reader_ = nullptr; + screen_reader_ = nullptr; } -void KeyingOperation::initExecution() +void KeyingOperation::init_execution() { - pixelReader_ = this->getInputSocketReader(0); - screenReader_ = this->getInputSocketReader(1); + pixel_reader_ = this->get_input_socket_reader(0); + screen_reader_ = this->get_input_socket_reader(1); } -void KeyingOperation::deinitExecution() +void KeyingOperation::deinit_execution() { - pixelReader_ = nullptr; - screenReader_ = nullptr; + pixel_reader_ = nullptr; + screen_reader_ = nullptr; } -void KeyingOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) +void KeyingOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { float pixel_color[4]; float screen_color[4]; - pixelReader_->readSampled(pixel_color, x, y, sampler); - screenReader_->readSampled(screen_color, x, y, sampler); + pixel_reader_->read_sampled(pixel_color, x, y, sampler); + screen_reader_->read_sampled(screen_color, x, y, sampler); const int primary_channel = max_axis_v3(screen_color); const float min_pixel_color = min_fff(pixel_color[0], pixel_color[1], pixel_color[2]); @@ -80,8 +83,8 @@ void KeyingOperation::executePixelSampled(float output[4], float x, float y, Pix output[0] = 1.0f; } else { - float saturation = get_pixel_saturation(pixel_color, screenBalance_, primary_channel); - float screen_saturation = get_pixel_saturation(screen_color, screenBalance_, primary_channel); + float saturation = get_pixel_saturation(pixel_color, screen_balance_, primary_channel); + float screen_saturation = get_pixel_saturation(screen_color, screen_balance_, primary_channel); if (saturation < 0) { /* means main channel of pixel is different from screen, @@ -124,9 +127,9 @@ void KeyingOperation::update_memory_buffer_partial(MemoryBuffer *output, it.out[0] = 1.0f; } else { - const float saturation = get_pixel_saturation(pixel_color, screenBalance_, primary_channel); + const float saturation = get_pixel_saturation(pixel_color, screen_balance_, primary_channel); const float screen_saturation = get_pixel_saturation( - screen_color, screenBalance_, primary_channel); + screen_color, screen_balance_, primary_channel); if (saturation < 0) { /* Means main channel of pixel is different from screen, diff --git a/source/blender/compositor/operations/COM_KeyingOperation.h b/source/blender/compositor/operations/COM_KeyingOperation.h index 3ad18085f6b..d7be4872065 100644 --- a/source/blender/compositor/operations/COM_KeyingOperation.h +++ b/source/blender/compositor/operations/COM_KeyingOperation.h @@ -31,23 +31,23 @@ namespace blender::compositor { */ class KeyingOperation : public MultiThreadedOperation { protected: - SocketReader *pixelReader_; - SocketReader *screenReader_; + SocketReader *pixel_reader_; + SocketReader *screen_reader_; - float screenBalance_; + float screen_balance_; public: KeyingOperation(); - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; - void setScreenBalance(float value) + void set_screen_balance(float value) { - screenBalance_ = value; + screen_balance_ = value; } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, diff --git a/source/blender/compositor/operations/COM_KeyingScreenOperation.cc b/source/blender/compositor/operations/COM_KeyingScreenOperation.cc index 8f14b5415b5..d7e56aaa7c6 100644 --- a/source/blender/compositor/operations/COM_KeyingScreenOperation.cc +++ b/source/blender/compositor/operations/COM_KeyingScreenOperation.cc @@ -28,32 +28,32 @@ namespace blender::compositor { KeyingScreenOperation::KeyingScreenOperation() { - this->addOutputSocket(DataType::Color); - movieClip_ = nullptr; + this->add_output_socket(DataType::Color); + movie_clip_ = nullptr; framenumber_ = 0; - trackingObject_[0] = 0; + tracking_object_[0] = 0; flags.complex = true; - cachedTriangulation_ = nullptr; + cached_triangulation_ = nullptr; } -void KeyingScreenOperation::initExecution() +void KeyingScreenOperation::init_execution() { - initMutex(); + init_mutex(); if (execution_model_ == eExecutionModel::FullFrame) { - BLI_assert(cachedTriangulation_ == nullptr); - if (movieClip_) { - cachedTriangulation_ = buildVoronoiTriangulation(); + BLI_assert(cached_triangulation_ == nullptr); + if (movie_clip_) { + cached_triangulation_ = build_voronoi_triangulation(); } } else { - cachedTriangulation_ = nullptr; + cached_triangulation_ = nullptr; } } -void KeyingScreenOperation::deinitExecution() +void KeyingScreenOperation::deinit_execution() { - if (cachedTriangulation_) { - TriangulationData *triangulation = cachedTriangulation_; + if (cached_triangulation_) { + TriangulationData *triangulation = cached_triangulation_; if (triangulation->triangulated_points) { MEM_freeN(triangulation->triangulated_points); @@ -67,17 +67,17 @@ void KeyingScreenOperation::deinitExecution() MEM_freeN(triangulation->triangles_AABB); } - MEM_freeN(cachedTriangulation_); + MEM_freeN(cached_triangulation_); - cachedTriangulation_ = nullptr; + cached_triangulation_ = nullptr; } } -KeyingScreenOperation::TriangulationData *KeyingScreenOperation::buildVoronoiTriangulation() +KeyingScreenOperation::TriangulationData *KeyingScreenOperation::build_voronoi_triangulation() { MovieClipUser user = {0}; TriangulationData *triangulation; - MovieTracking *tracking = &movieClip_->tracking; + MovieTracking *tracking = &movie_clip_->tracking; MovieTrackingTrack *track; VoronoiSite *sites, *site; ImBuf *ibuf; @@ -85,12 +85,12 @@ KeyingScreenOperation::TriangulationData *KeyingScreenOperation::buildVoronoiTri ListBase edges = {nullptr, nullptr}; int sites_total; int i; - int width = this->getWidth(); - int height = this->getHeight(); - int clip_frame = BKE_movieclip_remap_scene_to_clip_frame(movieClip_, framenumber_); + int width = this->get_width(); + int height = this->get_height(); + int clip_frame = BKE_movieclip_remap_scene_to_clip_frame(movie_clip_, framenumber_); - if (trackingObject_[0]) { - MovieTrackingObject *object = BKE_tracking_object_get_named(tracking, trackingObject_); + if (tracking_object_[0]) { + MovieTrackingObject *object = BKE_tracking_object_get_named(tracking, tracking_object_); if (!object) { return nullptr; @@ -126,7 +126,7 @@ KeyingScreenOperation::TriangulationData *KeyingScreenOperation::buildVoronoiTri } BKE_movieclip_user_set_frame(&user, clip_frame); - ibuf = BKE_movieclip_get_ibuf(movieClip_, &user); + ibuf = BKE_movieclip_get_ibuf(movie_clip_, &user); if (!ibuf) { return nullptr; @@ -237,7 +237,7 @@ KeyingScreenOperation::TileData *KeyingScreenOperation::triangulate(const rcti * int chunk_size = 20; int i; - triangulation = cachedTriangulation_; + triangulation = cached_triangulation_; if (!triangulation) { return nullptr; @@ -269,24 +269,24 @@ KeyingScreenOperation::TileData *KeyingScreenOperation::triangulate(const rcti * return tile_data; } -void *KeyingScreenOperation::initializeTileData(rcti *rect) +void *KeyingScreenOperation::initialize_tile_data(rcti *rect) { - if (movieClip_ == nullptr) { + if (movie_clip_ == nullptr) { return nullptr; } - if (!cachedTriangulation_) { - lockMutex(); - if (cachedTriangulation_ == nullptr) { - cachedTriangulation_ = buildVoronoiTriangulation(); + if (!cached_triangulation_) { + lock_mutex(); + if (cached_triangulation_ == nullptr) { + cached_triangulation_ = build_voronoi_triangulation(); } - unlockMutex(); + unlock_mutex(); } return triangulate(rect); } -void KeyingScreenOperation::deinitializeTileData(rcti * /*rect*/, void *data) +void KeyingScreenOperation::deinitialize_tile_data(rcti * /*rect*/, void *data) { TileData *tile_data = (TileData *)data; @@ -301,28 +301,28 @@ void KeyingScreenOperation::determine_canvas(const rcti &preferred_area, rcti &r { r_area = COM_AREA_NONE; - if (movieClip_) { + if (movie_clip_) { MovieClipUser user = {0}; int width, height; - int clip_frame = BKE_movieclip_remap_scene_to_clip_frame(movieClip_, framenumber_); + int clip_frame = BKE_movieclip_remap_scene_to_clip_frame(movie_clip_, framenumber_); BKE_movieclip_user_set_frame(&user, clip_frame); - BKE_movieclip_get_size(movieClip_, &user, &width, &height); + BKE_movieclip_get_size(movie_clip_, &user, &width, &height); r_area = preferred_area; r_area.xmax = r_area.xmin + width; r_area.ymax = r_area.ymin + height; } } -void KeyingScreenOperation::executePixel(float output[4], int x, int y, void *data) +void KeyingScreenOperation::execute_pixel(float output[4], int x, int y, void *data) { output[0] = 0.0f; output[1] = 0.0f; output[2] = 0.0f; output[3] = 1.0f; - if (movieClip_ && data) { - TriangulationData *triangulation = cachedTriangulation_; + if (movie_clip_ && data) { + TriangulationData *triangulation = cached_triangulation_; TileData *tile_data = (TileData *)data; int i; float co[2] = {(float)x, (float)y}; @@ -356,7 +356,7 @@ void KeyingScreenOperation::update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span<MemoryBuffer *> inputs) { - if (movieClip_ == nullptr) { + if (movie_clip_ == nullptr) { output->fill(area, COM_COLOR_BLACK); return; } @@ -366,7 +366,7 @@ void KeyingScreenOperation::update_memory_buffer_partial(MemoryBuffer *output, const int *triangles = tri_area->triangles; const int num_triangles = tri_area->triangles_total; - const TriangulationData *triangulation = cachedTriangulation_; + const TriangulationData *triangulation = cached_triangulation_; for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) { copy_v4_v4(it.out, COM_COLOR_BLACK); diff --git a/source/blender/compositor/operations/COM_KeyingScreenOperation.h b/source/blender/compositor/operations/COM_KeyingScreenOperation.h index a828513d9fa..3450a82a485 100644 --- a/source/blender/compositor/operations/COM_KeyingScreenOperation.h +++ b/source/blender/compositor/operations/COM_KeyingScreenOperation.h @@ -49,41 +49,41 @@ class KeyingScreenOperation : public MultiThreadedOperation { int triangles_total; } TileData; - MovieClip *movieClip_; + MovieClip *movie_clip_; int framenumber_; - TriangulationData *cachedTriangulation_; - char trackingObject_[64]; + TriangulationData *cached_triangulation_; + char tracking_object_[64]; /** * Determine the output resolution. The resolution is retrieved from the Renderer */ void determine_canvas(const rcti &preferred_area, rcti &r_area) override; - TriangulationData *buildVoronoiTriangulation(); + TriangulationData *build_voronoi_triangulation(); public: KeyingScreenOperation(); - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; - void *initializeTileData(rcti *rect) override; - void deinitializeTileData(rcti *rect, void *data) override; + void *initialize_tile_data(rcti *rect) override; + void deinitialize_tile_data(rcti *rect, void *data) override; - void setMovieClip(MovieClip *clip) + void set_movie_clip(MovieClip *clip) { - movieClip_ = clip; + movie_clip_ = clip; } - void setTrackingObject(const char *object) + void set_tracking_object(const char *object) { - BLI_strncpy(trackingObject_, object, sizeof(trackingObject_)); + BLI_strncpy(tracking_object_, object, sizeof(tracking_object_)); } - void setFramenumber(int framenumber) + void set_framenumber(int framenumber) { framenumber_ = framenumber; } - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, diff --git a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cc b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cc index d266cbd00f5..36dc9c42b8b 100644 --- a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cc +++ b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cc @@ -24,39 +24,39 @@ namespace blender::compositor { LuminanceMatteOperation::LuminanceMatteOperation() { - addInputSocket(DataType::Color); - addOutputSocket(DataType::Value); + add_input_socket(DataType::Color); + add_output_socket(DataType::Value); - inputImageProgram_ = nullptr; + input_image_program_ = nullptr; flags.can_be_constant = true; } -void LuminanceMatteOperation::initExecution() +void LuminanceMatteOperation::init_execution() { - inputImageProgram_ = this->getInputSocketReader(0); + input_image_program_ = this->get_input_socket_reader(0); } -void LuminanceMatteOperation::deinitExecution() +void LuminanceMatteOperation::deinit_execution() { - inputImageProgram_ = nullptr; + input_image_program_ = nullptr; } -void LuminanceMatteOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void LuminanceMatteOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inColor[4]; - inputImageProgram_->readSampled(inColor, x, y, sampler); + float in_color[4]; + input_image_program_->read_sampled(in_color, x, y, sampler); const float high = settings_->t1; const float low = settings_->t2; - const float luminance = IMB_colormanagement_get_luminance(inColor); + const float luminance = IMB_colormanagement_get_luminance(in_color); float alpha; /* one line thread-friend algorithm: - * output[0] = MIN2(inputValue[3], MIN2(1.0f, MAX2(0.0f, ((luminance - low) / (high - low)))); + * output[0] = MIN2(input_value[3], MIN2(1.0f, MAX2(0.0f, ((luminance - low) / (high - low)))); */ /* test range */ @@ -75,7 +75,7 @@ void LuminanceMatteOperation::executePixelSampled(float output[4], */ /* don't make something that was more transparent less transparent */ - output[0] = min_ff(alpha, inColor[3]); + output[0] = min_ff(alpha, in_color[3]); } void LuminanceMatteOperation::update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_LuminanceMatteOperation.h b/source/blender/compositor/operations/COM_LuminanceMatteOperation.h index 6262d1999bc..7f9ccfc83ac 100644 --- a/source/blender/compositor/operations/COM_LuminanceMatteOperation.h +++ b/source/blender/compositor/operations/COM_LuminanceMatteOperation.h @@ -29,7 +29,7 @@ namespace blender::compositor { class LuminanceMatteOperation : public MultiThreadedOperation { private: NodeChroma *settings_; - SocketReader *inputImageProgram_; + SocketReader *input_image_program_; public: /** @@ -40,14 +40,14 @@ class LuminanceMatteOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; - void setSettings(NodeChroma *nodeChroma) + void set_settings(NodeChroma *node_chroma) { - settings_ = nodeChroma; + settings_ = node_chroma; } void update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_MapRangeOperation.cc b/source/blender/compositor/operations/COM_MapRangeOperation.cc index 0fcdbd1fd99..e8ce1f100c3 100644 --- a/source/blender/compositor/operations/COM_MapRangeOperation.cc +++ b/source/blender/compositor/operations/COM_MapRangeOperation.cc @@ -22,45 +22,45 @@ namespace blender::compositor { MapRangeOperation::MapRangeOperation() { - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Value); - inputOperation_ = nullptr; - useClamp_ = false; + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Value); + input_operation_ = nullptr; + use_clamp_ = false; flags.can_be_constant = true; } -void MapRangeOperation::initExecution() +void MapRangeOperation::init_execution() { - inputOperation_ = this->getInputSocketReader(0); - sourceMinOperation_ = this->getInputSocketReader(1); - sourceMaxOperation_ = this->getInputSocketReader(2); - destMinOperation_ = this->getInputSocketReader(3); - destMaxOperation_ = this->getInputSocketReader(4); + input_operation_ = this->get_input_socket_reader(0); + source_min_operation_ = this->get_input_socket_reader(1); + source_max_operation_ = this->get_input_socket_reader(2); + dest_min_operation_ = this->get_input_socket_reader(3); + dest_max_operation_ = this->get_input_socket_reader(4); } /* The code below assumes all data is inside range +- this, and that input buffer is single channel */ #define BLENDER_ZMAX 10000.0f -void MapRangeOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MapRangeOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { float inputs[8]; /* includes the 5 inputs + 3 pads */ float value; float source_min, source_max; float dest_min, dest_max; - inputOperation_->readSampled(inputs, x, y, sampler); - sourceMinOperation_->readSampled(inputs + 1, x, y, sampler); - sourceMaxOperation_->readSampled(inputs + 2, x, y, sampler); - destMinOperation_->readSampled(inputs + 3, x, y, sampler); - destMaxOperation_->readSampled(inputs + 4, x, y, sampler); + input_operation_->read_sampled(inputs, x, y, sampler); + source_min_operation_->read_sampled(inputs + 1, x, y, sampler); + source_max_operation_->read_sampled(inputs + 2, x, y, sampler); + dest_min_operation_->read_sampled(inputs + 3, x, y, sampler); + dest_max_operation_->read_sampled(inputs + 4, x, y, sampler); value = inputs[0]; source_min = inputs[1]; @@ -84,7 +84,7 @@ void MapRangeOperation::executePixelSampled(float output[4], value = dest_min; } - if (useClamp_) { + if (use_clamp_) { if (dest_max > dest_min) { CLAMP(value, dest_min, dest_max); } @@ -96,13 +96,13 @@ void MapRangeOperation::executePixelSampled(float output[4], output[0] = value; } -void MapRangeOperation::deinitExecution() +void MapRangeOperation::deinit_execution() { - inputOperation_ = nullptr; - sourceMinOperation_ = nullptr; - sourceMaxOperation_ = nullptr; - destMinOperation_ = nullptr; - destMaxOperation_ = nullptr; + input_operation_ = nullptr; + source_min_operation_ = nullptr; + source_max_operation_ = nullptr; + dest_min_operation_ = nullptr; + dest_max_operation_ = nullptr; } void MapRangeOperation::update_memory_buffer_partial(MemoryBuffer *output, @@ -131,7 +131,7 @@ void MapRangeOperation::update_memory_buffer_partial(MemoryBuffer *output, value = dest_min; } - if (useClamp_) { + if (use_clamp_) { if (dest_max > dest_min) { CLAMP(value, dest_min, dest_max); } diff --git a/source/blender/compositor/operations/COM_MapRangeOperation.h b/source/blender/compositor/operations/COM_MapRangeOperation.h index f5c42d19079..0d0f3c90e35 100644 --- a/source/blender/compositor/operations/COM_MapRangeOperation.h +++ b/source/blender/compositor/operations/COM_MapRangeOperation.h @@ -30,15 +30,15 @@ namespace blender::compositor { class MapRangeOperation : public MultiThreadedOperation { private: /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputOperation_; - SocketReader *sourceMinOperation_; - SocketReader *sourceMaxOperation_; - SocketReader *destMinOperation_; - SocketReader *destMaxOperation_; + SocketReader *input_operation_; + SocketReader *source_min_operation_; + SocketReader *source_max_operation_; + SocketReader *dest_min_operation_; + SocketReader *dest_max_operation_; - bool useClamp_; + bool use_clamp_; public: /** @@ -49,24 +49,24 @@ class MapRangeOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; /** * Clamp the output */ - void setUseClamp(bool value) + void set_use_clamp(bool value) { - useClamp_ = value; + use_clamp_ = value; } void update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_MapUVOperation.cc b/source/blender/compositor/operations/COM_MapUVOperation.cc index a5140c30fed..fb4fcff381d 100644 --- a/source/blender/compositor/operations/COM_MapUVOperation.cc +++ b/source/blender/compositor/operations/COM_MapUVOperation.cc @@ -22,55 +22,55 @@ namespace blender::compositor { MapUVOperation::MapUVOperation() { - this->addInputSocket(DataType::Color, ResizeMode::Align); - this->addInputSocket(DataType::Vector); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color, ResizeMode::Align); + this->add_input_socket(DataType::Vector); + this->add_output_socket(DataType::Color); alpha_ = 0.0f; this->flags.complex = true; set_canvas_input_index(UV_INPUT_INDEX); inputUVProgram_ = nullptr; - inputColorProgram_ = nullptr; + input_color_program_ = nullptr; } void MapUVOperation::init_data() { NodeOperation *image_input = get_input_operation(IMAGE_INPUT_INDEX); - image_width_ = image_input->getWidth(); - image_height_ = image_input->getHeight(); + image_width_ = image_input->get_width(); + image_height_ = image_input->get_height(); NodeOperation *uv_input = get_input_operation(UV_INPUT_INDEX); - uv_width_ = uv_input->getWidth(); - uv_height_ = uv_input->getHeight(); + uv_width_ = uv_input->get_width(); + uv_height_ = uv_input->get_height(); } -void MapUVOperation::initExecution() +void MapUVOperation::init_execution() { - inputColorProgram_ = this->getInputSocketReader(0); - inputUVProgram_ = this->getInputSocketReader(1); + input_color_program_ = this->get_input_socket_reader(0); + inputUVProgram_ = this->get_input_socket_reader(1); if (execution_model_ == eExecutionModel::Tiled) { uv_input_read_fn_ = [=](float x, float y, float *out) { - inputUVProgram_->readSampled(out, x, y, PixelSampler::Bilinear); + inputUVProgram_->read_sampled(out, x, y, PixelSampler::Bilinear); }; } } -void MapUVOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler /*sampler*/) +void MapUVOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler /*sampler*/) { float xy[2] = {x, y}; float uv[2], deriv[2][2], alpha; - pixelTransform(xy, uv, deriv, alpha); + pixel_transform(xy, uv, deriv, alpha); if (alpha == 0.0f) { zero_v4(output); return; } /* EWA filtering */ - inputColorProgram_->readFiltered(output, uv[0], uv[1], deriv[0], deriv[1]); + input_color_program_->read_filtered(output, uv[0], uv[1], deriv[0], deriv[1]); /* UV to alpha threshold */ const float threshold = alpha_ * 0.05f; @@ -79,8 +79,8 @@ void MapUVOperation::executePixelSampled(float output[4], */ float du = len_v2(deriv[0]); float dv = len_v2(deriv[1]); - float factor = 1.0f - threshold * (du / inputColorProgram_->getWidth() + - dv / inputColorProgram_->getHeight()); + float factor = 1.0f - threshold * (du / input_color_program_->get_width() + + dv / input_color_program_->get_height()); if (factor < 0.0f) { alpha = 0.0f; } @@ -111,10 +111,10 @@ bool MapUVOperation::read_uv(float x, float y, float &r_u, float &r_v, float &r_ return true; } -void MapUVOperation::pixelTransform(const float xy[2], - float r_uv[2], - float r_deriv[2][2], - float &r_alpha) +void MapUVOperation::pixel_transform(const float xy[2], + float r_uv[2], + float r_deriv[2][2], + float &r_alpha) { float uv[2], alpha; /* temporary variables for derivative estimation */ int num; @@ -162,37 +162,37 @@ void MapUVOperation::pixelTransform(const float xy[2], } } -void MapUVOperation::deinitExecution() +void MapUVOperation::deinit_execution() { inputUVProgram_ = nullptr; - inputColorProgram_ = nullptr; + input_color_program_ = nullptr; } -bool MapUVOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool MapUVOperation::determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) { - rcti colorInput; - rcti uvInput; + rcti color_input; + rcti uv_input; NodeOperation *operation = nullptr; /* the uv buffer only needs a 3x3 buffer. The image needs whole buffer */ - operation = getInputOperation(0); - colorInput.xmax = operation->getWidth(); - colorInput.xmin = 0; - colorInput.ymax = operation->getHeight(); - colorInput.ymin = 0; - if (operation->determineDependingAreaOfInterest(&colorInput, readOperation, output)) { + operation = get_input_operation(0); + color_input.xmax = operation->get_width(); + color_input.xmin = 0; + color_input.ymax = operation->get_height(); + color_input.ymin = 0; + if (operation->determine_depending_area_of_interest(&color_input, read_operation, output)) { return true; } - operation = getInputOperation(1); - uvInput.xmax = input->xmax + 1; - uvInput.xmin = input->xmin - 1; - uvInput.ymax = input->ymax + 1; - uvInput.ymin = input->ymin - 1; - if (operation->determineDependingAreaOfInterest(&uvInput, readOperation, output)) { + operation = get_input_operation(1); + uv_input.xmax = input->xmax + 1; + uv_input.xmin = input->xmin - 1; + uv_input.ymax = input->ymax + 1; + uv_input.ymin = input->ymin - 1; + if (operation->determine_depending_area_of_interest(&uv_input, read_operation, output)) { return true; } @@ -236,7 +236,7 @@ void MapUVOperation::update_memory_buffer_partial(MemoryBuffer *output, float uv[2]; float deriv[2][2]; float alpha; - pixelTransform(xy, uv, deriv, alpha); + pixel_transform(xy, uv, deriv, alpha); if (alpha == 0.0f) { zero_v4(it.out); continue; diff --git a/source/blender/compositor/operations/COM_MapUVOperation.h b/source/blender/compositor/operations/COM_MapUVOperation.h index 7025e02e069..38d848f61a0 100644 --- a/source/blender/compositor/operations/COM_MapUVOperation.h +++ b/source/blender/compositor/operations/COM_MapUVOperation.h @@ -27,10 +27,10 @@ class MapUVOperation : public MultiThreadedOperation { static constexpr int IMAGE_INPUT_INDEX = 0; static constexpr int UV_INPUT_INDEX = 1; /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ SocketReader *inputUVProgram_; - SocketReader *inputColorProgram_; + SocketReader *input_color_program_; int uv_width_; int uv_height_; @@ -47,30 +47,30 @@ class MapUVOperation : public MultiThreadedOperation { /** * we need a 3x3 differential filter for UV Input and full buffer for the image */ - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(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); + void pixel_transform(const float xy[2], float r_uv[2], float r_deriv[2][2], float &r_alpha); void init_data() override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void setAlpha(float alpha) + void set_alpha(float alpha) { alpha_ = alpha; } diff --git a/source/blender/compositor/operations/COM_MapValueOperation.cc b/source/blender/compositor/operations/COM_MapValueOperation.cc index 0f4175c3d3d..da5ab04cc98 100644 --- a/source/blender/compositor/operations/COM_MapValueOperation.cc +++ b/source/blender/compositor/operations/COM_MapValueOperation.cc @@ -22,24 +22,24 @@ namespace blender::compositor { MapValueOperation::MapValueOperation() { - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Value); - inputOperation_ = nullptr; + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Value); + input_operation_ = nullptr; flags.can_be_constant = true; } -void MapValueOperation::initExecution() +void MapValueOperation::init_execution() { - inputOperation_ = this->getInputSocketReader(0); + input_operation_ = this->get_input_socket_reader(0); } -void MapValueOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MapValueOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { float src[4]; - inputOperation_->readSampled(src, x, y, sampler); + input_operation_->read_sampled(src, x, y, sampler); TexMapping *texmap = settings_; float value = (src[0] + texmap->loc[0]) * texmap->size[0]; if (texmap->flag & TEXMAP_CLIP_MIN) { @@ -56,9 +56,9 @@ void MapValueOperation::executePixelSampled(float output[4], output[0] = value; } -void MapValueOperation::deinitExecution() +void MapValueOperation::deinit_execution() { - inputOperation_ = nullptr; + input_operation_ = nullptr; } void MapValueOperation::update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_MapValueOperation.h b/source/blender/compositor/operations/COM_MapValueOperation.h index 38cb75869d5..77d3a4a2932 100644 --- a/source/blender/compositor/operations/COM_MapValueOperation.h +++ b/source/blender/compositor/operations/COM_MapValueOperation.h @@ -30,9 +30,9 @@ namespace blender::compositor { class MapValueOperation : public MultiThreadedOperation { private: /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputOperation_; + SocketReader *input_operation_; TexMapping *settings_; public: @@ -44,22 +44,22 @@ class MapValueOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; /** * \brief set the TexMapping settings */ - void setSettings(TexMapping *settings) + void set_settings(TexMapping *settings) { settings_ = settings; } diff --git a/source/blender/compositor/operations/COM_MaskOperation.cc b/source/blender/compositor/operations/COM_MaskOperation.cc index d02d23445b6..4e4cc820edb 100644 --- a/source/blender/compositor/operations/COM_MaskOperation.cc +++ b/source/blender/compositor/operations/COM_MaskOperation.cc @@ -25,31 +25,31 @@ namespace blender::compositor { MaskOperation::MaskOperation() { - this->addOutputSocket(DataType::Value); + this->add_output_socket(DataType::Value); mask_ = nullptr; - maskWidth_ = 0; - maskHeight_ = 0; - maskWidthInv_ = 0.0f; - maskHeightInv_ = 0.0f; + mask_width_ = 0; + mask_height_ = 0; + mask_width_inv_ = 0.0f; + mask_height_inv_ = 0.0f; frame_shutter_ = 0.0f; frame_number_ = 0; - rasterMaskHandleTot_ = 1; - memset(rasterMaskHandles_, 0, sizeof(rasterMaskHandles_)); + raster_mask_handle_tot_ = 1; + memset(raster_mask_handles_, 0, sizeof(raster_mask_handles_)); } -void MaskOperation::initExecution() +void MaskOperation::init_execution() { - if (mask_ && rasterMaskHandles_[0] == nullptr) { - if (rasterMaskHandleTot_ == 1) { - rasterMaskHandles_[0] = BKE_maskrasterize_handle_new(); + if (mask_ && raster_mask_handles_[0] == nullptr) { + if (raster_mask_handle_tot_ == 1) { + raster_mask_handles_[0] = BKE_maskrasterize_handle_new(); BKE_maskrasterize_handle_init( - rasterMaskHandles_[0], mask_, maskWidth_, maskHeight_, true, true, do_feather_); + raster_mask_handles_[0], mask_, mask_width_, mask_height_, true, true, do_feather_); } else { /* make a throw away copy of the mask */ const float frame = (float)frame_number_ - frame_shutter_; - const float frame_step = (frame_shutter_ * 2.0f) / rasterMaskHandleTot_; + const float frame_step = (frame_shutter_ * 2.0f) / raster_mask_handle_tot_; float frame_iter = frame; Mask *mask_temp = (Mask *)BKE_id_copy_ex( @@ -67,14 +67,19 @@ void MaskOperation::initExecution() } } - for (unsigned int i = 0; i < rasterMaskHandleTot_; i++) { - rasterMaskHandles_[i] = BKE_maskrasterize_handle_new(); + for (unsigned int i = 0; i < raster_mask_handle_tot_; i++) { + raster_mask_handles_[i] = BKE_maskrasterize_handle_new(); /* re-eval frame info */ BKE_mask_evaluate(mask_temp, frame_iter, true); - BKE_maskrasterize_handle_init( - rasterMaskHandles_[i], mask_temp, maskWidth_, maskHeight_, true, true, do_feather_); + BKE_maskrasterize_handle_init(raster_mask_handles_[i], + mask_temp, + mask_width_, + mask_height_, + true, + true, + do_feather_); frame_iter += frame_step; } @@ -84,41 +89,41 @@ void MaskOperation::initExecution() } } -void MaskOperation::deinitExecution() +void MaskOperation::deinit_execution() { - for (unsigned int i = 0; i < rasterMaskHandleTot_; i++) { - if (rasterMaskHandles_[i]) { - BKE_maskrasterize_handle_free(rasterMaskHandles_[i]); - rasterMaskHandles_[i] = nullptr; + for (unsigned int i = 0; i < raster_mask_handle_tot_; i++) { + if (raster_mask_handles_[i]) { + BKE_maskrasterize_handle_free(raster_mask_handles_[i]); + raster_mask_handles_[i] = nullptr; } } } void MaskOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) { - if (maskWidth_ == 0 || maskHeight_ == 0) { + if (mask_width_ == 0 || mask_height_ == 0) { r_area = COM_AREA_NONE; } else { r_area = preferred_area; - r_area.xmax = r_area.xmin + maskWidth_; - r_area.ymax = r_area.ymin + maskHeight_; + r_area.xmax = r_area.xmin + mask_width_; + r_area.ymax = r_area.ymin + mask_height_; } } -void MaskOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler /*sampler*/) +void MaskOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler /*sampler*/) { const float xy[2] = { - (x * maskWidthInv_) + mask_px_ofs_[0], - (y * maskHeightInv_) + mask_px_ofs_[1], + (x * mask_width_inv_) + mask_px_ofs_[0], + (y * mask_height_inv_) + mask_px_ofs_[1], }; - if (rasterMaskHandleTot_ == 1) { - if (rasterMaskHandles_[0]) { - output[0] = BKE_maskrasterize_handle_sample(rasterMaskHandles_[0], xy); + if (raster_mask_handle_tot_ == 1) { + if (raster_mask_handles_[0]) { + output[0] = BKE_maskrasterize_handle_sample(raster_mask_handles_[0], xy); } else { output[0] = 0.0f; @@ -128,14 +133,14 @@ void MaskOperation::executePixelSampled(float output[4], /* In case loop below fails. */ output[0] = 0.0f; - for (unsigned int i = 0; i < rasterMaskHandleTot_; i++) { - if (rasterMaskHandles_[i]) { - output[0] += BKE_maskrasterize_handle_sample(rasterMaskHandles_[i], xy); + for (unsigned int i = 0; i < raster_mask_handle_tot_; i++) { + if (raster_mask_handles_[i]) { + output[0] += BKE_maskrasterize_handle_sample(raster_mask_handles_[i], xy); } } /* until we get better falloff */ - output[0] /= rasterMaskHandleTot_; + output[0] /= raster_mask_handle_tot_; } } @@ -151,23 +156,23 @@ void MaskOperation::update_memory_buffer_partial(MemoryBuffer *output, float xy[2]; for (BuffersIterator<float> it = output->iterate_with({}, area); !it.is_end(); ++it) { - xy[0] = it.x * maskWidthInv_ + mask_px_ofs_[0]; - xy[1] = it.y * maskHeightInv_ + mask_px_ofs_[1]; + xy[0] = it.x * mask_width_inv_ + mask_px_ofs_[0]; + xy[1] = it.y * mask_height_inv_ + mask_px_ofs_[1]; *it.out = 0.0f; for (MaskRasterHandle *handle : handles) { *it.out += BKE_maskrasterize_handle_sample(handle, xy); } /* Until we get better falloff. */ - *it.out /= rasterMaskHandleTot_; + *it.out /= raster_mask_handle_tot_; } } Vector<MaskRasterHandle *> MaskOperation::get_non_null_handles() const { Vector<MaskRasterHandle *> handles; - for (int i = 0; i < rasterMaskHandleTot_; i++) { - MaskRasterHandle *handle = rasterMaskHandles_[i]; + for (int i = 0; i < raster_mask_handle_tot_; i++) { + MaskRasterHandle *handle = raster_mask_handles_[i]; if (handle == nullptr) { continue; } diff --git a/source/blender/compositor/operations/COM_MaskOperation.h b/source/blender/compositor/operations/COM_MaskOperation.h index e8f386242b4..5fc0ed96c22 100644 --- a/source/blender/compositor/operations/COM_MaskOperation.h +++ b/source/blender/compositor/operations/COM_MaskOperation.h @@ -37,10 +37,10 @@ class MaskOperation : public MultiThreadedOperation { /* NOTE: these are used more like aspect, * but they _do_ impact on mask detail */ - int maskWidth_; - int maskHeight_; - float maskWidthInv_; /* `1 / maskWidth_` */ - float maskHeightInv_; /* `1 / maskHeight_` */ + int mask_width_; + int mask_height_; + float mask_width_inv_; /* `1 / mask_width_` */ + float mask_height_inv_; /* `1 / mask_height_` */ float mask_px_ofs_[2]; float frame_shutter_; @@ -48,8 +48,8 @@ class MaskOperation : public MultiThreadedOperation { bool do_feather_; - struct MaskRasterHandle *rasterMaskHandles_[CMP_NODE_MASK_MBLUR_SAMPLES_MAX]; - unsigned int rasterMaskHandleTot_; + struct MaskRasterHandle *raster_mask_handles_[CMP_NODE_MASK_MBLUR_SAMPLES_MAX]; + unsigned int raster_mask_handle_tot_; /** * Determine the output resolution. The resolution is retrieved from the Renderer @@ -59,44 +59,44 @@ class MaskOperation : public MultiThreadedOperation { public: MaskOperation(); - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; - void setMask(Mask *mask) + void set_mask(Mask *mask) { mask_ = mask; } - void setMaskWidth(int width) + void set_mask_width(int width) { - maskWidth_ = width; - maskWidthInv_ = 1.0f / (float)width; - mask_px_ofs_[0] = maskWidthInv_ * 0.5f; + mask_width_ = width; + mask_width_inv_ = 1.0f / (float)width; + mask_px_ofs_[0] = mask_width_inv_ * 0.5f; } - void setMaskHeight(int height) + void set_mask_height(int height) { - maskHeight_ = height; - maskHeightInv_ = 1.0f / (float)height; - mask_px_ofs_[1] = maskHeightInv_ * 0.5f; + mask_height_ = height; + mask_height_inv_ = 1.0f / (float)height; + mask_px_ofs_[1] = mask_height_inv_ * 0.5f; } - void setFramenumber(int frame_number) + void set_framenumber(int frame_number) { frame_number_ = frame_number; } - void setFeather(bool feather) + void set_feather(bool feather) { do_feather_ = feather; } - void setMotionBlurSamples(int samples) + void set_motion_blur_samples(int samples) { - rasterMaskHandleTot_ = MIN2(MAX2(1, samples), CMP_NODE_MASK_MBLUR_SAMPLES_MAX); + raster_mask_handle_tot_ = MIN2(MAX2(1, samples), CMP_NODE_MASK_MBLUR_SAMPLES_MAX); } - void setMotionBlurShutter(float shutter) + void set_motion_blur_shutter(float shutter) { frame_shutter_ = shutter; } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.cc b/source/blender/compositor/operations/COM_MathBaseOperation.cc index 30b6e14a324..55151b70050 100644 --- a/source/blender/compositor/operations/COM_MathBaseOperation.cc +++ b/source/blender/compositor/operations/COM_MathBaseOperation.cc @@ -24,36 +24,36 @@ MathBaseOperation::MathBaseOperation() { /* TODO(manzanilla): after removing tiled implementation, template this class to only add needed * number of inputs. */ - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Value); - inputValue1Operation_ = nullptr; - inputValue2Operation_ = nullptr; - inputValue3Operation_ = nullptr; - useClamp_ = false; + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Value); + input_value1_operation_ = nullptr; + input_value2_operation_ = nullptr; + input_value3_operation_ = nullptr; + use_clamp_ = false; this->flags.can_be_constant = true; } -void MathBaseOperation::initExecution() +void MathBaseOperation::init_execution() { - inputValue1Operation_ = this->getInputSocketReader(0); - inputValue2Operation_ = this->getInputSocketReader(1); - inputValue3Operation_ = this->getInputSocketReader(2); + input_value1_operation_ = this->get_input_socket_reader(0); + input_value2_operation_ = this->get_input_socket_reader(1); + input_value3_operation_ = this->get_input_socket_reader(2); } -void MathBaseOperation::deinitExecution() +void MathBaseOperation::deinit_execution() { - inputValue1Operation_ = nullptr; - inputValue2Operation_ = nullptr; - inputValue3Operation_ = nullptr; + input_value1_operation_ = nullptr; + input_value2_operation_ = nullptr; + input_value3_operation_ = nullptr; } void MathBaseOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) { NodeOperationInput *socket; rcti temp_area; - socket = this->getInputSocket(0); + socket = this->get_input_socket(0); const bool determined = socket->determine_canvas(COM_AREA_NONE, temp_area); if (determined) { this->set_canvas_input_index(0); @@ -64,9 +64,9 @@ void MathBaseOperation::determine_canvas(const rcti &preferred_area, rcti &r_are NodeOperation::determine_canvas(preferred_area, r_area); } -void MathBaseOperation::clampIfNeeded(float *color) +void MathBaseOperation::clamp_if_needed(float *color) { - if (useClamp_) { + if (use_clamp_) { CLAMP(color[0], 0.0f, 1.0f); } } @@ -79,70 +79,73 @@ void MathBaseOperation::update_memory_buffer_partial(MemoryBuffer *output, update_memory_buffer_partial(it); } -void MathAddOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) +void MathAddOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; + float input_value1[4]; + float input_value2[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); - output[0] = inputValue1[0] + inputValue2[0]; + output[0] = input_value1[0] + input_value2[0]; - clampIfNeeded(output); + clamp_if_needed(output); } -void MathSubtractOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathSubtractOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; + float input_value1[4]; + float input_value2[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); - output[0] = inputValue1[0] - inputValue2[0]; + output[0] = input_value1[0] - input_value2[0]; - clampIfNeeded(output); + clamp_if_needed(output); } -void MathMultiplyOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathMultiplyOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; + float input_value1[4]; + float input_value2[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); - output[0] = inputValue1[0] * inputValue2[0]; + output[0] = input_value1[0] * input_value2[0]; - clampIfNeeded(output); + clamp_if_needed(output); } -void MathDivideOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathDivideOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; + float input_value1[4]; + float input_value2[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); - if (inputValue2[0] == 0) { /* We don't want to divide by zero. */ + if (input_value2[0] == 0) { /* We don't want to divide by zero. */ output[0] = 0.0; } else { - output[0] = inputValue1[0] / inputValue2[0]; + output[0] = input_value1[0] / input_value2[0]; } - clampIfNeeded(output); + clamp_if_needed(output); } void MathDivideOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -153,20 +156,20 @@ void MathDivideOperation::update_memory_buffer_partial(BuffersIterator<float> &i } } -void MathSineOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathSineOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; + float input_value1[4]; + float input_value2[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); - output[0] = sin(inputValue1[0]); + output[0] = sin(input_value1[0]); - clampIfNeeded(output); + clamp_if_needed(output); } void MathSineOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -177,20 +180,20 @@ void MathSineOperation::update_memory_buffer_partial(BuffersIterator<float> &it) } } -void MathCosineOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathCosineOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; + float input_value1[4]; + float input_value2[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); - output[0] = cos(inputValue1[0]); + output[0] = cos(input_value1[0]); - clampIfNeeded(output); + clamp_if_needed(output); } void MathCosineOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -201,20 +204,20 @@ void MathCosineOperation::update_memory_buffer_partial(BuffersIterator<float> &i } } -void MathTangentOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathTangentOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; + float input_value1[4]; + float input_value2[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); - output[0] = tan(inputValue1[0]); + output[0] = tan(input_value1[0]); - clampIfNeeded(output); + clamp_if_needed(output); } void MathTangentOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -225,20 +228,20 @@ void MathTangentOperation::update_memory_buffer_partial(BuffersIterator<float> & } } -void MathHyperbolicSineOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathHyperbolicSineOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; + float input_value1[4]; + float input_value2[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); - output[0] = sinh(inputValue1[0]); + output[0] = sinh(input_value1[0]); - clampIfNeeded(output); + clamp_if_needed(output); } void MathHyperbolicSineOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -249,20 +252,20 @@ void MathHyperbolicSineOperation::update_memory_buffer_partial(BuffersIterator<f } } -void MathHyperbolicCosineOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathHyperbolicCosineOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; + float input_value1[4]; + float input_value2[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); - output[0] = cosh(inputValue1[0]); + output[0] = cosh(input_value1[0]); - clampIfNeeded(output); + clamp_if_needed(output); } void MathHyperbolicCosineOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -273,20 +276,20 @@ void MathHyperbolicCosineOperation::update_memory_buffer_partial(BuffersIterator } } -void MathHyperbolicTangentOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathHyperbolicTangentOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; + float input_value1[4]; + float input_value2[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); - output[0] = tanh(inputValue1[0]); + output[0] = tanh(input_value1[0]); - clampIfNeeded(output); + clamp_if_needed(output); } void MathHyperbolicTangentOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -297,25 +300,25 @@ void MathHyperbolicTangentOperation::update_memory_buffer_partial(BuffersIterato } } -void MathArcSineOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathArcSineOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; + float input_value1[4]; + float input_value2[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); - if (inputValue1[0] <= 1 && inputValue1[0] >= -1) { - output[0] = asin(inputValue1[0]); + if (input_value1[0] <= 1 && input_value1[0] >= -1) { + output[0] = asin(input_value1[0]); } else { output[0] = 0.0; } - clampIfNeeded(output); + clamp_if_needed(output); } void MathArcSineOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -326,25 +329,25 @@ void MathArcSineOperation::update_memory_buffer_partial(BuffersIterator<float> & } } -void MathArcCosineOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathArcCosineOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; + float input_value1[4]; + float input_value2[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); - if (inputValue1[0] <= 1 && inputValue1[0] >= -1) { - output[0] = acos(inputValue1[0]); + if (input_value1[0] <= 1 && input_value1[0] >= -1) { + output[0] = acos(input_value1[0]); } else { output[0] = 0.0; } - clampIfNeeded(output); + clamp_if_needed(output); } void MathArcCosineOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -355,20 +358,20 @@ void MathArcCosineOperation::update_memory_buffer_partial(BuffersIterator<float> } } -void MathArcTangentOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathArcTangentOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; + float input_value1[4]; + float input_value2[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); - output[0] = atan(inputValue1[0]); + output[0] = atan(input_value1[0]); - clampIfNeeded(output); + clamp_if_needed(output); } void MathArcTangentOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -379,32 +382,32 @@ void MathArcTangentOperation::update_memory_buffer_partial(BuffersIterator<float } } -void MathPowerOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathPowerOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; + float input_value1[4]; + float input_value2[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); - if (inputValue1[0] >= 0) { - output[0] = pow(inputValue1[0], inputValue2[0]); + if (input_value1[0] >= 0) { + output[0] = pow(input_value1[0], input_value2[0]); } else { - float y_mod_1 = fmod(inputValue2[0], 1); + float y_mod_1 = fmod(input_value2[0], 1); /* if input value is not nearly an integer, fall back to zero, nicer than straight rounding */ if (y_mod_1 > 0.999f || y_mod_1 < 0.001f) { - output[0] = pow(inputValue1[0], floorf(inputValue2[0] + 0.5f)); + output[0] = pow(input_value1[0], floorf(input_value2[0] + 0.5f)); } else { output[0] = 0.0; } } - clampIfNeeded(output); + clamp_if_needed(output); } void MathPowerOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -430,25 +433,25 @@ void MathPowerOperation::update_memory_buffer_partial(BuffersIterator<float> &it } } -void MathLogarithmOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathLogarithmOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; + float input_value1[4]; + float input_value2[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); - if (inputValue1[0] > 0 && inputValue2[0] > 0) { - output[0] = log(inputValue1[0]) / log(inputValue2[0]); + if (input_value1[0] > 0 && input_value2[0] > 0) { + output[0] = log(input_value1[0]) / log(input_value2[0]); } else { output[0] = 0.0; } - clampIfNeeded(output); + clamp_if_needed(output); } void MathLogarithmOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -466,20 +469,20 @@ void MathLogarithmOperation::update_memory_buffer_partial(BuffersIterator<float> } } -void MathMinimumOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathMinimumOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; + float input_value1[4]; + float input_value2[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); - output[0] = MIN2(inputValue1[0], inputValue2[0]); + output[0] = MIN2(input_value1[0], input_value2[0]); - clampIfNeeded(output); + clamp_if_needed(output); } void MathMinimumOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -490,20 +493,20 @@ void MathMinimumOperation::update_memory_buffer_partial(BuffersIterator<float> & } } -void MathMaximumOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathMaximumOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; + float input_value1[4]; + float input_value2[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); - output[0] = MAX2(inputValue1[0], inputValue2[0]); + output[0] = MAX2(input_value1[0], input_value2[0]); - clampIfNeeded(output); + clamp_if_needed(output); } void MathMaximumOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -514,20 +517,20 @@ void MathMaximumOperation::update_memory_buffer_partial(BuffersIterator<float> & } } -void MathRoundOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathRoundOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; + float input_value1[4]; + float input_value2[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); - output[0] = round(inputValue1[0]); + output[0] = round(input_value1[0]); - clampIfNeeded(output); + clamp_if_needed(output); } void MathRoundOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -538,57 +541,57 @@ void MathRoundOperation::update_memory_buffer_partial(BuffersIterator<float> &it } } -void MathLessThanOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathLessThanOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; + float input_value1[4]; + float input_value2[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); - output[0] = inputValue1[0] < inputValue2[0] ? 1.0f : 0.0f; + output[0] = input_value1[0] < input_value2[0] ? 1.0f : 0.0f; - clampIfNeeded(output); + clamp_if_needed(output); } -void MathGreaterThanOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathGreaterThanOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; + float input_value1[4]; + float input_value2[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); - output[0] = inputValue1[0] > inputValue2[0] ? 1.0f : 0.0f; + output[0] = input_value1[0] > input_value2[0] ? 1.0f : 0.0f; - clampIfNeeded(output); + clamp_if_needed(output); } -void MathModuloOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathModuloOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; + float input_value1[4]; + float input_value2[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); - if (inputValue2[0] == 0) { + if (input_value2[0] == 0) { output[0] = 0.0; } else { - output[0] = fmod(inputValue1[0], inputValue2[0]); + output[0] = fmod(input_value1[0], input_value2[0]); } - clampIfNeeded(output); + clamp_if_needed(output); } void MathModuloOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -600,18 +603,18 @@ void MathModuloOperation::update_memory_buffer_partial(BuffersIterator<float> &i } } -void MathAbsoluteOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathAbsoluteOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; + float input_value1[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); - output[0] = fabs(inputValue1[0]); + output[0] = fabs(input_value1[0]); - clampIfNeeded(output); + clamp_if_needed(output); } void MathAbsoluteOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -622,18 +625,18 @@ void MathAbsoluteOperation::update_memory_buffer_partial(BuffersIterator<float> } } -void MathRadiansOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathRadiansOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; + float input_value1[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); - output[0] = DEG2RADF(inputValue1[0]); + output[0] = DEG2RADF(input_value1[0]); - clampIfNeeded(output); + clamp_if_needed(output); } void MathRadiansOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -644,18 +647,18 @@ void MathRadiansOperation::update_memory_buffer_partial(BuffersIterator<float> & } } -void MathDegreesOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathDegreesOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; + float input_value1[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); - output[0] = RAD2DEGF(inputValue1[0]); + output[0] = RAD2DEGF(input_value1[0]); - clampIfNeeded(output); + clamp_if_needed(output); } void MathDegreesOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -666,20 +669,20 @@ void MathDegreesOperation::update_memory_buffer_partial(BuffersIterator<float> & } } -void MathArcTan2Operation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathArcTan2Operation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; + float input_value1[4]; + float input_value2[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); - output[0] = atan2(inputValue1[0], inputValue2[0]); + output[0] = atan2(input_value1[0], input_value2[0]); - clampIfNeeded(output); + clamp_if_needed(output); } void MathArcTan2Operation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -690,18 +693,18 @@ void MathArcTan2Operation::update_memory_buffer_partial(BuffersIterator<float> & } } -void MathFloorOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathFloorOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; + float input_value1[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); - output[0] = floor(inputValue1[0]); + output[0] = floor(input_value1[0]); - clampIfNeeded(output); + clamp_if_needed(output); } void MathFloorOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -712,18 +715,18 @@ void MathFloorOperation::update_memory_buffer_partial(BuffersIterator<float> &it } } -void MathCeilOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathCeilOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; + float input_value1[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); - output[0] = ceil(inputValue1[0]); + output[0] = ceil(input_value1[0]); - clampIfNeeded(output); + clamp_if_needed(output); } void MathCeilOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -734,18 +737,18 @@ void MathCeilOperation::update_memory_buffer_partial(BuffersIterator<float> &it) } } -void MathFractOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathFractOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; + float input_value1[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); - output[0] = inputValue1[0] - floor(inputValue1[0]); + output[0] = input_value1[0] - floor(input_value1[0]); - clampIfNeeded(output); + clamp_if_needed(output); } void MathFractOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -756,23 +759,23 @@ void MathFractOperation::update_memory_buffer_partial(BuffersIterator<float> &it } } -void MathSqrtOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathSqrtOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; + float input_value1[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); - if (inputValue1[0] > 0) { - output[0] = sqrt(inputValue1[0]); + if (input_value1[0] > 0) { + output[0] = sqrt(input_value1[0]); } else { output[0] = 0.0f; } - clampIfNeeded(output); + clamp_if_needed(output); } void MathSqrtOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -783,23 +786,23 @@ void MathSqrtOperation::update_memory_buffer_partial(BuffersIterator<float> &it) } } -void MathInverseSqrtOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathInverseSqrtOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; + float input_value1[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); - if (inputValue1[0] > 0) { - output[0] = 1.0f / sqrt(inputValue1[0]); + if (input_value1[0] > 0) { + output[0] = 1.0f / sqrt(input_value1[0]); } else { output[0] = 0.0f; } - clampIfNeeded(output); + clamp_if_needed(output); } void MathInverseSqrtOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -810,18 +813,18 @@ void MathInverseSqrtOperation::update_memory_buffer_partial(BuffersIterator<floa } } -void MathSignOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathSignOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; + float input_value1[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); - output[0] = compatible_signf(inputValue1[0]); + output[0] = compatible_signf(input_value1[0]); - clampIfNeeded(output); + clamp_if_needed(output); } void MathSignOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -832,18 +835,18 @@ void MathSignOperation::update_memory_buffer_partial(BuffersIterator<float> &it) } } -void MathExponentOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathExponentOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; + float input_value1[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); - output[0] = expf(inputValue1[0]); + output[0] = expf(input_value1[0]); - clampIfNeeded(output); + clamp_if_needed(output); } void MathExponentOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -854,18 +857,18 @@ void MathExponentOperation::update_memory_buffer_partial(BuffersIterator<float> } } -void MathTruncOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathTruncOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; + float input_value1[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); - output[0] = (inputValue1[0] >= 0.0f) ? floor(inputValue1[0]) : ceil(inputValue1[0]); + output[0] = (input_value1[0] >= 0.0f) ? floor(input_value1[0]) : ceil(input_value1[0]); - clampIfNeeded(output); + clamp_if_needed(output); } void MathTruncOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -877,25 +880,25 @@ void MathTruncOperation::update_memory_buffer_partial(BuffersIterator<float> &it } } -void MathSnapOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathSnapOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; + float input_value1[4]; + float input_value2[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); - if (inputValue1[0] == 0 || inputValue2[0] == 0) { /* We don't want to divide by zero. */ + if (input_value1[0] == 0 || input_value2[0] == 0) { /* We don't want to divide by zero. */ output[0] = 0.0f; } else { - output[0] = floorf(inputValue1[0] / inputValue2[0]) * inputValue2[0]; + output[0] = floorf(input_value1[0] / input_value2[0]) * input_value2[0]; } - clampIfNeeded(output); + clamp_if_needed(output); } void MathSnapOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -913,22 +916,22 @@ void MathSnapOperation::update_memory_buffer_partial(BuffersIterator<float> &it) } } -void MathWrapOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathWrapOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; - float inputValue3[4]; + float input_value1[4]; + float input_value2[4]; + float input_value3[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); - inputValue3Operation_->readSampled(inputValue3, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); + input_value3_operation_->read_sampled(input_value3, x, y, sampler); - output[0] = wrapf(inputValue1[0], inputValue2[0], inputValue3[0]); + output[0] = wrapf(input_value1[0], input_value2[0], input_value3[0]); - clampIfNeeded(output); + clamp_if_needed(output); } void MathWrapOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -939,20 +942,20 @@ void MathWrapOperation::update_memory_buffer_partial(BuffersIterator<float> &it) } } -void MathPingpongOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathPingpongOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; + float input_value1[4]; + float input_value2[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); - output[0] = pingpongf(inputValue1[0], inputValue2[0]); + output[0] = pingpongf(input_value1[0], input_value2[0]); - clampIfNeeded(output); + clamp_if_needed(output); } void MathPingpongOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -963,23 +966,23 @@ void MathPingpongOperation::update_memory_buffer_partial(BuffersIterator<float> } } -void MathCompareOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathCompareOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; - float inputValue3[4]; + float input_value1[4]; + float input_value2[4]; + float input_value3[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); - inputValue3Operation_->readSampled(inputValue3, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); + input_value3_operation_->read_sampled(input_value3, x, y, sampler); - output[0] = (fabsf(inputValue1[0] - inputValue2[0]) <= MAX2(inputValue3[0], 1e-5f)) ? 1.0f : - 0.0f; + output[0] = (fabsf(input_value1[0] - input_value2[0]) <= MAX2(input_value3[0], 1e-5f)) ? 1.0f : + 0.0f; - clampIfNeeded(output); + clamp_if_needed(output); } void MathCompareOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -990,22 +993,22 @@ void MathCompareOperation::update_memory_buffer_partial(BuffersIterator<float> & } } -void MathMultiplyAddOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathMultiplyAddOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; - float inputValue3[4]; + float input_value1[4]; + float input_value2[4]; + float input_value3[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); - inputValue3Operation_->readSampled(inputValue3, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); + input_value3_operation_->read_sampled(input_value3, x, y, sampler); - output[0] = inputValue1[0] * inputValue2[0] + inputValue3[0]; + output[0] = input_value1[0] * input_value2[0] + input_value3[0]; - clampIfNeeded(output); + clamp_if_needed(output); } void MathMultiplyAddOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -1016,22 +1019,22 @@ void MathMultiplyAddOperation::update_memory_buffer_partial(BuffersIterator<floa } } -void MathSmoothMinOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathSmoothMinOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; - float inputValue3[4]; + float input_value1[4]; + float input_value2[4]; + float input_value3[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); - inputValue3Operation_->readSampled(inputValue3, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); + input_value3_operation_->read_sampled(input_value3, x, y, sampler); - output[0] = smoothminf(inputValue1[0], inputValue2[0], inputValue3[0]); + output[0] = smoothminf(input_value1[0], input_value2[0], input_value3[0]); - clampIfNeeded(output); + clamp_if_needed(output); } void MathSmoothMinOperation::update_memory_buffer_partial(BuffersIterator<float> &it) @@ -1042,22 +1045,22 @@ void MathSmoothMinOperation::update_memory_buffer_partial(BuffersIterator<float> } } -void MathSmoothMaxOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MathSmoothMaxOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue1[4]; - float inputValue2[4]; - float inputValue3[4]; + float input_value1[4]; + float input_value2[4]; + float input_value3[4]; - inputValue1Operation_->readSampled(inputValue1, x, y, sampler); - inputValue2Operation_->readSampled(inputValue2, x, y, sampler); - inputValue3Operation_->readSampled(inputValue3, x, y, sampler); + input_value1_operation_->read_sampled(input_value1, x, y, sampler); + input_value2_operation_->read_sampled(input_value2, x, y, sampler); + input_value3_operation_->read_sampled(input_value3, x, y, sampler); - output[0] = -smoothminf(-inputValue1[0], -inputValue2[0], inputValue3[0]); + output[0] = -smoothminf(-input_value1[0], -input_value2[0], input_value3[0]); - clampIfNeeded(output); + clamp_if_needed(output); } void MathSmoothMaxOperation::update_memory_buffer_partial(BuffersIterator<float> &it) diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.h b/source/blender/compositor/operations/COM_MathBaseOperation.h index fcb735720b2..dc5a16ba4a1 100644 --- a/source/blender/compositor/operations/COM_MathBaseOperation.h +++ b/source/blender/compositor/operations/COM_MathBaseOperation.h @@ -29,13 +29,13 @@ namespace blender::compositor { class MathBaseOperation : public MultiThreadedOperation { protected: /** - * Prefetched reference to the inputProgram + * Prefetched reference to the input_program */ - SocketReader *inputValue1Operation_; - SocketReader *inputValue2Operation_; - SocketReader *inputValue3Operation_; + SocketReader *input_value1_operation_; + SocketReader *input_value2_operation_; + SocketReader *input_value3_operation_; - bool useClamp_; + bool use_clamp_; protected: /** @@ -44,11 +44,11 @@ class MathBaseOperation : public MultiThreadedOperation { MathBaseOperation(); /* TODO(manzanilla): to be removed with tiled implementation. */ - void clampIfNeeded(float color[4]); + void clamp_if_needed(float color[4]); float clamp_when_enabled(float value) { - if (useClamp_) { + if (use_clamp_) { return CLAMPIS(value, 0.0f, 1.0f); } return value; @@ -56,7 +56,7 @@ class MathBaseOperation : public MultiThreadedOperation { void clamp_when_enabled(float *out) { - if (useClamp_) { + if (use_clamp_) { CLAMP(*out, 0.0f, 1.0f); } } @@ -65,21 +65,21 @@ class MathBaseOperation : public MultiThreadedOperation { /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; /** * Determine resolution */ void determine_canvas(const rcti &preferred_area, rcti &r_area) override; - void setUseClamp(bool value) + void set_use_clamp(bool value) { - useClamp_ = value; + use_clamp_ = value; } void update_memory_buffer_partial(MemoryBuffer *output, @@ -104,40 +104,40 @@ class MathFunctor2Operation : public MathBaseOperation { class MathAddOperation : public MathFunctor2Operation<std::plus> { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathSubtractOperation : public MathFunctor2Operation<std::minus> { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathMultiplyOperation : public MathFunctor2Operation<std::multiplies> { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathDivideOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; }; class MathSineOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; }; class MathCosineOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; }; class MathTangentOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -145,21 +145,21 @@ class MathTangentOperation : public MathBaseOperation { class MathHyperbolicSineOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; }; class MathHyperbolicCosineOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; }; class MathHyperbolicTangentOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -167,72 +167,72 @@ class MathHyperbolicTangentOperation : public MathBaseOperation { class MathArcSineOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; }; class MathArcCosineOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; }; class MathArcTangentOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; }; class MathPowerOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; }; class MathLogarithmOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; }; class MathMinimumOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; }; class MathMaximumOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; }; class MathRoundOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; }; class MathLessThanOperation : public MathFunctor2Operation<std::less> { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathGreaterThanOperation : public MathFunctor2Operation<std::greater> { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MathModuloOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -240,7 +240,7 @@ class MathModuloOperation : public MathBaseOperation { class MathAbsoluteOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -248,7 +248,7 @@ class MathAbsoluteOperation : public MathBaseOperation { class MathRadiansOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -256,7 +256,7 @@ class MathRadiansOperation : public MathBaseOperation { class MathDegreesOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -264,7 +264,7 @@ class MathDegreesOperation : public MathBaseOperation { class MathArcTan2Operation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -272,7 +272,7 @@ class MathArcTan2Operation : public MathBaseOperation { class MathFloorOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -280,7 +280,7 @@ class MathFloorOperation : public MathBaseOperation { class MathCeilOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -288,7 +288,7 @@ class MathCeilOperation : public MathBaseOperation { class MathFractOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -296,7 +296,7 @@ class MathFractOperation : public MathBaseOperation { class MathSqrtOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -304,7 +304,7 @@ class MathSqrtOperation : public MathBaseOperation { class MathInverseSqrtOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -312,7 +312,7 @@ class MathInverseSqrtOperation : public MathBaseOperation { class MathSignOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -320,7 +320,7 @@ class MathSignOperation : public MathBaseOperation { class MathExponentOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -328,7 +328,7 @@ class MathExponentOperation : public MathBaseOperation { class MathTruncOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -336,7 +336,7 @@ class MathTruncOperation : public MathBaseOperation { class MathSnapOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -344,7 +344,7 @@ class MathSnapOperation : public MathBaseOperation { class MathWrapOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -352,7 +352,7 @@ class MathWrapOperation : public MathBaseOperation { class MathPingpongOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -360,7 +360,7 @@ class MathPingpongOperation : public MathBaseOperation { class MathCompareOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -368,7 +368,7 @@ class MathCompareOperation : public MathBaseOperation { class MathMultiplyAddOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -376,7 +376,7 @@ class MathMultiplyAddOperation : public MathBaseOperation { class MathSmoothMinOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; @@ -384,7 +384,7 @@ class MathSmoothMinOperation : public MathBaseOperation { class MathSmoothMaxOperation : public MathBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_partial(BuffersIterator<float> &it) override; diff --git a/source/blender/compositor/operations/COM_MixOperation.cc b/source/blender/compositor/operations/COM_MixOperation.cc index 216dbc3a701..a40979fc1e6 100644 --- a/source/blender/compositor/operations/COM_MixOperation.cc +++ b/source/blender/compositor/operations/COM_MixOperation.cc @@ -24,44 +24,47 @@ namespace blender::compositor { MixBaseOperation::MixBaseOperation() { - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); - inputValueOperation_ = nullptr; - inputColor1Operation_ = nullptr; - inputColor2Operation_ = nullptr; - this->setUseValueAlphaMultiply(false); - this->setUseClamp(false); + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); + input_value_operation_ = nullptr; + input_color1_operation_ = nullptr; + input_color2_operation_ = nullptr; + this->set_use_value_alpha_multiply(false); + this->set_use_clamp(false); flags.can_be_constant = true; } -void MixBaseOperation::initExecution() +void MixBaseOperation::init_execution() { - inputValueOperation_ = this->getInputSocketReader(0); - inputColor1Operation_ = this->getInputSocketReader(1); - inputColor2Operation_ = this->getInputSocketReader(2); + input_value_operation_ = this->get_input_socket_reader(0); + input_color1_operation_ = this->get_input_socket_reader(1); + input_color2_operation_ = this->get_input_socket_reader(2); } -void MixBaseOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) +void MixBaseOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor1[4]; - float inputColor2[4]; - float inputValue[4]; + float input_color1[4]; + float input_color2[4]; + float input_value[4]; - inputValueOperation_->readSampled(inputValue, x, y, sampler); - inputColor1Operation_->readSampled(inputColor1, x, y, sampler); - inputColor2Operation_->readSampled(inputColor2, x, y, sampler); + input_value_operation_->read_sampled(input_value, x, y, sampler); + input_color1_operation_->read_sampled(input_color1, x, y, sampler); + input_color2_operation_->read_sampled(input_color2, x, y, sampler); - float value = inputValue[0]; - if (this->useValueAlphaMultiply()) { - value *= inputColor2[3]; + float value = input_value[0]; + if (this->use_value_alpha_multiply()) { + value *= input_color2[3]; } float valuem = 1.0f - value; - output[0] = valuem * (inputColor1[0]) + value * (inputColor2[0]); - output[1] = valuem * (inputColor1[1]) + value * (inputColor2[1]); - output[2] = valuem * (inputColor1[2]) + value * (inputColor2[2]); - output[3] = inputColor1[3]; + output[0] = valuem * (input_color1[0]) + value * (input_color2[0]); + output[1] = valuem * (input_color1[1]) + value * (input_color2[1]); + output[2] = valuem * (input_color1[2]) + value * (input_color2[2]); + output[3] = input_color1[3]; } void MixBaseOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) @@ -69,13 +72,13 @@ void MixBaseOperation::determine_canvas(const rcti &preferred_area, rcti &r_area NodeOperationInput *socket; rcti temp_area; - socket = this->getInputSocket(1); + socket = this->get_input_socket(1); bool determined = socket->determine_canvas(COM_AREA_NONE, temp_area); if (determined) { this->set_canvas_input_index(1); } else { - socket = this->getInputSocket(2); + socket = this->get_input_socket(2); determined = socket->determine_canvas(COM_AREA_NONE, temp_area); if (determined) { this->set_canvas_input_index(2); @@ -87,11 +90,11 @@ void MixBaseOperation::determine_canvas(const rcti &preferred_area, rcti &r_area NodeOperation::determine_canvas(preferred_area, r_area); } -void MixBaseOperation::deinitExecution() +void MixBaseOperation::deinit_execution() { - inputValueOperation_ = nullptr; - inputColor1Operation_ = nullptr; - inputColor2Operation_ = nullptr; + input_value_operation_ = nullptr; + input_color1_operation_ = nullptr; + input_color2_operation_ = nullptr; } void MixBaseOperation::update_memory_buffer_partial(MemoryBuffer *output, @@ -121,7 +124,7 @@ void MixBaseOperation::update_memory_buffer_row(PixelCursor &p) { while (p.out < p.row_end) { float value = p.value[0]; - if (this->useValueAlphaMultiply()) { + if (this->use_value_alpha_multiply()) { value *= p.color2[3]; } const float value_m = 1.0f - value; @@ -135,33 +138,36 @@ void MixBaseOperation::update_memory_buffer_row(PixelCursor &p) /* ******** Mix Add Operation ******** */ -void MixAddOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) +void MixAddOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor1[4]; - float inputColor2[4]; - float inputValue[4]; + float input_color1[4]; + float input_color2[4]; + float input_value[4]; - inputValueOperation_->readSampled(inputValue, x, y, sampler); - inputColor1Operation_->readSampled(inputColor1, x, y, sampler); - inputColor2Operation_->readSampled(inputColor2, x, y, sampler); + input_value_operation_->read_sampled(input_value, x, y, sampler); + input_color1_operation_->read_sampled(input_color1, x, y, sampler); + input_color2_operation_->read_sampled(input_color2, x, y, sampler); - float value = inputValue[0]; - if (this->useValueAlphaMultiply()) { - value *= inputColor2[3]; + float value = input_value[0]; + if (this->use_value_alpha_multiply()) { + value *= input_color2[3]; } - output[0] = inputColor1[0] + value * inputColor2[0]; - output[1] = inputColor1[1] + value * inputColor2[1]; - output[2] = inputColor1[2] + value * inputColor2[2]; - output[3] = inputColor1[3]; + output[0] = input_color1[0] + value * input_color2[0]; + output[1] = input_color1[1] + value * input_color2[1]; + output[2] = input_color1[2] + value * input_color2[2]; + output[3] = input_color1[3]; - clampIfNeeded(output); + clamp_if_needed(output); } void MixAddOperation::update_memory_buffer_row(PixelCursor &p) { while (p.out < p.row_end) { float value = p.value[0]; - if (this->useValueAlphaMultiply()) { + if (this->use_value_alpha_multiply()) { value *= p.color2[3]; } p.out[0] = p.color1[0] + value * p.color2[0]; @@ -169,45 +175,45 @@ void MixAddOperation::update_memory_buffer_row(PixelCursor &p) p.out[2] = p.color1[2] + value * p.color2[2]; p.out[3] = p.color1[3]; - clampIfNeeded(p.out); + clamp_if_needed(p.out); p.next(); } } /* ******** Mix Blend Operation ******** */ -void MixBlendOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MixBlendOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor1[4]; - float inputColor2[4]; - float inputValue[4]; + float input_color1[4]; + float input_color2[4]; + float input_value[4]; float value; - inputValueOperation_->readSampled(inputValue, x, y, sampler); - inputColor1Operation_->readSampled(inputColor1, x, y, sampler); - inputColor2Operation_->readSampled(inputColor2, x, y, sampler); - value = inputValue[0]; + input_value_operation_->read_sampled(input_value, x, y, sampler); + input_color1_operation_->read_sampled(input_color1, x, y, sampler); + input_color2_operation_->read_sampled(input_color2, x, y, sampler); + value = input_value[0]; - if (this->useValueAlphaMultiply()) { - value *= inputColor2[3]; + if (this->use_value_alpha_multiply()) { + value *= input_color2[3]; } float valuem = 1.0f - value; - output[0] = valuem * (inputColor1[0]) + value * (inputColor2[0]); - output[1] = valuem * (inputColor1[1]) + value * (inputColor2[1]); - output[2] = valuem * (inputColor1[2]) + value * (inputColor2[2]); - output[3] = inputColor1[3]; + output[0] = valuem * (input_color1[0]) + value * (input_color2[0]); + output[1] = valuem * (input_color1[1]) + value * (input_color2[1]); + output[2] = valuem * (input_color1[2]) + value * (input_color2[2]); + output[3] = input_color1[3]; - clampIfNeeded(output); + clamp_if_needed(output); } void MixBlendOperation::update_memory_buffer_row(PixelCursor &p) { while (p.out < p.row_end) { float value = p.value[0]; - if (this->useValueAlphaMultiply()) { + if (this->use_value_alpha_multiply()) { value *= p.color2[3]; } float value_m = 1.0f - value; @@ -216,39 +222,39 @@ void MixBlendOperation::update_memory_buffer_row(PixelCursor &p) p.out[2] = value_m * p.color1[2] + value * p.color2[2]; p.out[3] = p.color1[3]; - clampIfNeeded(p.out); + clamp_if_needed(p.out); p.next(); } } /* ******** Mix Burn Operation ******** */ -void MixColorBurnOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MixColorBurnOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor1[4]; - float inputColor2[4]; - float inputValue[4]; + float input_color1[4]; + float input_color2[4]; + float input_value[4]; float tmp; - inputValueOperation_->readSampled(inputValue, x, y, sampler); - inputColor1Operation_->readSampled(inputColor1, x, y, sampler); - inputColor2Operation_->readSampled(inputColor2, x, y, sampler); + input_value_operation_->read_sampled(input_value, x, y, sampler); + input_color1_operation_->read_sampled(input_color1, x, y, sampler); + input_color2_operation_->read_sampled(input_color2, x, y, sampler); - float value = inputValue[0]; - if (this->useValueAlphaMultiply()) { - value *= inputColor2[3]; + float value = input_value[0]; + if (this->use_value_alpha_multiply()) { + value *= input_color2[3]; } float valuem = 1.0f - value; - tmp = valuem + value * inputColor2[0]; + tmp = valuem + value * input_color2[0]; if (tmp <= 0.0f) { output[0] = 0.0f; } else { - tmp = 1.0f - (1.0f - inputColor1[0]) / tmp; + tmp = 1.0f - (1.0f - input_color1[0]) / tmp; if (tmp < 0.0f) { output[0] = 0.0f; } @@ -260,12 +266,12 @@ void MixColorBurnOperation::executePixelSampled(float output[4], } } - tmp = valuem + value * inputColor2[1]; + tmp = valuem + value * input_color2[1]; if (tmp <= 0.0f) { output[1] = 0.0f; } else { - tmp = 1.0f - (1.0f - inputColor1[1]) / tmp; + tmp = 1.0f - (1.0f - input_color1[1]) / tmp; if (tmp < 0.0f) { output[1] = 0.0f; } @@ -277,12 +283,12 @@ void MixColorBurnOperation::executePixelSampled(float output[4], } } - tmp = valuem + value * inputColor2[2]; + tmp = valuem + value * input_color2[2]; if (tmp <= 0.0f) { output[2] = 0.0f; } else { - tmp = 1.0f - (1.0f - inputColor1[2]) / tmp; + tmp = 1.0f - (1.0f - input_color1[2]) / tmp; if (tmp < 0.0f) { output[2] = 0.0f; } @@ -294,16 +300,16 @@ void MixColorBurnOperation::executePixelSampled(float output[4], } } - output[3] = inputColor1[3]; + output[3] = input_color1[3]; - clampIfNeeded(output); + clamp_if_needed(output); } void MixColorBurnOperation::update_memory_buffer_row(PixelCursor &p) { while (p.out < p.row_end) { float value = p.value[0]; - if (this->useValueAlphaMultiply()) { + if (this->use_value_alpha_multiply()) { value *= p.color2[3]; } const float value_m = 1.0f - value; @@ -336,56 +342,56 @@ void MixColorBurnOperation::update_memory_buffer_row(PixelCursor &p) } p.out[3] = p.color1[3]; - clampIfNeeded(p.out); + clamp_if_needed(p.out); p.next(); } } /* ******** Mix Color Operation ******** */ -void MixColorOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MixColorOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor1[4]; - float inputColor2[4]; - float inputValue[4]; + float input_color1[4]; + float input_color2[4]; + float input_value[4]; - inputValueOperation_->readSampled(inputValue, x, y, sampler); - inputColor1Operation_->readSampled(inputColor1, x, y, sampler); - inputColor2Operation_->readSampled(inputColor2, x, y, sampler); + input_value_operation_->read_sampled(input_value, x, y, sampler); + input_color1_operation_->read_sampled(input_color1, x, y, sampler); + input_color2_operation_->read_sampled(input_color2, x, y, sampler); - float value = inputValue[0]; - if (this->useValueAlphaMultiply()) { - value *= inputColor2[3]; + float value = input_value[0]; + if (this->use_value_alpha_multiply()) { + value *= input_color2[3]; } float valuem = 1.0f - value; float colH, colS, colV; - rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV); + rgb_to_hsv(input_color2[0], input_color2[1], input_color2[2], &colH, &colS, &colV); if (colS != 0.0f) { float rH, rS, rV; float tmpr, tmpg, tmpb; - rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV); + rgb_to_hsv(input_color1[0], input_color1[1], input_color1[2], &rH, &rS, &rV); hsv_to_rgb(colH, colS, rV, &tmpr, &tmpg, &tmpb); - output[0] = (valuem * inputColor1[0]) + (value * tmpr); - output[1] = (valuem * inputColor1[1]) + (value * tmpg); - output[2] = (valuem * inputColor1[2]) + (value * tmpb); + output[0] = (valuem * input_color1[0]) + (value * tmpr); + output[1] = (valuem * input_color1[1]) + (value * tmpg); + output[2] = (valuem * input_color1[2]) + (value * tmpb); } else { - copy_v3_v3(output, inputColor1); + copy_v3_v3(output, input_color1); } - output[3] = inputColor1[3]; + output[3] = input_color1[3]; - clampIfNeeded(output); + clamp_if_needed(output); } void MixColorOperation::update_memory_buffer_row(PixelCursor &p) { while (p.out < p.row_end) { float value = p.value[0]; - if (this->useValueAlphaMultiply()) { + if (this->use_value_alpha_multiply()) { value *= p.color2[3]; } const float value_m = 1.0f - value; @@ -406,44 +412,44 @@ void MixColorOperation::update_memory_buffer_row(PixelCursor &p) } p.out[3] = p.color1[3]; - clampIfNeeded(p.out); + clamp_if_needed(p.out); p.next(); } } /* ******** Mix Darken Operation ******** */ -void MixDarkenOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MixDarkenOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor1[4]; - float inputColor2[4]; - float inputValue[4]; + float input_color1[4]; + float input_color2[4]; + float input_value[4]; - inputValueOperation_->readSampled(inputValue, x, y, sampler); - inputColor1Operation_->readSampled(inputColor1, x, y, sampler); - inputColor2Operation_->readSampled(inputColor2, x, y, sampler); + input_value_operation_->read_sampled(input_value, x, y, sampler); + input_color1_operation_->read_sampled(input_color1, x, y, sampler); + input_color2_operation_->read_sampled(input_color2, x, y, sampler); - float value = inputValue[0]; - if (this->useValueAlphaMultiply()) { - value *= inputColor2[3]; + float value = input_value[0]; + if (this->use_value_alpha_multiply()) { + value *= input_color2[3]; } float valuem = 1.0f - value; - output[0] = min_ff(inputColor1[0], inputColor2[0]) * value + inputColor1[0] * valuem; - output[1] = min_ff(inputColor1[1], inputColor2[1]) * value + inputColor1[1] * valuem; - output[2] = min_ff(inputColor1[2], inputColor2[2]) * value + inputColor1[2] * valuem; - output[3] = inputColor1[3]; + output[0] = min_ff(input_color1[0], input_color2[0]) * value + input_color1[0] * valuem; + output[1] = min_ff(input_color1[1], input_color2[1]) * value + input_color1[1] * valuem; + output[2] = min_ff(input_color1[2], input_color2[2]) * value + input_color1[2] * valuem; + output[3] = input_color1[3]; - clampIfNeeded(output); + clamp_if_needed(output); } void MixDarkenOperation::update_memory_buffer_row(PixelCursor &p) { while (p.out < p.row_end) { float value = p.value[0]; - if (this->useValueAlphaMultiply()) { + if (this->use_value_alpha_multiply()) { value *= p.color2[3]; } float value_m = 1.0f - value; @@ -452,44 +458,44 @@ void MixDarkenOperation::update_memory_buffer_row(PixelCursor &p) p.out[2] = min_ff(p.color1[2], p.color2[2]) * value + p.color1[2] * value_m; p.out[3] = p.color1[3]; - clampIfNeeded(p.out); + clamp_if_needed(p.out); p.next(); } } /* ******** Mix Difference Operation ******** */ -void MixDifferenceOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MixDifferenceOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor1[4]; - float inputColor2[4]; - float inputValue[4]; + float input_color1[4]; + float input_color2[4]; + float input_value[4]; - inputValueOperation_->readSampled(inputValue, x, y, sampler); - inputColor1Operation_->readSampled(inputColor1, x, y, sampler); - inputColor2Operation_->readSampled(inputColor2, x, y, sampler); + input_value_operation_->read_sampled(input_value, x, y, sampler); + input_color1_operation_->read_sampled(input_color1, x, y, sampler); + input_color2_operation_->read_sampled(input_color2, x, y, sampler); - float value = inputValue[0]; - if (this->useValueAlphaMultiply()) { - value *= inputColor2[3]; + float value = input_value[0]; + if (this->use_value_alpha_multiply()) { + value *= input_color2[3]; } float valuem = 1.0f - value; - output[0] = valuem * inputColor1[0] + value * fabsf(inputColor1[0] - inputColor2[0]); - output[1] = valuem * inputColor1[1] + value * fabsf(inputColor1[1] - inputColor2[1]); - output[2] = valuem * inputColor1[2] + value * fabsf(inputColor1[2] - inputColor2[2]); - output[3] = inputColor1[3]; + output[0] = valuem * input_color1[0] + value * fabsf(input_color1[0] - input_color2[0]); + output[1] = valuem * input_color1[1] + value * fabsf(input_color1[1] - input_color2[1]); + output[2] = valuem * input_color1[2] + value * fabsf(input_color1[2] - input_color2[2]); + output[3] = input_color1[3]; - clampIfNeeded(output); + clamp_if_needed(output); } void MixDifferenceOperation::update_memory_buffer_row(PixelCursor &p) { while (p.out < p.row_end) { float value = p.value[0]; - if (this->useValueAlphaMultiply()) { + if (this->use_value_alpha_multiply()) { value *= p.color2[3]; } const float value_m = 1.0f - value; @@ -498,61 +504,61 @@ void MixDifferenceOperation::update_memory_buffer_row(PixelCursor &p) p.out[2] = value_m * p.color1[2] + value * fabsf(p.color1[2] - p.color2[2]); p.out[3] = p.color1[3]; - clampIfNeeded(p.out); + clamp_if_needed(p.out); p.next(); } } /* ******** Mix Difference Operation ******** */ -void MixDivideOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MixDivideOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor1[4]; - float inputColor2[4]; - float inputValue[4]; + float input_color1[4]; + float input_color2[4]; + float input_value[4]; - inputValueOperation_->readSampled(inputValue, x, y, sampler); - inputColor1Operation_->readSampled(inputColor1, x, y, sampler); - inputColor2Operation_->readSampled(inputColor2, x, y, sampler); + input_value_operation_->read_sampled(input_value, x, y, sampler); + input_color1_operation_->read_sampled(input_color1, x, y, sampler); + input_color2_operation_->read_sampled(input_color2, x, y, sampler); - float value = inputValue[0]; - if (this->useValueAlphaMultiply()) { - value *= inputColor2[3]; + float value = input_value[0]; + if (this->use_value_alpha_multiply()) { + value *= input_color2[3]; } float valuem = 1.0f - value; - if (inputColor2[0] != 0.0f) { - output[0] = valuem * (inputColor1[0]) + value * (inputColor1[0]) / inputColor2[0]; + if (input_color2[0] != 0.0f) { + output[0] = valuem * (input_color1[0]) + value * (input_color1[0]) / input_color2[0]; } else { output[0] = 0.0f; } - if (inputColor2[1] != 0.0f) { - output[1] = valuem * (inputColor1[1]) + value * (inputColor1[1]) / inputColor2[1]; + if (input_color2[1] != 0.0f) { + output[1] = valuem * (input_color1[1]) + value * (input_color1[1]) / input_color2[1]; } else { output[1] = 0.0f; } - if (inputColor2[2] != 0.0f) { - output[2] = valuem * (inputColor1[2]) + value * (inputColor1[2]) / inputColor2[2]; + if (input_color2[2] != 0.0f) { + output[2] = valuem * (input_color1[2]) + value * (input_color1[2]) / input_color2[2]; } else { output[2] = 0.0f; } - output[3] = inputColor1[3]; + output[3] = input_color1[3]; - clampIfNeeded(output); + clamp_if_needed(output); } void MixDivideOperation::update_memory_buffer_row(PixelCursor &p) { while (p.out < p.row_end) { float value = p.value[0]; - if (this->useValueAlphaMultiply()) { + if (this->use_value_alpha_multiply()) { value *= p.color2[3]; } const float value_m = 1.0f - value; @@ -578,39 +584,39 @@ void MixDivideOperation::update_memory_buffer_row(PixelCursor &p) p.out[3] = p.color1[3]; - clampIfNeeded(p.out); + clamp_if_needed(p.out); p.next(); } } /* ******** Mix Dodge Operation ******** */ -void MixDodgeOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MixDodgeOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor1[4]; - float inputColor2[4]; - float inputValue[4]; + float input_color1[4]; + float input_color2[4]; + float input_value[4]; float tmp; - inputValueOperation_->readSampled(inputValue, x, y, sampler); - inputColor1Operation_->readSampled(inputColor1, x, y, sampler); - inputColor2Operation_->readSampled(inputColor2, x, y, sampler); + input_value_operation_->read_sampled(input_value, x, y, sampler); + input_color1_operation_->read_sampled(input_color1, x, y, sampler); + input_color2_operation_->read_sampled(input_color2, x, y, sampler); - float value = inputValue[0]; - if (this->useValueAlphaMultiply()) { - value *= inputColor2[3]; + float value = input_value[0]; + if (this->use_value_alpha_multiply()) { + value *= input_color2[3]; } - if (inputColor1[0] != 0.0f) { - tmp = 1.0f - value * inputColor2[0]; + if (input_color1[0] != 0.0f) { + tmp = 1.0f - value * input_color2[0]; if (tmp <= 0.0f) { output[0] = 1.0f; } else { - tmp = inputColor1[0] / tmp; + tmp = input_color1[0] / tmp; if (tmp > 1.0f) { output[0] = 1.0f; } @@ -623,13 +629,13 @@ void MixDodgeOperation::executePixelSampled(float output[4], output[0] = 0.0f; } - if (inputColor1[1] != 0.0f) { - tmp = 1.0f - value * inputColor2[1]; + if (input_color1[1] != 0.0f) { + tmp = 1.0f - value * input_color2[1]; if (tmp <= 0.0f) { output[1] = 1.0f; } else { - tmp = inputColor1[1] / tmp; + tmp = input_color1[1] / tmp; if (tmp > 1.0f) { output[1] = 1.0f; } @@ -642,13 +648,13 @@ void MixDodgeOperation::executePixelSampled(float output[4], output[1] = 0.0f; } - if (inputColor1[2] != 0.0f) { - tmp = 1.0f - value * inputColor2[2]; + if (input_color1[2] != 0.0f) { + tmp = 1.0f - value * input_color2[2]; if (tmp <= 0.0f) { output[2] = 1.0f; } else { - tmp = inputColor1[2] / tmp; + tmp = input_color1[2] / tmp; if (tmp > 1.0f) { output[2] = 1.0f; } @@ -661,16 +667,16 @@ void MixDodgeOperation::executePixelSampled(float output[4], output[2] = 0.0f; } - output[3] = inputColor1[3]; + output[3] = input_color1[3]; - clampIfNeeded(output); + clamp_if_needed(output); } void MixDodgeOperation::update_memory_buffer_row(PixelCursor &p) { while (p.out < p.row_end) { float value = p.value[0]; - if (this->useValueAlphaMultiply()) { + if (this->use_value_alpha_multiply()) { value *= p.color2[3]; } @@ -719,27 +725,27 @@ void MixDodgeOperation::update_memory_buffer_row(PixelCursor &p) p.out[3] = p.color1[3]; - clampIfNeeded(p.out); + clamp_if_needed(p.out); p.next(); } } /* ******** Mix Glare Operation ******** */ -void MixGlareOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MixGlareOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor1[4]; - float inputColor2[4]; - float inputValue[4]; + float input_color1[4]; + float input_color2[4]; + float input_value[4]; float value, input_weight, glare_weight; - inputValueOperation_->readSampled(inputValue, x, y, sampler); - inputColor1Operation_->readSampled(inputColor1, x, y, sampler); - inputColor2Operation_->readSampled(inputColor2, x, y, sampler); - value = inputValue[0]; + input_value_operation_->read_sampled(input_value, x, y, sampler); + input_color1_operation_->read_sampled(input_color1, x, y, sampler); + input_color2_operation_->read_sampled(input_color2, x, y, sampler); + value = input_value[0]; /* Linear interpolation between 3 cases: * value=-1:output=input value=0:output=input+glare value=1:output=glare */ @@ -751,12 +757,12 @@ void MixGlareOperation::executePixelSampled(float output[4], input_weight = 1.0f - value; glare_weight = 1.0f; } - output[0] = input_weight * MAX2(inputColor1[0], 0.0f) + glare_weight * inputColor2[0]; - output[1] = input_weight * MAX2(inputColor1[1], 0.0f) + glare_weight * inputColor2[1]; - output[2] = input_weight * MAX2(inputColor1[2], 0.0f) + glare_weight * inputColor2[2]; - output[3] = inputColor1[3]; + output[0] = input_weight * MAX2(input_color1[0], 0.0f) + glare_weight * input_color2[0]; + output[1] = input_weight * MAX2(input_color1[1], 0.0f) + glare_weight * input_color2[1]; + output[2] = input_weight * MAX2(input_color1[2], 0.0f) + glare_weight * input_color2[2]; + output[3] = input_color1[3]; - clampIfNeeded(output); + clamp_if_needed(output); } void MixGlareOperation::update_memory_buffer_row(PixelCursor &p) @@ -781,53 +787,56 @@ void MixGlareOperation::update_memory_buffer_row(PixelCursor &p) p.out[2] = input_weight * MAX2(p.color1[2], 0.0f) + glare_weight * p.color2[2]; p.out[3] = p.color1[3]; - clampIfNeeded(p.out); + clamp_if_needed(p.out); p.next(); } } /* ******** Mix Hue Operation ******** */ -void MixHueOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) +void MixHueOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor1[4]; - float inputColor2[4]; - float inputValue[4]; + float input_color1[4]; + float input_color2[4]; + float input_value[4]; - inputValueOperation_->readSampled(inputValue, x, y, sampler); - inputColor1Operation_->readSampled(inputColor1, x, y, sampler); - inputColor2Operation_->readSampled(inputColor2, x, y, sampler); + input_value_operation_->read_sampled(input_value, x, y, sampler); + input_color1_operation_->read_sampled(input_color1, x, y, sampler); + input_color2_operation_->read_sampled(input_color2, x, y, sampler); - float value = inputValue[0]; - if (this->useValueAlphaMultiply()) { - value *= inputColor2[3]; + float value = input_value[0]; + if (this->use_value_alpha_multiply()) { + value *= input_color2[3]; } float valuem = 1.0f - value; float colH, colS, colV; - rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV); + rgb_to_hsv(input_color2[0], input_color2[1], input_color2[2], &colH, &colS, &colV); if (colS != 0.0f) { float rH, rS, rV; float tmpr, tmpg, tmpb; - rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV); + rgb_to_hsv(input_color1[0], input_color1[1], input_color1[2], &rH, &rS, &rV); hsv_to_rgb(colH, rS, rV, &tmpr, &tmpg, &tmpb); - output[0] = valuem * (inputColor1[0]) + value * tmpr; - output[1] = valuem * (inputColor1[1]) + value * tmpg; - output[2] = valuem * (inputColor1[2]) + value * tmpb; + output[0] = valuem * (input_color1[0]) + value * tmpr; + output[1] = valuem * (input_color1[1]) + value * tmpg; + output[2] = valuem * (input_color1[2]) + value * tmpb; } else { - copy_v3_v3(output, inputColor1); + copy_v3_v3(output, input_color1); } - output[3] = inputColor1[3]; + output[3] = input_color1[3]; - clampIfNeeded(output); + clamp_if_needed(output); } void MixHueOperation::update_memory_buffer_row(PixelCursor &p) { while (p.out < p.row_end) { float value = p.value[0]; - if (this->useValueAlphaMultiply()) { + if (this->use_value_alpha_multiply()) { value *= p.color2[3]; } const float value_m = 1.0f - value; @@ -848,62 +857,62 @@ void MixHueOperation::update_memory_buffer_row(PixelCursor &p) } p.out[3] = p.color1[3]; - clampIfNeeded(p.out); + clamp_if_needed(p.out); p.next(); } } /* ******** Mix Lighten Operation ******** */ -void MixLightenOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MixLightenOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor1[4]; - float inputColor2[4]; - float inputValue[4]; + float input_color1[4]; + float input_color2[4]; + float input_value[4]; - inputValueOperation_->readSampled(inputValue, x, y, sampler); - inputColor1Operation_->readSampled(inputColor1, x, y, sampler); - inputColor2Operation_->readSampled(inputColor2, x, y, sampler); + input_value_operation_->read_sampled(input_value, x, y, sampler); + input_color1_operation_->read_sampled(input_color1, x, y, sampler); + input_color2_operation_->read_sampled(input_color2, x, y, sampler); - float value = inputValue[0]; - if (this->useValueAlphaMultiply()) { - value *= inputColor2[3]; + float value = input_value[0]; + if (this->use_value_alpha_multiply()) { + value *= input_color2[3]; } float tmp; - tmp = value * inputColor2[0]; - if (tmp > inputColor1[0]) { + tmp = value * input_color2[0]; + if (tmp > input_color1[0]) { output[0] = tmp; } else { - output[0] = inputColor1[0]; + output[0] = input_color1[0]; } - tmp = value * inputColor2[1]; - if (tmp > inputColor1[1]) { + tmp = value * input_color2[1]; + if (tmp > input_color1[1]) { output[1] = tmp; } else { - output[1] = inputColor1[1]; + output[1] = input_color1[1]; } - tmp = value * inputColor2[2]; - if (tmp > inputColor1[2]) { + tmp = value * input_color2[2]; + if (tmp > input_color1[2]) { output[2] = tmp; } else { - output[2] = inputColor1[2]; + output[2] = input_color1[2]; } - output[3] = inputColor1[3]; + output[3] = input_color1[3]; - clampIfNeeded(output); + clamp_if_needed(output); } void MixLightenOperation::update_memory_buffer_row(PixelCursor &p) { while (p.out < p.row_end) { float value = p.value[0]; - if (this->useValueAlphaMultiply()) { + if (this->use_value_alpha_multiply()) { value *= p.color2[3]; } @@ -918,59 +927,59 @@ void MixLightenOperation::update_memory_buffer_row(PixelCursor &p) p.out[3] = p.color1[3]; - clampIfNeeded(p.out); + clamp_if_needed(p.out); p.next(); } } /* ******** Mix Linear Light Operation ******** */ -void MixLinearLightOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MixLinearLightOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor1[4]; - float inputColor2[4]; - float inputValue[4]; + float input_color1[4]; + float input_color2[4]; + float input_value[4]; - inputValueOperation_->readSampled(inputValue, x, y, sampler); - inputColor1Operation_->readSampled(inputColor1, x, y, sampler); - inputColor2Operation_->readSampled(inputColor2, x, y, sampler); + input_value_operation_->read_sampled(input_value, x, y, sampler); + input_color1_operation_->read_sampled(input_color1, x, y, sampler); + input_color2_operation_->read_sampled(input_color2, x, y, sampler); - float value = inputValue[0]; - if (this->useValueAlphaMultiply()) { - value *= inputColor2[3]; + float value = input_value[0]; + if (this->use_value_alpha_multiply()) { + value *= input_color2[3]; } - if (inputColor2[0] > 0.5f) { - output[0] = inputColor1[0] + value * (2.0f * (inputColor2[0] - 0.5f)); + if (input_color2[0] > 0.5f) { + output[0] = input_color1[0] + value * (2.0f * (input_color2[0] - 0.5f)); } else { - output[0] = inputColor1[0] + value * (2.0f * (inputColor2[0]) - 1.0f); + output[0] = input_color1[0] + value * (2.0f * (input_color2[0]) - 1.0f); } - if (inputColor2[1] > 0.5f) { - output[1] = inputColor1[1] + value * (2.0f * (inputColor2[1] - 0.5f)); + if (input_color2[1] > 0.5f) { + output[1] = input_color1[1] + value * (2.0f * (input_color2[1] - 0.5f)); } else { - output[1] = inputColor1[1] + value * (2.0f * (inputColor2[1]) - 1.0f); + output[1] = input_color1[1] + value * (2.0f * (input_color2[1]) - 1.0f); } - if (inputColor2[2] > 0.5f) { - output[2] = inputColor1[2] + value * (2.0f * (inputColor2[2] - 0.5f)); + if (input_color2[2] > 0.5f) { + output[2] = input_color1[2] + value * (2.0f * (input_color2[2] - 0.5f)); } else { - output[2] = inputColor1[2] + value * (2.0f * (inputColor2[2]) - 1.0f); + output[2] = input_color1[2] + value * (2.0f * (input_color2[2]) - 1.0f); } - output[3] = inputColor1[3]; + output[3] = input_color1[3]; - clampIfNeeded(output); + clamp_if_needed(output); } void MixLinearLightOperation::update_memory_buffer_row(PixelCursor &p) { while (p.out < p.row_end) { float value = p.value[0]; - if (this->useValueAlphaMultiply()) { + if (this->use_value_alpha_multiply()) { value *= p.color2[3]; } if (p.color2[0] > 0.5f) { @@ -994,44 +1003,44 @@ void MixLinearLightOperation::update_memory_buffer_row(PixelCursor &p) p.out[3] = p.color1[3]; - clampIfNeeded(p.out); + clamp_if_needed(p.out); p.next(); } } /* ******** Mix Multiply Operation ******** */ -void MixMultiplyOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MixMultiplyOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor1[4]; - float inputColor2[4]; - float inputValue[4]; + float input_color1[4]; + float input_color2[4]; + float input_value[4]; - inputValueOperation_->readSampled(inputValue, x, y, sampler); - inputColor1Operation_->readSampled(inputColor1, x, y, sampler); - inputColor2Operation_->readSampled(inputColor2, x, y, sampler); + input_value_operation_->read_sampled(input_value, x, y, sampler); + input_color1_operation_->read_sampled(input_color1, x, y, sampler); + input_color2_operation_->read_sampled(input_color2, x, y, sampler); - float value = inputValue[0]; - if (this->useValueAlphaMultiply()) { - value *= inputColor2[3]; + float value = input_value[0]; + if (this->use_value_alpha_multiply()) { + value *= input_color2[3]; } float valuem = 1.0f - value; - output[0] = inputColor1[0] * (valuem + value * inputColor2[0]); - output[1] = inputColor1[1] * (valuem + value * inputColor2[1]); - output[2] = inputColor1[2] * (valuem + value * inputColor2[2]); - output[3] = inputColor1[3]; + output[0] = input_color1[0] * (valuem + value * input_color2[0]); + output[1] = input_color1[1] * (valuem + value * input_color2[1]); + output[2] = input_color1[2] * (valuem + value * input_color2[2]); + output[3] = input_color1[3]; - clampIfNeeded(output); + clamp_if_needed(output); } void MixMultiplyOperation::update_memory_buffer_row(PixelCursor &p) { while (p.out < p.row_end) { float value = p.value[0]; - if (this->useValueAlphaMultiply()) { + if (this->use_value_alpha_multiply()) { value *= p.color2[3]; } const float value_m = 1.0f - value; @@ -1041,61 +1050,64 @@ void MixMultiplyOperation::update_memory_buffer_row(PixelCursor &p) p.out[3] = p.color1[3]; - clampIfNeeded(p.out); + clamp_if_needed(p.out); p.next(); } } /* ******** Mix Overlay Operation ******** */ -void MixOverlayOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MixOverlayOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor1[4]; - float inputColor2[4]; - float inputValue[4]; + float input_color1[4]; + float input_color2[4]; + float input_value[4]; - inputValueOperation_->readSampled(inputValue, x, y, sampler); - inputColor1Operation_->readSampled(inputColor1, x, y, sampler); - inputColor2Operation_->readSampled(inputColor2, x, y, sampler); + input_value_operation_->read_sampled(input_value, x, y, sampler); + input_color1_operation_->read_sampled(input_color1, x, y, sampler); + input_color2_operation_->read_sampled(input_color2, x, y, sampler); - float value = inputValue[0]; - if (this->useValueAlphaMultiply()) { - value *= inputColor2[3]; + float value = input_value[0]; + if (this->use_value_alpha_multiply()) { + value *= input_color2[3]; } float valuem = 1.0f - value; - if (inputColor1[0] < 0.5f) { - output[0] = inputColor1[0] * (valuem + 2.0f * value * inputColor2[0]); + if (input_color1[0] < 0.5f) { + output[0] = input_color1[0] * (valuem + 2.0f * value * input_color2[0]); } else { - output[0] = 1.0f - (valuem + 2.0f * value * (1.0f - inputColor2[0])) * (1.0f - inputColor1[0]); + output[0] = 1.0f - + (valuem + 2.0f * value * (1.0f - input_color2[0])) * (1.0f - input_color1[0]); } - if (inputColor1[1] < 0.5f) { - output[1] = inputColor1[1] * (valuem + 2.0f * value * inputColor2[1]); + if (input_color1[1] < 0.5f) { + output[1] = input_color1[1] * (valuem + 2.0f * value * input_color2[1]); } else { - output[1] = 1.0f - (valuem + 2.0f * value * (1.0f - inputColor2[1])) * (1.0f - inputColor1[1]); + output[1] = 1.0f - + (valuem + 2.0f * value * (1.0f - input_color2[1])) * (1.0f - input_color1[1]); } - if (inputColor1[2] < 0.5f) { - output[2] = inputColor1[2] * (valuem + 2.0f * value * inputColor2[2]); + if (input_color1[2] < 0.5f) { + output[2] = input_color1[2] * (valuem + 2.0f * value * input_color2[2]); } else { - output[2] = 1.0f - (valuem + 2.0f * value * (1.0f - inputColor2[2])) * (1.0f - inputColor1[2]); + output[2] = 1.0f - + (valuem + 2.0f * value * (1.0f - input_color2[2])) * (1.0f - input_color1[2]); } - output[3] = inputColor1[3]; + output[3] = input_color1[3]; - clampIfNeeded(output); + clamp_if_needed(output); } void MixOverlayOperation::update_memory_buffer_row(PixelCursor &p) { while (p.out < p.row_end) { float value = p.value[0]; - if (this->useValueAlphaMultiply()) { + if (this->use_value_alpha_multiply()) { value *= p.color2[3]; } const float value_m = 1.0f - value; @@ -1120,53 +1132,53 @@ void MixOverlayOperation::update_memory_buffer_row(PixelCursor &p) p.out[3] = p.color1[3]; - clampIfNeeded(p.out); + clamp_if_needed(p.out); p.next(); } } /* ******** Mix Saturation Operation ******** */ -void MixSaturationOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MixSaturationOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor1[4]; - float inputColor2[4]; - float inputValue[4]; + float input_color1[4]; + float input_color2[4]; + float input_value[4]; - inputValueOperation_->readSampled(inputValue, x, y, sampler); - inputColor1Operation_->readSampled(inputColor1, x, y, sampler); - inputColor2Operation_->readSampled(inputColor2, x, y, sampler); + input_value_operation_->read_sampled(input_value, x, y, sampler); + input_color1_operation_->read_sampled(input_color1, x, y, sampler); + input_color2_operation_->read_sampled(input_color2, x, y, sampler); - float value = inputValue[0]; - if (this->useValueAlphaMultiply()) { - value *= inputColor2[3]; + float value = input_value[0]; + if (this->use_value_alpha_multiply()) { + value *= input_color2[3]; } float valuem = 1.0f - value; float rH, rS, rV; - rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV); + rgb_to_hsv(input_color1[0], input_color1[1], input_color1[2], &rH, &rS, &rV); if (rS != 0.0f) { float colH, colS, colV; - rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV); + rgb_to_hsv(input_color2[0], input_color2[1], input_color2[2], &colH, &colS, &colV); hsv_to_rgb(rH, (valuem * rS + value * colS), rV, &output[0], &output[1], &output[2]); } else { - copy_v3_v3(output, inputColor1); + copy_v3_v3(output, input_color1); } - output[3] = inputColor1[3]; + output[3] = input_color1[3]; - clampIfNeeded(output); + clamp_if_needed(output); } void MixSaturationOperation::update_memory_buffer_row(PixelCursor &p) { while (p.out < p.row_end) { float value = p.value[0]; - if (this->useValueAlphaMultiply()) { + if (this->use_value_alpha_multiply()) { value *= p.color2[3]; } const float value_m = 1.0f - value; @@ -1184,45 +1196,45 @@ void MixSaturationOperation::update_memory_buffer_row(PixelCursor &p) p.out[3] = p.color1[3]; - clampIfNeeded(p.out); + clamp_if_needed(p.out); p.next(); } } /* ******** Mix Screen Operation ******** */ -void MixScreenOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MixScreenOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor1[4]; - float inputColor2[4]; - float inputValue[4]; + float input_color1[4]; + float input_color2[4]; + float input_value[4]; - inputValueOperation_->readSampled(inputValue, x, y, sampler); - inputColor1Operation_->readSampled(inputColor1, x, y, sampler); - inputColor2Operation_->readSampled(inputColor2, x, y, sampler); + input_value_operation_->read_sampled(input_value, x, y, sampler); + input_color1_operation_->read_sampled(input_color1, x, y, sampler); + input_color2_operation_->read_sampled(input_color2, x, y, sampler); - float value = inputValue[0]; - if (this->useValueAlphaMultiply()) { - value *= inputColor2[3]; + float value = input_value[0]; + if (this->use_value_alpha_multiply()) { + value *= input_color2[3]; } float valuem = 1.0f - value; - output[0] = 1.0f - (valuem + value * (1.0f - inputColor2[0])) * (1.0f - inputColor1[0]); - output[1] = 1.0f - (valuem + value * (1.0f - inputColor2[1])) * (1.0f - inputColor1[1]); - output[2] = 1.0f - (valuem + value * (1.0f - inputColor2[2])) * (1.0f - inputColor1[2]); - output[3] = inputColor1[3]; + output[0] = 1.0f - (valuem + value * (1.0f - input_color2[0])) * (1.0f - input_color1[0]); + output[1] = 1.0f - (valuem + value * (1.0f - input_color2[1])) * (1.0f - input_color1[1]); + output[2] = 1.0f - (valuem + value * (1.0f - input_color2[2])) * (1.0f - input_color1[2]); + output[3] = input_color1[3]; - clampIfNeeded(output); + clamp_if_needed(output); } void MixScreenOperation::update_memory_buffer_row(PixelCursor &p) { while (p.out < p.row_end) { float value = p.value[0]; - if (this->useValueAlphaMultiply()) { + if (this->use_value_alpha_multiply()) { value *= p.color2[3]; } const float value_m = 1.0f - value; @@ -1232,57 +1244,57 @@ void MixScreenOperation::update_memory_buffer_row(PixelCursor &p) p.out[2] = 1.0f - (value_m + value * (1.0f - p.color2[2])) * (1.0f - p.color1[2]); p.out[3] = p.color1[3]; - clampIfNeeded(p.out); + clamp_if_needed(p.out); p.next(); } } /* ******** Mix Soft Light Operation ******** */ -void MixSoftLightOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MixSoftLightOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor1[4]; - float inputColor2[4]; - float inputValue[4]; + float input_color1[4]; + float input_color2[4]; + float input_value[4]; - inputValueOperation_->readSampled(inputValue, x, y, sampler); - inputColor1Operation_->readSampled(inputColor1, x, y, sampler); - inputColor2Operation_->readSampled(inputColor2, x, y, sampler); + input_value_operation_->read_sampled(input_value, x, y, sampler); + input_color1_operation_->read_sampled(input_color1, x, y, sampler); + input_color2_operation_->read_sampled(input_color2, x, y, sampler); - float value = inputValue[0]; - if (this->useValueAlphaMultiply()) { - value *= inputColor2[3]; + float value = input_value[0]; + if (this->use_value_alpha_multiply()) { + value *= input_color2[3]; } float valuem = 1.0f - value; float scr, scg, scb; /* first calculate non-fac based Screen mix */ - scr = 1.0f - (1.0f - inputColor2[0]) * (1.0f - inputColor1[0]); - scg = 1.0f - (1.0f - inputColor2[1]) * (1.0f - inputColor1[1]); - scb = 1.0f - (1.0f - inputColor2[2]) * (1.0f - inputColor1[2]); - - output[0] = valuem * (inputColor1[0]) + - value * (((1.0f - inputColor1[0]) * inputColor2[0] * (inputColor1[0])) + - (inputColor1[0] * scr)); - output[1] = valuem * (inputColor1[1]) + - value * (((1.0f - inputColor1[1]) * inputColor2[1] * (inputColor1[1])) + - (inputColor1[1] * scg)); - output[2] = valuem * (inputColor1[2]) + - value * (((1.0f - inputColor1[2]) * inputColor2[2] * (inputColor1[2])) + - (inputColor1[2] * scb)); - output[3] = inputColor1[3]; - - clampIfNeeded(output); + scr = 1.0f - (1.0f - input_color2[0]) * (1.0f - input_color1[0]); + scg = 1.0f - (1.0f - input_color2[1]) * (1.0f - input_color1[1]); + scb = 1.0f - (1.0f - input_color2[2]) * (1.0f - input_color1[2]); + + output[0] = valuem * (input_color1[0]) + + value * (((1.0f - input_color1[0]) * input_color2[0] * (input_color1[0])) + + (input_color1[0] * scr)); + output[1] = valuem * (input_color1[1]) + + value * (((1.0f - input_color1[1]) * input_color2[1] * (input_color1[1])) + + (input_color1[1] * scg)); + output[2] = valuem * (input_color1[2]) + + value * (((1.0f - input_color1[2]) * input_color2[2] * (input_color1[2])) + + (input_color1[2] * scb)); + output[3] = input_color1[3]; + + clamp_if_needed(output); } void MixSoftLightOperation::update_memory_buffer_row(PixelCursor &p) { while (p.out < p.row_end) { float value = p.value[0]; - if (this->useValueAlphaMultiply()) { + if (this->use_value_alpha_multiply()) { value *= p.color2[3]; } const float value_m = 1.0f - value; @@ -1301,43 +1313,43 @@ void MixSoftLightOperation::update_memory_buffer_row(PixelCursor &p) value * ((1.0f - p.color1[2]) * p.color2[2] * p.color1[2] + p.color1[2] * scb); p.out[3] = p.color1[3]; - clampIfNeeded(p.out); + clamp_if_needed(p.out); p.next(); } } /* ******** Mix Subtract Operation ******** */ -void MixSubtractOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MixSubtractOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor1[4]; - float inputColor2[4]; - float inputValue[4]; + float input_color1[4]; + float input_color2[4]; + float input_value[4]; - inputValueOperation_->readSampled(inputValue, x, y, sampler); - inputColor1Operation_->readSampled(inputColor1, x, y, sampler); - inputColor2Operation_->readSampled(inputColor2, x, y, sampler); + input_value_operation_->read_sampled(input_value, x, y, sampler); + input_color1_operation_->read_sampled(input_color1, x, y, sampler); + input_color2_operation_->read_sampled(input_color2, x, y, sampler); - float value = inputValue[0]; - if (this->useValueAlphaMultiply()) { - value *= inputColor2[3]; + float value = input_value[0]; + if (this->use_value_alpha_multiply()) { + value *= input_color2[3]; } - output[0] = inputColor1[0] - value * (inputColor2[0]); - output[1] = inputColor1[1] - value * (inputColor2[1]); - output[2] = inputColor1[2] - value * (inputColor2[2]); - output[3] = inputColor1[3]; + output[0] = input_color1[0] - value * (input_color2[0]); + output[1] = input_color1[1] - value * (input_color2[1]); + output[2] = input_color1[2] - value * (input_color2[2]); + output[3] = input_color1[3]; - clampIfNeeded(output); + clamp_if_needed(output); } void MixSubtractOperation::update_memory_buffer_row(PixelCursor &p) { while (p.out < p.row_end) { float value = p.value[0]; - if (this->useValueAlphaMultiply()) { + if (this->use_value_alpha_multiply()) { value *= p.color2[3]; } p.out[0] = p.color1[0] - value * p.color2[0]; @@ -1345,47 +1357,47 @@ void MixSubtractOperation::update_memory_buffer_row(PixelCursor &p) p.out[2] = p.color1[2] - value * p.color2[2]; p.out[3] = p.color1[3]; - clampIfNeeded(p.out); + clamp_if_needed(p.out); p.next(); } } /* ******** Mix Value Operation ******** */ -void MixValueOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MixValueOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputColor1[4]; - float inputColor2[4]; - float inputValue[4]; + float input_color1[4]; + float input_color2[4]; + float input_value[4]; - inputValueOperation_->readSampled(inputValue, x, y, sampler); - inputColor1Operation_->readSampled(inputColor1, x, y, sampler); - inputColor2Operation_->readSampled(inputColor2, x, y, sampler); + input_value_operation_->read_sampled(input_value, x, y, sampler); + input_color1_operation_->read_sampled(input_color1, x, y, sampler); + input_color2_operation_->read_sampled(input_color2, x, y, sampler); - float value = inputValue[0]; - if (this->useValueAlphaMultiply()) { - value *= inputColor2[3]; + float value = input_value[0]; + if (this->use_value_alpha_multiply()) { + value *= input_color2[3]; } float valuem = 1.0f - value; float rH, rS, rV; float colH, colS, colV; - rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV); - rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV); + rgb_to_hsv(input_color1[0], input_color1[1], input_color1[2], &rH, &rS, &rV); + rgb_to_hsv(input_color2[0], input_color2[1], input_color2[2], &colH, &colS, &colV); hsv_to_rgb(rH, rS, (valuem * rV + value * colV), &output[0], &output[1], &output[2]); - output[3] = inputColor1[3]; + output[3] = input_color1[3]; - clampIfNeeded(output); + clamp_if_needed(output); } void MixValueOperation::update_memory_buffer_row(PixelCursor &p) { while (p.out < p.row_end) { float value = p.value[0]; - if (this->useValueAlphaMultiply()) { + if (this->use_value_alpha_multiply()) { value *= p.color2[3]; } float value_m = 1.0f - value; @@ -1397,7 +1409,7 @@ void MixValueOperation::update_memory_buffer_row(PixelCursor &p) hsv_to_rgb(rH, rS, (value_m * rV + value * colV), &p.out[0], &p.out[1], &p.out[2]); p.out[3] = p.color1[3]; - clampIfNeeded(p.out); + clamp_if_needed(p.out); p.next(); } } diff --git a/source/blender/compositor/operations/COM_MixOperation.h b/source/blender/compositor/operations/COM_MixOperation.h index 0efc98617a6..bf5639f43a3 100644 --- a/source/blender/compositor/operations/COM_MixOperation.h +++ b/source/blender/compositor/operations/COM_MixOperation.h @@ -51,17 +51,17 @@ class MixBaseOperation : public MultiThreadedOperation { }; /** - * Prefetched reference to the inputProgram + * Prefetched reference to the input_program */ - SocketReader *inputValueOperation_; - SocketReader *inputColor1Operation_; - SocketReader *inputColor2Operation_; - bool valueAlphaMultiply_; - bool useClamp_; + SocketReader *input_value_operation_; + SocketReader *input_color1_operation_; + SocketReader *input_color2_operation_; + bool value_alpha_multiply_; + bool use_clamp_; - inline void clampIfNeeded(float color[4]) + inline void clamp_if_needed(float color[4]) { - if (useClamp_) { + if (use_clamp_) { clamp_v4(color, 0.0f, 1.0f); } } @@ -75,31 +75,31 @@ class MixBaseOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; void determine_canvas(const rcti &preferred_area, rcti &r_area) override; - void setUseValueAlphaMultiply(const bool value) + void set_use_value_alpha_multiply(const bool value) { - valueAlphaMultiply_ = value; + value_alpha_multiply_ = value; } - inline bool useValueAlphaMultiply() + inline bool use_value_alpha_multiply() { - return valueAlphaMultiply_; + return value_alpha_multiply_; } - void setUseClamp(bool value) + void set_use_clamp(bool value) { - useClamp_ = value; + use_clamp_ = value; } void update_memory_buffer_partial(MemoryBuffer *output, @@ -112,7 +112,7 @@ class MixBaseOperation : public MultiThreadedOperation { class MixAddOperation : public MixBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_row(PixelCursor &p) override; @@ -120,7 +120,7 @@ class MixAddOperation : public MixBaseOperation { class MixBlendOperation : public MixBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_row(PixelCursor &p) override; @@ -128,7 +128,7 @@ class MixBlendOperation : public MixBaseOperation { class MixColorBurnOperation : public MixBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_row(PixelCursor &p) override; @@ -136,7 +136,7 @@ class MixColorBurnOperation : public MixBaseOperation { class MixColorOperation : public MixBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_row(PixelCursor &p) override; @@ -144,7 +144,7 @@ class MixColorOperation : public MixBaseOperation { class MixDarkenOperation : public MixBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_row(PixelCursor &p) override; @@ -152,7 +152,7 @@ class MixDarkenOperation : public MixBaseOperation { class MixDifferenceOperation : public MixBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_row(PixelCursor &p) override; @@ -160,7 +160,7 @@ class MixDifferenceOperation : public MixBaseOperation { class MixDivideOperation : public MixBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_row(PixelCursor &p) override; @@ -168,7 +168,7 @@ class MixDivideOperation : public MixBaseOperation { class MixDodgeOperation : public MixBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_row(PixelCursor &p) override; @@ -176,7 +176,7 @@ class MixDodgeOperation : public MixBaseOperation { class MixGlareOperation : public MixBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_row(PixelCursor &p) override; @@ -184,7 +184,7 @@ class MixGlareOperation : public MixBaseOperation { class MixHueOperation : public MixBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_row(PixelCursor &p) override; @@ -192,7 +192,7 @@ class MixHueOperation : public MixBaseOperation { class MixLightenOperation : public MixBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_row(PixelCursor &p) override; @@ -200,7 +200,7 @@ class MixLightenOperation : public MixBaseOperation { class MixLinearLightOperation : public MixBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_row(PixelCursor &p) override; @@ -208,7 +208,7 @@ class MixLinearLightOperation : public MixBaseOperation { class MixMultiplyOperation : public MixBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_row(PixelCursor &p) override; @@ -216,7 +216,7 @@ class MixMultiplyOperation : public MixBaseOperation { class MixOverlayOperation : public MixBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_row(PixelCursor &p) override; @@ -224,7 +224,7 @@ class MixOverlayOperation : public MixBaseOperation { class MixSaturationOperation : public MixBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_row(PixelCursor &p) override; @@ -232,7 +232,7 @@ class MixSaturationOperation : public MixBaseOperation { class MixScreenOperation : public MixBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_row(PixelCursor &p) override; @@ -240,7 +240,7 @@ class MixScreenOperation : public MixBaseOperation { class MixSoftLightOperation : public MixBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_row(PixelCursor &p) override; @@ -248,7 +248,7 @@ class MixSoftLightOperation : public MixBaseOperation { class MixSubtractOperation : public MixBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_row(PixelCursor &p) override; @@ -256,7 +256,7 @@ class MixSubtractOperation : public MixBaseOperation { class MixValueOperation : public MixBaseOperation { public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; protected: void update_memory_buffer_row(PixelCursor &p) override; diff --git a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cc b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cc index c43a552f1ce..1765012d873 100644 --- a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cc +++ b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cc @@ -25,7 +25,7 @@ namespace blender::compositor { MovieClipAttributeOperation::MovieClipAttributeOperation() { - this->addOutputSocket(DataType::Value); + this->add_output_socket(DataType::Value); framenumber_ = 0; attribute_ = MCA_X; invert_ = false; @@ -34,7 +34,7 @@ MovieClipAttributeOperation::MovieClipAttributeOperation() stabilization_resolution_socket_ = nullptr; } -void MovieClipAttributeOperation::initExecution() +void MovieClipAttributeOperation::init_execution() { if (!is_value_calculated_) { calc_value(); @@ -56,12 +56,12 @@ void MovieClipAttributeOperation::calc_value() int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(clip_, framenumber_); NodeOperation &stabilization_operation = stabilization_resolution_socket_ ? - stabilization_resolution_socket_->getLink()->getOperation() : + stabilization_resolution_socket_->get_link()->get_operation() : *this; BKE_tracking_stabilization_data_get(clip_, clip_framenr, - stabilization_operation.getWidth(), - stabilization_operation.getHeight(), + stabilization_operation.get_width(), + stabilization_operation.get_height(), loc, &scale, &angle); @@ -89,10 +89,10 @@ void MovieClipAttributeOperation::calc_value() } } -void MovieClipAttributeOperation::executePixelSampled(float output[4], - float /*x*/, - float /*y*/, - PixelSampler /*sampler*/) +void MovieClipAttributeOperation::execute_pixel_sampled(float output[4], + float /*x*/, + float /*y*/, + PixelSampler /*sampler*/) { output[0] = value_; } diff --git a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h index 2df2b199107..9f333189811 100644 --- a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h +++ b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.h @@ -50,29 +50,29 @@ class MovieClipAttributeOperation : public ConstantOperation { */ MovieClipAttributeOperation(); - void initExecution() override; + void init_execution() override; /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void determine_canvas(const rcti &preferred_area, rcti &r_area) override; const float *get_constant_elem() override; - void setMovieClip(MovieClip *clip) + void set_movie_clip(MovieClip *clip) { clip_ = clip; } - void setFramenumber(int framenumber) + void set_framenumber(int framenumber) { framenumber_ = framenumber; } - void setAttribute(MovieClipAttribute attribute) + void set_attribute(MovieClipAttribute attribute) { attribute_ = attribute; } - void setInvert(bool invert) + void set_invert(bool invert) { invert_ = invert; } diff --git a/source/blender/compositor/operations/COM_MovieClipOperation.cc b/source/blender/compositor/operations/COM_MovieClipOperation.cc index 2803c707371..a73b408e3ff 100644 --- a/source/blender/compositor/operations/COM_MovieClipOperation.cc +++ b/source/blender/compositor/operations/COM_MovieClipOperation.cc @@ -27,30 +27,30 @@ namespace blender::compositor { MovieClipBaseOperation::MovieClipBaseOperation() { - movieClip_ = nullptr; - movieClipBuffer_ = nullptr; - movieClipUser_ = nullptr; - movieClipwidth_ = 0; - movieClipheight_ = 0; + movie_clip_ = nullptr; + movie_clip_buffer_ = nullptr; + movie_clip_user_ = nullptr; + movie_clipwidth_ = 0; + movie_clipheight_ = 0; framenumber_ = 0; } -void MovieClipBaseOperation::initExecution() +void MovieClipBaseOperation::init_execution() { - if (movieClip_) { - BKE_movieclip_user_set_frame(movieClipUser_, framenumber_); + if (movie_clip_) { + BKE_movieclip_user_set_frame(movie_clip_user_, framenumber_); ImBuf *ibuf; - if (cacheFrame_) { - ibuf = BKE_movieclip_get_ibuf(movieClip_, movieClipUser_); + if (cache_frame_) { + ibuf = BKE_movieclip_get_ibuf(movie_clip_, movie_clip_user_); } else { ibuf = BKE_movieclip_get_ibuf_flag( - movieClip_, movieClipUser_, movieClip_->flag, MOVIECLIP_CACHE_SKIP); + movie_clip_, movie_clip_user_, movie_clip_->flag, MOVIECLIP_CACHE_SKIP); } if (ibuf) { - movieClipBuffer_ = ibuf; + movie_clip_buffer_ = ibuf; if (ibuf->rect_float == nullptr || ibuf->userflags & IB_RECT_INVALID) { IMB_float_from_rect(ibuf); ibuf->userflags &= ~IB_RECT_INVALID; @@ -59,31 +59,31 @@ void MovieClipBaseOperation::initExecution() } } -void MovieClipBaseOperation::deinitExecution() +void MovieClipBaseOperation::deinit_execution() { - if (movieClipBuffer_) { - IMB_freeImBuf(movieClipBuffer_); + if (movie_clip_buffer_) { + IMB_freeImBuf(movie_clip_buffer_); - movieClipBuffer_ = nullptr; + movie_clip_buffer_ = nullptr; } } void MovieClipBaseOperation::determine_canvas(const rcti &UNUSED(preferred_area), rcti &r_area) { r_area = COM_AREA_NONE; - if (movieClip_) { + if (movie_clip_) { int width, height; - BKE_movieclip_get_size(movieClip_, movieClipUser_, &width, &height); + BKE_movieclip_get_size(movie_clip_, movie_clip_user_, &width, &height); BLI_rcti_init(&r_area, 0, width, 0, height); } } -void MovieClipBaseOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MovieClipBaseOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - ImBuf *ibuf = movieClipBuffer_; + ImBuf *ibuf = movie_clip_buffer_; if (ibuf == nullptr) { zero_v4(output); @@ -111,8 +111,8 @@ void MovieClipBaseOperation::update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span<MemoryBuffer *> UNUSED(inputs)) { - if (movieClipBuffer_) { - output->copy_from(movieClipBuffer_, area); + if (movie_clip_buffer_) { + output->copy_from(movie_clip_buffer_, area); } else { output->fill(area, COM_COLOR_TRANSPARENT); @@ -121,21 +121,21 @@ void MovieClipBaseOperation::update_memory_buffer_partial(MemoryBuffer *output, MovieClipOperation::MovieClipOperation() : MovieClipBaseOperation() { - this->addOutputSocket(DataType::Color); + this->add_output_socket(DataType::Color); } MovieClipAlphaOperation::MovieClipAlphaOperation() : MovieClipBaseOperation() { - this->addOutputSocket(DataType::Value); + this->add_output_socket(DataType::Value); } -void MovieClipAlphaOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MovieClipAlphaOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { float result[4]; - MovieClipBaseOperation::executePixelSampled(result, x, y, sampler); + MovieClipBaseOperation::execute_pixel_sampled(result, x, y, sampler); output[0] = result[3]; } @@ -143,8 +143,8 @@ void MovieClipAlphaOperation::update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span<MemoryBuffer *> UNUSED(inputs)) { - if (movieClipBuffer_) { - output->copy_from(movieClipBuffer_, area, 3, COM_DATA_TYPE_VALUE_CHANNELS, 0); + if (movie_clip_buffer_) { + output->copy_from(movie_clip_buffer_, area, 3, COM_DATA_TYPE_VALUE_CHANNELS, 0); } else { output->fill(area, COM_VALUE_ZERO); diff --git a/source/blender/compositor/operations/COM_MovieClipOperation.h b/source/blender/compositor/operations/COM_MovieClipOperation.h index 58cebba45d7..e576917df1b 100644 --- a/source/blender/compositor/operations/COM_MovieClipOperation.h +++ b/source/blender/compositor/operations/COM_MovieClipOperation.h @@ -30,13 +30,13 @@ namespace blender::compositor { */ class MovieClipBaseOperation : public MultiThreadedOperation { protected: - MovieClip *movieClip_; - MovieClipUser *movieClipUser_; - ImBuf *movieClipBuffer_; - int movieClipheight_; - int movieClipwidth_; + MovieClip *movie_clip_; + MovieClipUser *movie_clip_user_; + ImBuf *movie_clip_buffer_; + int movie_clipheight_; + int movie_clipwidth_; int framenumber_; - bool cacheFrame_; + bool cache_frame_; /** * Determine the output resolution. The resolution is retrieved from the Renderer @@ -46,26 +46,26 @@ class MovieClipBaseOperation : public MultiThreadedOperation { public: MovieClipBaseOperation(); - void initExecution() override; - void deinitExecution() override; - void setMovieClip(MovieClip *image) + void init_execution() override; + void deinit_execution() override; + void set_movie_clip(MovieClip *image) { - movieClip_ = image; + movie_clip_ = image; } - void setMovieClipUser(MovieClipUser *imageuser) + void set_movie_clip_user(MovieClipUser *imageuser) { - movieClipUser_ = imageuser; + movie_clip_user_ = imageuser; } - void setCacheFrame(bool value) + void set_cache_frame(bool value) { - cacheFrame_ = value; + cache_frame_ = value; } - void setFramenumber(int framenumber) + void set_framenumber(int framenumber) { framenumber_ = framenumber; } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, @@ -80,7 +80,7 @@ class MovieClipOperation : public MovieClipBaseOperation { class MovieClipAlphaOperation : public MovieClipBaseOperation { public: MovieClipAlphaOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.cc b/source/blender/compositor/operations/COM_MovieDistortionOperation.cc index 0cb0742dbee..d04a970bc03 100644 --- a/source/blender/compositor/operations/COM_MovieDistortionOperation.cc +++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.cc @@ -24,31 +24,31 @@ namespace blender::compositor { MovieDistortionOperation::MovieDistortionOperation(bool distortion) { - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); this->set_canvas_input_index(0); - inputOperation_ = nullptr; - movieClip_ = nullptr; + input_operation_ = nullptr; + movie_clip_ = nullptr; apply_ = distortion; } void MovieDistortionOperation::init_data() { - if (movieClip_) { - MovieTracking *tracking = &movieClip_->tracking; - MovieClipUser clipUser = {0}; + if (movie_clip_) { + MovieTracking *tracking = &movie_clip_->tracking; + MovieClipUser clip_user = {0}; int calibration_width, calibration_height; - BKE_movieclip_user_set_frame(&clipUser, framenumber_); - BKE_movieclip_get_size(movieClip_, &clipUser, &calibration_width, &calibration_height); + BKE_movieclip_user_set_frame(&clip_user, framenumber_); + BKE_movieclip_get_size(movie_clip_, &clip_user, &calibration_width, &calibration_height); float delta[2]; rcti full_frame; full_frame.xmin = full_frame.ymin = 0; - full_frame.xmax = this->getWidth(); - full_frame.ymax = this->getHeight(); + full_frame.xmax = this->get_width(); + full_frame.ymax = this->get_height(); BKE_tracking_max_distortion_delta_across_bound( - tracking, this->getWidth(), this->getHeight(), &full_frame, !apply_, delta); + tracking, this->get_width(), this->get_height(), &full_frame, !apply_, delta); /* 5 is just in case we didn't hit real max of distortion in * BKE_tracking_max_undistortion_delta_across_bound @@ -65,11 +65,11 @@ void MovieDistortionOperation::init_data() } } -void MovieDistortionOperation::initExecution() +void MovieDistortionOperation::init_execution() { - inputOperation_ = this->getInputSocketReader(0); - if (movieClip_) { - MovieTracking *tracking = &movieClip_->tracking; + input_operation_ = this->get_input_socket_reader(0); + if (movie_clip_) { + MovieTracking *tracking = &movie_clip_->tracking; distortion_ = BKE_tracking_distortion_new(tracking, calibration_width_, calibration_height_); } else { @@ -77,25 +77,25 @@ void MovieDistortionOperation::initExecution() } } -void MovieDistortionOperation::deinitExecution() +void MovieDistortionOperation::deinit_execution() { - inputOperation_ = nullptr; - movieClip_ = nullptr; + input_operation_ = nullptr; + movie_clip_ = nullptr; if (distortion_ != nullptr) { BKE_tracking_distortion_free(distortion_); } } -void MovieDistortionOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler /*sampler*/) +void MovieDistortionOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler /*sampler*/) { if (distortion_ != nullptr) { /* float overscan = 0.0f; */ const float pixel_aspect = pixel_aspect_; - const float w = (float)this->getWidth() /* / (1 + overscan) */; - const float h = (float)this->getHeight() /* / (1 + overscan) */; + const float w = (float)this->get_width() /* / (1 + overscan) */; + const float h = (float)this->get_height() /* / (1 + overscan) */; const float aspx = w / (float)calibration_width_; const float aspy = h / (float)calibration_height_; float in[2]; @@ -114,23 +114,22 @@ 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; - inputOperation_->readSampled(output, u, v, PixelSampler::Bilinear); + input_operation_->read_sampled(output, u, v, PixelSampler::Bilinear); } else { - inputOperation_->readSampled(output, x, y, PixelSampler::Bilinear); + input_operation_->read_sampled(output, x, y, PixelSampler::Bilinear); } } -bool MovieDistortionOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool MovieDistortionOperation::determine_depending_area_of_interest( + rcti *input, ReadBufferOperation *read_operation, rcti *output) { - rcti newInput; - newInput.xmin = input->xmin - margin_[0]; - newInput.ymin = input->ymin - margin_[1]; - newInput.xmax = input->xmax + margin_[0]; - newInput.ymax = input->ymax + margin_[1]; - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + rcti new_input; + new_input.xmin = input->xmin - margin_[0]; + new_input.ymin = input->ymin - margin_[1]; + new_input.xmax = input->xmax + margin_[0]; + new_input.ymax = input->ymax + margin_[1]; + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } void MovieDistortionOperation::get_area_of_interest(const int input_idx, @@ -157,8 +156,8 @@ void MovieDistortionOperation::update_memory_buffer_partial(MemoryBuffer *output /* `float overscan = 0.0f;` */ const float pixel_aspect = pixel_aspect_; - const float w = (float)this->getWidth() /* `/ (1 + overscan)` */; - const float h = (float)this->getHeight() /* `/ (1 + overscan)` */; + const float w = (float)this->get_width() /* `/ (1 + overscan)` */; + const float h = (float)this->get_height() /* `/ (1 + overscan)` */; const float aspx = w / (float)calibration_width_; const float aspy = h / (float)calibration_height_; float xy[2]; diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.h b/source/blender/compositor/operations/COM_MovieDistortionOperation.h index 3e728962bc3..cf430c74f30 100644 --- a/source/blender/compositor/operations/COM_MovieDistortionOperation.h +++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.h @@ -28,8 +28,8 @@ namespace blender::compositor { class MovieDistortionOperation : public MultiThreadedOperation { private: - SocketReader *inputOperation_; - MovieClip *movieClip_; + SocketReader *input_operation_; + MovieClip *movie_clip_; int margin_[2]; protected: @@ -42,23 +42,23 @@ class MovieDistortionOperation : public MultiThreadedOperation { public: MovieDistortionOperation(bool distortion); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void init_data() override; - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; - void setMovieClip(MovieClip *clip) + void set_movie_clip(MovieClip *clip) { - movieClip_ = clip; + movie_clip_ = clip; } - void setFramenumber(int framenumber) + void set_framenumber(int framenumber) { framenumber_ = framenumber; } - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; void update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_MultilayerImageOperation.cc b/source/blender/compositor/operations/COM_MultilayerImageOperation.cc index 0209ea0e18c..5549cd1e937 100644 --- a/source/blender/compositor/operations/COM_MultilayerImageOperation.cc +++ b/source/blender/compositor/operations/COM_MultilayerImageOperation.cc @@ -26,27 +26,27 @@ MultilayerBaseOperation::MultilayerBaseOperation(RenderLayer *render_layer, RenderPass *render_pass, int view) { - passId_ = BLI_findindex(&render_layer->passes, render_pass); + pass_id_ = BLI_findindex(&render_layer->passes, render_pass); view_ = view; - renderLayer_ = render_layer; - renderPass_ = render_pass; + render_layer_ = render_layer; + render_pass_ = render_pass; } -ImBuf *MultilayerBaseOperation::getImBuf() +ImBuf *MultilayerBaseOperation::get_im_buf() { /* temporarily changes the view to get the right ImBuf */ - int view = imageUser_->view; + int view = image_user_->view; - imageUser_->view = view_; - imageUser_->pass = passId_; + image_user_->view = view_; + image_user_->pass = pass_id_; - if (BKE_image_multilayer_index(image_->rr, imageUser_)) { - ImBuf *ibuf = BaseImageOperation::getImBuf(); - imageUser_->view = view; + if (BKE_image_multilayer_index(image_->rr, image_user_)) { + ImBuf *ibuf = BaseImageOperation::get_im_buf(); + image_user_->view = view; return ibuf; } - imageUser_->view = view; + image_user_->view = view; return nullptr; } @@ -57,14 +57,14 @@ void MultilayerBaseOperation::update_memory_buffer_partial(MemoryBuffer *output, output->copy_from(buffer_, area); } -std::unique_ptr<MetaData> MultilayerColorOperation::getMetaData() +std::unique_ptr<MetaData> MultilayerColorOperation::get_meta_data() { BLI_assert(buffer_); MetaDataExtractCallbackData callback_data = {nullptr}; RenderResult *render_result = image_->rr; if (render_result && render_result->stamp_data) { - RenderLayer *render_layer = renderLayer_; - RenderPass *render_pass = renderPass_; + RenderLayer *render_layer = render_layer_; + RenderPass *render_pass = render_pass_; std::string full_layer_name = std::string(render_layer->name, BLI_strnlen(render_layer->name, sizeof(render_layer->name))) + @@ -72,7 +72,7 @@ std::unique_ptr<MetaData> MultilayerColorOperation::getMetaData() std::string(render_pass->name, BLI_strnlen(render_pass->name, sizeof(render_pass->name))); blender::StringRef cryptomatte_layer_name = blender::bke::cryptomatte::BKE_cryptomatte_extract_layer_name(full_layer_name); - callback_data.setCryptomatteKeys(cryptomatte_layer_name); + callback_data.set_cryptomatte_keys(cryptomatte_layer_name); BKE_stamp_info_callback(&callback_data, render_result->stamp_data, @@ -83,16 +83,16 @@ std::unique_ptr<MetaData> MultilayerColorOperation::getMetaData() return std::move(callback_data.meta_data); } -void MultilayerColorOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void MultilayerColorOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - if (imageFloatBuffer_ == nullptr) { + if (image_float_buffer_ == nullptr) { zero_v4(output); } else { - if (numberOfChannels_ == 4) { + if (number_of_channels_ == 4) { switch (sampler) { case PixelSampler::Nearest: nearest_interpolation_color(buffer_, nullptr, output, x, y); @@ -108,58 +108,58 @@ void MultilayerColorOperation::executePixelSampled(float output[4], else { int yi = y; int xi = x; - if (xi < 0 || yi < 0 || (unsigned int)xi >= this->getWidth() || - (unsigned int)yi >= this->getHeight()) { + if (xi < 0 || yi < 0 || (unsigned int)xi >= this->get_width() || + (unsigned int)yi >= this->get_height()) { zero_v4(output); } else { - int offset = (yi * this->getWidth() + xi) * 3; - copy_v3_v3(output, &imageFloatBuffer_[offset]); + int offset = (yi * this->get_width() + xi) * 3; + copy_v3_v3(output, &image_float_buffer_[offset]); } } } } -void MultilayerValueOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler /*sampler*/) +void MultilayerValueOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler /*sampler*/) { - if (imageFloatBuffer_ == nullptr) { + if (image_float_buffer_ == nullptr) { output[0] = 0.0f; } else { int yi = y; int xi = x; - if (xi < 0 || yi < 0 || (unsigned int)xi >= this->getWidth() || - (unsigned int)yi >= this->getHeight()) { + if (xi < 0 || yi < 0 || (unsigned int)xi >= this->get_width() || + (unsigned int)yi >= this->get_height()) { output[0] = 0.0f; } else { - float result = imageFloatBuffer_[yi * this->getWidth() + xi]; + float result = image_float_buffer_[yi * this->get_width() + xi]; output[0] = result; } } } -void MultilayerVectorOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler /*sampler*/) +void MultilayerVectorOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler /*sampler*/) { - if (imageFloatBuffer_ == nullptr) { + if (image_float_buffer_ == nullptr) { output[0] = 0.0f; } else { int yi = y; int xi = x; - if (xi < 0 || yi < 0 || (unsigned int)xi >= this->getWidth() || - (unsigned int)yi >= this->getHeight()) { + if (xi < 0 || yi < 0 || (unsigned int)xi >= this->get_width() || + (unsigned int)yi >= this->get_height()) { output[0] = 0.0f; } else { - int offset = (yi * this->getWidth() + xi) * 3; - copy_v3_v3(output, &imageFloatBuffer_[offset]); + int offset = (yi * this->get_width() + xi) * 3; + copy_v3_v3(output, &image_float_buffer_[offset]); } } } diff --git a/source/blender/compositor/operations/COM_MultilayerImageOperation.h b/source/blender/compositor/operations/COM_MultilayerImageOperation.h index 77805decc1f..ea5b0fb46ea 100644 --- a/source/blender/compositor/operations/COM_MultilayerImageOperation.h +++ b/source/blender/compositor/operations/COM_MultilayerImageOperation.h @@ -24,13 +24,13 @@ namespace blender::compositor { class MultilayerBaseOperation : public BaseImageOperation { private: - int passId_; + int pass_id_; int view_; protected: - RenderLayer *renderLayer_; - RenderPass *renderPass_; - ImBuf *getImBuf() override; + RenderLayer *render_layer_; + RenderPass *render_pass_; + ImBuf *get_im_buf() override; public: /** @@ -48,10 +48,10 @@ class MultilayerColorOperation : public MultilayerBaseOperation { MultilayerColorOperation(RenderLayer *render_layer, RenderPass *render_pass, int view) : MultilayerBaseOperation(render_layer, render_pass, view) { - this->addOutputSocket(DataType::Color); + this->add_output_socket(DataType::Color); } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; - std::unique_ptr<MetaData> getMetaData() override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; + std::unique_ptr<MetaData> get_meta_data() override; }; class MultilayerValueOperation : public MultilayerBaseOperation { @@ -59,9 +59,9 @@ class MultilayerValueOperation : public MultilayerBaseOperation { MultilayerValueOperation(RenderLayer *render_layer, RenderPass *render_pass, int view) : MultilayerBaseOperation(render_layer, render_pass, view) { - this->addOutputSocket(DataType::Value); + this->add_output_socket(DataType::Value); } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; }; class MultilayerVectorOperation : public MultilayerBaseOperation { @@ -69,9 +69,9 @@ class MultilayerVectorOperation : public MultilayerBaseOperation { MultilayerVectorOperation(RenderLayer *render_layer, RenderPass *render_pass, int view) : MultilayerBaseOperation(render_layer, render_pass, view) { - this->addOutputSocket(DataType::Vector); + this->add_output_socket(DataType::Vector); } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(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 0c2dc309ede..89793897a58 100644 --- a/source/blender/compositor/operations/COM_NormalizeOperation.cc +++ b/source/blender/compositor/operations/COM_NormalizeOperation.cc @@ -22,25 +22,25 @@ namespace blender::compositor { NormalizeOperation::NormalizeOperation() { - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Value); - imageReader_ = nullptr; - cachedInstance_ = nullptr; + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Value); + image_reader_ = nullptr; + cached_instance_ = nullptr; this->flags.complex = true; flags.can_be_constant = true; } -void NormalizeOperation::initExecution() +void NormalizeOperation::init_execution() { - imageReader_ = this->getInputSocketReader(0); - NodeOperation::initMutex(); + image_reader_ = this->get_input_socket_reader(0); + NodeOperation::init_mutex(); } -void NormalizeOperation::executePixel(float output[4], int x, int y, void *data) +void NormalizeOperation::execute_pixel(float output[4], int x, int y, void *data) { /* using generic two floats struct to store `x: min`, `y: multiply` */ NodeTwoFloats *minmult = (NodeTwoFloats *)data; - imageReader_->read(output, x, y, nullptr); + image_reader_->read(output, x, y, nullptr); output[0] = (output[0] - minmult->x) * minmult->y; @@ -53,30 +53,30 @@ void NormalizeOperation::executePixel(float output[4], int x, int y, void *data) } } -void NormalizeOperation::deinitExecution() +void NormalizeOperation::deinit_execution() { - imageReader_ = nullptr; - delete cachedInstance_; - cachedInstance_ = nullptr; - NodeOperation::deinitMutex(); + image_reader_ = nullptr; + delete cached_instance_; + cached_instance_ = nullptr; + NodeOperation::deinit_mutex(); } -bool NormalizeOperation::determineDependingAreaOfInterest(rcti * /*input*/, - ReadBufferOperation *readOperation, - rcti *output) +bool NormalizeOperation::determine_depending_area_of_interest(rcti * /*input*/, + ReadBufferOperation *read_operation, + rcti *output) { - rcti imageInput; - if (cachedInstance_) { + rcti image_input; + if (cached_instance_) { return false; } - NodeOperation *operation = getInputOperation(0); - imageInput.xmax = operation->getWidth(); - imageInput.xmin = 0; - imageInput.ymax = operation->getHeight(); - imageInput.ymin = 0; + NodeOperation *operation = get_input_operation(0); + image_input.xmax = operation->get_width(); + image_input.xmin = 0; + image_input.ymax = operation->get_height(); + image_input.ymin = 0; - if (operation->determineDependingAreaOfInterest(&imageInput, readOperation, output)) { + if (operation->determine_depending_area_of_interest(&image_input, read_operation, output)) { return true; } return false; @@ -86,16 +86,16 @@ bool NormalizeOperation::determineDependingAreaOfInterest(rcti * /*input*/, */ #define BLENDER_ZMAX 10000.0f -void *NormalizeOperation::initializeTileData(rcti *rect) +void *NormalizeOperation::initialize_tile_data(rcti *rect) { - lockMutex(); - if (cachedInstance_ == nullptr) { - MemoryBuffer *tile = (MemoryBuffer *)imageReader_->initializeTileData(rect); + lock_mutex(); + if (cached_instance_ == nullptr) { + MemoryBuffer *tile = (MemoryBuffer *)image_reader_->initialize_tile_data(rect); /* using generic two floats struct to store `x: min`, `y: multiply`. */ NodeTwoFloats *minmult = new NodeTwoFloats(); - float *buffer = tile->getBuffer(); - int p = tile->getWidth() * tile->getHeight(); + float *buffer = tile->get_buffer(); + int p = tile->get_width() * tile->get_height(); float *bc = buffer; float minv = 1.0f + BLENDER_ZMAX; @@ -117,14 +117,14 @@ void *NormalizeOperation::initializeTileData(rcti *rect) /* The rare case of flat buffer would cause a divide by 0 */ minmult->y = ((maxv != minv) ? 1.0f / (maxv - minv) : 0.0f); - cachedInstance_ = minmult; + cached_instance_ = minmult; } - unlockMutex(); - return cachedInstance_; + unlock_mutex(); + return cached_instance_; } -void NormalizeOperation::deinitializeTileData(rcti * /*rect*/, void * /*data*/) +void NormalizeOperation::deinitialize_tile_data(rcti * /*rect*/, void * /*data*/) { /* pass */ } @@ -140,7 +140,7 @@ void NormalizeOperation::update_memory_buffer_started(MemoryBuffer *UNUSED(outpu const rcti &UNUSED(area), Span<MemoryBuffer *> inputs) { - if (cachedInstance_ == nullptr) { + if (cached_instance_ == nullptr) { MemoryBuffer *input = inputs[0]; /* Using generic two floats struct to store `x: min`, `y: multiply`. */ @@ -162,7 +162,7 @@ void NormalizeOperation::update_memory_buffer_started(MemoryBuffer *UNUSED(outpu /* The case of a flat buffer would cause a divide by 0. */ minmult->y = ((maxv != minv) ? 1.0f / (maxv - minv) : 0.0f); - cachedInstance_ = minmult; + cached_instance_ = minmult; } } @@ -170,7 +170,7 @@ void NormalizeOperation::update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span<MemoryBuffer *> inputs) { - NodeTwoFloats *minmult = cachedInstance_; + NodeTwoFloats *minmult = cached_instance_; for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) { const float input_value = *it.in(0); diff --git a/source/blender/compositor/operations/COM_NormalizeOperation.h b/source/blender/compositor/operations/COM_NormalizeOperation.h index 450155c319a..dd9abcfad26 100644 --- a/source/blender/compositor/operations/COM_NormalizeOperation.h +++ b/source/blender/compositor/operations/COM_NormalizeOperation.h @@ -32,13 +32,13 @@ class NormalizeOperation : public MultiThreadedOperation { /** * \brief Cached reference to the reader */ - SocketReader *imageReader_; + SocketReader *image_reader_; /** * \brief temporarily cache of the execution storage * it stores `x->min` and `y->multiply`. */ - NodeTwoFloats *cachedInstance_; + NodeTwoFloats *cached_instance_; public: NormalizeOperation(); @@ -46,24 +46,24 @@ class NormalizeOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; - void *initializeTileData(rcti *rect) override; - void deinitializeTileData(rcti *rect, void *data) override; + void *initialize_tile_data(rcti *rect) override; + void deinitialize_tile_data(rcti *rect, void *data) override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; void update_memory_buffer_started(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_OpenCLKernels.cl b/source/blender/compositor/operations/COM_OpenCLKernels.cl index ebe8a6d08ec..d01e209d3e4 100644 --- a/source/blender/compositor/operations/COM_OpenCLKernels.cl +++ b/source/blender/compositor/operations/COM_OpenCLKernels.cl @@ -29,101 +29,101 @@ const sampler_t SAMPLER_NEAREST_CLAMP = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRES __constant const int2 zero = {0,0}; // KERNEL --- BOKEH BLUR --- -__kernel void bokehBlurKernel(__read_only image2d_t boundingBox, __read_only image2d_t inputImage, - __read_only image2d_t bokehImage, __write_only image2d_t output, - int2 offsetInput, int2 offsetOutput, int radius, int step, int2 dimension, int2 offset) +__kernel void bokeh_blur_kernel(__read_only image2d_t bounding_box, __read_only image2d_t input_image, + __read_only image2d_t bokeh_image, __write_only image2d_t output, + int2 offset_input, int2 offset_output, int radius, int step, int2 dimension, int2 offset) { int2 coords = {get_global_id(0), get_global_id(1)}; coords += offset; - float tempBoundingBox; + float temp_bounding_box; float4 color = {0.0f,0.0f,0.0f,0.0f}; float4 multiplyer = {0.0f,0.0f,0.0f,0.0f}; float4 bokeh; const float radius2 = radius*2.0f; - const int2 realCoordinate = coords + offsetOutput; - int2 imageCoordinates = realCoordinate - offsetInput; + const int2 real_coordinate = coords + offset_output; + int2 image_coordinates = real_coordinate - offset_input; - tempBoundingBox = read_imagef(boundingBox, SAMPLER_NEAREST, coords).s0; + temp_bounding_box = read_imagef(bounding_box, SAMPLER_NEAREST, coords).s0; - if (tempBoundingBox > 0.0f && radius > 0 ) { - const int2 bokehImageDim = get_image_dim(bokehImage); - const int2 bokehImageCenter = bokehImageDim/2; - const int2 minXY = max(realCoordinate - radius, zero); - const int2 maxXY = min(realCoordinate + radius, dimension); + if (temp_bounding_box > 0.0f && radius > 0 ) { + const int2 bokeh_image_dim = get_image_dim(bokeh_image); + const int2 bokeh_image_center = bokeh_image_dim/2; + const int2 minXY = max(real_coordinate - radius, zero); + const int2 maxXY = min(real_coordinate + radius, dimension); int nx, ny; float2 uv; - int2 inputXy; + int2 input_xy; if (radius < 2) { - color = read_imagef(inputImage, SAMPLER_NEAREST, imageCoordinates); + color = read_imagef(input_image, SAMPLER_NEAREST, image_coordinates); multiplyer = (float4)(1.0f, 1.0f, 1.0f, 1.0f); } - for (ny = minXY.y, inputXy.y = ny - offsetInput.y ; ny < maxXY.y ; ny += step, inputXy.y += step) { - uv.y = ((realCoordinate.y-ny)/radius2)*bokehImageDim.y+bokehImageCenter.y; + for (ny = minXY.y, input_xy.y = ny - offset_input.y ; ny < maxXY.y ; ny += step, input_xy.y += step) { + uv.y = ((real_coordinate.y-ny)/radius2)*bokeh_image_dim.y+bokeh_image_center.y; - for (nx = minXY.x, inputXy.x = nx - offsetInput.x; nx < maxXY.x ; nx += step, inputXy.x += step) { - uv.x = ((realCoordinate.x-nx)/radius2)*bokehImageDim.x+bokehImageCenter.x; - bokeh = read_imagef(bokehImage, SAMPLER_NEAREST, uv); - color += bokeh * read_imagef(inputImage, SAMPLER_NEAREST, inputXy); + for (nx = minXY.x, input_xy.x = nx - offset_input.x; nx < maxXY.x ; nx += step, input_xy.x += step) { + uv.x = ((real_coordinate.x-nx)/radius2)*bokeh_image_dim.x+bokeh_image_center.x; + bokeh = read_imagef(bokeh_image, SAMPLER_NEAREST, uv); + color += bokeh * read_imagef(input_image, SAMPLER_NEAREST, input_xy); multiplyer += bokeh; } } color /= multiplyer; } else { - color = read_imagef(inputImage, SAMPLER_NEAREST, imageCoordinates); + color = read_imagef(input_image, SAMPLER_NEAREST, image_coordinates); } write_imagef(output, coords, color); } //KERNEL --- DEFOCUS /VARIABLESIZEBOKEHBLUR --- -__kernel void defocusKernel(__read_only image2d_t inputImage, __read_only image2d_t bokehImage, - __read_only image2d_t inputSize, - __write_only image2d_t output, int2 offsetInput, int2 offsetOutput, - int step, int maxBlurScalar, float threshold, float scalar, int2 dimension, int2 offset) +__kernel void defocus_kernel(__read_only image2d_t input_image, __read_only image2d_t bokeh_image, + __read_only image2d_t input_size, + __write_only image2d_t output, int2 offset_input, int2 offset_output, + int step, int max_blur_scalar, float threshold, float scalar, int2 dimension, int2 offset) { float4 color = {1.0f, 0.0f, 0.0f, 1.0f}; int2 coords = {get_global_id(0), get_global_id(1)}; coords += offset; - const int2 realCoordinate = coords + offsetOutput; + const int2 real_coordinate = coords + offset_output; - float4 readColor; - float4 tempColor; + float4 read_color; + float4 temp_color; float4 bokeh; float size; float4 multiplier_accum = {1.0f, 1.0f, 1.0f, 1.0f}; float4 color_accum; - int minx = max(realCoordinate.s0 - maxBlurScalar, 0); - int miny = max(realCoordinate.s1 - maxBlurScalar, 0); - int maxx = min(realCoordinate.s0 + maxBlurScalar, dimension.s0); - int maxy = min(realCoordinate.s1 + maxBlurScalar, dimension.s1); + int minx = max(real_coordinate.s0 - max_blur_scalar, 0); + int miny = max(real_coordinate.s1 - max_blur_scalar, 0); + int maxx = min(real_coordinate.s0 + max_blur_scalar, dimension.s0); + int maxy = min(real_coordinate.s1 + max_blur_scalar, dimension.s1); { - int2 inputCoordinate = realCoordinate - offsetInput; - float size_center = read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0 * scalar; - color_accum = read_imagef(inputImage, SAMPLER_NEAREST, inputCoordinate); - readColor = color_accum; + int2 input_coordinate = real_coordinate - offset_input; + float size_center = read_imagef(input_size, SAMPLER_NEAREST, input_coordinate).s0 * scalar; + color_accum = read_imagef(input_image, SAMPLER_NEAREST, input_coordinate); + read_color = color_accum; if (size_center > threshold) { for (int ny = miny; ny < maxy; ny += step) { - inputCoordinate.s1 = ny - offsetInput.s1; - float dy = ny - realCoordinate.s1; + input_coordinate.s1 = ny - offset_input.s1; + float dy = ny - real_coordinate.s1; for (int nx = minx; nx < maxx; nx += step) { - float dx = nx - realCoordinate.s0; + float dx = nx - real_coordinate.s0; if (dx != 0 || dy != 0) { - inputCoordinate.s0 = nx - offsetInput.s0; - size = min(read_imagef(inputSize, SAMPLER_NEAREST, inputCoordinate).s0 * scalar, size_center); + input_coordinate.s0 = nx - offset_input.s0; + size = min(read_imagef(input_size, SAMPLER_NEAREST, input_coordinate).s0 * scalar, size_center); if (size > threshold) { if (size >= fabs(dx) && size >= fabs(dy)) { float2 uv = {256.0f + dx * 255.0f / size, 256.0f + dy * 255.0f / size}; - bokeh = read_imagef(bokehImage, SAMPLER_NEAREST, uv); - tempColor = read_imagef(inputImage, SAMPLER_NEAREST, inputCoordinate); - color_accum += bokeh * tempColor; + bokeh = read_imagef(bokeh_image, SAMPLER_NEAREST, uv); + temp_color = read_imagef(input_image, SAMPLER_NEAREST, input_coordinate); + color_accum += bokeh * temp_color; multiplier_accum += bokeh; } } @@ -140,7 +140,7 @@ __kernel void defocusKernel(__read_only image2d_t inputImage, __read_only image2 { /* factor from 0-1 */ float fac = (size_center - threshold) / threshold; - color = (readColor * (1.0f - fac)) + (color * fac); + color = (read_color * (1.0f - fac)) + (color * fac); } write_imagef(output, coords, color); @@ -149,28 +149,28 @@ __kernel void defocusKernel(__read_only image2d_t inputImage, __read_only image2 // KERNEL --- DILATE --- -__kernel void dilateKernel(__read_only image2d_t inputImage, __write_only image2d_t output, - int2 offsetInput, int2 offsetOutput, int scope, int distanceSquared, int2 dimension, +__kernel void dilate_kernel(__read_only image2d_t input_image, __write_only image2d_t output, + int2 offset_input, int2 offset_output, int scope, int distance_squared, int2 dimension, int2 offset) { int2 coords = {get_global_id(0), get_global_id(1)}; coords += offset; - const int2 realCoordinate = coords + offsetOutput; + const int2 real_coordinate = coords + offset_output; - const int2 minXY = max(realCoordinate - scope, zero); - const int2 maxXY = min(realCoordinate + scope, dimension); + const int2 minXY = max(real_coordinate - scope, zero); + const int2 maxXY = min(real_coordinate + scope, dimension); float value = 0.0f; int nx, ny; - int2 inputXy; + int2 input_xy; - for (ny = minXY.y, inputXy.y = ny - offsetInput.y ; ny < maxXY.y ; ny ++, inputXy.y++) { - const float deltaY = (realCoordinate.y - ny); - for (nx = minXY.x, inputXy.x = nx - offsetInput.x; nx < maxXY.x ; nx ++, inputXy.x++) { - const float deltaX = (realCoordinate.x - nx); - const float measuredDistance = deltaX * deltaX + deltaY * deltaY; - if (measuredDistance <= distanceSquared) { - value = max(value, read_imagef(inputImage, SAMPLER_NEAREST, inputXy).s0); + for (ny = minXY.y, input_xy.y = ny - offset_input.y ; ny < maxXY.y ; ny ++, input_xy.y++) { + const float deltaY = (real_coordinate.y - ny); + for (nx = minXY.x, input_xy.x = nx - offset_input.x; nx < maxXY.x ; nx ++, input_xy.x++) { + const float deltaX = (real_coordinate.x - nx); + const float measured_distance = deltaX * deltaX + deltaY * deltaY; + if (measured_distance <= distance_squared) { + value = max(value, read_imagef(input_image, SAMPLER_NEAREST, input_xy).s0); } } } @@ -180,28 +180,28 @@ __kernel void dilateKernel(__read_only image2d_t inputImage, __write_only image } // KERNEL --- DILATE --- -__kernel void erodeKernel(__read_only image2d_t inputImage, __write_only image2d_t output, - int2 offsetInput, int2 offsetOutput, int scope, int distanceSquared, int2 dimension, +__kernel void erode_kernel(__read_only image2d_t input_image, __write_only image2d_t output, + int2 offset_input, int2 offset_output, int scope, int distance_squared, int2 dimension, int2 offset) { int2 coords = {get_global_id(0), get_global_id(1)}; coords += offset; - const int2 realCoordinate = coords + offsetOutput; + const int2 real_coordinate = coords + offset_output; - const int2 minXY = max(realCoordinate - scope, zero); - const int2 maxXY = min(realCoordinate + scope, dimension); + const int2 minXY = max(real_coordinate - scope, zero); + const int2 maxXY = min(real_coordinate + scope, dimension); float value = 1.0f; int nx, ny; - int2 inputXy; + int2 input_xy; - for (ny = minXY.y, inputXy.y = ny - offsetInput.y ; ny < maxXY.y ; ny ++, inputXy.y++) { - for (nx = minXY.x, inputXy.x = nx - offsetInput.x; nx < maxXY.x ; nx ++, inputXy.x++) { - const float deltaX = (realCoordinate.x - nx); - const float deltaY = (realCoordinate.y - ny); - const float measuredDistance = deltaX * deltaX+deltaY * deltaY; - if (measuredDistance <= distanceSquared) { - value = min(value, read_imagef(inputImage, SAMPLER_NEAREST, inputXy).s0); + for (ny = minXY.y, input_xy.y = ny - offset_input.y ; ny < maxXY.y ; ny ++, input_xy.y++) { + for (nx = minXY.x, input_xy.x = nx - offset_input.x; nx < maxXY.x ; nx ++, input_xy.x++) { + const float deltaX = (real_coordinate.x - nx); + const float deltaY = (real_coordinate.y - ny); + const float measured_distance = deltaX * deltaX+deltaY * deltaY; + if (measured_distance <= distance_squared) { + value = min(value, read_imagef(input_image, SAMPLER_NEAREST, input_xy).s0); } } } @@ -211,34 +211,34 @@ __kernel void erodeKernel(__read_only image2d_t inputImage, __write_only image2 } // KERNEL --- DIRECTIONAL BLUR --- -__kernel void directionalBlurKernel(__read_only image2d_t inputImage, __write_only image2d_t output, - int2 offsetOutput, int iterations, float scale, float rotation, float2 translate, +__kernel void directional_blur_kernel(__read_only image2d_t input_image, __write_only image2d_t output, + int2 offset_output, int iterations, float scale, float rotation, float2 translate, float2 center, int2 offset) { int2 coords = {get_global_id(0), get_global_id(1)}; coords += offset; - const int2 realCoordinate = coords + offsetOutput; + const int2 real_coordinate = coords + offset_output; float4 col; float2 ltxy = translate; float lsc = scale; float lrot = rotation; - col = read_imagef(inputImage, SAMPLER_NEAREST, realCoordinate); + col = read_imagef(input_image, SAMPLER_NEAREST, real_coordinate); /* blur the image */ for (int i = 0; i < iterations; ++i) { const float cs = cos(lrot), ss = sin(lrot); const float isc = 1.0f / (1.0f + lsc); - const float v = isc * (realCoordinate.s1 - center.s1) + ltxy.s1; - const float u = isc * (realCoordinate.s0 - center.s0) + ltxy.s0; + const float v = isc * (real_coordinate.s1 - center.s1) + ltxy.s1; + const float u = isc * (real_coordinate.s0 - center.s0) + ltxy.s0; float2 uv = { cs * u + ss * v + center.s0, cs * v - ss * u + center.s1 }; - col += read_imagef(inputImage, SAMPLER_NEAREST_CLAMP, uv); + col += read_imagef(input_image, SAMPLER_NEAREST_CLAMP, uv); /* double transformations */ ltxy += translate; @@ -252,10 +252,10 @@ __kernel void directionalBlurKernel(__read_only image2d_t inputImage, __write_o } // KERNEL --- GAUSSIAN BLUR --- -__kernel void gaussianXBlurOperationKernel(__read_only image2d_t inputImage, - int2 offsetInput, +__kernel void gaussian_xblur_operation_kernel(__read_only image2d_t input_image, + int2 offset_input, __write_only image2d_t output, - int2 offsetOutput, + int2 offset_output, int filter_size, int2 dimension, __global float *gausstab, @@ -264,17 +264,17 @@ __kernel void gaussianXBlurOperationKernel(__read_only image2d_t inputImage, float4 color = {0.0f, 0.0f, 0.0f, 0.0f}; int2 coords = {get_global_id(0), get_global_id(1)}; coords += offset; - const int2 realCoordinate = coords + offsetOutput; - int2 inputCoordinate = realCoordinate - offsetInput; + const int2 real_coordinate = coords + offset_output; + int2 input_coordinate = real_coordinate - offset_input; float weight = 0.0f; - int xmin = max(realCoordinate.x - filter_size, 0) - offsetInput.x; - int xmax = min(realCoordinate.x + filter_size + 1, dimension.x) - offsetInput.x; + int xmin = max(real_coordinate.x - filter_size, 0) - offset_input.x; + int xmax = min(real_coordinate.x + filter_size + 1, dimension.x) - offset_input.x; - for (int nx = xmin, i = max(filter_size - realCoordinate.x, 0); nx < xmax; ++nx, ++i) { + for (int nx = xmin, i = max(filter_size - real_coordinate.x, 0); nx < xmax; ++nx, ++i) { float w = gausstab[i]; - inputCoordinate.x = nx; - color += read_imagef(inputImage, SAMPLER_NEAREST, inputCoordinate) * w; + input_coordinate.x = nx; + color += read_imagef(input_image, SAMPLER_NEAREST, input_coordinate) * w; weight += w; } @@ -283,10 +283,10 @@ __kernel void gaussianXBlurOperationKernel(__read_only image2d_t inputImage, write_imagef(output, coords, color); } -__kernel void gaussianYBlurOperationKernel(__read_only image2d_t inputImage, - int2 offsetInput, +__kernel void gaussian_yblur_operation_kernel(__read_only image2d_t input_image, + int2 offset_input, __write_only image2d_t output, - int2 offsetOutput, + int2 offset_output, int filter_size, int2 dimension, __global float *gausstab, @@ -295,17 +295,17 @@ __kernel void gaussianYBlurOperationKernel(__read_only image2d_t inputImage, float4 color = {0.0f, 0.0f, 0.0f, 0.0f}; int2 coords = {get_global_id(0), get_global_id(1)}; coords += offset; - const int2 realCoordinate = coords + offsetOutput; - int2 inputCoordinate = realCoordinate - offsetInput; + const int2 real_coordinate = coords + offset_output; + int2 input_coordinate = real_coordinate - offset_input; float weight = 0.0f; - int ymin = max(realCoordinate.y - filter_size, 0) - offsetInput.y; - int ymax = min(realCoordinate.y + filter_size + 1, dimension.y) - offsetInput.y; + int ymin = max(real_coordinate.y - filter_size, 0) - offset_input.y; + int ymax = min(real_coordinate.y + filter_size + 1, dimension.y) - offset_input.y; - for (int ny = ymin, i = max(filter_size - realCoordinate.y, 0); ny < ymax; ++ny, ++i) { + for (int ny = ymin, i = max(filter_size - real_coordinate.y, 0); ny < ymax; ++ny, ++i) { float w = gausstab[i]; - inputCoordinate.y = ny; - color += read_imagef(inputImage, SAMPLER_NEAREST, inputCoordinate) * w; + input_coordinate.y = ny; + color += read_imagef(input_image, SAMPLER_NEAREST, input_coordinate) * w; weight += w; } diff --git a/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cc b/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cc index e652a0be3e6..7f2968a4719 100644 --- a/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cc +++ b/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.cc @@ -36,19 +36,26 @@ OutputOpenExrSingleLayerMultiViewOperation::OutputOpenExrSingleLayerMultiViewOpe DataType datatype, ImageFormatData *format, const char *path, - const ColorManagedViewSettings *viewSettings, - const ColorManagedDisplaySettings *displaySettings, - const char *viewName, - const bool saveAsRender) - : OutputSingleLayerOperation( - rd, tree, datatype, format, path, viewSettings, displaySettings, viewName, saveAsRender) + const ColorManagedViewSettings *view_settings, + const ColorManagedDisplaySettings *display_settings, + const char *view_name, + const bool save_as_render) + : OutputSingleLayerOperation(rd, + tree, + datatype, + format, + path, + view_settings, + display_settings, + view_name, + save_as_render) { } void *OutputOpenExrSingleLayerMultiViewOperation::get_handle(const char *filename) { - size_t width = this->getWidth(); - size_t height = this->getHeight(); + size_t width = this->get_width(); + size_t height = this->get_height(); SceneRenderView *srv; if (width != 0 && height != 0) { @@ -56,7 +63,7 @@ void *OutputOpenExrSingleLayerMultiViewOperation::get_handle(const char *filenam exrhandle = IMB_exr_get_handle_name(filename); - if (!BKE_scene_multiview_is_render_view_first(rd_, viewName_)) { + if (!BKE_scene_multiview_is_render_view_first(rd_, view_name_)) { return exrhandle; } @@ -87,10 +94,10 @@ void *OutputOpenExrSingleLayerMultiViewOperation::get_handle(const char *filenam return nullptr; } -void OutputOpenExrSingleLayerMultiViewOperation::deinitExecution() +void OutputOpenExrSingleLayerMultiViewOperation::deinit_execution() { - unsigned int width = this->getWidth(); - unsigned int height = this->getHeight(); + unsigned int width = this->get_width(); + unsigned int height = this->get_height(); if (width != 0 && height != 0) { void *exrhandle; @@ -109,17 +116,17 @@ void OutputOpenExrSingleLayerMultiViewOperation::deinitExecution() add_exr_channels(exrhandle, nullptr, datatype_, - viewName_, + view_name_, width, format_->depth == R_IMF_CHAN_DEPTH_16, - outputBuffer_); + output_buffer_); /* memory can only be freed after we write all views to the file */ - outputBuffer_ = nullptr; - imageInput_ = nullptr; + output_buffer_ = nullptr; + image_input_ = nullptr; /* ready to close the file */ - if (BKE_scene_multiview_is_render_view_last(rd_, viewName_)) { + if (BKE_scene_multiview_is_render_view_last(rd_, view_name_)) { IMB_exr_write_channels(exrhandle); /* free buffer memory for all the views */ @@ -140,15 +147,15 @@ OutputOpenExrMultiLayerMultiViewOperation::OutputOpenExrMultiLayerMultiViewOpera const char *path, char exr_codec, bool exr_half_float, - const char *viewName) - : OutputOpenExrMultiLayerOperation(scene, rd, tree, path, exr_codec, exr_half_float, viewName) + const char *view_name) + : OutputOpenExrMultiLayerOperation(scene, rd, tree, path, exr_codec, exr_half_float, view_name) { } void *OutputOpenExrMultiLayerMultiViewOperation::get_handle(const char *filename) { - unsigned int width = this->getWidth(); - unsigned int height = this->getHeight(); + unsigned int width = this->get_width(); + unsigned int height = this->get_height(); if (width != 0 && height != 0) { @@ -158,7 +165,7 @@ void *OutputOpenExrMultiLayerMultiViewOperation::get_handle(const char *filename /* get a new global handle */ exrhandle = IMB_exr_get_handle_name(filename); - if (!BKE_scene_multiview_is_render_view_first(rd_, viewName_)) { + if (!BKE_scene_multiview_is_render_view_first(rd_, view_name_)) { return exrhandle; } @@ -187,7 +194,7 @@ void *OutputOpenExrMultiLayerMultiViewOperation::get_handle(const char *filename BLI_make_existing_file(filename); /* prepare the file with all the channels for the header */ - StampData *stamp_data = createStampData(); + StampData *stamp_data = create_stamp_data(); if (!IMB_exr_begin_write(exrhandle, filename, width, height, exr_codec_, stamp_data)) { printf("Error Writing Multilayer Multiview Openexr\n"); IMB_exr_close(exrhandle); @@ -202,10 +209,10 @@ void *OutputOpenExrMultiLayerMultiViewOperation::get_handle(const char *filename return nullptr; } -void OutputOpenExrMultiLayerMultiViewOperation::deinitExecution() +void OutputOpenExrMultiLayerMultiViewOperation::deinit_execution() { - unsigned int width = this->getWidth(); - unsigned int height = this->getHeight(); + unsigned int width = this->get_width(); + unsigned int height = this->get_height(); if (width != 0 && height != 0) { void *exrhandle; @@ -226,20 +233,20 @@ void OutputOpenExrMultiLayerMultiViewOperation::deinitExecution() add_exr_channels(exrhandle, layers_[i].name, layers_[i].datatype, - viewName_, + view_name_, width, exr_half_float_, - layers_[i].outputBuffer); + layers_[i].output_buffer); } for (unsigned int i = 0; i < layers_.size(); i++) { /* memory can only be freed after we write all views to the file */ - layers_[i].outputBuffer = nullptr; - layers_[i].imageInput = nullptr; + layers_[i].output_buffer = nullptr; + layers_[i].image_input = nullptr; } /* ready to close the file */ - if (BKE_scene_multiview_is_render_view_last(rd_, viewName_)) { + if (BKE_scene_multiview_is_render_view_last(rd_, view_name_)) { IMB_exr_write_channels(exrhandle); /* free buffer memory for all the views */ @@ -260,12 +267,19 @@ OutputStereoOperation::OutputStereoOperation(const RenderData *rd, ImageFormatData *format, const char *path, const char *name, - const ColorManagedViewSettings *viewSettings, - const ColorManagedDisplaySettings *displaySettings, - const char *viewName, - const bool saveAsRender) - : OutputSingleLayerOperation( - rd, tree, datatype, format, path, viewSettings, displaySettings, viewName, saveAsRender) + const ColorManagedViewSettings *view_settings, + const ColorManagedDisplaySettings *display_settings, + const char *view_name, + const bool save_as_render) + : OutputSingleLayerOperation(rd, + tree, + datatype, + format, + path, + view_settings, + display_settings, + view_name, + save_as_render) { BLI_strncpy(name_, name, sizeof(name_)); channels_ = get_datatype_size(datatype); @@ -273,8 +287,8 @@ OutputStereoOperation::OutputStereoOperation(const RenderData *rd, void *OutputStereoOperation::get_handle(const char *filename) { - size_t width = this->getWidth(); - size_t height = this->getHeight(); + size_t width = this->get_width(); + size_t height = this->get_height(); const char *names[2] = {STEREO_LEFT_NAME, STEREO_RIGHT_NAME}; size_t i; @@ -283,7 +297,7 @@ void *OutputStereoOperation::get_handle(const char *filename) exrhandle = IMB_exr_get_handle_name(filename); - if (!BKE_scene_multiview_is_render_view_first(rd_, viewName_)) { + if (!BKE_scene_multiview_is_render_view_first(rd_, view_name_)) { return exrhandle; } @@ -298,32 +312,32 @@ void *OutputStereoOperation::get_handle(const char *filename) return nullptr; } -void OutputStereoOperation::deinitExecution() +void OutputStereoOperation::deinit_execution() { - unsigned int width = this->getWidth(); - unsigned int height = this->getHeight(); + unsigned int width = this->get_width(); + unsigned int height = this->get_height(); if (width != 0 && height != 0) { void *exrhandle; exrhandle = this->get_handle(path_); - float *buf = outputBuffer_; + float *buf = output_buffer_; /* populate single EXR channel with view data */ IMB_exr_add_channel(exrhandle, nullptr, name_, - viewName_, + view_name_, 1, channels_ * width * height, buf, format_->depth == R_IMF_CHAN_DEPTH_16); - imageInput_ = nullptr; - outputBuffer_ = nullptr; + image_input_ = nullptr; + output_buffer_ = nullptr; /* create stereo ibuf */ - if (BKE_scene_multiview_is_render_view_last(rd_, viewName_)) { + if (BKE_scene_multiview_is_render_view_last(rd_, view_name_)) { ImBuf *ibuf[3] = {nullptr}; const char *names[2] = {STEREO_LEFT_NAME, STEREO_RIGHT_NAME}; char filename[FILE_MAX]; @@ -341,7 +355,7 @@ void OutputStereoOperation::deinitExecution() /* do colormanagement in the individual views, so it doesn't need to do in the stereo */ IMB_colormanagement_imbuf_for_write( - ibuf[i], true, false, viewSettings_, displaySettings_, format_); + ibuf[i], true, false, view_settings_, display_settings_, format_); IMB_prepare_write_ImBuf(IMB_isfloat(ibuf[i]), ibuf[i]); } diff --git a/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.h b/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.h index a6e76e6190e..9f8bf2ed127 100644 --- a/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.h +++ b/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.h @@ -38,13 +38,13 @@ class OutputOpenExrSingleLayerMultiViewOperation : public OutputSingleLayerOpera DataType datatype, ImageFormatData *format, const char *path, - const ColorManagedViewSettings *viewSettings, - const ColorManagedDisplaySettings *displaySettings, - const char *viewName, - const bool saveAsRender); + const ColorManagedViewSettings *view_settings, + const ColorManagedDisplaySettings *display_settings, + const char *view_name, + const bool save_as_render); void *get_handle(const char *filename); - void deinitExecution() override; + void deinit_execution() override; }; /* Writes inputs into OpenEXR multilayer channels. */ @@ -57,10 +57,10 @@ class OutputOpenExrMultiLayerMultiViewOperation : public OutputOpenExrMultiLayer const char *path, char exr_codec, bool exr_half_float, - const char *viewName); + const char *view_name); void *get_handle(const char *filename); - void deinitExecution() override; + void deinit_execution() override; }; class OutputStereoOperation : public OutputSingleLayerOperation { @@ -75,12 +75,12 @@ class OutputStereoOperation : public OutputSingleLayerOperation { struct ImageFormatData *format, const char *path, const char *name, - const ColorManagedViewSettings *viewSettings, - const ColorManagedDisplaySettings *displaySettings, - const char *viewName, - const bool saveAsRender); + const ColorManagedViewSettings *view_settings, + const ColorManagedDisplaySettings *display_settings, + const char *view_name, + const bool save_as_render); void *get_handle(const char *filename); - void deinitExecution() override; + void deinit_execution() override; }; } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.cc b/source/blender/compositor/operations/COM_OutputFileOperation.cc index 6a5ddd969b4..77e291e9dc4 100644 --- a/source/blender/compositor/operations/COM_OutputFileOperation.cc +++ b/source/blender/compositor/operations/COM_OutputFileOperation.cc @@ -37,9 +37,9 @@ namespace blender::compositor { void add_exr_channels(void *exrhandle, - const char *layerName, + const char *layer_name, const DataType datatype, - const char *viewName, + const char *view_name, const size_t width, bool use_half_float, float *buf) @@ -48,51 +48,63 @@ void add_exr_channels(void *exrhandle, switch (datatype) { case DataType::Value: IMB_exr_add_channel( - exrhandle, layerName, "V", viewName, 1, width, buf ? buf : nullptr, use_half_float); + exrhandle, layer_name, "V", view_name, 1, width, buf ? buf : nullptr, use_half_float); break; case DataType::Vector: - IMB_exr_add_channel( - exrhandle, layerName, "X", viewName, 3, 3 * width, buf ? buf : nullptr, use_half_float); IMB_exr_add_channel(exrhandle, - layerName, + layer_name, + "X", + view_name, + 3, + 3 * width, + buf ? buf : nullptr, + use_half_float); + IMB_exr_add_channel(exrhandle, + layer_name, "Y", - viewName, + view_name, 3, 3 * width, buf ? buf + 1 : nullptr, use_half_float); IMB_exr_add_channel(exrhandle, - layerName, + layer_name, "Z", - viewName, + view_name, 3, 3 * width, buf ? buf + 2 : nullptr, use_half_float); break; case DataType::Color: - IMB_exr_add_channel( - exrhandle, layerName, "R", viewName, 4, 4 * width, buf ? buf : nullptr, use_half_float); IMB_exr_add_channel(exrhandle, - layerName, + layer_name, + "R", + view_name, + 4, + 4 * width, + buf ? buf : nullptr, + use_half_float); + IMB_exr_add_channel(exrhandle, + layer_name, "G", - viewName, + view_name, 4, 4 * width, buf ? buf + 1 : nullptr, use_half_float); IMB_exr_add_channel(exrhandle, - layerName, + layer_name, "B", - viewName, + view_name, 4, 4 * width, buf ? buf + 2 : nullptr, use_half_float); IMB_exr_add_channel(exrhandle, - layerName, + layer_name, "A", - viewName, + view_name, 4, 4 * width, buf ? buf + 3 : nullptr, @@ -105,7 +117,7 @@ void add_exr_channels(void *exrhandle, void free_exr_channels(void *exrhandle, const RenderData *rd, - const char *layerName, + const char *layer_name, const DataType datatype) { SceneRenderView *srv; @@ -121,13 +133,13 @@ void free_exr_channels(void *exrhandle, /* the pointer is stored in the first channel of each datatype */ switch (datatype) { case DataType::Value: - rect = IMB_exr_channel_rect(exrhandle, layerName, "V", srv->name); + rect = IMB_exr_channel_rect(exrhandle, layer_name, "V", srv->name); break; case DataType::Vector: - rect = IMB_exr_channel_rect(exrhandle, layerName, "X", srv->name); + rect = IMB_exr_channel_rect(exrhandle, layer_name, "X", srv->name); break; case DataType::Color: - rect = IMB_exr_channel_rect(exrhandle, layerName, "R", srv->name); + rect = IMB_exr_channel_rect(exrhandle, layer_name, "R", srv->name); break; default: break; @@ -187,7 +199,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, PixelSampler::Nearest); + reader->read_sampled(color, x, y, PixelSampler::Nearest); for (i = 0; i < size; i++) { buffer[offset + i] = color[i]; @@ -208,58 +220,58 @@ OutputSingleLayerOperation::OutputSingleLayerOperation( DataType datatype, ImageFormatData *format, const char *path, - const ColorManagedViewSettings *viewSettings, - const ColorManagedDisplaySettings *displaySettings, - const char *viewName, - const bool saveAsRender) + const ColorManagedViewSettings *view_settings, + const ColorManagedDisplaySettings *display_settings, + const char *view_name, + const bool save_as_render) { rd_ = rd; tree_ = tree; - this->addInputSocket(datatype); + this->add_input_socket(datatype); - outputBuffer_ = nullptr; + output_buffer_ = nullptr; datatype_ = datatype; - imageInput_ = nullptr; + image_input_ = nullptr; format_ = format; BLI_strncpy(path_, path, sizeof(path_)); - viewSettings_ = viewSettings; - displaySettings_ = displaySettings; - viewName_ = viewName; - saveAsRender_ = saveAsRender; + view_settings_ = view_settings; + display_settings_ = display_settings; + view_name_ = view_name; + save_as_render_ = save_as_render; } -void OutputSingleLayerOperation::initExecution() +void OutputSingleLayerOperation::init_execution() { - imageInput_ = getInputSocketReader(0); - outputBuffer_ = init_buffer(this->getWidth(), this->getHeight(), datatype_); + image_input_ = get_input_socket_reader(0); + output_buffer_ = init_buffer(this->get_width(), this->get_height(), datatype_); } -void OutputSingleLayerOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/) +void OutputSingleLayerOperation::execute_region(rcti *rect, unsigned int /*tile_number*/) { - write_buffer_rect(rect, tree_, imageInput_, outputBuffer_, this->getWidth(), datatype_); + write_buffer_rect(rect, tree_, image_input_, output_buffer_, this->get_width(), datatype_); } -void OutputSingleLayerOperation::deinitExecution() +void OutputSingleLayerOperation::deinit_execution() { - if (this->getWidth() * this->getHeight() != 0) { + if (this->get_width() * this->get_height() != 0) { int size = get_datatype_size(datatype_); - ImBuf *ibuf = IMB_allocImBuf(this->getWidth(), this->getHeight(), format_->planes, 0); + ImBuf *ibuf = IMB_allocImBuf(this->get_width(), this->get_height(), format_->planes, 0); char filename[FILE_MAX]; const char *suffix; ibuf->channels = size; - ibuf->rect_float = outputBuffer_; + ibuf->rect_float = output_buffer_; ibuf->mall |= IB_rectfloat; ibuf->dither = rd_->dither_intensity; IMB_colormanagement_imbuf_for_write( - ibuf, saveAsRender_, false, viewSettings_, displaySettings_, format_); + ibuf, save_as_render_, false, view_settings_, display_settings_, format_); - suffix = BKE_scene_multiview_view_suffix_get(rd_, viewName_); + suffix = BKE_scene_multiview_view_suffix_get(rd_, view_name_); BKE_image_path_from_imformat(filename, path_, @@ -279,20 +291,22 @@ void OutputSingleLayerOperation::deinitExecution() IMB_freeImBuf(ibuf); } - outputBuffer_ = nullptr; - imageInput_ = nullptr; + output_buffer_ = nullptr; + image_input_ = nullptr; } void OutputSingleLayerOperation::update_memory_buffer_partial(MemoryBuffer *UNUSED(output), const rcti &area, Span<MemoryBuffer *> inputs) { - if (!outputBuffer_) { + if (!output_buffer_) { return; } - MemoryBuffer output_buf( - outputBuffer_, COM_data_type_num_channels(datatype_), this->getWidth(), this->getHeight()); + MemoryBuffer output_buf(output_buffer_, + COM_data_type_num_channels(datatype_), + this->get_width(), + this->get_height()); const MemoryBuffer *input_image = inputs[0]; output_buf.copy_from(input_image, area); } @@ -305,9 +319,9 @@ OutputOpenExrLayer::OutputOpenExrLayer(const char *name_, DataType datatype_, bo this->datatype = datatype_; this->use_layer = use_layer_; - /* these are created in initExecution */ - this->outputBuffer = nullptr; - this->imageInput = nullptr; + /* these are created in init_execution */ + this->output_buffer = nullptr; + this->image_input = nullptr; } OutputOpenExrMultiLayerOperation::OutputOpenExrMultiLayerOperation(const Scene *scene, @@ -316,7 +330,7 @@ OutputOpenExrMultiLayerOperation::OutputOpenExrMultiLayerOperation(const Scene * const char *path, char exr_codec, bool exr_half_float, - const char *viewName) + const char *view_name) { scene_ = scene; rd_ = rd; @@ -325,7 +339,7 @@ OutputOpenExrMultiLayerOperation::OutputOpenExrMultiLayerOperation(const Scene * BLI_strncpy(path_, path, sizeof(path_)); exr_codec_ = exr_codec; exr_half_float_ = exr_half_float; - viewName_ = viewName; + view_name_ = view_name; this->set_canvas_input_index(RESOLUTION_INPUT_ANY); } @@ -333,11 +347,11 @@ void OutputOpenExrMultiLayerOperation::add_layer(const char *name, DataType datatype, bool use_layer) { - this->addInputSocket(datatype); + this->add_input_socket(datatype); layers_.append(OutputOpenExrLayer(name, datatype, use_layer)); } -StampData *OutputOpenExrMultiLayerOperation::createStampData() const +StampData *OutputOpenExrMultiLayerOperation::create_stamp_data() const { /* StampData API doesn't provide functions to modify an instance without having a RenderResult. */ @@ -346,54 +360,54 @@ StampData *OutputOpenExrMultiLayerOperation::createStampData() const render_result.stamp_data = stamp_data; for (const OutputOpenExrLayer &layer : layers_) { /* Skip unconnected sockets. */ - if (layer.imageInput == nullptr) { + if (layer.image_input == nullptr) { continue; } - std::unique_ptr<MetaData> meta_data = layer.imageInput->getMetaData(); + std::unique_ptr<MetaData> meta_data = layer.image_input->get_meta_data(); 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)))); - meta_data->replaceHashNeutralCryptomatteKeys(layer_name); - meta_data->addToRenderResult(&render_result); + meta_data->replace_hash_neutral_cryptomatte_keys(layer_name); + meta_data->add_to_render_result(&render_result); } } return stamp_data; } -void OutputOpenExrMultiLayerOperation::initExecution() +void OutputOpenExrMultiLayerOperation::init_execution() { for (unsigned int i = 0; i < layers_.size(); i++) { if (layers_[i].use_layer) { - SocketReader *reader = getInputSocketReader(i); - layers_[i].imageInput = reader; - layers_[i].outputBuffer = init_buffer( - this->getWidth(), this->getHeight(), layers_[i].datatype); + SocketReader *reader = get_input_socket_reader(i); + layers_[i].image_input = reader; + layers_[i].output_buffer = init_buffer( + this->get_width(), this->get_height(), layers_[i].datatype); } } } -void OutputOpenExrMultiLayerOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/) +void OutputOpenExrMultiLayerOperation::execute_region(rcti *rect, unsigned int /*tile_number*/) { for (unsigned int i = 0; i < layers_.size(); i++) { OutputOpenExrLayer &layer = layers_[i]; - if (layer.imageInput) { + if (layer.image_input) { write_buffer_rect( - rect, tree_, layer.imageInput, layer.outputBuffer, this->getWidth(), layer.datatype); + rect, tree_, layer.image_input, layer.output_buffer, this->get_width(), layer.datatype); } } } -void OutputOpenExrMultiLayerOperation::deinitExecution() +void OutputOpenExrMultiLayerOperation::deinit_execution() { - unsigned int width = this->getWidth(); - unsigned int height = this->getHeight(); + unsigned int width = this->get_width(); + unsigned int height = this->get_height(); if (width != 0 && height != 0) { char filename[FILE_MAX]; const char *suffix; void *exrhandle = IMB_exr_get_handle(); - suffix = BKE_scene_multiview_view_suffix_get(rd_, viewName_); + suffix = BKE_scene_multiview_view_suffix_get(rd_, view_name_); BKE_image_path_from_imtype(filename, path_, BKE_main_blendfile_path_from_global(), @@ -406,7 +420,7 @@ void OutputOpenExrMultiLayerOperation::deinitExecution() for (unsigned int i = 0; i < layers_.size(); i++) { OutputOpenExrLayer &layer = layers_[i]; - if (!layer.imageInput) { + if (!layer.image_input) { continue; /* skip unconnected sockets */ } @@ -416,11 +430,11 @@ void OutputOpenExrMultiLayerOperation::deinitExecution() "", width, exr_half_float_, - layers_[i].outputBuffer); + layers_[i].output_buffer); } /* when the filename has no permissions, this can fail */ - StampData *stamp_data = createStampData(); + StampData *stamp_data = create_stamp_data(); if (IMB_exr_begin_write(exrhandle, filename, width, height, exr_codec_, stamp_data)) { IMB_exr_write_channels(exrhandle); } @@ -432,12 +446,12 @@ void OutputOpenExrMultiLayerOperation::deinitExecution() IMB_exr_close(exrhandle); for (unsigned int i = 0; i < layers_.size(); i++) { - if (layers_[i].outputBuffer) { - MEM_freeN(layers_[i].outputBuffer); - layers_[i].outputBuffer = nullptr; + if (layers_[i].output_buffer) { + MEM_freeN(layers_[i].output_buffer); + layers_[i].output_buffer = nullptr; } - layers_[i].imageInput = nullptr; + layers_[i].image_input = nullptr; } BKE_stamp_data_free(stamp_data); } @@ -450,11 +464,11 @@ void OutputOpenExrMultiLayerOperation::update_memory_buffer_partial(MemoryBuffer const MemoryBuffer *input_image = inputs[0]; for (int i = 0; i < layers_.size(); i++) { OutputOpenExrLayer &layer = layers_[i]; - if (layer.outputBuffer) { - MemoryBuffer output_buf(layer.outputBuffer, + if (layer.output_buffer) { + MemoryBuffer output_buf(layer.output_buffer, COM_data_type_num_channels(layer.datatype), - this->getWidth(), - this->getHeight()); + this->get_width(), + this->get_height()); output_buf.copy_from(input_image, area); } } diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.h b/source/blender/compositor/operations/COM_OutputFileOperation.h index e862b964431..2a18b056c12 100644 --- a/source/blender/compositor/operations/COM_OutputFileOperation.h +++ b/source/blender/compositor/operations/COM_OutputFileOperation.h @@ -38,15 +38,15 @@ class OutputSingleLayerOperation : public MultiThreadedOperation { ImageFormatData *format_; char path_[FILE_MAX]; - float *outputBuffer_; + float *output_buffer_; DataType datatype_; - SocketReader *imageInput_; + SocketReader *image_input_; - const ColorManagedViewSettings *viewSettings_; - const ColorManagedDisplaySettings *displaySettings_; + const ColorManagedViewSettings *view_settings_; + const ColorManagedDisplaySettings *display_settings_; - const char *viewName_; - bool saveAsRender_; + const char *view_name_; + bool save_as_render_; public: OutputSingleLayerOperation(const RenderData *rd, @@ -54,19 +54,19 @@ class OutputSingleLayerOperation : public MultiThreadedOperation { DataType datatype, ImageFormatData *format, const char *path, - const ColorManagedViewSettings *viewSettings, - const ColorManagedDisplaySettings *displaySettings, - const char *viewName, - const bool saveAsRender); + const ColorManagedViewSettings *view_settings, + const ColorManagedDisplaySettings *display_settings, + const char *view_name, + const bool save_as_render); - void executeRegion(rcti *rect, unsigned int tileNumber) override; - bool isOutputOperation(bool /*rendering*/) const override + void execute_region(rcti *rect, unsigned int tile_number) override; + bool is_output_operation(bool /*rendering*/) const override { return true; } - void initExecution() override; - void deinitExecution() override; - eCompositorPriority getRenderPriority() const override + void init_execution() override; + void deinit_execution() override; + eCompositorPriority get_render_priority() const override { return eCompositorPriority::Low; } @@ -85,8 +85,8 @@ struct OutputOpenExrLayer { bool use_layer; /* internals */ - float *outputBuffer; - SocketReader *imageInput; + float *output_buffer; + SocketReader *image_input; }; /* Writes inputs into OpenEXR multilayer channels. */ @@ -100,9 +100,9 @@ class OutputOpenExrMultiLayerOperation : public MultiThreadedOperation { char exr_codec_; bool exr_half_float_; Vector<OutputOpenExrLayer> layers_; - const char *viewName_; + const char *view_name_; - StampData *createStampData() const; + StampData *create_stamp_data() const; public: OutputOpenExrMultiLayerOperation(const Scene *scene, @@ -111,18 +111,18 @@ class OutputOpenExrMultiLayerOperation : public MultiThreadedOperation { const char *path, char exr_codec, bool exr_half_float, - const char *viewName); + const char *view_name); void add_layer(const char *name, DataType datatype, bool use_layer); - void executeRegion(rcti *rect, unsigned int tileNumber) override; - bool isOutputOperation(bool /*rendering*/) const override + void execute_region(rcti *rect, unsigned int tile_number) override; + bool is_output_operation(bool /*rendering*/) const override { return true; } - void initExecution() override; - void deinitExecution() override; - eCompositorPriority getRenderPriority() const override + void init_execution() override; + void deinit_execution() override; + eCompositorPriority get_render_priority() const override { return eCompositorPriority::Low; } @@ -133,15 +133,15 @@ class OutputOpenExrMultiLayerOperation : public MultiThreadedOperation { }; void add_exr_channels(void *exrhandle, - const char *layerName, + const char *layer_name, const DataType datatype, - const char *viewName, + const char *view_name, const size_t width, bool use_half_float, float *buf); void free_exr_channels(void *exrhandle, const RenderData *rd, - const char *layerName, + const char *layer_name, const DataType datatype); int get_datatype_size(DataType datatype); diff --git a/source/blender/compositor/operations/COM_PixelateOperation.cc b/source/blender/compositor/operations/COM_PixelateOperation.cc index 0d6e906a4c3..869e2357126 100644 --- a/source/blender/compositor/operations/COM_PixelateOperation.cc +++ b/source/blender/compositor/operations/COM_PixelateOperation.cc @@ -20,32 +20,32 @@ namespace blender::compositor { -PixelateOperation::PixelateOperation(DataType datatype) +PixelateOperation::PixelateOperation(DataType data_type) { - this->addInputSocket(datatype); - this->addOutputSocket(datatype); + this->add_input_socket(data_type); + this->add_output_socket(data_type); this->set_canvas_input_index(0); - inputOperation_ = nullptr; + input_operation_ = nullptr; } -void PixelateOperation::initExecution() +void PixelateOperation::init_execution() { - inputOperation_ = this->getInputSocketReader(0); + input_operation_ = this->get_input_socket_reader(0); } -void PixelateOperation::deinitExecution() +void PixelateOperation::deinit_execution() { - inputOperation_ = nullptr; + input_operation_ = nullptr; } -void PixelateOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void PixelateOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { float nx = round(x); float ny = round(y); - inputOperation_->readSampled(output, nx, ny, sampler); + input_operation_->read_sampled(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 f8155e54f75..51a480b98e9 100644 --- a/source/blender/compositor/operations/COM_PixelateOperation.h +++ b/source/blender/compositor/operations/COM_PixelateOperation.h @@ -34,33 +34,33 @@ class PixelateOperation : public NodeOperation { /** * \brief cached reference to the input operation */ - SocketReader *inputOperation_; + SocketReader *input_operation_; public: /** * \brief PixelateOperation - * \param dataType: the datatype to create this operator for (saves datatype conversions) + * \param data_type: the datatype to create this operator for (saves datatype conversions) */ - PixelateOperation(DataType dataType); + PixelateOperation(DataType data_type); /** * \brief initialization of the execution */ - void initExecution() override; + void init_execution() override; /** * \brief de-initialization of the execution */ - void deinitExecution() override; + void deinit_execution() override; /** - * \brief executePixel + * \brief execute_pixel * \param output: result * \param x: x-coordinate * \param y: y-coordinate * \param sampler: sampler */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(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 fbaab16efc2..6a6692c977d 100644 --- a/source/blender/compositor/operations/COM_PlaneCornerPinOperation.cc +++ b/source/blender/compositor/operations/COM_PlaneCornerPinOperation.cc @@ -56,11 +56,11 @@ static bool check_corners(float corners[4][2]) } /* TODO(manzanilla): to be removed with tiled implementation. */ -static void readCornersFromSockets(rcti *rect, SocketReader *readers[4], float corners[4][2]) +static void read_corners_from_sockets(rcti *rect, SocketReader *readers[4], float corners[4][2]) { 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, PixelSampler::Nearest); + readers[i]->read_sampled(result, rect->xmin, rect->ymin, PixelSampler::Nearest); corners[i][0] = result[0]; corners[i][1] = result[1]; } @@ -136,13 +136,13 @@ static void read_input_corners(NodeOperation *op, const int first_input_idx, flo PlaneCornerPinMaskOperation::PlaneCornerPinMaskOperation() : corners_ready_(false) { - addInputSocket(DataType::Vector); - addInputSocket(DataType::Vector); - addInputSocket(DataType::Vector); - addInputSocket(DataType::Vector); + add_input_socket(DataType::Vector); + add_input_socket(DataType::Vector); + add_input_socket(DataType::Vector); + add_input_socket(DataType::Vector); /* XXX this is stupid: we need to make this "complex", - * so we can use the initializeTileData function + * so we can use the initialize_tile_data function * to read corners from input sockets ... */ flags.complex = true; @@ -153,49 +153,49 @@ void PlaneCornerPinMaskOperation::init_data() if (execution_model_ == eExecutionModel::FullFrame) { float corners[4][2]; read_input_corners(this, 0, corners); - calculateCorners(corners, true, 0); + calculate_corners(corners, true, 0); } } -/* TODO(manzanilla): to be removed with tiled implementation. Same for #deinitExecution and do the +/* TODO(manzanilla): to be removed with tiled implementation. Same for #deinit_execution and do the * same on #PlaneCornerPinWarpImageOperation. */ -void PlaneCornerPinMaskOperation::initExecution() +void PlaneCornerPinMaskOperation::init_execution() { - PlaneDistortMaskOperation::initExecution(); + PlaneDistortMaskOperation::init_execution(); - initMutex(); + init_mutex(); } -void PlaneCornerPinMaskOperation::deinitExecution() +void PlaneCornerPinMaskOperation::deinit_execution() { - PlaneDistortMaskOperation::deinitExecution(); + PlaneDistortMaskOperation::deinit_execution(); - deinitMutex(); + deinit_mutex(); } -void *PlaneCornerPinMaskOperation::initializeTileData(rcti *rect) +void *PlaneCornerPinMaskOperation::initialize_tile_data(rcti *rect) { - void *data = PlaneDistortMaskOperation::initializeTileData(rect); + void *data = PlaneDistortMaskOperation::initialize_tile_data(rect); /* get corner values once, by reading inputs at (0,0) * XXX this assumes invariable values (no image inputs), * we don't have a nice generic system for that yet */ - lockMutex(); + lock_mutex(); if (!corners_ready_) { SocketReader *readers[4] = { - getInputSocketReader(0), - getInputSocketReader(1), - getInputSocketReader(2), - getInputSocketReader(3), + get_input_socket_reader(0), + get_input_socket_reader(1), + get_input_socket_reader(2), + get_input_socket_reader(3), }; float corners[4][2]; - readCornersFromSockets(rect, readers, corners); - calculateCorners(corners, true, 0); + read_corners_from_sockets(rect, readers, corners); + calculate_corners(corners, true, 0); corners_ready_ = true; } - unlockMutex(); + unlock_mutex(); return data; } @@ -221,10 +221,10 @@ void PlaneCornerPinMaskOperation::get_area_of_interest(const int UNUSED(input_id PlaneCornerPinWarpImageOperation::PlaneCornerPinWarpImageOperation() : corners_ready_(false) { - addInputSocket(DataType::Vector); - addInputSocket(DataType::Vector); - addInputSocket(DataType::Vector); - addInputSocket(DataType::Vector); + add_input_socket(DataType::Vector); + add_input_socket(DataType::Vector); + add_input_socket(DataType::Vector); + add_input_socket(DataType::Vector); } void PlaneCornerPinWarpImageOperation::init_data() @@ -232,57 +232,58 @@ void PlaneCornerPinWarpImageOperation::init_data() if (execution_model_ == eExecutionModel::FullFrame) { float corners[4][2]; read_input_corners(this, 1, corners); - calculateCorners(corners, true, 0); + calculate_corners(corners, true, 0); } } -void PlaneCornerPinWarpImageOperation::initExecution() +void PlaneCornerPinWarpImageOperation::init_execution() { - PlaneDistortWarpImageOperation::initExecution(); + PlaneDistortWarpImageOperation::init_execution(); - initMutex(); + init_mutex(); } -void PlaneCornerPinWarpImageOperation::deinitExecution() +void PlaneCornerPinWarpImageOperation::deinit_execution() { - PlaneDistortWarpImageOperation::deinitExecution(); + PlaneDistortWarpImageOperation::deinit_execution(); - deinitMutex(); + deinit_mutex(); } -void *PlaneCornerPinWarpImageOperation::initializeTileData(rcti *rect) +void *PlaneCornerPinWarpImageOperation::initialize_tile_data(rcti *rect) { - void *data = PlaneDistortWarpImageOperation::initializeTileData(rect); + void *data = PlaneDistortWarpImageOperation::initialize_tile_data(rect); /* get corner values once, by reading inputs at (0,0) * XXX this assumes invariable values (no image inputs), * we don't have a nice generic system for that yet */ - lockMutex(); + lock_mutex(); if (!corners_ready_) { /* corner sockets start at index 1 */ SocketReader *readers[4] = { - getInputSocketReader(1), - getInputSocketReader(2), - getInputSocketReader(3), - getInputSocketReader(4), + get_input_socket_reader(1), + get_input_socket_reader(2), + get_input_socket_reader(3), + get_input_socket_reader(4), }; float corners[4][2]; - readCornersFromSockets(rect, readers, corners); - calculateCorners(corners, true, 0); + read_corners_from_sockets(rect, readers, corners); + calculate_corners(corners, true, 0); corners_ready_ = true; } - unlockMutex(); + unlock_mutex(); return data; } -bool PlaneCornerPinWarpImageOperation::determineDependingAreaOfInterest( - rcti *input, ReadBufferOperation *readOperation, rcti *output) +bool PlaneCornerPinWarpImageOperation::determine_depending_area_of_interest( + rcti *input, ReadBufferOperation *read_operation, rcti *output) { for (int i = 0; i < 4; i++) { - if (getInputOperation(i + 1)->determineDependingAreaOfInterest(input, readOperation, output)) { + if (get_input_operation(i + 1)->determine_depending_area_of_interest( + input, read_operation, output)) { return true; } } @@ -293,12 +294,12 @@ bool PlaneCornerPinWarpImageOperation::determineDependingAreaOfInterest( */ output->xmin = 0; output->ymin = 0; - output->xmax = getInputOperation(0)->getWidth(); - output->ymax = getInputOperation(0)->getHeight(); + output->xmax = get_input_operation(0)->get_width(); + output->ymax = get_input_operation(0)->get_height(); return true; #if 0 - return PlaneDistortWarpImageOperation::determineDependingAreaOfInterest( - input, readOperation, output); + return PlaneDistortWarpImageOperation::determine_depending_area_of_interest( + input, read_operation, output); #endif } diff --git a/source/blender/compositor/operations/COM_PlaneCornerPinOperation.h b/source/blender/compositor/operations/COM_PlaneCornerPinOperation.h index 211dcee5132..bb2166bf8b8 100644 --- a/source/blender/compositor/operations/COM_PlaneCornerPinOperation.h +++ b/source/blender/compositor/operations/COM_PlaneCornerPinOperation.h @@ -38,10 +38,10 @@ class PlaneCornerPinMaskOperation : public PlaneDistortMaskOperation { PlaneCornerPinMaskOperation(); void init_data() override; - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; - void *initializeTileData(rcti *rect) override; + void *initialize_tile_data(rcti *rect) override; void determine_canvas(const rcti &preferred_area, rcti &r_area) override; @@ -56,14 +56,14 @@ class PlaneCornerPinWarpImageOperation : public PlaneDistortWarpImageOperation { PlaneCornerPinWarpImageOperation(); void init_data() override; - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; - void *initializeTileData(rcti *rect) override; + void *initialize_tile_data(rcti *rect) override; - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; }; diff --git a/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc b/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc index 8cfa8715cc2..21757e4c97d 100644 --- a/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc +++ b/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.cc @@ -29,29 +29,29 @@ PlaneDistortBaseOperation::PlaneDistortBaseOperation() { } -void PlaneDistortBaseOperation::calculateCorners(const float corners[4][2], - bool normalized, - int sample) +void PlaneDistortBaseOperation::calculate_corners(const float corners[4][2], + bool normalized, + int sample) { BLI_assert(sample < motion_blur_samples_); MotionSample *sample_data = &samples_[sample]; if (normalized) { for (int i = 0; i < 4; i++) { - sample_data->frameSpaceCorners[i][0] = corners[i][0] * this->getWidth(); - sample_data->frameSpaceCorners[i][1] = corners[i][1] * this->getHeight(); + sample_data->frame_space_corners[i][0] = corners[i][0] * this->get_width(); + sample_data->frame_space_corners[i][1] = corners[i][1] * this->get_height(); } } else { for (int i = 0; i < 4; i++) { - sample_data->frameSpaceCorners[i][0] = corners[i][0]; - sample_data->frameSpaceCorners[i][1] = corners[i][1]; + sample_data->frame_space_corners[i][0] = corners[i][0]; + sample_data->frame_space_corners[i][1] = corners[i][1]; } } } /* ******** PlaneDistort WarpImage ******** */ -BLI_INLINE void warpCoord(float x, float y, float matrix[3][3], float uv[2], float deriv[2][2]) +BLI_INLINE void warp_coord(float x, float y, float matrix[3][3], float uv[2], float deriv[2][2]) { float vec[3] = {x, y, 1.0f}; mul_m3_v3(matrix, vec); @@ -66,55 +66,55 @@ BLI_INLINE void warpCoord(float x, float y, float matrix[3][3], float uv[2], flo PlaneDistortWarpImageOperation::PlaneDistortWarpImageOperation() : PlaneDistortBaseOperation() { - this->addInputSocket(DataType::Color, ResizeMode::Align); - this->addOutputSocket(DataType::Color); - pixelReader_ = nullptr; + this->add_input_socket(DataType::Color, ResizeMode::Align); + this->add_output_socket(DataType::Color); + pixel_reader_ = nullptr; this->flags.complex = true; } -void PlaneDistortWarpImageOperation::calculateCorners(const float corners[4][2], - bool normalized, - int sample) +void PlaneDistortWarpImageOperation::calculate_corners(const float corners[4][2], + bool normalized, + int sample) { - PlaneDistortBaseOperation::calculateCorners(corners, normalized, sample); + PlaneDistortBaseOperation::calculate_corners(corners, normalized, sample); const NodeOperation *image = get_input_operation(0); - const int width = image->getWidth(); - const int height = image->getHeight(); + const int width = image->get_width(); + const int height = image->get_height(); float frame_corners[4][2] = { {0.0f, 0.0f}, {(float)width, 0.0f}, {(float)width, (float)height}, {0.0f, (float)height}}; MotionSample *sample_data = &samples_[sample]; BKE_tracking_homography_between_two_quads( - sample_data->frameSpaceCorners, frame_corners, sample_data->perspectiveMatrix); + sample_data->frame_space_corners, frame_corners, sample_data->perspective_matrix); } -void PlaneDistortWarpImageOperation::initExecution() +void PlaneDistortWarpImageOperation::init_execution() { - pixelReader_ = this->getInputSocketReader(0); + pixel_reader_ = this->get_input_socket_reader(0); } -void PlaneDistortWarpImageOperation::deinitExecution() +void PlaneDistortWarpImageOperation::deinit_execution() { - pixelReader_ = nullptr; + pixel_reader_ = nullptr; } -void PlaneDistortWarpImageOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler /*sampler*/) +void PlaneDistortWarpImageOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler /*sampler*/) { float uv[2]; float deriv[2][2]; if (motion_blur_samples_ == 1) { - warpCoord(x, y, samples_[0].perspectiveMatrix, uv, deriv); - pixelReader_->readFiltered(output, uv[0], uv[1], deriv[0], deriv[1]); + warp_coord(x, y, samples_[0].perspective_matrix, uv, deriv); + pixel_reader_->read_filtered(output, uv[0], uv[1], deriv[0], deriv[1]); } else { zero_v4(output); for (int sample = 0; sample < motion_blur_samples_; sample++) { float color[4]; - warpCoord(x, y, samples_[sample].perspectiveMatrix, uv, deriv); - pixelReader_->readFiltered(color, uv[0], uv[1], deriv[0], deriv[1]); + warp_coord(x, y, samples_[sample].perspective_matrix, uv, deriv); + pixel_reader_->read_filtered(color, uv[0], uv[1], deriv[0], deriv[1]); add_v4_v4(output, color); } mul_v4_fl(output, 1.0f / (float)motion_blur_samples_); @@ -131,7 +131,7 @@ void PlaneDistortWarpImageOperation::update_memory_buffer_partial(MemoryBuffer * BuffersIterator<float> it = output->iterate_with({}, area); if (motion_blur_samples_ == 1) { for (; !it.is_end(); ++it) { - warpCoord(it.x, it.y, samples_[0].perspectiveMatrix, uv, deriv); + warp_coord(it.x, it.y, samples_[0].perspective_matrix, uv, deriv); input_img->read_elem_filtered(uv[0], uv[1], deriv[0], deriv[1], it.out); } } @@ -140,7 +140,7 @@ void PlaneDistortWarpImageOperation::update_memory_buffer_partial(MemoryBuffer * zero_v4(it.out); for (const int sample : IndexRange(motion_blur_samples_)) { float color[4]; - warpCoord(it.x, it.y, samples_[sample].perspectiveMatrix, uv, deriv); + warp_coord(it.x, it.y, samples_[sample].perspective_matrix, uv, deriv); input_img->read_elem_filtered(uv[0], uv[1], deriv[0], deriv[1], color); add_v4_v4(it.out, color); } @@ -149,8 +149,8 @@ void PlaneDistortWarpImageOperation::update_memory_buffer_partial(MemoryBuffer * } } -bool PlaneDistortWarpImageOperation::determineDependingAreaOfInterest( - rcti *input, ReadBufferOperation *readOperation, rcti *output) +bool PlaneDistortWarpImageOperation::determine_depending_area_of_interest( + rcti *input, ReadBufferOperation *read_operation, rcti *output) { float min[2], max[2]; INIT_MINMAX2(min, max); @@ -160,23 +160,23 @@ bool PlaneDistortWarpImageOperation::determineDependingAreaOfInterest( float deriv[2][2]; MotionSample *sample_data = &samples_[sample]; /* TODO(sergey): figure out proper way to do this. */ - warpCoord(input->xmin - 2, input->ymin - 2, sample_data->perspectiveMatrix, UVs[0], deriv); - warpCoord(input->xmax + 2, input->ymin - 2, sample_data->perspectiveMatrix, UVs[1], deriv); - warpCoord(input->xmax + 2, input->ymax + 2, sample_data->perspectiveMatrix, UVs[2], deriv); - warpCoord(input->xmin - 2, input->ymax + 2, sample_data->perspectiveMatrix, UVs[3], deriv); + warp_coord(input->xmin - 2, input->ymin - 2, sample_data->perspective_matrix, UVs[0], deriv); + warp_coord(input->xmax + 2, input->ymin - 2, sample_data->perspective_matrix, UVs[1], deriv); + warp_coord(input->xmax + 2, input->ymax + 2, sample_data->perspective_matrix, UVs[2], deriv); + warp_coord(input->xmin - 2, input->ymax + 2, sample_data->perspective_matrix, UVs[3], deriv); for (int i = 0; i < 4; i++) { minmax_v2v2_v2(min, max, UVs[i]); } } - rcti newInput; + rcti new_input; - newInput.xmin = min[0] - 1; - newInput.ymin = min[1] - 1; - newInput.xmax = max[0] + 1; - newInput.ymax = max[1] + 1; + new_input.xmin = min[0] - 1; + new_input.ymin = min[1] - 1; + new_input.xmax = max[0] + 1; + new_input.ymax = max[1] + 1; - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } void PlaneDistortWarpImageOperation::get_area_of_interest(const int input_idx, @@ -201,14 +201,14 @@ void PlaneDistortWarpImageOperation::get_area_of_interest(const int input_idx, float deriv[2][2]; MotionSample *sample_data = &samples_[sample]; /* TODO(sergey): figure out proper way to do this. */ - warpCoord( - output_area.xmin - 2, output_area.ymin - 2, sample_data->perspectiveMatrix, UVs[0], deriv); - warpCoord( - output_area.xmax + 2, output_area.ymin - 2, sample_data->perspectiveMatrix, UVs[1], deriv); - warpCoord( - output_area.xmax + 2, output_area.ymax + 2, sample_data->perspectiveMatrix, UVs[2], deriv); - warpCoord( - output_area.xmin - 2, output_area.ymax + 2, sample_data->perspectiveMatrix, UVs[3], deriv); + warp_coord( + output_area.xmin - 2, output_area.ymin - 2, sample_data->perspective_matrix, UVs[0], deriv); + warp_coord( + output_area.xmax + 2, output_area.ymin - 2, sample_data->perspective_matrix, UVs[1], deriv); + warp_coord( + output_area.xmax + 2, output_area.ymax + 2, sample_data->perspective_matrix, UVs[2], deriv); + warp_coord( + output_area.xmin - 2, output_area.ymax + 2, sample_data->perspective_matrix, UVs[3], deriv); for (int i = 0; i < 4; i++) { minmax_v2v2_v2(min, max, UVs[i]); } @@ -225,21 +225,21 @@ void PlaneDistortWarpImageOperation::get_area_of_interest(const int input_idx, PlaneDistortMaskOperation::PlaneDistortMaskOperation() : PlaneDistortBaseOperation() { - addOutputSocket(DataType::Value); + add_output_socket(DataType::Value); /* Currently hardcoded to 8 samples. */ osa_ = 8; } -void PlaneDistortMaskOperation::initExecution() +void PlaneDistortMaskOperation::init_execution() { BLI_jitter_init(jitter_, osa_); } -void PlaneDistortMaskOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler /*sampler*/) +void PlaneDistortMaskOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler /*sampler*/) { float point[2]; int inside_counter = 0; @@ -249,13 +249,13 @@ void PlaneDistortMaskOperation::executePixelSampled(float output[4], point[0] = x + jitter_[sample][0]; point[1] = y + jitter_[sample][1]; if (isect_point_tri_v2(point, - sample_data->frameSpaceCorners[0], - sample_data->frameSpaceCorners[1], - sample_data->frameSpaceCorners[2]) || + sample_data->frame_space_corners[0], + sample_data->frame_space_corners[1], + sample_data->frame_space_corners[2]) || isect_point_tri_v2(point, - sample_data->frameSpaceCorners[0], - sample_data->frameSpaceCorners[2], - sample_data->frameSpaceCorners[3])) { + sample_data->frame_space_corners[0], + sample_data->frame_space_corners[2], + sample_data->frame_space_corners[3])) { inside_counter++; } } @@ -268,13 +268,13 @@ void PlaneDistortMaskOperation::executePixelSampled(float output[4], point[0] = x + jitter_[osa_sample][0]; point[1] = y + jitter_[osa_sample][1]; if (isect_point_tri_v2(point, - sample_data->frameSpaceCorners[0], - sample_data->frameSpaceCorners[1], - sample_data->frameSpaceCorners[2]) || + sample_data->frame_space_corners[0], + sample_data->frame_space_corners[1], + sample_data->frame_space_corners[2]) || isect_point_tri_v2(point, - sample_data->frameSpaceCorners[0], - sample_data->frameSpaceCorners[2], - sample_data->frameSpaceCorners[3])) { + sample_data->frame_space_corners[0], + sample_data->frame_space_corners[2], + sample_data->frame_space_corners[3])) { inside_counter++; } } @@ -307,13 +307,13 @@ int PlaneDistortMaskOperation::get_jitter_samples_inside_count(int x, point[0] = x + jitter_[sample][0]; point[1] = y + jitter_[sample][1]; if (isect_point_tri_v2(point, - sample_data.frameSpaceCorners[0], - sample_data.frameSpaceCorners[1], - sample_data.frameSpaceCorners[2]) || + sample_data.frame_space_corners[0], + sample_data.frame_space_corners[1], + sample_data.frame_space_corners[2]) || isect_point_tri_v2(point, - sample_data.frameSpaceCorners[0], - sample_data.frameSpaceCorners[2], - sample_data.frameSpaceCorners[3])) { + sample_data.frame_space_corners[0], + sample_data.frame_space_corners[2], + sample_data.frame_space_corners[3])) { inside_count++; } } diff --git a/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.h b/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.h index e9880624ebf..bf330ed7230 100644 --- a/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.h +++ b/source/blender/compositor/operations/COM_PlaneDistortCommonOperation.h @@ -35,8 +35,8 @@ namespace blender::compositor { class PlaneDistortBaseOperation : public MultiThreadedOperation { protected: struct MotionSample { - float frameSpaceCorners[4][2]; /* Corners coordinates in pixel space. */ - float perspectiveMatrix[3][3]; + float frame_space_corners[4][2]; /* Corners coordinates in pixel space. */ + float perspective_matrix[3][3]; }; MotionSample samples_[PLANE_DISTORT_MAX_SAMPLES]; int motion_blur_samples_; @@ -45,17 +45,17 @@ class PlaneDistortBaseOperation : public MultiThreadedOperation { public: PlaneDistortBaseOperation(); - void setMotionBlurSamples(int samples) + void set_motion_blur_samples(int samples) { BLI_assert(samples <= PLANE_DISTORT_MAX_SAMPLES); motion_blur_samples_ = samples; } - void setMotionBlurShutter(float shutter) + void set_motion_blur_shutter(float shutter) { motion_blur_shutter_ = shutter; } - virtual void calculateCorners(const float corners[4][2], bool normalized, int sample); + virtual void calculate_corners(const float corners[4][2], bool normalized, int sample); private: friend class PlaneTrackCommon; @@ -63,21 +63,21 @@ class PlaneDistortBaseOperation : public MultiThreadedOperation { class PlaneDistortWarpImageOperation : public PlaneDistortBaseOperation { protected: - SocketReader *pixelReader_; + SocketReader *pixel_reader_; public: PlaneDistortWarpImageOperation(); - void calculateCorners(const float corners[4][2], bool normalized, int sample) override; + void calculate_corners(const float corners[4][2], bool normalized, int sample) override; - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; void update_memory_buffer_partial(MemoryBuffer *output, @@ -93,9 +93,9 @@ class PlaneDistortMaskOperation : public PlaneDistortBaseOperation { public: PlaneDistortMaskOperation(); - void initExecution() override; + void init_execution() override; - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, diff --git a/source/blender/compositor/operations/COM_PlaneTrackOperation.cc b/source/blender/compositor/operations/COM_PlaneTrackOperation.cc index 1f40556a935..28da200c615 100644 --- a/source/blender/compositor/operations/COM_PlaneTrackOperation.cc +++ b/source/blender/compositor/operations/COM_PlaneTrackOperation.cc @@ -27,18 +27,18 @@ namespace blender::compositor { PlaneTrackCommon::PlaneTrackCommon() { - movieClip_ = nullptr; + movie_clip_ = nullptr; framenumber_ = 0; - trackingObjectName_[0] = '\0'; - planeTrackName_[0] = '\0'; + tracking_object_name_[0] = '\0'; + plane_track_name_[0] = '\0'; } void PlaneTrackCommon::read_and_calculate_corners(PlaneDistortBaseOperation *distort_op) { float corners[4][2]; if (distort_op->motion_blur_samples_ == 1) { - readCornersFromTrack(corners, framenumber_); - distort_op->calculateCorners(corners, true, 0); + read_corners_from_track(corners, framenumber_); + distort_op->calculate_corners(corners, true, 0); } else { const float frame = (float)framenumber_ - distort_op->motion_blur_shutter_; @@ -46,30 +46,30 @@ void PlaneTrackCommon::read_and_calculate_corners(PlaneDistortBaseOperation *dis distort_op->motion_blur_samples_; float frame_iter = frame; for (int sample = 0; sample < distort_op->motion_blur_samples_; sample++) { - readCornersFromTrack(corners, frame_iter); - distort_op->calculateCorners(corners, true, sample); + read_corners_from_track(corners, frame_iter); + distort_op->calculate_corners(corners, true, sample); frame_iter += frame_step; } } } -void PlaneTrackCommon::readCornersFromTrack(float corners[4][2], float frame) +void PlaneTrackCommon::read_corners_from_track(float corners[4][2], float frame) { MovieTracking *tracking; MovieTrackingObject *object; - if (!movieClip_) { + if (!movie_clip_) { return; } - tracking = &movieClip_->tracking; + tracking = &movie_clip_->tracking; - object = BKE_tracking_object_get_named(tracking, trackingObjectName_); + object = BKE_tracking_object_get_named(tracking, tracking_object_name_); if (object) { MovieTrackingPlaneTrack *plane_track; - plane_track = BKE_tracking_plane_track_get_named(tracking, object, planeTrackName_); + plane_track = BKE_tracking_plane_track_get_named(tracking, object, plane_track_name_); if (plane_track) { - float clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(movieClip_, frame); + float clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(movie_clip_, frame); BKE_tracking_plane_marker_get_subframe_corners(plane_track, clip_framenr, corners); } } @@ -78,11 +78,11 @@ void PlaneTrackCommon::readCornersFromTrack(float corners[4][2], float frame) void PlaneTrackCommon::determine_canvas(const rcti &preferred_area, rcti &r_area) { r_area = COM_AREA_NONE; - if (movieClip_) { + if (movie_clip_) { int width, height; MovieClipUser user = {0}; BKE_movieclip_user_set_frame(&user, framenumber_); - BKE_movieclip_get_size(movieClip_, &user, &width, &height); + BKE_movieclip_get_size(movie_clip_, &user, &width, &height); r_area = preferred_area; r_area.xmax = r_area.xmin + width; r_area.ymax = r_area.ymin + height; @@ -100,9 +100,9 @@ void PlaneTrackMaskOperation::init_data() } /* TODO(manzanilla): to be removed with tiled implementation. */ -void PlaneTrackMaskOperation::initExecution() +void PlaneTrackMaskOperation::init_execution() { - PlaneDistortMaskOperation::initExecution(); + PlaneDistortMaskOperation::init_execution(); if (execution_model_ == eExecutionModel::Tiled) { PlaneTrackCommon::read_and_calculate_corners(this); } @@ -119,9 +119,9 @@ void PlaneTrackWarpImageOperation::init_data() } /* TODO(manzanilla): to be removed with tiled implementation. */ -void PlaneTrackWarpImageOperation::initExecution() +void PlaneTrackWarpImageOperation::init_execution() { - PlaneDistortWarpImageOperation::initExecution(); + PlaneDistortWarpImageOperation::init_execution(); if (execution_model_ == eExecutionModel::Tiled) { PlaneTrackCommon::read_and_calculate_corners(this); } diff --git a/source/blender/compositor/operations/COM_PlaneTrackOperation.h b/source/blender/compositor/operations/COM_PlaneTrackOperation.h index d3dbd092024..4c584ca43f4 100644 --- a/source/blender/compositor/operations/COM_PlaneTrackOperation.h +++ b/source/blender/compositor/operations/COM_PlaneTrackOperation.h @@ -32,10 +32,10 @@ namespace blender::compositor { class PlaneTrackCommon { protected: - MovieClip *movieClip_; + MovieClip *movie_clip_; int framenumber_; - char trackingObjectName_[64]; - char planeTrackName_[64]; + char tracking_object_name_[64]; + char plane_track_name_[64]; /* NOTE: this class is not an operation itself (to prevent virtual inheritance issues) * implementation classes must make wrappers to use these methods, see below. @@ -46,25 +46,25 @@ class PlaneTrackCommon { public: PlaneTrackCommon(); - void setMovieClip(MovieClip *clip) + void set_movie_clip(MovieClip *clip) { - movieClip_ = clip; + movie_clip_ = clip; } - void setTrackingObject(char *object) + void set_tracking_object(char *object) { - BLI_strncpy(trackingObjectName_, object, sizeof(trackingObjectName_)); + BLI_strncpy(tracking_object_name_, object, sizeof(tracking_object_name_)); } - void setPlaneTrackName(char *plane_track) + void set_plane_track_name(char *plane_track) { - BLI_strncpy(planeTrackName_, plane_track, sizeof(planeTrackName_)); + BLI_strncpy(plane_track_name_, plane_track, sizeof(plane_track_name_)); } - void setFramenumber(int framenumber) + void set_framenumber(int framenumber) { framenumber_ = framenumber; } private: - void readCornersFromTrack(float corners[4][2], float frame); + void read_corners_from_track(float corners[4][2], float frame); }; class PlaneTrackMaskOperation : public PlaneDistortMaskOperation, public PlaneTrackCommon { @@ -75,7 +75,7 @@ class PlaneTrackMaskOperation : public PlaneDistortMaskOperation, public PlaneTr void init_data() override; - void initExecution() override; + void init_execution() override; void determine_canvas(const rcti &preferred_area, rcti &r_area) override { @@ -96,7 +96,7 @@ class PlaneTrackWarpImageOperation : public PlaneDistortWarpImageOperation, void init_data() override; - void initExecution() override; + void init_execution() override; void determine_canvas(const rcti &preferred_area, rcti &r_area) override { diff --git a/source/blender/compositor/operations/COM_PosterizeOperation.cc b/source/blender/compositor/operations/COM_PosterizeOperation.cc index 44a86f1d9de..c43520d103c 100644 --- a/source/blender/compositor/operations/COM_PosterizeOperation.cc +++ b/source/blender/compositor/operations/COM_PosterizeOperation.cc @@ -22,37 +22,37 @@ namespace blender::compositor { PosterizeOperation::PosterizeOperation() { - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Color); - inputProgram_ = nullptr; - inputStepsProgram_ = nullptr; + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Color); + input_program_ = nullptr; + input_steps_program_ = nullptr; flags.can_be_constant = true; } -void PosterizeOperation::initExecution() +void PosterizeOperation::init_execution() { - inputProgram_ = this->getInputSocketReader(0); - inputStepsProgram_ = this->getInputSocketReader(1); + input_program_ = this->get_input_socket_reader(0); + input_steps_program_ = this->get_input_socket_reader(1); } -void PosterizeOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void PosterizeOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inputValue[4]; - float inputSteps[4]; + float input_value[4]; + float input_steps[4]; - inputProgram_->readSampled(inputValue, x, y, sampler); - inputStepsProgram_->readSampled(inputSteps, x, y, sampler); - CLAMP(inputSteps[0], 2.0f, 1024.0f); - const float steps_inv = 1.0f / inputSteps[0]; + input_program_->read_sampled(input_value, x, y, sampler); + input_steps_program_->read_sampled(input_steps, x, y, sampler); + CLAMP(input_steps[0], 2.0f, 1024.0f); + const float steps_inv = 1.0f / input_steps[0]; - output[0] = floor(inputValue[0] / steps_inv) * steps_inv; - output[1] = floor(inputValue[1] / steps_inv) * steps_inv; - output[2] = floor(inputValue[2] / steps_inv) * steps_inv; - output[3] = inputValue[3]; + output[0] = floor(input_value[0] / steps_inv) * steps_inv; + output[1] = floor(input_value[1] / steps_inv) * steps_inv; + output[2] = floor(input_value[2] / steps_inv) * steps_inv; + output[3] = input_value[3]; } void PosterizeOperation::update_memory_buffer_partial(MemoryBuffer *output, @@ -73,10 +73,10 @@ void PosterizeOperation::update_memory_buffer_partial(MemoryBuffer *output, } } -void PosterizeOperation::deinitExecution() +void PosterizeOperation::deinit_execution() { - inputProgram_ = nullptr; - inputStepsProgram_ = nullptr; + input_program_ = nullptr; + input_steps_program_ = nullptr; } } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_PosterizeOperation.h b/source/blender/compositor/operations/COM_PosterizeOperation.h index 58ce599c6fe..70e516bccf8 100644 --- a/source/blender/compositor/operations/COM_PosterizeOperation.h +++ b/source/blender/compositor/operations/COM_PosterizeOperation.h @@ -25,10 +25,10 @@ namespace blender::compositor { class PosterizeOperation : public MultiThreadedOperation { private: /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputProgram_; - SocketReader *inputStepsProgram_; + SocketReader *input_program_; + SocketReader *input_steps_program_; public: PosterizeOperation(); @@ -36,17 +36,17 @@ class PosterizeOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, diff --git a/source/blender/compositor/operations/COM_PreviewOperation.cc b/source/blender/compositor/operations/COM_PreviewOperation.cc index 960cfda9ec0..f46f0f5b13f 100644 --- a/source/blender/compositor/operations/COM_PreviewOperation.cc +++ b/source/blender/compositor/operations/COM_PreviewOperation.cc @@ -23,70 +23,70 @@ namespace blender::compositor { -PreviewOperation::PreviewOperation(const ColorManagedViewSettings *viewSettings, - const ColorManagedDisplaySettings *displaySettings, - const unsigned int defaultWidth, - const unsigned int defaultHeight) +PreviewOperation::PreviewOperation(const ColorManagedViewSettings *view_settings, + const ColorManagedDisplaySettings *display_settings, + const unsigned int default_width, + const unsigned int default_height) { - this->addInputSocket(DataType::Color, ResizeMode::Align); + this->add_input_socket(DataType::Color, ResizeMode::Align); preview_ = nullptr; - outputBuffer_ = nullptr; + output_buffer_ = nullptr; input_ = nullptr; divider_ = 1.0f; - viewSettings_ = viewSettings; - displaySettings_ = displaySettings; - defaultWidth_ = defaultWidth; - defaultHeight_ = defaultHeight; + view_settings_ = view_settings; + display_settings_ = display_settings; + default_width_ = default_width; + default_height_ = default_height; flags.use_viewer_border = true; flags.is_preview_operation = true; } -void PreviewOperation::verifyPreview(bNodeInstanceHash *previews, bNodeInstanceKey key) +void PreviewOperation::verify_preview(bNodeInstanceHash *previews, bNodeInstanceKey key) { /* Size (0, 0) ensures the preview rect is not allocated in advance, - * this is set later in initExecution once the resolution is determined. + * this is set later in init_execution once the resolution is determined. */ preview_ = BKE_node_preview_verify(previews, key, 0, 0, true); } -void PreviewOperation::initExecution() +void PreviewOperation::init_execution() { - input_ = getInputSocketReader(0); + input_ = get_input_socket_reader(0); - if (this->getWidth() == (unsigned int)preview_->xsize && - this->getHeight() == (unsigned int)preview_->ysize) { - outputBuffer_ = preview_->rect; + if (this->get_width() == (unsigned int)preview_->xsize && + this->get_height() == (unsigned int)preview_->ysize) { + output_buffer_ = preview_->rect; } - if (outputBuffer_ == nullptr) { - outputBuffer_ = (unsigned char *)MEM_callocN( - sizeof(unsigned char) * 4 * getWidth() * getHeight(), "PreviewOperation"); + if (output_buffer_ == nullptr) { + output_buffer_ = (unsigned char *)MEM_callocN( + sizeof(unsigned char) * 4 * get_width() * get_height(), "PreviewOperation"); if (preview_->rect) { MEM_freeN(preview_->rect); } - preview_->xsize = getWidth(); - preview_->ysize = getHeight(); - preview_->rect = outputBuffer_; + preview_->xsize = get_width(); + preview_->ysize = get_height(); + preview_->rect = output_buffer_; } } -void PreviewOperation::deinitExecution() +void PreviewOperation::deinit_execution() { - outputBuffer_ = nullptr; + output_buffer_ = nullptr; input_ = nullptr; } -void PreviewOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/) +void PreviewOperation::execute_region(rcti *rect, unsigned int /*tile_number*/) { int offset; float color[4]; struct ColormanageProcessor *cm_processor; - cm_processor = IMB_colormanagement_display_processor_new(viewSettings_, displaySettings_); + cm_processor = IMB_colormanagement_display_processor_new(view_settings_, display_settings_); for (int y = rect->ymin; y < rect->ymax; y++) { - offset = (y * getWidth() + rect->xmin) * 4; + offset = (y * get_width() + rect->xmin) * 4; for (int x = rect->xmin; x < rect->xmax; x++) { float rx = floor(x / divider_); float ry = floor(y / divider_); @@ -95,35 +95,35 @@ void PreviewOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/) color[1] = 0.0f; color[2] = 0.0f; color[3] = 1.0f; - input_->readSampled(color, rx, ry, PixelSampler::Nearest); + input_->read_sampled(color, rx, ry, PixelSampler::Nearest); IMB_colormanagement_processor_apply_v4(cm_processor, color); - rgba_float_to_uchar(outputBuffer_ + offset, color); + rgba_float_to_uchar(output_buffer_ + offset, color); offset += 4; } } IMB_colormanagement_processor_free(cm_processor); } -bool PreviewOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool PreviewOperation::determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) { - rcti newInput; + rcti new_input; - newInput.xmin = input->xmin / divider_; - newInput.xmax = input->xmax / divider_; - newInput.ymin = input->ymin / divider_; - newInput.ymax = input->ymax / divider_; + new_input.xmin = input->xmin / divider_; + new_input.xmax = input->xmax / divider_; + new_input.ymin = input->ymin / divider_; + new_input.ymax = input->ymax / divider_; - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } void PreviewOperation::determine_canvas(const rcti &UNUSED(preferred_area), rcti &r_area) { /* Use default preview resolution as preferred ensuring it has size so that * generated inputs (which don't have resolution on their own) are displayed */ - BLI_assert(defaultWidth_ > 0 && defaultHeight_ > 0); + BLI_assert(default_width_ > 0 && default_height_ > 0); rcti local_preferred; - BLI_rcti_init(&local_preferred, 0, defaultWidth_, 0, defaultHeight_); + BLI_rcti_init(&local_preferred, 0, default_width_, 0, default_height_); NodeOperation::determine_canvas(local_preferred, r_area); /* If resolution is 0 there are two possible scenarios: @@ -152,7 +152,7 @@ void PreviewOperation::determine_canvas(const rcti &UNUSED(preferred_area), rcti BLI_rcti_init(&r_area, r_area.xmin, r_area.xmin + width, r_area.ymin, r_area.ymin + height); } -eCompositorPriority PreviewOperation::getRenderPriority() const +eCompositorPriority PreviewOperation::get_render_priority() const { return eCompositorPriority::Low; } @@ -176,12 +176,12 @@ void PreviewOperation::update_memory_buffer_partial(MemoryBuffer *UNUSED(output) { MemoryBuffer *input = inputs[0]; struct ColormanageProcessor *cm_processor = IMB_colormanagement_display_processor_new( - viewSettings_, displaySettings_); + view_settings_, display_settings_); rcti buffer_area; - BLI_rcti_init(&buffer_area, 0, this->getWidth(), 0, this->getHeight()); + BLI_rcti_init(&buffer_area, 0, this->get_width(), 0, this->get_height()); BuffersIteratorBuilder<uchar> it_builder( - outputBuffer_, buffer_area, area, COM_data_type_num_channels(DataType::Color)); + output_buffer_, buffer_area, area, COM_data_type_num_channels(DataType::Color)); for (BuffersIterator<uchar> it = it_builder.build(); !it.is_end(); ++it) { const float rx = it.x / divider_; diff --git a/source/blender/compositor/operations/COM_PreviewOperation.h b/source/blender/compositor/operations/COM_PreviewOperation.h index 1df8815d62b..97d1884c9a7 100644 --- a/source/blender/compositor/operations/COM_PreviewOperation.h +++ b/source/blender/compositor/operations/COM_PreviewOperation.h @@ -28,7 +28,7 @@ namespace blender::compositor { class PreviewOperation : public MultiThreadedOperation { protected: - unsigned char *outputBuffer_; + unsigned char *output_buffer_; /** * \brief holds reference to the SDNA bNode, where this nodes will render the preview image for @@ -36,32 +36,32 @@ class PreviewOperation : public MultiThreadedOperation { bNodePreview *preview_; SocketReader *input_; float divider_; - unsigned int defaultWidth_; - unsigned int defaultHeight_; + unsigned int default_width_; + unsigned int default_height_; - const ColorManagedViewSettings *viewSettings_; - const ColorManagedDisplaySettings *displaySettings_; + const ColorManagedViewSettings *view_settings_; + const ColorManagedDisplaySettings *display_settings_; public: - PreviewOperation(const ColorManagedViewSettings *viewSettings, - const ColorManagedDisplaySettings *displaySettings, - unsigned int defaultWidth, - unsigned int defaultHeight); - void verifyPreview(bNodeInstanceHash *previews, bNodeInstanceKey key); + PreviewOperation(const ColorManagedViewSettings *view_settings, + const ColorManagedDisplaySettings *display_settings, + unsigned int default_width, + unsigned int default_height); + void verify_preview(bNodeInstanceHash *previews, bNodeInstanceKey key); - bool isOutputOperation(bool /*rendering*/) const override + bool is_output_operation(bool /*rendering*/) const override { return !G.background; } - void initExecution() override; - void deinitExecution() override; - eCompositorPriority getRenderPriority() const override; + void init_execution() override; + void deinit_execution() override; + eCompositorPriority get_render_priority() const override; - void executeRegion(rcti *rect, unsigned int tileNumber) override; + void execute_region(rcti *rect, unsigned int tile_number) override; void determine_canvas(const rcti &preferred_area, rcti &r_area) override; - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; void update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cc b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cc index 8e6aa7e8db8..436fdb16e8d 100644 --- a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cc +++ b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.cc @@ -23,12 +23,12 @@ namespace blender::compositor { ProjectorLensDistortionOperation::ProjectorLensDistortionOperation() { - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Color); this->flags.complex = true; - inputProgram_ = nullptr; - dispersionAvailable_ = false; + input_program_ = nullptr; + dispersion_available_ = false; dispersion_ = 0.0f; } @@ -44,87 +44,87 @@ void ProjectorLensDistortionOperation::init_data() } } -void ProjectorLensDistortionOperation::initExecution() +void ProjectorLensDistortionOperation::init_execution() { - this->initMutex(); - inputProgram_ = this->getInputSocketReader(0); + this->init_mutex(); + input_program_ = this->get_input_socket_reader(0); } -void *ProjectorLensDistortionOperation::initializeTileData(rcti * /*rect*/) +void *ProjectorLensDistortionOperation::initialize_tile_data(rcti * /*rect*/) { - updateDispersion(); - void *buffer = inputProgram_->initializeTileData(nullptr); + update_dispersion(); + void *buffer = input_program_->initialize_tile_data(nullptr); return buffer; } -void ProjectorLensDistortionOperation::executePixel(float output[4], int x, int y, void *data) +void ProjectorLensDistortionOperation::execute_pixel(float output[4], int x, int y, void *data) { - float inputValue[4]; - const float height = this->getHeight(); - const float width = this->getWidth(); + float input_value[4]; + const float height = this->get_height(); + const float width = this->get_width(); const float v = (y + 0.5f) / height; const float u = (x + 0.5f) / width; - MemoryBuffer *inputBuffer = (MemoryBuffer *)data; - inputBuffer->readBilinear(inputValue, (u * width + kr2_) - 0.5f, v * height - 0.5f); - output[0] = inputValue[0]; - inputBuffer->read(inputValue, x, y); - output[1] = inputValue[1]; - inputBuffer->readBilinear(inputValue, (u * width - kr2_) - 0.5f, v * height - 0.5f); - output[2] = inputValue[2]; + MemoryBuffer *input_buffer = (MemoryBuffer *)data; + input_buffer->read_bilinear(input_value, (u * width + kr2_) - 0.5f, v * height - 0.5f); + output[0] = input_value[0]; + input_buffer->read(input_value, x, y); + output[1] = input_value[1]; + input_buffer->read_bilinear(input_value, (u * width - kr2_) - 0.5f, v * height - 0.5f); + output[2] = input_value[2]; output[3] = 1.0f; } -void ProjectorLensDistortionOperation::deinitExecution() +void ProjectorLensDistortionOperation::deinit_execution() { - this->deinitMutex(); - inputProgram_ = nullptr; + this->deinit_mutex(); + input_program_ = nullptr; } -bool ProjectorLensDistortionOperation::determineDependingAreaOfInterest( - rcti *input, ReadBufferOperation *readOperation, rcti *output) +bool ProjectorLensDistortionOperation::determine_depending_area_of_interest( + rcti *input, ReadBufferOperation *read_operation, rcti *output) { - rcti newInput; - if (dispersionAvailable_) { - newInput.ymax = input->ymax; - newInput.ymin = input->ymin; - newInput.xmin = input->xmin - kr2_ - 2; - newInput.xmax = input->xmax + kr2_ + 2; + rcti new_input; + if (dispersion_available_) { + new_input.ymax = input->ymax; + new_input.ymin = input->ymin; + new_input.xmin = input->xmin - kr2_ - 2; + new_input.xmax = input->xmax + kr2_ + 2; } else { - rcti dispInput; - BLI_rcti_init(&dispInput, 0, 5, 0, 5); - if (this->getInputOperation(1)->determineDependingAreaOfInterest( - &dispInput, readOperation, output)) { + rcti disp_input; + BLI_rcti_init(&disp_input, 0, 5, 0, 5); + if (this->get_input_operation(1)->determine_depending_area_of_interest( + &disp_input, read_operation, output)) { return true; } - newInput.xmin = input->xmin - 7; /* (0.25f * 20 * 1) + 2 == worse case dispersion */ - newInput.ymin = input->ymin; - newInput.ymax = input->ymax; - newInput.xmax = input->xmax + 7; /* (0.25f * 20 * 1) + 2 == worse case dispersion */ + new_input.xmin = input->xmin - 7; /* (0.25f * 20 * 1) + 2 == worse case dispersion */ + new_input.ymin = input->ymin; + new_input.ymax = input->ymax; + new_input.xmax = input->xmax + 7; /* (0.25f * 20 * 1) + 2 == worse case dispersion */ } - if (this->getInputOperation(0)->determineDependingAreaOfInterest( - &newInput, readOperation, output)) { + if (this->get_input_operation(0)->determine_depending_area_of_interest( + &new_input, read_operation, output)) { return true; } return false; } /* TODO(manzanilla): to be removed with tiled implementation. */ -void ProjectorLensDistortionOperation::updateDispersion() +void ProjectorLensDistortionOperation::update_dispersion() { - if (dispersionAvailable_) { + if (dispersion_available_) { return; } - this->lockMutex(); - if (!dispersionAvailable_) { + this->lock_mutex(); + if (!dispersion_available_) { float result[4]; - this->getInputSocketReader(1)->readSampled(result, 1, 1, PixelSampler::Nearest); + this->get_input_socket_reader(1)->read_sampled(result, 1, 1, PixelSampler::Nearest); dispersion_ = result[0]; kr_ = 0.25f * max_ff(min_ff(dispersion_, 1.0f), 0.0f); kr2_ = kr_ * 20; - dispersionAvailable_ = true; + dispersion_available_ = true; } - this->unlockMutex(); + this->unlock_mutex(); } void ProjectorLensDistortionOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) @@ -165,8 +165,8 @@ void ProjectorLensDistortionOperation::update_memory_buffer_partial(MemoryBuffer Span<MemoryBuffer *> inputs) { const MemoryBuffer *input_image = inputs[0]; - const float height = this->getHeight(); - const float width = this->getWidth(); + const float height = this->get_height(); + const float width = this->get_width(); float color[4]; for (BuffersIterator<float> it = output->iterate_with({}, area); !it.is_end(); ++it) { const float v = (it.y + 0.5f) / height; diff --git a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h index af9b216db07..ea90840e61c 100644 --- a/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h +++ b/source/blender/compositor/operations/COM_ProjectorLensDistortionOperation.h @@ -26,13 +26,13 @@ namespace blender::compositor { class ProjectorLensDistortionOperation : public MultiThreadedOperation { private: /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputProgram_; + SocketReader *input_program_; float dispersion_; /* TODO(manzanilla): to be removed with tiled implementation. */ - bool dispersionAvailable_; + bool dispersion_available_; float kr_, kr2_; @@ -42,25 +42,25 @@ class ProjectorLensDistortionOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; void init_data() override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; - void *initializeTileData(rcti *rect) override; + void *initialize_tile_data(rcti *rect) override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; - void updateDispersion(); + void update_dispersion(); void determine_canvas(const rcti &preferred_area, rcti &r_area) override; void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; diff --git a/source/blender/compositor/operations/COM_QualityStepHelper.cc b/source/blender/compositor/operations/COM_QualityStepHelper.cc index a45c7ab552c..895e341d550 100644 --- a/source/blender/compositor/operations/COM_QualityStepHelper.cc +++ b/source/blender/compositor/operations/COM_QualityStepHelper.cc @@ -27,7 +27,7 @@ QualityStepHelper::QualityStepHelper() offsetadd_ = 4; } -void QualityStepHelper::initExecution(QualityHelper helper) +void QualityStepHelper::init_execution(QualityHelper helper) { switch (helper) { case COM_QH_INCREASE: diff --git a/source/blender/compositor/operations/COM_QualityStepHelper.h b/source/blender/compositor/operations/COM_QualityStepHelper.h index 5c59f4d2a37..6f168babeae 100644 --- a/source/blender/compositor/operations/COM_QualityStepHelper.h +++ b/source/blender/compositor/operations/COM_QualityStepHelper.h @@ -37,13 +37,13 @@ class QualityStepHelper { /** * Initialize the execution */ - void initExecution(QualityHelper helper); + void init_execution(QualityHelper helper); - inline int getStep() const + inline int get_step() const { return step_; } - inline int getOffsetAdd() const + inline int get_offset_add() const { return offsetadd_; } @@ -51,7 +51,7 @@ class QualityStepHelper { public: QualityStepHelper(); - void setQuality(eCompositorQuality quality) + void set_quality(eCompositorQuality quality) { quality_ = quality; } diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.cc b/source/blender/compositor/operations/COM_ReadBufferOperation.cc index 9fe800021e7..75b4c61a376 100644 --- a/source/blender/compositor/operations/COM_ReadBufferOperation.cc +++ b/source/blender/compositor/operations/COM_ReadBufferOperation.cc @@ -25,39 +25,39 @@ namespace blender::compositor { ReadBufferOperation::ReadBufferOperation(DataType datatype) { - this->addOutputSocket(datatype); + this->add_output_socket(datatype); single_value_ = false; offset_ = 0; buffer_ = nullptr; flags.is_read_buffer_operation = true; } -void *ReadBufferOperation::initializeTileData(rcti * /*rect*/) +void *ReadBufferOperation::initialize_tile_data(rcti * /*rect*/) { return buffer_; } void ReadBufferOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) { - if (memoryProxy_ != nullptr) { - WriteBufferOperation *operation = memoryProxy_->getWriteBufferOperation(); + if (memory_proxy_ != nullptr) { + WriteBufferOperation *operation = memory_proxy_->get_write_buffer_operation(); operation->determine_canvas(preferred_area, r_area); operation->set_canvas(r_area); /** \todo may not occur! But does with blur node. */ - if (memoryProxy_->getExecutor()) { + if (memory_proxy_->get_executor()) { uint resolution[2] = {static_cast<uint>(BLI_rcti_size_x(&r_area)), static_cast<uint>(BLI_rcti_size_y(&r_area))}; - memoryProxy_->getExecutor()->setResolution(resolution); + memory_proxy_->get_executor()->set_resolution(resolution); } - single_value_ = operation->isSingleValue(); + single_value_ = operation->is_single_value(); } } -void ReadBufferOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ReadBufferOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { if (single_value_) { /* write buffer has a single value stored at (0,0) */ @@ -70,21 +70,21 @@ void ReadBufferOperation::executePixelSampled(float output[4], break; case PixelSampler::Bilinear: default: - buffer_->readBilinear(output, x, y); + buffer_->read_bilinear(output, x, y); break; case PixelSampler::Bicubic: - buffer_->readBilinear(output, x, y); + buffer_->read_bilinear(output, x, y); break; } } } -void ReadBufferOperation::executePixelExtend(float output[4], - float x, - float y, - PixelSampler sampler, - MemoryBufferExtend extend_x, - MemoryBufferExtend extend_y) +void ReadBufferOperation::execute_pixel_extend(float output[4], + float x, + float y, + PixelSampler sampler, + MemoryBufferExtend extend_x, + MemoryBufferExtend extend_y) { if (single_value_) { /* write buffer has a single value stored at (0,0) */ @@ -94,11 +94,11 @@ void ReadBufferOperation::executePixelExtend(float output[4], buffer_->read(output, x, y, extend_x, extend_y); } else { - buffer_->readBilinear(output, x, y, extend_x, extend_y); + buffer_->read_bilinear(output, x, y, extend_x, extend_y); } } -void ReadBufferOperation::executePixelFiltered( +void ReadBufferOperation::execute_pixel_filtered( float output[4], float x, float y, float dx[2], float dy[2]) { if (single_value_) { @@ -112,29 +112,29 @@ void ReadBufferOperation::executePixelFiltered( } } -bool ReadBufferOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool ReadBufferOperation::determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) { - if (this == readOperation) { + if (this == read_operation) { BLI_rcti_init(output, input->xmin, input->xmax, input->ymin, input->ymax); return true; } return false; } -void ReadBufferOperation::readResolutionFromWriteBuffer() +void ReadBufferOperation::read_resolution_from_write_buffer() { - if (memoryProxy_ != nullptr) { - WriteBufferOperation *operation = memoryProxy_->getWriteBufferOperation(); - this->setWidth(operation->getWidth()); - this->setHeight(operation->getHeight()); + if (memory_proxy_ != nullptr) { + WriteBufferOperation *operation = memory_proxy_->get_write_buffer_operation(); + this->set_width(operation->get_width()); + this->set_height(operation->get_height()); } } -void ReadBufferOperation::updateMemoryBuffer() +void ReadBufferOperation::update_memory_buffer() { - buffer_ = this->getMemoryProxy()->getBuffer(); + buffer_ = this->get_memory_proxy()->get_buffer(); } } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.h b/source/blender/compositor/operations/COM_ReadBufferOperation.h index f4504e11f48..7f461d1c925 100644 --- a/source/blender/compositor/operations/COM_ReadBufferOperation.h +++ b/source/blender/compositor/operations/COM_ReadBufferOperation.h @@ -26,51 +26,52 @@ namespace blender::compositor { class ReadBufferOperation : public NodeOperation { private: - MemoryProxy *memoryProxy_; + MemoryProxy *memory_proxy_; bool single_value_; /* single value stored in buffer, copied from associated write operation */ unsigned int offset_; MemoryBuffer *buffer_; public: ReadBufferOperation(DataType datatype); - void setMemoryProxy(MemoryProxy *memoryProxy) + void set_memory_proxy(MemoryProxy *memory_proxy) { - memoryProxy_ = memoryProxy; + memory_proxy_ = memory_proxy; } - MemoryProxy *getMemoryProxy() const + MemoryProxy *get_memory_proxy() const { - return memoryProxy_; + return memory_proxy_; } void determine_canvas(const rcti &preferred_area, rcti &r_area) override; - 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]) override; - void setOffset(unsigned int offset) + void *initialize_tile_data(rcti *rect) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_extend(float output[4], + float x, + float y, + PixelSampler sampler, + MemoryBufferExtend extend_x, + MemoryBufferExtend extend_y); + void execute_pixel_filtered( + float output[4], float x, float y, float dx[2], float dy[2]) override; + void set_offset(unsigned int offset) { offset_ = offset; } - unsigned int getOffset() const + unsigned int get_offset() const { return offset_; } - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; - MemoryBuffer *getInputMemoryBuffer(MemoryBuffer **memoryBuffers) override + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; + MemoryBuffer *get_input_memory_buffer(MemoryBuffer **memory_buffers) override { - return memoryBuffers[offset_]; + return memory_buffers[offset_]; } - void readResolutionFromWriteBuffer(); - void updateMemoryBuffer(); + void read_resolution_from_write_buffer(); + void update_memory_buffer(); }; } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.cc b/source/blender/compositor/operations/COM_RenderLayersProg.cc index 02a278899bb..7650def2c87 100644 --- a/source/blender/compositor/operations/COM_RenderLayersProg.cc +++ b/source/blender/compositor/operations/COM_RenderLayersProg.cc @@ -24,21 +24,21 @@ namespace blender::compositor { /* ******** Render Layers Base Prog ******** */ -RenderLayersProg::RenderLayersProg(const char *passName, DataType type, int elementsize) - : passName_(passName) +RenderLayersProg::RenderLayersProg(const char *pass_name, DataType type, int elementsize) + : pass_name_(pass_name) { - this->setScene(nullptr); - inputBuffer_ = nullptr; + this->set_scene(nullptr); + input_buffer_ = nullptr; elementsize_ = elementsize; rd_ = nullptr; layer_buffer_ = nullptr; - this->addOutputSocket(type); + this->add_output_socket(type); } -void RenderLayersProg::initExecution() +void RenderLayersProg::init_execution() { - Scene *scene = this->getScene(); + Scene *scene = this->get_scene(); Render *re = (scene) ? RE_GetSceneRender(scene) : nullptr; RenderResult *rr = nullptr; @@ -47,14 +47,14 @@ void RenderLayersProg::initExecution() } if (rr) { - ViewLayer *view_layer = (ViewLayer *)BLI_findlink(&scene->view_layers, getLayerId()); + ViewLayer *view_layer = (ViewLayer *)BLI_findlink(&scene->view_layers, get_layer_id()); if (view_layer) { RenderLayer *rl = RE_GetRenderLayer(rr, view_layer->name); if (rl) { - inputBuffer_ = RE_RenderLayerGetPass(rl, passName_.c_str(), viewName_); - if (inputBuffer_) { - layer_buffer_ = new MemoryBuffer(inputBuffer_, elementsize_, getWidth(), getHeight()); + input_buffer_ = RE_RenderLayerGetPass(rl, pass_name_.c_str(), view_name_); + if (input_buffer_) { + layer_buffer_ = new MemoryBuffer(input_buffer_, elementsize_, get_width(), get_height()); } } } @@ -65,10 +65,10 @@ void RenderLayersProg::initExecution() } } -void RenderLayersProg::doInterpolation(float output[4], float x, float y, PixelSampler sampler) +void RenderLayersProg::do_interpolation(float output[4], float x, float y, PixelSampler sampler) { unsigned int offset; - int width = this->getWidth(), height = this->getHeight(); + int width = this->get_width(), height = this->get_height(); int ix = x, iy = y; if (ix < 0 || iy < 0 || ix >= width || iy >= height) { @@ -89,28 +89,31 @@ void RenderLayersProg::doInterpolation(float output[4], float x, float y, PixelS offset = (iy * width + ix) * elementsize_; if (elementsize_ == 1) { - output[0] = inputBuffer_[offset]; + output[0] = input_buffer_[offset]; } else if (elementsize_ == 3) { - copy_v3_v3(output, &inputBuffer_[offset]); + copy_v3_v3(output, &input_buffer_[offset]); } else { - copy_v4_v4(output, &inputBuffer_[offset]); + copy_v4_v4(output, &input_buffer_[offset]); } break; } case PixelSampler::Bilinear: - BLI_bilinear_interpolation_fl(inputBuffer_, output, width, height, elementsize_, x, y); + BLI_bilinear_interpolation_fl(input_buffer_, output, width, height, elementsize_, x, y); break; case PixelSampler::Bicubic: - BLI_bicubic_interpolation_fl(inputBuffer_, output, width, height, elementsize_, x, y); + BLI_bicubic_interpolation_fl(input_buffer_, output, width, height, elementsize_, x, y); break; } } -void RenderLayersProg::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) +void RenderLayersProg::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { #if 0 const RenderData *rd = rd_; @@ -118,14 +121,14 @@ void RenderLayersProg::executePixelSampled(float output[4], float x, float y, Pi int dx = 0, dy = 0; if (rd->mode & R_BORDER && rd->mode & R_CROP) { - /* see comment in executeRegion describing coordinate mapping, + /* see comment in execute_region describing coordinate mapping, * here it simply goes other way around */ int full_width = rd->xsch * rd->size / 100; int full_height = rd->ysch * rd->size / 100; - dx = rd->border.xmin * full_width - (full_width - this->getWidth()) / 2.0f; - dy = rd->border.ymin * full_height - (full_height - this->getHeight()) / 2.0f; + dx = rd->border.xmin * full_width - (full_width - this->get_width()) / 2.0f; + dy = rd->border.ymin * full_height - (full_height - this->get_height()) / 2.0f; } int ix = x - dx; @@ -134,7 +137,7 @@ void RenderLayersProg::executePixelSampled(float output[4], float x, float y, Pi #ifndef NDEBUG { - const DataType data_type = this->getOutputSocket()->getDataType(); + const DataType data_type = this->get_output_socket()->get_data_type(); int actual_element_size = elementsize_; int expected_element_size; if (data_type == DataType::Value) { @@ -154,7 +157,7 @@ void RenderLayersProg::executePixelSampled(float output[4], float x, float y, Pi } #endif - if (inputBuffer_ == nullptr) { + if (input_buffer_ == nullptr) { int elemsize = elementsize_; if (elemsize == 1) { output[0] = 0.0f; @@ -168,13 +171,13 @@ void RenderLayersProg::executePixelSampled(float output[4], float x, float y, Pi } } else { - doInterpolation(output, x, y, sampler); + do_interpolation(output, x, y, sampler); } } -void RenderLayersProg::deinitExecution() +void RenderLayersProg::deinit_execution() { - inputBuffer_ = nullptr; + input_buffer_ = nullptr; if (layer_buffer_) { delete layer_buffer_; layer_buffer_ = nullptr; @@ -183,7 +186,7 @@ void RenderLayersProg::deinitExecution() void RenderLayersProg::determine_canvas(const rcti &UNUSED(preferred_area), rcti &r_area) { - Scene *sce = this->getScene(); + Scene *sce = this->get_scene(); Render *re = (sce) ? RE_GetSceneRender(sce) : nullptr; RenderResult *rr = nullptr; @@ -194,7 +197,7 @@ void RenderLayersProg::determine_canvas(const rcti &UNUSED(preferred_area), rcti } if (rr) { - ViewLayer *view_layer = (ViewLayer *)BLI_findlink(&sce->view_layers, getLayerId()); + ViewLayer *view_layer = (ViewLayer *)BLI_findlink(&sce->view_layers, get_layer_id()); if (view_layer) { RenderLayer *rl = RE_GetRenderLayer(rr, view_layer->name); if (rl) { @@ -208,9 +211,9 @@ void RenderLayersProg::determine_canvas(const rcti &UNUSED(preferred_area), rcti } } -std::unique_ptr<MetaData> RenderLayersProg::getMetaData() +std::unique_ptr<MetaData> RenderLayersProg::get_meta_data() { - Scene *scene = this->getScene(); + Scene *scene = this->get_scene(); Render *re = (scene) ? RE_GetSceneRender(scene) : nullptr; RenderResult *render_result = nullptr; MetaDataExtractCallbackData callback_data = {nullptr}; @@ -220,15 +223,15 @@ std::unique_ptr<MetaData> RenderLayersProg::getMetaData() } if (render_result && render_result->stamp_data) { - ViewLayer *view_layer = (ViewLayer *)BLI_findlink(&scene->view_layers, getLayerId()); + ViewLayer *view_layer = (ViewLayer *)BLI_findlink(&scene->view_layers, get_layer_id()); if (view_layer) { std::string full_layer_name = std::string( view_layer->name, BLI_strnlen(view_layer->name, sizeof(view_layer->name))) + - "." + passName_; + "." + pass_name_; blender::StringRef cryptomatte_layer_name = blender::bke::cryptomatte::BKE_cryptomatte_extract_layer_name(full_layer_name); - callback_data.setCryptomatteKeys(cryptomatte_layer_name); + callback_data.set_cryptomatte_keys(cryptomatte_layer_name); BKE_stamp_info_callback(&callback_data, render_result->stamp_data, @@ -260,17 +263,17 @@ void RenderLayersProg::update_memory_buffer_partial(MemoryBuffer *output, } /* ******** Render Layers AO Operation ******** */ -void RenderLayersAOOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void RenderLayersAOOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float *inputBuffer = this->getInputBuffer(); - if (inputBuffer == nullptr) { + float *input_buffer = this->get_input_buffer(); + if (input_buffer == nullptr) { zero_v3(output); } else { - doInterpolation(output, x, y, sampler); + do_interpolation(output, x, y, sampler); } output[3] = 1.0f; } @@ -291,19 +294,19 @@ void RenderLayersAOOperation::update_memory_buffer_partial(MemoryBuffer *output, } /* ******** Render Layers Alpha Operation ******** */ -void RenderLayersAlphaProg::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void RenderLayersAlphaProg::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float *inputBuffer = this->getInputBuffer(); + float *input_buffer = this->get_input_buffer(); - if (inputBuffer == nullptr) { + if (input_buffer == nullptr) { output[0] = 0.0f; } else { float temp[4]; - doInterpolation(temp, x, y, sampler); + do_interpolation(temp, x, y, sampler); output[0] = temp[3]; } } @@ -323,22 +326,22 @@ void RenderLayersAlphaProg::update_memory_buffer_partial(MemoryBuffer *output, } /* ******** Render Layers Depth Operation ******** */ -void RenderLayersDepthProg::executePixelSampled(float output[4], - float x, - float y, - PixelSampler /*sampler*/) +void RenderLayersDepthProg::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler /*sampler*/) { int ix = x; int iy = y; - float *inputBuffer = this->getInputBuffer(); + float *input_buffer = this->get_input_buffer(); - if (inputBuffer == nullptr || ix < 0 || iy < 0 || ix >= (int)this->getWidth() || - iy >= (int)this->getHeight()) { + if (input_buffer == nullptr || ix < 0 || iy < 0 || ix >= (int)this->get_width() || + iy >= (int)this->get_height()) { output[0] = 10e10f; } else { - unsigned int offset = (iy * this->getWidth() + ix); - output[0] = inputBuffer[offset]; + unsigned int offset = (iy * this->get_width() + ix); + output[0] = input_buffer[offset]; } } diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.h b/source/blender/compositor/operations/COM_RenderLayersProg.h index 14fc3babe32..79afe3c2a8c 100644 --- a/source/blender/compositor/operations/COM_RenderLayersProg.h +++ b/source/blender/compositor/operations/COM_RenderLayersProg.h @@ -41,14 +41,14 @@ class RenderLayersProg : public MultiThreadedOperation { Scene *scene_; /** - * layerId of the layer where this operation needs to get its data from + * layer_id of the layer where this operation needs to get its data from */ - short layerId_; + short layer_id_; /** - * viewName of the view to use (unless another view is specified by the node + * view_name of the view to use (unless another view is specified by the node */ - const char *viewName_; + const char *view_name_; const MemoryBuffer *layer_buffer_; @@ -56,12 +56,12 @@ class RenderLayersProg : public MultiThreadedOperation { * Cached instance to the float buffer inside the layer. * TODO: To be removed with tiled implementation. */ - float *inputBuffer_; + float *input_buffer_; /** * Render-pass where this operation needs to get its data from. */ - std::string passName_; + std::string pass_name_; int elementsize_; @@ -78,56 +78,56 @@ class RenderLayersProg : public MultiThreadedOperation { /** * retrieve the reference to the float buffer of the renderer. */ - inline float *getInputBuffer() + inline float *get_input_buffer() { - return inputBuffer_; + return input_buffer_; } - void doInterpolation(float output[4], float x, float y, PixelSampler sampler); + void do_interpolation(float output[4], float x, float y, PixelSampler sampler); public: /** * Constructor */ - RenderLayersProg(const char *passName, DataType type, int elementsize); + RenderLayersProg(const char *pass_name, DataType type, int elementsize); /** * setter for the scene field. Will be called from * \see RenderLayerNode to set the actual scene where * the data will be retrieved from. */ - void setScene(Scene *scene) + void set_scene(Scene *scene) { scene_ = scene; } - Scene *getScene() const + Scene *get_scene() const { return scene_; } - void setRenderData(const RenderData *rd) + void set_render_data(const RenderData *rd) { rd_ = rd; } - void setLayerId(short layerId) + void set_layer_id(short layer_id) { - layerId_ = layerId; + layer_id_ = layer_id; } - short getLayerId() const + short get_layer_id() const { - return layerId_; + return layer_id_; } - void setViewName(const char *viewName) + void set_view_name(const char *view_name) { - viewName_ = viewName; + view_name_ = view_name; } - const char *getViewName() + const char *get_view_name() { - return viewName_; + return view_name_; } - void initExecution() override; - void deinitExecution() override; - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void init_execution() override; + void deinit_execution() override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; - std::unique_ptr<MetaData> getMetaData() override; + std::unique_ptr<MetaData> get_meta_data() override; virtual void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, @@ -136,11 +136,11 @@ class RenderLayersProg : public MultiThreadedOperation { class RenderLayersAOOperation : public RenderLayersProg { public: - RenderLayersAOOperation(const char *passName, DataType type, int elementsize) - : RenderLayersProg(passName, type, elementsize) + RenderLayersAOOperation(const char *pass_name, DataType type, int elementsize) + : RenderLayersProg(pass_name, type, elementsize) { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, @@ -149,11 +149,11 @@ class RenderLayersAOOperation : public RenderLayersProg { class RenderLayersAlphaProg : public RenderLayersProg { public: - RenderLayersAlphaProg(const char *passName, DataType type, int elementsize) - : RenderLayersProg(passName, type, elementsize) + RenderLayersAlphaProg(const char *pass_name, DataType type, int elementsize) + : RenderLayersProg(pass_name, type, elementsize) { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, @@ -162,11 +162,11 @@ class RenderLayersAlphaProg : public RenderLayersProg { class RenderLayersDepthProg : public RenderLayersProg { public: - RenderLayersDepthProg(const char *passName, DataType type, int elementsize) - : RenderLayersProg(passName, type, elementsize) + RenderLayersDepthProg(const char *pass_name, DataType type, int elementsize) + : RenderLayersProg(pass_name, type, elementsize) { } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, diff --git a/source/blender/compositor/operations/COM_RotateOperation.cc b/source/blender/compositor/operations/COM_RotateOperation.cc index 9cef80c14b9..8129516f81c 100644 --- a/source/blender/compositor/operations/COM_RotateOperation.cc +++ b/source/blender/compositor/operations/COM_RotateOperation.cc @@ -22,14 +22,14 @@ namespace blender::compositor { RotateOperation::RotateOperation() { - this->addInputSocket(DataType::Color, ResizeMode::None); - this->addInputSocket(DataType::Value, ResizeMode::None); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color, ResizeMode::None); + this->add_input_socket(DataType::Value, ResizeMode::None); + this->add_output_socket(DataType::Color); this->set_canvas_input_index(0); - imageSocket_ = nullptr; - degreeSocket_ = nullptr; - doDegree2RadConversion_ = false; - isDegreeSet_ = false; + image_socket_ = nullptr; + degree_socket_ = nullptr; + do_degree2_rad_conversion_ = false; + is_degree_set_ = false; sampler_ = PixelSampler::Bilinear; } @@ -127,29 +127,29 @@ void RotateOperation::get_rotation_canvas(const rcti &input_canvas, void RotateOperation::init_data() { if (execution_model_ == eExecutionModel::Tiled) { - get_rotation_center(get_canvas(), centerX_, centerY_); + get_rotation_center(get_canvas(), center_x_, center_y_); } } -void RotateOperation::initExecution() +void RotateOperation::init_execution() { - imageSocket_ = this->getInputSocketReader(0); - degreeSocket_ = this->getInputSocketReader(1); + image_socket_ = this->get_input_socket_reader(0); + degree_socket_ = this->get_input_socket_reader(1); } -void RotateOperation::deinitExecution() +void RotateOperation::deinit_execution() { - imageSocket_ = nullptr; - degreeSocket_ = nullptr; + image_socket_ = nullptr; + degree_socket_ = nullptr; } -inline void RotateOperation::ensureDegree() +inline void RotateOperation::ensure_degree() { - if (!isDegreeSet_) { + if (!is_degree_set_) { float degree[4]; switch (execution_model_) { case eExecutionModel::Tiled: - degreeSocket_->readSampled(degree, 0, 0, PixelSampler::Nearest); + degree_socket_->read_sampled(degree, 0, 0, PixelSampler::Nearest); break; case eExecutionModel::FullFrame: degree[0] = get_input_operation(DEGREE_INPUT_INDEX)->get_constant_value_default(0.0f); @@ -157,7 +157,7 @@ inline void RotateOperation::ensureDegree() } double rad; - if (doDegree2RadConversion_) { + if (do_degree2_rad_conversion_) { rad = DEG2RAD((double)degree[0]); } else { @@ -166,51 +166,54 @@ inline void RotateOperation::ensureDegree() cosine_ = cos(rad); sine_ = sin(rad); - isDegreeSet_ = true; + is_degree_set_ = true; } } -void RotateOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) +void RotateOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - ensureDegree(); - const float dy = y - centerY_; - const float dx = x - centerX_; - const float nx = centerX_ + (cosine_ * dx + sine_ * dy); - const float ny = centerY_ + (-sine_ * dx + cosine_ * dy); - imageSocket_->readSampled(output, nx, ny, sampler); + ensure_degree(); + const float dy = y - center_y_; + const float dx = x - center_x_; + const float nx = center_x_ + (cosine_ * dx + sine_ * dy); + const float ny = center_y_ + (-sine_ * dx + cosine_ * dy); + image_socket_->read_sampled(output, nx, ny, sampler); } -bool RotateOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool RotateOperation::determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) { - ensureDegree(); - rcti newInput; - - const float dxmin = input->xmin - centerX_; - const float dymin = input->ymin - centerY_; - const float dxmax = input->xmax - centerX_; - const float dymax = input->ymax - centerY_; - - const float x1 = centerX_ + (cosine_ * dxmin + sine_ * dymin); - const float x2 = centerX_ + (cosine_ * dxmax + sine_ * dymin); - const float x3 = centerX_ + (cosine_ * dxmin + sine_ * dymax); - const float x4 = centerX_ + (cosine_ * dxmax + sine_ * dymax); - const float y1 = centerY_ + (-sine_ * dxmin + cosine_ * dymin); - const float y2 = centerY_ + (-sine_ * dxmax + cosine_ * dymin); - const float y3 = centerY_ + (-sine_ * dxmin + cosine_ * dymax); - const float y4 = centerY_ + (-sine_ * dxmax + cosine_ * dymax); + ensure_degree(); + rcti new_input; + + const float dxmin = input->xmin - center_x_; + const float dymin = input->ymin - center_y_; + const float dxmax = input->xmax - center_x_; + const float dymax = input->ymax - center_y_; + + const float x1 = center_x_ + (cosine_ * dxmin + sine_ * dymin); + const float x2 = center_x_ + (cosine_ * dxmax + sine_ * dymin); + const float x3 = center_x_ + (cosine_ * dxmin + sine_ * dymax); + const float x4 = center_x_ + (cosine_ * dxmax + sine_ * dymax); + const float y1 = center_y_ + (-sine_ * dxmin + cosine_ * dymin); + const float y2 = center_y_ + (-sine_ * dxmax + cosine_ * dymin); + const float y3 = center_y_ + (-sine_ * dxmin + cosine_ * dymax); + const float y4 = center_y_ + (-sine_ * dxmax + cosine_ * dymax); const float minx = MIN2(x1, MIN2(x2, MIN2(x3, x4))); const float maxx = MAX2(x1, MAX2(x2, MAX2(x3, x4))); const float miny = MIN2(y1, MIN2(y2, MIN2(y3, y4))); const float maxy = MAX2(y1, MAX2(y2, MAX2(y3, y4))); - newInput.xmax = ceil(maxx) + 1; - newInput.xmin = floor(minx) - 1; - newInput.ymax = ceil(maxy) + 1; - newInput.ymin = floor(miny) - 1; + new_input.xmax = ceil(maxx) + 1; + new_input.xmin = floor(minx) - 1; + new_input.ymax = ceil(maxy) + 1; + new_input.ymin = floor(miny) - 1; - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } void RotateOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) @@ -221,13 +224,13 @@ void RotateOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) } const bool image_determined = - getInputSocket(IMAGE_INPUT_INDEX)->determine_canvas(preferred_area, r_area); + get_input_socket(IMAGE_INPUT_INDEX)->determine_canvas(preferred_area, r_area); if (image_determined) { rcti input_canvas = r_area; rcti unused; - getInputSocket(DEGREE_INPUT_INDEX)->determine_canvas(input_canvas, unused); + get_input_socket(DEGREE_INPUT_INDEX)->determine_canvas(input_canvas, unused); - ensureDegree(); + ensure_degree(); get_rotation_canvas(input_canvas, sine_, cosine_, r_area); } @@ -242,7 +245,7 @@ void RotateOperation::get_area_of_interest(const int input_idx, return; } - ensureDegree(); + ensure_degree(); const rcti &input_image_canvas = get_input_operation(IMAGE_INPUT_INDEX)->get_canvas(); get_rotation_area_of_interest( diff --git a/source/blender/compositor/operations/COM_RotateOperation.h b/source/blender/compositor/operations/COM_RotateOperation.h index d99c914bed7..3970d3a2776 100644 --- a/source/blender/compositor/operations/COM_RotateOperation.h +++ b/source/blender/compositor/operations/COM_RotateOperation.h @@ -27,16 +27,16 @@ class RotateOperation : public MultiThreadedOperation { constexpr static int IMAGE_INPUT_INDEX = 0; constexpr static int DEGREE_INPUT_INDEX = 1; - SocketReader *imageSocket_; - SocketReader *degreeSocket_; + SocketReader *image_socket_; + SocketReader *degree_socket_; /* TODO(manzanilla): to be removed with tiled implementation. */ - float centerX_; - float centerY_; + float center_x_; + float center_y_; float cosine_; float sine_; - bool doDegree2RadConversion_; - bool isDegreeSet_; + bool do_degree2_rad_conversion_; + bool is_degree_set_; PixelSampler sampler_; public: @@ -79,17 +79,17 @@ class RotateOperation : public MultiThreadedOperation { const float cosine, rcti &r_canvas); - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void init_data() override; - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; - void setDoDegree2RadConversion(bool abool) + void set_do_degree2_rad_conversion(bool abool) { - doDegree2RadConversion_ = abool; + do_degree2_rad_conversion_ = abool; } void set_sampler(PixelSampler sampler) @@ -97,7 +97,7 @@ class RotateOperation : public MultiThreadedOperation { sampler_ = sampler; } - void ensureDegree(); + void ensure_degree(); void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; void update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_SMAAOperation.cc b/source/blender/compositor/operations/COM_SMAAOperation.cc index 40af7389d7f..c73462d2e6d 100644 --- a/source/blender/compositor/operations/COM_SMAAOperation.cc +++ b/source/blender/compositor/operations/COM_SMAAOperation.cc @@ -38,7 +38,7 @@ namespace blender::compositor { * * This file is based on SMAA-CPP: * - * https://github.com/iRi-E/smaa-cpp + * https://github.com/i_ri-E/smaa-cpp * * Currently only SMAA 1x mode is provided, so the operation will be done * with no spatial multi-sampling nor temporal super-sampling. @@ -64,7 +64,7 @@ namespace blender::compositor { * #buffer->read_elem_checked. */ static inline void sample(SocketReader *reader, int x, int y, float color[4]) { - if (x < 0 || x >= reader->getWidth() || y < 0 || y >= reader->getHeight()) { + if (x < 0 || x >= reader->get_width() || y < 0 || y >= reader->get_height()) { color[0] = color[1] = color[2] = color[3] = 0.0; return; } @@ -167,50 +167,50 @@ static void area_diag(int d1, int d2, int e1, int e2, float weights[2]) SMAAEdgeDetectionOperation::SMAAEdgeDetectionOperation() { - this->addInputSocket(DataType::Color); /* image */ - this->addInputSocket(DataType::Value); /* Depth, material ID, etc. TODO: currently unused. */ - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); /* image */ + this->add_input_socket(DataType::Value); /* Depth, material ID, etc. TODO: currently unused. */ + this->add_output_socket(DataType::Color); this->flags.complex = true; - imageReader_ = nullptr; - valueReader_ = nullptr; - this->setThreshold(CMP_DEFAULT_SMAA_THRESHOLD); - this->setLocalContrastAdaptationFactor(CMP_DEFAULT_SMAA_CONTRAST_LIMIT); + image_reader_ = nullptr; + value_reader_ = nullptr; + this->set_threshold(CMP_DEFAULT_SMAA_THRESHOLD); + this->set_local_contrast_adaptation_factor(CMP_DEFAULT_SMAA_CONTRAST_LIMIT); } -void SMAAEdgeDetectionOperation::initExecution() +void SMAAEdgeDetectionOperation::init_execution() { - imageReader_ = this->getInputSocketReader(0); - valueReader_ = this->getInputSocketReader(1); + image_reader_ = this->get_input_socket_reader(0); + value_reader_ = this->get_input_socket_reader(1); } -void SMAAEdgeDetectionOperation::deinitExecution() +void SMAAEdgeDetectionOperation::deinit_execution() { - imageReader_ = nullptr; - valueReader_ = nullptr; + image_reader_ = nullptr; + value_reader_ = nullptr; } -void SMAAEdgeDetectionOperation::setThreshold(float threshold) +void SMAAEdgeDetectionOperation::set_threshold(float threshold) { /* UI values are between 0 and 1 for simplicity but algorithm expects values between 0 and 0.5 */ threshold_ = scalenorm(0, 0.5, threshold); } -void SMAAEdgeDetectionOperation::setLocalContrastAdaptationFactor(float factor) +void SMAAEdgeDetectionOperation::set_local_contrast_adaptation_factor(float factor) { /* UI values are between 0 and 1 for simplicity but algorithm expects values between 1 and 10 */ contrast_limit_ = scalenorm(1, 10, factor); } -bool SMAAEdgeDetectionOperation::determineDependingAreaOfInterest( - rcti *input, ReadBufferOperation *readOperation, rcti *output) +bool SMAAEdgeDetectionOperation::determine_depending_area_of_interest( + rcti *input, ReadBufferOperation *read_operation, rcti *output) { - rcti newInput; - newInput.xmax = input->xmax + 1; - newInput.xmin = input->xmin - 2; - newInput.ymax = input->ymax + 1; - newInput.ymin = input->ymin - 2; + rcti new_input; + new_input.xmax = input->xmax + 1; + new_input.xmin = input->xmin - 2; + new_input.ymax = input->ymax + 1; + new_input.ymin = input->ymin - 2; - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } void SMAAEdgeDetectionOperation::get_area_of_interest(const int UNUSED(input_idx), @@ -223,16 +223,16 @@ void SMAAEdgeDetectionOperation::get_area_of_interest(const int UNUSED(input_idx r_input_area.ymin = output_area.ymin - 2; } -void SMAAEdgeDetectionOperation::executePixel(float output[4], int x, int y, void * /*data*/) +void SMAAEdgeDetectionOperation::execute_pixel(float output[4], int x, int y, void * /*data*/) { float color[4]; /* Calculate luma deltas: */ - sample(imageReader_, x, y, color); + sample(image_reader_, x, y, color); float L = IMB_colormanagement_get_luminance(color); - sample(imageReader_, x - 1, y, color); + sample(image_reader_, x - 1, y, color); float Lleft = IMB_colormanagement_get_luminance(color); - sample(imageReader_, x, y - 1, color); + sample(image_reader_, x, y - 1, color); float Ltop = IMB_colormanagement_get_luminance(color); float Dleft = fabsf(L - Lleft); float Dtop = fabsf(L - Ltop); @@ -249,36 +249,36 @@ void SMAAEdgeDetectionOperation::executePixel(float output[4], int x, int y, voi } /* Calculate right and bottom deltas: */ - sample(imageReader_, x + 1, y, color); + sample(image_reader_, x + 1, y, color); float Lright = IMB_colormanagement_get_luminance(color); - sample(imageReader_, x, y + 1, color); + sample(image_reader_, 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)); + float max_delta = fmaxf(fmaxf(Dleft, Dright), fmaxf(Dtop, Dbottom)); /* Calculate luma used for both left and top edges: */ - sample(imageReader_, x - 1, y - 1, color); + sample(image_reader_, 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(imageReader_, x - 2, y, color); + sample(image_reader_, x - 2, y, color); float Lleftleft = IMB_colormanagement_get_luminance(color); - sample(imageReader_, x - 1, y + 1, color); + sample(image_reader_, 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))); + max_delta = fmaxf(max_delta, fmaxf(Dleftleft, fmaxf(Dlefttop, Dleftbottom))); /* Local contrast adaptation: */ - if (maxDelta > contrast_limit_ * Dleft) { + if (max_delta > contrast_limit_ * Dleft) { output[0] = 0.0f; } } @@ -286,19 +286,19 @@ void SMAAEdgeDetectionOperation::executePixel(float output[4], int x, int y, voi /* Top edge */ if (output[1] != 0.0f) { /* Calculate top-top delta: */ - sample(imageReader_, x, y - 2, color); + sample(image_reader_, x, y - 2, color); float Ltoptop = IMB_colormanagement_get_luminance(color); - sample(imageReader_, x + 1, y - 1, color); + sample(image_reader_, 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))); + max_delta = fmaxf(max_delta, fmaxf(Dtoptop, fmaxf(Dtopleft, Dtopright))); /* Local contrast adaptation: */ - if (maxDelta > contrast_limit_ * Dtop) { + if (max_delta > contrast_limit_ * Dtop) { output[1] = 0.0f; } } @@ -344,7 +344,7 @@ void SMAAEdgeDetectionOperation::update_memory_buffer_partial(MemoryBuffer *outp const float Dbottom = fabsf(L - Lbottom); /* Calculate the maximum delta in the direct neighborhood: */ - float maxDelta = fmaxf(fmaxf(Dleft, Dright), fmaxf(Dtop, Dbottom)); + float max_delta = fmaxf(fmaxf(Dleft, Dright), fmaxf(Dtop, Dbottom)); /* Calculate luma used for both left and top edges: */ image->read_elem_checked(x - 1, y - 1, color); @@ -362,10 +362,10 @@ void SMAAEdgeDetectionOperation::update_memory_buffer_partial(MemoryBuffer *outp const float Dleftbottom = fabsf(Lleft - Lleftbottom); /* Calculate the final maximum delta: */ - maxDelta = fmaxf(maxDelta, fmaxf(Dleftleft, fmaxf(Dlefttop, Dleftbottom))); + max_delta = fmaxf(max_delta, fmaxf(Dleftleft, fmaxf(Dlefttop, Dleftbottom))); /* Local contrast adaptation: */ - if (maxDelta > contrast_limit_ * Dleft) { + if (max_delta > contrast_limit_ * Dleft) { it.out[0] = 0.0f; } } @@ -382,10 +382,10 @@ void SMAAEdgeDetectionOperation::update_memory_buffer_partial(MemoryBuffer *outp const float Dtopright = fabsf(Ltop - Ltopright); /* Calculate the final maximum delta: */ - maxDelta = fmaxf(maxDelta, fmaxf(Dtoptop, fmaxf(Dtopleft, Dtopright))); + max_delta = fmaxf(max_delta, fmaxf(Dtoptop, fmaxf(Dtopleft, Dtopright))); /* Local contrast adaptation: */ - if (maxDelta > contrast_limit_ * Dtop) { + if (max_delta > contrast_limit_ * Dtop) { it.out[1] = 0.0f; } } @@ -398,47 +398,47 @@ void SMAAEdgeDetectionOperation::update_memory_buffer_partial(MemoryBuffer *outp SMAABlendingWeightCalculationOperation::SMAABlendingWeightCalculationOperation() { - this->addInputSocket(DataType::Color); /* edges */ - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); /* edges */ + this->add_output_socket(DataType::Color); this->flags.complex = true; - imageReader_ = nullptr; - this->setCornerRounding(CMP_DEFAULT_SMAA_CORNER_ROUNDING); + image_reader_ = nullptr; + this->set_corner_rounding(CMP_DEFAULT_SMAA_CORNER_ROUNDING); } -void *SMAABlendingWeightCalculationOperation::initializeTileData(rcti *rect) +void *SMAABlendingWeightCalculationOperation::initialize_tile_data(rcti *rect) { - return getInputOperation(0)->initializeTileData(rect); + return get_input_operation(0)->initialize_tile_data(rect); } -void SMAABlendingWeightCalculationOperation::initExecution() +void SMAABlendingWeightCalculationOperation::init_execution() { - imageReader_ = this->getInputSocketReader(0); + image_reader_ = this->get_input_socket_reader(0); if (execution_model_ == eExecutionModel::Tiled) { - sample_image_fn_ = [=](int x, int y, float *out) { sample(imageReader_, x, y, out); }; + sample_image_fn_ = [=](int x, int y, float *out) { sample(image_reader_, x, y, out); }; } } -void SMAABlendingWeightCalculationOperation::setCornerRounding(float rounding) +void SMAABlendingWeightCalculationOperation::set_corner_rounding(float rounding) { /* UI values are between 0 and 1 for simplicity but algorithm expects values between 0 and 100 */ corner_rounding_ = static_cast<int>(scalenorm(0, 100, rounding)); } -void SMAABlendingWeightCalculationOperation::executePixel(float output[4], - int x, - int y, - void * /*data*/) +void SMAABlendingWeightCalculationOperation::execute_pixel(float output[4], + int x, + int y, + void * /*data*/) { float edges[4], c[4]; zero_v4(output); - sample(imageReader_, x, y, edges); + sample(image_reader_, 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); + calculate_diag_weights(x, y, edges, output); /* We give priority to diagonals, so if we find a diagonal we skip. */ /* horizontal/vertical processing. */ @@ -447,25 +447,25 @@ void SMAABlendingWeightCalculationOperation::executePixel(float output[4], } /* Find the distance to the left and the right: */ - int left = searchXLeft(x, y); - int right = searchXRight(x, y); + int left = search_xleft(x, y); + int right = search_xright(x, y); int d1 = x - left, d2 = right - x; /* Fetch the left and right crossing edges: */ int e1 = 0, e2 = 0; - sample(imageReader_, left, y - 1, c); + sample(image_reader_, left, y - 1, c); if (c[0] > 0.0) { e1 += 1; } - sample(imageReader_, left, y, c); + sample(image_reader_, left, y, c); if (c[0] > 0.0) { e1 += 2; } - sample(imageReader_, right + 1, y - 1, c); + sample(image_reader_, right + 1, y - 1, c); if (c[0] > 0.0) { e2 += 1; } - sample(imageReader_, right + 1, y, c); + sample(image_reader_, right + 1, y, c); if (c[0] > 0.0) { e2 += 2; } @@ -476,37 +476,37 @@ void SMAABlendingWeightCalculationOperation::executePixel(float output[4], /* Fix corners: */ if (corner_rounding_) { - detectHorizontalCornerPattern(output, left, right, y, d1, d2); + detect_horizontal_corner_pattern(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)) { + if (is_vertical_search_unneeded(x, y)) { return; } /* Find the distance to the top and the bottom: */ - int top = searchYUp(x, y); - int bottom = searchYDown(x, y); + int top = search_yup(x, y); + int bottom = search_ydown(x, y); int d1 = y - top, d2 = bottom - y; /* Fetch the top and bottom crossing edges: */ int e1 = 0, e2 = 0; - sample(imageReader_, x - 1, top, c); + sample(image_reader_, x - 1, top, c); if (c[1] > 0.0) { e1 += 1; } - sample(imageReader_, x, top, c); + sample(image_reader_, x, top, c); if (c[1] > 0.0) { e1 += 2; } - sample(imageReader_, x - 1, bottom + 1, c); + sample(image_reader_, x - 1, bottom + 1, c); if (c[1] > 0.0) { e2 += 1; } - sample(imageReader_, x, bottom + 1, c); + sample(image_reader_, x, bottom + 1, c); if (c[1] > 0.0) { e2 += 2; } @@ -516,7 +516,7 @@ void SMAABlendingWeightCalculationOperation::executePixel(float output[4], /* Fix corners: */ if (corner_rounding_) { - detectVerticalCornerPattern(output + 2, x, top, bottom, d1, d2); + detect_vertical_corner_pattern(output + 2, x, top, bottom, d1, d2); } } } @@ -544,7 +544,7 @@ void SMAABlendingWeightCalculationOperation::update_memory_buffer_partial( 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, it.out); + calculate_diag_weights(x, y, edges, it.out); /* We give priority to diagonals, so if we find a diagonal we skip. */ /* horizontal/vertical processing. */ @@ -553,8 +553,8 @@ void SMAABlendingWeightCalculationOperation::update_memory_buffer_partial( } /* Find the distance to the left and the right: */ - int left = searchXLeft(x, y); - int right = searchXRight(x, y); + int left = search_xleft(x, y); + int right = search_xright(x, y); int d1 = x - left, d2 = right - x; /* Fetch the left and right crossing edges: */ @@ -582,20 +582,20 @@ void SMAABlendingWeightCalculationOperation::update_memory_buffer_partial( /* Fix corners: */ if (corner_rounding_) { - detectHorizontalCornerPattern(it.out, left, right, y, d1, d2); + detect_horizontal_corner_pattern(it.out, 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)) { + if (is_vertical_search_unneeded(x, y)) { continue; } /* Find the distance to the top and the bottom: */ - int top = searchYUp(x, y); - int bottom = searchYDown(x, y); + int top = search_yup(x, y); + int bottom = search_ydown(x, y); int d1 = y - top, d2 = bottom - y; /* Fetch the top and bottom crossing edges: */ @@ -622,30 +622,30 @@ void SMAABlendingWeightCalculationOperation::update_memory_buffer_partial( /* Fix corners: */ if (corner_rounding_) { - detectVerticalCornerPattern(it.out + 2, x, top, bottom, d1, d2); + detect_vertical_corner_pattern(it.out + 2, x, top, bottom, d1, d2); } } } } -void SMAABlendingWeightCalculationOperation::deinitExecution() +void SMAABlendingWeightCalculationOperation::deinit_execution() { - imageReader_ = nullptr; + image_reader_ = nullptr; } -bool SMAABlendingWeightCalculationOperation::determineDependingAreaOfInterest( - rcti *input, ReadBufferOperation *readOperation, rcti *output) +bool SMAABlendingWeightCalculationOperation::determine_depending_area_of_interest( + rcti *input, ReadBufferOperation *read_operation, rcti *output) { - rcti newInput; + rcti new_input; - 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); + new_input.xmax = input->xmax + fmax(SMAA_MAX_SEARCH_STEPS, SMAA_MAX_SEARCH_STEPS_DIAG + 1); + new_input.xmin = input->xmin - + fmax(fmax(SMAA_MAX_SEARCH_STEPS - 1, 1), SMAA_MAX_SEARCH_STEPS_DIAG + 1); + new_input.ymax = input->ymax + fmax(SMAA_MAX_SEARCH_STEPS, SMAA_MAX_SEARCH_STEPS_DIAG); + new_input.ymin = input->ymin - + fmax(fmax(SMAA_MAX_SEARCH_STEPS - 1, 1), SMAA_MAX_SEARCH_STEPS_DIAG); - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } void SMAABlendingWeightCalculationOperation::get_area_of_interest(const int UNUSED(input_idx), @@ -667,7 +667,7 @@ void SMAABlendingWeightCalculationOperation::get_area_of_interest(const int UNUS /** * These functions allows to perform diagonal pattern searches. */ -int SMAABlendingWeightCalculationOperation::searchDiag1(int x, int y, int dir, bool *found) +int SMAABlendingWeightCalculationOperation::search_diag1(int x, int y, int dir, bool *found) { float e[4]; int end = x + SMAA_MAX_SEARCH_STEPS_DIAG * dir; @@ -690,7 +690,7 @@ int SMAABlendingWeightCalculationOperation::searchDiag1(int x, int y, int dir, b return x - dir; } -int SMAABlendingWeightCalculationOperation::searchDiag2(int x, int y, int dir, bool *found) +int SMAABlendingWeightCalculationOperation::search_diag2(int x, int y, int dir, bool *found) { float e[4]; int end = x + SMAA_MAX_SEARCH_STEPS_DIAG * dir; @@ -717,10 +717,10 @@ int SMAABlendingWeightCalculationOperation::searchDiag2(int x, int y, int dir, b /** * This searches for diagonal patterns and returns the corresponding weights. */ -void SMAABlendingWeightCalculationOperation::calculateDiagWeights(int x, - int y, - const float edges[2], - float weights[2]) +void SMAABlendingWeightCalculationOperation::calculate_diag_weights(int x, + int y, + const float edges[2], + float weights[2]) { int d1, d2; bool d1_found, d2_found; @@ -734,13 +734,13 @@ void SMAABlendingWeightCalculationOperation::calculateDiagWeights(int x, /* Search for the line ends: */ if (edges[0] > 0.0f) { - d1 = x - searchDiag1(x, y, -1, &d1_found); + d1 = x - search_diag1(x, y, -1, &d1_found); } else { d1 = 0; d1_found = true; } - d2 = searchDiag1(x, y, 1, &d2_found) - x; + d2 = search_diag1(x, y, 1, &d2_found) - x; if (d1 + d2 > 2) { /* d1 + d2 + 1 > 3 */ int e1 = 0, e2 = 0; @@ -778,10 +778,10 @@ void SMAABlendingWeightCalculationOperation::calculateDiagWeights(int x, } /* Search for the line ends: */ - d1 = x - searchDiag2(x, y, -1, &d1_found); + d1 = x - search_diag2(x, y, -1, &d1_found); sample_image_fn_(x + 1, y, e); if (e[0] > 0.0f) { - d2 = searchDiag2(x, y, 1, &d2_found) - x; + d2 = search_diag2(x, y, 1, &d2_found) - x; } else { d2 = 0; @@ -826,7 +826,7 @@ void SMAABlendingWeightCalculationOperation::calculateDiagWeights(int x, } } -bool SMAABlendingWeightCalculationOperation::isVerticalSearchUnneeded(int x, int y) +bool SMAABlendingWeightCalculationOperation::is_vertical_search_unneeded(int x, int y) { int d1, d2; bool found; @@ -839,12 +839,12 @@ bool SMAABlendingWeightCalculationOperation::isVerticalSearchUnneeded(int x, int /* Search for the line ends: */ sample_image_fn_(x - 1, y, e); if (e[1] > 0.0f) { - d1 = x - searchDiag2(x - 1, y, -1, &found); + d1 = x - search_diag2(x - 1, y, -1, &found); } else { d1 = 0; } - d2 = searchDiag2(x - 1, y, 1, &found) - x; + d2 = search_diag2(x - 1, y, 1, &found) - x; return (d1 + d2 > 2); /* d1 + d2 + 1 > 3 */ } @@ -852,7 +852,7 @@ bool SMAABlendingWeightCalculationOperation::isVerticalSearchUnneeded(int x, int /*-----------------------------------------------------------------------------*/ /* Horizontal/Vertical Search Functions */ -int SMAABlendingWeightCalculationOperation::searchXLeft(int x, int y) +int SMAABlendingWeightCalculationOperation::search_xleft(int x, int y) { int end = x - SMAA_MAX_SEARCH_STEPS; float e[4]; @@ -875,7 +875,7 @@ int SMAABlendingWeightCalculationOperation::searchXLeft(int x, int y) return x + 1; } -int SMAABlendingWeightCalculationOperation::searchXRight(int x, int y) +int SMAABlendingWeightCalculationOperation::search_xright(int x, int y) { int end = x + SMAA_MAX_SEARCH_STEPS; float e[4]; @@ -896,7 +896,7 @@ int SMAABlendingWeightCalculationOperation::searchXRight(int x, int y) return x - 1; } -int SMAABlendingWeightCalculationOperation::searchYUp(int x, int y) +int SMAABlendingWeightCalculationOperation::search_yup(int x, int y) { int end = y - SMAA_MAX_SEARCH_STEPS; float e[4]; @@ -919,7 +919,7 @@ int SMAABlendingWeightCalculationOperation::searchYUp(int x, int y) return y + 1; } -int SMAABlendingWeightCalculationOperation::searchYDown(int x, int y) +int SMAABlendingWeightCalculationOperation::search_ydown(int x, int y) { int end = y + SMAA_MAX_SEARCH_STEPS; float e[4]; @@ -943,7 +943,7 @@ int SMAABlendingWeightCalculationOperation::searchYDown(int x, int y) /*-----------------------------------------------------------------------------*/ /* Corner Detection Functions */ -void SMAABlendingWeightCalculationOperation::detectHorizontalCornerPattern( +void SMAABlendingWeightCalculationOperation::detect_horizontal_corner_pattern( float weights[2], int left, int right, int y, int d1, int d2) { float factor[2] = {1.0f, 1.0f}; @@ -972,7 +972,7 @@ void SMAABlendingWeightCalculationOperation::detectHorizontalCornerPattern( weights[1] *= CLAMPIS(factor[1], 0.0f, 1.0f); } -void SMAABlendingWeightCalculationOperation::detectVerticalCornerPattern( +void SMAABlendingWeightCalculationOperation::detect_vertical_corner_pattern( float weights[2], int x, int top, int bottom, int d1, int d2) { float factor[2] = {1.0f, 1.0f}; @@ -1007,29 +1007,29 @@ void SMAABlendingWeightCalculationOperation::detectVerticalCornerPattern( SMAANeighborhoodBlendingOperation::SMAANeighborhoodBlendingOperation() { - this->addInputSocket(DataType::Color); /* image */ - this->addInputSocket(DataType::Color); /* blend */ - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); /* image */ + this->add_input_socket(DataType::Color); /* blend */ + this->add_output_socket(DataType::Color); this->flags.complex = true; image1Reader_ = nullptr; image2Reader_ = nullptr; } -void *SMAANeighborhoodBlendingOperation::initializeTileData(rcti *rect) +void *SMAANeighborhoodBlendingOperation::initialize_tile_data(rcti *rect) { - return getInputOperation(0)->initializeTileData(rect); + return get_input_operation(0)->initialize_tile_data(rect); } -void SMAANeighborhoodBlendingOperation::initExecution() +void SMAANeighborhoodBlendingOperation::init_execution() { - image1Reader_ = this->getInputSocketReader(0); - image2Reader_ = this->getInputSocketReader(1); + image1Reader_ = this->get_input_socket_reader(0); + image2Reader_ = this->get_input_socket_reader(1); } -void SMAANeighborhoodBlendingOperation::executePixel(float output[4], - int x, - int y, - void * /*data*/) +void SMAANeighborhoodBlendingOperation::execute_pixel(float output[4], + int x, + int y, + void * /*data*/) { float w[4]; @@ -1127,23 +1127,23 @@ void SMAANeighborhoodBlendingOperation::update_memory_buffer_partial(MemoryBuffe } } -void SMAANeighborhoodBlendingOperation::deinitExecution() +void SMAANeighborhoodBlendingOperation::deinit_execution() { image1Reader_ = nullptr; image2Reader_ = nullptr; } -bool SMAANeighborhoodBlendingOperation::determineDependingAreaOfInterest( - rcti *input, ReadBufferOperation *readOperation, rcti *output) +bool SMAANeighborhoodBlendingOperation::determine_depending_area_of_interest( + rcti *input, ReadBufferOperation *read_operation, rcti *output) { - rcti newInput; + rcti new_input; - newInput.xmax = input->xmax + 1; - newInput.xmin = input->xmin - 1; - newInput.ymax = input->ymax + 1; - newInput.ymin = input->ymin - 1; + new_input.xmax = input->xmax + 1; + new_input.xmin = input->xmin - 1; + new_input.ymax = input->ymax + 1; + new_input.ymin = input->ymin - 1; - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } void SMAANeighborhoodBlendingOperation::get_area_of_interest(const int UNUSED(input_idx), diff --git a/source/blender/compositor/operations/COM_SMAAOperation.h b/source/blender/compositor/operations/COM_SMAAOperation.h index d4c9e128dca..65a88d43fdf 100644 --- a/source/blender/compositor/operations/COM_SMAAOperation.h +++ b/source/blender/compositor/operations/COM_SMAAOperation.h @@ -29,8 +29,8 @@ namespace blender::compositor { class SMAAEdgeDetectionOperation : public MultiThreadedOperation { protected: - SocketReader *imageReader_; - SocketReader *valueReader_; + SocketReader *image_reader_; + SocketReader *value_reader_; float threshold_; float contrast_limit_; @@ -41,25 +41,25 @@ class SMAAEdgeDetectionOperation : public MultiThreadedOperation { /** * the inner loop of this program */ - virtual void executePixel(float output[4], int x, int y, void *data) override; + virtual void execute_pixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void setThreshold(float threshold); + void set_threshold(float threshold); - void setLocalContrastAdaptationFactor(float factor); + void set_local_contrast_adaptation_factor(float factor); - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; void update_memory_buffer_partial(MemoryBuffer *output, @@ -72,7 +72,7 @@ class SMAAEdgeDetectionOperation : public MultiThreadedOperation { class SMAABlendingWeightCalculationOperation : public MultiThreadedOperation { private: - SocketReader *imageReader_; + SocketReader *image_reader_; std::function<void(int x, int y, float *out)> sample_image_fn_; int corner_rounding_; @@ -82,24 +82,24 @@ class SMAABlendingWeightCalculationOperation : public MultiThreadedOperation { /** * the inner loop of this program */ - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution() override; - void *initializeTileData(rcti *rect) override; + void init_execution() override; + void *initialize_tile_data(rcti *rect) override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void setCornerRounding(float rounding); + void set_corner_rounding(float rounding); - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; void update_memory_buffer_started(MemoryBuffer *output, @@ -111,20 +111,22 @@ class SMAABlendingWeightCalculationOperation : public MultiThreadedOperation { 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); + int search_diag1(int x, int y, int dir, bool *found); + int search_diag2(int x, int y, int dir, bool *found); + void calculate_diag_weights(int x, int y, const float edges[2], float weights[2]); + bool is_vertical_search_unneeded(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); + int search_xleft(int x, int y); + int search_xright(int x, int y); + int search_yup(int x, int y); + int search_ydown(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); + void detect_horizontal_corner_pattern( + float weights[2], int left, int right, int y, int d1, int d2); + void detect_vertical_corner_pattern( + float weights[2], int x, int top, int bottom, int d1, int d2); }; /*-----------------------------------------------------------------------------*/ @@ -141,22 +143,22 @@ class SMAANeighborhoodBlendingOperation : public MultiThreadedOperation { /** * the inner loop of this program */ - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution() override; - void *initializeTileData(rcti *rect) override; + void init_execution() override; + void *initialize_tile_data(rcti *rect) override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; void update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_ScaleOperation.cc b/source/blender/compositor/operations/COM_ScaleOperation.cc index 82878c1276f..350934b0d3b 100644 --- a/source/blender/compositor/operations/COM_ScaleOperation.cc +++ b/source/blender/compositor/operations/COM_ScaleOperation.cc @@ -49,20 +49,21 @@ ScaleOperation::ScaleOperation() : ScaleOperation(DataType::Color) ScaleOperation::ScaleOperation(DataType data_type) : BaseScaleOperation() { - this->addInputSocket(data_type, ResizeMode::None); - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Value); - this->addOutputSocket(data_type); - inputOperation_ = nullptr; - inputXOperation_ = nullptr; - inputYOperation_ = nullptr; + this->add_input_socket(data_type, ResizeMode::None); + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Value); + this->add_output_socket(data_type); + input_operation_ = nullptr; + input_xoperation_ = nullptr; + input_yoperation_ = nullptr; } float ScaleOperation::get_constant_scale(const int input_op_idx, const float factor) { - const bool is_constant = getInputOperation(input_op_idx)->get_flags().is_constant_operation; + const bool is_constant = get_input_operation(input_op_idx)->get_flags().is_constant_operation; if (is_constant) { - return ((ConstantOperation *)getInputOperation(input_op_idx))->get_constant_elem()[0] * factor; + return ((ConstantOperation *)get_input_operation(input_op_idx))->get_constant_elem()[0] * + factor; } return 1.0f; @@ -112,22 +113,22 @@ void ScaleOperation::clamp_area_size_max(rcti &area, Size2f max_size) void ScaleOperation::init_data() { - canvas_center_x_ = canvas_.xmin + getWidth() / 2.0f; - canvas_center_y_ = canvas_.ymin + getHeight() / 2.0f; + canvas_center_x_ = canvas_.xmin + get_width() / 2.0f; + canvas_center_y_ = canvas_.ymin + get_height() / 2.0f; } -void ScaleOperation::initExecution() +void ScaleOperation::init_execution() { - inputOperation_ = this->getInputSocketReader(0); - inputXOperation_ = this->getInputSocketReader(1); - inputYOperation_ = this->getInputSocketReader(2); + input_operation_ = this->get_input_socket_reader(0); + input_xoperation_ = this->get_input_socket_reader(1); + input_yoperation_ = this->get_input_socket_reader(2); } -void ScaleOperation::deinitExecution() +void ScaleOperation::deinit_execution() { - inputOperation_ = nullptr; - inputXOperation_ = nullptr; - inputYOperation_ = nullptr; + input_operation_ = nullptr; + input_xoperation_ = nullptr; + input_yoperation_ = nullptr; } void ScaleOperation::get_scale_offset(const rcti &input_canvas, @@ -171,8 +172,8 @@ void ScaleOperation::get_area_of_interest(const int input_idx, } NodeOperation *image_op = get_input_operation(IMAGE_INPUT_INDEX); - const float scale_x = get_constant_scale_x(image_op->getWidth()); - const float scale_y = get_constant_scale_y(image_op->getHeight()); + const float scale_x = get_constant_scale_x(image_op->get_width()); + const float scale_y = get_constant_scale_y(image_op->get_height()); get_scale_area_of_interest( image_op->get_canvas(), this->get_canvas(), scale_x, scale_y, output_area, r_input_area); @@ -184,8 +185,8 @@ void ScaleOperation::update_memory_buffer_partial(MemoryBuffer *output, Span<MemoryBuffer *> inputs) { NodeOperation *input_image_op = get_input_operation(IMAGE_INPUT_INDEX); - const int input_image_width = input_image_op->getWidth(); - const int input_image_height = input_image_op->getHeight(); + const int input_image_width = input_image_op->get_width(); + const int input_image_height = input_image_op->get_height(); const float scale_x_factor = get_relative_scale_x_factor(input_image_width); const float scale_y_factor = get_relative_scale_y_factor(input_image_height); const float scale_center_x = input_image_width / 2.0f; @@ -219,12 +220,12 @@ void ScaleOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) } const bool image_determined = - getInputSocket(IMAGE_INPUT_INDEX)->determine_canvas(preferred_area, r_area); + get_input_socket(IMAGE_INPUT_INDEX)->determine_canvas(preferred_area, r_area); if (image_determined) { rcti image_canvas = r_area; rcti unused; - NodeOperationInput *x_socket = getInputSocket(X_INPUT_INDEX); - NodeOperationInput *y_socket = getInputSocket(Y_INPUT_INDEX); + NodeOperationInput *x_socket = get_input_socket(X_INPUT_INDEX); + NodeOperationInput *y_socket = get_input_socket(Y_INPUT_INDEX); x_socket->determine_canvas(image_canvas, unused); y_socket->determine_canvas(image_canvas, unused); if (is_scaling_variable()) { @@ -258,129 +259,128 @@ ScaleRelativeOperation::ScaleRelativeOperation(DataType data_type) : ScaleOperat { } -void ScaleRelativeOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ScaleRelativeOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - PixelSampler effective_sampler = getEffectiveSampler(sampler); + PixelSampler effective_sampler = get_effective_sampler(sampler); float scaleX[4]; float scaleY[4]; - inputXOperation_->readSampled(scaleX, x, y, effective_sampler); - inputYOperation_->readSampled(scaleY, x, y, effective_sampler); + input_xoperation_->read_sampled(scaleX, x, y, effective_sampler); + input_yoperation_->read_sampled(scaleY, x, y, effective_sampler); const float scx = scaleX[0]; const float scy = scaleY[0]; float nx = this->canvas_center_x_ + (x - this->canvas_center_x_) / scx; float ny = this->canvas_center_y_ + (y - this->canvas_center_y_) / scy; - inputOperation_->readSampled(output, nx, ny, effective_sampler); + input_operation_->read_sampled(output, nx, ny, effective_sampler); } -bool ScaleRelativeOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool ScaleRelativeOperation::determine_depending_area_of_interest( + rcti *input, ReadBufferOperation *read_operation, rcti *output) { - rcti newInput; + rcti new_input; if (!variable_size_) { float scaleX[4]; float scaleY[4]; - inputXOperation_->readSampled(scaleX, 0, 0, PixelSampler::Nearest); - inputYOperation_->readSampled(scaleY, 0, 0, PixelSampler::Nearest); + input_xoperation_->read_sampled(scaleX, 0, 0, PixelSampler::Nearest); + input_yoperation_->read_sampled(scaleY, 0, 0, PixelSampler::Nearest); const float scx = scaleX[0]; const float scy = scaleY[0]; - newInput.xmax = this->canvas_center_x_ + (input->xmax - this->canvas_center_x_) / scx + 1; - newInput.xmin = this->canvas_center_x_ + (input->xmin - this->canvas_center_x_) / scx - 1; - newInput.ymax = this->canvas_center_y_ + (input->ymax - this->canvas_center_y_) / scy + 1; - newInput.ymin = this->canvas_center_y_ + (input->ymin - this->canvas_center_y_) / scy - 1; + new_input.xmax = this->canvas_center_x_ + (input->xmax - this->canvas_center_x_) / scx + 1; + new_input.xmin = this->canvas_center_x_ + (input->xmin - this->canvas_center_x_) / scx - 1; + new_input.ymax = this->canvas_center_y_ + (input->ymax - this->canvas_center_y_) / scy + 1; + new_input.ymin = this->canvas_center_y_ + (input->ymin - this->canvas_center_y_) / scy - 1; } else { - newInput.xmax = this->getWidth(); - newInput.xmin = 0; - newInput.ymax = this->getHeight(); - newInput.ymin = 0; + new_input.xmax = this->get_width(); + new_input.xmin = 0; + new_input.ymax = this->get_height(); + new_input.ymin = 0; } - return BaseScaleOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return BaseScaleOperation::determine_depending_area_of_interest( + &new_input, read_operation, output); } -void ScaleAbsoluteOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ScaleAbsoluteOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - PixelSampler effective_sampler = getEffectiveSampler(sampler); + PixelSampler effective_sampler = get_effective_sampler(sampler); float scaleX[4]; float scaleY[4]; - inputXOperation_->readSampled(scaleX, x, y, effective_sampler); - inputYOperation_->readSampled(scaleY, x, y, effective_sampler); + input_xoperation_->read_sampled(scaleX, x, y, effective_sampler); + input_yoperation_->read_sampled(scaleY, x, y, effective_sampler); const float scx = scaleX[0]; /* Target absolute scale. */ const float scy = scaleY[0]; /* Target absolute scale. */ - const float width = this->getWidth(); - const float height = this->getHeight(); + const float width = this->get_width(); + const float height = this->get_height(); /* Divide. */ - float relativeXScale = scx / width; - float relativeYScale = scy / height; + float relative_xscale = scx / width; + float relative_yscale = scy / height; - float nx = this->canvas_center_x_ + (x - this->canvas_center_x_) / relativeXScale; - float ny = this->canvas_center_y_ + (y - this->canvas_center_y_) / relativeYScale; + float nx = this->canvas_center_x_ + (x - this->canvas_center_x_) / relative_xscale; + float ny = this->canvas_center_y_ + (y - this->canvas_center_y_) / relative_yscale; - inputOperation_->readSampled(output, nx, ny, effective_sampler); + input_operation_->read_sampled(output, nx, ny, effective_sampler); } -bool ScaleAbsoluteOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool ScaleAbsoluteOperation::determine_depending_area_of_interest( + rcti *input, ReadBufferOperation *read_operation, rcti *output) { - rcti newInput; + rcti new_input; if (!variable_size_) { float scaleX[4]; float scaleY[4]; - inputXOperation_->readSampled(scaleX, 0, 0, PixelSampler::Nearest); - inputYOperation_->readSampled(scaleY, 0, 0, PixelSampler::Nearest); + input_xoperation_->read_sampled(scaleX, 0, 0, PixelSampler::Nearest); + input_yoperation_->read_sampled(scaleY, 0, 0, PixelSampler::Nearest); const float scx = scaleX[0]; const float scy = scaleY[0]; - const float width = this->getWidth(); - const float height = this->getHeight(); + const float width = this->get_width(); + const float height = this->get_height(); /* Divide. */ - float relateveXScale = scx / width; - float relateveYScale = scy / height; - - newInput.xmax = this->canvas_center_x_ + - (input->xmax - this->canvas_center_x_) / relateveXScale; - newInput.xmin = this->canvas_center_x_ + - (input->xmin - this->canvas_center_x_) / relateveXScale; - newInput.ymax = this->canvas_center_y_ + - (input->ymax - this->canvas_center_y_) / relateveYScale; - newInput.ymin = this->canvas_center_y_ + - (input->ymin - this->canvas_center_y_) / relateveYScale; + float relateve_xscale = scx / width; + float relateve_yscale = scy / height; + + new_input.xmax = this->canvas_center_x_ + + (input->xmax - this->canvas_center_x_) / relateve_xscale; + new_input.xmin = this->canvas_center_x_ + + (input->xmin - this->canvas_center_x_) / relateve_xscale; + new_input.ymax = this->canvas_center_y_ + + (input->ymax - this->canvas_center_y_) / relateve_yscale; + new_input.ymin = this->canvas_center_y_ + + (input->ymin - this->canvas_center_y_) / relateve_yscale; } else { - newInput.xmax = this->getWidth(); - newInput.xmin = 0; - newInput.ymax = this->getHeight(); - newInput.ymin = 0; + new_input.xmax = this->get_width(); + new_input.xmin = 0; + new_input.ymax = this->get_height(); + new_input.ymin = 0; } - return ScaleOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return ScaleOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } /* Absolute fixed size. */ ScaleFixedSizeOperation::ScaleFixedSizeOperation() : BaseScaleOperation() { - this->addInputSocket(DataType::Color, ResizeMode::None); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color, ResizeMode::None); + this->add_output_socket(DataType::Color); this->set_canvas_input_index(0); - inputOperation_ = nullptr; + input_operation_ = nullptr; is_offset_ = false; } @@ -388,20 +388,20 @@ void ScaleFixedSizeOperation::init_data(const rcti &input_canvas) { const int input_width = BLI_rcti_size_x(&input_canvas); const int input_height = BLI_rcti_size_y(&input_canvas); - relX_ = input_width / (float)newWidth_; - relY_ = input_height / (float)newHeight_; + rel_x_ = input_width / (float)new_width_; + rel_y_ = input_height / (float)new_height_; /* *** all the options below are for a fairly special case - camera framing *** */ - if (offsetX_ != 0.0f || offsetY_ != 0.0f) { + if (offset_x_ != 0.0f || offset_y_ != 0.0f) { is_offset_ = true; - if (newWidth_ > newHeight_) { - offsetX_ *= newWidth_; - offsetY_ *= newWidth_; + if (new_width_ > new_height_) { + offset_x_ *= new_width_; + offset_y_ *= new_width_; } else { - offsetX_ *= newHeight_; - offsetY_ *= newHeight_; + offset_x_ *= new_height_; + offset_y_ *= new_height_; } } @@ -411,8 +411,8 @@ void ScaleFixedSizeOperation::init_data(const rcti &input_canvas) const float h_src = input_height; /* destination aspect is already applied from the camera frame */ - const float w_dst = newWidth_; - const float h_dst = newHeight_; + const float w_dst = new_width_; + const float h_dst = new_height_; const float asp_src = w_src / h_src; const float asp_dst = w_dst / h_dst; @@ -421,33 +421,33 @@ void ScaleFixedSizeOperation::init_data(const rcti &input_canvas) if ((asp_src > asp_dst) == (is_crop_ == true)) { /* fit X */ const float div = asp_src / asp_dst; - relX_ /= div; - offsetX_ += ((w_src - (w_src * div)) / (w_src / w_dst)) / 2.0f; + rel_x_ /= div; + offset_x_ += ((w_src - (w_src * div)) / (w_src / w_dst)) / 2.0f; if (is_crop_ && execution_model_ == eExecutionModel::FullFrame) { - int fit_width = newWidth_ * div; + int fit_width = new_width_ * div; if (fit_width > max_scale_canvas_size_.x) { fit_width = max_scale_canvas_size_.x; } - const int added_width = fit_width - newWidth_; - newWidth_ += added_width; - offsetX_ += added_width / 2.0f; + const int added_width = fit_width - new_width_; + new_width_ += added_width; + offset_x_ += added_width / 2.0f; } } else { /* fit Y */ const float div = asp_dst / asp_src; - relY_ /= div; - offsetY_ += ((h_src - (h_src * div)) / (h_src / h_dst)) / 2.0f; + rel_y_ /= div; + offset_y_ += ((h_src - (h_src * div)) / (h_src / h_dst)) / 2.0f; if (is_crop_ && execution_model_ == eExecutionModel::FullFrame) { - int fit_height = newHeight_ * div; + int fit_height = new_height_ * div; if (fit_height > max_scale_canvas_size_.y) { fit_height = max_scale_canvas_size_.y; } - const int added_height = fit_height - newHeight_; - newHeight_ += added_height; - offsetY_ += added_height / 2.0f; + const int added_height = fit_height - new_height_; + new_height_ += added_height; + offset_y_ += added_height / 2.0f; } } @@ -457,66 +457,67 @@ void ScaleFixedSizeOperation::init_data(const rcti &input_canvas) /* *** end framing options *** */ } -void ScaleFixedSizeOperation::initExecution() +void ScaleFixedSizeOperation::init_execution() { - inputOperation_ = this->getInputSocketReader(0); + input_operation_ = this->get_input_socket_reader(0); } -void ScaleFixedSizeOperation::deinitExecution() +void ScaleFixedSizeOperation::deinit_execution() { - inputOperation_ = nullptr; + input_operation_ = nullptr; } -void ScaleFixedSizeOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ScaleFixedSizeOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - PixelSampler effective_sampler = getEffectiveSampler(sampler); + PixelSampler effective_sampler = get_effective_sampler(sampler); if (is_offset_) { - float nx = ((x - offsetX_) * relX_); - float ny = ((y - offsetY_) * relY_); - inputOperation_->readSampled(output, nx, ny, effective_sampler); + float nx = ((x - offset_x_) * rel_x_); + float ny = ((y - offset_y_) * rel_y_); + input_operation_->read_sampled(output, nx, ny, effective_sampler); } else { - inputOperation_->readSampled(output, x * relX_, y * relY_, effective_sampler); + input_operation_->read_sampled(output, x * rel_x_, y * rel_y_, effective_sampler); } } -bool ScaleFixedSizeOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool ScaleFixedSizeOperation::determine_depending_area_of_interest( + rcti *input, ReadBufferOperation *read_operation, rcti *output) { - rcti newInput; + rcti new_input; - newInput.xmax = (input->xmax - offsetX_) * relX_ + 1; - newInput.xmin = (input->xmin - offsetX_) * relX_; - newInput.ymax = (input->ymax - offsetY_) * relY_ + 1; - newInput.ymin = (input->ymin - offsetY_) * relY_; + new_input.xmax = (input->xmax - offset_x_) * rel_x_ + 1; + new_input.xmin = (input->xmin - offset_x_) * rel_x_; + new_input.ymax = (input->ymax - offset_y_) * rel_y_ + 1; + new_input.ymin = (input->ymin - offset_y_) * rel_y_; - return BaseScaleOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return BaseScaleOperation::determine_depending_area_of_interest( + &new_input, read_operation, output); } void ScaleFixedSizeOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) { rcti local_preferred = preferred_area; - local_preferred.xmax = local_preferred.xmin + newWidth_; - local_preferred.ymax = local_preferred.ymin + newHeight_; + local_preferred.xmax = local_preferred.xmin + new_width_; + local_preferred.ymax = local_preferred.ymin + new_height_; rcti input_canvas; - const bool input_determined = getInputSocket(0)->determine_canvas(local_preferred, input_canvas); + const bool input_determined = get_input_socket(0)->determine_canvas(local_preferred, + input_canvas); if (input_determined) { init_data(input_canvas); r_area = input_canvas; if (execution_model_ == eExecutionModel::FullFrame) { - r_area.xmin /= relX_; - r_area.ymin /= relY_; - r_area.xmin += offsetX_; - r_area.ymin += offsetY_; + r_area.xmin /= rel_x_; + r_area.ymin /= rel_y_; + r_area.xmin += offset_x_; + r_area.ymin += offset_y_; } - r_area.xmax = r_area.xmin + newWidth_; - r_area.ymax = r_area.ymin + newHeight_; + r_area.xmax = r_area.xmin + new_width_; + r_area.ymax = r_area.ymin + new_height_; } } @@ -527,10 +528,10 @@ void ScaleFixedSizeOperation::get_area_of_interest(const int input_idx, BLI_assert(input_idx == 0); UNUSED_VARS_NDEBUG(input_idx); - r_input_area.xmax = ceilf((output_area.xmax - offsetX_) * relX_); - r_input_area.xmin = floorf((output_area.xmin - offsetX_) * relX_); - r_input_area.ymax = ceilf((output_area.ymax - offsetY_) * relY_); - r_input_area.ymin = floorf((output_area.ymin - offsetY_) * relY_); + r_input_area.xmax = ceilf((output_area.xmax - offset_x_) * rel_x_); + r_input_area.xmin = floorf((output_area.xmin - offset_x_) * rel_x_); + r_input_area.ymax = ceilf((output_area.ymax - offset_y_) * rel_y_); + r_input_area.ymin = floorf((output_area.ymin - offset_y_) * rel_y_); expand_area_for_sampler(r_input_area, (PixelSampler)sampler_); } @@ -543,15 +544,15 @@ void ScaleFixedSizeOperation::update_memory_buffer_partial(MemoryBuffer *output, BuffersIterator<float> it = output->iterate_with({}, area); if (is_offset_) { for (; !it.is_end(); ++it) { - const float nx = (canvas_.xmin + it.x - offsetX_) * relX_; - const float ny = (canvas_.ymin + it.y - offsetY_) * relY_; + const float nx = (canvas_.xmin + it.x - offset_x_) * rel_x_; + const float ny = (canvas_.ymin + it.y - offset_y_) * rel_y_; input_img->read_elem_sampled(nx - canvas_.xmin, ny - canvas_.ymin, sampler, it.out); } } else { for (; !it.is_end(); ++it) { - input_img->read_elem_sampled((canvas_.xmin + it.x) * relX_ - canvas_.xmin, - (canvas_.ymin + it.y) * relY_ - canvas_.ymin, + input_img->read_elem_sampled((canvas_.xmin + it.x) * rel_x_ - canvas_.xmin, + (canvas_.ymin + it.y) * rel_y_ - canvas_.ymin, sampler, it.out); } diff --git a/source/blender/compositor/operations/COM_ScaleOperation.h b/source/blender/compositor/operations/COM_ScaleOperation.h index 868a17bc394..7710aa34c54 100644 --- a/source/blender/compositor/operations/COM_ScaleOperation.h +++ b/source/blender/compositor/operations/COM_ScaleOperation.h @@ -27,11 +27,11 @@ class BaseScaleOperation : public MultiThreadedOperation { static constexpr float DEFAULT_MAX_SCALE_CANVAS_SIZE = 12000; public: - void setSampler(PixelSampler sampler) + void set_sampler(PixelSampler sampler) { sampler_ = (int)sampler; } - void setVariableSize(bool variable_size) + void set_variable_size(bool variable_size) { variable_size_ = variable_size; }; @@ -41,7 +41,7 @@ class BaseScaleOperation : public MultiThreadedOperation { protected: BaseScaleOperation(); - PixelSampler getEffectiveSampler(PixelSampler sampler) + PixelSampler get_effective_sampler(PixelSampler sampler) { return (sampler_ == -1) ? sampler : (PixelSampler)sampler_; } @@ -61,9 +61,9 @@ class ScaleOperation : public BaseScaleOperation { static constexpr int X_INPUT_INDEX = 1; static constexpr int Y_INPUT_INDEX = 2; - SocketReader *inputOperation_; - SocketReader *inputXOperation_; - SocketReader *inputYOperation_; + SocketReader *input_operation_; + SocketReader *input_xoperation_; + SocketReader *input_yoperation_; float canvas_center_x_; float canvas_center_y_; @@ -97,8 +97,8 @@ class ScaleOperation : public BaseScaleOperation { static void clamp_area_size_max(rcti &area, Size2f max_size); void init_data() override; - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; void update_memory_buffer_partial(MemoryBuffer *output, @@ -122,10 +122,10 @@ class ScaleRelativeOperation : public ScaleOperation { public: ScaleRelativeOperation(); ScaleRelativeOperation(DataType data_type); - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; float get_relative_scale_x_factor(float UNUSED(width)) override { @@ -140,10 +140,10 @@ class ScaleRelativeOperation : public ScaleOperation { class ScaleAbsoluteOperation : public ScaleOperation { public: - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; float get_relative_scale_x_factor(float width) override { @@ -157,15 +157,15 @@ class ScaleAbsoluteOperation : public ScaleOperation { }; class ScaleFixedSizeOperation : public BaseScaleOperation { - SocketReader *inputOperation_; - int newWidth_; - int newHeight_; - float relX_; - float relY_; + SocketReader *input_operation_; + int new_width_; + int new_height_; + float rel_x_; + float rel_y_; /* center is only used for aspect correction */ - float offsetX_; - float offsetY_; + float offset_x_; + float offset_y_; bool is_aspect_; bool is_crop_; /* set from other properties on initialization, @@ -174,34 +174,34 @@ class ScaleFixedSizeOperation : public BaseScaleOperation { public: ScaleFixedSizeOperation(); - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; void determine_canvas(const rcti &preferred_area, rcti &r_area) override; - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution() override; - void deinitExecution() override; - void setNewWidth(int width) + void init_execution() override; + void deinit_execution() override; + void set_new_width(int width) { - newWidth_ = width; + new_width_ = width; } - void setNewHeight(int height) + void set_new_height(int height) { - newHeight_ = height; + new_height_ = height; } - void setIsAspect(bool is_aspect) + void set_is_aspect(bool is_aspect) { is_aspect_ = is_aspect; } - void setIsCrop(bool is_crop) + void set_is_crop(bool is_crop) { is_crop_ = is_crop; } - void setOffset(float x, float y) + void set_offset(float x, float y) { - offsetX_ = x; - offsetY_ = y; + offset_x_ = x; + offset_y_ = y; } void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc index 3892d76874c..1ce0378c335 100644 --- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc +++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cc @@ -28,12 +28,12 @@ namespace blender::compositor { ScreenLensDistortionOperation::ScreenLensDistortionOperation() { - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Color); this->flags.complex = true; - inputProgram_ = nullptr; + input_program_ = nullptr; distortion_ = 0.0f; dispersion_ = 0.0f; distortion_const_ = false; @@ -41,13 +41,13 @@ ScreenLensDistortionOperation::ScreenLensDistortionOperation() variables_ready_ = false; } -void ScreenLensDistortionOperation::setDistortion(float distortion) +void ScreenLensDistortionOperation::set_distortion(float distortion) { distortion_ = distortion; distortion_const_ = true; } -void ScreenLensDistortionOperation::setDispersion(float dispersion) +void ScreenLensDistortionOperation::set_dispersion(float dispersion) { dispersion_ = dispersion; dispersion_const_ = true; @@ -55,8 +55,8 @@ void ScreenLensDistortionOperation::setDispersion(float dispersion) void ScreenLensDistortionOperation::init_data() { - cx_ = 0.5f * (float)getWidth(); - cy_ = 0.5f * (float)getHeight(); + cx_ = 0.5f * (float)get_width(); + cy_ = 0.5f * (float)get_height(); switch (execution_model_) { case eExecutionModel::FullFrame: { @@ -68,13 +68,13 @@ void ScreenLensDistortionOperation::init_data() if (!dispersion_const_ && distortion_op->get_flags().is_constant_operation) { dispersion_ = static_cast<ConstantOperation *>(dispersion_op)->get_constant_elem()[0]; } - updateVariables(distortion_, dispersion_); + update_variables(distortion_, dispersion_); break; } case eExecutionModel::Tiled: { /* If both are constant, init variables once. */ if (distortion_const_ && dispersion_const_) { - updateVariables(distortion_, dispersion_); + update_variables(distortion_, dispersion_); variables_ready_ = true; } break; @@ -82,42 +82,42 @@ void ScreenLensDistortionOperation::init_data() } } -void ScreenLensDistortionOperation::initExecution() +void ScreenLensDistortionOperation::init_execution() { - inputProgram_ = this->getInputSocketReader(0); - this->initMutex(); + input_program_ = this->get_input_socket_reader(0); + this->init_mutex(); uint rng_seed = (uint)(PIL_check_seconds_timer_i() & UINT_MAX); - rng_seed ^= (uint)POINTER_AS_INT(inputProgram_); + rng_seed ^= (uint)POINTER_AS_INT(input_program_); rng_ = BLI_rng_new(rng_seed); } -void *ScreenLensDistortionOperation::initializeTileData(rcti * /*rect*/) +void *ScreenLensDistortionOperation::initialize_tile_data(rcti * /*rect*/) { - void *buffer = inputProgram_->initializeTileData(nullptr); + void *buffer = input_program_->initialize_tile_data(nullptr); /* get distortion/dispersion values once, by reading inputs at (0,0) * XXX this assumes invariable values (no image inputs), * we don't have a nice generic system for that yet */ if (!variables_ready_) { - this->lockMutex(); + this->lock_mutex(); if (!distortion_const_) { float result[4]; - getInputSocketReader(1)->readSampled(result, 0, 0, PixelSampler::Nearest); + get_input_socket_reader(1)->read_sampled(result, 0, 0, PixelSampler::Nearest); distortion_ = result[0]; } if (!dispersion_const_) { float result[4]; - getInputSocketReader(2)->readSampled(result, 0, 0, PixelSampler::Nearest); + get_input_socket_reader(2)->read_sampled(result, 0, 0, PixelSampler::Nearest); dispersion_ = result[0]; } - updateVariables(distortion_, dispersion_); + update_variables(distortion_, dispersion_); variables_ready_ = true; - this->unlockMutex(); + this->unlock_mutex(); } return buffer; @@ -132,8 +132,8 @@ void ScreenLensDistortionOperation::get_uv(const float xy[2], float uv[2]) const void ScreenLensDistortionOperation::distort_uv(const float uv[2], float t, float xy[2]) const { float d = 1.0f / (1.0f + sqrtf(t)); - xy[0] = (uv[0] * d + 0.5f) * getWidth() - 0.5f; - xy[1] = (uv[1] * d + 0.5f) * getHeight() - 0.5f; + xy[0] = (uv[0] * d + 0.5f) * get_width() - 0.5f; + xy[1] = (uv[1] * d + 0.5f) * get_height() - 0.5f; } bool ScreenLensDistortionOperation::get_delta(float r_sq, @@ -176,7 +176,7 @@ void ScreenLensDistortionOperation::accumulate(const MemoryBuffer *buffer, distort_uv(uv, t, xy); switch (execution_model_) { case eExecutionModel::Tiled: - buffer->readBilinear(color, xy[0], xy[1]); + buffer->read_bilinear(color, xy[0], xy[1]); break; case eExecutionModel::FullFrame: buffer->read_elem_bilinear(xy[0], xy[1], color); @@ -190,7 +190,7 @@ void ScreenLensDistortionOperation::accumulate(const MemoryBuffer *buffer, } } -void ScreenLensDistortionOperation::executePixel(float output[4], int x, int y, void *data) +void ScreenLensDistortionOperation::execute_pixel(float output[4], int x, int y, void *data) { MemoryBuffer *buffer = (MemoryBuffer *)data; float xy[2] = {(float)x, (float)y}; @@ -228,10 +228,10 @@ void ScreenLensDistortionOperation::executePixel(float output[4], int x, int y, } } -void ScreenLensDistortionOperation::deinitExecution() +void ScreenLensDistortionOperation::deinit_execution() { - this->deinitMutex(); - inputProgram_ = nullptr; + this->deinit_mutex(); + input_program_ = nullptr; BLI_rng_free(rng_); } @@ -250,22 +250,22 @@ void ScreenLensDistortionOperation::determineUV(float result[6], float x, float get_delta(uv_dot, k4_[2], uv, result + 4); } -bool ScreenLensDistortionOperation::determineDependingAreaOfInterest( - rcti * /*input*/, ReadBufferOperation *readOperation, rcti *output) +bool ScreenLensDistortionOperation::determine_depending_area_of_interest( + rcti * /*input*/, ReadBufferOperation *read_operation, rcti *output) { - rcti newInputValue; - newInputValue.xmin = 0; - newInputValue.ymin = 0; - newInputValue.xmax = 2; - newInputValue.ymax = 2; - - NodeOperation *operation = getInputOperation(1); - if (operation->determineDependingAreaOfInterest(&newInputValue, readOperation, output)) { + rcti new_input_value; + new_input_value.xmin = 0; + new_input_value.ymin = 0; + new_input_value.xmax = 2; + new_input_value.ymax = 2; + + NodeOperation *operation = get_input_operation(1); + if (operation->determine_depending_area_of_interest(&new_input_value, read_operation, output)) { return true; } - operation = getInputOperation(2); - if (operation->determineDependingAreaOfInterest(&newInputValue, readOperation, output)) { + operation = get_input_operation(2); + if (operation->determine_depending_area_of_interest(&new_input_value, read_operation, output)) { return true; } @@ -275,23 +275,23 @@ bool ScreenLensDistortionOperation::determineDependingAreaOfInterest( * So now just use the full image area, which may not be as efficient but works at least ... */ #if 1 - rcti imageInput; + rcti image_input; - operation = getInputOperation(0); - imageInput.xmax = operation->getWidth(); - imageInput.xmin = 0; - imageInput.ymax = operation->getHeight(); - imageInput.ymin = 0; + operation = get_input_operation(0); + image_input.xmax = operation->get_width(); + image_input.xmin = 0; + image_input.ymax = operation->get_height(); + image_input.ymin = 0; - if (operation->determineDependingAreaOfInterest(&imageInput, readOperation, output)) { + if (operation->determine_depending_area_of_interest(&image_input, read_operation, output)) { return true; } return false; #else - rcti newInput; + rcti new_input; const float margin = 2; - BLI_rcti_init_minmax(&newInput); + BLI_rcti_init_minmax(&new_input); if (dispersion_const_ && distortion_const_) { /* update from fixed distortion/dispersion */ @@ -299,10 +299,10 @@ bool ScreenLensDistortionOperation::determineDependingAreaOfInterest( { \ float coords[6]; \ determineUV(coords, x, y); \ - newInput.xmin = min_ffff(newInput.xmin, coords[0], coords[2], coords[4]); \ - newInput.ymin = min_ffff(newInput.ymin, coords[1], coords[3], coords[5]); \ - newInput.xmax = max_ffff(newInput.xmax, coords[0], coords[2], coords[4]); \ - newInput.ymax = max_ffff(newInput.ymax, coords[1], coords[3], coords[5]); \ + new_input.xmin = min_ffff(new_input.xmin, coords[0], coords[2], coords[4]); \ + new_input.ymin = min_ffff(new_input.ymin, coords[1], coords[3], coords[5]); \ + new_input.xmax = max_ffff(new_input.xmax, coords[0], coords[2], coords[4]); \ + new_input.ymax = max_ffff(new_input.ymax, coords[1], coords[3], coords[5]); \ } \ (void)0 @@ -320,12 +320,12 @@ bool ScreenLensDistortionOperation::determineDependingAreaOfInterest( # define UPDATE_INPUT(x, y, distortion) \ { \ float coords[6]; \ - updateVariables(distortion, dispersion); \ + update_variables(distortion, dispersion); \ determineUV(coords, x, y); \ - newInput.xmin = min_ffff(newInput.xmin, coords[0], coords[2], coords[4]); \ - newInput.ymin = min_ffff(newInput.ymin, coords[1], coords[3], coords[5]); \ - newInput.xmax = max_ffff(newInput.xmax, coords[0], coords[2], coords[4]); \ - newInput.ymax = max_ffff(newInput.ymax, coords[1], coords[3], coords[5]); \ + new_input.xmin = min_ffff(new_input.xmin, coords[0], coords[2], coords[4]); \ + new_input.ymin = min_ffff(new_input.ymin, coords[1], coords[3], coords[5]); \ + new_input.xmax = max_ffff(new_input.xmax, coords[0], coords[2], coords[4]); \ + new_input.ymax = max_ffff(new_input.ymax, coords[1], coords[3], coords[5]); \ } \ (void)0 @@ -352,20 +352,20 @@ bool ScreenLensDistortionOperation::determineDependingAreaOfInterest( } } - newInput.xmin -= margin; - newInput.ymin -= margin; - newInput.xmax += margin; - newInput.ymax += margin; + new_input.xmin -= margin; + new_input.ymin -= margin; + new_input.xmax += margin; + new_input.ymax += margin; - operation = getInputOperation(0); - if (operation->determineDependingAreaOfInterest(&newInput, readOperation, output)) { + operation = get_input_operation(0); + if (operation->determine_depending_area_of_interest(&new_input, read_operation, output)) { return true; } return false; #endif } -void ScreenLensDistortionOperation::updateVariables(float distortion, float dispersion) +void ScreenLensDistortionOperation::update_variables(float distortion, float dispersion) { k_[1] = max_ff(min_ff(distortion, 1.0f), -0.999f); /* Smaller dispersion range for somewhat more control. */ @@ -413,14 +413,14 @@ void ScreenLensDistortionOperation::get_area_of_interest(const int input_idx, * So now just use the full image area, which may not be as efficient but works at least ... */ #if 1 - NodeOperation *image = getInputOperation(0); + NodeOperation *image = get_input_operation(0); r_input_area = image->get_canvas(); #else /* Original method in tiled implementation. */ - rcti newInput; + rcti new_input; const float margin = 2; - BLI_rcti_init_minmax(&newInput); + BLI_rcti_init_minmax(&new_input); if (dispersion_const_ && distortion_const_) { /* update from fixed distortion/dispersion */ @@ -428,10 +428,10 @@ void ScreenLensDistortionOperation::get_area_of_interest(const int input_idx, { \ float coords[6]; \ determineUV(coords, x, y); \ - newInput.xmin = min_ffff(newInput.xmin, coords[0], coords[2], coords[4]); \ - newInput.ymin = min_ffff(newInput.ymin, coords[1], coords[3], coords[5]); \ - newInput.xmax = max_ffff(newInput.xmax, coords[0], coords[2], coords[4]); \ - newInput.ymax = max_ffff(newInput.ymax, coords[1], coords[3], coords[5]); \ + new_input.xmin = min_ffff(new_input.xmin, coords[0], coords[2], coords[4]); \ + new_input.ymin = min_ffff(new_input.ymin, coords[1], coords[3], coords[5]); \ + new_input.xmax = max_ffff(new_input.xmax, coords[0], coords[2], coords[4]); \ + new_input.ymax = max_ffff(new_input.ymax, coords[1], coords[3], coords[5]); \ } \ (void)0 @@ -449,12 +449,12 @@ void ScreenLensDistortionOperation::get_area_of_interest(const int input_idx, # define UPDATE_INPUT(x, y, distortion) \ { \ float coords[6]; \ - updateVariables(distortion, dispersion); \ + update_variables(distortion, dispersion); \ determineUV(coords, x, y); \ - newInput.xmin = min_ffff(newInput.xmin, coords[0], coords[2], coords[4]); \ - newInput.ymin = min_ffff(newInput.ymin, coords[1], coords[3], coords[5]); \ - newInput.xmax = max_ffff(newInput.xmax, coords[0], coords[2], coords[4]); \ - newInput.ymax = max_ffff(newInput.ymax, coords[1], coords[3], coords[5]); \ + new_input.xmin = min_ffff(new_input.xmin, coords[0], coords[2], coords[4]); \ + new_input.ymin = min_ffff(new_input.ymin, coords[1], coords[3], coords[5]); \ + new_input.xmax = max_ffff(new_input.xmax, coords[0], coords[2], coords[4]); \ + new_input.ymax = max_ffff(new_input.ymax, coords[1], coords[3], coords[5]); \ } \ (void)0 @@ -481,13 +481,13 @@ void ScreenLensDistortionOperation::get_area_of_interest(const int input_idx, } } - newInput.xmin -= margin; - newInput.ymin -= margin; - newInput.xmax += margin; - newInput.ymax += margin; + new_input.xmin -= margin; + new_input.ymin -= margin; + new_input.xmax += margin; + new_input.ymax += margin; - operation = getInputOperation(0); - if (operation->determineDependingAreaOfInterest(&newInput, readOperation, output)) { + operation = get_input_operation(0); + if (operation->determine_depending_area_of_interest(&new_input, read_operation, output)) { return true; } return false; diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h index 8962ee09290..fb610b90466 100644 --- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h +++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.h @@ -28,9 +28,9 @@ namespace blender::compositor { class ScreenLensDistortionOperation : public MultiThreadedOperation { private: /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputProgram_; + SocketReader *input_program_; struct RNG *rng_; bool fit_; @@ -55,36 +55,36 @@ class ScreenLensDistortionOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; - void *initializeTileData(rcti *rect) override; + void *initialize_tile_data(rcti *rect) override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void setFit(bool fit) + void set_fit(bool fit) { fit_ = fit; } - void setJitter(bool jitter) + void set_jitter(bool jitter) { jitter_ = jitter; } /** Set constant distortion value */ - void setDistortion(float distortion); + void set_distortion(float distortion); /** Set constant dispersion value */ - void setDispersion(float dispersion); + void set_dispersion(float dispersion); - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; void determine_canvas(const rcti &preferred_area, rcti &r_area) override; void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; @@ -94,7 +94,7 @@ class ScreenLensDistortionOperation : public MultiThreadedOperation { private: void determineUV(float result[6], float x, float y) const; - void updateVariables(float distortion, float dispersion); + void update_variables(float distortion, float dispersion); void get_uv(const float xy[2], float uv[2]) const; void distort_uv(const float uv[2], float t, float xy[2]) const; diff --git a/source/blender/compositor/operations/COM_SetAlphaMultiplyOperation.cc b/source/blender/compositor/operations/COM_SetAlphaMultiplyOperation.cc index 2f11e1dbb18..a1ea5758a83 100644 --- a/source/blender/compositor/operations/COM_SetAlphaMultiplyOperation.cc +++ b/source/blender/compositor/operations/COM_SetAlphaMultiplyOperation.cc @@ -22,39 +22,39 @@ namespace blender::compositor { SetAlphaMultiplyOperation::SetAlphaMultiplyOperation() { - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Color); - inputColor_ = nullptr; - inputAlpha_ = nullptr; + input_color_ = nullptr; + input_alpha_ = nullptr; this->flags.can_be_constant = true; } -void SetAlphaMultiplyOperation::initExecution() +void SetAlphaMultiplyOperation::init_execution() { - inputColor_ = getInputSocketReader(0); - inputAlpha_ = getInputSocketReader(1); + input_color_ = get_input_socket_reader(0); + input_alpha_ = get_input_socket_reader(1); } -void SetAlphaMultiplyOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void SetAlphaMultiplyOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { float color_input[4]; float alpha_input[4]; - inputColor_->readSampled(color_input, x, y, sampler); - inputAlpha_->readSampled(alpha_input, x, y, sampler); + input_color_->read_sampled(color_input, x, y, sampler); + input_alpha_->read_sampled(alpha_input, x, y, sampler); mul_v4_v4fl(output, color_input, alpha_input[0]); } -void SetAlphaMultiplyOperation::deinitExecution() +void SetAlphaMultiplyOperation::deinit_execution() { - inputColor_ = nullptr; - inputAlpha_ = nullptr; + input_color_ = nullptr; + input_alpha_ = nullptr; } void SetAlphaMultiplyOperation::update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_SetAlphaMultiplyOperation.h b/source/blender/compositor/operations/COM_SetAlphaMultiplyOperation.h index 77f61e976e1..2aa56800ff7 100644 --- a/source/blender/compositor/operations/COM_SetAlphaMultiplyOperation.h +++ b/source/blender/compositor/operations/COM_SetAlphaMultiplyOperation.h @@ -29,16 +29,16 @@ namespace blender::compositor { */ class SetAlphaMultiplyOperation : public MultiThreadedOperation { private: - SocketReader *inputColor_; - SocketReader *inputAlpha_; + SocketReader *input_color_; + SocketReader *input_alpha_; public: SetAlphaMultiplyOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, diff --git a/source/blender/compositor/operations/COM_SetAlphaReplaceOperation.cc b/source/blender/compositor/operations/COM_SetAlphaReplaceOperation.cc index 09539d2fe57..649e6ce0a4e 100644 --- a/source/blender/compositor/operations/COM_SetAlphaReplaceOperation.cc +++ b/source/blender/compositor/operations/COM_SetAlphaReplaceOperation.cc @@ -22,37 +22,37 @@ namespace blender::compositor { SetAlphaReplaceOperation::SetAlphaReplaceOperation() { - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Color); - inputColor_ = nullptr; - inputAlpha_ = nullptr; + input_color_ = nullptr; + input_alpha_ = nullptr; this->flags.can_be_constant = true; } -void SetAlphaReplaceOperation::initExecution() +void SetAlphaReplaceOperation::init_execution() { - inputColor_ = getInputSocketReader(0); - inputAlpha_ = getInputSocketReader(1); + input_color_ = get_input_socket_reader(0); + input_alpha_ = get_input_socket_reader(1); } -void SetAlphaReplaceOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void SetAlphaReplaceOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { float alpha_input[4]; - inputColor_->readSampled(output, x, y, sampler); - inputAlpha_->readSampled(alpha_input, x, y, sampler); + input_color_->read_sampled(output, x, y, sampler); + input_alpha_->read_sampled(alpha_input, x, y, sampler); output[3] = alpha_input[0]; } -void SetAlphaReplaceOperation::deinitExecution() +void SetAlphaReplaceOperation::deinit_execution() { - inputColor_ = nullptr; - inputAlpha_ = nullptr; + input_color_ = nullptr; + input_alpha_ = nullptr; } void SetAlphaReplaceOperation::update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_SetAlphaReplaceOperation.h b/source/blender/compositor/operations/COM_SetAlphaReplaceOperation.h index 9c295eec3bd..ea27e6af672 100644 --- a/source/blender/compositor/operations/COM_SetAlphaReplaceOperation.h +++ b/source/blender/compositor/operations/COM_SetAlphaReplaceOperation.h @@ -28,8 +28,8 @@ namespace blender::compositor { */ class SetAlphaReplaceOperation : public MultiThreadedOperation { private: - SocketReader *inputColor_; - SocketReader *inputAlpha_; + SocketReader *input_color_; + SocketReader *input_alpha_; public: /** @@ -40,10 +40,10 @@ class SetAlphaReplaceOperation : public MultiThreadedOperation { /** * the inner loop of this program */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, diff --git a/source/blender/compositor/operations/COM_SetColorOperation.cc b/source/blender/compositor/operations/COM_SetColorOperation.cc index 8700ba7496b..2f89e6722fa 100644 --- a/source/blender/compositor/operations/COM_SetColorOperation.cc +++ b/source/blender/compositor/operations/COM_SetColorOperation.cc @@ -22,14 +22,14 @@ namespace blender::compositor { SetColorOperation::SetColorOperation() { - this->addOutputSocket(DataType::Color); + this->add_output_socket(DataType::Color); flags.is_set_operation = true; } -void SetColorOperation::executePixelSampled(float output[4], - float /*x*/, - float /*y*/, - PixelSampler /*sampler*/) +void SetColorOperation::execute_pixel_sampled(float output[4], + float /*x*/, + float /*y*/, + PixelSampler /*sampler*/) { copy_v4_v4(output, color_); } diff --git a/source/blender/compositor/operations/COM_SetColorOperation.h b/source/blender/compositor/operations/COM_SetColorOperation.h index ad30c1d820d..0e04c0324b8 100644 --- a/source/blender/compositor/operations/COM_SetColorOperation.h +++ b/source/blender/compositor/operations/COM_SetColorOperation.h @@ -41,39 +41,39 @@ class SetColorOperation : public ConstantOperation { return color_; } - float getChannel1() + float get_channel1() { return color_[0]; } - void setChannel1(float value) + void set_channel1(float value) { color_[0] = value; } - float getChannel2() + float get_channel2() { return color_[1]; } - void setChannel2(float value) + void set_channel2(float value) { color_[1] = value; } - float getChannel3() + float get_channel3() { return color_[2]; } - void setChannel3(float value) + void set_channel3(float value) { color_[2] = value; } - float getChannel4() + float get_channel4() { return color_[3]; } - void setChannel4(const float value) + void set_channel4(const float value) { color_[3] = value; } - void setChannels(const float value[4]) + void set_channels(const float value[4]) { copy_v4_v4(color_, value); } @@ -81,7 +81,7 @@ class SetColorOperation : public ConstantOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void determine_canvas(const rcti &preferred_area, rcti &r_area) override; }; diff --git a/source/blender/compositor/operations/COM_SetSamplerOperation.cc b/source/blender/compositor/operations/COM_SetSamplerOperation.cc index 7919b885556..6f5ac63317b 100644 --- a/source/blender/compositor/operations/COM_SetSamplerOperation.cc +++ b/source/blender/compositor/operations/COM_SetSamplerOperation.cc @@ -22,25 +22,25 @@ namespace blender::compositor { SetSamplerOperation::SetSamplerOperation() { - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); } -void SetSamplerOperation::initExecution() +void SetSamplerOperation::init_execution() { - reader_ = this->getInputSocketReader(0); + reader_ = this->get_input_socket_reader(0); } -void SetSamplerOperation::deinitExecution() +void SetSamplerOperation::deinit_execution() { reader_ = nullptr; } -void SetSamplerOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler /*sampler*/) +void SetSamplerOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler /*sampler*/) { - reader_->readSampled(output, x, y, sampler_); + reader_->read_sampled(output, x, y, sampler_); } } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_SetSamplerOperation.h b/source/blender/compositor/operations/COM_SetSamplerOperation.h index 87b232cbfa7..27ef6603ae4 100644 --- a/source/blender/compositor/operations/COM_SetSamplerOperation.h +++ b/source/blender/compositor/operations/COM_SetSamplerOperation.h @@ -37,7 +37,7 @@ class SetSamplerOperation : public NodeOperation { */ SetSamplerOperation(); - void setSampler(PixelSampler sampler) + void set_sampler(PixelSampler sampler) { sampler_ = sampler; } @@ -45,9 +45,9 @@ class SetSamplerOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution() override; - void deinitExecution() override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; + void init_execution() override; + void deinit_execution() override; }; } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_SetValueOperation.cc b/source/blender/compositor/operations/COM_SetValueOperation.cc index b5e2f50338f..9cd4bed0750 100644 --- a/source/blender/compositor/operations/COM_SetValueOperation.cc +++ b/source/blender/compositor/operations/COM_SetValueOperation.cc @@ -22,14 +22,14 @@ namespace blender::compositor { SetValueOperation::SetValueOperation() { - this->addOutputSocket(DataType::Value); + this->add_output_socket(DataType::Value); flags.is_set_operation = true; } -void SetValueOperation::executePixelSampled(float output[4], - float /*x*/, - float /*y*/, - PixelSampler /*sampler*/) +void SetValueOperation::execute_pixel_sampled(float output[4], + float /*x*/, + float /*y*/, + PixelSampler /*sampler*/) { output[0] = value_; } diff --git a/source/blender/compositor/operations/COM_SetValueOperation.h b/source/blender/compositor/operations/COM_SetValueOperation.h index bf914d2f918..4c824d00294 100644 --- a/source/blender/compositor/operations/COM_SetValueOperation.h +++ b/source/blender/compositor/operations/COM_SetValueOperation.h @@ -41,11 +41,11 @@ class SetValueOperation : public ConstantOperation { return &value_; } - float getValue() + float get_value() { return value_; } - void setValue(float value) + void set_value(float value) { value_ = value; } @@ -53,7 +53,7 @@ class SetValueOperation : public ConstantOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void determine_canvas(const rcti &preferred_area, rcti &r_area) override; }; diff --git a/source/blender/compositor/operations/COM_SetVectorOperation.cc b/source/blender/compositor/operations/COM_SetVectorOperation.cc index 6f0a947c52d..47f13f10fee 100644 --- a/source/blender/compositor/operations/COM_SetVectorOperation.cc +++ b/source/blender/compositor/operations/COM_SetVectorOperation.cc @@ -22,14 +22,14 @@ namespace blender::compositor { SetVectorOperation::SetVectorOperation() { - this->addOutputSocket(DataType::Vector); + this->add_output_socket(DataType::Vector); flags.is_set_operation = true; } -void SetVectorOperation::executePixelSampled(float output[4], - float /*x*/, - float /*y*/, - PixelSampler /*sampler*/) +void SetVectorOperation::execute_pixel_sampled(float output[4], + float /*x*/, + float /*y*/, + PixelSampler /*sampler*/) { output[0] = vector_.x; output[1] = vector_.y; diff --git a/source/blender/compositor/operations/COM_SetVectorOperation.h b/source/blender/compositor/operations/COM_SetVectorOperation.h index 920ea8051e4..291fef37817 100644 --- a/source/blender/compositor/operations/COM_SetVectorOperation.h +++ b/source/blender/compositor/operations/COM_SetVectorOperation.h @@ -82,11 +82,11 @@ class SetVectorOperation : public ConstantOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void determine_canvas(const rcti &preferred_area, rcti &r_area) override; - void setVector(const float vector[3]) + void set_vector(const float vector[3]) { setX(vector[0]); setY(vector[1]); diff --git a/source/blender/compositor/operations/COM_SocketProxyOperation.cc b/source/blender/compositor/operations/COM_SocketProxyOperation.cc index 39876439b7b..18a09362591 100644 --- a/source/blender/compositor/operations/COM_SocketProxyOperation.cc +++ b/source/blender/compositor/operations/COM_SocketProxyOperation.cc @@ -22,15 +22,15 @@ namespace blender::compositor { SocketProxyOperation::SocketProxyOperation(DataType type, bool use_conversion) { - this->addInputSocket(type); - this->addOutputSocket(type); + this->add_input_socket(type); + this->add_output_socket(type); flags.is_proxy_operation = true; flags.use_datatype_conversion = use_conversion; } -std::unique_ptr<MetaData> SocketProxyOperation::getMetaData() +std::unique_ptr<MetaData> SocketProxyOperation::get_meta_data() { - return this->getInputSocket(0)->getReader()->getMetaData(); + return this->get_input_socket(0)->get_reader()->get_meta_data(); } } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_SocketProxyOperation.h b/source/blender/compositor/operations/COM_SocketProxyOperation.h index 1d3b76055bd..e9740cf43bc 100644 --- a/source/blender/compositor/operations/COM_SocketProxyOperation.h +++ b/source/blender/compositor/operations/COM_SocketProxyOperation.h @@ -26,7 +26,7 @@ class SocketProxyOperation : public NodeOperation { public: SocketProxyOperation(DataType type, bool use_conversion); - std::unique_ptr<MetaData> getMetaData() override; + std::unique_ptr<MetaData> get_meta_data() override; }; } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_SplitOperation.cc b/source/blender/compositor/operations/COM_SplitOperation.cc index 99db558343d..e98c5c986f5 100644 --- a/source/blender/compositor/operations/COM_SplitOperation.cc +++ b/source/blender/compositor/operations/COM_SplitOperation.cc @@ -22,39 +22,39 @@ namespace blender::compositor { SplitOperation::SplitOperation() { - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); image1Input_ = nullptr; image2Input_ = nullptr; } -void SplitOperation::initExecution() +void SplitOperation::init_execution() { /* When initializing the tree during initial load the width and height can be zero. */ - image1Input_ = getInputSocketReader(0); - image2Input_ = getInputSocketReader(1); + image1Input_ = get_input_socket_reader(0); + image2Input_ = get_input_socket_reader(1); } -void SplitOperation::deinitExecution() +void SplitOperation::deinit_execution() { image1Input_ = nullptr; image2Input_ = nullptr; } -void SplitOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler /*sampler*/) +void SplitOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler /*sampler*/) { - int perc = xSplit_ ? splitPercentage_ * this->getWidth() / 100.0f : - splitPercentage_ * this->getHeight() / 100.0f; - bool image1 = xSplit_ ? x > perc : y > perc; + int perc = x_split_ ? split_percentage_ * this->get_width() / 100.0f : + split_percentage_ * this->get_height() / 100.0f; + bool image1 = x_split_ ? x > perc : y > perc; if (image1) { - image1Input_->readSampled(output, x, y, PixelSampler::Nearest); + image1Input_->read_sampled(output, x, y, PixelSampler::Nearest); } else { - image2Input_->readSampled(output, x, y, PixelSampler::Nearest); + image2Input_->read_sampled(output, x, y, PixelSampler::Nearest); } } @@ -62,7 +62,7 @@ void SplitOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) { rcti unused_area; - const bool determined = this->getInputSocket(0)->determine_canvas(COM_AREA_NONE, unused_area); + const bool determined = this->get_input_socket(0)->determine_canvas(COM_AREA_NONE, unused_area); this->set_canvas_input_index(determined ? 0 : 1); NodeOperation::determine_canvas(preferred_area, r_area); @@ -72,11 +72,11 @@ void SplitOperation::update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span<MemoryBuffer *> inputs) { - const int percent = xSplit_ ? splitPercentage_ * this->getWidth() / 100.0f : - splitPercentage_ * this->getHeight() / 100.0f; - const size_t elem_bytes = COM_data_type_bytes_len(getOutputSocket()->getDataType()); + const int percent = x_split_ ? split_percentage_ * this->get_width() / 100.0f : + split_percentage_ * this->get_height() / 100.0f; + const size_t elem_bytes = COM_data_type_bytes_len(get_output_socket()->get_data_type()); for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) { - const bool is_image1 = xSplit_ ? it.x > percent : it.y > percent; + const bool is_image1 = x_split_ ? it.x > percent : it.y > percent; memcpy(it.out, it.in(is_image1 ? 0 : 1), elem_bytes); } } diff --git a/source/blender/compositor/operations/COM_SplitOperation.h b/source/blender/compositor/operations/COM_SplitOperation.h index 9f594793be5..2d2b2e89cca 100644 --- a/source/blender/compositor/operations/COM_SplitOperation.h +++ b/source/blender/compositor/operations/COM_SplitOperation.h @@ -27,22 +27,22 @@ class SplitOperation : public MultiThreadedOperation { SocketReader *image1Input_; SocketReader *image2Input_; - float splitPercentage_; - bool xSplit_; + float split_percentage_; + bool x_split_; public: SplitOperation(); - void initExecution() override; - void deinitExecution() override; - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void init_execution() override; + void deinit_execution() override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void determine_canvas(const rcti &preferred_area, rcti &r_area) override; - void setSplitPercentage(float splitPercentage) + void set_split_percentage(float split_percentage) { - splitPercentage_ = splitPercentage; + split_percentage_ = split_percentage; } - void setXSplit(bool xsplit) + void set_xsplit(bool xsplit) { - xSplit_ = xsplit; + x_split_ = xsplit; } void update_memory_buffer_partial(MemoryBuffer *output, diff --git a/source/blender/compositor/operations/COM_SunBeamsOperation.cc b/source/blender/compositor/operations/COM_SunBeamsOperation.cc index b055d0a7644..5842fcc2278 100644 --- a/source/blender/compositor/operations/COM_SunBeamsOperation.cc +++ b/source/blender/compositor/operations/COM_SunBeamsOperation.cc @@ -23,8 +23,8 @@ namespace blender::compositor { SunBeamsOperation::SunBeamsOperation() { - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); this->set_canvas_input_index(0); this->flags.complex = true; @@ -33,12 +33,12 @@ SunBeamsOperation::SunBeamsOperation() void SunBeamsOperation::calc_rays_common_data() { /* convert to pixels */ - source_px_[0] = data_.source[0] * this->getWidth(); - source_px_[1] = data_.source[1] * this->getHeight(); - ray_length_px_ = data_.ray_length * MAX2(this->getWidth(), this->getHeight()); + source_px_[0] = data_.source[0] * this->get_width(); + source_px_[1] = data_.source[1] * this->get_height(); + ray_length_px_ = data_.ray_length * MAX2(this->get_width(), this->get_height()); } -void SunBeamsOperation::initExecution() +void SunBeamsOperation::init_execution() { calc_rays_common_data(); } @@ -145,7 +145,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() + input->get_coords_offset(x, y); + float *iter = input->get_buffer() + input->get_coords_offset(x, y); return iter; } @@ -312,13 +312,13 @@ static void accumulate_line(MemoryBuffer *input, } } -void *SunBeamsOperation::initializeTileData(rcti * /*rect*/) +void *SunBeamsOperation::initialize_tile_data(rcti * /*rect*/) { - void *buffer = getInputOperation(0)->initializeTileData(nullptr); + void *buffer = get_input_operation(0)->initialize_tile_data(nullptr); return buffer; } -void SunBeamsOperation::executePixel(float output[4], int x, int y, void *data) +void SunBeamsOperation::execute_pixel(float output[4], int x, int y, void *data) { const float co[2] = {(float)x, (float)y}; @@ -340,9 +340,9 @@ static void calc_ray_shift(rcti *rect, float x, float y, const float source[2], BLI_rcti_do_minmax_v(rect, ico); } -bool SunBeamsOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool SunBeamsOperation::determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) { /* Enlarges the rect by moving each corner toward the source. * This is the maximum distance that pixels can influence each other @@ -354,7 +354,7 @@ bool SunBeamsOperation::determineDependingAreaOfInterest(rcti *input, calc_ray_shift(&rect, input->xmax, input->ymin, source_px_, ray_length_px_); calc_ray_shift(&rect, input->xmax, input->ymax, source_px_, ray_length_px_); - return NodeOperation::determineDependingAreaOfInterest(&rect, readOperation, output); + return NodeOperation::determine_depending_area_of_interest(&rect, read_operation, output); } void SunBeamsOperation::get_area_of_interest(const int input_idx, diff --git a/source/blender/compositor/operations/COM_SunBeamsOperation.h b/source/blender/compositor/operations/COM_SunBeamsOperation.h index 2a62be065a4..c40d540996e 100644 --- a/source/blender/compositor/operations/COM_SunBeamsOperation.h +++ b/source/blender/compositor/operations/COM_SunBeamsOperation.h @@ -25,17 +25,17 @@ class SunBeamsOperation : public MultiThreadedOperation { public: SunBeamsOperation(); - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; - void initExecution() override; + void init_execution() override; - void *initializeTileData(rcti *rect) override; + void *initialize_tile_data(rcti *rect) override; - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; - void setData(const NodeSunBeams &data) + void set_data(const NodeSunBeams &data) { data_ = data; } diff --git a/source/blender/compositor/operations/COM_TextureOperation.cc b/source/blender/compositor/operations/COM_TextureOperation.cc index 7c18b8214de..da1c90cd1c5 100644 --- a/source/blender/compositor/operations/COM_TextureOperation.cc +++ b/source/blender/compositor/operations/COM_TextureOperation.cc @@ -26,46 +26,46 @@ namespace blender::compositor { TextureBaseOperation::TextureBaseOperation() { - this->addInputSocket(DataType::Vector); // offset - this->addInputSocket(DataType::Vector); // size + this->add_input_socket(DataType::Vector); // offset + this->add_input_socket(DataType::Vector); // size texture_ = nullptr; - inputSize_ = nullptr; - inputOffset_ = nullptr; + input_size_ = nullptr; + input_offset_ = nullptr; rd_ = nullptr; pool_ = nullptr; - sceneColorManage_ = false; + scene_color_manage_ = false; flags.complex = true; } TextureOperation::TextureOperation() : TextureBaseOperation() { - this->addOutputSocket(DataType::Color); + this->add_output_socket(DataType::Color); } TextureAlphaOperation::TextureAlphaOperation() : TextureBaseOperation() { - this->addOutputSocket(DataType::Value); + this->add_output_socket(DataType::Value); } -void TextureBaseOperation::initExecution() +void TextureBaseOperation::init_execution() { - inputOffset_ = getInputSocketReader(0); - inputSize_ = getInputSocketReader(1); + input_offset_ = get_input_socket_reader(0); + input_size_ = get_input_socket_reader(1); pool_ = BKE_image_pool_new(); if (texture_ != nullptr && texture_->nodetree != nullptr && texture_->use_nodes) { ntreeTexBeginExecTree(texture_->nodetree); } - NodeOperation::initExecution(); + NodeOperation::init_execution(); } -void TextureBaseOperation::deinitExecution() +void TextureBaseOperation::deinit_execution() { - inputSize_ = nullptr; - inputOffset_ = nullptr; + input_size_ = nullptr; + input_offset_ = nullptr; BKE_image_pool_free(pool_); pool_ = nullptr; if (texture_ != nullptr && texture_->use_nodes && texture_->nodetree != nullptr && texture_->nodetree->execdata != nullptr) { ntreeTexEndExecTree(texture_->nodetree->execdata); } - NodeOperation::deinitExecution(); + NodeOperation::deinit_execution(); } void TextureBaseOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) @@ -85,30 +85,30 @@ void TextureBaseOperation::determine_canvas(const rcti &preferred_area, rcti &r_ } } -void TextureAlphaOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void TextureAlphaOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { float color[4]; - TextureBaseOperation::executePixelSampled(color, x, y, sampler); + TextureBaseOperation::execute_pixel_sampled(color, x, y, sampler); output[0] = color[3]; } -void TextureBaseOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void TextureBaseOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { TexResult texres = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, nullptr}; - float textureSize[4]; - float textureOffset[4]; + float texture_size[4]; + float texture_offset[4]; float vec[3]; int retval; - const float cx = this->getWidth() / 2; - const float cy = this->getHeight() / 2; - float u = (x - cx) / this->getWidth() * 2; - float v = (y - cy) / this->getHeight() * 2; + const float cx = this->get_width() / 2; + const float cy = this->get_height() / 2; + float u = (x - cx) / this->get_width() * 2; + float v = (y - cy) / this->get_height() * 2; /* When no interpolation/filtering happens in multitex() force nearest interpolation. * We do it here because (a) we can't easily say multitex() that we want nearest @@ -120,16 +120,16 @@ void TextureBaseOperation::executePixelSampled(float output[4], v += 0.5f / cy; } - inputSize_->readSampled(textureSize, x, y, sampler); - inputOffset_->readSampled(textureOffset, x, y, sampler); + input_size_->read_sampled(texture_size, x, y, sampler); + input_offset_->read_sampled(texture_offset, x, y, sampler); - vec[0] = textureSize[0] * (u + textureOffset[0]); - vec[1] = textureSize[1] * (v + textureOffset[1]); - vec[2] = textureSize[2] * textureOffset[2]; + vec[0] = texture_size[0] * (u + texture_offset[0]); + vec[1] = texture_size[1] * (v + texture_offset[1]); + vec[2] = texture_size[2] * texture_offset[2]; const int thread_id = WorkScheduler::current_thread_id(); retval = multitex_ext( - texture_, vec, nullptr, nullptr, 0, &texres, thread_id, pool_, sceneColorManage_, false); + texture_, vec, nullptr, nullptr, 0, &texres, thread_id, pool_, scene_color_manage_, false); output[3] = texres.talpha ? texres.ta : texres.tin; if (retval & TEX_RGB) { @@ -146,8 +146,8 @@ void TextureBaseOperation::update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span<MemoryBuffer *> inputs) { - const int op_width = this->getWidth(); - const int op_height = this->getHeight(); + const int op_width = this->get_width(); + const int op_height = this->get_height(); const float center_x = op_width / 2; const float center_y = op_height / 2; TexResult tex_result = {0}; @@ -181,7 +181,7 @@ void TextureBaseOperation::update_memory_buffer_partial(MemoryBuffer *output, &tex_result, thread_id, pool_, - sceneColorManage_, + scene_color_manage_, false); it.out[3] = tex_result.talpha ? tex_result.ta : tex_result.tin; diff --git a/source/blender/compositor/operations/COM_TextureOperation.h b/source/blender/compositor/operations/COM_TextureOperation.h index 3916f82c77b..bf1bb1affb8 100644 --- a/source/blender/compositor/operations/COM_TextureOperation.h +++ b/source/blender/compositor/operations/COM_TextureOperation.h @@ -37,10 +37,10 @@ class TextureBaseOperation : public MultiThreadedOperation { private: Tex *texture_; const RenderData *rd_; - SocketReader *inputSize_; - SocketReader *inputOffset_; + SocketReader *input_size_; + SocketReader *input_offset_; struct ImagePool *pool_; - bool sceneColorManage_; + bool scene_color_manage_; protected: /** @@ -54,21 +54,21 @@ class TextureBaseOperation : public MultiThreadedOperation { TextureBaseOperation(); public: - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; - void setTexture(Tex *texture) + void set_texture(Tex *texture) { texture_ = texture; } - void initExecution() override; - void deinitExecution() override; - void setRenderData(const RenderData *rd) + void init_execution() override; + void deinit_execution() override; + void set_render_data(const RenderData *rd) { rd_ = rd; } - void setSceneColorManage(bool sceneColorManage) + void set_scene_color_manage(bool scene_color_manage) { - sceneColorManage_ = sceneColorManage; + scene_color_manage_ = scene_color_manage; } void update_memory_buffer_partial(MemoryBuffer *output, @@ -83,7 +83,7 @@ class TextureOperation : public TextureBaseOperation { class TextureAlphaOperation : public TextureBaseOperation { public: TextureAlphaOperation(); - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, diff --git a/source/blender/compositor/operations/COM_TonemapOperation.cc b/source/blender/compositor/operations/COM_TonemapOperation.cc index b9d67ec8be3..6d3fc9380c1 100644 --- a/source/blender/compositor/operations/COM_TonemapOperation.cc +++ b/source/blender/compositor/operations/COM_TonemapOperation.cc @@ -26,24 +26,24 @@ namespace blender::compositor { TonemapOperation::TonemapOperation() { - this->addInputSocket(DataType::Color, ResizeMode::Align); - this->addOutputSocket(DataType::Color); - imageReader_ = nullptr; + this->add_input_socket(DataType::Color, ResizeMode::Align); + this->add_output_socket(DataType::Color); + image_reader_ = nullptr; data_ = nullptr; - cachedInstance_ = nullptr; + cached_instance_ = nullptr; this->flags.complex = true; } -void TonemapOperation::initExecution() +void TonemapOperation::init_execution() { - imageReader_ = this->getInputSocketReader(0); - NodeOperation::initMutex(); + image_reader_ = this->get_input_socket_reader(0); + NodeOperation::init_mutex(); } -void TonemapOperation::executePixel(float output[4], int x, int y, void *data) +void TonemapOperation::execute_pixel(float output[4], int x, int y, void *data) { AvgLogLum *avg = (AvgLogLum *)data; - imageReader_->read(output, x, y, nullptr); + image_reader_->read(output, x, y, nullptr); mul_v3_fl(output, avg->al); float dr = output[0] + data_->offset; float dg = output[1] + data_->offset; @@ -58,7 +58,7 @@ void TonemapOperation::executePixel(float output[4], int x, int y, void *data) output[2] = powf(MAX2(output[2], 0.0f), igm); } } -void PhotoreceptorTonemapOperation::executePixel(float output[4], int x, int y, void *data) +void PhotoreceptorTonemapOperation::execute_pixel(float output[4], int x, int y, void *data) { AvgLogLum *avg = (AvgLogLum *)data; NodeTonemap *ntm = data_; @@ -67,7 +67,7 @@ void PhotoreceptorTonemapOperation::executePixel(float output[4], int x, int y, const float m = (ntm->m > 0.0f) ? ntm->m : (0.3f + 0.7f * powf(avg->auto_key, 1.4f)); const float ic = 1.0f - ntm->c, ia = 1.0f - ntm->a; - imageReader_->read(output, x, y, nullptr); + image_reader_->read(output, x, y, nullptr); const float L = IMB_colormanagement_get_luminance(output); float I_l = output[0] + ic * (L - output[0]); @@ -84,41 +84,41 @@ void PhotoreceptorTonemapOperation::executePixel(float output[4], int x, int y, output[2] /= (output[2] + powf(f * I_a, m)); } -void TonemapOperation::deinitExecution() +void TonemapOperation::deinit_execution() { - imageReader_ = nullptr; - delete cachedInstance_; - NodeOperation::deinitMutex(); + image_reader_ = nullptr; + delete cached_instance_; + NodeOperation::deinit_mutex(); } -bool TonemapOperation::determineDependingAreaOfInterest(rcti * /*input*/, - ReadBufferOperation *readOperation, - rcti *output) +bool TonemapOperation::determine_depending_area_of_interest(rcti * /*input*/, + ReadBufferOperation *read_operation, + rcti *output) { - rcti imageInput; + rcti image_input; - NodeOperation *operation = getInputOperation(0); - imageInput.xmax = operation->getWidth(); - imageInput.xmin = 0; - imageInput.ymax = operation->getHeight(); - imageInput.ymin = 0; - if (operation->determineDependingAreaOfInterest(&imageInput, readOperation, output)) { + NodeOperation *operation = get_input_operation(0); + image_input.xmax = operation->get_width(); + image_input.xmin = 0; + image_input.ymax = operation->get_height(); + image_input.ymin = 0; + if (operation->determine_depending_area_of_interest(&image_input, read_operation, output)) { return true; } return false; } -void *TonemapOperation::initializeTileData(rcti *rect) +void *TonemapOperation::initialize_tile_data(rcti *rect) { - lockMutex(); - if (cachedInstance_ == nullptr) { - MemoryBuffer *tile = (MemoryBuffer *)imageReader_->initializeTileData(rect); + lock_mutex(); + if (cached_instance_ == nullptr) { + MemoryBuffer *tile = (MemoryBuffer *)image_reader_->initialize_tile_data(rect); AvgLogLum *data = new AvgLogLum(); - float *buffer = tile->getBuffer(); + float *buffer = tile->get_buffer(); float lsum = 0.0f; - int p = tile->getWidth() * tile->getHeight(); + int p = tile->get_width() * tile->get_height(); float *bc = buffer; float avl, maxl = -1e10f, minl = 1e10f; const float sc = 1.0f / p; @@ -142,13 +142,13 @@ void *TonemapOperation::initializeTileData(rcti *rect) float al = exp((double)avl); data->al = (al == 0.0f) ? 0.0f : (data_->key / al); data->igm = (data_->gamma == 0.0f) ? 1 : (1.0f / data_->gamma); - cachedInstance_ = data; + cached_instance_ = data; } - unlockMutex(); - return cachedInstance_; + unlock_mutex(); + return cached_instance_; } -void TonemapOperation::deinitializeTileData(rcti * /*rect*/, void * /*data*/) +void TonemapOperation::deinitialize_tile_data(rcti * /*rect*/, void * /*data*/) { /* pass */ } @@ -189,7 +189,7 @@ void TonemapOperation::update_memory_buffer_started(MemoryBuffer *UNUSED(output) const rcti &UNUSED(area), Span<MemoryBuffer *> inputs) { - if (cachedInstance_ == nullptr) { + if (cached_instance_ == nullptr) { Luminance lum = {0}; const MemoryBuffer *input = inputs[0]; exec_system_->execute_work<Luminance>( @@ -215,7 +215,7 @@ void TonemapOperation::update_memory_buffer_started(MemoryBuffer *UNUSED(output) const float al = exp((double)avg_log); avg->al = (al == 0.0f) ? 0.0f : (data_->key / al); avg->igm = (data_->gamma == 0.0f) ? 1 : (1.0f / data_->gamma); - cachedInstance_ = avg; + cached_instance_ = avg; } } @@ -223,7 +223,7 @@ void TonemapOperation::update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span<MemoryBuffer *> inputs) { - AvgLogLum *avg = cachedInstance_; + AvgLogLum *avg = cached_instance_; const float igm = avg->igm; const float offset = data_->offset; for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) { @@ -247,7 +247,7 @@ void PhotoreceptorTonemapOperation::update_memory_buffer_partial(MemoryBuffer *o const rcti &area, Span<MemoryBuffer *> inputs) { - AvgLogLum *avg = cachedInstance_; + AvgLogLum *avg = cached_instance_; NodeTonemap *ntm = data_; const float f = expf(-data_->f); const float m = (ntm->m > 0.0f) ? ntm->m : (0.3f + 0.7f * powf(avg->auto_key, 1.4f)); diff --git a/source/blender/compositor/operations/COM_TonemapOperation.h b/source/blender/compositor/operations/COM_TonemapOperation.h index c04ee4fcbe9..a20c061965e 100644 --- a/source/blender/compositor/operations/COM_TonemapOperation.h +++ b/source/blender/compositor/operations/COM_TonemapOperation.h @@ -44,7 +44,7 @@ class TonemapOperation : public MultiThreadedOperation { /** * \brief Cached reference to the reader */ - SocketReader *imageReader_; + SocketReader *image_reader_; /** * \brief settings of the Tonemap @@ -54,7 +54,7 @@ class TonemapOperation : public MultiThreadedOperation { /** * \brief temporarily cache of the execution storage */ - AvgLogLum *cachedInstance_; + AvgLogLum *cached_instance_; public: TonemapOperation(); @@ -62,29 +62,29 @@ class TonemapOperation : public MultiThreadedOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; - void *initializeTileData(rcti *rect) override; - void deinitializeTileData(rcti *rect, void *data) override; + void *initialize_tile_data(rcti *rect) override; + void deinitialize_tile_data(rcti *rect, void *data) override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void setData(NodeTonemap *data) + void set_data(NodeTonemap *data) { data_ = data; } - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; void update_memory_buffer_started(MemoryBuffer *output, @@ -106,7 +106,7 @@ class PhotoreceptorTonemapOperation : public TonemapOperation { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, diff --git a/source/blender/compositor/operations/COM_TrackPositionOperation.cc b/source/blender/compositor/operations/COM_TrackPositionOperation.cc index d9e55011d16..f329bfb0656 100644 --- a/source/blender/compositor/operations/COM_TrackPositionOperation.cc +++ b/source/blender/compositor/operations/COM_TrackPositionOperation.cc @@ -26,20 +26,20 @@ namespace blender::compositor { TrackPositionOperation::TrackPositionOperation() { - this->addOutputSocket(DataType::Value); - movieClip_ = nullptr; + this->add_output_socket(DataType::Value); + movie_clip_ = nullptr; framenumber_ = 0; - trackingObjectName_[0] = 0; - trackName_[0] = 0; + tracking_object_name_[0] = 0; + track_name_[0] = 0; axis_ = 0; position_ = CMP_TRACKPOS_ABSOLUTE; - relativeFrame_ = 0; + relative_frame_ = 0; speed_output_ = false; flags.is_set_operation = true; is_track_position_calculated_ = false; } -void TrackPositionOperation::initExecution() +void TrackPositionOperation::init_execution() { if (!is_track_position_calculated_) { calc_track_position(); @@ -54,45 +54,45 @@ void TrackPositionOperation::calc_track_position() MovieTrackingObject *object; track_position_ = 0; - zero_v2(markerPos_); - zero_v2(relativePos_); + zero_v2(marker_pos_); + zero_v2(relative_pos_); - if (!movieClip_) { + if (!movie_clip_) { return; } - tracking = &movieClip_->tracking; + tracking = &movie_clip_->tracking; BKE_movieclip_user_set_frame(&user, framenumber_); - BKE_movieclip_get_size(movieClip_, &user, &width_, &height_); + BKE_movieclip_get_size(movie_clip_, &user, &width_, &height_); - object = BKE_tracking_object_get_named(tracking, trackingObjectName_); + object = BKE_tracking_object_get_named(tracking, tracking_object_name_); if (object) { MovieTrackingTrack *track; - track = BKE_tracking_track_get_named(tracking, object, trackName_); + track = BKE_tracking_track_get_named(tracking, object, track_name_); if (track) { MovieTrackingMarker *marker; - int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(movieClip_, framenumber_); + int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(movie_clip_, framenumber_); marker = BKE_tracking_marker_get(track, clip_framenr); - copy_v2_v2(markerPos_, marker->pos); + copy_v2_v2(marker_pos_, marker->pos); if (speed_output_) { - int relative_clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(movieClip_, - relativeFrame_); + int relative_clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(movie_clip_, + relative_frame_); marker = BKE_tracking_marker_get_exact(track, relative_clip_framenr); if (marker != nullptr && (marker->flag & MARKER_DISABLED) == 0) { - copy_v2_v2(relativePos_, marker->pos); + copy_v2_v2(relative_pos_, marker->pos); } else { - copy_v2_v2(relativePos_, markerPos_); + copy_v2_v2(relative_pos_, marker_pos_); } - if (relativeFrame_ < framenumber_) { - swap_v2_v2(relativePos_, markerPos_); + if (relative_frame_ < framenumber_) { + swap_v2_v2(relative_pos_, marker_pos_); } } else if (position_ == CMP_TRACKPOS_RELATIVE_START) { @@ -102,23 +102,23 @@ void TrackPositionOperation::calc_track_position() marker = &track->markers[i]; if ((marker->flag & MARKER_DISABLED) == 0) { - copy_v2_v2(relativePos_, marker->pos); + copy_v2_v2(relative_pos_, marker->pos); break; } } } else if (position_ == CMP_TRACKPOS_RELATIVE_FRAME) { - int relative_clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(movieClip_, - relativeFrame_); + int relative_clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(movie_clip_, + relative_frame_); marker = BKE_tracking_marker_get(track, relative_clip_framenr); - copy_v2_v2(relativePos_, marker->pos); + copy_v2_v2(relative_pos_, marker->pos); } } } - track_position_ = markerPos_[axis_] - relativePos_[axis_]; + track_position_ = marker_pos_[axis_] - relative_pos_[axis_]; if (axis_ == 0) { track_position_ *= width_; } @@ -127,12 +127,12 @@ void TrackPositionOperation::calc_track_position() } } -void TrackPositionOperation::executePixelSampled(float output[4], - float /*x*/, - float /*y*/, - PixelSampler /*sampler*/) +void TrackPositionOperation::execute_pixel_sampled(float output[4], + float /*x*/, + float /*y*/, + PixelSampler /*sampler*/) { - output[0] = markerPos_[axis_] - relativePos_[axis_]; + output[0] = marker_pos_[axis_] - relative_pos_[axis_]; if (axis_ == 0) { output[0] *= width_; diff --git a/source/blender/compositor/operations/COM_TrackPositionOperation.h b/source/blender/compositor/operations/COM_TrackPositionOperation.h index 25e5a144228..1de8b72f783 100644 --- a/source/blender/compositor/operations/COM_TrackPositionOperation.h +++ b/source/blender/compositor/operations/COM_TrackPositionOperation.h @@ -35,18 +35,18 @@ namespace blender::compositor { */ class TrackPositionOperation : public ConstantOperation { protected: - MovieClip *movieClip_; + MovieClip *movie_clip_; int framenumber_; - char trackingObjectName_[64]; - char trackName_[64]; + char tracking_object_name_[64]; + char track_name_[64]; int axis_; int position_; - int relativeFrame_; + int relative_frame_; bool speed_output_; int width_, height_; - float markerPos_[2]; - float relativePos_[2]; + float marker_pos_[2]; + float relative_pos_[2]; float track_position_; bool is_track_position_calculated_; @@ -58,42 +58,42 @@ class TrackPositionOperation : public ConstantOperation { public: TrackPositionOperation(); - void setMovieClip(MovieClip *clip) + void set_movie_clip(MovieClip *clip) { - movieClip_ = clip; + movie_clip_ = clip; } - void setTrackingObject(char *object) + void set_tracking_object(char *object) { - BLI_strncpy(trackingObjectName_, object, sizeof(trackingObjectName_)); + BLI_strncpy(tracking_object_name_, object, sizeof(tracking_object_name_)); } - void setTrackName(char *track) + void set_track_name(char *track) { - BLI_strncpy(trackName_, track, sizeof(trackName_)); + BLI_strncpy(track_name_, track, sizeof(track_name_)); } - void setFramenumber(int framenumber) + void set_framenumber(int framenumber) { framenumber_ = framenumber; } - void setAxis(int value) + void set_axis(int value) { axis_ = value; } - void setPosition(int value) + void set_position(int value) { position_ = value; } - void setRelativeFrame(int value) + void set_relative_frame(int value) { - relativeFrame_ = value; + relative_frame_ = value; } - void setSpeedOutput(bool speed_output) + void set_speed_output(bool speed_output) { speed_output_ = speed_output; } - void initExecution() override; + void init_execution() override; - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; const float *get_constant_elem() override; diff --git a/source/blender/compositor/operations/COM_TransformOperation.cc b/source/blender/compositor/operations/COM_TransformOperation.cc index 38bb443bdea..be9bb32e7f0 100644 --- a/source/blender/compositor/operations/COM_TransformOperation.cc +++ b/source/blender/compositor/operations/COM_TransformOperation.cc @@ -24,12 +24,12 @@ namespace blender::compositor { TransformOperation::TransformOperation() { - addInputSocket(DataType::Color, ResizeMode::None); - addInputSocket(DataType::Value, ResizeMode::None); - addInputSocket(DataType::Value, ResizeMode::None); - addInputSocket(DataType::Value, ResizeMode::None); - addInputSocket(DataType::Value, ResizeMode::None); - addOutputSocket(DataType::Color); + add_input_socket(DataType::Color, ResizeMode::None); + add_input_socket(DataType::Value, ResizeMode::None); + add_input_socket(DataType::Value, ResizeMode::None); + add_input_socket(DataType::Value, ResizeMode::None); + add_input_socket(DataType::Value, ResizeMode::None); + add_output_socket(DataType::Color); translate_factor_x_ = 1.0f; translate_factor_y_ = 1.0f; convert_degree_to_rad_ = false; @@ -123,14 +123,14 @@ void TransformOperation::update_memory_buffer_partial(MemoryBuffer *output, void TransformOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) { const bool image_determined = - getInputSocket(IMAGE_INPUT_INDEX)->determine_canvas(preferred_area, r_area); + get_input_socket(IMAGE_INPUT_INDEX)->determine_canvas(preferred_area, r_area); if (image_determined) { rcti image_canvas = r_area; rcti unused; - getInputSocket(X_INPUT_INDEX)->determine_canvas(image_canvas, unused); - getInputSocket(Y_INPUT_INDEX)->determine_canvas(image_canvas, unused); - getInputSocket(DEGREE_INPUT_INDEX)->determine_canvas(image_canvas, unused); - getInputSocket(SCALE_INPUT_INDEX)->determine_canvas(image_canvas, unused); + get_input_socket(X_INPUT_INDEX)->determine_canvas(image_canvas, unused); + get_input_socket(Y_INPUT_INDEX)->determine_canvas(image_canvas, unused); + get_input_socket(DEGREE_INPUT_INDEX)->determine_canvas(image_canvas, unused); + get_input_socket(SCALE_INPUT_INDEX)->determine_canvas(image_canvas, unused); init_data(); if (invert_) { diff --git a/source/blender/compositor/operations/COM_TranslateOperation.cc b/source/blender/compositor/operations/COM_TranslateOperation.cc index 1ec5029385e..89c7468a67c 100644 --- a/source/blender/compositor/operations/COM_TranslateOperation.cc +++ b/source/blender/compositor/operations/COM_TranslateOperation.cc @@ -25,68 +25,68 @@ TranslateOperation::TranslateOperation() : TranslateOperation(DataType::Color) } TranslateOperation::TranslateOperation(DataType data_type, ResizeMode resize_mode) { - this->addInputSocket(data_type, resize_mode); - this->addInputSocket(DataType::Value, ResizeMode::None); - this->addInputSocket(DataType::Value, ResizeMode::None); - this->addOutputSocket(data_type); + this->add_input_socket(data_type, resize_mode); + this->add_input_socket(DataType::Value, ResizeMode::None); + this->add_input_socket(DataType::Value, ResizeMode::None); + this->add_output_socket(data_type); this->set_canvas_input_index(0); - inputOperation_ = nullptr; - inputXOperation_ = nullptr; - inputYOperation_ = nullptr; - isDeltaSet_ = false; - factorX_ = 1.0f; - factorY_ = 1.0f; + input_operation_ = nullptr; + input_xoperation_ = nullptr; + input_yoperation_ = nullptr; + is_delta_set_ = false; + factor_x_ = 1.0f; + factor_y_ = 1.0f; this->x_extend_mode_ = MemoryBufferExtend::Clip; this->y_extend_mode_ = MemoryBufferExtend::Clip; } -void TranslateOperation::initExecution() +void TranslateOperation::init_execution() { - inputOperation_ = this->getInputSocketReader(0); - inputXOperation_ = this->getInputSocketReader(1); - inputYOperation_ = this->getInputSocketReader(2); + input_operation_ = this->get_input_socket_reader(0); + input_xoperation_ = this->get_input_socket_reader(1); + input_yoperation_ = this->get_input_socket_reader(2); } -void TranslateOperation::deinitExecution() +void TranslateOperation::deinit_execution() { - inputOperation_ = nullptr; - inputXOperation_ = nullptr; - inputYOperation_ = nullptr; + input_operation_ = nullptr; + input_xoperation_ = nullptr; + input_yoperation_ = nullptr; } -void TranslateOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler /*sampler*/) +void TranslateOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler /*sampler*/) { - ensureDelta(); + ensure_delta(); - float originalXPos = x - this->getDeltaX(); - float originalYPos = y - this->getDeltaY(); + float original_xpos = x - this->getDeltaX(); + float original_ypos = y - this->getDeltaY(); - inputOperation_->readSampled(output, originalXPos, originalYPos, PixelSampler::Bilinear); + input_operation_->read_sampled(output, original_xpos, original_ypos, PixelSampler::Bilinear); } -bool TranslateOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool TranslateOperation::determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) { - rcti newInput; + rcti new_input; - ensureDelta(); + ensure_delta(); - newInput.xmin = input->xmin - this->getDeltaX(); - newInput.xmax = input->xmax - this->getDeltaX(); - newInput.ymin = input->ymin - this->getDeltaY(); - newInput.ymax = input->ymax - this->getDeltaY(); + new_input.xmin = input->xmin - this->getDeltaX(); + new_input.xmax = input->xmax - this->getDeltaX(); + new_input.ymin = input->ymin - this->getDeltaY(); + new_input.ymax = input->ymax - this->getDeltaY(); - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } void TranslateOperation::setFactorXY(float factorX, float factorY) { - factorX_ = factorX; - factorY_ = factorY; + factor_x_ = factorX; + factor_y_ = factorY; } void TranslateOperation::set_wrapping(int wrapping_type) @@ -112,7 +112,7 @@ void TranslateOperation::get_area_of_interest(const int input_idx, rcti &r_input_area) { if (input_idx == 0) { - ensureDelta(); + ensure_delta(); r_input_area = output_area; if (x_extend_mode_ == MemoryBufferExtend::Clip) { const int delta_x = this->getDeltaX(); @@ -154,15 +154,15 @@ TranslateCanvasOperation::TranslateCanvasOperation() void TranslateCanvasOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) { const bool determined = - getInputSocket(IMAGE_INPUT_INDEX)->determine_canvas(preferred_area, r_area); + get_input_socket(IMAGE_INPUT_INDEX)->determine_canvas(preferred_area, r_area); if (determined) { - NodeOperationInput *x_socket = getInputSocket(X_INPUT_INDEX); - NodeOperationInput *y_socket = getInputSocket(Y_INPUT_INDEX); + NodeOperationInput *x_socket = get_input_socket(X_INPUT_INDEX); + NodeOperationInput *y_socket = get_input_socket(Y_INPUT_INDEX); rcti unused; x_socket->determine_canvas(r_area, unused); y_socket->determine_canvas(r_area, unused); - ensureDelta(); + ensure_delta(); const float delta_x = x_extend_mode_ == MemoryBufferExtend::Clip ? getDeltaX() : 0.0f; const float delta_y = y_extend_mode_ == MemoryBufferExtend::Clip ? getDeltaY() : 0.0f; BLI_rcti_translate(&r_area, delta_x, delta_y); diff --git a/source/blender/compositor/operations/COM_TranslateOperation.h b/source/blender/compositor/operations/COM_TranslateOperation.h index 25251ff1d9e..30e489bf395 100644 --- a/source/blender/compositor/operations/COM_TranslateOperation.h +++ b/source/blender/compositor/operations/COM_TranslateOperation.h @@ -30,14 +30,14 @@ class TranslateOperation : public MultiThreadedOperation { static constexpr int Y_INPUT_INDEX = 2; private: - SocketReader *inputOperation_; - SocketReader *inputXOperation_; - SocketReader *inputYOperation_; - float deltaX_; - float deltaY_; - bool isDeltaSet_; - float factorX_; - float factorY_; + SocketReader *input_operation_; + SocketReader *input_xoperation_; + SocketReader *input_yoperation_; + float delta_x_; + float delta_y_; + bool is_delta_set_; + float factor_x_; + float factor_y_; protected: MemoryBufferExtend x_extend_mode_; @@ -46,39 +46,39 @@ class TranslateOperation : public MultiThreadedOperation { public: TranslateOperation(); TranslateOperation(DataType data_type, ResizeMode mode = ResizeMode::Center); - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; float getDeltaX() { - return deltaX_ * factorX_; + return delta_x_ * factor_x_; } float getDeltaY() { - return deltaY_ * factorY_; + return delta_y_ * factor_y_; } - inline void ensureDelta() + inline void ensure_delta() { - if (!isDeltaSet_) { + if (!is_delta_set_) { if (execution_model_ == eExecutionModel::Tiled) { - float tempDelta[4]; - inputXOperation_->readSampled(tempDelta, 0, 0, PixelSampler::Nearest); - deltaX_ = tempDelta[0]; - inputYOperation_->readSampled(tempDelta, 0, 0, PixelSampler::Nearest); - deltaY_ = tempDelta[0]; + float temp_delta[4]; + input_xoperation_->read_sampled(temp_delta, 0, 0, PixelSampler::Nearest); + delta_x_ = temp_delta[0]; + input_yoperation_->read_sampled(temp_delta, 0, 0, PixelSampler::Nearest); + delta_y_ = temp_delta[0]; } else { - deltaX_ = get_input_operation(X_INPUT_INDEX)->get_constant_value_default(0.0f); - deltaY_ = get_input_operation(Y_INPUT_INDEX)->get_constant_value_default(0.0f); + delta_x_ = get_input_operation(X_INPUT_INDEX)->get_constant_value_default(0.0f); + delta_y_ = get_input_operation(Y_INPUT_INDEX)->get_constant_value_default(0.0f); } - isDeltaSet_ = true; + is_delta_set_ = true; } } diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc index a0013ae1061..07baf370d1d 100644 --- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc +++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cc @@ -23,127 +23,128 @@ namespace blender::compositor { VariableSizeBokehBlurOperation::VariableSizeBokehBlurOperation() { - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Color, ResizeMode::Align); /* Do not resize the bokeh image. */ - this->addInputSocket(DataType::Value); /* Radius. */ + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Color, ResizeMode::Align); /* Do not resize the bokeh image. */ + this->add_input_socket(DataType::Value); /* Radius. */ #ifdef COM_DEFOCUS_SEARCH /* Inverse search radius optimization structure. */ - this->addInputSocket(DataType::Color, ResizeMode::None); + this->add_input_socket(DataType::Color, ResizeMode::None); #endif - this->addOutputSocket(DataType::Color); + this->add_output_socket(DataType::Color); flags.complex = true; flags.open_cl = true; - inputProgram_ = nullptr; - inputBokehProgram_ = nullptr; - inputSizeProgram_ = nullptr; - maxBlur_ = 32.0f; + input_program_ = nullptr; + input_bokeh_program_ = nullptr; + input_size_program_ = nullptr; + max_blur_ = 32.0f; threshold_ = 1.0f; do_size_scale_ = false; #ifdef COM_DEFOCUS_SEARCH - inputSearchProgram_ = nullptr; + input_search_program_ = nullptr; #endif } -void VariableSizeBokehBlurOperation::initExecution() +void VariableSizeBokehBlurOperation::init_execution() { - inputProgram_ = getInputSocketReader(0); - inputBokehProgram_ = getInputSocketReader(1); - inputSizeProgram_ = getInputSocketReader(2); + input_program_ = get_input_socket_reader(0); + input_bokeh_program_ = get_input_socket_reader(1); + input_size_program_ = get_input_socket_reader(2); #ifdef COM_DEFOCUS_SEARCH - inputSearchProgram_ = getInputSocketReader(3); + input_search_program_ = get_input_socket_reader(3); #endif - QualityStepHelper::initExecution(COM_QH_INCREASE); + QualityStepHelper::init_execution(COM_QH_INCREASE); } struct VariableSizeBokehBlurTileData { MemoryBuffer *color; MemoryBuffer *bokeh; MemoryBuffer *size; - int maxBlurScalar; + int max_blur_scalar; }; -void *VariableSizeBokehBlurOperation::initializeTileData(rcti *rect) +void *VariableSizeBokehBlurOperation::initialize_tile_data(rcti *rect) { VariableSizeBokehBlurTileData *data = new VariableSizeBokehBlurTileData(); - data->color = (MemoryBuffer *)inputProgram_->initializeTileData(rect); - data->bokeh = (MemoryBuffer *)inputBokehProgram_->initializeTileData(rect); - data->size = (MemoryBuffer *)inputSizeProgram_->initializeTileData(rect); + data->color = (MemoryBuffer *)input_program_->initialize_tile_data(rect); + data->bokeh = (MemoryBuffer *)input_bokeh_program_->initialize_tile_data(rect); + data->size = (MemoryBuffer *)input_size_program_->initialize_tile_data(rect); rcti rect2; - this->determineDependingAreaOfInterest(rect, (ReadBufferOperation *)inputSizeProgram_, &rect2); + this->determine_depending_area_of_interest( + rect, (ReadBufferOperation *)input_size_program_, &rect2); - const float max_dim = MAX2(this->getWidth(), this->getHeight()); + const float max_dim = MAX2(this->get_width(), this->get_height()); const float scalar = do_size_scale_ ? (max_dim / 100.0f) : 1.0f; - data->maxBlurScalar = (int)(data->size->get_max_value(rect2) * scalar); - CLAMP(data->maxBlurScalar, 1.0f, maxBlur_); + data->max_blur_scalar = (int)(data->size->get_max_value(rect2) * scalar); + CLAMP(data->max_blur_scalar, 1.0f, max_blur_); return data; } -void VariableSizeBokehBlurOperation::deinitializeTileData(rcti * /*rect*/, void *data) +void VariableSizeBokehBlurOperation::deinitialize_tile_data(rcti * /*rect*/, void *data) { VariableSizeBokehBlurTileData *result = (VariableSizeBokehBlurTileData *)data; delete result; } -void VariableSizeBokehBlurOperation::executePixel(float output[4], int x, int y, void *data) +void VariableSizeBokehBlurOperation::execute_pixel(float output[4], int x, int y, void *data) { - VariableSizeBokehBlurTileData *tileData = (VariableSizeBokehBlurTileData *)data; - MemoryBuffer *inputProgramBuffer = tileData->color; - MemoryBuffer *inputBokehBuffer = tileData->bokeh; - MemoryBuffer *inputSizeBuffer = tileData->size; - float *inputSizeFloatBuffer = inputSizeBuffer->getBuffer(); - float *inputProgramFloatBuffer = inputProgramBuffer->getBuffer(); - float readColor[4]; + VariableSizeBokehBlurTileData *tile_data = (VariableSizeBokehBlurTileData *)data; + MemoryBuffer *input_program_buffer = tile_data->color; + MemoryBuffer *input_bokeh_buffer = tile_data->bokeh; + MemoryBuffer *input_size_buffer = tile_data->size; + float *input_size_float_buffer = input_size_buffer->get_buffer(); + float *input_program_float_buffer = input_program_buffer->get_buffer(); + float read_color[4]; float bokeh[4]; - float tempSize[4]; + float temp_size[4]; float multiplier_accum[4]; float color_accum[4]; - const float max_dim = MAX2(getWidth(), getHeight()); + const float max_dim = MAX2(get_width(), get_height()); const float scalar = do_size_scale_ ? (max_dim / 100.0f) : 1.0f; - int maxBlurScalar = tileData->maxBlurScalar; + int max_blur_scalar = tile_data->max_blur_scalar; - BLI_assert(inputBokehBuffer->getWidth() == COM_BLUR_BOKEH_PIXELS); - BLI_assert(inputBokehBuffer->getHeight() == COM_BLUR_BOKEH_PIXELS); + BLI_assert(input_bokeh_buffer->get_width() == COM_BLUR_BOKEH_PIXELS); + BLI_assert(input_bokeh_buffer->get_height() == COM_BLUR_BOKEH_PIXELS); #ifdef COM_DEFOCUS_SEARCH float search[4]; - inputSearchProgram_->read(search, - x / InverseSearchRadiusOperation::DIVIDER, - y / InverseSearchRadiusOperation::DIVIDER, - nullptr); + input_search_program_->read(search, + x / InverseSearchRadiusOperation::DIVIDER, + y / InverseSearchRadiusOperation::DIVIDER, + nullptr); int minx = search[0]; int miny = search[1]; int maxx = search[2]; int maxy = search[3]; #else - int minx = MAX2(x - maxBlurScalar, 0); - int miny = MAX2(y - maxBlurScalar, 0); - int maxx = MIN2(x + maxBlurScalar, (int)getWidth()); - int maxy = MIN2(y + maxBlurScalar, (int)getHeight()); + int minx = MAX2(x - max_blur_scalar, 0); + int miny = MAX2(y - max_blur_scalar, 0); + int maxx = MIN2(x + max_blur_scalar, (int)get_width()); + int maxy = MIN2(y + max_blur_scalar, (int)get_height()); #endif { - inputSizeBuffer->readNoCheck(tempSize, x, y); - inputProgramBuffer->readNoCheck(readColor, x, y); + input_size_buffer->read_no_check(temp_size, x, y); + input_program_buffer->read_no_check(read_color, x, y); - copy_v4_v4(color_accum, readColor); + copy_v4_v4(color_accum, read_color); copy_v4_fl(multiplier_accum, 1.0f); - float size_center = tempSize[0] * scalar; + float size_center = temp_size[0] * scalar; - const int addXStepValue = QualityStepHelper::getStep(); - const int addYStepValue = addXStepValue; - const int addXStepColor = addXStepValue * COM_DATA_TYPE_COLOR_CHANNELS; + const int add_xstep_value = QualityStepHelper::get_step(); + const int add_ystep_value = add_xstep_value; + const int add_xstep_color = add_xstep_value * COM_DATA_TYPE_COLOR_CHANNELS; if (size_center > threshold_) { - for (int ny = miny; ny < maxy; ny += addYStepValue) { + for (int ny = miny; ny < maxy; ny += add_ystep_value) { float dy = ny - y; - int offsetValueNy = ny * inputSizeBuffer->getWidth(); - int offsetValueNxNy = offsetValueNy + (minx); - int offsetColorNxNy = offsetValueNxNy * COM_DATA_TYPE_COLOR_CHANNELS; - for (int nx = minx; nx < maxx; nx += addXStepValue) { + int offset_value_ny = ny * input_size_buffer->get_width(); + int offset_value_nx_ny = offset_value_ny + (minx); + int offset_color_nx_ny = offset_value_nx_ny * COM_DATA_TYPE_COLOR_CHANNELS; + for (int nx = minx; nx < maxx; nx += add_xstep_value) { if (nx != x || ny != y) { - float size = MIN2(inputSizeFloatBuffer[offsetValueNxNy] * scalar, size_center); + float size = MIN2(input_size_float_buffer[offset_value_nx_ny] * scalar, size_center); if (size > threshold_) { float dx = nx - x; if (size > fabsf(dx) && size > fabsf(dy)) { @@ -153,14 +154,14 @@ void VariableSizeBokehBlurOperation::executePixel(float output[4], int x, int y, (float)(COM_BLUR_BOKEH_PIXELS / 2) + (dy / size) * (float)((COM_BLUR_BOKEH_PIXELS / 2) - 1), }; - inputBokehBuffer->read(bokeh, uv[0], uv[1]); - madd_v4_v4v4(color_accum, bokeh, &inputProgramFloatBuffer[offsetColorNxNy]); + input_bokeh_buffer->read(bokeh, uv[0], uv[1]); + madd_v4_v4v4(color_accum, bokeh, &input_program_float_buffer[offset_color_nx_ny]); add_v4_v4(multiplier_accum, bokeh); } } } - offsetColorNxNy += addXStepColor; - offsetValueNxNy += addXStepValue; + offset_color_nx_ny += add_xstep_color; + offset_value_nx_ny += add_xstep_value; } } } @@ -174,98 +175,102 @@ void VariableSizeBokehBlurOperation::executePixel(float output[4], int x, int y, if ((size_center > threshold_) && (size_center < threshold_ * 2.0f)) { /* factor from 0-1 */ float fac = (size_center - threshold_) / threshold_; - interp_v4_v4v4(output, readColor, output, fac); + interp_v4_v4v4(output, read_color, output, fac); } } } -void VariableSizeBokehBlurOperation::executeOpenCL(OpenCLDevice *device, - MemoryBuffer *outputMemoryBuffer, - cl_mem clOutputBuffer, - MemoryBuffer **inputMemoryBuffers, - std::list<cl_mem> *clMemToCleanUp, - std::list<cl_kernel> * /*clKernelsToCleanUp*/) +void VariableSizeBokehBlurOperation::execute_opencl( + OpenCLDevice *device, + MemoryBuffer *output_memory_buffer, + cl_mem cl_output_buffer, + MemoryBuffer **input_memory_buffers, + std::list<cl_mem> *cl_mem_to_clean_up, + std::list<cl_kernel> * /*cl_kernels_to_clean_up*/) { - cl_kernel defocusKernel = device->COM_clCreateKernel("defocusKernel", nullptr); + cl_kernel defocus_kernel = device->COM_cl_create_kernel("defocus_kernel", nullptr); - cl_int step = this->getStep(); - cl_int maxBlur; + cl_int step = this->get_step(); + cl_int max_blur; cl_float threshold = threshold_; - MemoryBuffer *sizeMemoryBuffer = inputSizeProgram_->getInputMemoryBuffer(inputMemoryBuffers); + MemoryBuffer *size_memory_buffer = input_size_program_->get_input_memory_buffer( + input_memory_buffers); - const float max_dim = MAX2(getWidth(), getHeight()); + const float max_dim = MAX2(get_width(), get_height()); cl_float scalar = do_size_scale_ ? (max_dim / 100.0f) : 1.0f; - maxBlur = (cl_int)min_ff(sizeMemoryBuffer->get_max_value() * scalar, (float)maxBlur_); - - device->COM_clAttachMemoryBufferToKernelParameter( - defocusKernel, 0, -1, clMemToCleanUp, inputMemoryBuffers, inputProgram_); - device->COM_clAttachMemoryBufferToKernelParameter( - defocusKernel, 1, -1, clMemToCleanUp, inputMemoryBuffers, inputBokehProgram_); - device->COM_clAttachMemoryBufferToKernelParameter( - defocusKernel, 2, 4, clMemToCleanUp, inputMemoryBuffers, inputSizeProgram_); - device->COM_clAttachOutputMemoryBufferToKernelParameter(defocusKernel, 3, clOutputBuffer); - device->COM_clAttachMemoryBufferOffsetToKernelParameter(defocusKernel, 5, outputMemoryBuffer); - clSetKernelArg(defocusKernel, 6, sizeof(cl_int), &step); - clSetKernelArg(defocusKernel, 7, sizeof(cl_int), &maxBlur); - clSetKernelArg(defocusKernel, 8, sizeof(cl_float), &threshold); - clSetKernelArg(defocusKernel, 9, sizeof(cl_float), &scalar); - device->COM_clAttachSizeToKernelParameter(defocusKernel, 10, this); - - device->COM_clEnqueueRange(defocusKernel, outputMemoryBuffer, 11, this); + max_blur = (cl_int)min_ff(size_memory_buffer->get_max_value() * scalar, (float)max_blur_); + + device->COM_cl_attach_memory_buffer_to_kernel_parameter( + defocus_kernel, 0, -1, cl_mem_to_clean_up, input_memory_buffers, input_program_); + device->COM_cl_attach_memory_buffer_to_kernel_parameter( + defocus_kernel, 1, -1, cl_mem_to_clean_up, input_memory_buffers, input_bokeh_program_); + device->COM_cl_attach_memory_buffer_to_kernel_parameter( + defocus_kernel, 2, 4, cl_mem_to_clean_up, input_memory_buffers, input_size_program_); + device->COM_cl_attach_output_memory_buffer_to_kernel_parameter( + defocus_kernel, 3, cl_output_buffer); + device->COM_cl_attach_memory_buffer_offset_to_kernel_parameter( + defocus_kernel, 5, output_memory_buffer); + clSetKernelArg(defocus_kernel, 6, sizeof(cl_int), &step); + clSetKernelArg(defocus_kernel, 7, sizeof(cl_int), &max_blur); + clSetKernelArg(defocus_kernel, 8, sizeof(cl_float), &threshold); + clSetKernelArg(defocus_kernel, 9, sizeof(cl_float), &scalar); + device->COM_cl_attach_size_to_kernel_parameter(defocus_kernel, 10, this); + + device->COM_cl_enqueue_range(defocus_kernel, output_memory_buffer, 11, this); } -void VariableSizeBokehBlurOperation::deinitExecution() +void VariableSizeBokehBlurOperation::deinit_execution() { - inputProgram_ = nullptr; - inputBokehProgram_ = nullptr; - inputSizeProgram_ = nullptr; + input_program_ = nullptr; + input_bokeh_program_ = nullptr; + input_size_program_ = nullptr; #ifdef COM_DEFOCUS_SEARCH - inputSearchProgram_ = nullptr; + input_search_program_ = nullptr; #endif } -bool VariableSizeBokehBlurOperation::determineDependingAreaOfInterest( - rcti *input, ReadBufferOperation *readOperation, rcti *output) +bool VariableSizeBokehBlurOperation::determine_depending_area_of_interest( + rcti *input, ReadBufferOperation *read_operation, rcti *output) { - rcti newInput; - rcti bokehInput; + rcti new_input; + rcti bokeh_input; - const float max_dim = MAX2(getWidth(), getHeight()); + const float max_dim = MAX2(get_width(), get_height()); const float scalar = do_size_scale_ ? (max_dim / 100.0f) : 1.0f; - int maxBlurScalar = maxBlur_ * scalar; - - newInput.xmax = input->xmax + maxBlurScalar + 2; - newInput.xmin = input->xmin - maxBlurScalar + 2; - newInput.ymax = input->ymax + maxBlurScalar - 2; - newInput.ymin = input->ymin - maxBlurScalar - 2; - bokehInput.xmax = COM_BLUR_BOKEH_PIXELS; - bokehInput.xmin = 0; - bokehInput.ymax = COM_BLUR_BOKEH_PIXELS; - bokehInput.ymin = 0; - - NodeOperation *operation = getInputOperation(2); - if (operation->determineDependingAreaOfInterest(&newInput, readOperation, output)) { + int max_blur_scalar = max_blur_ * scalar; + + new_input.xmax = input->xmax + max_blur_scalar + 2; + new_input.xmin = input->xmin - max_blur_scalar + 2; + new_input.ymax = input->ymax + max_blur_scalar - 2; + new_input.ymin = input->ymin - max_blur_scalar - 2; + bokeh_input.xmax = COM_BLUR_BOKEH_PIXELS; + bokeh_input.xmin = 0; + bokeh_input.ymax = COM_BLUR_BOKEH_PIXELS; + bokeh_input.ymin = 0; + + NodeOperation *operation = get_input_operation(2); + if (operation->determine_depending_area_of_interest(&new_input, read_operation, output)) { return true; } - operation = getInputOperation(1); - if (operation->determineDependingAreaOfInterest(&bokehInput, readOperation, output)) { + operation = get_input_operation(1); + if (operation->determine_depending_area_of_interest(&bokeh_input, read_operation, output)) { return true; } #ifdef COM_DEFOCUS_SEARCH - rcti searchInput; - searchInput.xmax = (input->xmax / InverseSearchRadiusOperation::DIVIDER) + 1; - searchInput.xmin = (input->xmin / InverseSearchRadiusOperation::DIVIDER) - 1; - searchInput.ymax = (input->ymax / InverseSearchRadiusOperation::DIVIDER) + 1; - searchInput.ymin = (input->ymin / InverseSearchRadiusOperation::DIVIDER) - 1; - operation = getInputOperation(3); - if (operation->determineDependingAreaOfInterest(&searchInput, readOperation, output)) { + rcti search_input; + search_input.xmax = (input->xmax / InverseSearchRadiusOperation::DIVIDER) + 1; + search_input.xmin = (input->xmin / InverseSearchRadiusOperation::DIVIDER) - 1; + search_input.ymax = (input->ymax / InverseSearchRadiusOperation::DIVIDER) + 1; + search_input.ymin = (input->ymin / InverseSearchRadiusOperation::DIVIDER) - 1; + operation = get_input_operation(3); + if (operation->determine_depending_area_of_interest(&search_input, read_operation, output)) { return true; } #endif - operation = getInputOperation(0); - if (operation->determineDependingAreaOfInterest(&newInput, readOperation, output)) { + operation = get_input_operation(0); + if (operation->determine_depending_area_of_interest(&new_input, read_operation, output)) { return true; } return false; @@ -278,9 +283,9 @@ void VariableSizeBokehBlurOperation::get_area_of_interest(const int input_idx, switch (input_idx) { case IMAGE_INPUT_INDEX: case SIZE_INPUT_INDEX: { - const float max_dim = MAX2(getWidth(), getHeight()); + const float max_dim = MAX2(get_width(), get_height()); const float scalar = do_size_scale_ ? (max_dim / 100.0f) : 1.0f; - const int max_blur_scalar = maxBlur_ * scalar; + const int max_blur_scalar = max_blur_ * scalar; r_input_area.xmax = output_area.xmax + max_blur_scalar + 2; r_input_area.xmin = output_area.xmin - max_blur_scalar - 2; r_input_area.ymax = output_area.ymax + max_blur_scalar + 2; @@ -322,8 +327,8 @@ struct PixelData { static void blur_pixel(int x, int y, PixelData &p) { - BLI_assert(p.bokeh_input->getWidth() == COM_BLUR_BOKEH_PIXELS); - BLI_assert(p.bokeh_input->getHeight() == COM_BLUR_BOKEH_PIXELS); + BLI_assert(p.bokeh_input->get_width() == COM_BLUR_BOKEH_PIXELS); + BLI_assert(p.bokeh_input->get_height() == COM_BLUR_BOKEH_PIXELS); #ifdef COM_DEFOCUS_SEARCH float search[4]; @@ -388,20 +393,20 @@ void VariableSizeBokehBlurOperation::update_memory_buffer_partial(MemoryBuffer * p.bokeh_input = inputs[BOKEH_INPUT_INDEX]; p.size_input = inputs[SIZE_INPUT_INDEX]; p.image_input = inputs[IMAGE_INPUT_INDEX]; - p.step = QualityStepHelper::getStep(); + p.step = QualityStepHelper::get_step(); p.threshold = threshold_; - p.image_width = this->getWidth(); - p.image_height = this->getHeight(); + p.image_width = this->get_width(); + p.image_height = this->get_height(); rcti scalar_area; this->get_area_of_interest(SIZE_INPUT_INDEX, area, scalar_area); BLI_rcti_isect(&scalar_area, &p.size_input->get_rect(), &scalar_area); const float max_size = p.size_input->get_max_value(scalar_area); - const float max_dim = MAX2(this->getWidth(), this->getHeight()); + const float max_dim = MAX2(this->get_width(), this->get_height()); p.scalar = do_size_scale_ ? (max_dim / 100.0f) : 1.0f; p.max_blur_scalar = static_cast<int>(max_size * p.scalar); - CLAMP(p.max_blur_scalar, 1, maxBlur_); + CLAMP(p.max_blur_scalar, 1, max_blur_); for (BuffersIterator<float> it = output->iterate_with({p.image_input, p.size_input}, area); !it.is_end(); @@ -434,34 +439,34 @@ void VariableSizeBokehBlurOperation::update_memory_buffer_partial(MemoryBuffer * /* #InverseSearchRadiusOperation. */ InverseSearchRadiusOperation::InverseSearchRadiusOperation() { - this->addInputSocket(DataType::Value, ResizeMode::Align); /* Radius. */ - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Value, ResizeMode::Align); /* Radius. */ + this->add_output_socket(DataType::Color); this->flags.complex = true; - inputRadius_ = nullptr; + input_radius_ = nullptr; } -void InverseSearchRadiusOperation::initExecution() +void InverseSearchRadiusOperation::init_execution() { - inputRadius_ = this->getInputSocketReader(0); + input_radius_ = this->get_input_socket_reader(0); } -void *InverseSearchRadiusOperation::initializeTileData(rcti *rect) +void *InverseSearchRadiusOperation::initialize_tile_data(rcti *rect) { MemoryBuffer *data = new MemoryBuffer(DataType::Color, rect); - float *buffer = data->getBuffer(); + float *buffer = data->get_buffer(); int x, y; - int width = inputRadius_->getWidth(); - int height = inputRadius_->getHeight(); + int width = input_radius_->get_width(); + int height = input_radius_->get_height(); float temp[4]; int offset = 0; for (y = rect->ymin; y < rect->ymax; y++) { for (x = rect->xmin; x < rect->xmax; x++) { int rx = x * DIVIDER; int ry = y * DIVIDER; - buffer[offset] = MAX2(rx - maxBlur_, 0); - buffer[offset + 1] = MAX2(ry - maxBlur_, 0); - buffer[offset + 2] = MIN2(rx + DIVIDER + maxBlur_, width); - buffer[offset + 3] = MIN2(ry + DIVIDER + maxBlur_, height); + buffer[offset] = MAX2(rx - max_blur_, 0); + buffer[offset + 1] = MAX2(ry - max_blur_, 0); + buffer[offset + 2] = MIN2(rx + DIVIDER + max_blur_, width); + buffer[offset + 3] = MIN2(ry + DIVIDER + max_blur_, height); offset += 4; } } @@ -476,7 +481,7 @@ void *InverseSearchRadiusOperation::initializeTileData(rcti *rect) for (int x2 = 0; x2 < DIVIDER; x2++) { for (int y2 = 0; y2 < DIVIDER; y2++) { - inputRadius_->read(temp, rx + x2, ry + y2, PixelSampler::Nearest); + input_radius_->read(temp, rx + x2, ry + y2, PixelSampler::Nearest); if (radius < temp[0]) { radius = temp[0]; maxx = x2; @@ -484,15 +489,15 @@ void *InverseSearchRadiusOperation::initializeTileData(rcti *rect) } } } - int impactRadius = ceil(radius / DIVIDER); - for (int x2 = x - impactRadius; x2 < x + impactRadius; x2++) { - for (int y2 = y - impactRadius; y2 < y + impactRadius; y2++) { + int impact_radius = ceil(radius / DIVIDER); + for (int x2 = x - impact_radius; x2 < x + impact_radius; x2++) { + for (int y2 = y - impact_radius; y2 < y + impact_radius; y2++) { data->read(temp, x2, y2); temp[0] = MIN2(temp[0], maxx); temp[1] = MIN2(temp[1], maxy); temp[2] = MAX2(temp[2], maxx); temp[3] = MAX2(temp[3], maxy); - data->writePixel(x2, y2, temp); + data->write_pixel(x2, y2, temp); } } } @@ -501,13 +506,13 @@ void *InverseSearchRadiusOperation::initializeTileData(rcti *rect) return data; } -void InverseSearchRadiusOperation::executePixelChunk(float output[4], int x, int y, void *data) +void InverseSearchRadiusOperation::execute_pixel_chunk(float output[4], int x, int y, void *data) { MemoryBuffer *buffer = (MemoryBuffer *)data; - buffer->readNoCheck(output, x, y); + buffer->read_no_check(output, x, y); } -void InverseSearchRadiusOperation::deinitializeTileData(rcti *rect, void *data) +void InverseSearchRadiusOperation::deinitialize_tile_data(rcti *rect, void *data) { if (data) { MemoryBuffer *mb = (MemoryBuffer *)data; @@ -515,28 +520,28 @@ void InverseSearchRadiusOperation::deinitializeTileData(rcti *rect, void *data) } } -void InverseSearchRadiusOperation::deinitExecution() +void InverseSearchRadiusOperation::deinit_execution() { - inputRadius_ = nullptr; + input_radius_ = nullptr; } -void InverseSearchRadiusOperation::determineResolution(unsigned int resolution[2], - unsigned int preferredResolution[2]) +void InverseSearchRadiusOperation::determine_resolution(unsigned int resolution[2], + unsigned int preferred_resolution[2]) { - NodeOperation::determineResolution(resolution, preferredResolution); + NodeOperation::determine_resolution(resolution, preferred_resolution); resolution[0] = resolution[0] / DIVIDER; resolution[1] = resolution[1] / DIVIDER; } -bool InverseSearchRadiusOperation::determineDependingAreaOfInterest( - rcti *input, ReadBufferOperation *readOperation, rcti *output) +bool InverseSearchRadiusOperation::determine_depending_area_of_interest( + rcti *input, ReadBufferOperation *read_operation, rcti *output) { - rcti newRect; - newRect.ymin = input->ymin * DIVIDER - maxBlur_; - newRect.ymax = input->ymax * DIVIDER + maxBlur_; - newRect.xmin = input->xmin * DIVIDER - maxBlur_; - newRect.xmax = input->xmax * DIVIDER + maxBlur_; - return NodeOperation::determineDependingAreaOfInterest(&newRect, readOperation, output); + rcti new_rect; + new_rect.ymin = input->ymin * DIVIDER - max_blur_; + new_rect.ymax = input->ymax * DIVIDER + max_blur_; + new_rect.xmin = input->xmin * DIVIDER - max_blur_; + new_rect.xmax = input->xmax * DIVIDER + max_blur_; + return NodeOperation::determine_depending_area_of_interest(&new_rect, read_operation, output); } #endif diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h index c32d10ae3b9..7e53ed8a979 100644 --- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h +++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h @@ -34,14 +34,14 @@ class VariableSizeBokehBlurOperation : public MultiThreadedOperation, public Qua static constexpr int DEFOCUS_INPUT_INDEX = 3; #endif - int maxBlur_; + int max_blur_; float threshold_; bool do_size_scale_; /* scale size, matching 'BokehBlurNode' */ - SocketReader *inputProgram_; - SocketReader *inputBokehProgram_; - SocketReader *inputSizeProgram_; + SocketReader *input_program_; + SocketReader *input_bokeh_program_; + SocketReader *input_size_program_; #ifdef COM_DEFOCUS_SEARCH - SocketReader *inputSearchProgram_; + SocketReader *input_search_program_; #endif public: @@ -50,47 +50,47 @@ class VariableSizeBokehBlurOperation : public MultiThreadedOperation, public Qua /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; - void *initializeTileData(rcti *rect) override; + void *initialize_tile_data(rcti *rect) override; - void deinitializeTileData(rcti *rect, void *data) override; + void deinitialize_tile_data(rcti *rect, void *data) override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; - void setMaxBlur(int maxRadius) + void set_max_blur(int max_radius) { - maxBlur_ = maxRadius; + max_blur_ = max_radius; } - void setThreshold(float threshold) + void set_threshold(float threshold) { threshold_ = threshold; } - void setDoScaleSize(bool scale_size) + void set_do_scale_size(bool scale_size) { do_size_scale_ = scale_size; } - void executeOpenCL(OpenCLDevice *device, - MemoryBuffer *outputMemoryBuffer, - cl_mem clOutputBuffer, - MemoryBuffer **inputMemoryBuffers, - std::list<cl_mem> *clMemToCleanUp, - std::list<cl_kernel> *clKernelsToCleanUp) override; + void execute_opencl(OpenCLDevice *device, + MemoryBuffer *output_memory_buffer, + cl_mem cl_output_buffer, + MemoryBuffer **input_memory_buffers, + std::list<cl_mem> *cl_mem_to_clean_up, + std::list<cl_kernel> *cl_kernels_to_clean_up) override; void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; void update_memory_buffer_partial(MemoryBuffer *output, @@ -102,8 +102,8 @@ class VariableSizeBokehBlurOperation : public MultiThreadedOperation, public Qua #ifdef COM_DEFOCUS_SEARCH class InverseSearchRadiusOperation : public NodeOperation { private: - int maxBlur_; - SocketReader *inputRadius_; + int max_blur_; + SocketReader *input_radius_; public: static const int DIVIDER = 4; @@ -113,28 +113,28 @@ class InverseSearchRadiusOperation : public NodeOperation { /** * The inner loop of this operation. */ - void executePixelChunk(float output[4], int x, int y, void *data); + void execute_pixel_chunk(float output[4], int x, int y, void *data); /** * Initialize the execution */ - void initExecution() override; - void *initializeTileData(rcti *rect) override; - void deinitializeTileData(rcti *rect, void *data) override; + void init_execution() override; + void *initialize_tile_data(rcti *rect) override; + void deinitialize_tile_data(rcti *rect, void *data) override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; void determine_canvas(const rcti &preferred_area, rcti &r_area) override; - void setMaxBlur(int maxRadius) + void set_max_blur(int max_radius) { - maxBlur_ = maxRadius; + max_blur_ = max_radius; } }; #endif diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.cc b/source/blender/compositor/operations/COM_VectorBlurOperation.cc index 6ebd8e27d76..8fd074749cd 100644 --- a/source/blender/compositor/operations/COM_VectorBlurOperation.cc +++ b/source/blender/compositor/operations/COM_VectorBlurOperation.cc @@ -42,76 +42,76 @@ void antialias_tagbuf(int xsize, int ysize, char *rectmove); /* VectorBlurOperation */ VectorBlurOperation::VectorBlurOperation() { - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Value); /* ZBUF */ - this->addInputSocket(DataType::Color); /* SPEED */ - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Value); /* ZBUF */ + this->add_input_socket(DataType::Color); /* SPEED */ + this->add_output_socket(DataType::Color); settings_ = nullptr; - cachedInstance_ = nullptr; - inputImageProgram_ = nullptr; - inputSpeedProgram_ = nullptr; - inputZProgram_ = nullptr; + cached_instance_ = nullptr; + input_image_program_ = nullptr; + input_speed_program_ = nullptr; + input_zprogram_ = nullptr; flags.complex = true; flags.is_fullframe_operation = true; } -void VectorBlurOperation::initExecution() +void VectorBlurOperation::init_execution() { - initMutex(); - inputImageProgram_ = getInputSocketReader(0); - inputZProgram_ = getInputSocketReader(1); - inputSpeedProgram_ = getInputSocketReader(2); - cachedInstance_ = nullptr; - QualityStepHelper::initExecution(COM_QH_INCREASE); + init_mutex(); + input_image_program_ = get_input_socket_reader(0); + input_zprogram_ = get_input_socket_reader(1); + input_speed_program_ = get_input_socket_reader(2); + cached_instance_ = nullptr; + QualityStepHelper::init_execution(COM_QH_INCREASE); } -void VectorBlurOperation::executePixel(float output[4], int x, int y, void *data) +void VectorBlurOperation::execute_pixel(float output[4], int x, int y, void *data) { float *buffer = (float *)data; - int index = (y * this->getWidth() + x) * COM_DATA_TYPE_COLOR_CHANNELS; + int index = (y * this->get_width() + x) * COM_DATA_TYPE_COLOR_CHANNELS; copy_v4_v4(output, &buffer[index]); } -void VectorBlurOperation::deinitExecution() +void VectorBlurOperation::deinit_execution() { - deinitMutex(); - inputImageProgram_ = nullptr; - inputSpeedProgram_ = nullptr; - inputZProgram_ = nullptr; - if (cachedInstance_) { - MEM_freeN(cachedInstance_); - cachedInstance_ = nullptr; + deinit_mutex(); + input_image_program_ = nullptr; + input_speed_program_ = nullptr; + input_zprogram_ = nullptr; + if (cached_instance_) { + MEM_freeN(cached_instance_); + cached_instance_ = nullptr; } } -void *VectorBlurOperation::initializeTileData(rcti *rect) +void *VectorBlurOperation::initialize_tile_data(rcti *rect) { - if (cachedInstance_) { - return cachedInstance_; + if (cached_instance_) { + return cached_instance_; } - lockMutex(); - if (cachedInstance_ == nullptr) { - MemoryBuffer *tile = (MemoryBuffer *)inputImageProgram_->initializeTileData(rect); - MemoryBuffer *speed = (MemoryBuffer *)inputSpeedProgram_->initializeTileData(rect); - MemoryBuffer *z = (MemoryBuffer *)inputZProgram_->initializeTileData(rect); - float *data = (float *)MEM_dupallocN(tile->getBuffer()); - this->generateVectorBlur(data, tile, speed, z); - cachedInstance_ = data; + lock_mutex(); + if (cached_instance_ == nullptr) { + MemoryBuffer *tile = (MemoryBuffer *)input_image_program_->initialize_tile_data(rect); + MemoryBuffer *speed = (MemoryBuffer *)input_speed_program_->initialize_tile_data(rect); + MemoryBuffer *z = (MemoryBuffer *)input_zprogram_->initialize_tile_data(rect); + float *data = (float *)MEM_dupallocN(tile->get_buffer()); + this->generate_vector_blur(data, tile, speed, z); + cached_instance_ = data; } - unlockMutex(); - return cachedInstance_; + unlock_mutex(); + return cached_instance_; } -bool VectorBlurOperation::determineDependingAreaOfInterest(rcti * /*input*/, - ReadBufferOperation *readOperation, - rcti *output) +bool VectorBlurOperation::determine_depending_area_of_interest(rcti * /*input*/, + ReadBufferOperation *read_operation, + rcti *output) { - if (cachedInstance_ == nullptr) { - rcti newInput; - newInput.xmax = this->getWidth(); - newInput.xmin = 0; - newInput.ymax = this->getHeight(); - newInput.ymin = 0; - return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + if (cached_instance_ == nullptr) { + rcti new_input; + new_input.xmax = this->get_width(); + new_input.xmin = 0; + new_input.ymax = this->get_height(); + new_input.ymin = 0; + return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output); } return false; @@ -129,12 +129,12 @@ void VectorBlurOperation::update_memory_buffer(MemoryBuffer *output, Span<MemoryBuffer *> inputs) { /* TODO(manzanilla): once tiled implementation is removed, run multi-threaded where possible. */ - if (!cachedInstance_) { + if (!cached_instance_) { MemoryBuffer *image = inputs[IMAGE_INPUT_INDEX]; const bool is_image_inflated = image->is_a_single_elem(); image = is_image_inflated ? image->inflate() : image; - /* Must be a copy because it's modified in #generateVectorBlur. */ + /* Must be a copy because it's modified in #generate_vector_blur. */ MemoryBuffer *speed = inputs[SPEED_INPUT_INDEX]; speed = speed->is_a_single_elem() ? speed->inflate() : new MemoryBuffer(*speed); @@ -142,8 +142,8 @@ void VectorBlurOperation::update_memory_buffer(MemoryBuffer *output, const bool is_z_inflated = z->is_a_single_elem(); z = is_z_inflated ? z->inflate() : z; - cachedInstance_ = (float *)MEM_dupallocN(image->getBuffer()); - this->generateVectorBlur(cachedInstance_, image, speed, z); + cached_instance_ = (float *)MEM_dupallocN(image->get_buffer()); + this->generate_vector_blur(cached_instance_, image, speed, z); if (is_image_inflated) { delete image; @@ -154,29 +154,29 @@ void VectorBlurOperation::update_memory_buffer(MemoryBuffer *output, } } - const int num_channels = COM_data_type_num_channels(getOutputSocket()->getDataType()); - MemoryBuffer buf(cachedInstance_, num_channels, this->getWidth(), this->getHeight()); + const int num_channels = COM_data_type_num_channels(get_output_socket()->get_data_type()); + MemoryBuffer buf(cached_instance_, num_channels, this->get_width(), this->get_height()); output->copy_from(&buf, area); } -void VectorBlurOperation::generateVectorBlur(float *data, - MemoryBuffer *inputImage, - MemoryBuffer *inputSpeed, - MemoryBuffer *inputZ) +void VectorBlurOperation::generate_vector_blur(float *data, + MemoryBuffer *input_image, + MemoryBuffer *input_speed, + MemoryBuffer *inputZ) { NodeBlurData blurdata; - blurdata.samples = settings_->samples / QualityStepHelper::getStep(); + blurdata.samples = settings_->samples / QualityStepHelper::get_step(); blurdata.maxspeed = settings_->maxspeed; blurdata.minspeed = settings_->minspeed; blurdata.curved = settings_->curved; blurdata.fac = settings_->fac; zbuf_accumulate_vecblur(&blurdata, - this->getWidth(), - this->getHeight(), + this->get_width(), + this->get_height(), data, - inputImage->getBuffer(), - inputSpeed->getBuffer(), - inputZ->getBuffer()); + input_image->get_buffer(), + input_speed->get_buffer(), + inputZ->get_buffer()); } /* ****************** Spans ******************************* */ diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.h b/source/blender/compositor/operations/COM_VectorBlurOperation.h index cb384283c79..efcb5001fd4 100644 --- a/source/blender/compositor/operations/COM_VectorBlurOperation.h +++ b/source/blender/compositor/operations/COM_VectorBlurOperation.h @@ -31,18 +31,18 @@ class VectorBlurOperation : public NodeOperation, public QualityStepHelper { static constexpr int SPEED_INPUT_INDEX = 2; /** - * \brief Cached reference to the inputProgram + * \brief Cached reference to the input_program */ - SocketReader *inputImageProgram_; - SocketReader *inputSpeedProgram_; - SocketReader *inputZProgram_; + SocketReader *input_image_program_; + SocketReader *input_speed_program_; + SocketReader *input_zprogram_; /** * \brief settings of the glare node. */ NodeBlurData *settings_; - float *cachedInstance_; + float *cached_instance_; public: VectorBlurOperation(); @@ -50,27 +50,27 @@ class VectorBlurOperation : public NodeOperation, public QualityStepHelper { /** * The inner loop of this operation. */ - void executePixel(float output[4], int x, int y, void *data) override; + void execute_pixel(float output[4], int x, int y, void *data) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; - void *initializeTileData(rcti *rect) override; + void *initialize_tile_data(rcti *rect) override; - void setVectorBlurSettings(NodeBlurData *settings) + void set_vector_blur_settings(NodeBlurData *settings) { settings_ = settings; } - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; void get_area_of_interest(const int input_idx, const rcti &output_area, @@ -80,10 +80,10 @@ class VectorBlurOperation : public NodeOperation, public QualityStepHelper { Span<MemoryBuffer *> inputs) override; protected: - void generateVectorBlur(float *data, - MemoryBuffer *inputImage, - MemoryBuffer *inputSpeed, - MemoryBuffer *inputZ); + void generate_vector_blur(float *data, + MemoryBuffer *input_image, + MemoryBuffer *input_speed, + MemoryBuffer *inputZ); }; } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_VectorCurveOperation.cc b/source/blender/compositor/operations/COM_VectorCurveOperation.cc index ade0c5ee788..c7cd8dc5684 100644 --- a/source/blender/compositor/operations/COM_VectorCurveOperation.cc +++ b/source/blender/compositor/operations/COM_VectorCurveOperation.cc @@ -24,40 +24,40 @@ namespace blender::compositor { VectorCurveOperation::VectorCurveOperation() { - this->addInputSocket(DataType::Vector); - this->addOutputSocket(DataType::Vector); + this->add_input_socket(DataType::Vector); + this->add_output_socket(DataType::Vector); - inputProgram_ = nullptr; + input_program_ = nullptr; } -void VectorCurveOperation::initExecution() +void VectorCurveOperation::init_execution() { - CurveBaseOperation::initExecution(); - inputProgram_ = this->getInputSocketReader(0); + CurveBaseOperation::init_execution(); + input_program_ = this->get_input_socket_reader(0); } -void VectorCurveOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void VectorCurveOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { float input[4]; - inputProgram_->readSampled(input, x, y, sampler); + input_program_->read_sampled(input, x, y, sampler); - BKE_curvemapping_evaluate_premulRGBF(curveMapping_, output, input); + BKE_curvemapping_evaluate_premulRGBF(curve_mapping_, output, input); } -void VectorCurveOperation::deinitExecution() +void VectorCurveOperation::deinit_execution() { - CurveBaseOperation::deinitExecution(); - inputProgram_ = nullptr; + CurveBaseOperation::deinit_execution(); + input_program_ = nullptr; } void VectorCurveOperation::update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span<MemoryBuffer *> inputs) { - CurveMapping *curve_map = curveMapping_; + CurveMapping *curve_map = curve_mapping_; for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) { BKE_curvemapping_evaluate_premulRGBF(curve_map, it.out, it.in(0)); } diff --git a/source/blender/compositor/operations/COM_VectorCurveOperation.h b/source/blender/compositor/operations/COM_VectorCurveOperation.h index 0f819628935..87864e08e25 100644 --- a/source/blender/compositor/operations/COM_VectorCurveOperation.h +++ b/source/blender/compositor/operations/COM_VectorCurveOperation.h @@ -26,9 +26,9 @@ namespace blender::compositor { class VectorCurveOperation : public CurveBaseOperation { private: /** - * Cached reference to the inputProgram + * Cached reference to the input_program */ - SocketReader *inputProgram_; + SocketReader *input_program_; public: VectorCurveOperation(); @@ -36,17 +36,17 @@ class VectorCurveOperation : public CurveBaseOperation { /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; /** * Initialize the execution */ - void initExecution() override; + void init_execution() override; /** * Deinitialize the execution */ - void deinitExecution() override; + void deinit_execution() override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cc b/source/blender/compositor/operations/COM_ViewerOperation.cc index 5360b118dee..440deea7796 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.cc +++ b/source/blender/compositor/operations/COM_ViewerOperation.cc @@ -31,54 +31,54 @@ static int MAX_VIEWER_TRANSLATION_PADDING = 12000; ViewerOperation::ViewerOperation() { - this->setImage(nullptr); - this->setImageUser(nullptr); - outputBuffer_ = nullptr; - depthBuffer_ = nullptr; + this->set_image(nullptr); + this->set_image_user(nullptr); + output_buffer_ = nullptr; + depth_buffer_ = nullptr; active_ = false; - doDepthBuffer_ = false; - viewSettings_ = nullptr; - displaySettings_ = nullptr; - useAlphaInput_ = false; - - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Value); - - imageInput_ = nullptr; - alphaInput_ = nullptr; - depthInput_ = nullptr; + do_depth_buffer_ = false; + view_settings_ = nullptr; + display_settings_ = nullptr; + use_alpha_input_ = false; + + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Value); + + image_input_ = nullptr; + alpha_input_ = nullptr; + depth_input_ = nullptr; rd_ = nullptr; - viewName_ = nullptr; + view_name_ = nullptr; flags.use_viewer_border = true; flags.is_viewer_operation = true; } -void ViewerOperation::initExecution() +void ViewerOperation::init_execution() { /* When initializing the tree during initial load the width and height can be zero. */ - imageInput_ = getInputSocketReader(0); - alphaInput_ = getInputSocketReader(1); - depthInput_ = getInputSocketReader(2); - doDepthBuffer_ = (depthInput_ != nullptr); + image_input_ = get_input_socket_reader(0); + alpha_input_ = get_input_socket_reader(1); + depth_input_ = get_input_socket_reader(2); + do_depth_buffer_ = (depth_input_ != nullptr); - if (isActiveViewerOutput() && !exec_system_->is_breaked()) { - initImage(); + if (is_active_viewer_output() && !exec_system_->is_breaked()) { + init_image(); } } -void ViewerOperation::deinitExecution() +void ViewerOperation::deinit_execution() { - imageInput_ = nullptr; - alphaInput_ = nullptr; - depthInput_ = nullptr; - outputBuffer_ = nullptr; + image_input_ = nullptr; + alpha_input_ = nullptr; + depth_input_ = nullptr; + output_buffer_ = nullptr; } -void ViewerOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/) +void ViewerOperation::execute_region(rcti *rect, unsigned int /*tile_number*/) { - float *buffer = outputBuffer_; - float *depthbuffer = depthBuffer_; + float *buffer = output_buffer_; + float *depthbuffer = depth_buffer_; if (!buffer) { return; } @@ -86,9 +86,9 @@ void ViewerOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/) const int y1 = rect->ymin; const int x2 = rect->xmax; const int y2 = rect->ymax; - const int offsetadd = (this->getWidth() - (x2 - x1)); + const int offsetadd = (this->get_width() - (x2 - x1)); const int offsetadd4 = offsetadd * 4; - int offset = (y1 * this->getWidth() + x1); + int offset = (y1 * this->get_width() + x1); int offset4 = offset * 4; float alpha[4], depth[4]; int x; @@ -97,54 +97,54 @@ void ViewerOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/) for (y = y1; y < y2 && (!breaked); y++) { for (x = x1; x < x2; x++) { - imageInput_->readSampled(&(buffer[offset4]), x, y, PixelSampler::Nearest); - if (useAlphaInput_) { - alphaInput_->readSampled(alpha, x, y, PixelSampler::Nearest); + image_input_->read_sampled(&(buffer[offset4]), x, y, PixelSampler::Nearest); + if (use_alpha_input_) { + alpha_input_->read_sampled(alpha, x, y, PixelSampler::Nearest); buffer[offset4 + 3] = alpha[0]; } - depthInput_->readSampled(depth, x, y, PixelSampler::Nearest); + depth_input_->read_sampled(depth, x, y, PixelSampler::Nearest); depthbuffer[offset] = depth[0]; offset++; offset4 += 4; } - if (isBraked()) { + if (is_braked()) { breaked = true; } offset += offsetadd; offset4 += offsetadd4; } - updateImage(rect); + update_image(rect); } void ViewerOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) { - const int sceneRenderWidth = rd_->xsch * rd_->size / 100; - const int sceneRenderHeight = rd_->ysch * rd_->size / 100; + const int scene_render_width = rd_->xsch * rd_->size / 100; + const int scene_render_height = rd_->ysch * rd_->size / 100; rcti local_preferred = preferred_area; - local_preferred.xmax = local_preferred.xmin + sceneRenderWidth; - local_preferred.ymax = local_preferred.ymin + sceneRenderHeight; + local_preferred.xmax = local_preferred.xmin + scene_render_width; + local_preferred.ymax = local_preferred.ymin + scene_render_height; NodeOperation::determine_canvas(local_preferred, r_area); } -void ViewerOperation::initImage() +void ViewerOperation::init_image() { Image *ima = image_; - ImageUser iuser = *imageUser_; + ImageUser iuser = *image_user_; void *lock; ImBuf *ibuf; /* make sure the image has the correct number of views */ - if (ima && BKE_scene_multiview_is_render_view_first(rd_, viewName_)) { - BKE_image_ensure_viewer_views(rd_, ima, imageUser_); + if (ima && BKE_scene_multiview_is_render_view_first(rd_, view_name_)) { + BKE_image_ensure_viewer_views(rd_, ima, image_user_); } BLI_thread_lock(LOCK_DRAW_IMAGE); /* local changes to the original ImageUser */ - iuser.multi_index = BKE_scene_multiview_view_id_get(rd_, viewName_); + iuser.multi_index = BKE_scene_multiview_view_id_get(rd_, view_name_); ibuf = BKE_image_acquire_ibuf(ima, &iuser, &lock); if (!ibuf) { @@ -161,8 +161,8 @@ void ViewerOperation::initImage() padding_y = MAX_VIEWER_TRANSLATION_PADDING; } - display_width_ = getWidth() + padding_x; - display_height_ = getHeight() + padding_y; + display_width_ = get_width() + padding_x; + display_height_ = get_height() + padding_y; if (ibuf->x != display_width_ || ibuf->y != display_height_) { imb_freerectImBuf(ibuf); imb_freerectfloatImBuf(ibuf); @@ -179,18 +179,18 @@ void ViewerOperation::initImage() ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID; } - if (doDepthBuffer_) { + if (do_depth_buffer_) { addzbuffloatImBuf(ibuf); } /* now we combine the input with ibuf */ - outputBuffer_ = ibuf->rect_float; + output_buffer_ = ibuf->rect_float; /* needed for display buffer update */ ibuf_ = ibuf; - if (doDepthBuffer_) { - depthBuffer_ = ibuf->zbuf_float; + if (do_depth_buffer_) { + depth_buffer_ = ibuf->zbuf_float; } BKE_image_release_ibuf(image_, ibuf_, lock); @@ -198,32 +198,32 @@ void ViewerOperation::initImage() BLI_thread_unlock(LOCK_DRAW_IMAGE); } -void ViewerOperation::updateImage(const rcti *rect) +void ViewerOperation::update_image(const rcti *rect) { if (exec_system_->is_breaked()) { return; } - float *buffer = outputBuffer_; + float *buffer = output_buffer_; IMB_partial_display_buffer_update(ibuf_, buffer, nullptr, display_width_, 0, 0, - viewSettings_, - displaySettings_, + view_settings_, + display_settings_, rect->xmin, rect->ymin, rect->xmax, rect->ymax); image_->gpuflag |= IMA_GPU_REFRESH; - this->updateDraw(); + this->update_draw(); } -eCompositorPriority ViewerOperation::getRenderPriority() const +eCompositorPriority ViewerOperation::get_render_priority() const { - if (this->isActiveViewerOutput()) { + if (this->is_active_viewer_output()) { return eCompositorPriority::High; } @@ -234,25 +234,25 @@ void ViewerOperation::update_memory_buffer_partial(MemoryBuffer *UNUSED(output), const rcti &area, Span<MemoryBuffer *> inputs) { - if (!outputBuffer_) { + if (!output_buffer_) { return; } const int offset_x = area.xmin + (canvas_.xmin > 0 ? canvas_.xmin * 2 : 0); const int offset_y = area.ymin + (canvas_.ymin > 0 ? canvas_.ymin * 2 : 0); MemoryBuffer output_buffer( - outputBuffer_, COM_DATA_TYPE_COLOR_CHANNELS, display_width_, display_height_); + output_buffer_, COM_DATA_TYPE_COLOR_CHANNELS, display_width_, display_height_); const MemoryBuffer *input_image = inputs[0]; output_buffer.copy_from(input_image, area, offset_x, offset_y); - if (useAlphaInput_) { + if (use_alpha_input_) { const MemoryBuffer *input_alpha = inputs[1]; output_buffer.copy_from( input_alpha, area, 0, COM_DATA_TYPE_VALUE_CHANNELS, offset_x, offset_y, 3); } - if (depthBuffer_) { + if (depth_buffer_) { MemoryBuffer depth_buffer( - depthBuffer_, COM_DATA_TYPE_VALUE_CHANNELS, display_width_, display_height_); + depth_buffer_, COM_DATA_TYPE_VALUE_CHANNELS, display_width_, display_height_); const MemoryBuffer *input_depth = inputs[2]; depth_buffer.copy_from(input_depth, area, offset_x, offset_y); } @@ -263,27 +263,27 @@ void ViewerOperation::update_memory_buffer_partial(MemoryBuffer *UNUSED(output), offset_x + BLI_rcti_size_x(&area), offset_y, offset_y + BLI_rcti_size_y(&area)); - updateImage(&display_area); + update_image(&display_area); } void ViewerOperation::clear_display_buffer() { - BLI_assert(isActiveViewerOutput()); + BLI_assert(is_active_viewer_output()); if (exec_system_->is_breaked()) { return; } - initImage(); - if (outputBuffer_ == nullptr) { + init_image(); + if (output_buffer_ == nullptr) { return; } size_t buf_bytes = (size_t)ibuf_->y * ibuf_->x * COM_DATA_TYPE_COLOR_CHANNELS * sizeof(float); if (buf_bytes > 0) { - memset(outputBuffer_, 0, buf_bytes); + memset(output_buffer_, 0, buf_bytes); rcti display_area; BLI_rcti_init(&display_area, 0, ibuf_->x, 0, ibuf_->y); - updateImage(&display_area); + update_image(&display_area); } } diff --git a/source/blender/compositor/operations/COM_ViewerOperation.h b/source/blender/compositor/operations/COM_ViewerOperation.h index 9a812c8d87d..7fc5ae36ad9 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.h +++ b/source/blender/compositor/operations/COM_ViewerOperation.h @@ -28,105 +28,105 @@ namespace blender::compositor { class ViewerOperation : public MultiThreadedOperation { private: /* TODO(manzanilla): To be removed together with tiled implementation. */ - float *outputBuffer_; - float *depthBuffer_; + float *output_buffer_; + float *depth_buffer_; Image *image_; - ImageUser *imageUser_; + ImageUser *image_user_; bool active_; - float centerX_; - float centerY_; - ChunkOrdering chunkOrder_; - bool doDepthBuffer_; + float center_x_; + float center_y_; + ChunkOrdering chunk_order_; + bool do_depth_buffer_; ImBuf *ibuf_; - bool useAlphaInput_; + bool use_alpha_input_; const RenderData *rd_; - const char *viewName_; + const char *view_name_; - const ColorManagedViewSettings *viewSettings_; - const ColorManagedDisplaySettings *displaySettings_; + const ColorManagedViewSettings *view_settings_; + const ColorManagedDisplaySettings *display_settings_; - SocketReader *imageInput_; - SocketReader *alphaInput_; - SocketReader *depthInput_; + SocketReader *image_input_; + SocketReader *alpha_input_; + SocketReader *depth_input_; int display_width_; int display_height_; public: ViewerOperation(); - void initExecution() override; - void deinitExecution() override; - void executeRegion(rcti *rect, unsigned int tileNumber) override; + void init_execution() override; + void deinit_execution() override; + void execute_region(rcti *rect, unsigned int tile_number) override; void determine_canvas(const rcti &preferred_area, rcti &r_area) override; - bool isOutputOperation(bool /*rendering*/) const override + bool is_output_operation(bool /*rendering*/) const override { if (G.background) { return false; } - return isActiveViewerOutput(); + return is_active_viewer_output(); } - void setImage(Image *image) + void set_image(Image *image) { image_ = image; } - void setImageUser(ImageUser *imageUser) + void set_image_user(ImageUser *image_user) { - imageUser_ = imageUser; + image_user_ = image_user; } - bool isActiveViewerOutput() const override + bool is_active_viewer_output() const override { return active_; } - void setActive(bool active) + void set_active(bool active) { active_ = active; } void setCenterX(float centerX) { - centerX_ = centerX; + center_x_ = centerX; } void setCenterY(float centerY) { - centerY_ = centerY; + center_y_ = centerY; } - void setChunkOrder(ChunkOrdering tileOrder) + void set_chunk_order(ChunkOrdering tile_order) { - chunkOrder_ = tileOrder; + chunk_order_ = tile_order; } float getCenterX() const { - return centerX_; + return center_x_; } float getCenterY() const { - return centerY_; + return center_y_; } - ChunkOrdering getChunkOrder() const + ChunkOrdering get_chunk_order() const { - return chunkOrder_; + return chunk_order_; } - eCompositorPriority getRenderPriority() const override; - void setUseAlphaInput(bool value) + eCompositorPriority get_render_priority() const override; + void set_use_alpha_input(bool value) { - useAlphaInput_ = value; + use_alpha_input_ = value; } - void setRenderData(const RenderData *rd) + void set_render_data(const RenderData *rd) { rd_ = rd; } - void setViewName(const char *viewName) + void set_view_name(const char *view_name) { - viewName_ = viewName; + view_name_ = view_name; } - void setViewSettings(const ColorManagedViewSettings *viewSettings) + void set_view_settings(const ColorManagedViewSettings *view_settings) { - viewSettings_ = viewSettings; + view_settings_ = view_settings; } - void setDisplaySettings(const ColorManagedDisplaySettings *displaySettings) + void set_display_settings(const ColorManagedDisplaySettings *display_settings) { - displaySettings_ = displaySettings; + display_settings_ = display_settings; } void update_memory_buffer_partial(MemoryBuffer *output, @@ -136,8 +136,8 @@ class ViewerOperation : public MultiThreadedOperation { void clear_display_buffer(); private: - void updateImage(const rcti *rect); - void initImage(); + void update_image(const rcti *rect); + void init_image(); }; } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_WrapOperation.cc b/source/blender/compositor/operations/COM_WrapOperation.cc index be4798c605f..336e1b72520 100644 --- a/source/blender/compositor/operations/COM_WrapOperation.cc +++ b/source/blender/compositor/operations/COM_WrapOperation.cc @@ -24,98 +24,99 @@ namespace blender::compositor { WrapOperation::WrapOperation(DataType datatype) : ReadBufferOperation(datatype) { - wrappingType_ = CMP_NODE_WRAP_NONE; + wrapping_type_ = CMP_NODE_WRAP_NONE; } -inline float WrapOperation::getWrappedOriginalXPos(float x) +inline float WrapOperation::get_wrapped_original_xpos(float x) { - if (this->getWidth() == 0) { + if (this->get_width() == 0) { return 0; } while (x < 0) { - x += this->getWidth(); + x += this->get_width(); } - return fmodf(x, this->getWidth()); + return fmodf(x, this->get_width()); } -inline float WrapOperation::getWrappedOriginalYPos(float y) +inline float WrapOperation::get_wrapped_original_ypos(float y) { - if (this->getHeight() == 0) { + if (this->get_height() == 0) { return 0; } while (y < 0) { - y += this->getHeight(); + y += this->get_height(); } - return fmodf(y, this->getHeight()); + return fmodf(y, this->get_height()); } -void WrapOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) +void WrapOperation::execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) { float nx, ny; nx = x; ny = y; MemoryBufferExtend extend_x = MemoryBufferExtend::Clip, extend_y = MemoryBufferExtend::Clip; - switch (wrappingType_) { + switch (wrapping_type_) { case CMP_NODE_WRAP_NONE: - /* Intentionally empty, originalXPos and originalYPos have been set before. */ + /* Intentionally empty, original_xpos and original_ypos have been set before. */ break; case CMP_NODE_WRAP_X: /* Wrap only on the x-axis. */ - nx = this->getWrappedOriginalXPos(x); + nx = this->get_wrapped_original_xpos(x); extend_x = MemoryBufferExtend::Repeat; break; case CMP_NODE_WRAP_Y: /* Wrap only on the y-axis. */ - ny = this->getWrappedOriginalYPos(y); + ny = this->get_wrapped_original_ypos(y); extend_y = MemoryBufferExtend::Repeat; break; case CMP_NODE_WRAP_XY: /* Wrap on both. */ - nx = this->getWrappedOriginalXPos(x); - ny = this->getWrappedOriginalYPos(y); + nx = this->get_wrapped_original_xpos(x); + ny = this->get_wrapped_original_ypos(y); extend_x = MemoryBufferExtend::Repeat; extend_y = MemoryBufferExtend::Repeat; break; } - executePixelExtend(output, nx, ny, sampler, extend_x, extend_y); + execute_pixel_extend(output, nx, ny, sampler, extend_x, extend_y); } -bool WrapOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool WrapOperation::determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) { - rcti newInput; - newInput.xmin = input->xmin; - newInput.xmax = input->xmax; - newInput.ymin = input->ymin; - newInput.ymax = input->ymax; + rcti new_input; + new_input.xmin = input->xmin; + new_input.xmax = input->xmax; + new_input.ymin = input->ymin; + new_input.ymax = input->ymax; - if (ELEM(wrappingType_, CMP_NODE_WRAP_X, CMP_NODE_WRAP_XY)) { + if (ELEM(wrapping_type_, CMP_NODE_WRAP_X, CMP_NODE_WRAP_XY)) { /* Wrap only on the x-axis if tile is wrapping. */ - newInput.xmin = getWrappedOriginalXPos(input->xmin); - newInput.xmax = roundf(getWrappedOriginalXPos(input->xmax)); - if (newInput.xmin >= newInput.xmax) { - newInput.xmin = 0; - newInput.xmax = this->getWidth(); + new_input.xmin = get_wrapped_original_xpos(input->xmin); + new_input.xmax = roundf(get_wrapped_original_xpos(input->xmax)); + if (new_input.xmin >= new_input.xmax) { + new_input.xmin = 0; + new_input.xmax = this->get_width(); } } - if (ELEM(wrappingType_, CMP_NODE_WRAP_Y, CMP_NODE_WRAP_XY)) { + if (ELEM(wrapping_type_, CMP_NODE_WRAP_Y, CMP_NODE_WRAP_XY)) { /* Wrap only on the y-axis if tile is wrapping. */ - newInput.ymin = getWrappedOriginalYPos(input->ymin); - newInput.ymax = roundf(getWrappedOriginalYPos(input->ymax)); - if (newInput.ymin >= newInput.ymax) { - newInput.ymin = 0; - newInput.ymax = this->getHeight(); + new_input.ymin = get_wrapped_original_ypos(input->ymin); + new_input.ymax = roundf(get_wrapped_original_ypos(input->ymax)); + if (new_input.ymin >= new_input.ymax) { + new_input.ymin = 0; + new_input.ymax = this->get_height(); } } - return ReadBufferOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); + return ReadBufferOperation::determine_depending_area_of_interest( + &new_input, read_operation, output); } -void WrapOperation::setWrapping(int wrapping_type) +void WrapOperation::set_wrapping(int wrapping_type) { - wrappingType_ = wrapping_type; + wrapping_type_ = wrapping_type; } } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_WrapOperation.h b/source/blender/compositor/operations/COM_WrapOperation.h index 15fc43cc65a..e8ec97fa5f2 100644 --- a/source/blender/compositor/operations/COM_WrapOperation.h +++ b/source/blender/compositor/operations/COM_WrapOperation.h @@ -24,18 +24,18 @@ namespace blender::compositor { class WrapOperation : public ReadBufferOperation { private: - int wrappingType_; + int wrapping_type_; public: WrapOperation(DataType datatype); - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; - - void setWrapping(int wrapping_type); - float getWrappedOriginalXPos(float x); - float getWrappedOriginalYPos(float y); + bool determine_depending_area_of_interest(rcti *input, + ReadBufferOperation *read_operation, + rcti *output) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; + + void set_wrapping(int wrapping_type); + float get_wrapped_original_xpos(float x); + float get_wrapped_original_ypos(float y); void setFactorXY(float factorX, float factorY); }; diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.cc b/source/blender/compositor/operations/COM_WriteBufferOperation.cc index 26c1d71c9da..1c728772fdd 100644 --- a/source/blender/compositor/operations/COM_WriteBufferOperation.cc +++ b/source/blender/compositor/operations/COM_WriteBufferOperation.cc @@ -23,47 +23,47 @@ namespace blender::compositor { WriteBufferOperation::WriteBufferOperation(DataType datatype) { - this->addInputSocket(datatype); - memoryProxy_ = new MemoryProxy(datatype); - memoryProxy_->setWriteBufferOperation(this); - memoryProxy_->setExecutor(nullptr); + this->add_input_socket(datatype); + memory_proxy_ = new MemoryProxy(datatype); + memory_proxy_->set_write_buffer_operation(this); + memory_proxy_->set_executor(nullptr); flags.is_write_buffer_operation = true; } WriteBufferOperation::~WriteBufferOperation() { - if (memoryProxy_) { - delete memoryProxy_; - memoryProxy_ = nullptr; + if (memory_proxy_) { + delete memory_proxy_; + memory_proxy_ = nullptr; } } -void WriteBufferOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void WriteBufferOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - input_->readSampled(output, x, y, sampler); + input_->read_sampled(output, x, y, sampler); } -void WriteBufferOperation::initExecution() +void WriteBufferOperation::init_execution() { - input_ = this->getInputOperation(0); - memoryProxy_->allocate(this->getWidth(), this->getHeight()); + input_ = this->get_input_operation(0); + memory_proxy_->allocate(this->get_width(), this->get_height()); } -void WriteBufferOperation::deinitExecution() +void WriteBufferOperation::deinit_execution() { input_ = nullptr; - memoryProxy_->free(); + memory_proxy_->free(); } -void WriteBufferOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/) +void WriteBufferOperation::execute_region(rcti *rect, unsigned int /*tile_number*/) { - MemoryBuffer *memoryBuffer = memoryProxy_->getBuffer(); - float *buffer = memoryBuffer->getBuffer(); - const uint8_t num_channels = memoryBuffer->get_num_channels(); + MemoryBuffer *memory_buffer = memory_proxy_->get_buffer(); + float *buffer = memory_buffer->get_buffer(); + const uint8_t num_channels = memory_buffer->get_num_channels(); if (input_->get_flags().complex) { - void *data = input_->initializeTileData(rect); + void *data = input_->initialize_tile_data(rect); int x1 = rect->xmin; int y1 = rect->ymin; int x2 = rect->xmax; @@ -72,17 +72,17 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/ int y; bool breaked = false; for (y = y1; y < y2 && (!breaked); y++) { - int offset4 = (y * memoryBuffer->getWidth() + x1) * num_channels; + int offset4 = (y * memory_buffer->get_width() + x1) * num_channels; for (x = x1; x < x2; x++) { input_->read(&(buffer[offset4]), x, y, data); offset4 += num_channels; } - if (isBraked()) { + if (is_braked()) { breaked = true; } } if (data) { - input_->deinitializeTileData(rect, data); + input_->deinitialize_tile_data(rect, data); data = nullptr; } } @@ -96,25 +96,25 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/ int y; bool breaked = false; for (y = y1; y < y2 && (!breaked); y++) { - int offset4 = (y * memoryBuffer->getWidth() + x1) * num_channels; + int offset4 = (y * memory_buffer->get_width() + x1) * num_channels; for (x = x1; x < x2; x++) { - input_->readSampled(&(buffer[offset4]), x, y, PixelSampler::Nearest); + input_->read_sampled(&(buffer[offset4]), x, y, PixelSampler::Nearest); offset4 += num_channels; } - if (isBraked()) { + if (is_braked()) { breaked = true; } } } } -void WriteBufferOperation::executeOpenCLRegion(OpenCLDevice *device, - rcti * /*rect*/, - unsigned int /*chunkNumber*/, - MemoryBuffer **inputMemoryBuffers, - MemoryBuffer *outputBuffer) +void WriteBufferOperation::execute_opencl_region(OpenCLDevice *device, + rcti * /*rect*/, + unsigned int /*chunk_number*/, + MemoryBuffer **input_memory_buffers, + MemoryBuffer *output_buffer) { - float *outputFloatBuffer = outputBuffer->getBuffer(); + float *output_float_buffer = output_buffer->get_buffer(); cl_int error; /* * 1. create cl_mem from outputbuffer @@ -125,55 +125,55 @@ void WriteBufferOperation::executeOpenCLRegion(OpenCLDevice *device, * NOTE: list of cl_mem will be filled by 2, and needs to be cleaned up by 4 */ /* STEP 1 */ - const unsigned int outputBufferWidth = outputBuffer->getWidth(); - const unsigned int outputBufferHeight = outputBuffer->getHeight(); - - const cl_image_format *imageFormat = OpenCLDevice::determineImageFormat(outputBuffer); - - cl_mem clOutputBuffer = clCreateImage2D(device->getContext(), - CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR, - imageFormat, - outputBufferWidth, - outputBufferHeight, - 0, - outputFloatBuffer, - &error); + const unsigned int output_buffer_width = output_buffer->get_width(); + const unsigned int output_buffer_height = output_buffer->get_height(); + + const cl_image_format *image_format = OpenCLDevice::determine_image_format(output_buffer); + + cl_mem cl_output_buffer = clCreateImage2D(device->get_context(), + CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR, + image_format, + output_buffer_width, + output_buffer_height, + 0, + output_float_buffer, + &error); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } /* STEP 2 */ - std::list<cl_mem> *clMemToCleanUp = new std::list<cl_mem>(); - clMemToCleanUp->push_back(clOutputBuffer); - std::list<cl_kernel> *clKernelsToCleanUp = new std::list<cl_kernel>(); + std::list<cl_mem> *cl_mem_to_clean_up = new std::list<cl_mem>(); + cl_mem_to_clean_up->push_back(cl_output_buffer); + std::list<cl_kernel> *cl_kernels_to_clean_up = new std::list<cl_kernel>(); - input_->executeOpenCL(device, - outputBuffer, - clOutputBuffer, - inputMemoryBuffers, - clMemToCleanUp, - clKernelsToCleanUp); + input_->execute_opencl(device, + output_buffer, + cl_output_buffer, + input_memory_buffers, + cl_mem_to_clean_up, + cl_kernels_to_clean_up); /* STEP 3 */ size_t origin[3] = {0, 0, 0}; - size_t region[3] = {outputBufferWidth, outputBufferHeight, 1}; + size_t region[3] = {output_buffer_width, output_buffer_height, 1}; // clFlush(queue); // clFinish(queue); - error = clEnqueueBarrier(device->getQueue()); + error = clEnqueueBarrier(device->get_queue()); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } - error = clEnqueueReadImage(device->getQueue(), - clOutputBuffer, + error = clEnqueueReadImage(device->get_queue(), + cl_output_buffer, CL_TRUE, origin, region, 0, 0, - outputFloatBuffer, + output_float_buffer, 0, nullptr, nullptr); @@ -181,27 +181,27 @@ void WriteBufferOperation::executeOpenCLRegion(OpenCLDevice *device, printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } - this->getMemoryProxy()->getBuffer()->fill_from(*outputBuffer); + this->get_memory_proxy()->get_buffer()->fill_from(*output_buffer); /* STEP 4 */ - while (!clMemToCleanUp->empty()) { - cl_mem mem = clMemToCleanUp->front(); + while (!cl_mem_to_clean_up->empty()) { + cl_mem mem = cl_mem_to_clean_up->front(); error = clReleaseMemObject(mem); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } - clMemToCleanUp->pop_front(); + cl_mem_to_clean_up->pop_front(); } - while (!clKernelsToCleanUp->empty()) { - cl_kernel kernel = clKernelsToCleanUp->front(); + while (!cl_kernels_to_clean_up->empty()) { + cl_kernel kernel = cl_kernels_to_clean_up->front(); error = clReleaseKernel(kernel); if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); } - clKernelsToCleanUp->pop_front(); + cl_kernels_to_clean_up->pop_front(); } - delete clKernelsToCleanUp; + delete cl_kernels_to_clean_up; } void WriteBufferOperation::determine_canvas(const rcti &preferred_area, rcti &r_area) @@ -219,11 +219,11 @@ void WriteBufferOperation::determine_canvas(const rcti &preferred_area, rcti &r_ } } -void WriteBufferOperation::readResolutionFromInputSocket() +void WriteBufferOperation::read_resolution_from_input_socket() { - NodeOperation *inputOperation = this->getInputOperation(0); - this->setWidth(inputOperation->getWidth()); - this->setHeight(inputOperation->getHeight()); + NodeOperation *input_operation = this->get_input_operation(0); + this->set_width(input_operation->get_width()); + this->set_height(input_operation->get_height()); } } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.h b/source/blender/compositor/operations/COM_WriteBufferOperation.h index bd8a2876a42..cf6b7f655ce 100644 --- a/source/blender/compositor/operations/COM_WriteBufferOperation.h +++ b/source/blender/compositor/operations/COM_WriteBufferOperation.h @@ -31,34 +31,34 @@ class MemoryProxy; * \ingroup Operation */ class WriteBufferOperation : public NodeOperation { - MemoryProxy *memoryProxy_; + MemoryProxy *memory_proxy_; bool single_value_; /* single value stored in buffer */ NodeOperation *input_; public: WriteBufferOperation(DataType datatype); ~WriteBufferOperation(); - MemoryProxy *getMemoryProxy() + MemoryProxy *get_memory_proxy() { - return memoryProxy_; + return memory_proxy_; } - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; - bool isSingleValue() const + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; + bool is_single_value() const { return single_value_; } - 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) override; + void execute_region(rcti *rect, unsigned int tile_number) override; + void init_execution() override; + void deinit_execution() override; + void execute_opencl_region(OpenCLDevice *device, + rcti *rect, + unsigned int chunk_number, + MemoryBuffer **memory_buffers, + MemoryBuffer *output_buffer) override; void determine_canvas(const rcti &preferred_area, rcti &r_area) override; - void readResolutionFromInputSocket(); - inline NodeOperation *getInput() + void read_resolution_from_input_socket(); + inline NodeOperation *get_input() { return input_; } diff --git a/source/blender/compositor/operations/COM_ZCombineOperation.cc b/source/blender/compositor/operations/COM_ZCombineOperation.cc index 3a0126a12d4..9593e909d5a 100644 --- a/source/blender/compositor/operations/COM_ZCombineOperation.cc +++ b/source/blender/compositor/operations/COM_ZCombineOperation.cc @@ -22,11 +22,11 @@ namespace blender::compositor { ZCombineOperation::ZCombineOperation() { - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Color); image1Reader_ = nullptr; depth1Reader_ = nullptr; @@ -35,29 +35,29 @@ ZCombineOperation::ZCombineOperation() this->flags.can_be_constant = true; } -void ZCombineOperation::initExecution() +void ZCombineOperation::init_execution() { - image1Reader_ = this->getInputSocketReader(0); - depth1Reader_ = this->getInputSocketReader(1); - image2Reader_ = this->getInputSocketReader(2); - depth2Reader_ = this->getInputSocketReader(3); + image1Reader_ = this->get_input_socket_reader(0); + depth1Reader_ = this->get_input_socket_reader(1); + image2Reader_ = this->get_input_socket_reader(2); + depth2Reader_ = this->get_input_socket_reader(3); } -void ZCombineOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ZCombineOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { float depth1[4]; float depth2[4]; - depth1Reader_->readSampled(depth1, x, y, sampler); - depth2Reader_->readSampled(depth2, x, y, sampler); + depth1Reader_->read_sampled(depth1, x, y, sampler); + depth2Reader_->read_sampled(depth2, x, y, sampler); if (depth1[0] < depth2[0]) { - image1Reader_->readSampled(output, x, y, sampler); + image1Reader_->read_sampled(output, x, y, sampler); } else { - image2Reader_->readSampled(output, x, y, sampler); + image2Reader_->read_sampled(output, x, y, sampler); } } @@ -73,25 +73,25 @@ void ZCombineOperation::update_memory_buffer_partial(MemoryBuffer *output, } } -void ZCombineAlphaOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ZCombineAlphaOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { float depth1[4]; float depth2[4]; float color1[4]; float color2[4]; - depth1Reader_->readSampled(depth1, x, y, sampler); - depth2Reader_->readSampled(depth2, x, y, sampler); + depth1Reader_->read_sampled(depth1, x, y, sampler); + depth2Reader_->read_sampled(depth2, x, y, sampler); if (depth1[0] <= depth2[0]) { - image1Reader_->readSampled(color1, x, y, sampler); - image2Reader_->readSampled(color2, x, y, sampler); + image1Reader_->read_sampled(color1, x, y, sampler); + image2Reader_->read_sampled(color2, x, y, sampler); } else { - image1Reader_->readSampled(color2, x, y, sampler); - image2Reader_->readSampled(color1, x, y, sampler); + image1Reader_->read_sampled(color2, x, y, sampler); + image2Reader_->read_sampled(color1, x, y, sampler); } float fac = color1[3]; float ifac = 1.0f - fac; @@ -127,7 +127,7 @@ void ZCombineAlphaOperation::update_memory_buffer_partial(MemoryBuffer *output, } } -void ZCombineOperation::deinitExecution() +void ZCombineOperation::deinit_execution() { image1Reader_ = nullptr; depth1Reader_ = nullptr; @@ -138,35 +138,35 @@ void ZCombineOperation::deinitExecution() // MASK combine ZCombineMaskOperation::ZCombineMaskOperation() { - this->addInputSocket(DataType::Value); // mask - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Color); - this->addOutputSocket(DataType::Color); + this->add_input_socket(DataType::Value); // mask + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); - maskReader_ = nullptr; + mask_reader_ = nullptr; image1Reader_ = nullptr; image2Reader_ = nullptr; } -void ZCombineMaskOperation::initExecution() +void ZCombineMaskOperation::init_execution() { - maskReader_ = this->getInputSocketReader(0); - image1Reader_ = this->getInputSocketReader(1); - image2Reader_ = this->getInputSocketReader(2); + mask_reader_ = this->get_input_socket_reader(0); + image1Reader_ = this->get_input_socket_reader(1); + image2Reader_ = this->get_input_socket_reader(2); } -void ZCombineMaskOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ZCombineMaskOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { float mask[4]; float color1[4]; float color2[4]; - maskReader_->readSampled(mask, x, y, sampler); - image1Reader_->readSampled(color1, x, y, sampler); - image2Reader_->readSampled(color2, x, y, sampler); + mask_reader_->read_sampled(mask, x, y, sampler); + image1Reader_->read_sampled(color1, x, y, sampler); + image2Reader_->read_sampled(color2, x, y, sampler); interp_v4_v4v4(output, color1, color2, 1.0f - mask[0]); } @@ -183,18 +183,18 @@ void ZCombineMaskOperation::update_memory_buffer_partial(MemoryBuffer *output, } } -void ZCombineMaskAlphaOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void ZCombineMaskAlphaOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { float mask[4]; float color1[4]; float color2[4]; - maskReader_->readSampled(mask, x, y, sampler); - image1Reader_->readSampled(color1, x, y, sampler); - image2Reader_->readSampled(color2, x, y, sampler); + mask_reader_->read_sampled(mask, x, y, sampler); + image1Reader_->read_sampled(color1, x, y, sampler); + image2Reader_->read_sampled(color2, x, y, sampler); float fac = (1.0f - mask[0]) * (1.0f - color1[3]) + mask[0] * color2[3]; float mfac = 1.0f - fac; @@ -223,10 +223,10 @@ void ZCombineMaskAlphaOperation::update_memory_buffer_partial(MemoryBuffer *outp } } -void ZCombineMaskOperation::deinitExecution() +void ZCombineMaskOperation::deinit_execution() { image1Reader_ = nullptr; - maskReader_ = nullptr; + mask_reader_ = nullptr; image2Reader_ = nullptr; } diff --git a/source/blender/compositor/operations/COM_ZCombineOperation.h b/source/blender/compositor/operations/COM_ZCombineOperation.h index 612107e3c77..ffc1bdd93b4 100644 --- a/source/blender/compositor/operations/COM_ZCombineOperation.h +++ b/source/blender/compositor/operations/COM_ZCombineOperation.h @@ -39,13 +39,13 @@ class ZCombineOperation : public MultiThreadedOperation { */ ZCombineOperation(); - void initExecution() override; - void deinitExecution() override; + void init_execution() override; + void deinit_execution() override; /** * The inner loop of this operation. */ - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, @@ -53,7 +53,7 @@ class ZCombineOperation : public MultiThreadedOperation { }; class ZCombineAlphaOperation : public ZCombineOperation { - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, @@ -62,23 +62,23 @@ class ZCombineAlphaOperation : public ZCombineOperation { class ZCombineMaskOperation : public MultiThreadedOperation { protected: - SocketReader *maskReader_; + SocketReader *mask_reader_; SocketReader *image1Reader_; SocketReader *image2Reader_; public: ZCombineMaskOperation(); - void initExecution() override; - void deinitExecution() override; - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void init_execution() override; + void deinit_execution() override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span<MemoryBuffer *> inputs) override; }; class ZCombineMaskAlphaOperation : public ZCombineMaskOperation { - void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, diff --git a/source/blender/compositor/tests/COM_NodeOperation_test.cc b/source/blender/compositor/tests/COM_NodeOperation_test.cc index 94e9fdeedb1..ea61df22f88 100644 --- a/source/blender/compositor/tests/COM_NodeOperation_test.cc +++ b/source/blender/compositor/tests/COM_NodeOperation_test.cc @@ -27,9 +27,9 @@ class NonHashedOperation : public NodeOperation { NonHashedOperation(int id) { set_id(id); - addOutputSocket(DataType::Value); - setWidth(2); - setHeight(3); + add_output_socket(DataType::Value); + set_width(2); + set_height(3); } }; @@ -40,9 +40,9 @@ class NonHashedConstantOperation : public ConstantOperation { NonHashedConstantOperation(int id) { set_id(id); - addOutputSocket(DataType::Value); - setWidth(2); - setHeight(3); + add_output_socket(DataType::Value); + set_width(2); + set_height(3); constant_ = 1.0f; } @@ -65,14 +65,14 @@ class HashedOperation : public NodeOperation { public: HashedOperation(NodeOperation &input, int width, int height) { - addInputSocket(DataType::Value); - addOutputSocket(DataType::Color); - setWidth(width); - setHeight(height); + add_input_socket(DataType::Value); + add_output_socket(DataType::Color); + set_width(width); + set_height(height); param1 = 2; param2 = 7.0f; - getInputSocket(0)->setLink(input.getOutputSocket()); + get_input_socket(0)->set_link(input.get_output_socket()); } void set_param1(int value) |