| 226 | */ |
| 227 | |
| 228 | void RealFFT(size_t NumSamples, const float *RealIn, float *RealOut, float *ImagOut) |
| 229 | { |
| 230 | auto hFFT = GetFFT(NumSamples); |
| 231 | Floats pFFT{ NumSamples }; |
| 232 | // Copy the data into the processing buffer |
| 233 | for(size_t i = 0; i < NumSamples; i++) |
| 234 | pFFT[i] = RealIn[i]; |
| 235 | |
| 236 | // Perform the FFT |
| 237 | RealFFTf(pFFT.get(), hFFT.get()); |
| 238 | |
| 239 | // Copy the data into the real and imaginary outputs |
| 240 | for (size_t i = 1; i<(NumSamples / 2); i++) { |
| 241 | RealOut[i]=pFFT[hFFT->BitReversed[i] ]; |
| 242 | ImagOut[i]=pFFT[hFFT->BitReversed[i]+1]; |
| 243 | } |
| 244 | // Handle the (real-only) DC and Fs/2 bins |
| 245 | RealOut[0] = pFFT[0]; |
| 246 | RealOut[NumSamples / 2] = pFFT[1]; |
| 247 | ImagOut[0] = ImagOut[NumSamples / 2] = 0; |
| 248 | // Fill in the upper half using symmetry properties |
| 249 | for(size_t i = NumSamples / 2 + 1; i < NumSamples; i++) { |
| 250 | RealOut[i] = RealOut[NumSamples-i]; |
| 251 | ImagOut[i] = -ImagOut[NumSamples-i]; |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | /* |
| 256 | * InverseRealFFT |