ATV Demod: methods to set RF filters limits and channel marker bandwidth according to other parameters. Set interpolator filter phases to 16 (/3) to improve performance

This commit is contained in:
f4exb 2017-03-18 11:05:28 +01:00
parent f6cbdbe1ed
commit d6b48ed4d0
4 changed files with 64 additions and 162 deletions

View File

@ -610,7 +610,7 @@ void ATVDemod::applySettings()
} }
m_interpolatorDistanceRemain = 0; m_interpolatorDistanceRemain = 0;
m_interpolator.create(48, m_objConfigPrivate.m_intTVSampleRate, m_objRFConfig.m_fltRFBandwidth / 2.2, 3.0); m_interpolator.create(16, m_objConfigPrivate.m_intTVSampleRate, m_objRFConfig.m_fltRFBandwidth / 2.2, 3.0);
m_objSettingsMutex.unlock(); m_objSettingsMutex.unlock();
} }
@ -657,3 +657,7 @@ int ATVDemod::getSampleRate()
return m_objRunning.m_intSampleRate; return m_objRunning.m_intSampleRate;
} }
int ATVDemod::getEffectiveSampleRate()
{
return m_objRFRunning.m_blndecimatorEnable ? m_objRunningPrivate.m_intTVSampleRate : m_objRunning.m_intSampleRate;
}

View File

@ -144,6 +144,7 @@ public:
void setATVScreen(ATVScreen *objScreen); void setATVScreen(ATVScreen *objScreen);
int getSampleRate(); int getSampleRate();
int getEffectiveSampleRate();
double getMagSq() const { return m_objMagSqAverage.average(); } //!< Beware this is scaled to 2^30 double getMagSq() const { return m_objMagSqAverage.average(); } //!< Beware this is scaled to 2^30
private: private:

View File

