1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 10:05:46 -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

@ -69,10 +69,19 @@ void ChannelAnalyzerSink::feed(const SampleVector::const_iterator& begin, const
}
else
{
if (m_interpolator.decimate(&m_interpolatorDistanceRemain, c, &ci))
if (m_settings.m_rationalDownSample)
{
processOneSample(ci, sideband);
m_interpolatorDistanceRemain += m_interpolatorDistance;
if (m_interpolator.decimate(&m_interpolatorDistanceRemain, c, &ci))
{
processOneSample(ci, sideband);
m_interpolatorDistanceRemain += m_interpolatorDistance;
}
}
else
{
if (m_decimator.decimate(c, ci)) {
processOneSample(ci, sideband);
}
}
}
}
@ -153,6 +162,21 @@ void ChannelAnalyzerSink::applyChannelSettings(int channelSampleRate, int sinkSa
setFilters(sinkSampleRate, m_settings.m_bandwidth, m_settings.m_lowCutoff);
m_pll.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;

View File

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