SSB demod: clamp AGC value

pull/60/head
f4exb 2017-08-06 00:02:16 +02:00
rodzic 428d22579d
commit 8a5668a186
3 zmienionych plików z 9 dodań i 4 usunięć

Wyświetl plik

@ -68,6 +68,9 @@ SSBDemod::SSBDemod(BasebandSampleSink* sampleSink) :
m_magsqPeak = 0.0f;
m_magsqCount = 0;
m_agc.setClampMax(32768.0*32768.0);
m_agc.setClamping(true);
SSBFilter = new fftfilt(m_LowCutoff / m_audioSampleRate, m_Bandwidth / m_audioSampleRate, ssbFftLen);
DSBFilter = new fftfilt((2.0f * m_Bandwidth) / m_audioSampleRate, 2 * ssbFftLen);

Wyświetl plik

@ -71,12 +71,14 @@ void MagAGC::resize(int historySize, Real R)
m_stepUpCounter = 0;
m_stepDownCounter = m_stepLength;
AGC::resize(historySize, R);
m_moving_average.fill(0);
}
void MagAGC::setOrder(double R)
{
m_R2 = R*R;
AGC::setOrder(R);
m_moving_average.fill(0);
}
void MagAGC::setThresholdEnable(bool enable)
@ -110,7 +112,7 @@ double MagAGC::feedAndGetValue(const Complex& ci)
else
{
double u02 = m_R2 / m_moving_average.average();
m_u0 = (u02 * m_magsq > m_clampMax) ? m_clampMax / sqrt(m_magsq) : sqrt(u02);
m_u0 = (u02 * m_magsq > m_clampMax) ? sqrt(m_clampMax / m_magsq) : sqrt(u02);
}
}
else

Wyświetl plik

@ -24,7 +24,7 @@ public:
protected:
double m_u0; //!< AGC factor
double m_R; //!< objective mag
double m_R; //!< ordered magnitude
MovingAverage<double> m_moving_average; //!< Averaging engine. The stack length conditions the smoothness of AGC.
int m_historySize; //!< Averaging length (attack)
int m_count; //!< Samples counter
@ -61,8 +61,8 @@ private:
int m_gateCounter; //!< threshold gate samples counter
int m_stepDownDelay; //!< delay in samples before cutoff (release)
bool m_clamping; //!< clamping active
double m_R2; //!< square of objective magnitude
double m_clampMax; //!< maximum to clamp to
double m_R2; //!< square of ordered magnitude
double m_clampMax; //!< maximum to clamp to as power value
};