mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-02-03 09:44:01 -05:00
Channel analyzer NG: autocorrelation corrections (1)
This commit is contained in:
parent
f600f78c0f
commit
8050266b28
2
debian/changelog
vendored
2
debian/changelog
vendored
@ -1,6 +1,6 @@
|
|||||||
sdrangel (3.14.7-1) unstable; urgency=medium
|
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
|
* RTL-SDR: fixed inf/sup decimators
|
||||||
* AM demod: syncrhronous AM detection option
|
* AM demod: syncrhronous AM detection option
|
||||||
|
|
||||||
|
@ -113,6 +113,7 @@ void ChannelAnalyzerNGGUI::displaySettings()
|
|||||||
ui->deltaFrequency->setValue(m_settings.m_frequency);
|
ui->deltaFrequency->setValue(m_settings.m_frequency);
|
||||||
ui->spanLog2->setCurrentIndex(m_settings.m_spanLog2);
|
ui->spanLog2->setCurrentIndex(m_settings.m_spanLog2);
|
||||||
displayPLLSettings();
|
displayPLLSettings();
|
||||||
|
ui->signalSelect->setCurrentIndex((int) m_settings.m_inputType);
|
||||||
|
|
||||||
blockApplySettings(false);
|
blockApplySettings(false);
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
|
|
||||||
void fftcorr::init_fft()
|
void fftcorr::init_fft()
|
||||||
{
|
{
|
||||||
flen2 = flen >> 1;
|
|
||||||
fftA = new g_fft<float>(flen);
|
fftA = new g_fft<float>(flen);
|
||||||
fftB = new g_fft<float>(flen);
|
fftB = new g_fft<float>(flen);
|
||||||
|
|
||||||
@ -35,20 +34,16 @@ void fftcorr::init_fft()
|
|||||||
dataB = new cmplx[flen];
|
dataB = new cmplx[flen];
|
||||||
dataBj = new cmplx[flen];
|
dataBj = new cmplx[flen];
|
||||||
dataP = new cmplx[flen];
|
dataP = new cmplx[flen];
|
||||||
output = new cmplx[flen2];
|
|
||||||
ovlbuf = new cmplx[flen2];
|
|
||||||
|
|
||||||
std::fill(dataA, dataA+flen, 0);
|
std::fill(dataA, dataA+flen, 0);
|
||||||
std::fill(dataB, dataB+flen, 0);
|
std::fill(dataB, dataB+flen, 0);
|
||||||
std::fill(output, output+flen2, 0);
|
|
||||||
std::fill(ovlbuf, ovlbuf+flen2, 0);
|
|
||||||
|
|
||||||
inptrA = 0;
|
inptrA = 0;
|
||||||
inptrB = 0;
|
inptrB = 0;
|
||||||
outptr = 0;
|
outptr = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fftcorr::fftcorr(int len) : flen(len), flen2(len>>1)
|
fftcorr::fftcorr(int len) : flen(len)
|
||||||
{
|
{
|
||||||
init_fft();
|
init_fft();
|
||||||
}
|
}
|
||||||
@ -61,8 +56,6 @@ fftcorr::~fftcorr()
|
|||||||
delete[] dataB;
|
delete[] dataB;
|
||||||
delete[] dataBj;
|
delete[] dataBj;
|
||||||
delete[] dataP;
|
delete[] dataP;
|
||||||
delete[] output;
|
|
||||||
delete[] ovlbuf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int fftcorr::run(const cmplx& inA, const cmplx* inB, cmplx **out)
|
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;
|
dataB[inptrB++] = *inB;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inptrA < flen2) {
|
if (inptrA < flen) {
|
||||||
return 0;
|
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; });
|
std::transform(dataA, dataA+flen, dataBj, dataP, [](const cmplx& a, const cmplx& b) -> cmplx { return a*b; });
|
||||||
|
|
||||||
fftA->InverseComplexFFT(dataP);
|
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);
|
std::fill(dataA, dataA+flen, 0);
|
||||||
inptrA = 0;
|
inptrA = 0;
|
||||||
|
|
||||||
@ -108,8 +94,8 @@ int fftcorr::run(const cmplx& inA, const cmplx* inB, cmplx **out)
|
|||||||
inptrB = 0;
|
inptrB = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
*out = output;
|
*out = dataP;
|
||||||
return flen2;
|
return flen;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fftcorr::cmplx& fftcorr::run(const cmplx& inA, const cmplx* inB)
|
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;
|
outptr = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return output[outptr++];
|
return dataP[outptr++];
|
||||||
}
|
}
|
||||||
|
@ -41,15 +41,12 @@ public:
|
|||||||
private:
|
private:
|
||||||
void init_fft();
|
void init_fft();
|
||||||
int flen; //!< FFT length
|
int flen; //!< FFT length
|
||||||
int flen2; //!< half FFT length
|
|
||||||
g_fft<float> *fftA;
|
g_fft<float> *fftA;
|
||||||
g_fft<float> *fftB;
|
g_fft<float> *fftB;
|
||||||
cmplx *dataA; // from A input
|
cmplx *dataA; // from A input
|
||||||
cmplx *dataB; // from B input
|
cmplx *dataB; // from B input
|
||||||
cmplx *dataBj; // conjugate of B
|
cmplx *dataBj; // conjugate of B
|
||||||
cmplx *dataP; // product of A with conjugate of B
|
cmplx *dataP; // product of A with conjugate of B
|
||||||
cmplx *ovlbuf;
|
|
||||||
cmplx *output;
|
|
||||||
int inptrA;
|
int inptrA;
|
||||||
int inptrB;
|
int inptrB;
|
||||||
int outptr;
|
int outptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user