mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 18:15:45 -05:00
Alpha AGC cleanup
This commit is contained in:
parent
a1c84718ef
commit
24080bafd3
@ -176,46 +176,3 @@ double MagAGC::feedAndGetValue(const Complex& ci)
|
||||
return m_u0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
AlphaAGC::AlphaAGC(int historySize, Real R) :
|
||||
AGC(historySize, R),
|
||||
m_alpha(0.5),
|
||||
m_magsq(0.0),
|
||||
m_squelchOpen(true)
|
||||
{}
|
||||
|
||||
|
||||
AlphaAGC::AlphaAGC(int historySize, Real R, Real alpha) :
|
||||
AGC(historySize, R),
|
||||
m_alpha(alpha),
|
||||
m_magsq(0.0),
|
||||
m_squelchOpen(true)
|
||||
{}
|
||||
|
||||
AlphaAGC::~AlphaAGC()
|
||||
{}
|
||||
|
||||
void AlphaAGC::resize(int historySize, Real R, Real alpha)
|
||||
{
|
||||
m_R = R;
|
||||
m_alpha = alpha;
|
||||
m_squelchOpen = true;
|
||||
m_moving_average.resize(historySize, R);
|
||||
}
|
||||
|
||||
void AlphaAGC::feed(Complex& ci)
|
||||
{
|
||||
m_magsq = ci.real()*ci.real() + ci.imag()*ci.imag();
|
||||
|
||||
if (m_squelchOpen && (m_magsq))
|
||||
{
|
||||
m_moving_average.feed(m_moving_average.average() - m_alpha*(m_moving_average.average() - m_magsq));
|
||||
}
|
||||
else
|
||||
{
|
||||
//m_squelchOpen = true;
|
||||
m_moving_average.feed(m_magsq);
|
||||
}
|
||||
ci *= m_u0;
|
||||
}
|
||||
|
@ -66,22 +66,6 @@ private:
|
||||
double m_clampMax; //!< maximum to clamp to as power value
|
||||
};
|
||||
|
||||
|
||||
class AlphaAGC : public AGC
|
||||
{
|
||||
public:
|
||||
AlphaAGC(int historySize, Real R);
|
||||
AlphaAGC(int historySize, Real R, Real alpha);
|
||||
virtual ~AlphaAGC();
|
||||
void resize(int historySize, Real R, Real alpha);
|
||||
virtual void feed(Complex& ci);
|
||||
Real getMagSq() const { return m_magsq; }
|
||||
private:
|
||||
Real m_alpha;
|
||||
Real m_magsq;
|
||||
bool m_squelchOpen;
|
||||
};
|
||||
|
||||
template<uint32_t AvgSize>
|
||||
class SimpleAGC
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user