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

Function RealFFT

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

Source from the content-addressed store, hash-verified

226 */
227
228void 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

Callers 4

CalculateMethod · 0.85
ComputeSpectrumFunction · 0.85
processMethod · 0.85
CalcFilterMethod · 0.85

Calls 3

GetFFTFunction · 0.85
RealFFTfFunction · 0.85
getMethod · 0.45

Tested by 2

CalculateMethod · 0.68
ComputeSpectrumFunction · 0.68