Channel analyzer NG: autocorrelation corrections (1)

pull/183/merge
f4exb 2018-05-20 19:41:36 +02:00
rodzic f600f78c0f
commit 8050266b28
4 zmienionych plików z 7 dodań i 23 usunięć

2
debian/changelog vendored
Wyświetl plik

@ -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

Wyświetl plik

@ -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);
}

Wyświetl plik

@ -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++];
}

Wyświetl plik

@ -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;