* InverseRealFFT * * This function computes the inverse of RealFFT, above. * The RealIn and ImagIn is assumed to be conjugate-symmetric * and as a result the output is purely real. * Only the first half of RealIn and ImagIn are used due to this * symmetry assumption. * * This is merely a wrapper of InverseRealFFTf() from RealFFTf.h. */
| 264 | * This is merely a wrapper of InverseRealFFTf() from RealFFTf.h. |
| 265 | */ |
| 266 | void InverseRealFFT(size_t NumSamples, const float *RealIn, const float *ImagIn, |
| 267 | float *RealOut) |
| 268 | { |
| 269 | auto hFFT = GetFFT(NumSamples); |
| 270 | Floats pFFT{ NumSamples }; |
| 271 | // Copy the data into the processing buffer |
| 272 | for (size_t i = 0; i < (NumSamples / 2); i++) |
| 273 | pFFT[2*i ] = RealIn[i]; |
| 274 | if(ImagIn == NULL) { |
| 275 | for (size_t i = 0; i < (NumSamples / 2); i++) |
| 276 | pFFT[2*i+1] = 0; |
| 277 | } else { |
| 278 | for (size_t i = 0; i < (NumSamples / 2); i++) |
| 279 | pFFT[2*i+1] = ImagIn[i]; |
| 280 | } |
| 281 | // Put the fs/2 component in the imaginary part of the DC bin |
| 282 | pFFT[1] = RealIn[NumSamples / 2]; |
| 283 | |
| 284 | // Perform the FFT |
| 285 | InverseRealFFTf(pFFT.get(), hFFT.get()); |
| 286 | |
| 287 | // Copy the data to the (purely real) output buffer |
| 288 | ReorderToTime(hFFT.get(), pFFT.get(), RealOut); |
| 289 | } |
| 290 | |
| 291 | /* |
| 292 | * PowerSpectrum |