mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-02-03 09:44:01 -05:00
Down channelizer: fixed sample saturation in 16 bit mode
This commit is contained in:
parent
c733bade1f
commit
aa60776795
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user