Files
test2/source/blender/compositor/nodes/COM_DoubleEdgeMaskNode.cc
Omar Emara 049b0e6539 Compositor: Rewrite and optimize Double Edge Mask node
This patch rewrites and optimizes the Double Edge Mask node to be orders
of magnitude faster. For a 1k complex mask, it is 650x faster, while for
a 1k simple mask, it is only 50x faster.

This improvement is attributed to the use of a new Jump Flooding
algorithm as well as multi-threading, matching the GPU implementation.

The result of the new implementation differs in that the boundaries of
the masks are now identified as the last pixels inside the mask.

Pull Request: https://projects.blender.org/blender/blender/pulls/117545
2024-01-30 19:49:32 +01:00

32 lines
1.0 KiB
C++

/* SPDX-FileCopyrightText: 2011 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#include "COM_DoubleEdgeMaskNode.h"
#include "COM_DoubleEdgeMaskOperation.h"
namespace blender::compositor {
DoubleEdgeMaskNode::DoubleEdgeMaskNode(bNode *editor_node) : Node(editor_node)
{
/* pass */
}
void DoubleEdgeMaskNode::convert_to_operations(NodeConverter &converter,
const CompositorContext & /*context*/) const
{
DoubleEdgeMaskOperation *operation;
const bNode *bnode = this->get_bnode();
operation = new DoubleEdgeMaskOperation();
operation->set_include_all_inner_edges(!bool(bnode->custom1));
operation->set_include_edges_of_image(bool(bnode->custom2));
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