FFTLIB User Guide
FFTLIB_ifft1d_i32fc_c32fc_o32f_tw_gen.cpp
Go to the documentation of this file.
1 #include <math.h>
2 
4 
5 void ifft_c2r_tw_gen (FFTLIB_F32 *pW, int32_t numPoints)
6 {
7  int32_t i, j, k, t;
8  const double PI = 3.141592654;
9 
10  // since we perform N-point FFT to compute FFT of 2N-point real sequence
11  numPoints >>= 1;
12 
13  t = numPoints >> 2;
14  for (j = 1, k = 0; j <= numPoints >> 2; j = j << 2) {
15  for (i = 0; i<numPoints>> 2; i += j) {
16  /* TODO: Big endian requires different format of Twiddle factors? */
17  pW[k] = (FFTLIB_F32) cos (2 * PI * i / numPoints);
18  pW[k + 1] = (FFTLIB_F32) -sin (2 * PI * i / numPoints);
19  pW[k + 2 * t] = (FFTLIB_F32) cos (4 * PI * i / numPoints);
20  pW[k + 2 * t + 1] = (FFTLIB_F32) -sin (4 * PI * i / numPoints);
21  pW[k + 4 * t] = (FFTLIB_F32) cos (6 * PI * i / numPoints);
22  pW[k + 4 * t + 1] = (FFTLIB_F32) -sin (6 * PI * i / numPoints);
23  k += 2;
24  }
25  k += (t) *4;
26  t = t >> 2;
27  }
28 }
29 
30 void ifft_c2r_split_factor_gen (FFTLIB_F32 *pSf, int32_t numPoints)
31 {
32 
33  int32_t i = 0;
34 
35  const double PI = 3.141592654;
36 
37  for (i = 0; i<numPoints>> 1; i++) {
38  pSf[2 * i] = (FFTLIB_F32) (0.5 * (1 - sin (2 * PI * i / numPoints)));
39  pSf[2 * i + 1] = (FFTLIB_F32) (0.5 * (cos (2 * PI * i / numPoints)));
40 
41  pSf[2 * i + numPoints] =
42  (FFTLIB_F32) (0.5 * (1 + sin (2 * PI * i / numPoints)));
43  pSf[2 * i + numPoints + 1] =
44  (FFTLIB_F32) (0.5 * (-cos (2 * PI * i / numPoints)));
45  }
46 }
void ifft_c2r_split_factor_gen(FFTLIB_F32 *pSf, int32_t numPoints)
void ifft_c2r_tw_gen(FFTLIB_F32 *pW, int32_t numPoints)
float FFTLIB_F32
Single precision floating point.
Definition: FFTLIB_types.h:166