1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-07-25 11:34:09 -04:00

Replaced hardcoded bit scaling literals by defines

This commit is contained in:
f4exb
2018-01-21 10:57:04 +01:00
parent f34750716a
commit 491b8a6d33
29 changed files with 89 additions and 111 deletions
+11 -31
View File
@@ -160,12 +160,12 @@ void SSBMod::pull(Sample& sample)
m_interpolatorDistanceRemain += m_interpolatorDistance;
ci *= m_carrierNco.nextIQ(); // shift to carrier frequency
ci *= 29204.0f; //scaling at -1 dB to account for possible filter overshoot
ci *= 0.891235351562f * SDR_SCALEF; //scaling at -1 dB to account for possible filter overshoot
m_settingsMutex.unlock();
Real magsq = ci.real() * ci.real() + ci.imag() * ci.imag();
magsq /= (1<<30);
double magsq = ci.real() * ci.real() + ci.imag() * ci.imag();
magsq /= (SDR_SCALED*SDR_SCALED);
m_movingAverage.feed(magsq);
m_magsq = m_movingAverage.average();
@@ -298,13 +298,13 @@ void SSBMod::pullAF(Complex& sample)
{
if (m_settings.m_audioFlipChannels)
{
ci.real((m_audioBuffer[m_audioBufferFill].r / 32768.0f) * m_settings.m_volumeFactor);
ci.imag((m_audioBuffer[m_audioBufferFill].l / 32768.0f) * m_settings.m_volumeFactor);
ci.real((m_audioBuffer[m_audioBufferFill].r / SDR_SCALEF) * m_settings.m_volumeFactor);
ci.imag((m_audioBuffer[m_audioBufferFill].l / SDR_SCALEF) * m_settings.m_volumeFactor);
}
else
{
ci.real((m_audioBuffer[m_audioBufferFill].l / 32768.0f) * m_settings.m_volumeFactor);
ci.imag((m_audioBuffer[m_audioBufferFill].r / 32768.0f) * m_settings.m_volumeFactor);
ci.real((m_audioBuffer[m_audioBufferFill].l / SDR_SCALEF) * m_settings.m_volumeFactor);
ci.imag((m_audioBuffer[m_audioBufferFill].r / SDR_SCALEF) * m_settings.m_volumeFactor);
}
}
else
@@ -419,18 +419,8 @@ void SSBMod::pullAF(Complex& sample)
if (!(m_undersampleCount++ & decim_mask))
{
Real avgr = (m_sum.real() / decim) * 29204.0f; //scaling at -1 dB to account for possible filter overshoot
Real avgi = (m_sum.imag() / decim) * 29204.0f;
// m_magsqSpectrum = (avgr * avgr + avgi * avgi) / (1<<30);
//
// m_magsqSum += m_magsqSpectrum;
//
// if (m_magsqSpectrum > m_magsqPeak)
// {
// m_magsqPeak = m_magsqSpectrum;
// }
//
// m_magsqCount++;
Real avgr = (m_sum.real() / decim) * 0.891235351562f * SDR_SCALEF; //scaling at -1 dB to account for possible filter overshoot
Real avgi = (m_sum.imag() / decim) * 0.891235351562f * SDR_SCALEF;
if (!m_settings.m_dsb & !m_settings.m_usb)
{ // invert spectrum for LSB
@@ -453,18 +443,8 @@ void SSBMod::pullAF(Complex& sample)
if (!(m_undersampleCount++ & decim_mask))
{
Real avgr = (m_sum.real() / decim) * 29204.0f; //scaling at -1 dB to account for possible filter overshoot
Real avgi = (m_sum.imag() / decim) * 29204.0f;
// m_magsqSpectrum = (avgr * avgr + avgi * avgi) / (1<<30);
//
// m_magsqSum += m_magsqSpectrum;
//
// if (m_magsqSpectrum > m_magsqPeak)
// {
// m_magsqPeak = m_magsqSpectrum;
// }
//
// m_magsqCount++;
Real avgr = (m_sum.real() / decim) * 0.891235351562f * SDR_SCALEF; //scaling at -1 dB to account for possible filter overshoot
Real avgi = (m_sum.imag() / decim) * 0.891235351562f * SDR_SCALEF;
if (!m_settings.m_dsb & !m_settings.m_usb)
{ // invert spectrum for LSB