31 static unsigned int nextPow2(
unsigned int x,
unsigned int *L2)
33 unsigned int pw, x_notpow2 =
x & (
x - 1);
50 static unsigned int revbin_upd(
unsigned int r,
unsigned int h)
52 while (!((
r ^= h) & h)) {
60 double tt, fc, dc, fs, ds,
a =
M_PI;
62 int n2, bd, bl, istep, k,
len = 1 <<
M, n = 1;
65 unsigned int Nh =
len >> 1;
66 for (i = 1; i < (
len - 1); i++) {
79 for (k = 0; k <
len; k += istep) {
81 data_n[k] =
data[k] - t1;
88 fs = ds =
sqrt(1.0 - fc * fc);
90 for (bl = 1; bl < n2; bl++) {
91 fREAL *data_nbd = &data_n[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;
101 tt = fc * dc - fs * ds;
102 fs = fs * dc + fc * ds;
109 for (k = n2; k <
len; k += istep) {
111 data_n[k] =
data[k] - t1;
122 for (k = 0; k <
len; k++) {
132 fREAL *
data,
unsigned int Mx,
unsigned int My,
unsigned int nzp,
unsigned int inverse)
134 unsigned int i, j, Nx, Ny, maxy;
141 for (j = 0; j < maxy; j++) {
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);
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)) {
164 for (k = i, j =
PRED(i); j != i; k = j, j =
PRED(j), stm--) {
172 SWAP(
unsigned int, Nx, Ny);
173 SWAP(
unsigned int, Mx, My);
176 for (j = 0; j < Ny; j++) {
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);
192 data[ji + i] =
A - E;
193 data[jmi + i] =
B + E;
194 data[ji + im] =
C + E;
195 data[jmi + im] =
D - E;
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);
214 d1[m2 + mn2] *= d2[m2 + mn2];
215 for (i = 1; i < m2; 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;
226 for (j = 1; j < n2; j++) {
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;
239 for (i = 1; i < m2; i++) {
241 for (j = 1; j < n2; j++) {
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;
261 unsigned int w2, h2, hw, hh, log2_w, log2_h;
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();
279 w2 = 2 * kernelWidth - 1;
280 h2 = 2 * kernelHeight - 1;
290 wt[0] = wt[1] = wt[2] = 0.0f;
291 for (
y = 0;
y < kernelHeight;
y++) {
293 for (
x = 0;
x < kernelWidth;
x++) {
298 wt[0] = 1.0f / wt[0];
301 wt[1] = 1.0f / wt[1];
304 wt[2] = 1.0f / wt[2];
306 for (
y = 0;
y < kernelHeight;
y++) {
308 for (
x = 0;
x < kernelWidth;
x++) {
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) {
325 nyb = imageHeight / ybsz;
326 if (imageHeight % ybsz) {
329 for (ybl = 0; ybl < nyb; ybl++) {
330 for (xbl = 0; xbl < nxb; xbl++) {
333 for (ch = 0; ch < 3; ch++) {
339 for (
y = 0;
y < kernelHeight;
y++) {
340 fp = &data1ch[
y * w2];
342 for (
x = 0;
x < kernelWidth;
x++) {
350 for (
y = 0;
y < ybsz;
y++) {
351 int yy = ybl * ybsz +
y;
352 if (yy >= imageHeight) {
357 for (
x = 0;
x < xbsz;
x++) {
358 int xx = xbl * xbsz +
x;
359 if (xx >= imageWidth) {
362 fp[
x] = colp[xx][ch];
369 FHT2D(data1ch, log2_w, log2_h, kernelHeight + 1, 0);
371 FHT2D(
data2, log2_w, log2_h, kernelHeight + 1, 0);
380 for (
y = 0;
y < (int)h2;
y++) {
381 const int yy = ybl * ybsz +
y - hh;
382 if ((yy < 0) || (yy >= imageHeight)) {
387 for (
x = 0;
x < (int)w2;
x++) {
388 const int xx = xbl * xbsz +
x - hw;
389 if ((xx < 0) || (xx >= imageWidth)) {
392 colp[xx][ch] += fp[
x];
413 float scale, u,
v,
r,
w, d;
416 unsigned int sz = 1 << settings->
size;
417 const float cs_r = 1.0f, cs_g = 1.0f, cs_b = 1.0f;
425 scale = 0.25f *
sqrtf((
float)(sz * sz));
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;
433 fcol[0] =
expf(d * cs_r);
434 fcol[1] =
expf(d * cs_g);
435 fcol[2] =
expf(d * cs_b);
typedef float(TangentPoint)[2]
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)
typedef double(DMatrix)[4][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 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.
ATTR_WARN_UNUSED_RESULT const BMVert * v
btMatrix3x3 inverse() const
Return the inverse of the matrix.
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
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]
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
static void FHT2D(fREAL *data, unsigned int Mx, unsigned int My, unsigned int nzp, unsigned int inverse)
constexpr int COM_DATA_TYPE_COLOR_CHANNELS
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)