60 void GaussianBokehBlurOperation::update_gauss()
62 if (gausstab_ ==
nullptr) {
63 int ddwidth = 2 * radx_ + 1;
64 int ddheight = 2 * rady_ + 1;
65 int n = ddwidth * ddheight;
67 float *ddgauss = (
float *)
MEM_mallocN(
sizeof(
float) * n, __func__);
68 float *dgauss = ddgauss;
70 float facx = (radxf_ > 0.0f ? 1.0f / radxf_ : 0.0f);
71 float facy = (radyf_ > 0.0f ? 1.0f / radyf_ : 0.0f);
72 for (
int j = -rady_; j <= rady_; j++) {
73 for (
int i = -radx_; i <= radx_; i++, dgauss++) {
74 float fj = (
float)j * facy;
75 float fi = (
float)i * facx;
76 float dist =
sqrt(fj * fj + fi * fi);
86 for (
int j = n - 1; j >= 0; j--) {
91 int center = rady_ * ddwidth + radx_;
114 radx_ =
ceil(radxf_);
115 rady_ =
ceil(radyf_);
122 float multiplier_accum = 0;
125 int bufferwidth = input_buffer->
get_width();
127 int bufferstartx = input_rect.
xmin;
128 int bufferstarty = input_rect.
ymin;
138 const int add_const = (xmin -
x + radx_);
139 const int mul_const = (radx_ * 2 + 1);
140 for (
int ny = ymin;
ny < ymax;
ny += step) {
141 index = ((
ny -
y) + rady_) * mul_const + add_const;
142 int bufferindex = ((xmin - bufferstartx) * 4) + ((
ny - bufferstarty) * 4 * bufferwidth);
143 for (
int nx = xmin; nx < xmax; nx += step) {
144 const float multiplier = gausstab_[index];
146 multiplier_accum += multiplier;
148 bufferindex += offsetadd;
197 &new_input, read_operation,
output);
201 const rcti &output_area,
209 r_input_area.
xmax = output_area.
xmax + radx_;
210 r_input_area.
xmin = output_area.
xmin - radx_;
211 r_input_area.
ymax = output_area.
ymax + rady_;
212 r_input_area.
ymin = output_area.
ymin - rady_;
221 const rcti &input_rect =
input->get_rect();
222 for (; !it.is_end(); ++it) {
226 const int ymin =
max_ii(
y - rady_, input_rect.
ymin);
227 const int ymax =
min_ii(
y + rady_ + 1, input_rect.
ymax);
228 const int xmin =
max_ii(
x - radx_, input_rect.
xmin);
229 const int xmax =
min_ii(
x + radx_ + 1, input_rect.
xmax);
231 float temp_color[4] = {0};
232 float multiplier_accum = 0;
234 const int elem_step = step *
input->elem_stride;
235 const int add_const = (xmin -
x + radx_);
236 const int mul_const = (radx_ * 2 + 1);
237 for (
int ny = ymin;
ny < ymax;
ny += step) {
239 int gauss_index = ((
ny -
y) + rady_) * mul_const + add_const;
240 const int gauss_end = gauss_index + (xmax - xmin);
241 for (; gauss_index < gauss_end; gauss_index += step,
color += elem_step) {
242 const float multiplier = gausstab_[gauss_index];
244 multiplier_accum += multiplier;
248 mul_v4_v4fl(it.out, temp_color, 1.0f / multiplier_accum);
285 if (filtersizex_ > imgx) {
288 else if (filtersizex_ < 1) {
291 radx_ = (
float)filtersizex_;
296 if (filtersizey_ > imgy) {
299 else if (filtersizey_ < 1) {
302 rady_ = (
float)filtersizey_;
318 void GaussianBlurReferenceOperation::update_gauss()
321 int x =
MAX2(filtersizex_, filtersizey_);
322 maintabs_ = (
float **)
MEM_mallocN(
x *
sizeof(
float *),
"gauss array");
323 for (i = 0; i <
x; i++) {
332 float *gausstabx, *gausstabcenty;
333 float *gausstaby, *gausstabcentx;
337 float rval, gval, bval, aval;
342 float ref_size = temp_size[0];
343 int refradx = (int)(ref_size * radx_);
344 int refrady = (int)(ref_size * rady_);
345 if (refradx > filtersizex_) {
346 refradx = filtersizex_;
348 else if (refradx < 1) {
351 if (refrady > filtersizey_) {
352 refrady = filtersizey_;
354 else if (refrady < 1) {
358 if (refradx == 1 && refrady == 1) {
362 int minxr =
x - refradx < 0 ? -
x : -refradx;
363 int maxxr =
x + refradx > imgx ? imgx -
x : refradx;
364 int minyr =
y - refrady < 0 ? -
y : -refrady;
365 int maxyr =
y + refrady > imgy ? imgy -
y : refrady;
369 gausstabx = maintabs_[refradx - 1];
370 gausstabcentx = gausstabx + refradx;
371 gausstaby = maintabs_[refrady - 1];
372 gausstabcenty = gausstaby + refrady;
374 sum = gval = rval = bval = aval = 0.0f;
379 val = gausstabcenty[i] * gausstabcentx[j];
381 rval += val *
src[0];
382 gval += val *
src[1];
383 bval += val *
src[2];
384 aval += val *
src[3];
398 x =
MAX2(filtersizex_, filtersizey_);
399 for (i = 0; i <
x; i++) {
426 const rcti &output_area,
436 r_input_area.
xmax = output_area.
xmax + add_x;
437 r_input_area.
xmin = output_area.
xmin - add_x;
438 r_input_area.
ymax = output_area.
ymax + add_y;
439 r_input_area.
ymin = output_area.
ymin - add_y;
449 const float ref_size = *it.in(0);
450 int ref_radx = (int)(ref_size * radx_);
451 int ref_rady = (int)(ref_size * rady_);
452 if (ref_radx > filtersizex_) {
453 ref_radx = filtersizex_;
455 else if (ref_radx < 1) {
458 if (ref_rady > filtersizey_) {
459 ref_rady = filtersizey_;
461 else if (ref_rady < 1) {
467 if (ref_radx == 1 && ref_rady == 1) {
474 const int minxr =
x - ref_radx < 0 ? -
x : -ref_radx;
475 const int maxxr =
x + ref_radx >
w ?
w -
x : ref_radx;
476 const int minyr =
y - ref_rady < 0 ? -
y : -ref_rady;
479 const float *gausstabx = maintabs_[ref_radx - 1];
480 const float *gausstabcentx = gausstabx + ref_radx;
481 const float *gausstaby = maintabs_[ref_rady - 1];
482 const float *gausstabcenty = gausstaby + ref_rady;
484 float gauss_sum = 0.0f;
485 float color_sum[4] = {0};
486 const float *row_color = image_input->
get_elem(
x + minxr,
y + minyr);
487 for (
int i = minyr; i < maxyr; i++, row_color += image_input->
row_stride) {
488 const float *
color = row_color;
490 const float val = gausstabcenty[i] * gausstabcentx[j];
typedef float(TangentPoint)[2]
MINLINE int min_ii(int a, int b)
MINLINE int max_ii(int a, int b)
MINLINE void mul_v4_v4fl(float r[4], const float a[4], float f)
MINLINE void madd_v4_v4fl(float r[4], const float a[4], float f)
#define CMP_NODE_BLUR_ASPECT_X
#define CMP_NODE_BLUR_ASPECT_Y
#define CMP_NODE_BLUR_ASPECT_NONE
NSNotificationCenter * center
_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 GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble ny
_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
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between and object coordinate space Combine Create a color from its and value channels Color Retrieve a color or the default fallback if none is specified Separate Split a vector into its and Z components Generates normals with round corners and may slow down renders Vector Displace the surface along an arbitrary direction White Return a random value or color based on an input seed Float Map an input float to a curve and outputs a float value Separate Color
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a color
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
static T sum(const btAlignedObjectArray< T > &items)
SIMD_FORCE_INLINE btScalar norm() const
Return the norm (length) of the vector.
float * make_gausstab(float rad, int size)
virtual 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.
static constexpr int SIZE_INPUT_INDEX
virtual void init_data() override
void deinit_execution() override
SocketReader * input_size_
void init_execution() override
static constexpr int IMAGE_INPUT_INDEX
void init_execution() override
GaussianBlurReferenceOperation()
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
Get input operation area being read by this operation on rendering given output area.
void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) override
void * initialize_tile_data(rcti *rect) override
void execute_pixel(float output[4], int x, int y, void *data) override
void init_data() override
void deinit_execution() override
void init_execution() override
void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) override
void * initialize_tile_data(rcti *rect) override
GaussianBokehBlurOperation()
bool determine_depending_area_of_interest(rcti *input, ReadBufferOperation *read_operation, rcti *output) override
void init_data() 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.
void execute_pixel(float output[4], int x, int y, void *data) override
a MemoryBuffer contains access to the data of a chunk
const rcti & get_rect() const
get the rect of this MemoryBuffer
float * get_elem(int x, int y)
const int get_width() const
get the width of this MemoryBuffer
float * get_buffer()
get the data of this MemoryBuffer
void read_elem(int x, int y, float *out) const
void read_no_check(float *result, int x, int y, MemoryBufferExtend extend_x=MemoryBufferExtend::Clip, MemoryBufferExtend extend_y=MemoryBufferExtend::Clip)
NodeOperation contains calculation logic.
unsigned int get_height() const
unsigned int get_width() const
eExecutionModel execution_model_
NodeOperation * get_input_operation(int index)
void read(float result[4], int x, int y, void *chunk_data)
virtual bool determine_depending_area_of_interest(rcti *input, ReadBufferOperation *read_operation, rcti *output)
void read_sampled(float result[4], float x, float y, PixelSampler sampler)
virtual void * initialize_tile_data(rcti *)
int get_offset_add() const
SyclQueue void void * src
DataType
possible data types for sockets
float RE_filter_value(int type, float x)
ccl_global float * buffer
ccl_global KernelShaderEvalInput ccl_global float * output
ccl_global KernelShaderEvalInput * input
void(* MEM_freeN)(void *vmemh)
void *(* MEM_mallocN)(size_t len, const char *str)
ccl_device_inline float3 ceil(const float3 &a)
static void area(int d1, int d2, int e1, int e2, float weights[2])
constexpr int COM_DATA_TYPE_COLOR_CHANNELS
typename BuffersIteratorBuilder< T >::Iterator BuffersIterator
static bNodeSocketTemplate inputs[]