FastLED 3.9.15
Loading...
Searching...
No Matches

◆ kiss_fftr()

void kiss_fftr ( kiss_fftr_cfg st,
const kiss_fft_scalar * timedata,
kiss_fft_cpx * freqdata )

Definition at line 67 of file kiss_fftr.c.

68{
69 /* input buffer timedata is stored row-wise */
70 int k,ncfft;
71 kiss_fft_cpx fpnk,fpk,f1k,f2k,tw,tdc;
72
73 if ( st->substate->inverse) {
74 fprintf(stderr,"kiss fft usage error: improper alloc\n");
75 exit(1);
76 }
77
78 ncfft = st->substate->nfft;
79
80 /*perform the parallel fft of two real signals packed in real,imag*/
81 kiss_fft( st->substate , (const kiss_fft_cpx*)timedata, st->tmpbuf );
82 /* The real part of the DC element of the frequency spectrum in st->tmpbuf
83 * contains the sum of the even-numbered elements of the input time sequence
84 * The imag part is the sum of the odd-numbered elements
85 *
86 * The sum of tdc.r and tdc.i is the sum of the input time sequence.
87 * yielding DC of input time sequence
88 * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1...
89 * yielding Nyquist bin of input time sequence
90 */
91
92 tdc.r = st->tmpbuf[0].r;
93 tdc.i = st->tmpbuf[0].i;
94 C_FIXDIV(tdc,2);
95 CHECK_OVERFLOW_OP(tdc.r ,+, tdc.i);
96 CHECK_OVERFLOW_OP(tdc.r ,-, tdc.i);
97 freqdata[0].r = tdc.r + tdc.i;
98 freqdata[ncfft].r = tdc.r - tdc.i;
99#ifdef USE_SIMD
100 freqdata[ncfft].i = freqdata[0].i = _mm_set1_ps(0);
101#else
102 freqdata[ncfft].i = freqdata[0].i = 0;
103#endif
104
105 for ( k=1;k <= ncfft/2 ; ++k ) {
106 fpk = st->tmpbuf[k];
107 fpnk.r = st->tmpbuf[ncfft-k].r;
108 fpnk.i = - st->tmpbuf[ncfft-k].i;
109 C_FIXDIV(fpk,2);
110 C_FIXDIV(fpnk,2);
111
112 C_ADD( f1k, fpk , fpnk );
113 C_SUB( f2k, fpk , fpnk );
114 C_MUL( tw , f2k , st->super_twiddles[k-1]);
115
116 freqdata[k].r = HALF_OF(f1k.r + tw.r);
117 freqdata[k].i = HALF_OF(f1k.i + tw.i);
118 freqdata[ncfft-k].r = HALF_OF(f1k.r - tw.r);
119 freqdata[ncfft-k].i = HALF_OF(tw.i - f1k.i);
120 }
121}
#define C_FIXDIV(c, div)
#define HALF_OF(x)
#define C_ADD(res, a, b)
#define CHECK_OVERFLOW_OP(a, op, b)
#define C_SUB(res, a, b)
#define C_MUL(m, a, b)
void kiss_fft(kiss_fft_cfg cfg, const kiss_fft_cpx *fin, kiss_fft_cpx *fout)
Definition kiss_fft.c:379
kiss_fft_scalar r
Definition kiss_fft.h:73
kiss_fft_scalar i
Definition kiss_fft.h:74
kiss_fft_cfg substate
Definition kiss_fftr.c:13
kiss_fft_cpx * tmpbuf
Definition kiss_fftr.c:14
kiss_fft_cpx * super_twiddles
Definition kiss_fftr.c:15

References C_ADD, C_FIXDIV, C_MUL, C_SUB, CHECK_OVERFLOW_OP, HALF_OF, kiss_fft_cpx::i, kiss_fft_state::inverse, kiss_fft(), kiss_fft_scalar, kiss_fft_state::nfft, kiss_fft_cpx::r, kiss_fftr_state::substate, kiss_fftr_state::super_twiddles, and kiss_fftr_state::tmpbuf.

Referenced by _generate_kernel(), and fl::FFTContext::fft_unit_test().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: