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

Channel Analyzer: use complex decimator for decimation by power of two value

This commit is contained in:
f4exb 2020-07-19 11:48:02 +02:00
parent 7195600cb6
commit 9b10ddc668
2 changed files with 29 additions and 3 deletions

View File

@ -68,6 +68,8 @@ void ChannelAnalyzerSink::feed(const SampleVector::const_iterator& begin, const
processOneSample(c, sideband); processOneSample(c, sideband);
} }
else else
{
if (m_settings.m_rationalDownSample)
{ {
if (m_interpolator.decimate(&m_interpolatorDistanceRemain, c, &ci)) if (m_interpolator.decimate(&m_interpolatorDistanceRemain, c, &ci))
{ {
@ -75,6 +77,13 @@ void ChannelAnalyzerSink::feed(const SampleVector::const_iterator& begin, const
m_interpolatorDistanceRemain += m_interpolatorDistance; m_interpolatorDistanceRemain += m_interpolatorDistance;
} }
} }
else
{
if (m_decimator.decimate(c, ci)) {
processOneSample(ci, sideband);
}
}
}
} }
if (m_sampleSink) { if (m_sampleSink) {
@ -153,6 +162,21 @@ void ChannelAnalyzerSink::applyChannelSettings(int channelSampleRate, int sinkSa
setFilters(sinkSampleRate, m_settings.m_bandwidth, m_settings.m_lowCutoff); setFilters(sinkSampleRate, m_settings.m_bandwidth, m_settings.m_lowCutoff);
m_pll.setSampleRate(sinkSampleRate); m_pll.setSampleRate(sinkSampleRate);
m_fll.setSampleRate(sinkSampleRate); m_fll.setSampleRate(sinkSampleRate);
int decim = channelSampleRate / sinkSampleRate;
m_decimator.setLog2Decim(0);
for (int i = 0; i < 7; i++) // find log2 beween 0 and 6
{
if (decim & 1 == 1)
{
qDebug() << "ChannelAnalyzerSink::applyChannelSettings: log2decim: " << i;
m_decimator.setLog2Decim(i);
break;
}
decim >>= 1;
}
} }
m_channelSampleRate = channelSampleRate; m_channelSampleRate = channelSampleRate;

View File

@ -20,6 +20,7 @@
#include "dsp/channelsamplesink.h" #include "dsp/channelsamplesink.h"
#include "dsp/interpolator.h" #include "dsp/interpolator.h"
#include "dsp/decimatorc.h"
#include "dsp/ncof.h" #include "dsp/ncof.h"
#include "dsp/fftcorr.h" #include "dsp/fftcorr.h"
#include "dsp/fftfilt.h" #include "dsp/fftfilt.h"
@ -69,6 +70,7 @@ private:
Interpolator m_interpolator; Interpolator m_interpolator;
Real m_interpolatorDistance; Real m_interpolatorDistance;
Real m_interpolatorDistanceRemain; Real m_interpolatorDistanceRemain;
DecimatorC m_decimator;
fftfilt* SSBFilter; fftfilt* SSBFilter;
fftfilt* DSBFilter; fftfilt* DSBFilter;