Skip to content

Commit

Permalink
up/down channelizers: set guard interfal to 12.5% and optimize debug …
Browse files Browse the repository at this point in the history
…messages
  • Loading branch information
f4exb committed Oct 18, 2023
1 parent cdc9ddb commit 9799874
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 25 deletions.
10 changes: 3 additions & 7 deletions sdrbase/dsp/downchannelizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ Real DownChannelizer::createFilterChain(Real sigStart, Real sigEnd, Real chanSta
Real chanBw = chanEnd - chanStart;
Real rot = sigBw / 4;

qDebug("DownChannelizer::createFilterChain: Signal [%.1f, %.1f] (BW %.1f), Channel [%.1f, %.1f], Rot %.1f", sigStart, sigEnd, sigBw, chanStart, chanEnd, rot);

std::array<Real, 3> filterMinSpaces; // Array of left, center and right filter min spaces respectively
filterMinSpaces[0] = channelMinSpace(sigStart, sigStart + sigBw / 2.0, chanStart, chanEnd);
Expand All @@ -243,28 +242,25 @@ Real DownChannelizer::createFilterChain(Real sigStart, Real sigEnd, Real chanSta
int maxIndex = maxIt - filterMinSpaces.begin();
Real maxValue = *maxIt;

qDebug("DownChannelizer::createFilterChain: best index: %d best value: %.1f sigBW: %.1f chanBW: %.1f",
maxIndex, maxValue, sigBw, chanBw);
qDebug("DownChannelizer::createFilterChain: Signal [%.1f, %.1f] (BW %.1f) Channel [%.1f, %.1f] (BW %.1f) Selected: %d (fit %.1f)",
sigStart, sigEnd, sigBw, chanStart, chanEnd, chanBw, maxIndex, maxValue);

if ((sigStart < sigEnd) && (chanStart < chanEnd) && (maxValue >= chanBw/10.0))
if ((sigStart < sigEnd) && (chanStart < chanEnd) && (maxValue >= chanBw/8.0))
{
if (maxIndex == 0)
{
qDebug("DownChannelizer::createFilterChain: -> take left half (rotate by +1/4 and decimate by 2)");
m_filterStages.push_back(new FilterStage(FilterStage::ModeLowerHalf));
return createFilterChain(sigStart, sigStart + sigBw / 2.0, chanStart, chanEnd);
}

if (maxIndex == 1)
{
qDebug("DownChannelizer::createFilterChain: -> take center half (decimate by 2)");
m_filterStages.push_back(new FilterStage(FilterStage::ModeCenter));
return createFilterChain(sigStart + rot, sigEnd - rot, chanStart, chanEnd);
}

if (maxIndex == 2)
{
qDebug("DownChannelizer::createFilterChain: -> take right half (rotate by -1/4 and decimate by 2)");
m_filterStages.push_back(new FilterStage(FilterStage::ModeUpperHalf));
return createFilterChain(sigEnd - sigBw / 2.0f, sigEnd, chanStart, chanEnd);
}
Expand Down
21 changes: 3 additions & 18 deletions sdrbase/dsp/upchannelizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,6 @@ Real UpChannelizer::createFilterChain(Real sigStart, Real sigEnd, Real chanStart
Real rot = sigBw / 4;
Sample s;

qDebug() << "UpChannelizer::createFilterChain: start:"
<< " sig: [" << sigStart << ":" << sigEnd << "]"
<< " BW: " << sigBw
<< " chan: [" << chanStart << ":" << chanEnd << "]"
<< " rot: " << rot;

std::array<Real, 3> filterMinSpaces; // Array of left, center and right filter min spaces respectively
filterMinSpaces[0] = channelMinSpace(sigStart, sigStart + sigBw / 2.0, chanStart, chanEnd);
filterMinSpaces[1] = channelMinSpace(sigStart + rot, sigEnd - rot, chanStart, chanEnd);
Expand All @@ -266,36 +260,27 @@ Real UpChannelizer::createFilterChain(Real sigStart, Real sigEnd, Real chanStart
int maxIndex = maxIt - filterMinSpaces.begin();
Real maxValue = *maxIt;

qDebug("UpChannelizer::createFilterChain: best index: %d best value: %.1f sigBW: %.1f chanBW: %.1f",
maxIndex, maxValue, sigBw, chanBw);
qDebug("UpChannelizer::createFilterChain: Signal [%.1f, %.1f] (BW %.1f) Channel [%.1f, %.1f] (BW %.1f) Selected: %d (fit %.1f)",
sigStart, sigEnd, sigBw, chanStart, chanEnd, chanBw, maxIndex, maxValue);

if ((sigStart < sigEnd) && (chanStart < chanEnd) && (maxValue >= chanBw/10.0))
if ((sigStart < sigEnd) && (chanStart < chanEnd) && (maxValue >= chanBw/8.0))
{
if (maxIndex == 0)
{
qDebug() << "UpChannelizer::createFilterChain: take left half (rotate by +1/4 and decimate by 2):"
<< " [" << m_filterStages.size() << "]"
<< " sig: [" << sigStart << ":" << sigStart + sigBw / 2.0 << "]";
m_filterStages.push_back(new FilterStage(FilterStage::ModeLowerHalf));
m_stageSamples.push_back(s);
return createFilterChain(sigStart, sigStart + sigBw / 2.0, chanStart, chanEnd);
}

if (maxIndex == 1)
{
qDebug() << "UpChannelizer::createFilterChain: take center half (decimate by 2):"
<< " [" << m_filterStages.size() << "]"
<< " sig: [" << sigStart + rot << ":" << sigEnd - rot << "]";
m_filterStages.push_back(new FilterStage(FilterStage::ModeCenter));
m_stageSamples.push_back(s);
return createFilterChain(sigStart + rot, sigEnd - rot, chanStart, chanEnd);
}

if (maxIndex == 2)
{
qDebug() << "UpChannelizer::createFilterChain: take right half (rotate by -1/4 and decimate by 2):"
<< " [" << m_filterStages.size() << "]"
<< " sig: [" << sigEnd - sigBw / 2.0f << ":" << sigEnd << "]";
m_filterStages.push_back(new FilterStage(FilterStage::ModeUpperHalf));
m_stageSamples.push_back(s);
return createFilterChain(sigEnd - sigBw / 2.0f, sigEnd, chanStart, chanEnd);
Expand Down

0 comments on commit 9799874

Please sign in to comment.