MCPcopy Create free account
hub / github.com/audacity/audacity / InverseRealFFT

Function InverseRealFFT

libraries/lib-fft/FFT.cpp:266–289  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

264 * This is merely a wrapper of InverseRealFFTf() from RealFFTf.h.
265 */
266void 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

Callers 3

CalculateMethod · 0.85
CalcFilterMethod · 0.85
RecalcMethod · 0.85

Calls 4

GetFFTFunction · 0.85
InverseRealFFTfFunction · 0.85
ReorderToTimeFunction · 0.85
getMethod · 0.45

Tested by 1

CalculateMethod · 0.68