Skip to content

Commit

Permalink
Implemented issues #606 and #685 (#688)
Browse files Browse the repository at this point in the history
* Fix for issue #685

* Additional feature in ld-analyse - issue #606

* Bug fix - Visible DO range now limited to visible field line range too
  • Loading branch information
simoninns authored Dec 14, 2021
1 parent a521fb6 commit f1fd64f
Show file tree
Hide file tree
Showing 12 changed files with 375 additions and 8 deletions.
13 changes: 13 additions & 0 deletions tools/ld-analyse/configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ void Configuration::writeConfiguration(void)
configuration->setValue("vbiDialogGeometry", settings.windows.vbiDialogGeometry);
configuration->setValue("oscilloscopeDialogGeometry", settings.windows.oscilloscopeDialogGeometry);
configuration->setValue("dropoutAnalysisDialogGeometry", settings.windows.dropoutAnalysisDialogGeometry);
configuration->setValue("visibleDropoutAnalysisDialogGeometry", settings.windows.visibleDropoutAnalysisDialogGeometry);
configuration->setValue("blackSnrAnalysisDialogGeometry", settings.windows.blackSnrAnalysisDialogGeometry);
configuration->setValue("whiteSnrAnalysisDialogGeometry", settings.windows.whiteSnrAnalysisDialogGeometry);
configuration->setValue("closedCaptionDialogGeometry", settings.windows.closedCaptionDialogGeometry);
Expand Down Expand Up @@ -104,6 +105,7 @@ void Configuration::readConfiguration(void)
settings.windows.vbiDialogGeometry = configuration->value("vbiDialogGeometry").toByteArray();
settings.windows.oscilloscopeDialogGeometry = configuration->value("oscilloscopeDialogGeometry").toByteArray();
settings.windows.dropoutAnalysisDialogGeometry = configuration->value("dropoutAnalysisDialogGeometry").toByteArray();
settings.windows.visibleDropoutAnalysisDialogGeometry = configuration->value("visibleDropoutAnalysisDialogGeometry").toByteArray();
settings.windows.blackSnrAnalysisDialogGeometry = configuration->value("blackSnrAnalysisDialogGeometry").toByteArray();
settings.windows.whiteSnrAnalysisDialogGeometry = configuration->value("whiteSnrAnalysisDialogGeometry").toByteArray();
settings.windows.closedCaptionDialogGeometry = configuration->value("closedCaptionDialogGeometry").toByteArray();
Expand All @@ -126,6 +128,7 @@ void Configuration::setDefault(void)
settings.windows.vbiDialogGeometry = QByteArray();
settings.windows.oscilloscopeDialogGeometry = QByteArray();
settings.windows.dropoutAnalysisDialogGeometry = QByteArray();
settings.windows.visibleDropoutAnalysisDialogGeometry = QByteArray();
settings.windows.blackSnrAnalysisDialogGeometry = QByteArray();
settings.windows.whiteSnrAnalysisDialogGeometry = QByteArray();
settings.windows.closedCaptionDialogGeometry = QByteArray();
Expand Down Expand Up @@ -209,6 +212,16 @@ QByteArray Configuration::getDropoutAnalysisDialogGeometry(void)
return settings.windows.dropoutAnalysisDialogGeometry;
}

void Configuration::setVisibleDropoutAnalysisDialogGeometry(QByteArray visibleDropoutAnalysisDialogGeometry)
{
settings.windows.visibleDropoutAnalysisDialogGeometry = visibleDropoutAnalysisDialogGeometry;
}

QByteArray Configuration::getVisibleDropoutAnalysisDialogGeometry(void)
{
return settings.windows.visibleDropoutAnalysisDialogGeometry;
}

