1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-17 13:51:47 -05:00

FFT correlator: use FFT factory

This commit is contained in:
f4exb 2020-03-12 15:34:32 +01:00
parent 2764fd6083
commit 37082ce41d
2 changed files with 20 additions and 8 deletions

View File

@ -20,14 +20,18 @@
#include <algorithm>
#include "dsp/dspengine.h"
#include "dsp/fftfactory.h"
#include "dsp/fftengine.h"
#include "fftcorr.h"
void fftcorr::init_fft()
{
fftA->configure(flen, false);
fftB->configure(flen, false);
fftInvA->configure(flen, true);
FFTFactory *fftFactory = DSPEngine::instance()->getFFTFactory();
fftASequence = fftFactory->getEngine(flen, false, &fftA);
fftBSequence = fftFactory->getEngine(flen, false, &fftB);
fftInvASequence = fftFactory->getEngine(flen, true, &fftInvA);
m_window.create(FFTWindow::Hanning, flen);
dataA = new cmplx[flen];
@ -46,17 +50,22 @@ void fftcorr::init_fft()
fftcorr::fftcorr(int len) :
flen(len),
flen2(len>>1),
fftA(FFTEngine::create(QString(""))), // TODO: use factory
fftB(FFTEngine::create(QString(""))), // TODO: use factory
fftInvA(FFTEngine::create(QString(""))) // TODO: use factory
fftA(nullptr),
fftB(nullptr),
fftInvA(nullptr),
fftASequence(0),
fftBSequence(0),
fftInvASequence(0)
{
init_fft();
}
fftcorr::~fftcorr()
{
delete fftA;
delete fftB;
FFTFactory *fftFactory = DSPEngine::instance()->getFFTFactory();
fftFactory->releaseEngine(flen, false, fftASequence);
fftFactory->releaseEngine(flen, false, fftBSequence);
fftFactory->releaseEngine(flen, true, fftInvASequence);
delete[] dataA;
delete[] dataB;
delete[] dataBj;

View File

@ -44,6 +44,9 @@ private:
FFTEngine *fftA;
FFTEngine *fftB;
FFTEngine *fftInvA;
unsigned int fftASequence;
unsigned int fftBSequence;
unsigned int fftInvASequence;
FFTWindow m_window;
cmplx *dataA; // from A input
cmplx *dataB; // from B input