2017-02-23 02:18:56 -05:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Copyright (C) 2017 F4HKW //
|
|
|
|
// for F4EXB / SDRAngel //
|
|
|
|
// //
|
|
|
|
// This program is free software; you can redistribute it and/or modify //
|
|
|
|
// it under the terms of the GNU General Public License as published by //
|
|
|
|
// the Free Software Foundation as version 3 of the License, or //
|
|
|
|
// //
|
|
|
|
// This program is distributed in the hope that it will be useful, //
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
|
|
|
// GNU General Public License V3 for more details. //
|
|
|
|
// //
|
|
|
|
// You should have received a copy of the GNU General Public License //
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <QDockWidget>
|
|
|
|
#include <QMainWindow>
|
|
|
|
|
|
|
|
#include "atvdemodgui.h"
|
|
|
|
|
|
|
|
#include "device/devicesourceapi.h"
|
|
|
|
#include "dsp/downchannelizer.h"
|
|
|
|
|
|
|
|
#include "dsp/threadedbasebandsamplesink.h"
|
2017-03-20 06:57:52 -04:00
|
|
|
#include "dsp/scopevisng.h"
|
2017-02-23 02:18:56 -05:00
|
|
|
#include "ui_atvdemodgui.h"
|
|
|
|
#include "plugin/pluginapi.h"
|
|
|
|
#include "util/simpleserializer.h"
|
|
|
|
#include "util/db.h"
|
|
|
|
#include "gui/basicchannelsettingswidget.h"
|
|
|
|
#include "dsp/dspengine.h"
|
|
|
|
#include "mainwindow.h"
|
|
|
|
|
|
|
|
#include "atvdemod.h"
|
|
|
|
|
|
|
|
const QString ATVDemodGUI::m_strChannelID = "sdrangel.channel.demodatv";
|
|
|
|
|
2017-02-25 04:15:47 -05:00
|
|
|
ATVDemodGUI* ATVDemodGUI::create(PluginAPI* objPluginAPI,
|
|
|
|
DeviceSourceAPI *objDeviceAPI)
|
2017-02-23 02:18:56 -05:00
|
|
|
{
|
|
|
|
ATVDemodGUI* gui = new ATVDemodGUI(objPluginAPI, objDeviceAPI);
|
2017-02-25 04:15:47 -05:00
|
|
|
return gui;
|
2017-02-23 02:18:56 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void ATVDemodGUI::destroy()
|
|
|
|
{
|
|
|
|
delete this;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ATVDemodGUI::setName(const QString& strName)
|
|
|
|
{
|
|
|
|
setObjectName(strName);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString ATVDemodGUI::getName() const
|
|
|
|
{
|
2017-02-25 04:15:47 -05:00
|
|
|
return objectName();
|
2017-02-23 02:18:56 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
qint64 ATVDemodGUI::getCenterFrequency() const
|
|
|
|
{
|
|
|
|
return m_objChannelMarker.getCenterFrequency();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ATVDemodGUI::setCenterFrequency(qint64 intCenterFrequency)
|
|
|
|
{
|
|
|
|
m_objChannelMarker.setCenterFrequency(intCenterFrequency);
|
2017-02-25 04:15:47 -05:00
|
|
|
applySettings();
|
2017-02-23 02:18:56 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void ATVDemodGUI::resetToDefaults()
|
|
|
|
{
|
2017-02-25 04:15:47 -05:00
|
|
|
blockApplySettings(true);
|
2017-02-23 02:18:56 -05:00
|
|
|
|
2017-02-25 04:15:47 -05:00
|
|
|
//********** ATV Default values **********
|
|
|
|
ui->synchLevel->setValue(100);
|
|
|
|
ui->blackLevel->setValue(310);
|
2017-03-20 20:30:46 -04:00
|
|
|
ui->lineTime->setValue(0);
|
2017-02-25 04:15:47 -05:00
|
|
|
ui->topTime->setValue(3);
|
|
|
|
ui->modulation->setCurrentIndex(0);
|
|
|
|
ui->fps->setCurrentIndex(0);
|
|
|
|
ui->hSync->setChecked(true);
|
|
|
|
ui->vSync->setChecked(true);
|
|
|
|
ui->halfImage->setChecked(false);
|
2017-03-19 14:10:48 -04:00
|
|
|
ui->invertVideo->setChecked(false);
|
2017-04-08 00:54:24 -04:00
|
|
|
ui->standard->setCurrentIndex(1);
|
2017-03-19 14:10:48 -04:00
|
|
|
|
|
|
|
//********** RF Default values **********
|
|
|
|
ui->decimatorEnable->setChecked(false);
|
|
|
|
ui->rfFiltering->setChecked(false);
|
|
|
|
ui->rfBW->setValue(10);
|
|
|
|
ui->rfOppBW->setValue(10);
|
|
|
|
ui->bfo->setValue(0);
|
2017-04-09 01:27:32 -04:00
|
|
|
ui->fmDeviation->setValue(250);
|
2017-02-23 02:18:56 -05:00
|
|
|
|
|
|
|
blockApplySettings(false);
|
2017-03-20 17:37:11 -04:00
|
|
|
lineTimeUpdate();
|
2017-03-26 17:47:21 -04:00
|
|
|
topTimeUpdate();
|
2017-02-25 04:15:47 -05:00
|
|
|
applySettings();
|
2017-02-23 02:18:56 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
QByteArray ATVDemodGUI::serialize() const
|
|
|
|
{
|
2017-02-25 04:15:47 -05:00
|
|
|
SimpleSerializer s(1);
|
2017-02-23 02:18:56 -05:00
|
|
|
|
2017-02-25 04:34:05 -05:00
|
|
|
s.writeS32(1, m_objChannelMarker.getCenterFrequency());
|
|
|
|
s.writeU32(2, m_objChannelMarker.getColor().rgb());
|
|
|
|
s.writeS32(3, ui->synchLevel->value());
|
|
|
|
s.writeS32(4, ui->blackLevel->value());
|
|
|
|
s.writeS32(5, ui->lineTime->value());
|
|
|
|
s.writeS32(6, ui->topTime->value());
|
|
|
|
s.writeS32(7, ui->modulation->currentIndex());
|
|
|
|
s.writeS32(8, ui->fps->currentIndex());
|
|
|
|
s.writeBool(9, ui->hSync->isChecked());
|
|
|
|
s.writeBool(10, ui->vSync->isChecked());
|
|
|
|
s.writeBool(11, ui->halfImage->isChecked());
|
2017-03-18 11:10:16 -04:00
|
|
|
s.writeS32(12, ui->rfBW->value());
|
|
|
|
s.writeS32(13, ui->rfOppBW->value());
|
2017-03-19 05:28:54 -04:00
|
|
|
s.writeS32(14, ui->bfo->value());
|
2017-03-19 14:10:48 -04:00
|
|
|
s.writeBool(15, ui->invertVideo->isChecked());
|
2017-03-20 17:37:11 -04:00
|
|
|
s.writeS32(16, ui->nbLines->currentIndex());
|
2017-03-22 18:55:47 -04:00
|
|
|
s.writeS32(17, ui->fmDeviation->value());
|
2017-03-28 20:29:20 -04:00
|
|
|
s.writeS32(18, ui->standard->currentIndex());
|
2017-02-23 02:18:56 -05:00
|
|
|
|
|
|
|
return s.final();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ATVDemodGUI::deserialize(const QByteArray& arrData)
|
|
|
|
{
|
|
|
|
SimpleDeserializer d(arrData);
|
|
|
|
|
2017-02-25 04:15:47 -05:00
|
|
|
if (!d.isValid())
|
2017-02-23 02:18:56 -05:00
|
|
|
{
|
2017-02-25 04:15:47 -05:00
|
|
|
resetToDefaults();
|
|
|
|
return false;
|
|
|
|
}
|
2017-02-23 02:18:56 -05:00
|
|
|
|
2017-02-25 04:15:47 -05:00
|
|
|
if (d.getVersion() == 1)
|
2017-02-23 02:18:56 -05:00
|
|
|
{
|
2017-02-25 04:15:47 -05:00
|
|
|
QByteArray bytetmp;
|
2017-02-25 04:34:05 -05:00
|
|
|
uint32_t u32tmp;
|
|
|
|
int tmp;
|
|
|
|
bool booltmp;
|
2017-02-23 02:18:56 -05:00
|
|
|
|
2017-02-25 04:15:47 -05:00
|
|
|
blockApplySettings(true);
|
2017-02-23 02:18:56 -05:00
|
|
|
m_objChannelMarker.blockSignals(true);
|
|
|
|
|
2017-02-25 04:15:47 -05:00
|
|
|
d.readS32(1, &tmp, 0);
|
2017-02-23 02:18:56 -05:00
|
|
|
m_objChannelMarker.setCenterFrequency(tmp);
|
|
|
|
|
2017-03-18 12:56:32 -04:00
|
|
|
// if (d.readU32(2, &u32tmp)) {
|
|
|
|
// m_objChannelMarker.setColor(u32tmp);
|
|
|
|
// } else {
|
|
|
|
// m_objChannelMarker.setColor(Qt::white);
|
|
|
|
// }
|
2017-02-23 02:18:56 -05:00
|
|
|
|
2017-02-25 04:34:05 -05:00
|
|
|
d.readS32(3, &tmp, 100);
|
|
|
|
ui->synchLevel->setValue(tmp);
|
|
|
|
d.readS32(4, &tmp, 310);
|
|
|
|
ui->blackLevel->setValue(tmp);
|
2017-03-20 20:30:46 -04:00
|
|
|
d.readS32(5, &tmp, 0);
|
2017-02-25 04:34:05 -05:00
|
|
|
ui->lineTime->setValue(tmp);
|
|
|
|
d.readS32(6, &tmp, 3);
|
|
|
|
ui->topTime->setValue(tmp);
|
|
|
|
d.readS32(7, &tmp, 0);
|
|
|
|
ui->modulation->setCurrentIndex(tmp);
|
|
|
|
d.readS32(8, &tmp, 0);
|
|
|
|
ui->fps->setCurrentIndex(tmp);
|
|
|
|
d.readBool(9, &booltmp, true);
|
|
|
|
ui->hSync->setChecked(booltmp);
|
|
|
|
d.readBool(10, &booltmp, true);
|
|
|
|
ui->vSync->setChecked(booltmp);
|
|
|
|
d.readBool(11, &booltmp, false);
|
|
|
|
ui->halfImage->setChecked(booltmp);
|
2017-03-18 11:10:16 -04:00
|
|
|
d.readS32(12, &tmp, 10);
|
|
|
|
ui->rfBW->setValue(tmp);
|
|
|
|
d.readS32(13, &tmp, 10);
|
|
|
|
ui->rfOppBW->setValue(tmp);
|
2017-03-19 05:28:54 -04:00
|
|
|
d.readS32(14, &tmp, 10);
|
|
|
|
ui->bfo->setValue(tmp);
|
2017-03-19 14:10:48 -04:00
|
|
|
d.readBool(15, &booltmp, true);
|
|
|
|
ui->invertVideo->setChecked(booltmp);
|
2017-03-20 17:37:11 -04:00
|
|
|
d.readS32(16, &tmp, 0);
|
|
|
|
ui->nbLines->setCurrentIndex(tmp);
|
2017-04-09 01:27:32 -04:00
|
|
|
d.readS32(17, &tmp, 250);
|
2017-03-22 18:55:47 -04:00
|
|
|
ui->fmDeviation->setValue(tmp);
|
2017-04-08 00:54:24 -04:00
|
|
|
d.readS32(18, &tmp, 1);
|
2017-03-28 20:29:20 -04:00
|
|
|
ui->standard->setCurrentIndex(tmp);
|
2017-02-25 04:34:05 -05:00
|
|
|
|
2017-02-23 02:18:56 -05:00
|
|
|
blockApplySettings(false);
|
|
|
|
m_objChannelMarker.blockSignals(false);
|
|
|
|
|
2017-03-20 17:37:11 -04:00
|
|
|
lineTimeUpdate();
|
2017-03-26 17:47:21 -04:00
|
|
|
topTimeUpdate();
|
2017-02-25 04:15:47 -05:00
|
|
|
applySettings();
|
|
|
|
return true;
|
|
|
|
}
|
2017-02-23 02:18:56 -05:00
|
|
|
else
|
|
|
|
{
|
2017-02-25 04:15:47 -05:00
|
|
|
resetToDefaults();
|
|
|
|
return false;
|
|
|
|
}
|
2017-02-23 02:18:56 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bool ATVDemodGUI::handleMessage(const Message& objMessage)
|
|
|
|
{
|
2017-03-18 05:04:57 -04:00
|
|
|
if (ATVDemod::MsgReportEffectiveSampleRate::match(objMessage))
|
|
|
|
{
|
|
|
|
int sampleRate = ((ATVDemod::MsgReportEffectiveSampleRate&)objMessage).getSampleRate();
|
2017-03-23 21:42:36 -04:00
|
|
|
int nbPointsPerLine = ((ATVDemod::MsgReportEffectiveSampleRate&)objMessage).getNbPointsPerLine();
|
2017-04-09 00:48:29 -04:00
|
|
|
ui->channelSampleRateText->setText(tr("%1k").arg(sampleRate/1000.0f, 0, 'f', 2));
|
2017-03-23 21:42:36 -04:00
|
|
|
ui->nbPointsPerLineText->setText(tr("%1p").arg(nbPointsPerLine));
|
2017-04-06 19:35:08 -04:00
|
|
|
m_objScopeVis->setSampleRate(sampleRate);
|
2017-03-18 06:05:28 -04:00
|
|
|
setRFFiltersSlidersRange(sampleRate);
|
2017-03-23 20:01:53 -04:00
|
|
|
lineTimeUpdate();
|
2017-03-26 17:47:21 -04:00
|
|
|
topTimeUpdate();
|
2017-03-18 05:04:57 -04:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2017-02-23 02:18:56 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void ATVDemodGUI::viewChanged()
|
|
|
|
{
|
2017-03-18 08:19:24 -04:00
|
|
|
qDebug("ATVDemodGUI::viewChanged");
|
2017-02-25 04:15:47 -05:00
|
|
|
applySettings();
|
2017-03-18 08:19:24 -04:00
|
|
|
applyRFSettings();
|
2017-02-23 02:18:56 -05:00
|
|
|
}
|
|
|
|
|
2017-02-25 05:52:57 -05:00
|
|
|
void ATVDemodGUI::channelSampleRateChanged()
|
|
|
|
{
|
2017-02-25 07:14:29 -05:00
|
|
|
qDebug("ATVDemodGUI::channelSampleRateChanged");
|
2017-02-25 05:52:57 -05:00
|
|
|
applySettings();
|
2017-03-17 05:52:18 -04:00
|
|
|
applyRFSettings();
|
2017-02-25 05:52:57 -05:00
|
|
|
}
|
|
|
|
|
2017-03-18 05:04:57 -04:00
|
|
|
void ATVDemodGUI::handleSourceMessages()
|
|
|
|
{
|
|
|
|
Message* message;
|
|
|
|
|
|
|
|
while ((message = m_objATVDemod->getOutputMessageQueue()->pop()) != 0)
|
|
|
|
{
|
|
|
|
if (handleMessage(*message))
|
|
|
|
{
|
|
|
|
delete message;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-23 02:18:56 -05:00
|
|
|
void ATVDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void ATVDemodGUI::onMenuDoubleClicked()
|
|
|
|
{
|
2017-02-25 04:15:47 -05:00
|
|
|
if (!m_blnBasicSettingsShown)
|
2017-02-23 02:18:56 -05:00
|
|
|
{
|
|
|
|
m_blnBasicSettingsShown = true;
|
2017-02-25 04:15:47 -05:00
|
|
|
BasicChannelSettingsWidget* bcsw = new BasicChannelSettingsWidget(
|
|
|
|
&m_objChannelMarker, this);
|
2017-02-23 02:18:56 -05:00
|
|
|
bcsw->show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-25 04:15:47 -05:00
|
|
|
ATVDemodGUI::ATVDemodGUI(PluginAPI* objPluginAPI, DeviceSourceAPI *objDeviceAPI,
|
|
|
|
QWidget* objParent) :
|
2017-03-15 17:12:12 -04:00
|
|
|
RollupWidget(objParent),
|
|
|
|
ui(new Ui::ATVDemodGUI),
|
|
|
|
m_objPluginAPI(objPluginAPI),
|
|
|
|
m_objDeviceAPI(objDeviceAPI),
|
|
|
|
m_objChannelMarker(this),
|
|
|
|
m_blnBasicSettingsShown(false),
|
2017-03-16 13:56:20 -04:00
|
|
|
m_blnDoApplySettings(true),
|
|
|
|
m_intTickCount(0)
|
2017-02-23 02:18:56 -05:00
|
|
|
{
|
2017-02-25 04:15:47 -05:00
|
|
|
ui->setupUi(this);
|
|
|
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
2017-03-15 17:12:12 -04:00
|
|
|
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
|
|
|
connect(this, SIGNAL(menuDoubleClickEvent()), this, SLOT(onMenuDoubleClicked()));
|
2017-02-23 02:18:56 -05:00
|
|
|
|
2017-03-20 06:57:52 -04:00
|
|
|
m_objScopeVis = new ScopeVisNG(ui->glScope);
|
|
|
|
m_objATVDemod = new ATVDemod(m_objScopeVis);
|
2017-03-16 21:05:13 -04:00
|
|
|
m_objATVDemod->setATVScreen(ui->screenTV);
|
2017-02-23 02:18:56 -05:00
|
|
|
|
|
|
|
m_objChannelizer = new DownChannelizer(m_objATVDemod);
|
2017-03-15 17:12:12 -04:00
|
|
|
m_objThreadedChannelizer = new ThreadedBasebandSampleSink(m_objChannelizer, this);
|
2017-02-23 02:18:56 -05:00
|
|
|
m_objDeviceAPI->addThreadedSink(m_objThreadedChannelizer);
|
|
|
|
|
2017-03-20 06:57:52 -04:00
|
|
|
ui->glScope->connectTimer(m_objPluginAPI->getMainWindow()->getMasterTimer());
|
2017-03-16 13:56:20 -04:00
|
|
|
connect(&m_objPluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); // 50 ms
|
2017-02-23 02:18:56 -05:00
|
|
|
|
2017-03-15 13:56:38 -04:00
|
|
|
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
|
2017-03-15 17:12:12 -04:00
|
|
|
ui->deltaFrequency->setValueRange(7, 0U, 9999999U);
|
2017-03-15 13:56:38 -04:00
|
|
|
|
2017-03-15 17:12:12 -04:00
|
|
|
connect(m_objChannelizer, SIGNAL(inputSampleRateChanged()), this, SLOT(channelSampleRateChanged()));
|
|
|
|
|
|
|
|
//m_objPluginAPI->addThreadedSink(m_objThreadedChannelizer);
|
2017-02-23 02:18:56 -05:00
|
|
|
m_objChannelMarker.setColor(Qt::white);
|
2017-03-15 19:39:49 -04:00
|
|
|
m_objChannelMarker.setMovable(false);
|
2017-02-23 02:18:56 -05:00
|
|
|
m_objChannelMarker.setBandwidth(6000000);
|
|
|
|
m_objChannelMarker.setCenterFrequency(0);
|
|
|
|
m_objChannelMarker.setVisible(true);
|
2017-03-18 12:56:32 -04:00
|
|
|
setTitleColor(m_objChannelMarker.getColor());
|
2017-02-23 02:18:56 -05:00
|
|
|
|
2017-03-17 19:11:48 -04:00
|
|
|
connect(&m_objChannelMarker, SIGNAL(changed()), this, SLOT(viewChanged()));
|
2017-02-23 02:18:56 -05:00
|
|
|
|
|
|
|
m_objDeviceAPI->registerChannelInstance(m_strChannelID, this);
|
|
|
|
m_objDeviceAPI->addChannelMarker(&m_objChannelMarker);
|
|
|
|
m_objDeviceAPI->addRollupWidget(this);
|
|
|
|
|
2017-02-24 23:45:42 -05:00
|
|
|
//ui->screenTV->connectTimer(m_objPluginAPI->getMainWindow()->getMasterTimer());
|
2017-02-23 02:18:56 -05:00
|
|
|
|
2017-03-17 06:17:15 -04:00
|
|
|
m_objMagSqAverage.resize(4, 1.0);
|
|
|
|
|
2017-03-20 06:57:52 -04:00
|
|
|
ui->scopeGUI->setBuddies(m_objScopeVis->getInputMessageQueue(), m_objScopeVis, ui->glScope);
|
|
|
|
|
2017-02-25 04:15:47 -05:00
|
|
|
resetToDefaults(); // does applySettings()
|
2017-03-18 05:04:57 -04:00
|
|
|
|
2017-03-21 06:24:46 -04:00
|
|
|
ui->scopeGUI->setPreTrigger(1);
|
|
|
|
ScopeVisNG::TraceData traceData;
|
|
|
|
traceData.m_amp = 2.0; // amplification factor
|
|
|
|
traceData.m_ampIndex = 1; // this is second step
|
|
|
|
traceData.m_ofs = 0.5; // direct offset
|
|
|
|
traceData.m_ofsCoarse = 50; // this is 50 coarse steps
|
|
|
|
ui->scopeGUI->changeTrace(0, traceData);
|
|
|
|
ui->scopeGUI->focusOnTrace(0); // re-focus to take changes into account in the GUI
|
|
|
|
ScopeVisNG::TriggerData triggerData;
|
|
|
|
triggerData.m_triggerLevel = 0.1;
|
|
|
|
triggerData.m_triggerLevelCoarse = 10;
|
|
|
|
triggerData.m_triggerPositiveEdge = false;
|
|
|
|
ui->scopeGUI->changeTrigger(0, triggerData);
|
|
|
|
ui->scopeGUI->focusOnTrigger(0); // re-focus to take changes into account in the GUI
|
|
|
|
|
2017-03-18 05:04:57 -04:00
|
|
|
connect(m_objATVDemod->getOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
|
2017-03-22 18:55:47 -04:00
|
|
|
|
|
|
|
QChar delta = QChar(0x94, 0x03);
|
|
|
|
ui->fmDeviationLabel->setText(delta);
|
2017-02-23 02:18:56 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
ATVDemodGUI::~ATVDemodGUI()
|
|
|
|
{
|
|
|
|
m_objDeviceAPI->removeChannelInstance(this);
|
|
|
|
m_objDeviceAPI->removeThreadedSink(m_objThreadedChannelizer);
|
|
|
|
delete m_objThreadedChannelizer;
|
|
|
|
delete m_objChannelizer;
|
|
|
|
delete m_objATVDemod;
|
2017-03-20 06:57:52 -04:00
|
|
|
delete m_objScopeVis;
|
2017-02-23 02:18:56 -05:00
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ATVDemodGUI::blockApplySettings(bool blnBlock)
|
|
|
|
{
|
|
|
|
m_blnDoApplySettings = !blnBlock;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ATVDemodGUI::applySettings()
|
|
|
|
{
|
|
|
|
if (m_blnDoApplySettings)
|
2017-02-25 04:15:47 -05:00
|
|
|
{
|
2017-03-15 13:56:38 -04:00
|
|
|
ui->deltaFrequency->setValue(abs(m_objChannelMarker.getCenterFrequency()));
|
|
|
|
ui->deltaFrequencyMinus->setChecked(m_objChannelMarker.getCenterFrequency() < 0);
|
2017-02-23 02:18:56 -05:00
|
|
|
|
2017-02-25 04:15:47 -05:00
|
|
|
m_objChannelizer->configure(m_objChannelizer->getInputMessageQueue(),
|
2017-02-25 05:21:38 -05:00
|
|
|
m_objChannelizer->getInputSampleRate(), // always use maximum available bandwidth
|
2017-02-25 04:15:47 -05:00
|
|
|
m_objChannelMarker.getCenterFrequency());
|
2017-02-23 02:18:56 -05:00
|
|
|
|
|
|
|
m_objATVDemod->configure(m_objATVDemod->getInputMessageQueue(),
|
2017-03-20 17:37:11 -04:00
|
|
|
getNominalLineTime(ui->nbLines->currentIndex(), ui->fps->currentIndex()) + ui->lineTime->value() * m_fltLineTimeMultiplier,
|
2017-03-26 17:47:21 -04:00
|
|
|
getNominalLineTime(ui->nbLines->currentIndex(), ui->fps->currentIndex()) * (4.7f / 64.0f) + ui->topTime->value() * m_fltTopTimeMultiplier,
|
2017-03-20 20:30:46 -04:00
|
|
|
getFps(ui->fps->currentIndex()),
|
2017-03-26 20:29:02 -04:00
|
|
|
(ATVDemod::ATVStd) ui->standard->currentIndex(),
|
2017-04-02 17:20:25 -04:00
|
|
|
getNumberOfLines(ui->nbLines->currentIndex()),
|
2017-03-16 19:12:12 -04:00
|
|
|
(ui->halfImage->checkState() == Qt::Checked) ? 0.5f : 1.0f,
|
|
|
|
ui->synchLevel->value() / 1000.0f,
|
|
|
|
ui->blackLevel->value() / 1000.0f,
|
2017-03-16 15:57:00 -04:00
|
|
|
ui->hSync->isChecked(),
|
2017-03-19 14:10:48 -04:00
|
|
|
ui->vSync->isChecked(),
|
2017-03-24 07:57:49 -04:00
|
|
|
ui->invertVideo->isChecked(),
|
|
|
|
ui->screenTabWidget->currentIndex());
|
2017-02-23 02:18:56 -05:00
|
|
|
|
2017-02-25 07:14:29 -05:00
|
|
|
qDebug() << "ATVDemodGUI::applySettings:"
|
|
|
|
<< " m_objChannelizer.inputSampleRate: " << m_objChannelizer->getInputSampleRate()
|
2017-03-16 21:05:13 -04:00
|
|
|
<< " m_objATVDemod.sampleRate: " << m_objATVDemod->getSampleRate();
|
2017-02-25 04:15:47 -05:00
|
|
|
}
|
2017-02-23 02:18:56 -05:00
|
|
|
}
|
|
|
|
|
2017-03-17 05:04:00 -04:00
|
|
|
void ATVDemodGUI::applyRFSettings()
|
|
|
|
{
|
|
|
|
if (m_blnDoApplySettings)
|
|
|
|
{
|
|
|
|
m_objATVDemod->configureRF(m_objATVDemod->getInputMessageQueue(),
|
|
|
|
(ATVDemod::ATVModulation) ui->modulation->currentIndex(),
|
2017-03-21 10:10:01 -04:00
|
|
|
ui->rfBW->value() * m_rfSliderDivisor * 1.0f,
|
|
|
|
ui->rfOppBW->value() * m_rfSliderDivisor * 1.0f,
|
2017-03-17 06:46:38 -04:00
|
|
|
ui->rfFiltering->isChecked(),
|
2017-03-19 05:28:54 -04:00
|
|
|
ui->decimatorEnable->isChecked(),
|
2017-04-06 20:26:34 -04:00
|
|
|
ui->bfo->value(),
|
2017-04-09 01:27:32 -04:00
|
|
|
ui->fmDeviation->value() / 500.0f);
|
2017-03-17 05:04:00 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-18 06:05:28 -04:00
|
|
|
void ATVDemodGUI::setChannelMarkerBandwidth()
|
|
|
|
{
|
|
|
|
m_blnDoApplySettings = false; // avoid infinite recursion
|
|
|
|
|
|
|
|
if (ui->rfFiltering->isChecked()) // FFT filter
|
|
|
|
{
|
2017-03-21 10:10:01 -04:00
|
|
|
m_objChannelMarker.setBandwidth(ui->rfBW->value()*m_rfSliderDivisor);
|
|
|
|
m_objChannelMarker.setOppositeBandwidth(ui->rfOppBW->value()*m_rfSliderDivisor);
|
2017-03-18 06:05:28 -04:00
|
|
|
|
2017-03-19 05:28:54 -04:00
|
|
|
if (ui->modulation->currentIndex() == (int) ATVDemod::ATV_LSB) {
|
2017-03-18 06:05:28 -04:00
|
|
|
m_objChannelMarker.setSidebands(ChannelMarker::vlsb);
|
2017-03-19 05:28:54 -04:00
|
|
|
} else if (ui->modulation->currentIndex() == (int) ATVDemod::ATV_USB) {
|
2017-03-18 06:05:28 -04:00
|
|
|
m_objChannelMarker.setSidebands(ChannelMarker::vusb);
|
|
|
|
} else {
|
|
|
|
m_objChannelMarker.setSidebands(ChannelMarker::vusb);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (ui->decimatorEnable->isChecked()) {
|
2017-03-21 10:10:01 -04:00
|
|
|
m_objChannelMarker.setBandwidth(ui->rfBW->value()*m_rfSliderDivisor);
|
2017-03-18 06:05:28 -04:00
|
|
|
} else {
|
|
|
|
m_objChannelMarker.setBandwidth(m_objChannelizer->getInputSampleRate());
|
|
|
|
}
|
|
|
|
|
|
|
|
m_objChannelMarker.setSidebands(ChannelMarker::dsb);
|
|
|
|
}
|
|
|
|
|
|
|
|
m_blnDoApplySettings = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ATVDemodGUI::setRFFiltersSlidersRange(int sampleRate)
|
|
|
|
{
|
|
|
|
// RF filters sliders range
|
2017-03-21 10:10:01 -04:00
|
|
|
int scaleFactor = (int) std::log10(sampleRate/2);
|
|
|
|
m_rfSliderDivisor = std::pow(10.0, scaleFactor-1);
|
|
|
|
|
|
|
|
if (sampleRate/m_rfSliderDivisor < 50) {
|
|
|
|
m_rfSliderDivisor /= 10;
|
|
|
|
}
|
|
|
|
|
2017-03-18 06:05:28 -04:00
|
|
|
if (ui->rfFiltering->isChecked())
|
|
|
|
{
|
2017-03-21 10:10:01 -04:00
|
|
|
ui->rfBW->setMaximum((sampleRate) / (2*m_rfSliderDivisor));
|
|
|
|
ui->rfOppBW->setMaximum((sampleRate) / (2*m_rfSliderDivisor));
|
2017-03-18 06:05:28 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-03-21 10:10:01 -04:00
|
|
|
ui->rfBW->setMaximum((sampleRate) / m_rfSliderDivisor);
|
|
|
|
ui->rfOppBW->setMaximum((sampleRate) / m_rfSliderDivisor);
|
2017-03-18 06:05:28 -04:00
|
|
|
}
|
2017-03-21 10:10:01 -04:00
|
|
|
|
|
|
|
ui->rfBWText->setText(QString("%1k").arg((ui->rfBW->value() * m_rfSliderDivisor) / 1000.0, 0, 'f', 0));
|
|
|
|
ui->rfOppBWText->setText(QString("%1k").arg((ui->rfOppBW->value() * m_rfSliderDivisor) / 1000.0, 0, 'f', 0));
|
2017-03-18 06:05:28 -04:00
|
|
|
}
|
|
|
|
|
2017-02-23 02:18:56 -05:00
|
|
|
void ATVDemodGUI::leaveEvent(QEvent*)
|
|
|
|
{
|
2017-02-25 04:15:47 -05:00
|
|
|
blockApplySettings(true);
|
2017-02-23 02:18:56 -05:00
|
|
|
m_objChannelMarker.setHighlighted(false);
|
2017-02-25 04:15:47 -05:00
|
|
|
blockApplySettings(false);
|
2017-02-23 02:18:56 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void ATVDemodGUI::enterEvent(QEvent*)
|
|
|
|
{
|
2017-02-25 04:15:47 -05:00
|
|
|
blockApplySettings(true);
|
2017-02-23 02:18:56 -05:00
|
|
|
m_objChannelMarker.setHighlighted(true);
|
2017-02-25 04:15:47 -05:00
|
|
|
blockApplySettings(false);
|
2017-02-23 02:18:56 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void ATVDemodGUI::tick()
|
|
|
|
{
|
2017-03-17 06:17:15 -04:00
|
|
|
if (m_intTickCount < 4) // ~200 ms
|
2017-03-16 13:56:20 -04:00
|
|
|
{
|
|
|
|
m_intTickCount++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (m_objATVDemod)
|
|
|
|
{
|
2017-03-17 06:17:15 -04:00
|
|
|
m_objMagSqAverage.feed(m_objATVDemod->getMagSq());
|
|
|
|
double magSqDB = CalcDb::dbPower(m_objMagSqAverage.average() / (1<<30));
|
2017-03-16 13:56:20 -04:00
|
|
|
ui->channePowerText->setText(tr("%1 dB").arg(magSqDB, 0, 'f', 1));
|
2017-03-19 05:28:54 -04:00
|
|
|
|
|
|
|
if (m_objATVDemod->getBFOLocked()) {
|
|
|
|
ui->bfoLockedLabel->setStyleSheet("QLabel { background-color : green; }");
|
|
|
|
} else {
|
|
|
|
ui->bfoLockedLabel->setStyleSheet("QLabel { background:rgb(79,79,79); }");
|
|
|
|
}
|
2017-03-16 13:56:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
m_intTickCount = 0;
|
|
|
|
}
|
|
|
|
|
2017-02-25 04:15:47 -05:00
|
|
|
return;
|
2017-02-23 02:18:56 -05:00
|
|
|
}
|
|
|
|
|
2017-02-25 04:15:47 -05:00
|
|
|
void ATVDemodGUI::on_synchLevel_valueChanged(int value)
|
2017-02-23 02:18:56 -05:00
|
|
|
{
|
|
|
|
applySettings();
|
2017-02-25 04:15:47 -05:00
|
|
|
ui->synchLevelText->setText(QString("%1 mV").arg(value));
|
2017-02-23 02:18:56 -05:00
|
|
|
}
|
|
|
|
|
2017-02-25 04:15:47 -05:00
|
|
|
void ATVDemodGUI::on_blackLevel_valueChanged(int value)
|
2017-02-23 02:18:56 -05:00
|
|
|
{
|
|
|
|
applySettings();
|
2017-02-25 04:15:47 -05:00
|
|
|
ui->blackLevelText->setText(QString("%1 mV").arg(value));
|
2017-02-23 02:18:56 -05:00
|
|
|
}
|
|
|
|
|
2017-02-25 04:15:47 -05:00
|
|
|
void ATVDemodGUI::on_lineTime_valueChanged(int value)
|
2017-02-23 02:18:56 -05:00
|
|
|
{
|
2017-03-27 07:37:50 -04:00
|
|
|
ui->lineTime->setToolTip(QString("Line length adjustment (%1)").arg(value));
|
2017-03-20 17:37:11 -04:00
|
|
|
lineTimeUpdate();
|
2017-02-24 23:45:42 -05:00
|
|
|
applySettings();
|
2017-02-23 02:18:56 -05:00
|
|
|
}
|
|
|
|
|
2017-02-25 04:15:47 -05:00
|
|
|
void ATVDemodGUI::on_topTime_valueChanged(int value)
|
2017-02-23 02:18:56 -05:00
|
|
|
{
|
2017-03-27 07:37:50 -04:00
|
|
|
ui->topTime->setToolTip(QString("Horizontal sync pulse length adjustment (%1)").arg(value));
|
2017-03-26 17:47:21 -04:00
|
|
|
topTimeUpdate();
|
2017-02-25 04:15:47 -05:00
|
|
|
applySettings();
|
2017-02-23 02:18:56 -05:00
|
|
|
}
|
|
|
|
|
2017-02-25 04:15:47 -05:00
|
|
|
void ATVDemodGUI::on_hSync_clicked()
|
2017-02-23 02:18:56 -05:00
|
|
|
{
|
2017-02-25 04:15:47 -05:00
|
|
|
applySettings();
|
2017-02-23 02:18:56 -05:00
|
|
|
}
|
|
|
|
|
2017-02-25 04:15:47 -05:00
|
|
|
void ATVDemodGUI::on_vSync_clicked()
|
2017-02-24 23:45:42 -05:00
|
|
|
{
|
2017-02-25 04:15:47 -05:00
|
|
|
applySettings();
|
2017-02-23 02:18:56 -05:00
|
|
|
}
|
|
|
|
|
2017-03-19 14:10:48 -04:00
|
|
|
void ATVDemodGUI::on_invertVideo_clicked()
|
|
|
|
{
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
2017-02-25 04:15:47 -05:00
|
|
|
void ATVDemodGUI::on_halfImage_clicked()
|
2017-02-23 02:18:56 -05:00
|
|
|
{
|
2017-02-25 04:15:47 -05:00
|
|
|
applySettings();
|
2017-02-23 02:18:56 -05:00
|
|
|
}
|
|
|
|
|
2017-03-20 17:37:11 -04:00
|
|
|
void ATVDemodGUI::on_nbLines_currentIndexChanged(int index)
|
|
|
|
{
|
|
|
|
lineTimeUpdate();
|
2017-03-26 17:47:21 -04:00
|
|
|
topTimeUpdate();
|
2017-03-20 17:37:11 -04:00
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
2017-02-25 04:15:47 -05:00
|
|
|
void ATVDemodGUI::on_fps_currentIndexChanged(int index)
|
2017-02-23 02:18:56 -05:00
|
|
|
{
|
2017-03-20 17:37:11 -04:00
|
|
|
lineTimeUpdate();
|
2017-03-26 17:47:21 -04:00
|
|
|
topTimeUpdate();
|
2017-02-23 02:18:56 -05:00
|
|
|
applySettings();
|
|
|
|
}
|
2017-02-25 04:15:47 -05:00
|
|
|
|
2017-03-26 20:29:02 -04:00
|
|
|
void ATVDemodGUI::on_standard_currentIndexChanged(int index)
|
|
|
|
{
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
2017-02-25 04:15:47 -05:00
|
|
|
void ATVDemodGUI::on_reset_clicked(bool checked)
|
|
|
|
{
|
|
|
|
resetToDefaults();
|
|
|
|
}
|
2017-03-17 05:04:00 -04:00
|
|
|
|
|
|
|
void ATVDemodGUI::on_modulation_currentIndexChanged(int index)
|
|
|
|
{
|
2017-03-18 06:05:28 -04:00
|
|
|
setRFFiltersSlidersRange(m_objATVDemod->getEffectiveSampleRate());
|
|
|
|
setChannelMarkerBandwidth();
|
2017-03-17 05:04:00 -04:00
|
|
|
applyRFSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ATVDemodGUI::on_rfBW_valueChanged(int value)
|
|
|
|
{
|
2017-03-21 10:10:01 -04:00
|
|
|
ui->rfBWText->setText(QString("%1k").arg((value * m_rfSliderDivisor) / 1000.0, 0, 'f', 0));
|
2017-03-18 06:05:28 -04:00
|
|
|
setChannelMarkerBandwidth();
|
|
|
|
applyRFSettings();
|
2017-03-17 05:04:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void ATVDemodGUI::on_rfOppBW_valueChanged(int value)
|
|
|
|
{
|
2017-03-21 10:10:01 -04:00
|
|
|
ui->rfOppBWText->setText(QString("%1k").arg((value * m_rfSliderDivisor) / 1000.0, 0, 'f', 0));
|
2017-03-18 06:05:28 -04:00
|
|
|
setChannelMarkerBandwidth();
|
|
|
|
applyRFSettings();
|
2017-03-17 05:04:00 -04:00
|
|
|
}
|
|
|
|
|
2017-03-17 05:52:18 -04:00
|
|
|
void ATVDemodGUI::on_rfFiltering_toggled(bool checked)
|
2017-03-17 05:04:00 -04:00
|
|
|
{
|
2017-03-18 06:05:28 -04:00
|
|
|
setRFFiltersSlidersRange(m_objATVDemod->getEffectiveSampleRate());
|
|
|
|
setChannelMarkerBandwidth();
|
2017-03-17 05:04:00 -04:00
|
|
|
applyRFSettings();
|
|
|
|
}
|
2017-03-17 06:46:38 -04:00
|
|
|
|
2017-03-18 04:19:51 -04:00
|
|
|
void ATVDemodGUI::on_decimatorEnable_toggled(bool checked)
|
2017-03-17 06:46:38 -04:00
|
|
|
{
|
2017-03-18 06:05:28 -04:00
|
|
|
setChannelMarkerBandwidth();
|
2017-03-17 06:46:38 -04:00
|
|
|
applyRFSettings();
|
|
|
|
}
|
|
|
|
|
2017-03-17 19:11:48 -04:00
|
|
|
void ATVDemodGUI::on_deltaFrequency_changed(quint64 value)
|
|
|
|
{
|
|
|
|
if (ui->deltaFrequencyMinus->isChecked()) {
|
|
|
|
m_objChannelMarker.setCenterFrequency(-value);
|
|
|
|
} else {
|
|
|
|
m_objChannelMarker.setCenterFrequency(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ATVDemodGUI::on_deltaFrequencyMinus_toggled(bool minus)
|
|
|
|
{
|
|
|
|
int deltaFrequency = m_objChannelMarker.getCenterFrequency();
|
|
|
|
bool minusDelta = (deltaFrequency < 0);
|
|
|
|
|
|
|
|
if (minus ^ minusDelta) // sign change
|
|
|
|
{
|
|
|
|
m_objChannelMarker.setCenterFrequency(-deltaFrequency);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-19 05:28:54 -04:00
|
|
|
void ATVDemodGUI::on_bfo_valueChanged(int value)
|
|
|
|
{
|
2017-04-06 20:26:34 -04:00
|
|
|
ui->bfoText->setText(QString("%1").arg(value * 1.0, 0, 'f', 0));
|
2017-03-19 05:28:54 -04:00
|
|
|
applyRFSettings();
|
|
|
|
}
|
|
|
|
|
2017-03-22 18:55:47 -04:00
|
|
|
void ATVDemodGUI::on_fmDeviation_valueChanged(int value)
|
|
|
|
{
|
2017-04-09 01:27:32 -04:00
|
|
|
ui->fmDeviationText->setText(QString("%1").arg(value / 10.0, 0, 'f', 1));
|
2017-03-22 18:55:47 -04:00
|
|
|
applyRFSettings();
|
|
|
|
}
|
|
|
|
|
2017-03-24 07:57:49 -04:00
|
|
|
void ATVDemodGUI::on_screenTabWidget_currentChanged(int index)
|
|
|
|
{
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
2017-03-20 17:37:11 -04:00
|
|
|
void ATVDemodGUI::lineTimeUpdate()
|
|
|
|
{
|
|
|
|
float nominalLineTime = getNominalLineTime(ui->nbLines->currentIndex(), ui->fps->currentIndex());
|
|
|
|
int lineTimeScaleFactor = (int) std::log10(nominalLineTime);
|
2017-03-23 20:01:53 -04:00
|
|
|
|
|
|
|
if (m_objATVDemod->getEffectiveSampleRate() == 0) {
|
|
|
|
m_fltLineTimeMultiplier = std::pow(10.0, lineTimeScaleFactor-3);
|
|
|
|
} else {
|
|
|
|
m_fltLineTimeMultiplier = 1.0f / m_objATVDemod->getEffectiveSampleRate();
|
|
|
|
}
|
2017-03-20 17:37:11 -04:00
|
|
|
|
|
|
|
float lineTime = nominalLineTime + m_fltLineTimeMultiplier * ui->lineTime->value();
|
|
|
|
|
2017-04-06 19:44:49 -04:00
|
|
|
if (lineTime < 0.0)
|
|
|
|
ui->lineTimeText->setText("invalid");
|
|
|
|
else if(lineTime < 0.000001)
|
2017-03-26 17:47:21 -04:00
|
|
|
ui->lineTimeText->setText(tr("%1 ns").arg(lineTime * 1000000000.0, 0, 'f', 2));
|
2017-03-20 17:37:11 -04:00
|
|
|
else if(lineTime < 0.001)
|
2017-03-26 17:47:21 -04:00
|
|
|
ui->lineTimeText->setText(tr("%1 µs").arg(lineTime * 1000000.0, 0, 'f', 2));
|
2017-03-20 17:37:11 -04:00
|
|
|
else if(lineTime < 1.0)
|
2017-03-26 17:47:21 -04:00
|
|
|
ui->lineTimeText->setText(tr("%1 ms").arg(lineTime * 1000.0, 0, 'f', 2));
|
2017-03-20 17:37:11 -04:00
|
|
|
else
|
2017-03-26 17:47:21 -04:00
|
|
|
ui->lineTimeText->setText(tr("%1 s").arg(lineTime * 1.0, 0, 'f', 2));
|
|
|
|
}
|
|
|
|
|
|
|
|
void ATVDemodGUI::topTimeUpdate()
|
|
|
|
{
|
|
|
|
float nominalTopTime = getNominalLineTime(ui->nbLines->currentIndex(), ui->fps->currentIndex()) * (4.7f / 64.0f);
|
|
|
|
int topTimeScaleFactor = (int) std::log10(nominalTopTime);
|
|
|
|
|
|
|
|
if (m_objATVDemod->getEffectiveSampleRate() == 0) {
|
|
|
|
m_fltTopTimeMultiplier = std::pow(10.0, topTimeScaleFactor-3);
|
|
|
|
} else {
|
|
|
|
m_fltTopTimeMultiplier = 1.0f / m_objATVDemod->getEffectiveSampleRate();
|
|
|
|
}
|
|
|
|
|
|
|
|
float topTime = nominalTopTime + m_fltTopTimeMultiplier * ui->topTime->value();
|
|
|
|
|
2017-04-06 19:44:49 -04:00
|
|
|
if (topTime < 0.0)
|
|
|
|
ui->topTimeText->setText("invalid");
|
|
|
|
else if (topTime < 0.000001)
|
2017-03-26 17:47:21 -04:00
|
|
|
ui->topTimeText->setText(tr("%1 ns").arg(topTime * 1000000000.0, 0, 'f', 2));
|
|
|
|
else if(topTime < 0.001)
|
|
|
|
ui->topTimeText->setText(tr("%1 µs").arg(topTime * 1000000.0, 0, 'f', 2));
|
|
|
|
else if(topTime < 1.0)
|
|
|
|
ui->topTimeText->setText(tr("%1 ms").arg(topTime * 1000.0, 0, 'f', 2));
|
|
|
|
else
|
|
|
|
ui->topTimeText->setText(tr("%1 s").arg(topTime * 1.0, 0, 'f', 2));
|
2017-03-20 17:37:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
float ATVDemodGUI::getFps(int fpsIndex)
|
|
|
|
{
|
|
|
|
switch(fpsIndex)
|
|
|
|
{
|
2017-04-04 23:01:01 -04:00
|
|
|
case 0:
|
2017-03-20 17:37:11 -04:00
|
|
|
return 30.0f;
|
|
|
|
break;
|
2017-03-20 20:30:46 -04:00
|
|
|
case 2:
|
|
|
|
return 20.0f;
|
|
|
|
break;
|
2017-03-20 23:29:55 -04:00
|
|
|
case 3:
|
|
|
|
return 16.0f;
|
|
|
|
break;
|
2017-04-03 11:23:27 -04:00
|
|
|
case 4:
|
|
|
|
return 12.0f;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
return 10.0f;
|
|
|
|
break;
|
2017-04-04 23:01:01 -04:00
|
|
|
case 6:
|
|
|
|
return 8.0f;
|
|
|
|
break;
|
2017-04-08 00:54:24 -04:00
|
|
|
case 7:
|
|
|
|
return 5.0f;
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
return 2.0f;
|
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
return 1.0f;
|
|
|
|
break;
|
2017-04-04 23:01:01 -04:00
|
|
|
case 1:
|
2017-03-20 17:37:11 -04:00
|
|
|
default:
|
|
|
|
return 25.0f;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
float ATVDemodGUI::getNominalLineTime(int nbLinesIndex, int fpsIndex)
|
|
|
|
{
|
|
|
|
float fps = getFps(fpsIndex);
|
2017-04-06 02:28:30 -04:00
|
|
|
int nbLines = getNumberOfLines(nbLinesIndex);
|
2017-03-20 17:37:11 -04:00
|
|
|
|
2017-04-06 02:28:30 -04:00
|
|
|
return 1.0f / (nbLines * fps);
|
2017-03-20 17:37:11 -04:00
|
|
|
}
|
2017-04-02 17:20:25 -04:00
|
|
|
|
|
|
|
int ATVDemodGUI::getNumberOfLines(int nbLinesIndex)
|
|
|
|
{
|
|
|
|
switch(nbLinesIndex)
|
|
|
|
{
|
2017-04-08 00:54:24 -04:00
|
|
|
case 0:
|
|
|
|
return 640;
|
2017-04-02 17:20:25 -04:00
|
|
|
break;
|
|
|
|
case 2:
|
2017-04-08 00:54:24 -04:00
|
|
|
return 525;
|
2017-04-02 17:20:25 -04:00
|
|
|
break;
|
2017-04-03 11:23:27 -04:00
|
|
|
case 3:
|
2017-04-08 00:54:24 -04:00
|
|
|
return 480;
|
2017-04-03 11:23:27 -04:00
|
|
|
break;
|
|
|
|
case 4:
|
2017-04-08 00:54:24 -04:00
|
|
|
return 405;
|
2017-04-03 11:23:27 -04:00
|
|
|
break;
|
|
|
|
case 5:
|
2017-04-08 00:54:24 -04:00
|
|
|
return 360;
|
2017-04-03 11:23:27 -04:00
|
|
|
break;
|
|
|
|
case 6:
|
2017-04-08 00:54:24 -04:00
|
|
|
return 343;
|
2017-04-03 11:23:27 -04:00
|
|
|
break;
|
2017-04-03 12:57:48 -04:00
|
|
|
case 7:
|
2017-04-08 00:54:24 -04:00
|
|
|
return 240;
|
2017-04-03 12:57:48 -04:00
|
|
|
break;
|
|
|
|
case 8:
|
2017-04-08 00:54:24 -04:00
|
|
|
return 180;
|
2017-04-06 02:28:30 -04:00
|
|
|
break;
|
|
|
|
case 9:
|
2017-04-08 00:54:24 -04:00
|
|
|
return 120;
|
|
|
|
break;
|
|
|
|
case 10:
|
|
|
|
return 90;
|
|
|
|
break;
|
|
|
|
case 11:
|
|
|
|
return 60;
|
|
|
|
break;
|
|
|
|
case 12:
|
2017-04-03 12:57:48 -04:00
|
|
|
return 32;
|
|
|
|
break;
|
2017-04-08 00:54:24 -04:00
|
|
|
case 1:
|
2017-04-02 17:20:25 -04:00
|
|
|
default:
|
|
|
|
return 625;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|