void Configuration::setBlackSnrAnalysisDialogGeometry(QByteArray blackSnrAnalysisDialogGeometry)
{
settings.windows.blackSnrAnalysisDialogGeometry = blackSnrAnalysisDialogGeometry;
Expand Down
5 changes: 4 additions & 1 deletion tools/ld-analyse/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ class Configuration : public QObject
QByteArray getVbiDialogGeometry(void);
void setOscilloscopeDialogGeometry(QByteArray oscilloscopeDialogGeometry);
QByteArray getOscilloscopeDialogGeometry(void);
void setDropoutAnalysisDialogGeometry(QByteArray videoMetadataDialogGeometry);
void setDropoutAnalysisDialogGeometry(QByteArray dropoutAnalysisDialogGeometry);
QByteArray getDropoutAnalysisDialogGeometry(void);
void setVisibleDropoutAnalysisDialogGeometry(QByteArray visibleDropoutDialogGeometry);
QByteArray getVisibleDropoutAnalysisDialogGeometry(void);
void setBlackSnrAnalysisDialogGeometry(QByteArray blackSnrAnalysisDialogGeometry);
QByteArray getBlackSnrAnalysisDialogGeometry(void);
void setWhiteSnrAnalysisDialogGeometry(QByteArray whiteSnrAnalysisDialogGeometry);
Expand Down Expand Up @@ -89,6 +91,7 @@ public slots:
QByteArray vbiDialogGeometry;
QByteArray oscilloscopeDialogGeometry;
QByteArray dropoutAnalysisDialogGeometry;
QByteArray visibleDropoutAnalysisDialogGeometry;
QByteArray blackSnrAnalysisDialogGeometry;
QByteArray whiteSnrAnalysisDialogGeometry;
QByteArray closedCaptionDialogGeometry;
Expand Down
2 changes: 1 addition & 1 deletion tools/ld-analyse/dropoutanalysisdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ DropoutAnalysisDialog::DropoutAnalysisDialog(QWidget *parent) :
numberOfFrames = 0;

// Connect to scale changed slot
connect(((QObject*)plot->axisWidget(QwtPlot::xBottom)) , SIGNAL(scaleDivChanged () ), this, SLOT(scaleDivChangedSlot () ));
connect(((QObject*)plot->axisWidget(QwtPlot::xBottom)) , SIGNAL(scaleDivChanged() ), this, SLOT(scaleDivChangedSlot() ));
}

DropoutAnalysisDialog::~DropoutAnalysisDialog()
Expand Down
3 changes: 3 additions & 0 deletions tools/ld-analyse/ld-analyse.pro
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ SOURCES += \
../library/tbc/filters.cpp \
../library/tbc/logging.cpp \
../library/tbc/dropouts.cpp \
visibledropoutanalysisdialog.cpp \
whitesnranalysisdialog.cpp

HEADERS += \
Expand Down Expand Up @@ -82,6 +83,7 @@ HEADERS += \
../library/tbc/filters.h \
../library/tbc/logging.h \
../library/tbc/dropouts.h \
visibledropoutanalysisdialog.h \
whitesnranalysisdialog.h

FORMS += \
Expand All @@ -94,6 +96,7 @@ FORMS += \
chromadecoderconfigdialog.ui \
vbidialog.ui \
dropoutanalysisdialog.ui \
visibledropoutanalysisdialog.ui \
whitesnranalysisdialog.ui

