fixed scaling issue with VDSP fft impl
This commit is contained in:
parent
97b982aa85
commit
c37aab3dcc
@ -121,6 +121,11 @@ void FFT::smp2freq()
|
||||
|
||||
//DebugLogC("post fft: %g %g\n", A.realp[fftFrameSize/4], A.imagp[fftFrameSize/4 + 1]);
|
||||
|
||||
// forward scale
|
||||
const float scale = 0.5f;
|
||||
vDSP_vsmul(A.realp, 1, &scale, A.realp, 1, halfsamples);
|
||||
vDSP_vsmul(A.imagp, 1, &scale, A.imagp, 1, halfsamples);
|
||||
|
||||
// Absolute square (equivalent to mag^2)
|
||||
vDSP_zvmags(&A, 1, freq.data(), 1, halfsamples);
|
||||
|
||||
@ -183,8 +188,7 @@ void FFT::freq2smp()
|
||||
vDSP_ztoc(&A, 1, (COMPLEX*)data.data(), 2, halfsamples);
|
||||
|
||||
// scale
|
||||
//float scale = 1.f/data[0]; // 1.0f / nsamples ??
|
||||
float scale = 1.f / nsamples; // 1.0f / nsamples ??
|
||||
float scale = 1.f / nsamples;
|
||||
vDSP_vsmul(data.data(), 1, &scale, smp.data(), 1, nsamples);
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user