1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 09:18:54 -05:00

Channel analyzer NG: autocorrelation corrections (1)

This commit is contained in:
f4exb 2018-05-20 19:41:36 +02:00
parent f600f78c0f
commit 8050266b28
4 changed files with 7 additions and 23 deletions

2
debian/changelog vendored
View File

@ -1,6 +1,6 @@
sdrangel (3.14.7-1) unstable; urgency=medium
* ChanelAnalyzerNG: added PLL option
* ChanelAnalyzerNG: added PLL option and source selection with auto correlation
* RTL-SDR: fixed inf/sup decimators
* AM demod: syncrhronous AM detection option

View File

@ -113,6 +113,7 @@ void ChannelAnalyzerNGGUI::displaySettings()
ui->deltaFrequency->setValue(m_settings.m_frequency);
ui->spanLog2->setCurrentIndex(m_settings.m_spanLog2);
displayPLLSettings();
ui->signalSelect->setCurrentIndex((int) m_settings.m_inputType);
blockApplySettings(false);
}

View File

@ -27,7 +27,6 @@
void fftcorr::init_fft()
{
flen2 = flen >> 1;
fftA = new g_fft<float>(flen);
fftB = new g_fft<float>(flen);
@ -35,20 +34,16 @@ void fftcorr::init_fft()
dataB = new cmplx[flen];
dataBj = new cmplx[flen];
dataP = new cmplx[flen];
output = new cmplx[flen2];
ovlbuf = new cmplx[flen2];
std::fill(dataA, dataA+flen, 0);
std::fill(dataB, dataB+flen, 0);
std::fill(output, output+flen2, 0);
std::fill(ovlbuf, ovlbuf+flen2, 0);
inptrA = 0;
inptrB = 0;
outptr = 0;
}
fftcorr::fftcorr(int len) : flen(len), flen2(len>>1)
fftcorr::fftcorr(int len) : flen(len)
{
init_fft();
}
@ -61,8 +56,6 @@ fftcorr::~fftcorr()
delete[] dataB;
delete[] dataBj;
delete[] dataP;
delete[] output;
delete[] ovlbuf;
}
int fftcorr::run(const cmplx& inA, const cmplx* inB, cmplx **out)
@ -73,7 +66,7 @@ int fftcorr::run(const cmplx& inA, const cmplx* inB, cmplx **out)
dataB[inptrB++] = *inB;
}
if (inptrA < flen2) {
if (inptrA < flen) {
return 0;
}
@ -90,15 +83,8 @@ 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);
for (int i = 0; i < flen2; i++)
{
output[i] = ovlbuf[i] + dataP[i];
ovlbuf[i] = dataP[flen2 + i];
}
std::fill(dataA, dataA+flen, 0);
inptrA = 0;
@ -108,8 +94,8 @@ int fftcorr::run(const cmplx& inA, const cmplx* inB, cmplx **out)
inptrB = 0;
}
*out = output;
return flen2;
*out = dataP;
return flen;
}
const fftcorr::cmplx& fftcorr::run(const cmplx& inA, const cmplx* inB)
@ -120,5 +106,5 @@ const fftcorr::cmplx& fftcorr::run(const cmplx& inA, const cmplx* inB)
outptr = 0;
}
return output[outptr++];
return dataP[outptr++];
}

View File

@ -41,15 +41,12 @@ 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
cmplx *dataB; // from B input
cmplx *dataBj; // conjugate of B
cmplx *dataP; // product of A with conjugate of B
cmplx *ovlbuf;
cmplx *output;
int inptrA;
int inptrB;
int outptr;