mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-23 08:28:36 -05:00
DSD demod plugin: fixed magnitude squared precision problem
This commit is contained in:
parent
9d5e5c76c7
commit
be4982c447
@ -64,7 +64,7 @@ DSDDemod::DSDDemod(SampleSink* sampleSink) :
|
||||
m_sampleBuffer = new qint16[1<<17]; // 128 kS
|
||||
m_sampleBufferIndex = 0;
|
||||
|
||||
m_movingAverage.resize(16, 0);
|
||||
m_movingAverage.resize(50, 0);
|
||||
|
||||
DSPEngine::instance()->addAudioSink(&m_audioFifo);
|
||||
}
|
||||
@ -119,7 +119,7 @@ void DSDDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
|
||||
{
|
||||
qint16 sample, delayedSample;
|
||||
|
||||
m_magsq = ((ci.real()*ci.real() + ci.imag()*ci.imag())) / (Real) (1<<30);
|
||||
m_magsq = ((ci.real()*ci.real() + ci.imag()*ci.imag()));
|
||||
m_movingAverage.feed(m_magsq);
|
||||
|
||||
Real demod = 32768.0f * m_phaseDiscri.phaseDiscriminator(ci) * ((float) m_running.m_demodGain / 100.0f);
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
m_dsdDemodGUI = dsdDemodGUI;
|
||||
}
|
||||
|
||||
Real getMagSq() { return m_movingAverage.average(); }
|
||||
double getMagSq() { return m_movingAverage.average() / (double) (1<<30); }
|
||||
bool getSquelchOpen() const { return m_squelchOpen; }
|
||||
|
||||
const DSDDecoder& getDecoder() const { return m_dsdDecoder; }
|
||||
@ -199,8 +199,8 @@ private:
|
||||
bool m_squelchOpen;
|
||||
|
||||
Real m_lastArgument;
|
||||
MovingAverage<Real> m_movingAverage;
|
||||
Real m_magsq;
|
||||
MovingAverage<double> m_movingAverage;
|
||||
double m_magsq;
|
||||
|
||||
Real m_fmExcursion;
|
||||
|
||||
|
@ -492,8 +492,9 @@ void DSDDemodGUI::formatStatusText()
|
||||
void DSDDemodGUI::tick()
|
||||
{
|
||||
Real powDb = CalcDb::dbPower(m_dsdDemod->getMagSq());
|
||||
m_channelPowerDbAvg.feed(powDb);
|
||||
m_channelPowerDbAvg.feed(powDb);
|
||||
ui->channelPower->setText(QString::number(m_channelPowerDbAvg.average(), 'f', 1));
|
||||
|
||||
bool squelchOpen = m_dsdDemod->getSquelchOpen();
|
||||
|
||||
if (squelchOpen != m_squelchOpen)
|
||||
|
Loading…
Reference in New Issue
Block a user