1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-09-28 15:56:33 -04:00

Down channelizer: fixed sample saturation in 16 bit mode

This commit is contained in:
f4exb 2019-05-03 00:23:38 +02:00
parent c733bade1f
commit aa60776795

View File

@ -79,6 +79,10 @@ void DownChannelizer::feed(const SampleVector::const_iterator& begin, const Samp
for (; stage != m_filterStages.end(); ++stage)
{
#ifndef SDR_RX_SAMPLE_24BIT
s.m_real /= 2; // avoid saturation on 16 bit samples
s.m_imag /= 2;
#endif
if(!(*stage)->work(&s))
{
break;
@ -87,8 +91,10 @@ void DownChannelizer::feed(const SampleVector::const_iterator& begin, const Samp
if(stage == m_filterStages.end())
{
s.m_real /= (1<<(m_filterStages.size()));
#ifdef SDR_RX_SAMPLE_24BIT
s.m_real /= (1<<(m_filterStages.size())); // on 32 bit samples there is enough headroom to just divide the final result
s.m_imag /= (1<<(m_filterStages.size()));
#endif
m_sampleBuffer.push_back(s);
}
}