mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-22 16:08:39 -05:00
Channel analyzer NG: autocorrelation corrections (2): corrected FFT aliasing
This commit is contained in:
parent
8050266b28
commit
f2f34ad9a9
@ -52,8 +52,7 @@ ChannelAnalyzerNG::ChannelAnalyzerNG(DeviceSourceAPI *deviceAPI) :
|
||||
m_inputFrequencyOffset = 0;
|
||||
SSBFilter = new fftfilt(m_settings.m_lowCutoff / m_inputSampleRate, m_settings.m_bandwidth / m_inputSampleRate, ssbFftLen);
|
||||
DSBFilter = new fftfilt(m_settings.m_bandwidth / m_inputSampleRate, 2*ssbFftLen);
|
||||
m_corr = new fftcorr(4*ssbFftLen);
|
||||
//m_pll.computeCoefficients(0.05f, 0.707f, 1000.0f); // bandwidth, damping factor, loop gain
|
||||
m_corr = new fftcorr(8*ssbFftLen); // 8k for 4k effective samples
|
||||
m_pll.computeCoefficients(0.002f, 0.5f, 10.0f); // bandwidth, damping factor, loop gain
|
||||
|
||||
applyChannelSettings(m_inputSampleRate, m_inputFrequencyOffset, true);
|
||||
|
@ -43,7 +43,7 @@ void fftcorr::init_fft()
|
||||
outptr = 0;
|
||||
}
|
||||
|
||||
fftcorr::fftcorr(int len) : flen(len)
|
||||
fftcorr::fftcorr(int len) : flen(len), flen2(len>>1)
|
||||
{
|
||||
init_fft();
|
||||
}
|
||||
@ -66,7 +66,7 @@ int fftcorr::run(const cmplx& inA, const cmplx* inB, cmplx **out)
|
||||
dataB[inptrB++] = *inB;
|
||||
}
|
||||
|
||||
if (inptrA < flen) {
|
||||
if (inptrA < flen2) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -83,6 +83,7 @@ int fftcorr::run(const cmplx& inA, const cmplx* inB, cmplx **out)
|
||||
}
|
||||
|
||||
std::transform(dataA, dataA+flen, dataBj, dataP, [](const cmplx& a, const cmplx& b) -> cmplx { return a*b; });
|
||||
|
||||
fftA->InverseComplexFFT(dataP);
|
||||
|
||||
std::fill(dataA, dataA+flen, 0);
|
||||
@ -95,7 +96,7 @@ int fftcorr::run(const cmplx& inA, const cmplx* inB, cmplx **out)
|
||||
}
|
||||
|
||||
*out = dataP;
|
||||
return flen;
|
||||
return flen2;
|
||||
}
|
||||
|
||||
const fftcorr::cmplx& fftcorr::run(const cmplx& inA, const cmplx* inB)
|
||||
|
@ -41,6 +41,7 @@ public:
|
||||
private:
|
||||
void init_fft();
|
||||
int flen; //!< FFT length
|
||||
int flen2; //!< half FFT length
|
||||
g_fft<float> *fftA;
|
||||
g_fft<float> *fftB;
|
||||
cmplx *dataA; // from A input
|
||||
|
Loading…
Reference in New Issue
Block a user