# Add external includes to the include path
Expand Down
25 changes: 23 additions & 2 deletions tools/ld-analyse/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ MainWindow::MainWindow(QString inputFilenameParam, QWidget *parent) :
aboutDialog = new AboutDialog(this);
vbiDialog = new VbiDialog(this);
dropoutAnalysisDialog = new DropoutAnalysisDialog(this);
visibleDropoutAnalysisDialog = new VisibleDropOutAnalysisDialog(this);
blackSnrAnalysisDialog = new BlackSnrAnalysisDialog(this);
whiteSnrAnalysisDialog = new WhiteSnrAnalysisDialog(this);
busyDialog = new BusyDialog(this);
Expand Down Expand Up @@ -88,6 +89,7 @@ MainWindow::MainWindow(QString inputFilenameParam, QWidget *parent) :
vbiDialog->restoreGeometry(configuration.getVbiDialogGeometry());
oscilloscopeDialog->restoreGeometry(configuration.getOscilloscopeDialogGeometry());
dropoutAnalysisDialog->restoreGeometry(configuration.getDropoutAnalysisDialogGeometry());
visibleDropoutAnalysisDialog->restoreGeometry(configuration.getVisibleDropoutAnalysisDialogGeometry());
blackSnrAnalysisDialog->restoreGeometry(configuration.getBlackSnrAnalysisDialogGeometry());
whiteSnrAnalysisDialog->restoreGeometry(configuration.getWhiteSnrAnalysisDialogGeometry());
closedCaptionDialog->restoreGeometry(configuration.getClosedCaptionDialogGeometry());
Expand Down Expand Up @@ -116,6 +118,7 @@ MainWindow::~MainWindow()
configuration.setVbiDialogGeometry(vbiDialog->saveGeometry());
configuration.setOscilloscopeDialogGeometry(oscilloscopeDialog->saveGeometry());
configuration.setDropoutAnalysisDialogGeometry(dropoutAnalysisDialog->saveGeometry());
configuration.setVisibleDropoutAnalysisDialogGeometry(visibleDropoutAnalysisDialog->saveGeometry());
configuration.setBlackSnrAnalysisDialogGeometry(blackSnrAnalysisDialog->saveGeometry());
configuration.setWhiteSnrAnalysisDialogGeometry(whiteSnrAnalysisDialog->saveGeometry());
configuration.setClosedCaptionDialogGeometry(closedCaptionDialog->saveGeometry());
Expand Down Expand Up @@ -174,7 +177,9 @@ void MainWindow::updateGuiLoaded()
ui->actionZoom_2x->setEnabled(true);
ui->actionZoom_3x->setEnabled(true);
ui->actionDropout_analysis->setEnabled(true);
ui->actionSNR_analysis->setEnabled(true);
ui->actionVisible_Dropout_analysis->setEnabled(true);
ui->actionSNR_analysis->setEnabled(true); // Black SNR
ui->actionWhite_SNR_analysis->setEnabled(true);
ui->actionSave_frame_as_PNG->setEnabled(true);
ui->actionClosed_Captions->setEnabled(true);
ui->actionChroma_decoder_configuration->setEnabled(true);
Expand Down Expand Up @@ -263,7 +268,9 @@ void MainWindow::updateGuiUnloaded()
ui->actionZoom_2x->setEnabled(false);
ui->actionZoom_3x->setEnabled(false);
ui->actionDropout_analysis->setEnabled(false);
ui->actionSNR_analysis->setEnabled(false);
ui->actionVisible_Dropout_analysis->setEnabled(false);
ui->actionSNR_analysis->setEnabled(false); // Black SNR
ui->actionWhite_SNR_analysis->setEnabled(false);
ui->actionSave_frame_as_PNG->setEnabled(false);
ui->actionClosed_Captions->setEnabled(false);
ui->actionChroma_decoder_configuration->setEnabled(false);
Expand Down Expand Up @@ -493,6 +500,13 @@ void MainWindow::on_actionDropout_analysis_triggered()
dropoutAnalysisDialog->show();
}

// Show the visible drop out analysis graph
void MainWindow::on_actionVisible_Dropout_analysis_triggered()
{
// Show the visible dropout analysis dialogue
visibleDropoutAnalysisDialog->show();
}

