mirror of https://github.com/f4exb/sdrangel.git
Channel Analyzer NG: isolate one sample processing
This commit is contained in:
parent
5dfe2a7a2a
commit
f2ec2c9f1d
|
@ -71,42 +71,7 @@ void ChannelAnalyzerNG::feed(const SampleVector::const_iterator& begin, const Sa
|
||||||
//Complex c(it->real() / 32768.0f, it->imag() / 32768.0f);
|
//Complex c(it->real() / 32768.0f, it->imag() / 32768.0f);
|
||||||
Complex c(it->real(), it->imag());
|
Complex c(it->real(), it->imag());
|
||||||
c *= m_nco.nextIQ();
|
c *= m_nco.nextIQ();
|
||||||
|
processOneSample(c, sideband);
|
||||||
if (m_running.m_ssb)
|
|
||||||
{
|
|
||||||
n_out = SSBFilter->runSSB(c, &sideband, m_usb);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
n_out = DSBFilter->runDSB(c, &sideband);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < n_out; i++)
|
|
||||||
{
|
|
||||||
// Downsample by 2^(m_scaleLog2 - 1) for SSB band spectrum display
|
|
||||||
// smart decimation with bit gain using float arithmetic (23 bits significand)
|
|
||||||
|
|
||||||
m_sum += sideband[i];
|
|
||||||
|
|
||||||
if (!(m_undersampleCount++ & decim_mask))
|
|
||||||
{
|
|
||||||
m_sum /= decim;
|
|
||||||
m_magsq = (m_sum.real() * m_sum.real() + m_sum.imag() * m_sum.imag())/ (1<<30);
|
|
||||||
|
|
||||||
if (m_running.m_ssb & !m_usb)
|
|
||||||
{ // invert spectrum for LSB
|
|
||||||
//m_sampleBuffer.push_back(Sample(m_sum.imag() * 32768.0, m_sum.real() * 32768.0));
|
|
||||||
m_sampleBuffer.push_back(Sample(m_sum.imag(), m_sum.real()));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//m_sampleBuffer.push_back(Sample(m_sum.real() * 32768.0, m_sum.imag() * 32768.0));
|
|
||||||
m_sampleBuffer.push_back(Sample(m_sum.real(), m_sum.imag()));
|
|
||||||
}
|
|
||||||
|
|
||||||
m_sum = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_sampleSink != NULL)
|
if(m_sampleSink != NULL)
|
||||||
|
|
|
@ -135,6 +135,48 @@ private:
|
||||||
QMutex m_settingsMutex;
|
QMutex m_settingsMutex;
|
||||||
|
|
||||||
void apply(bool force = false);
|
void apply(bool force = false);
|
||||||
|
|
||||||
|
void processOneSample(Complex& c, fftfilt::cmplx *sideband)
|
||||||
|
{
|
||||||
|
int n_out;
|
||||||
|
int decim = 1<<m_running.m_spanLog2;
|
||||||
|
|
||||||
|
if (m_running.m_ssb)
|
||||||
|
{
|
||||||
|
n_out = SSBFilter->runSSB(c, &sideband, m_usb);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
n_out = DSBFilter->runDSB(c, &sideband);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < n_out; i++)
|
||||||
|
{
|
||||||
|
// Downsample by 2^(m_scaleLog2 - 1) for SSB band spectrum display
|
||||||
|
// smart decimation with bit gain using float arithmetic (23 bits significand)
|
||||||
|
|
||||||
|
m_sum += sideband[i];
|
||||||
|
|
||||||
|
if (!(m_undersampleCount++ & (decim - 1)))
|
||||||
|
{
|
||||||
|
m_sum /= decim;
|
||||||
|
m_magsq = (m_sum.real() * m_sum.real() + m_sum.imag() * m_sum.imag())/ (1<<30);
|
||||||
|
|
||||||
|
if (m_running.m_ssb & !m_usb)
|
||||||
|
{ // invert spectrum for LSB
|
||||||
|
//m_sampleBuffer.push_back(Sample(m_sum.imag() * 32768.0, m_sum.real() * 32768.0));
|
||||||
|
m_sampleBuffer.push_back(Sample(m_sum.imag(), m_sum.real()));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//m_sampleBuffer.push_back(Sample(m_sum.real() * 32768.0, m_sum.imag() * 32768.0));
|
||||||
|
m_sampleBuffer.push_back(Sample(m_sum.real(), m_sum.imag()));
|
||||||
|
}
|
||||||
|
|
||||||
|
m_sum = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_CHANALYZERNG_H
|
#endif // INCLUDE_CHANALYZERNG_H
|
||||||
|
|
Loading…
Reference in New Issue