Blender  V2.93
COM_VariableSizeBokehBlurOperation.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * Copyright 2011, Blender Foundation.
17  */
18 
19 #pragma once
20 
21 #include "COM_NodeOperation.h"
22 #include "COM_QualityStepHelper.h"
23 
24 namespace blender::compositor {
25 
26 //#define COM_DEFOCUS_SEARCH
27 
29  private:
30  int m_maxBlur;
31  float m_threshold;
32  bool m_do_size_scale; /* scale size, matching 'BokehBlurNode' */
33  SocketReader *m_inputProgram;
34  SocketReader *m_inputBokehProgram;
35  SocketReader *m_inputSizeProgram;
36 #ifdef COM_DEFOCUS_SEARCH
37  SocketReader *m_inputSearchProgram;
38 #endif
39 
40  public:
42 
46  void executePixel(float output[4], int x, int y, void *data) override;
47 
51  void initExecution() override;
52 
53  void *initializeTileData(rcti *rect) override;
54 
55  void deinitializeTileData(rcti *rect, void *data) override;
56 
60  void deinitExecution() override;
61 
63  ReadBufferOperation *readOperation,
64  rcti *output) override;
65 
66  void setMaxBlur(int maxRadius)
67  {
68  this->m_maxBlur = maxRadius;
69  }
70 
71  void setThreshold(float threshold)
72  {
73  this->m_threshold = threshold;
74  }
75 
76  void setDoScaleSize(bool scale_size)
77  {
78  this->m_do_size_scale = scale_size;
79  }
80 
81  void executeOpenCL(OpenCLDevice *device,
82  MemoryBuffer *outputMemoryBuffer,
83  cl_mem clOutputBuffer,
84  MemoryBuffer **inputMemoryBuffers,
85  std::list<cl_mem> *clMemToCleanUp,
86  std::list<cl_kernel> *clKernelsToCleanUp) override;
87 };
88 
89 #ifdef COM_DEFOCUS_SEARCH
90 class InverseSearchRadiusOperation : public NodeOperation {
91  private:
92  int m_maxBlur;
93  SocketReader *m_inputRadius;
94 
95  public:
96  static const int DIVIDER = 4;
97 
98  InverseSearchRadiusOperation();
99 
103  void executePixelChunk(float output[4], int x, int y, void *data);
104 
108  void initExecution() override;
109  void *initializeTileData(rcti *rect) override;
110  void deinitializeTileData(rcti *rect, void *data) override;
111 
115  void deinitExecution() override;
116 
117  bool determineDependingAreaOfInterest(rcti *input,
118  ReadBufferOperation *readOperation,
119  rcti *output) override;
120  void determineResolution(unsigned int resolution[2],
121  unsigned int preferredResolution[2]) override;
122 
123  void setMaxBlur(int maxRadius)
124  {
125  this->m_maxBlur = maxRadius;
126  }
127 };
128 #endif
129 
130 } // namespace blender::compositor
_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
#define output
a MemoryBuffer contains access to the data of a chunk
NodeOperation contains calculation logic.
device representing an GPU OpenCL device. an instance of this class represents a single cl_device
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) override
void executePixel(float output[4], int x, int y, void *data) override
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...
NodeOperation SocketReader