1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-15 21:01:45 -05:00

Fixed down channelizer by dividing by 2 at each filter stage

This commit is contained in:
f4exb 2017-05-12 02:41:51 +02:00
parent ffb6ad3009
commit 3cd754bd67
2 changed files with 37 additions and 2 deletions

View File

@ -77,6 +77,8 @@ void DownChannelizer::feed(const SampleVector::const_iterator& begin, const Samp
if(stage == m_filterStages.end())
{
s.m_real /= (1<<(m_filterStages.size()));
s.m_imag /= (1<<(m_filterStages.size()));
m_sampleBuffer.push_back(s);
}
}
@ -172,6 +174,8 @@ void DownChannelizer::applyConfiguration()
m_mutex.unlock();
//debugFilterChain();
m_currentOutputSampleRate = m_inputSampleRate / (1 << m_filterStages.size());
qDebug() << "DownChannelizer::applyConfiguration in=" << m_inputSampleRate
@ -189,7 +193,9 @@ void DownChannelizer::applyConfiguration()
#ifdef USE_SSE4_1
DownChannelizer::FilterStage::FilterStage(Mode mode) :
m_filter(new IntHalfbandFilterEO1<DOWNCHANNELIZER_HB_FILTER_ORDER>),
m_workFunction(0)
m_workFunction(0),
m_mode(mode),
m_sse(true)
{
switch(mode) {
case ModeCenter:
@ -208,7 +214,9 @@ DownChannelizer::FilterStage::FilterStage(Mode mode) :
#else
DownChannelizer::FilterStage::FilterStage(Mode mode) :
m_filter(new IntHalfbandFilterDB<DOWNCHANNELIZER_HB_FILTER_ORDER>),
m_workFunction(0)
m_workFunction(0),
m_mode(mode),
m_sse(false)
{
switch(mode) {
case ModeCenter:
@ -286,3 +294,27 @@ void DownChannelizer::freeFilterChain()
delete *it;
m_filterStages.clear();
}
void DownChannelizer::debugFilterChain()
{
qDebug("DownChannelizer::debugFilterChain: %lu stages", m_filterStages.size());
for(FilterStages::iterator it = m_filterStages.begin(); it != m_filterStages.end(); ++it)
{
switch ((*it)->m_mode)
{
case FilterStage::ModeCenter:
qDebug("DownChannelizer::debugFilterChain: center %s", (*it)->m_sse ? "sse" : "no_sse");
break;
case FilterStage::ModeLowerHalf:
qDebug("DownChannelizer::debugFilterChain: lower %s", (*it)->m_sse ? "sse" : "no_sse");
break;
case FilterStage::ModeUpperHalf:
qDebug("DownChannelizer::debugFilterChain: upper %s", (*it)->m_sse ? "sse" : "no_sse");
break;
default:
qDebug("DownChannelizer::debugFilterChain: none %s", (*it)->m_sse ? "sse" : "no_sse");
break;
}
}
}

View File

@ -81,6 +81,8 @@ protected:
IntHalfbandFilterDB<DOWNCHANNELIZER_HB_FILTER_ORDER>* m_filter;
#endif
WorkFunction m_workFunction;
Mode m_mode;
bool m_sse;
FilterStage(Mode mode);
~FilterStage();
@ -105,6 +107,7 @@ protected:
bool signalContainsChannel(Real sigStart, Real sigEnd, Real chanStart, Real chanEnd) const;
Real createFilterChain(Real sigStart, Real sigEnd, Real chanStart, Real chanEnd);
void freeFilterChain();
void debugFilterChain();
signals:
void inputSampleRateChanged();