72 for (
int i = 0; i < n; i++)
87 for (
int j = 0; j < np; j++)
96 for (
int j = 0; j < np; j++) {
121 #define sqrthalf (float)M_SQRT1_2 123 #define BF(x,y,a,b) {\ 128 #define BUTTERFLIES(a0,a1,a2,a3) {\ 130 BF(a2.re, a0.re, a0.re, t5);\ 131 BF(a3.im, a1.im, a1.im, t3);\ 133 BF(a3.re, a1.re, a1.re, t4);\ 134 BF(a2.im, a0.im, a0.im, t6);\ 140 #define BUTTERFLIES_BIG(a0,a1,a2,a3) {\ 141 float r0=a0.re, i0=a0.im, r1=a1.re, i1=a1.im;\ 143 BF(a2.re, a0.re, r0, t5);\ 144 BF(a3.im, a1.im, i1, t3);\ 146 BF(a3.re, a1.re, r1, t4);\ 147 BF(a2.im, a0.im, i0, t6);\ 150 #define TRANSFORM(a0,a1,a2,a3,wre,wim) {\ 151 t1 = a2.re * wre + a2.im * wim;\ 152 t2 = a2.im * wre - a2.re * wim;\ 153 t5 = a3.re * wre - a3.im * wim;\ 154 t6 = a3.im * wre + a3.re * wim;\ 155 BUTTERFLIES(a0,a1,a2,a3)\ 158 #define TRANSFORM_ZERO(a0,a1,a2,a3) {\ 163 BUTTERFLIES(a0,a1,a2,a3)\ 168 static void name(Complex *z, const float *wre, unsigned int n)\ 170 float t1, t2, t3, t4, t5, t6;\ 174 const float *wim = wre+o1;\ 177 TRANSFORM_ZERO(z[0],z[o1],z[o2],z[o3]);\ 178 TRANSFORM(z[1],z[o1+1],z[o2+1],z[o3+1],wre[1],wim[-1]);\ 183 TRANSFORM(z[0],z[o1],z[o2],z[o3],wre[0],wim[0]);\ 184 TRANSFORM(z[1],z[o1+1],z[o2+1],z[o3+1],wre[1],wim[-1]);\ 190 #define BUTTERFLIES BUTTERFLIES_BIG 193 #define DECL_FFT(t,n,n2,n4)\ 194 static void fft##n(Complex *z)\ 199 pass(z,getCosineTable(t),n4/2);\ 204 float t1, t2, t3, t4, t5, t6, t7, t8;
206 BF(t3, t1, z[0].re, z[1].re);
207 BF(t8, t6, z[3].re, z[2].re);
208 BF(z[2].re, z[0].re, t1, t6);
209 BF(t4, t2, z[0].im, z[1].im);
210 BF(t7, t5, z[2].im, z[3].im);
211 BF(z[3].im, z[1].im, t4, t8);
212 BF(z[3].re, z[1].re, t3, t7);
213 BF(z[2].im, z[0].im, t2, t5);
218 float t1, t2, t3, t4, t5, t6, t7, t8;
222 BF(t1, z[5].re, z[4].re, -z[5].re);
223 BF(t2, z[5].im, z[4].im, -z[5].im);
224 BF(t3, z[7].re, z[6].re, -z[7].re);
225 BF(t4, z[7].im, z[6].im, -z[7].im);
228 BF(z[4].re, z[0].re, z[0].re, t1);
229 BF(z[4].im, z[0].im, z[0].im, t2);
230 BF(z[6].re, z[2].re, z[2].re, t7);
231 BF(z[6].im, z[2].im, z[2].im, t8);
238 float t1, t2, t3, t4, t5, t6;
248 TRANSFORM(z[1],z[5],z[9],z[13],cosTable[1],cosTable[3]);
249 TRANSFORM(z[3],z[7],z[11],z[15],cosTable[3],cosTable[1]);
257 #define pass pass_big
static void fft4(Complex *z)
static void pass(Complex *z, const float *wre, unsigned int n)
static void fft8(Complex *z)
ScopedArray< Complex > _expTab
const uint16 * getRevTab() const
static void fft64(Complex *z)
void reset(PointerType o=0)
Resets the pointer with the new value.
static void fft128(Complex *z)
static void(*const fft_dispatch[])(Complex *)
Utility templates and functions.
#define TRANSFORM(a0, a1, a2, a3, wre, wim)
#define TRANSFORM_ZERO(a0, a1, a2, a3)
static void fft8192(Complex *z)
static void fft2048(Complex *z)
static void fft32(Complex *z)
ScopedArray< uint16 > _revTab
void permute(Complex *z)
Do the permutation needed BEFORE calling calc().
void calc(Complex *z)
Do a complex FFT.
static void fft32768(Complex *z)
static void fft65536(Complex *z)
ScopedArray< Complex > _tmpBuf
PointerType get() const
Returns the plain pointer value.
FFT(int bits, bool inverse)
static void fft512(Complex *z)
static void fft1024(Complex *z)
static glm::mat4 inverse(const glm::mat4 &m)
static int splitRadixPermutation(int i, int n, bool inverse)
static void fft256(Complex *z)
const float * getCosineTable(int bits)
static void fft16(Complex *z)
#define DECL_FFT(t, n, n2, n4)
(Inverse) Fast Fourier Transform.
static void fft16384(Complex *z)
static void fft4096(Complex *z)
void SWAP(T &a, T &b)
Template method which swaps the values of its two parameters.
static void pass_big(Complex *z, const float *wre, unsigned int n)