39 int buffer_width = input_buffer->
get_width();
40 int buffer_height = input_buffer->
get_height();
42 float value =
buffer[(
y * buffer_width +
x)];
45 int start_x =
max_ff(0,
x - delta + 1), start_y =
max_ff(0,
y - delta + 1),
46 end_x =
min_ff(
x + delta - 1, buffer_width - 1),
47 end_y =
min_ff(
y + delta - 1, buffer_height - 1);
49 int count = 0, total_count = (end_x - start_x + 1) * (end_y - start_y + 1) - 1;
50 int threshold_count =
ceil((
float)total_count * 0.9f);
56 for (
int cx = start_x; ok ==
false && cx <= end_x; cx++) {
57 for (
int cy = start_y; ok ==
false && cy <= end_y; cy++) {
62 int buffer_index = (cy * buffer_width + cx);
63 float current_value =
buffer[buffer_index];
65 if (
fabsf(current_value - value) < tolerance) {
67 if (
count >= threshold_count) {
114 const rcti &output_area,
136 const int row_stride =
input->row_stride;
137 const int elem_stride =
input->elem_stride;
138 for (; !it.is_end(); ++it) {
142 const int start_x =
MAX2(0,
x - delta + 1);
143 const int start_y =
MAX2(0,
y - delta + 1);
146 const int x_len = end_x - start_x;
147 const int y_len = end_y - start_y;
149 const int total_count = x_len * y_len - 1;
150 const int threshold_count =
ceil((
float)total_count * 0.9f);
156 const float *main_elem = it.in(0);
157 const float value = *main_elem;
158 const float *row =
input->get_elem(start_x, start_y);
159 const float *end_row = row + y_len * row_stride;
161 for (; ok ==
false && row < end_row; row += row_stride) {
162 const float *end_elem = row + x_len * elem_stride;
163 for (
const float *elem = row; ok ==
false && elem < end_elem; elem += elem_stride) {
168 const float current_value = *elem;
169 if (
fabsf(current_value - value) < tolerance) {
171 if (
count >= threshold_count) {
179 *it.out = ok ? 0.0f : 1.0f;
MINLINE float max_ff(float a, float b)
MINLINE float min_ff(float a, float b)
#define UNUSED_VARS_NDEBUG(...)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
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
calculate a single pixel
void * initialize_tile_data(rcti *rect) override
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 of a chunk
const int get_width() const
get the width of this MemoryBuffer
const int get_height() const
get the height of this MemoryBuffer
float * get_buffer()
get the data of this MemoryBuffer
unsigned int get_height() const
void add_output_socket(DataType datatype)
unsigned int get_width() const
NodeOperationFlags flags_
NodeOperation * get_input_operation(int index)
virtual bool determine_depending_area_of_interest(rcti *input, ReadBufferOperation *read_operation, rcti *output)
void add_input_socket(DataType datatype, ResizeMode resize_mode=ResizeMode::Center)
virtual void * initialize_tile_data(rcti *)
ccl_global float * buffer
ccl_global KernelShaderEvalInput ccl_global float * output
ccl_global KernelShaderEvalInput * input
ccl_device_inline float3 ceil(const float3 &a)
static void area(int d1, int d2, int e1, int e2, float weights[2])
typename BuffersIteratorBuilder< T >::Iterator BuffersIterator
static bNodeSocketTemplate inputs[]