mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-09-05 14:47:50 -04:00
Fixed some AGC issues
This commit is contained in:
parent
4e25f4d678
commit
f98800702c
@ -63,7 +63,6 @@ MagAGC::MagAGC(int historySize, double R, double threshold) :
|
|||||||
m_stepDownCounter(0),
|
m_stepDownCounter(0),
|
||||||
m_gateCounter(0),
|
m_gateCounter(0),
|
||||||
m_stepDownDelay(historySize),
|
m_stepDownDelay(historySize),
|
||||||
m_R2(R*R),
|
|
||||||
m_hardLimiting(false)
|
m_hardLimiting(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -72,20 +71,18 @@ MagAGC::~MagAGC()
|
|||||||
|
|
||||||
void MagAGC::resize(int historySize, int stepLength, Real R)
|
void MagAGC::resize(int historySize, int stepLength, Real R)
|
||||||
{
|
{
|
||||||
m_R2 = R*R;
|
|
||||||
m_stepLength = stepLength;
|
m_stepLength = stepLength;
|
||||||
m_stepDelta = 1.0 / m_stepLength;
|
m_stepDelta = 1.0 / m_stepLength;
|
||||||
m_stepUpCounter = 0;
|
m_stepUpCounter = 0;
|
||||||
m_stepDownCounter = 0;
|
m_stepDownCounter = 0;
|
||||||
AGC::resize(historySize, R);
|
AGC::resize(historySize, R);
|
||||||
m_moving_average.fill(0);
|
m_moving_average.fill(m_squared ? R : R*R);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MagAGC::setOrder(double R)
|
void MagAGC::setOrder(double R)
|
||||||
{
|
{
|
||||||
m_R2 = R*R;
|
|
||||||
AGC::setOrder(R);
|
AGC::setOrder(R);
|
||||||
m_moving_average.fill(0);
|
m_moving_average.fill(m_squared ? R : R*R);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MagAGC::setThresholdEnable(bool enable)
|
void MagAGC::setThresholdEnable(bool enable)
|
||||||
|
@ -39,7 +39,7 @@ protected:
|
|||||||
double m_u0; //!< AGC factor
|
double m_u0; //!< AGC factor
|
||||||
double m_R; //!< ordered magnitude
|
double m_R; //!< ordered magnitude
|
||||||
MovingAverage<double> m_moving_average; //!< Averaging engine. The stack length conditions the smoothness of AGC.
|
MovingAverage<double> m_moving_average; //!< Averaging engine. The stack length conditions the smoothness of AGC.
|
||||||
int m_historySize; //!< Averaging length (attack)
|
int m_historySize; //!< Averaging length (the longer the slower the AGC)
|
||||||
int m_count; //!< Samples counter
|
int m_count; //!< Samples counter
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -76,7 +76,6 @@ private:
|
|||||||
int m_stepDownCounter; //!< step down transition samples counter
|
int m_stepDownCounter; //!< step down transition samples counter
|
||||||
int m_gateCounter; //!< threshold gate samples counter
|
int m_gateCounter; //!< threshold gate samples counter
|
||||||
int m_stepDownDelay; //!< delay in samples before cutoff (release)
|
int m_stepDownDelay; //!< delay in samples before cutoff (release)
|
||||||
double m_R2; //!< square of ordered magnitude
|
|
||||||
bool m_hardLimiting; //!< hard limit multiplier so that resulting sample magnitude does not exceed 1.0
|
bool m_hardLimiting; //!< hard limit multiplier so that resulting sample magnitude does not exceed 1.0
|
||||||
|
|
||||||
double hardLimiter(double multiplier, double magsq);
|
double hardLimiter(double multiplier, double magsq);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user