29 this->m_gausstab =
nullptr;
54 void GaussianBokehBlurOperation::updateGauss()
56 if (this->m_gausstab ==
nullptr) {
75 this->m_radx =
ceil(radxf);
76 this->m_rady =
ceil(radyf);
78 int ddwidth = 2 * this->m_radx + 1;
79 int ddheight = 2 * this->m_rady + 1;
80 n = ddwidth * ddheight;
83 ddgauss = (
float *)
MEM_mallocN(
sizeof(
float) * n, __func__);
86 float facx = (radxf > 0.0f ? 1.0f / radxf : 0.0f);
87 float facy = (radyf > 0.0f ? 1.0f / radyf : 0.0f);
88 for (j = -this->m_rady; j <= this->m_rady; j++) {
89 for (i = -this->m_radx; i <= this->m_radx; i++, dgauss++) {
90 float fj = (
float)j * facy;
91 float fi = (
float)i * facx;
92 float dist =
sqrt(fj * fj + fi * fi);
102 for (j = n - 1; j >= 0; j--) {
107 int center = m_rady * ddwidth + m_radx;
111 this->m_gausstab = ddgauss;
122 float multiplier_accum = 0;
125 int bufferwidth = inputBuffer->
getWidth();
127 int bufferstartx = input_rect.
xmin;
128 int bufferstarty = input_rect.
ymin;
130 int ymin =
max_ii(
y - this->m_rady, input_rect.
ymin);
131 int ymax =
min_ii(
y + this->m_rady + 1, input_rect.
ymax);
132 int xmin =
max_ii(
x - this->m_radx, input_rect.
xmin);
133 int xmax =
min_ii(
x + this->m_radx + 1, input_rect.
xmax);
138 const int addConst = (xmin -
x + this->m_radx);
139 const int mulConst = (this->m_radx * 2 + 1);
140 for (
int ny = ymin;
ny < ymax;
ny += step) {
141 index = ((
ny -
y) + this->m_rady) * mulConst + addConst;
142 int bufferindex = ((xmin - bufferstartx) * 4) + ((
ny - bufferstarty) * 4 * bufferwidth);
143 for (
int nx = xmin; nx < xmax; nx += step) {
144 const float multiplier = this->m_gausstab[index];
146 multiplier_accum += multiplier;
148 bufferindex += offsetadd;
159 if (this->m_gausstab) {
161 this->m_gausstab =
nullptr;
189 int addx = this->m_radx;
190 int addy = this->m_rady;
203 this->m_maintabs =
nullptr;
238 if (m_filtersizex > imgx) {
239 m_filtersizex = imgx;
241 else if (m_filtersizex < 1) {
244 m_radx = (
float)m_filtersizex;
249 if (m_filtersizey > imgy) {
250 m_filtersizey = imgy;
252 else if (m_filtersizey < 1) {
255 m_rady = (
float)m_filtersizey;
259 void GaussianBlurReferenceOperation::updateGauss()
262 int x =
MAX2(m_filtersizex, m_filtersizey);
263 m_maintabs = (
float **)
MEM_mallocN(
x *
sizeof(
float *),
"gauss array");
264 for (i = 0; i <
x; i++) {
273 float *gausstabx, *gausstabcenty;
274 float *gausstaby, *gausstabcentx;
278 float rval, gval, bval, aval;
283 float refSize = tempSize[0];
284 int refradx = (int)(refSize * m_radx);
285 int refrady = (int)(refSize * m_rady);
286 if (refradx > m_filtersizex) {
287 refradx = m_filtersizex;
289 else if (refradx < 1) {
292 if (refrady > m_filtersizey) {
293 refrady = m_filtersizey;
295 else if (refrady < 1) {
299 if (refradx == 1 && refrady == 1) {
303 int minxr =
x - refradx < 0 ? -
x : -refradx;
304 int maxxr =
x + refradx > imgx ? imgx -
x : refradx;
305 int minyr =
y - refrady < 0 ? -
y : -refrady;
306 int maxyr =
y + refrady > imgy ? imgy -
y : refrady;
310 gausstabx = m_maintabs[refradx - 1];
311 gausstabcentx = gausstabx + refradx;
312 gausstaby = m_maintabs[refrady - 1];
313 gausstabcenty = gausstaby + refrady;
315 sum = gval = rval = bval = aval = 0.0f;
320 val = gausstabcenty[i] * gausstabcentx[j];
322 rval += val * src[0];
323 gval += val * src[1];
324 bval += val * src[2];
325 aval += val * src[3];
339 x =
MAX2(this->m_filtersizex, this->m_filtersizey);
340 for (i = 0; i <
x; i++) {
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[3], 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 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
_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
Read Guarded memory(de)allocation.
Group RGB to Bright Vector Camera CLAMP
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume Image Sky Noise Wave Voronoi Brick Texture Vector Combine Vertex Color
static T sum(const btAlignedObjectArray< T > &items)
SIMD_FORCE_INLINE btScalar norm() const
Return the norm (length) of the vector.
void deinitExecution() override
float * make_gausstab(float rad, int size)
void initExecution() override
SocketReader * m_inputSize
void executePixel(float output[4], int x, int y, void *data) override
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) override
void * initializeTileData(rcti *rect) override
void initExecution() override
GaussianBlurReferenceOperation()
void deinitExecution() override
void deinitExecution() override
void initExecution() override
GaussianBokehBlurOperation()
void executePixel(float output[4], int x, int y, void *data) override
void * initializeTileData(rcti *rect) override
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) override
a MemoryBuffer contains access to the data of a chunk
void readNoCheck(float *result, int x, int y, MemoryBufferExtend extend_x=MemoryBufferExtend::Clip, MemoryBufferExtend extend_y=MemoryBufferExtend::Clip)
const rcti & get_rect() const
get the rect of this MemoryBuffer
const int getWidth() const
get the width of this MemoryBuffer
float * getBuffer()
get the data of this MemoryBuffer
NodeOperation contains calculation logic.
virtual void * initializeTileData(rcti *)
unsigned int getHeight() const
NodeOperation * getInputOperation(unsigned int inputSocketindex)
void read(float result[4], int x, int y, void *chunkData)
unsigned int getWidth() const
virtual bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
DataType
possible data types for sockets
float RE_filter_value(int type, float x)
__kernel void ccl_constant KernelData ccl_global void ccl_global char ccl_global int ccl_global char ccl_global unsigned int ccl_global float * buffer
void(* MEM_freeN)(void *vmemh)
void *(* MEM_mallocN)(size_t len, const char *str)
constexpr int COM_DATA_TYPE_COLOR_CHANNELS
ccl_device_inline float3 ceil(const float3 &a)