mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 865256 - Part 3b: Add a complex->real ifft to FFTBlock. r=ehsan
From ea43bceaf8f6dd2c44d7f55a45f770be19b335a5 Mon Sep 17 00:00:00 2001 Currently FFTBlock only holds the complex frequency domain data internally, reading and writing to external time domain data buffers. For PeriodicWave we need to create a real, time domain signal from real and imaginary frequency domain data. This method does this without touching the internal output buffer at all. FFTBlock is just used as a wrapper for kiss_fft_cfg.
This commit is contained in:
parent
0713177406
commit
3006203577
@ -39,11 +39,14 @@ public:
|
||||
CreateInterpolatedBlock(const FFTBlock& block0,
|
||||
const FFTBlock& block1, double interp);
|
||||
|
||||
// Transform FFTSize() points of aData and store the result internally.
|
||||
void PerformFFT(const float* aData)
|
||||
{
|
||||
EnsureFFT();
|
||||
kiss_fftr(mFFT, aData, mOutputBuffer.Elements());
|
||||
}
|
||||
// Inverse-transform internal data and store the resulting FFTSize()
|
||||
// points in aData.
|
||||
void PerformInverseFFT(float* aData)
|
||||
{
|
||||
EnsureIFFT();
|
||||
@ -52,6 +55,27 @@ public:
|
||||
aData[i] /= mFFTSize;
|
||||
}
|
||||
}
|
||||
// Inverse-transform the FFTSize()/2+1 points of data in each
|
||||
// of aRealDataIn and aImagDataIn and store the resulting
|
||||
// FFTSize() points in aRealDataOut.
|
||||
void PerformInverseFFT(float* aRealDataIn,
|
||||
float *aImagDataIn,
|
||||
float *aRealDataOut)
|
||||
{
|
||||
EnsureIFFT();
|
||||
const uint32_t inputSize = mFFTSize / 2 + 1;
|
||||
nsTArray<kiss_fft_cpx> inputBuffer;
|
||||
inputBuffer.SetLength(inputSize);
|
||||
for (uint32_t i = 0; i < inputSize; ++i) {
|
||||
inputBuffer[i].r = aRealDataIn[i];
|
||||
inputBuffer[i].i = aImagDataIn[i];
|
||||
}
|
||||
kiss_fftri(mIFFT, inputBuffer.Elements(), aRealDataOut);
|
||||
for (uint32_t i = 0; i < mFFTSize; ++i) {
|
||||
aRealDataOut[i] /= mFFTSize;
|
||||
}
|
||||
}
|
||||
|
||||
void Multiply(const FFTBlock& aFrame)
|
||||
{
|
||||
BufferComplexMultiply(reinterpret_cast<const float*>(mOutputBuffer.Elements()),
|
||||
|
Loading…
Reference in New Issue
Block a user