// Show the Black SNR analysis graph
void MainWindow::on_actionSNR_analysis_triggered()
{
Expand Down Expand Up @@ -961,20 +975,24 @@ void MainWindow::on_finishedLoading()
if (tbcSource.getIsSourceLoaded()) {
// Generate the graph data
dropoutAnalysisDialog->startUpdate(tbcSource.getNumberOfFrames());
visibleDropoutAnalysisDialog->startUpdate(tbcSource.getNumberOfFrames());
blackSnrAnalysisDialog->startUpdate(tbcSource.getNumberOfFrames());
whiteSnrAnalysisDialog->startUpdate(tbcSource.getNumberOfFrames());

QVector<qreal> doGraphData = tbcSource.getDropOutGraphData();
QVector<qreal> visibleDoGraphData = tbcSource.getVisibleDropOutGraphData();
QVector<qreal> blackSnrGraphData = tbcSource.getBlackSnrGraphData();
QVector<qreal> whiteSnrGraphData = tbcSource.getWhiteSnrGraphData();

for (qint32 frameNumber = 0; frameNumber < tbcSource.getNumberOfFrames(); frameNumber++) {
dropoutAnalysisDialog->addDataPoint(frameNumber + 1, doGraphData[frameNumber]);
visibleDropoutAnalysisDialog->addDataPoint(frameNumber + 1, visibleDoGraphData[frameNumber]);
blackSnrAnalysisDialog->addDataPoint(frameNumber + 1, blackSnrGraphData[frameNumber]);
whiteSnrAnalysisDialog->addDataPoint(frameNumber + 1, whiteSnrGraphData[frameNumber]);
}

dropoutAnalysisDialog->finishUpdate(currentFrameNumber);
visibleDropoutAnalysisDialog->finishUpdate(currentFrameNumber);
blackSnrAnalysisDialog->finishUpdate(currentFrameNumber);
whiteSnrAnalysisDialog->finishUpdate(currentFrameNumber);

Expand Down Expand Up @@ -1004,3 +1022,6 @@ void MainWindow::on_finishedLoading()
this->setEnabled(true);
}




6 changes: 4 additions & 2 deletions tools/ld-analyse/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "aboutdialog.h"
#include "vbidialog.h"
#include "dropoutanalysisdialog.h"
#include "visibledropoutanalysisdialog.h"
#include "blacksnranalysisdialog.h"
#include "whitesnranalysisdialog.h"
#include "busydialog.h"
Expand Down Expand Up @@ -67,7 +68,9 @@ private slots:
void on_actionAbout_ld_analyse_triggered();
void on_actionVBI_triggered();
void on_actionDropout_analysis_triggered();
void on_actionVisible_Dropout_analysis_triggered();
void on_actionSNR_analysis_triggered();
void on_actionWhite_SNR_analysis_triggered();
void on_actionSave_frame_as_PNG_triggered();
void on_actionZoom_In_triggered();
void on_actionZoom_Out_triggered();
Expand Down Expand Up @@ -103,8 +106,6 @@ private slots:
void on_busyLoading(QString infoMessage);
void on_finishedLoading();

void on_actionWhite_SNR_analysis_triggered();

private:
Ui::MainWindow *ui;

Expand All @@ -113,6 +114,7 @@ private slots:
AboutDialog* aboutDialog;
VbiDialog* vbiDialog;
DropoutAnalysisDialog* dropoutAnalysisDialog;
VisibleDropOutAnalysisDialog* visibleDropoutAnalysisDialog;
BlackSnrAnalysisDialog* blackSnrAnalysisDialog;
WhiteSnrAnalysisDialog* whiteSnrAnalysisDialog;
BusyDialog* busyDialog;
Expand Down
10 changes: 8 additions & 2 deletions tools/ld-analyse/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<x>0</x>
<y>0</y>
<width>969</width>
<height>559</height>
<height>576</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
Expand Down Expand Up @@ -434,7 +434,7 @@
<x>0</x>
<y>0</y>
<width>991</width>
<height>29</height>
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
Expand All @@ -453,6 +453,7 @@
<string>Window</string>
</property>
<addaction name="actionDropout_analysis"/>
<addaction name="actionVisible_Dropout_analysis"/>
<addaction name="actionSNR_analysis"/>
<addaction name="actionWhite_SNR_analysis"/>
<addaction name="actionVBI"/>
Expand Down Expand Up @@ -634,6 +635,11 @@
<string>Ctrl+T</string>
</property>
</action>
<action name="actionVisible_Dropout_analysis">
<property name="text">
<string>Visible Dropout analysis...</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources>
Expand Down
50 changes: 50 additions & 0 deletions tools/ld-analyse/tbcsource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,12 @@ QVector<qreal> TbcSource::getDropOutGraphData()
return dropoutGraphData;
}

// Get visible dropout data for graphing
QVector<qreal> TbcSource::getVisibleDropOutGraphData()
{
return visibleDropoutGraphData;
}

