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

Demod Analyzer: implemented decimation

This commit is contained in:
f4exb 2020-12-20 11:51:38 +01:00
parent 321cffc9c7
commit 11e1d1c684
9 changed files with 141 additions and 391 deletions

View File

@ -1,346 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DemodAnalyzerGUI</class>
<widget class="RollupWidget" name="DemodAnalyzerGUI">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>739</width>
<height>778</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>720</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<family>Liberation Sans</family>
<pointsize>9</pointsize>
</font>
</property>
<property name="windowTitle">
<string>Demod Analyzer</string>
</property>
<widget class="QWidget" name="settingsContainer" native="true">
<property name="geometry">
<rect>
<x>0</x>
<y>10</y>
<width>631</width>
<height>41</height>
</rect>
</property>
<property name="windowTitle">
<string>Settings</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>3</number>
</property>
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<layout class="QHBoxLayout" name="HeaderLayout">
<property name="topMargin">
<number>2</number>
</property>
<item>
<widget class="ButtonSwitch" name="startStop">
<property name="toolTip">
<string>start/stop acquisition</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/play.png</normaloff>
<normalon>:/stop.png</normalon>:/play.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="devicesRefresh">
<property name="maximumSize">
<size>
<width>24</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Refresh indexes of available device sets</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/recycle.png</normaloff>:/recycle.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="channelsLabel">
<property name="text">
<string>Chan</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="channels">
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Channel index</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="channelApply">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip">
<string>Reinitialization of device data</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../sdrgui/resources/res.qrc">
<normaloff>:/checkmark.png</normaloff>:/checkmark.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="sinkSampleRateText">
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Analyzer (sink) sample rate</string>
</property>
<property name="text">
<string>00000.0 kS/s</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="channelPower">
<property name="minimumSize">
<size>
<width>52</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Channel power</string>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>-100.0 dB</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="spectrumContainer" native="true">
<property name="geometry">
<rect>
<x>0</x>
<y>98</y>
<width>720</width>
<height>284</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>716</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>Channel Spectrum</string>
</property>
<layout class="QVBoxLayout" name="verticalLayoutSpectrum">
<property name="spacing">
<number>2</number>
</property>
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<widget class="GLSpectrum" name="glSpectrum" native="true">
<property name="minimumSize">
<size>
<width>200</width>
<height>250</height>
</size>
</property>
<property name="font">
<font>
<family>Liberation Mono</family>
<pointsize>8</pointsize>
</font>
</property>
</widget>
</item>
<item>
<widget class="GLSpectrumGUI" name="spectrumGUI" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="scopeContainer" native="true">
<property name="geometry">
<rect>
<x>0</x>
<y>390</y>
<width>720</width>
<height>334</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>716</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>Channel Scope</string>
</property>
<layout class="QVBoxLayout" name="verticalLayoutScope">
<property name="spacing">
<number>2</number>
</property>
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<widget class="GLScope" name="glScope" native="true">
<property name="minimumSize">
<size>
<width>200</width>
<height>300</height>
</size>
</property>
<property name="font">
<font>
<family>Liberation Mono</family>
<pointsize>8</pointsize>
</font>
</property>
</widget>
</item>
<item>
<widget class="GLScopeGUI" name="scopeGUI" native="true"/>
</item>
</layout>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>RollupWidget</class>
<extends>QWidget</extends>
<header>gui/rollupwidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>GLSpectrum</class>
<extends>QWidget</extends>
<header>gui/glspectrum.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>GLSpectrumGUI</class>
<extends>QWidget</extends>
<header>gui/glspectrumgui.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ButtonSwitch</class>
<extends>QToolButton</extends>
<header>gui/buttonswitch.h</header>
</customwidget>
<customwidget>
<class>GLScope</class>
<extends>QWidget</extends>
<header>gui/glscope.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>GLScopeGUI</class>
<extends>QWidget</extends>
<header>gui/glscopegui.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../../../sdrgui/resources/res.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -205,8 +205,7 @@ bool DemodAnalyzer::deserialize(const QByteArray& data)
void DemodAnalyzer::applySettings(const DemodAnalyzerSettings& settings, bool force) void DemodAnalyzer::applySettings(const DemodAnalyzerSettings& settings, bool force)
{ {
qDebug() << "DemodAnalyzer::applySettings:" qDebug() << "DemodAnalyzer::applySettings:"
<< " m_deviceIndex: " << settings.m_deviceIndex << " m_channelIndex: " << settings.m_log2Decim
<< " m_channelIndex: " << settings.m_channelIndex
<< " m_title: " << settings.m_title << " m_title: " << settings.m_title
<< " m_rgbColor: " << settings.m_rgbColor << " m_rgbColor: " << settings.m_rgbColor
<< " m_useReverseAPI: " << settings.m_useReverseAPI << " m_useReverseAPI: " << settings.m_useReverseAPI
@ -218,11 +217,8 @@ void DemodAnalyzer::applySettings(const DemodAnalyzerSettings& settings, bool fo
QList<QString> reverseAPIKeys; QList<QString> reverseAPIKeys;
if ((m_settings.m_deviceIndex != settings.m_deviceIndex) || force) { if ((m_settings.m_log2Decim != settings.m_log2Decim) || force) {
reverseAPIKeys.append("deviceIndex"); reverseAPIKeys.append("log2Decim");
}
if ((m_settings.m_channelIndex != settings.m_channelIndex) || force) {
reverseAPIKeys.append("channelIndex");
} }
if ((m_settings.m_title != settings.m_title) || force) { if ((m_settings.m_title != settings.m_title) || force) {
reverseAPIKeys.append("title"); reverseAPIKeys.append("title");
@ -400,9 +396,6 @@ void DemodAnalyzer::webapiFormatFeatureSettings(
SWGSDRangel::SWGFeatureSettings& response, SWGSDRangel::SWGFeatureSettings& response,
const DemodAnalyzerSettings& settings) const DemodAnalyzerSettings& settings)
{ {
response.getDemodAnalyzerSettings()->setDeviceIndex(settings.m_deviceIndex);
response.getDemodAnalyzerSettings()->setChannelIndex(settings.m_channelIndex);
if (response.getDemodAnalyzerSettings()->getTitle()) { if (response.getDemodAnalyzerSettings()->getTitle()) {
*response.getDemodAnalyzerSettings()->getTitle() = settings.m_title; *response.getDemodAnalyzerSettings()->getTitle() = settings.m_title;
} else { } else {
@ -428,12 +421,6 @@ void DemodAnalyzer::webapiUpdateFeatureSettings(
const QStringList& featureSettingsKeys, const QStringList& featureSettingsKeys,
SWGSDRangel::SWGFeatureSettings& response) SWGSDRangel::SWGFeatureSettings& response)
{ {
if (featureSettingsKeys.contains("deviceIndex")) {
settings.m_deviceIndex = response.getDemodAnalyzerSettings()->getDeviceIndex();
}
if (featureSettingsKeys.contains("channelIndex")) {
settings.m_channelIndex = response.getDemodAnalyzerSettings()->getChannelIndex();
}
if (featureSettingsKeys.contains("title")) { if (featureSettingsKeys.contains("title")) {
settings.m_title = *response.getDemodAnalyzerSettings()->getTitle(); settings.m_title = *response.getDemodAnalyzerSettings()->getTitle();
} }
@ -468,12 +455,6 @@ void DemodAnalyzer::webapiReverseSendSettings(QList<QString>& featureSettingsKey
// transfer data that has been modified. When force is on transfer all data except reverse API data // transfer data that has been modified. When force is on transfer all data except reverse API data
if (featureSettingsKeys.contains("deviceIndex") || force) {
swgDemodAnalyzerSettings->setDeviceIndex(settings.m_deviceIndex);
}
if (featureSettingsKeys.contains("channelIndex") || force) {
swgDemodAnalyzerSettings->setChannelIndex(settings.m_channelIndex);
}
if (featureSettingsKeys.contains("title") || force) { if (featureSettingsKeys.contains("title") || force) {
swgDemodAnalyzerSettings->setTitle(new QString(settings.m_title)); swgDemodAnalyzerSettings->setTitle(new QString(settings.m_title));
} }

View File

@ -96,9 +96,10 @@ bool DemodAnalyzerGUI::handleMessage(const Message& message)
DemodAnalyzer::MsgReportSampleRate& report = (DemodAnalyzer::MsgReportSampleRate&) message; DemodAnalyzer::MsgReportSampleRate& report = (DemodAnalyzer::MsgReportSampleRate&) message;
int sampleRate = report.getSampleRate(); int sampleRate = report.getSampleRate();
qDebug("DemodAnalyzerGUI::handleMessage: DemodAnalyzer::MsgReportSampleRate: %d", sampleRate); qDebug("DemodAnalyzerGUI::handleMessage: DemodAnalyzer::MsgReportSampleRate: %d", sampleRate);
ui->glSpectrum->setSampleRate(sampleRate); ui->glSpectrum->setSampleRate(sampleRate/(1<<m_settings.m_log2Decim));
m_scopeVis->setLiveRate(sampleRate); m_scopeVis->setLiveRate(sampleRate/(1<<m_settings.m_log2Decim));
displaySampleRate(sampleRate); displaySampleRate(sampleRate/(1<<m_settings.m_log2Decim));
m_sampleRate = sampleRate;
return true; return true;
} }
@ -129,6 +130,7 @@ DemodAnalyzerGUI::DemodAnalyzerGUI(PluginAPI* pluginAPI, FeatureUISet *featureUI
ui(new Ui::DemodAnalyzerGUI), ui(new Ui::DemodAnalyzerGUI),
m_pluginAPI(pluginAPI), m_pluginAPI(pluginAPI),
m_featureUISet(featureUISet), m_featureUISet(featureUISet),
m_sampleRate(48000),
m_doApplySettings(true), m_doApplySettings(true),
m_lastFeatureState(0), m_lastFeatureState(0),
m_selectedChannel(nullptr) m_selectedChannel(nullptr)
@ -157,9 +159,9 @@ DemodAnalyzerGUI::DemodAnalyzerGUI(PluginAPI* pluginAPI, FeatureUISet *featureUI
ui->spectrumGUI->setBuddies(m_spectrumVis, ui->glSpectrum); ui->spectrumGUI->setBuddies(m_spectrumVis, ui->glSpectrum);
ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope); ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope);
ui->glSpectrum->setCenterFrequency(0); ui->glSpectrum->setCenterFrequency(0);
ui->glSpectrum->setSampleRate(48000); ui->glSpectrum->setSampleRate(m_sampleRate/(1<<m_settings.m_log2Decim));
m_scopeVis->setLiveRate(48000); m_scopeVis->setLiveRate(m_sampleRate/(1<<m_settings.m_log2Decim));
displaySampleRate(48000); displaySampleRate(m_sampleRate/(1<<m_settings.m_log2Decim));
ui->glSpectrum->connectTimer(MainCore::instance()->getMasterTimer()); ui->glSpectrum->connectTimer(MainCore::instance()->getMasterTimer());
ui->glScope->connectTimer(MainCore::instance()->getMasterTimer()); ui->glScope->connectTimer(MainCore::instance()->getMasterTimer());
@ -192,6 +194,7 @@ void DemodAnalyzerGUI::displaySettings()
setTitleColor(m_settings.m_rgbColor); setTitleColor(m_settings.m_rgbColor);
setWindowTitle(m_settings.m_title); setWindowTitle(m_settings.m_title);
blockApplySettings(true); blockApplySettings(true);
ui->log2Decim->setCurrentIndex(m_settings.m_log2Decim);
blockApplySettings(false); blockApplySettings(false);
} }
@ -308,6 +311,19 @@ void DemodAnalyzerGUI::on_channelApply_clicked()
} }
} }
void DemodAnalyzerGUI::on_log2Decim_currentIndexChanged(int index)
{
if ((index < 0) || (index > 6)) {
return;
}
m_settings.m_log2Decim = index;
ui->glSpectrum->setSampleRate(m_sampleRate/(1<<m_settings.m_log2Decim));
m_scopeVis->setLiveRate(m_sampleRate/(1<<m_settings.m_log2Decim));
displaySampleRate(m_sampleRate/(1<<m_settings.m_log2Decim));
applySettings();
}
void DemodAnalyzerGUI::tick() void DemodAnalyzerGUI::tick()
{ {
m_channelPowerAvg(m_demodAnalyzer->getMagSqAvg()); m_channelPowerAvg(m_demodAnalyzer->getMagSqAvg());

View File

@ -54,6 +54,7 @@ private:
PluginAPI* m_pluginAPI; PluginAPI* m_pluginAPI;
FeatureUISet* m_featureUISet; FeatureUISet* m_featureUISet;
DemodAnalyzerSettings m_settings; DemodAnalyzerSettings m_settings;
int m_sampleRate;
bool m_doApplySettings; bool m_doApplySettings;
DemodAnalyzer* m_demodAnalyzer; DemodAnalyzer* m_demodAnalyzer;
@ -88,6 +89,7 @@ private slots:
void on_devicesRefresh_clicked(); void on_devicesRefresh_clicked();
void on_channels_currentIndexChanged(int index); void on_channels_currentIndexChanged(int index);
void on_channelApply_clicked(); void on_channelApply_clicked();
void on_log2Decim_currentIndexChanged(int index);
void updateStatus(); void updateStatus();
void tick(); void tick();
}; };

View File

@ -122,7 +122,7 @@
</size> </size>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Reinitialization of device data</string> <string>(Re) apply channel selection</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>
@ -133,6 +133,54 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QComboBox" name="log2Decim">
<property name="maximumSize">
<size>
<width>50</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Channel decimation</string>
</property>
<item>
<property name="text">
<string>1</string>
</property>
</item>
<item>
<property name="text">
<string>2</string>
</property>
</item>
<item>
<property name="text">
<string>4</string>
</property>
</item>
<item>
<property name="text">
<string>8</string>
</property>
</item>
<item>
<property name="text">
<string>16</string>
</property>
</item>
<item>
<property name="text">
<string>32</string>
</property>
</item>
<item>
<property name="text">
<string>64</string>
</property>
</item>
</widget>
</item>
<item> <item>
<widget class="QLabel" name="sinkSampleRateText"> <widget class="QLabel" name="sinkSampleRateText">
<property name="minimumSize"> <property name="minimumSize">

View File

@ -24,12 +24,16 @@
const QStringList DemodAnalyzerSettings::m_channelTypes = { const QStringList DemodAnalyzerSettings::m_channelTypes = {
QStringLiteral("AMDemod"), QStringLiteral("AMDemod"),
QStringLiteral("AMMod") QStringLiteral("AMMod"),
QStringLiteral("DSDDemod"),
QStringLiteral("NFMDemod"),
}; };
const QStringList DemodAnalyzerSettings::m_channelURIs = { const QStringList DemodAnalyzerSettings::m_channelURIs = {
QStringLiteral("sdrangel.channel.amdemod"), QStringLiteral("sdrangel.channel.amdemod"),
QStringLiteral("sdrangel.channeltx.modam") QStringLiteral("sdrangel.channeltx.modam"),
QStringLiteral("sdrangel.channel.dsddemod"),
QStringLiteral("sdrangel.channel.nfmdemod"),
}; };
DemodAnalyzerSettings::DemodAnalyzerSettings() : DemodAnalyzerSettings::DemodAnalyzerSettings() :
@ -41,8 +45,7 @@ DemodAnalyzerSettings::DemodAnalyzerSettings() :
void DemodAnalyzerSettings::resetToDefaults() void DemodAnalyzerSettings::resetToDefaults()
{ {
m_deviceIndex = -1; m_log2Decim = 0;
m_channelIndex = -1;
m_title = "Demod Analyzer"; m_title = "Demod Analyzer";
m_rgbColor = QColor(128, 128, 128).rgb(); m_rgbColor = QColor(128, 128, 128).rgb();
m_useReverseAPI = false; m_useReverseAPI = false;
@ -58,8 +61,7 @@ QByteArray DemodAnalyzerSettings::serialize() const
s.writeBlob(1, m_spectrumGUI->serialize()); s.writeBlob(1, m_spectrumGUI->serialize());
s.writeBlob(2, m_scopeGUI->serialize()); s.writeBlob(2, m_scopeGUI->serialize());
s.writeS32(3, m_deviceIndex); s.writeS32(3, m_log2Decim);
s.writeS32(4, m_channelIndex);
s.writeString(5, m_title); s.writeString(5, m_title);
s.writeU32(6, m_rgbColor); s.writeU32(6, m_rgbColor);
s.writeBool(7, m_useReverseAPI); s.writeBool(7, m_useReverseAPI);
@ -99,9 +101,8 @@ bool DemodAnalyzerSettings::deserialize(const QByteArray& data)
m_scopeGUI->deserialize(bytetmp); m_scopeGUI->deserialize(bytetmp);
} }
d.readS32(3, &m_deviceIndex, -1); d.readS32(3, &m_log2Decim, 0);
d.readS32(4, &m_channelIndex, -1); d.readString(5, &m_title, "Demod Analyzer");
d.readString(5, &m_title, "RigCtl Server");
d.readU32(6, &m_rgbColor, QColor(128, 128, 128).rgb()); d.readU32(6, &m_rgbColor, QColor(128, 128, 128).rgb());
d.readBool(7, &m_useReverseAPI, false); d.readBool(7, &m_useReverseAPI, false);
d.readString(8, &m_reverseAPIAddress, "127.0.0.1"); d.readString(8, &m_reverseAPIAddress, "127.0.0.1");

View File

@ -41,8 +41,7 @@ struct DemodAnalyzerSettings
AvailableChannel& operator=(const AvailableChannel&) = default; AvailableChannel& operator=(const AvailableChannel&) = default;
}; };
int m_deviceIndex; int m_log2Decim;
int m_channelIndex;
QString m_title; QString m_title;
quint32 m_rgbColor; quint32 m_rgbColor;
bool m_useReverseAPI; bool m_useReverseAPI;

