Files
test/source/blender/compositor/algorithms/COM_JumpFloodingAlgorithm.h
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

25 lines
696 B
C++

/* SPDX-FileCopyrightText: 2024 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include "BLI_array.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_span.hh"
/* Exact copies of the functions in gpu_shader_compositor_jump_flooding_lib.glsl and
* COM_algorithm_jump_flooding.hh but adapted for CPU. See those files for more information. */
#define JUMP_FLOODING_NON_FLOODED_VALUE int2(-1)
namespace blender::compositor {
int2 encode_jump_flooding_value(int2 closest_seed_texel, bool is_flooded);
int2 initialize_jump_flooding_value(int2 texel, bool is_seed);
Array<int2> jump_flooding(Span<int2> input, int2 size);
} // namespace blender::compositor