1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-04 16:01:14 -05:00

SSB demod: yet again another clamping algorithm

This commit is contained in:
f4exb 2018-05-28 02:40:26 +02:00
parent 8155825bc4
commit 723747e9dc
2 changed files with 7 additions and 13 deletions

View File

@ -85,7 +85,7 @@ SSBDemod::SSBDemod(DeviceSourceAPI *deviceAPI) :
m_magsqPeak = 0.0f;
m_magsqCount = 0;
m_agc.setClampMax(SDR_RX_SCALED*SDR_RX_SCALED);
m_agc.setClampMax(SDR_RX_SCALED/100.0);
m_agc.setClamping(m_agcClamping);
SSBFilter = new fftfilt(m_LowCutoff / m_audioSampleRate, m_Bandwidth / m_audioSampleRate, ssbFftLen);

View File

@ -104,25 +104,19 @@ double MagAGC::feedAndGetValue(const Complex& ci)
{
if (m_squared)
{
double u0 = m_R / m_moving_average.average();
double du = (u0*m_magsq) - (m_clampMax/4.0);
if (du > 0) {
m_u0 = (m_clampMax/4.0)*(1.0 + (log10(1+du)/8.0)); // experimental clipping limiter
if (m_magsq > m_clampMax) {
m_u0 = m_clampMax / m_magsq;
} else {
m_u0 = u0;
m_u0 = m_R / m_moving_average.average();
}
//m_u0 = (u0 * m_magsq > m_clampMax) ? m_clampMax / m_magsq : u0;
}
else
{
double u02 = m_R2 / m_moving_average.average();
double du = (u02*m_magsq) - (m_clampMax/4.0);
if (du > 0) {
m_u0 = (m_clampMax/4.0)*(1.0 + (log10(1+du)/8.0)); // experimental clipping limiter
if (sqrt(m_magsq) > m_clampMax) {
m_u0 = m_clampMax / sqrt(m_magsq);
} else {
m_u0 = sqrt(u02);
m_u0 = m_R / sqrt(m_moving_average.average());
}
//m_u0 = (u02 * m_magsq > m_clampMax) ? sqrt(m_clampMax / m_magsq) : sqrt(u02);
}
}
else