Blender  V2.93
COM_GlareFogGlowOperation.cc
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 
20 #include "MEM_guardedalloc.h"
21 
22 namespace blender::compositor {
23 
24 /*
25  * 2D Fast Hartley Transform, used for convolution
26  */
27 
28 using fREAL = float;
29 
30 // returns next highest power of 2 of x, as well its log2 in L2
31 static unsigned int nextPow2(unsigned int x, unsigned int *L2)
32 {
33  unsigned int pw, x_notpow2 = x & (x - 1);
34  *L2 = 0;
35  while (x >>= 1) {
36  ++(*L2);
37  }
38  pw = 1 << (*L2);
39  if (x_notpow2) {
40  (*L2)++;
41  pw <<= 1;
42  }
43  return pw;
44 }
45 
46 //------------------------------------------------------------------------------
47 
48 // from FXT library by Joerg Arndt, faster in order bitreversal
49 // use: r = revbin_upd(r, h) where h = N>>1
50 static unsigned int revbin_upd(unsigned int r, unsigned int h)
51 {
52  while (!((r ^= h) & h)) {
53  h >>= 1;
54  }
55  return r;
56 }
57 //------------------------------------------------------------------------------
58 static void FHT(fREAL *data, unsigned int M, unsigned int inverse)
59 {
60  double tt, fc, dc, fs, ds, a = M_PI;
61  fREAL t1, t2;
62  int n2, bd, bl, istep, k, len = 1 << M, n = 1;
63 
64  int i, j = 0;
65  unsigned int Nh = len >> 1;
66  for (i = 1; i < (len - 1); i++) {
67  j = revbin_upd(j, Nh);
68  if (j > i) {
69  t1 = data[i];
70  data[i] = data[j];
71  data[j] = t1;
72  }
73  }
74 
75  do {
76  fREAL *data_n = &data[n];
77 
78  istep = n << 1;
79  for (k = 0; k < len; k += istep) {
80  t1 = data_n[k];
81  data_n[k] = data[k] - t1;
82  data[k] += t1;
83  }
84 
85  n2 = n >> 1;
86  if (n > 2) {
87  fc = dc = cos(a);
88  fs = ds = sqrt(1.0 - fc * fc); // sin(a);
89  bd = n - 2;
90  for (bl = 1; bl < n2; bl++) {
91  fREAL *data_nbd = &data_n[bd];
92  fREAL *data_bd = &data[bd];
93  for (k = bl; k < len; k += istep) {
94  t1 = fc * (double)data_n[k] + fs * (double)data_nbd[k];
95  t2 = fs * (double)data_n[k] - fc * (double)data_nbd[k];
96  data_n[k] = data[k] - t1;
97  data_nbd[k] = data_bd[k] - t2;
98  data[k] += t1;
99  data_bd[k] += t2;
100  }
101  tt = fc * dc - fs * ds;
102  fs = fs * dc + fc * ds;
103  fc = tt;
104  bd -= 2;
105  }
106  }
107 
108  if (n > 1) {
109  for (k = n2; k < len; k += istep) {
110  t1 = data_n[k];
111  data_n[k] = data[k] - t1;
112  data[k] += t1;
113  }
114  }
115 
116  n = istep;
117  a *= 0.5;
118  } while (n < len);
119 
120  if (inverse) {
121  fREAL sc = (fREAL)1 / (fREAL)len;
122  for (k = 0; k < len; k++) {
123  data[k] *= sc;
124  }
125  }
126 }
127 //------------------------------------------------------------------------------
128 /* 2D Fast Hartley Transform, Mx/My -> log2 of width/height,
129  * nzp -> the row where zero pad data starts,
130  * inverse -> see above */
131 static void FHT2D(
132  fREAL *data, unsigned int Mx, unsigned int My, unsigned int nzp, unsigned int inverse)
133 {
134  unsigned int i, j, Nx, Ny, maxy;
135 
136  Nx = 1 << Mx;
137  Ny = 1 << My;
138 
139  // rows (forward transform skips 0 pad data)
140  maxy = inverse ? Ny : nzp;
141  for (j = 0; j < maxy; j++) {
142  FHT(&data[Nx * j], Mx, inverse);
143  }
144 
145  // transpose data
146  if (Nx == Ny) { // square
147  for (j = 0; j < Ny; j++) {
148  for (i = j + 1; i < Nx; i++) {
149  unsigned int op = i + (j << Mx), np = j + (i << My);
150  SWAP(fREAL, data[op], data[np]);
151  }
152  }
153  }
154  else { // rectangular
155  unsigned int k, Nym = Ny - 1, stm = 1 << (Mx + My);
156  for (i = 0; stm > 0; i++) {
157 #define PRED(k) (((k & Nym) << Mx) + (k >> My))
158  for (j = PRED(i); j > i; j = PRED(j)) {
159  /* pass */
160  }
161  if (j < i) {
162  continue;
163  }
164  for (k = i, j = PRED(i); j != i; k = j, j = PRED(j), stm--) {
165  SWAP(fREAL, data[j], data[k]);
166  }
167 #undef PRED
168  stm--;
169  }
170  }
171 
172  SWAP(unsigned int, Nx, Ny);
173  SWAP(unsigned int, Mx, My);
174 
175  // now columns == transposed rows
176  for (j = 0; j < Ny; j++) {
177  FHT(&data[Nx * j], Mx, inverse);
178  }
179 
180  // finalize
181  for (j = 0; j <= (Ny >> 1); j++) {
182  unsigned int jm = (Ny - j) & (Ny - 1);
183  unsigned int ji = j << Mx;
184  unsigned int jmi = jm << Mx;
185  for (i = 0; i <= (Nx >> 1); i++) {
186  unsigned int im = (Nx - i) & (Nx - 1);
187  fREAL A = data[ji + i];
188  fREAL B = data[jmi + i];
189  fREAL C = data[ji + im];
190  fREAL D = data[jmi + im];
191  fREAL E = (fREAL)0.5 * ((A + D) - (B + C));
192  data[ji + i] = A - E;
193  data[jmi + i] = B + E;
194  data[ji + im] = C + E;
195  data[jmi + im] = D - E;
196  }
197  }
198 }
199 
200 //------------------------------------------------------------------------------
201 
202 /* 2D convolution calc, d1 *= d2, M/N - > log2 of width/height */
203 static void fht_convolve(fREAL *d1, const fREAL *d2, unsigned int M, unsigned int N)
204 {
205  fREAL a, b;
206  unsigned int i, j, k, L, mj, mL;
207  unsigned int m = 1 << M, n = 1 << N;
208  unsigned int m2 = 1 << (M - 1), n2 = 1 << (N - 1);
209  unsigned int mn2 = m << (N - 1);
210 
211  d1[0] *= d2[0];
212  d1[mn2] *= d2[mn2];
213  d1[m2] *= d2[m2];
214  d1[m2 + mn2] *= d2[m2 + mn2];
215  for (i = 1; i < m2; i++) {
216  k = m - i;
217  a = d1[i] * d2[i] - d1[k] * d2[k];
218  b = d1[k] * d2[i] + d1[i] * d2[k];
219  d1[i] = (b + a) * (fREAL)0.5;
220  d1[k] = (b - a) * (fREAL)0.5;
221  a = d1[i + mn2] * d2[i + mn2] - d1[k + mn2] * d2[k + mn2];
222  b = d1[k + mn2] * d2[i + mn2] + d1[i + mn2] * d2[k + mn2];
223  d1[i + mn2] = (b + a) * (fREAL)0.5;
224  d1[k + mn2] = (b - a) * (fREAL)0.5;
225  }
226  for (j = 1; j < n2; j++) {
227  L = n - j;
228  mj = j << M;
229  mL = L << M;
230  a = d1[mj] * d2[mj] - d1[mL] * d2[mL];
231  b = d1[mL] * d2[mj] + d1[mj] * d2[mL];
232  d1[mj] = (b + a) * (fREAL)0.5;
233  d1[mL] = (b - a) * (fREAL)0.5;
234  a = d1[m2 + mj] * d2[m2 + mj] - d1[m2 + mL] * d2[m2 + mL];
235  b = d1[m2 + mL] * d2[m2 + mj] + d1[m2 + mj] * d2[m2 + mL];
236  d1[m2 + mj] = (b + a) * (fREAL)0.5;
237  d1[m2 + mL] = (b - a) * (fREAL)0.5;
238  }
239  for (i = 1; i < m2; i++) {
240  k = m - i;
241  for (j = 1; j < n2; j++) {
242  L = n - j;
243  mj = j << M;
244  mL = L << M;
245  a = d1[i + mj] * d2[i + mj] - d1[k + mL] * d2[k + mL];
246  b = d1[k + mL] * d2[i + mj] + d1[i + mj] * d2[k + mL];
247  d1[i + mj] = (b + a) * (fREAL)0.5;
248  d1[k + mL] = (b - a) * (fREAL)0.5;
249  a = d1[i + mL] * d2[i + mL] - d1[k + mj] * d2[k + mj];
250  b = d1[k + mj] * d2[i + mL] + d1[i + mL] * d2[k + mj];
251  d1[i + mL] = (b + a) * (fREAL)0.5;
252  d1[k + mj] = (b - a) * (fREAL)0.5;
253  }
254  }
255 }
256 //------------------------------------------------------------------------------
257 
258 static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2)
259 {
260  fREAL *data1, *data2, *fp;
261  unsigned int w2, h2, hw, hh, log2_w, log2_h;
262  fRGB wt, *colp;
263  int x, y, ch;
264  int xbl, ybl, nxb, nyb, xbsz, ybsz;
265  bool in2done = false;
266  const unsigned int kernelWidth = in2->getWidth();
267  const unsigned int kernelHeight = in2->getHeight();
268  const unsigned int imageWidth = in1->getWidth();
269  const unsigned int imageHeight = in1->getHeight();
270  float *kernelBuffer = in2->getBuffer();
271  float *imageBuffer = in1->getBuffer();
272 
273  MemoryBuffer *rdst = new MemoryBuffer(DataType::Color, in1->get_rect());
274  memset(rdst->getBuffer(),
275  0,
276  rdst->getWidth() * rdst->getHeight() * COM_DATA_TYPE_COLOR_CHANNELS * sizeof(float));
277 
278  // convolution result width & height
279  w2 = 2 * kernelWidth - 1;
280  h2 = 2 * kernelHeight - 1;
281  // FFT pow2 required size & log2
282  w2 = nextPow2(w2, &log2_w);
283  h2 = nextPow2(h2, &log2_h);
284 
285  // alloc space
286  data1 = (fREAL *)MEM_callocN(3 * w2 * h2 * sizeof(fREAL), "convolve_fast FHT data1");
287  data2 = (fREAL *)MEM_callocN(w2 * h2 * sizeof(fREAL), "convolve_fast FHT data2");
288 
289  // normalize convolutor
290  wt[0] = wt[1] = wt[2] = 0.0f;
291  for (y = 0; y < kernelHeight; y++) {
292  colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_DATA_TYPE_COLOR_CHANNELS];
293  for (x = 0; x < kernelWidth; x++) {
294  add_v3_v3(wt, colp[x]);
295  }
296  }
297  if (wt[0] != 0.0f) {
298  wt[0] = 1.0f / wt[0];
299  }
300  if (wt[1] != 0.0f) {
301  wt[1] = 1.0f / wt[1];
302  }
303  if (wt[2] != 0.0f) {
304  wt[2] = 1.0f / wt[2];
305  }
306  for (y = 0; y < kernelHeight; y++) {
307  colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_DATA_TYPE_COLOR_CHANNELS];
308  for (x = 0; x < kernelWidth; x++) {
309  mul_v3_v3(colp[x], wt);
310  }
311  }
312 
313  // copy image data, unpacking interleaved RGBA into separate channels
314  // only need to calc data1 once
315 
316  // block add-overlap
317  hw = kernelWidth >> 1;
318  hh = kernelHeight >> 1;
319  xbsz = (w2 + 1) - kernelWidth;
320  ybsz = (h2 + 1) - kernelHeight;
321  nxb = imageWidth / xbsz;
322  if (imageWidth % xbsz) {
323  nxb++;
324  }
325  nyb = imageHeight / ybsz;
326  if (imageHeight % ybsz) {
327  nyb++;
328  }
329  for (ybl = 0; ybl < nyb; ybl++) {
330  for (xbl = 0; xbl < nxb; xbl++) {
331 
332  // each channel one by one
333  for (ch = 0; ch < 3; ch++) {
334  fREAL *data1ch = &data1[ch * w2 * h2];
335 
336  // only need to calc fht data from in2 once, can re-use for every block
337  if (!in2done) {
338  // in2, channel ch -> data1
339  for (y = 0; y < kernelHeight; y++) {
340  fp = &data1ch[y * w2];
341  colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_DATA_TYPE_COLOR_CHANNELS];
342  for (x = 0; x < kernelWidth; x++) {
343  fp[x] = colp[x][ch];
344  }
345  }
346  }
347 
348  // in1, channel ch -> data2
349  memset(data2, 0, w2 * h2 * sizeof(fREAL));
350  for (y = 0; y < ybsz; y++) {
351  int yy = ybl * ybsz + y;
352  if (yy >= imageHeight) {
353  continue;
354  }
355  fp = &data2[y * w2];
356  colp = (fRGB *)&imageBuffer[yy * imageWidth * COM_DATA_TYPE_COLOR_CHANNELS];
357  for (x = 0; x < xbsz; x++) {
358  int xx = xbl * xbsz + x;
359  if (xx >= imageWidth) {
360  continue;
361  }
362  fp[x] = colp[xx][ch];
363  }
364  }
365 
366  // forward FHT
367  // zero pad data start is different for each == height+1
368  if (!in2done) {
369  FHT2D(data1ch, log2_w, log2_h, kernelHeight + 1, 0);
370  }
371  FHT2D(data2, log2_w, log2_h, kernelHeight + 1, 0);
372 
373  // FHT2D transposed data, row/col now swapped
374  // convolve & inverse FHT
375  fht_convolve(data2, data1ch, log2_h, log2_w);
376  FHT2D(data2, log2_h, log2_w, 0, 1);
377  // data again transposed, so in order again
378 
379  // overlap-add result
380  for (y = 0; y < (int)h2; y++) {
381  const int yy = ybl * ybsz + y - hh;
382  if ((yy < 0) || (yy >= imageHeight)) {
383  continue;
384  }
385  fp = &data2[y * w2];
386  colp = (fRGB *)&rdst->getBuffer()[yy * imageWidth * COM_DATA_TYPE_COLOR_CHANNELS];
387  for (x = 0; x < (int)w2; x++) {
388  const int xx = xbl * xbsz + x - hw;
389  if ((xx < 0) || (xx >= imageWidth)) {
390  continue;
391  }
392  colp[xx][ch] += fp[x];
393  }
394  }
395  }
396  in2done = true;
397  }
398  }
399 
400  MEM_freeN(data2);
401  MEM_freeN(data1);
402  memcpy(dst,
403  rdst->getBuffer(),
404  sizeof(float) * imageWidth * imageHeight * COM_DATA_TYPE_COLOR_CHANNELS);
405  delete (rdst);
406 }
407 
409  MemoryBuffer *inputTile,
410  NodeGlare *settings)
411 {
412  int x, y;
413  float scale, u, v, r, w, d;
414  fRGB fcol;
415  MemoryBuffer *ckrn;
416  unsigned int sz = 1 << settings->size;
417  const float cs_r = 1.0f, cs_g = 1.0f, cs_b = 1.0f;
418 
419  // temp. src image
420  // make the convolution kernel
421  rcti kernelRect;
422  BLI_rcti_init(&kernelRect, 0, sz, 0, sz);
423  ckrn = new MemoryBuffer(DataType::Color, kernelRect);
424 
425  scale = 0.25f * sqrtf((float)(sz * sz));
426 
427  for (y = 0; y < sz; y++) {
428  v = 2.0f * (y / (float)sz) - 1.0f;
429  for (x = 0; x < sz; x++) {
430  u = 2.0f * (x / (float)sz) - 1.0f;
431  r = (u * u + v * v) * scale;
432  d = -sqrtf(sqrtf(sqrtf(r))) * 9.0f;
433  fcol[0] = expf(d * cs_r);
434  fcol[1] = expf(d * cs_g);
435  fcol[2] = expf(d * cs_b);
436  // linear window good enough here, visual result counts, not scientific analysis
437  // w = (1.0f-fabs(u))*(1.0f-fabs(v));
438  // actually, Hanning window is ok, cos^2 for some reason is slower
439  w = (0.5f + 0.5f * cosf(u * (float)M_PI)) * (0.5f + 0.5f * cosf(v * (float)M_PI));
440  mul_v3_fl(fcol, w);
441  ckrn->writePixel(x, y, fcol);
442  }
443  }
444 
445  convolve(data, inputTile, ckrn);
446  delete ckrn;
447 }
448 
449 } // namespace blender::compositor
typedef float(TangentPoint)[2]
#define D
sqrt(x)+1/max(0
#define M_PI
Definition: BLI_math_base.h:38
MINLINE void mul_v3_v3(float r[3], const float a[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void add_v3_v3(float r[3], const float a[3])
void BLI_rcti_init(struct rcti *rect, int xmin, int xmax, int ymin, int ymax)
Definition: rct.c:446
#define SWAP(type, a, b)
typedef double(DMatrix)[4][4]
#define PRED(k)
_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 GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_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.
#define C
Definition: RandGen.cpp:39
ATTR_WARN_UNUSED_RESULT const BMVert * v
#define A
btMatrix3x3 inverse() const
Return the inverse of the matrix.
Definition: btTransform.h:182
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition: btQuadWord.h:119
void generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings) override
a MemoryBuffer contains access to the data of a chunk
void writePixel(int x, int y, const float color[4])
const rcti & get_rect() const
get the rect of this MemoryBuffer
const int getHeight() const
get the height of this MemoryBuffer
const int getWidth() const
get the width of this MemoryBuffer
float * getBuffer()
get the data of this MemoryBuffer
static const float data2[18 *GP_PRIM_DATABUF_SIZE]
static const float data1[33 *GP_PRIM_DATABUF_SIZE]
#define cosf(x)
#define expf(x)
#define sqrtf(x)
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
#define M
#define B
#define L
static unsigned a[3]
Definition: RandGen.cpp:92
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
Definition: rall1d.h:319
static void FHT2D(fREAL *data, unsigned int Mx, unsigned int My, unsigned int nzp, unsigned int inverse)
constexpr int COM_DATA_TYPE_COLOR_CHANNELS
Definition: COM_defines.h:53
static void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2)
static unsigned int nextPow2(unsigned int x, unsigned int *L2)
static void FHT(fREAL *data, unsigned int M, unsigned int inverse)
static unsigned int revbin_upd(unsigned int r, unsigned int h)
static void fht_convolve(fREAL *d1, const fREAL *d2, unsigned int M, unsigned int N)
params N
char angle size
uint len