17 flags_.can_be_constant =
true;
22 return ((
fabsf(a[0] -
b[0]) > threshold) || (
fabsf(a[1] -
b[1]) > threshold) ||
23 (
fabsf(a[2] -
b[2]) > threshold));
27 const rcti &output_area,
31 case IMAGE_INPUT_INDEX: {
34 r_input_area.
xmin = output_area.
xmin - add_x;
35 r_input_area.
xmax = output_area.
xmax + add_x;
36 r_input_area.
ymin = output_area.
ymin - add_y;
37 r_input_area.
ymax = output_area.
ymax + add_y;
40 case FACTOR_INPUT_INDEX: {
41 r_input_area = output_area;
55 const int x1 = std::max(it.x - 1, 0);
57 const int x3 = std::min(it.x + 1, last_x);
58 const int y1 = std::max(it.y - 1, 0);
60 const int y3 = std::min(it.y + 1, last_y);
63 const float *color_org = it.in(IMAGE_INPUT_INDEX);
65 float color_mid_ok[4];
66 const float *in1 =
nullptr;
68#define TOT_DIV_ONE 1.0f
69#define TOT_DIV_CNR float(M_SQRT1_2)
71#define WTOT (TOT_DIV_ONE * 4 + TOT_DIV_CNR * 4)
73#define COLOR_ADD(fac) \
75 madd_v4_v4fl(color_mid, in1, fac); \
76 if (color_diff(in1, color_org, threshold_)) { \
78 madd_v4_v4fl(color_mid_ok, in1, fac); \
85 in1 =
image->get_elem(x1, y1);
87 in1 =
image->get_elem(x2, y1);
89 in1 =
image->get_elem(x3, y1);
91 in1 =
image->get_elem(x1, y2);
95 const float *in2 =
image->get_elem(x2, y2);
99 in1 =
image->get_elem(x3, y2);
101 in1 =
image->get_elem(x1, y3);
103 in1 =
image->get_elem(x2, y3);
105 in1 =
image->get_elem(x3, y3);
111 if ((
w != 0.0f) && ((
w /
WTOT) > (threshold_neighbor_)) &&
114 const float factor = *it.in(FACTOR_INPUT_INDEX);
MINLINE void mul_v4_fl(float r[4], float f)
MINLINE void copy_v4_v4(float r[4], const float a[4])
void interp_v4_v4v4(float r[4], const float a[4], const float b[4], float t)
MINLINE void zero_v4(float r[4])
MINLINE void madd_v4_v4fl(float r[4], const float a[4], float f)
Read Guarded memory(de)allocation.
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) override
void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override
Get input operation area being read by this operation on rendering given output area.
a MemoryBuffer contains access to the data
unsigned int get_height() const
void add_output_socket(DataType datatype)
unsigned int get_width() const
NodeOperationFlags flags_
void add_input_socket(DataType datatype, ResizeMode resize_mode=ResizeMode::Center)
void set_canvas_input_index(unsigned int index)
set the index of the input socket that will determine the canvas of this operation
input_tx image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, "preview_img") .compute_source("compositor_compute_preview.glsl") .do_static_compilation(true)
local_group_size(16, 16) .push_constant(Type b
BLI_INLINE int color_diff(const float a[3], const float b[3], const float threshold)
typename BuffersIteratorBuilder< T >::Iterator BuffersIterator
static blender::bke::bNodeSocketTemplate inputs[]