@ -174,23 +174,7 @@ bool ATVDemodGUI::handleMessage(const Message& objMessage)
{ {
int sampleRate = ((ATVDemod::MsgReportEffectiveSampleRate&)objMessage).getSampleRate(); int sampleRate = ((ATVDemod::MsgReportEffectiveSampleRate&)objMessage).getSampleRate();
ui->channelSampleRateText->setText(tr("%1k").arg(sampleRate/1000.0f, 0, 'f', 0)); ui->channelSampleRateText->setText(tr("%1k").arg(sampleRate/1000.0f, 0, 'f', 0));
setRFFiltersSlidersRange(sampleRate);
// filter sliders range
if (ui->modulation->currentIndex() == (int) ATVDemod::ATV_VAML)
{
ui->rfBW->setMaximum(sampleRate / 200000);
ui->rfOppBW->setMaximum(sampleRate / 200000);
}
else if (ui->modulation->currentIndex() == (int) ATVDemod::ATV_VAMU)
{
ui->rfBW->setMaximum(sampleRate / 200000);
ui->rfOppBW->setMaximum(sampleRate / 200000);
}
else
{
ui->rfBW->setMaximum(sampleRate / 100000);
ui->rfOppBW->setMaximum(sampleRate / 100000);
}
return true; return true;
} }
@ -208,41 +192,7 @@ void ATVDemodGUI::viewChanged()
void ATVDemodGUI::channelSampleRateChanged() void ATVDemodGUI::channelSampleRateChanged()
{ {
qDebug("ATVDemodGUI::channelSampleRateChanged"); qDebug("ATVDemodGUI::channelSampleRateChanged");
applySettings(); applySettings();
// channel marker
m_blnDoApplySettings = false; // avoid infinite recursion
if (ui->rfFiltering->isChecked())
{
if (ui->modulation->currentIndex() == (int) ATVDemod::ATV_VAML)
{
m_objChannelMarker.setBandwidth(ui->rfBW->value()*100000);
m_objChannelMarker.setOppositeBandwidth(ui->rfOppBW->value()*100000);
m_objChannelMarker.setSidebands(ChannelMarker::vlsb);
}
else if (ui->modulation->currentIndex() == (int) ATVDemod::ATV_VAMU)
{
m_objChannelMarker.setBandwidth(ui->rfBW->value()*100000);
m_objChannelMarker.setOppositeBandwidth(ui->rfOppBW->value()*100000);
m_objChannelMarker.setSidebands(ChannelMarker::vusb);
}
else
{
m_objChannelMarker.setSidebands(ChannelMarker::dsb);
}
}
else
{
m_objChannelMarker.setBandwidth(m_objChannelizer->getInputSampleRate());
m_objChannelMarker.setSidebands(ChannelMarker::dsb);
}
m_blnDoApplySettings = true;
applyRFSettings(); applyRFSettings();
} }
@ -382,6 +332,52 @@ void ATVDemodGUI::applyRFSettings()
} }
} }
void ATVDemodGUI::setChannelMarkerBandwidth()
{
m_blnDoApplySettings = false; // avoid infinite recursion
if (ui->rfFiltering->isChecked()) // FFT filter
{
m_objChannelMarker.setBandwidth(ui->rfBW->value()*100000);
m_objChannelMarker.setOppositeBandwidth(ui->rfOppBW->value()*100000);
if (ui->modulation->currentIndex() == (int) ATVDemod::ATV_VAML) {
m_objChannelMarker.setSidebands(ChannelMarker::vlsb);
} else if (ui->modulation->currentIndex() == (int) ATVDemod::ATV_VAMU) {
m_objChannelMarker.setSidebands(ChannelMarker::vusb);
} else {
m_objChannelMarker.setSidebands(ChannelMarker::vusb);
}
}
else
{
if (ui->decimatorEnable->isChecked()) {
m_objChannelMarker.setBandwidth(ui->rfBW->value()*100000);
} else {
m_objChannelMarker.setBandwidth(m_objChannelizer->getInputSampleRate());
}
m_objChannelMarker.setSidebands(ChannelMarker::dsb);
}
m_blnDoApplySettings = true;
}
void ATVDemodGUI::setRFFiltersSlidersRange(int sampleRate)
{
// RF filters sliders range
if (ui->rfFiltering->isChecked())
{
ui->rfBW->setMaximum(sampleRate / 200000);
ui->rfOppBW->setMaximum(sampleRate / 200000);
}
else
{
ui->rfBW->setMaximum(sampleRate / 100000);
ui->rfOppBW->setMaximum(sampleRate / 100000);
}
}
void ATVDemodGUI::leaveEvent(QEvent*) void ATVDemodGUI::leaveEvent(QEvent*)
{ {
blockApplySettings(true); blockApplySettings(true);
@ -469,136 +465,35 @@ void ATVDemodGUI::on_reset_clicked(bool checked)
void ATVDemodGUI::on_modulation_currentIndexChanged(int index) void ATVDemodGUI::on_modulation_currentIndexChanged(int index)
{ {
// RF filters setRFFiltersSlidersRange(m_objATVDemod->getEffectiveSampleRate());
setChannelMarkerBandwidth();
if (index == (int) ATVDemod::ATV_VAML)
{
ui->rfBW->setMaximum(m_objChannelizer->getInputSampleRate() / 200000);
ui->rfOppBW->setMaximum(m_objChannelizer->getInputSampleRate() / 200000);
}
else if (index == (int) ATVDemod::ATV_VAMU)
{
ui->rfBW->setMaximum(m_objChannelizer->getInputSampleRate() / 200000);
ui->rfOppBW->setMaximum(m_objChannelizer->getInputSampleRate() / 200000);
}
else
{
ui->rfBW->setMaximum(m_objChannelizer->getInputSampleRate() / 100000);
ui->rfOppBW->setMaximum(m_objChannelizer->getInputSampleRate() / 100000);
}
// channel marker
m_blnDoApplySettings = false; // avoid infinite recursion
if (ui->rfFiltering->isChecked())
{
if (ui->modulation->currentIndex() == (int) ATVDemod::ATV_VAML)
{
m_objChannelMarker.setBandwidth(ui->rfBW->value()*100000);
m_objChannelMarker.setOppositeBandwidth(ui->rfOppBW->value()*100000);
m_objChannelMarker.setSidebands(ChannelMarker::vlsb);
}
else if (ui->modulation->currentIndex() == (int) ATVDemod::ATV_VAMU)
{
m_objChannelMarker.setBandwidth(ui->rfBW->value()*100000);
m_objChannelMarker.setOppositeBandwidth(ui->rfOppBW->value()*100000);
m_objChannelMarker.setSidebands(ChannelMarker::vusb);
}
else
{
m_objChannelMarker.setBandwidth(ui->rfBW->value()*100000);
m_objChannelMarker.setSidebands(ChannelMarker::dsb);
}
}
else
{
m_objChannelMarker.setBandwidth(m_objChannelizer->getInputSampleRate());
m_objChannelMarker.setSidebands(ChannelMarker::dsb);
}
m_blnDoApplySettings = true;
applyRFSettings(); applyRFSettings();
} }
void ATVDemodGUI::on_rfBW_valueChanged(int value) void ATVDemodGUI::on_rfBW_valueChanged(int value)
{ {
ui->rfBWText->setText(QString("%1 MHz").arg(value / 10.0, 0, 'f', 1)); ui->rfBWText->setText(QString("%1 MHz").arg(value / 10.0, 0, 'f', 1));
setChannelMarkerBandwidth();
// channel marker applyRFSettings();
if (ui->rfFiltering->isChecked())
{
m_blnDoApplySettings = false; // avoid infinite recursion
m_objChannelMarker.setBandwidth(ui->rfBW->value()*100000);
m_blnDoApplySettings = true;
applyRFSettings();
}
} }
void ATVDemodGUI::on_rfOppBW_valueChanged(int value) void ATVDemodGUI::on_rfOppBW_valueChanged(int value)
{ {
ui->rfOppBWText->setText(QString("%1").arg(value / 10.0, 0, 'f', 1)); ui->rfOppBWText->setText(QString("%1").arg(value / 10.0, 0, 'f', 1));
setChannelMarkerBandwidth();
// channel marker applyRFSettings();
if (ui->rfFiltering->isChecked())
{
m_blnDoApplySettings = false; // avoid infinite recursion
if (ui->modulation->currentIndex() == (int) ATVDemod::ATV_VAML)
{
m_objChannelMarker.setOppositeBandwidth(ui->rfOppBW->value()*100000);
}
else if (ui->modulation->currentIndex() == (int) ATVDemod::ATV_VAMU)
{
m_objChannelMarker.setOppositeBandwidth(ui->rfOppBW->value()*100000);
}
m_blnDoApplySettings = true;
applyRFSettings();
}
} }
void ATVDemodGUI::on_rfFiltering_toggled(bool checked) void ATVDemodGUI::on_rfFiltering_toggled(bool checked)
{ {
// channel marker setRFFiltersSlidersRange(m_objATVDemod->getEffectiveSampleRate());
setChannelMarkerBandwidth();
m_blnDoApplySettings = false; // avoid infinite recursion
if (ui->rfFiltering->isChecked())
{
m_objChannelMarker.setBandwidth(ui->rfBW->value()*100000);
if (ui->modulation->currentIndex() == (int) ATVDemod::ATV_VAML)
{
m_objChannelMarker.setOppositeBandwidth(ui->rfOppBW->value()*100000);
m_objChannelMarker.setSidebands(ChannelMarker::vlsb);
}
else if (ui->modulation->currentIndex() == (int) ATVDemod::ATV_VAMU)
{
m_objChannelMarker.setOppositeBandwidth(ui->rfOppBW->value()*100000);
m_objChannelMarker.setSidebands(ChannelMarker::vusb);
}
else
{
m_objChannelMarker.setOppositeBandwidth(ui->rfOppBW->value()*100000);
m_objChannelMarker.setSidebands(ChannelMarker::dsb);
}
}
else
{
m_objChannelMarker.setBandwidth(m_objChannelizer->getInputSampleRate());
m_objChannelMarker.setSidebands(ChannelMarker::dsb);
}
m_blnDoApplySettings = true;
applyRFSettings(); applyRFSettings();
} }
void ATVDemodGUI::on_decimatorEnable_toggled(bool checked) void ATVDemodGUI::on_decimatorEnable_toggled(bool checked)
{ {
setChannelMarkerBandwidth();
applyRFSettings(); applyRFSettings();
} }

View File

@ -101,6 +101,8 @@ private:
void blockApplySettings(bool blnBlock); void blockApplySettings(bool blnBlock);
void applySettings(); void applySettings();
void applyRFSettings(); void applyRFSettings();
void setChannelMarkerBandwidth();
void setRFFiltersSlidersRange(int sampleRate);
void leaveEvent(QEvent*); void leaveEvent(QEvent*);
void enterEvent(QEvent*); void enterEvent(QEvent*);