29 this->m_iirgaus =
nullptr;
53 if (this->m_iirgaus) {
73 if (this->m_iirgaus) {
74 delete this->m_iirgaus;
75 this->m_iirgaus =
nullptr;
83 if (!this->m_iirgaus) {
92 if ((this->m_sx == this->m_sy) && (this->m_sx > 0.0f)) {
98 if (this->m_sx > 0.0f) {
103 if (this->m_sy > 0.0f) {
109 this->m_iirgaus =
copy;
112 return this->m_iirgaus;
120 double q, q2, sc, cf[4], tsM[9], tsu[3], tsv[3];
122 const unsigned int src_width = src->
getWidth();
123 const unsigned int src_height = src->
getHeight();
124 unsigned int x,
y, sz;
134 if ((xy < 1) || (xy > 3)) {
143 if (src_height < 3) {
153 if (sigma >= 3.556f) {
154 q = 0.9804f * (sigma - 3.556f) + 2.5091f;
157 q = (0.0561f * sigma + 0.5784f) * sigma - 0.2568f;
160 sc = (1.1668 + q) * (3.203729649 + (2.21566 + q) * q);
163 cf[1] = q * (5.788961737 + (6.76492 + 3.0 * q) * q) / sc;
164 cf[2] = -q2 * (3.38246 + 3.0 * q) / sc;
167 cf[0] = 1.0 - cf[1] - cf[2] - cf[3];
176 sc = cf[0] / ((1.0 + cf[1] - cf[2] + cf[3]) * (1.0 - cf[1] - cf[2] - cf[3]) *
177 (1.0 + cf[2] + (cf[1] - cf[3]) * cf[3]));
178 tsM[0] = sc * (-cf[3] * cf[1] + 1.0 - cf[3] * cf[3] - cf[2]);
179 tsM[1] = sc * ((cf[3] + cf[1]) * (cf[2] + cf[3] * cf[1]));
180 tsM[2] = sc * (cf[3] * (cf[1] + cf[3] * cf[2]));
181 tsM[3] = sc * (cf[1] + cf[3] * cf[2]);
182 tsM[4] = sc * (-(cf[2] - 1.0) * (cf[2] + cf[3] * cf[1]));
183 tsM[5] = sc * (-(cf[3] * cf[1] + cf[3] * cf[3] + cf[2] - 1.0) * cf[3]);
184 tsM[6] = sc * (cf[3] * cf[1] + cf[2] + cf[1] * cf[1] - cf[2] * cf[2]);
185 tsM[7] = sc * (cf[1] * cf[2] + cf[3] * cf[2] * cf[2] - cf[1] * cf[3] * cf[3] -
186 cf[3] * cf[3] * cf[3] - cf[3] * cf[2] + cf[3]);
187 tsM[8] = sc * (cf[3] * (cf[1] + cf[3] * cf[2]));
191 W[0] = cf[0] * X[0] + cf[1] * X[0] + cf[2] * X[0] + cf[3] * X[0]; \
192 W[1] = cf[0] * X[1] + cf[1] * W[0] + cf[2] * X[0] + cf[3] * X[0]; \
193 W[2] = cf[0] * X[2] + cf[1] * W[1] + cf[2] * W[0] + cf[3] * X[0]; \
194 for (i = 3; i < L; i++) { \
195 W[i] = cf[0] * X[i] + cf[1] * W[i - 1] + cf[2] * W[i - 2] + cf[3] * W[i - 3]; \
197 tsu[0] = W[L - 1] - X[L - 1]; \
198 tsu[1] = W[L - 2] - X[L - 1]; \
199 tsu[2] = W[L - 3] - X[L - 1]; \
200 tsv[0] = tsM[0] * tsu[0] + tsM[1] * tsu[1] + tsM[2] * tsu[2] + X[L - 1]; \
201 tsv[1] = tsM[3] * tsu[0] + tsM[4] * tsu[1] + tsM[5] * tsu[2] + X[L - 1]; \
202 tsv[2] = tsM[6] * tsu[0] + tsM[7] * tsu[1] + tsM[8] * tsu[2] + X[L - 1]; \
203 Y[L - 1] = cf[0] * W[L - 1] + cf[1] * tsv[0] + cf[2] * tsv[1] + cf[3] * tsv[2]; \
204 Y[L - 2] = cf[0] * W[L - 2] + cf[1] * Y[L - 1] + cf[2] * tsv[0] + cf[3] * tsv[1]; \
205 Y[L - 3] = cf[0] * W[L - 3] + cf[1] * Y[L - 2] + cf[2] * Y[L - 1] + cf[3] * tsv[0]; \
207 for (i = L - 4; i != UINT_MAX; i--) { \
208 Y[i] = cf[0] * W[i] + cf[1] * Y[i + 1] + cf[2] * Y[i + 2] + cf[3] * Y[i + 3]; \
214 sz =
MAX2(src_width, src_height);
215 X = (
double *)
MEM_callocN(sz *
sizeof(
double),
"IIR_gauss X buf");
216 Y = (
double *)
MEM_callocN(sz *
sizeof(
double),
"IIR_gauss Y buf");
217 W = (
double *)
MEM_callocN(sz *
sizeof(
double),
"IIR_gauss W buf");
220 for (
y = 0;
y < src_height;
y++) {
221 const int yx =
y * src_width;
222 offset = yx * num_channels + chan;
223 for (
x = 0;
x < src_width;
x++) {
225 offset += num_channels;
228 offset = yx * num_channels + chan;
229 for (
x = 0;
x < src_width;
x++) {
231 offset += num_channels;
237 const int add = src_width * num_channels;
239 for (
x = 0;
x < src_width;
x++) {
240 offset =
x * num_channels + chan;
241 for (
y = 0;
y < src_height;
y++) {
246 offset =
x * num_channels + chan;
247 for (
y = 0;
y < src_height;
y++) {
265 this->m_iirgaus =
nullptr;
266 this->m_inputprogram =
nullptr;
267 this->m_sigma = 1.0f;
283 if (this->m_iirgaus) {
303 if (this->m_iirgaus) {
304 delete this->m_iirgaus;
305 this->m_iirgaus =
nullptr;
313 if (!this->m_iirgaus) {
320 float *dst =
copy->getBuffer();
321 for (
int i =
copy->getWidth() *
copy->getHeight(); i != 0;
330 float *dst =
copy->getBuffer();
331 for (
int i =
copy->getWidth() *
copy->getHeight(); i != 0;
341 this->m_iirgaus =
copy;
344 return this->m_iirgaus;
_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 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
void initExecution() override
SocketReader * m_inputProgram
void * initializeTileData(rcti *rect) override
void executePixel(float output[4], int x, int y, void *data) override
calculate a single pixel
void initExecution() override
FastGaussianBlurOperation()
void deinitExecution() override
static void IIR_gauss(MemoryBuffer *src, float sigma, unsigned int channel, unsigned int xy)
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) override
void * initializeTileData(rcti *rect) override
void deinitExecution() override
FastGaussianBlurValueOperation()
void initExecution() override
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) override
void executePixel(float output[4], int x, int y, void *data) override
calculate a single pixel
a MemoryBuffer contains access to the data of a chunk
void read(float *result, int x, int y, MemoryBufferExtend extend_x=MemoryBufferExtend::Clip, MemoryBufferExtend extend_y=MemoryBufferExtend::Clip)
const int getHeight() const
get the height of this MemoryBuffer
uint8_t get_num_channels()
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
void addInputSocket(DataType datatype, ResizeMode resize_mode=ResizeMode::Center)
NodeOperation * getInputOperation(unsigned int inputSocketindex)
void addOutputSocket(DataType datatype)
unsigned int getWidth() const
SocketReader * getInputSocketReader(unsigned int inputSocketindex)
virtual bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
DataType
possible data types for sockets
__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_callocN)(size_t len, const char *str)
static void add(GHash *messages, MemArena *memarena, const Message *msg)
constexpr int COM_DATA_TYPE_VALUE_CHANNELS
constexpr int COM_DATA_TYPE_COLOR_CHANNELS
static void copy(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node)