39 this->m_sizeavailable =
false;
40 this->m_inputProgram =
nullptr;
41 this->m_inputBokehProgram =
nullptr;
42 this->m_inputBoundingBoxReader =
nullptr;
44 this->m_extend_bounds =
false;
50 if (!this->m_sizeavailable) {
70 this->m_bokehMidX =
width / 2.0f;
71 this->m_bokehMidY =
height / 2.0f;
72 this->m_bokehDimension = dimension / 2.0f;
79 float tempBoundingBox[4];
83 if (tempBoundingBox[0] > 0.0f) {
84 float multiplier_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f};
88 int bufferwidth = inputBuffer->
getWidth();
89 int bufferstartx = input_rect.
xmin;
90 int bufferstarty = input_rect.
ymin;
92 int pixelSize = this->m_size * max_dim / 100.0f;
97 multiplier_accum[0] = 1.0f;
98 multiplier_accum[1] = 1.0f;
99 multiplier_accum[2] = 1.0f;
100 multiplier_accum[3] = 1.0f;
102 int miny =
y - pixelSize;
103 int maxy =
y + pixelSize;
104 int minx =
x - pixelSize;
105 int maxx =
x + pixelSize;
114 float m = this->m_bokehDimension / pixelSize;
115 for (
int ny = miny;
ny < maxy;
ny += step) {
118 for (
int nx = minx; nx < maxx; nx += step) {
119 float u = this->m_bokehMidX - (nx -
x) * m;
120 float v = this->m_bokehMidY - (
ny -
y) * m;
124 bufferindex += offsetadd;
127 output[0] = color_accum[0] * (1.0f / multiplier_accum[0]);
128 output[1] = color_accum[1] * (1.0f / multiplier_accum[1]);
129 output[2] = color_accum[2] * (1.0f / multiplier_accum[2]);
130 output[3] = color_accum[3] * (1.0f / multiplier_accum[3]);
140 this->m_inputProgram =
nullptr;
141 this->m_inputBokehProgram =
nullptr;
142 this->m_inputBoundingBoxReader =
nullptr;
153 if (this->m_sizeavailable) {
154 newInput.
xmax = input->
xmax + (this->m_size * max_dim / 100.0f);
155 newInput.
xmin = input->
xmin - (this->m_size * max_dim / 100.0f);
156 newInput.
ymax = input->
ymax + (this->m_size * max_dim / 100.0f);
157 newInput.
ymin = input->
ymin - (this->m_size * max_dim / 100.0f);
160 newInput.
xmax = input->
xmax + (10.0f * max_dim / 100.0f);
161 newInput.
xmin = input->
xmin - (10.0f * max_dim / 100.0f);
162 newInput.
ymax = input->
ymax + (10.0f * max_dim / 100.0f);
163 newInput.
ymin = input->
ymin - (10.0f * max_dim / 100.0f);
182 if (!this->m_sizeavailable) {
198 cl_mem clOutputBuffer,
200 std::list<cl_mem> *clMemToCleanUp,
201 std::list<cl_kernel> * )
204 if (!this->m_sizeavailable) {
208 cl_int radius = this->m_size * max_dim / 100.0f;
212 kernel, 0, -1, clMemToCleanUp, inputMemoryBuffers, this->m_inputBoundingBoxReader);
214 kernel, 1, 4, clMemToCleanUp, inputMemoryBuffers, this->m_inputProgram);
216 kernel, 2, -1, clMemToCleanUp, inputMemoryBuffers, this->m_inputBokehProgram);
219 clSetKernelArg(kernel, 6,
sizeof(cl_int), &radius);
220 clSetKernelArg(kernel, 7,
sizeof(cl_int), &step);
226 void BokehBlurOperation::updateSize()
228 if (!this->m_sizeavailable) {
232 CLAMP(this->m_size, 0.0f, 10.0f);
233 this->m_sizeavailable =
true;
238 unsigned int preferredResolution[2])
241 if (this->m_extend_bounds) {
242 const float max_dim =
MAX2(resolution[0], resolution[1]);
243 resolution[0] += 2 * this->m_size * max_dim / 100.0f;
244 resolution[1] += 2 * this->m_size * max_dim / 100.0f;
MINLINE void add_v4_v4(float r[4], const float a[4])
MINLINE void madd_v4_v4v4(float r[4], const float a[4], const float b[4])
MINLINE void zero_v4(float r[4])
_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
Group RGB to Bright Vector Camera CLAMP
ATTR_WARN_UNUSED_RESULT const BMVert * v
void executePixel(float output[4], int x, int y, void *data) override
void deinitExecution() override
void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]) override
determine the resolution of this node
void executeOpenCL(OpenCLDevice *device, MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer **inputMemoryBuffers, std::list< cl_mem > *clMemToCleanUp, std::list< cl_kernel > *clKernelsToCleanUp) override
custom handle to add new tasks to the OpenCL command queue in order to execute a chunk on an GPUDevic...
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) override
void initExecution() override
void * initializeTileData(rcti *rect) override
a MemoryBuffer contains access to the data of a chunk
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 *)
void readSampled(float result[4], float x, float y, PixelSampler sampler)
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
virtual void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2])
determine the resolution of this node
SocketReader * getInputSocketReader(unsigned int inputSocketindex)
virtual bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
device representing an GPU OpenCL device. an instance of this class represents a single cl_device
void COM_clAttachMemoryBufferOffsetToKernelParameter(cl_kernel kernel, int offsetIndex, MemoryBuffer *memoryBuffers)
cl_mem COM_clAttachMemoryBufferToKernelParameter(cl_kernel kernel, int parameterIndex, int offsetIndex, std::list< cl_mem > *cleanup, MemoryBuffer **inputMemoryBuffers, SocketReader *reader)
void COM_clEnqueueRange(cl_kernel kernel, MemoryBuffer *outputMemoryBuffer)
void COM_clAttachOutputMemoryBufferToKernelParameter(cl_kernel kernel, int parameterIndex, cl_mem clOutputMemoryBuffer)
void COM_clAttachSizeToKernelParameter(cl_kernel kernel, int offsetIndex, NodeOperation *operation)
cl_kernel COM_clCreateKernel(const char *kernelname, std::list< cl_kernel > *clKernelsToCleanUp)
void initExecution(QualityHelper helper)
@ None
The bottom left of the input image is the bottom left of the working area of the node,...
__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
constexpr int COM_DATA_TYPE_COLOR_CHANNELS