mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-07-31 13:02:27 -04:00
SSB demod: continuous sum for SSB downsampling
This commit is contained in:
parent
332fe54b6a
commit
2b98bc9d8a
@ -50,6 +50,7 @@ SSBDemod::SSBDemod(SampleSink* sampleSink) :
|
|||||||
m_audioBuffer.resize(1<<9);
|
m_audioBuffer.resize(1<<9);
|
||||||
m_audioBufferFill = 0;
|
m_audioBufferFill = 0;
|
||||||
m_undersampleCount = 0;
|
m_undersampleCount = 0;
|
||||||
|
m_sum = 0;
|
||||||
|
|
||||||
m_usb = true;
|
m_usb = true;
|
||||||
m_magsq = 0.0f;
|
m_magsq = 0.0f;
|
||||||
@ -83,7 +84,7 @@ void SSBDemod::configure(MessageQueue* messageQueue,
|
|||||||
void SSBDemod::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly)
|
void SSBDemod::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly)
|
||||||
{
|
{
|
||||||
Complex ci;
|
Complex ci;
|
||||||
fftfilt::cmplx *sideband, sum;
|
fftfilt::cmplx *sideband;
|
||||||
Real avg;
|
Real avg;
|
||||||
int n_out;
|
int n_out;
|
||||||
|
|
||||||
@ -113,18 +114,18 @@ void SSBDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
|
|||||||
// Downsample by 2^(m_scaleLog2 - 1) for SSB band spectrum display
|
// Downsample by 2^(m_scaleLog2 - 1) for SSB band spectrum display
|
||||||
// smart decimation with bit gain using float arithmetic (23 bits significand)
|
// smart decimation with bit gain using float arithmetic (23 bits significand)
|
||||||
|
|
||||||
sum += sideband[i];
|
m_sum += sideband[i];
|
||||||
|
|
||||||
if (!(m_undersampleCount++ & decim_mask))
|
if (!(m_undersampleCount++ & decim_mask))
|
||||||
{
|
{
|
||||||
Real avgr = sum.real() / decim;
|
Real avgr = m_sum.real() / decim;
|
||||||
Real avgi = sum.imag() / decim;
|
Real avgi = m_sum.imag() / decim;
|
||||||
m_magsq = (avgr * avgr + avgi * avgi) / (1<<30);
|
m_magsq = (avgr * avgr + avgi * avgi) / (1<<30);
|
||||||
//avg = (sum.real() + sum.imag()) * 0.7 * 32768.0 / decim;
|
//avg = (sum.real() + sum.imag()) * 0.7 * 32768.0 / decim;
|
||||||
avg = (avgr + avgi) * 0.7;
|
avg = (avgr + avgi) * 0.7;
|
||||||
m_sampleBuffer.push_back(Sample(avg, 0.0));
|
m_sampleBuffer.push_back(Sample(avg, 0.0));
|
||||||
sum.real() = 0.0;
|
m_sum.real() = 0.0;
|
||||||
sum.imag() = 0.0;
|
m_sum.imag() = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_audioBinaual)
|
if (m_audioBinaual)
|
||||||
|
@ -112,6 +112,7 @@ private:
|
|||||||
Real m_LowCutoff;
|
Real m_LowCutoff;
|
||||||
Real m_volume;
|
Real m_volume;
|
||||||
int m_spanLog2;
|
int m_spanLog2;
|
||||||
|
fftfilt::cmplx m_sum;
|
||||||
int m_undersampleCount;
|
int m_undersampleCount;
|
||||||
int m_sampleRate;
|
int m_sampleRate;
|
||||||
int m_frequency;
|
int m_frequency;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user