// Method to get the size of the graphing data
qint32 TbcSource::getGraphDataSize()
{
Expand Down Expand Up @@ -646,10 +652,12 @@ QImage TbcSource::generateQImage()
void TbcSource::generateData()
{
dropoutGraphData.clear();
visibleDropoutGraphData.clear();
blackSnrGraphData.clear();
whiteSnrGraphData.clear();

dropoutGraphData.resize(ldDecodeMetaData.getNumberOfFrames());
visibleDropoutGraphData.resize(ldDecodeMetaData.getNumberOfFrames());
blackSnrGraphData.resize(ldDecodeMetaData.getNumberOfFrames());
whiteSnrGraphData.resize(ldDecodeMetaData.getNumberOfFrames());

Expand All @@ -661,6 +669,7 @@ void TbcSource::generateData()
const qint32 numFrames = ldDecodeMetaData.getNumberOfFrames();
for (qint32 frameNumber = 0; frameNumber < numFrames; frameNumber++) {
qreal doLength = 0;
qreal visibleDoLength = 0;
qreal blackSnrTotal = 0;
qreal whiteSnrTotal = 0;

Expand Down Expand Up @@ -688,6 +697,46 @@ void TbcSource::generateData()
}
}

// Get the first field visible DOs
LdDecodeMetaData::VideoParameters videoParameters = ldDecodeMetaData.getVideoParameters();

if (firstField.dropOuts.size() > 0) {
// Calculate the total length of the visible dropouts
for (qint32 i = 0; i < firstField.dropOuts.size(); i++) {
// Does the drop out start in the visible area?
if ((firstField.dropOuts.fieldLine(i) >= videoParameters.firstActiveFieldLine) &&
(firstField.dropOuts.fieldLine(i) <= videoParameters.lastActiveFieldLine)) {
if (firstField.dropOuts.startx(i) >= videoParameters.activeVideoStart) {
qint32 startx = firstField.dropOuts.startx(i);
qint32 endx;
if (firstField.dropOuts.endx(i) < videoParameters.activeVideoEnd) endx = firstField.dropOuts.endx(i);
else endx = videoParameters.activeVideoEnd;

visibleDoLength += endx - startx;
}
}
}
}

// Get the second field visible DOs
if (secondField.dropOuts.size() > 0) {
// Calculate the total length of the visible dropouts
for (qint32 i = 0; i < secondField.dropOuts.size(); i++) {
// Does the drop out start in the visible area?
if ((secondField.dropOuts.fieldLine(i) >= videoParameters.firstActiveFieldLine) &&
(secondField.dropOuts.fieldLine(i) <= videoParameters.lastActiveFieldLine)) {
if (secondField.dropOuts.startx(i) >= videoParameters.activeVideoStart) {
qint32 startx = secondField.dropOuts.startx(i);
qint32 endx;
if (secondField.dropOuts.endx(i) < videoParameters.activeVideoEnd) endx = secondField.dropOuts.endx(i);
else endx = videoParameters.activeVideoEnd;

visibleDoLength += endx - startx;
}
}
}
}

// Get the first field SNRs
if (firstField.vitsMetrics.inUse) {
if (firstField.vitsMetrics.bPSNR > 0) {
Expand All @@ -714,6 +763,7 @@ void TbcSource::generateData()

// Add the result to the vectors
dropoutGraphData[frameNumber] = doLength;
visibleDropoutGraphData[frameNumber] = visibleDoLength;
blackSnrGraphData[frameNumber] = blackSnrTotal / blackSnrPoints; // Calc average for frame
whiteSnrGraphData[frameNumber] = whiteSnrTotal / whiteSnrPoints; // Calc average for frame

Expand Down
2 changes: 2 additions & 0 deletions tools/ld-analyse/tbcsource.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class TbcSource : public QObject
QVector<qreal> getBlackSnrGraphData();
QVector<qreal> getWhiteSnrGraphData();
QVector<qreal> getDropOutGraphData();
QVector<qreal> getVisibleDropOutGraphData();
qint32 getGraphDataSize();

bool getIsDropoutPresent();
Expand Down Expand Up @@ -126,6 +127,7 @@ private slots:
QVector<qreal> blackSnrGraphData;
QVector<qreal> whiteSnrGraphData;
QVector<qreal> dropoutGraphData;
QVector<qreal> visibleDropoutGraphData;

// Frame image options
bool chromaOn;
Expand Down
Loading

0 comments on commit f1fd64f

Please sign in to comment.