mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-10 10:33:29 -05:00
Mods and demods: prevent returning null or infinite values for squared magnitude
This commit is contained in:
parent
747f400a78
commit
416817d0b8
@ -43,7 +43,7 @@ public:
|
||||
|
||||
int getInputSampleRate() const { return m_running.m_inputSampleRate; }
|
||||
int getChannelSampleRate() const { return m_running.m_channelSampleRate; }
|
||||
Real getMagSq() const { return m_magsq; }
|
||||
Real getMagSq() const { return m_magsq == 0 ? 1e-10 : m_magsq; }
|
||||
|
||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly);
|
||||
virtual void start();
|
||||
|
@ -46,9 +46,9 @@ public:
|
||||
|
||||
void getMagSqLevels(Real& avg, Real& peak, int& nbSamples)
|
||||
{
|
||||
avg = m_magsqSum / m_magsqCount;
|
||||
peak = m_magsqPeak;
|
||||
nbSamples = m_magsqCount;
|
||||
avg = m_magsqCount == 0 ? 1e-10 : m_magsqSum / m_magsqCount;
|
||||
peak = m_magsqPeak == 0.0 ? 1e-10 : m_magsqPeak;
|
||||
nbSamples = m_magsqCount == 0 ? 1 : m_magsqCount;
|
||||
m_magsqSum = 0.0f;
|
||||
m_magsqPeak = 0.0f;
|
||||
m_magsqCount = 0;
|
||||
|
@ -71,10 +71,10 @@ public:
|
||||
|
||||
void getMagSqLevels(Real& avg, Real& peak, int& nbSamples)
|
||||
{
|
||||
avg = m_magsqSum / m_magsqCount;
|
||||
avg = m_magsqCount == 0 ? 1e-10 : m_magsqSum / m_magsqCount;
|
||||
m_magsq = avg;
|
||||
peak = m_magsqPeak;
|
||||
nbSamples = m_magsqCount;
|
||||
peak = m_magsqPeak == 0.0 ? 1e-10 : m_magsqPeak;
|
||||
nbSamples = m_magsqCount == 0 ? 1 : m_magsqCount;
|
||||
m_magsqSum = 0.0f;
|
||||
m_magsqPeak = 0.0f;
|
||||
m_magsqCount = 0;
|
||||
|
@ -75,15 +75,16 @@ public:
|
||||
|
||||
void getMagSqLevels(Real& avg, Real& peak, int& nbSamples)
|
||||
{
|
||||
avg = m_magsqSum / m_magsqCount;
|
||||
avg = m_magsqCount == 0 ? 1e-10 : m_magsqSum / m_magsqCount;
|
||||
m_magsq = avg;
|
||||
peak = m_magsqPeak;
|
||||
nbSamples = m_magsqCount;
|
||||
peak = m_magsqPeak == 0.0 ? 1e-10 : m_magsqPeak;
|
||||
nbSamples = m_magsqCount == 0 ? 1 : m_magsqCount;
|
||||
m_magsqSum = 0.0f;
|
||||
m_magsqPeak = 0.0f;
|
||||
m_magsqCount = 0;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
class MsgConfigureMyPosition : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
|
@ -74,10 +74,10 @@ public:
|
||||
|
||||
void getMagSqLevels(Real& avg, Real& peak, int& nbSamples)
|
||||
{
|
||||
avg = m_magsqSum / m_magsqCount;
|
||||
avg = m_magsqCount == 0 ? 1e-10 : m_magsqSum / m_magsqCount;
|
||||
m_magsq = avg;
|
||||
peak = m_magsqPeak;
|
||||
nbSamples = m_magsqCount;
|
||||
peak = m_magsqPeak == 0.0 ? 1e-10 : m_magsqPeak;
|
||||
nbSamples = m_magsqCount == 0 ? 1 : m_magsqCount;
|
||||
m_magsqSum = 0.0f;
|
||||
m_magsqPeak = 0.0f;
|
||||
m_magsqCount = 0;
|
||||
|
@ -53,10 +53,10 @@ public:
|
||||
|
||||
void getMagSqLevels(Real& avg, Real& peak, int& nbSamples)
|
||||
{
|
||||
avg = m_magsqSum / m_magsqCount;
|
||||
avg = m_magsqCount == 0 ? 1e-10 : m_magsqSum / m_magsqCount;
|
||||
m_magsq = avg;
|
||||
peak = m_magsqPeak;
|
||||
nbSamples = m_magsqCount;
|
||||
peak = m_magsqPeak == 0.0 ? 1e-10 : m_magsqPeak;
|
||||
nbSamples = m_magsqCount == 0 ? 1 : m_magsqCount;
|
||||
m_magsqSum = 0.0f;
|
||||
m_magsqPeak = 0.0f;
|
||||
m_magsqCount = 0;
|
||||
|
@ -55,10 +55,10 @@ public:
|
||||
|
||||
void getMagSqLevels(Real& avg, Real& peak, int& nbSamples)
|
||||
{
|
||||
avg = m_magsqSum / m_magsqCount;
|
||||
avg = m_magsqCount == 0 ? 1e-10 : m_magsqSum / m_magsqCount;
|
||||
m_magsq = avg;
|
||||
peak = m_magsqPeak;
|
||||
nbSamples = m_magsqCount;
|
||||
peak = m_magsqPeak == 0.0 ? 1e-10 : m_magsqPeak;
|
||||
nbSamples = m_magsqCount == 0 ? 1 : m_magsqCount;
|
||||
m_magsqSum = 0.0f;
|
||||
m_magsqPeak = 0.0f;
|
||||
m_magsqCount = 0;
|
||||
|
@ -190,7 +190,7 @@ public:
|
||||
virtual void stop();
|
||||
virtual bool handleMessage(const Message& cmd);
|
||||
|
||||
Real getMagSq() const { return m_magsq; }
|
||||
Real getMagSq() const { return m_magsq == 0.0 ? 1e-10 : m_magsq; }
|
||||
|
||||
CWKeyer *getCWKeyer() { return &m_cwKeyer; }
|
||||
|
||||
|
@ -195,7 +195,7 @@ public:
|
||||
virtual void stop();
|
||||
virtual bool handleMessage(const Message& cmd);
|
||||
|
||||
Real getMagSq() const { return m_magsq; }
|
||||
Real getMagSq() const { return m_magsq == 0 ? 1e-10 : m_magsq; }
|
||||
|
||||
CWKeyer *getCWKeyer() { return &m_cwKeyer; }
|
||||
|
||||
|
@ -195,7 +195,7 @@ public:
|
||||
virtual void stop();
|
||||
virtual bool handleMessage(const Message& cmd);
|
||||
|
||||
Real getMagSq() const { return m_magsq; }
|
||||
Real getMagSq() const { return m_magsq == 0 ? 1e-10 : m_magsq; }
|
||||
|
||||
CWKeyer *getCWKeyer() { return &m_cwKeyer; }
|
||||
|
||||
|
@ -192,7 +192,7 @@ public:
|
||||
virtual void stop();
|
||||
virtual bool handleMessage(const Message& cmd);
|
||||
|
||||
Real getMagSq() const { return m_magsq; }
|
||||
Real getMagSq() const { return m_magsq == 0 ? 1e-10 : m_magsq; }
|
||||
|
||||
CWKeyer *getCWKeyer() { return &m_cwKeyer; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user