summaryrefslogtreecommitdiffstats
path: root/dom/media/webaudio/FFTBlock.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /dom/media/webaudio/FFTBlock.cpp
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-upstream/125.0.1.tar.xz
firefox-upstream/125.0.1.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/webaudio/FFTBlock.cpp')
-rw-r--r--dom/media/webaudio/FFTBlock.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/dom/media/webaudio/FFTBlock.cpp b/dom/media/webaudio/FFTBlock.cpp
index 6789ca0264..79fb934a00 100644
--- a/dom/media/webaudio/FFTBlock.cpp
+++ b/dom/media/webaudio/FFTBlock.cpp
@@ -30,15 +30,14 @@
#include "FFTBlock.h"
+#include "FFVPXRuntimeLinker.h"
#include <complex>
namespace mozilla {
-typedef std::complex<double> Complex;
+FFmpegFFTFuncs FFTBlock::sFFTFuncs = {};
-#ifdef MOZ_LIBAV_FFT
-FFmpegRDFTFuncs FFTBlock::sRDFTFuncs;
-#endif
+using Complex = std::complex<double>;
static double fdlibm_cabs(const Complex& z) {
return fdlibm_hypot(real(z), imag(z));
@@ -51,16 +50,15 @@ static double fdlibm_carg(const Complex& z) {
FFTBlock* FFTBlock::CreateInterpolatedBlock(const FFTBlock& block0,
const FFTBlock& block1,
double interp) {
- FFTBlock* newBlock = new FFTBlock(block0.FFTSize());
+ uint32_t fftSize = block0.FFTSize();
+ FFTBlock* newBlock = new FFTBlock(fftSize, 1.0f / AssertedCast<float>(fftSize));
newBlock->InterpolateFrequencyComponents(block0, block1, interp);
// In the time-domain, the 2nd half of the response must be zero, to avoid
// circular convolution aliasing...
- int fftSize = newBlock->FFTSize();
AlignedTArray<float> buffer(fftSize);
- newBlock->GetInverseWithoutScaling(buffer.Elements());
- AudioBufferInPlaceScale(buffer.Elements(), 1.0f / fftSize, fftSize / 2);
+ newBlock->GetInverse(buffer.Elements());
PodZero(buffer.Elements() + fftSize / 2, fftSize / 2);
// Put back into frequency domain.