View File

@ -69,6 +69,7 @@ void DemodAnalyzerWorker::feedPart(const QByteArray::const_iterator& begin, cons
if (countSamples > m_sampleBufferSize) if (countSamples > m_sampleBufferSize)
{ {
m_sampleBuffer.resize(countSamples); m_sampleBuffer.resize(countSamples);
m_convBuffer.resize(2*countSamples);
m_sampleBufferSize = countSamples; m_sampleBufferSize = countSamples;
} }
@ -77,15 +78,58 @@ void DemodAnalyzerWorker::feedPart(const QByteArray::const_iterator& begin, cons
double re = s[i] / (double) std::numeric_limits<int16_t>::max(); double re = s[i] / (double) std::numeric_limits<int16_t>::max();
m_magsq = re*re; m_magsq = re*re;
m_channelPowerAvg(m_magsq); m_channelPowerAvg(m_magsq);
m_sampleBuffer[i].setReal(re * SDR_RX_SCALEF);
m_sampleBuffer[i].setImag(0); if (m_settings.m_log2Decim == 0)
{
m_sampleBuffer[i].setReal(re * SDR_RX_SCALEF);
m_sampleBuffer[i].setImag(0);
}
else
{
m_convBuffer[2*i] = s[i];
m_convBuffer[2*i+1] = 0;
if (i == countSamples - 1) {
decimate(countSamples);
}
}
} }
if (m_sampleSink) { if (m_sampleSink) {
m_sampleSink->feed(m_sampleBuffer.begin(), m_sampleBuffer.begin() + countSamples, false); m_sampleSink->feed(m_sampleBuffer.begin(), m_sampleBuffer.begin() + countSamples/(1<<m_settings.m_log2Decim), false);
} }
} }
void DemodAnalyzerWorker::decimate(int countSamples)
{
qint16 *buf = m_convBuffer.data();
SampleVector::iterator it = m_sampleBuffer.begin();
switch (m_settings.m_log2Decim)
{
case 1:
m_decimators.decimate2_cen(&it, buf, countSamples*2);
break;
case 2:
m_decimators.decimate4_cen(&it, buf, countSamples*2);
break;
case 3:
m_decimators.decimate8_cen(&it, buf, countSamples*2);
break;
case 4:
m_decimators.decimate16_cen(&it, buf, countSamples*2);
break;
case 5:
m_decimators.decimate32_cen(&it, buf, countSamples*2);
break;
case 6:
m_decimators.decimate64_cen(&it, buf, countSamples*2);
break;
default:
break;
}
}
void DemodAnalyzerWorker::handleInputMessages() void DemodAnalyzerWorker::handleInputMessages()
{ {
Message* message; Message* message;
@ -148,8 +192,7 @@ void DemodAnalyzerWorker::applySettings(const DemodAnalyzerSettings& settings, b
qDebug() << "DemodAnalyzerWorker::applySettings:" qDebug() << "DemodAnalyzerWorker::applySettings:"
<< " m_title: " << settings.m_title << " m_title: " << settings.m_title
<< " m_rgbColor: " << settings.m_rgbColor << " m_rgbColor: " << settings.m_rgbColor
<< " m_deviceIndex: " << settings.m_deviceIndex << " m_log2Decim: " << settings.m_log2Decim
<< " m_channelIndex: " << settings.m_channelIndex
<< " force: " << force; << " force: " << force;
m_settings = settings; m_settings = settings;

View File

@ -18,11 +18,14 @@
#ifndef INCLUDE_DEMODALYZERWORKER_H #ifndef INCLUDE_DEMODALYZERWORKER_H
#define INCLUDE_DEMODALYZERWORKER_H #define INCLUDE_DEMODALYZERWORKER_H
#include <vector>
#include <QObject> #include <QObject>
#include <QMutex> #include <QMutex>
#include <QByteArray> #include <QByteArray>
#include "dsp/dsptypes.h" #include "dsp/dsptypes.h"
#include "dsp/decimators.h"
#include "util/movingaverage.h" #include "util/movingaverage.h"
#include "util/message.h" #include "util/message.h"
#include "util/messagequeue.h" #include "util/messagequeue.h"
@ -110,6 +113,8 @@ private:
DemodAnalyzerSettings m_settings; DemodAnalyzerSettings m_settings;
double m_magsq; double m_magsq;
SampleVector m_sampleBuffer; SampleVector m_sampleBuffer;
std::vector<qint16> m_convBuffer;
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 16, true> m_decimators;
int m_sampleBufferSize; int m_sampleBufferSize;
MovingAverageUtil<double, double, 480> m_channelPowerAvg; MovingAverageUtil<double, double, 480> m_channelPowerAvg;
BasebandSampleSink* m_sampleSink; BasebandSampleSink* m_sampleSink;
@ -117,6 +122,7 @@ private:
QMutex m_mutex; QMutex m_mutex;
bool handleMessage(const Message& cmd); bool handleMessage(const Message& cmd);
void decimate(int countSamples);
private slots: private slots:
void handleInputMessages(); void handleInputMessages();