From bcb7e273a69a995e216c010739fe35a779ff537e Mon Sep 17 00:00:00 2001 From: Karl Tomlinson Date: Fri, 30 Oct 2015 15:24:23 +1300 Subject: [PATCH] bug 1220041 scale when copying for inverse FFT to avoid iterating twice r=padenot --HG-- extra : rebase_source : ed8826cac68bc28c5b019547a7da5451a87a2c29 --- dom/media/webaudio/FFTBlock.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/dom/media/webaudio/FFTBlock.h b/dom/media/webaudio/FFTBlock.h index 12b76989b3f7..79259e2f3e3c 100644 --- a/dom/media/webaudio/FFTBlock.h +++ b/dom/media/webaudio/FFTBlock.h @@ -110,16 +110,13 @@ public: EnsureIFFT(); #if defined(MOZ_LIBAV_FFT) { - PodCopy(aDataOut, (float*)mOutputBuffer.Elements(), mFFTSize); - aDataOut[1] = mOutputBuffer[mFFTSize/2].r; // Packed Nyquist - av_rdft_calc(mAvIRDFT, aDataOut); - // TODO: Once bug 877662 lands, change this to use SSE. // Even though this function doesn't scale, the libav forward transform // gives a value that needs scaling by 2 in order for things to turn out // similar to how we expect from kissfft/openmax. - for (uint32_t i = 0; i < mFFTSize; ++i) { - aDataOut[i] *= 2.0; - } + AudioBufferCopyWithScale(mOutputBuffer.Elements()->f, 2.0f, + aDataOut, mFFTSize); + aDataOut[1] = 2.0f * mOutputBuffer[mFFTSize/2].r; // Packed Nyquist + av_rdft_calc(mAvIRDFT, aDataOut); } #else #ifdef BUILD_ARM_NEON