-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added enhanced Multidisc dropout correction feature to ld-dropout-correct #393
Changes from 8 commits
d966fec
f309384
787471d
70d836a
2aa451d
a1aa5ab
79b7404
dba932e
33df921
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
main.cpp | ||
|
||
ld-dropout-correct - Dropout correction for ld-decode | ||
Copyright (C) 2018-2019 Simon Inns | ||
Copyright (C) 2018-2020 Simon Inns | ||
|
||
This file is part of ld-decode-tools. | ||
|
||
|
@@ -29,7 +29,6 @@ | |
#include <QThread> | ||
|
||
#include "correctorpool.h" | ||
#include "dropoutcorrect.h" | ||
|
||
// Global for debug output | ||
static bool showDebug = false; | ||
|
@@ -166,7 +165,6 @@ int main(int argc, char *argv[]) | |
QString outputFilename = "-"; | ||
QStringList positionalArguments = parser.positionalArguments(); | ||
qint32 totalNumberOfInputFiles = positionalArguments.count() - 1; | ||
inputFilenames.resize(totalNumberOfInputFiles); | ||
|
||
// Ensure we don't have more than 32 sources | ||
if (totalNumberOfInputFiles > 32) { | ||
|
@@ -176,6 +174,9 @@ int main(int argc, char *argv[]) | |
|
||
// Get the input TBC sources | ||
if (positionalArguments.count() >= 2) { | ||
// Resize the input filenames vector according to the number of input files supplied | ||
inputFilenames.resize(totalNumberOfInputFiles); | ||
|
||
for (qint32 i = 0; i < positionalArguments.count() - 1; i++) { | ||
inputFilenames[i] = positionalArguments.at(i); | ||
} | ||
|
@@ -238,16 +239,21 @@ int main(int argc, char *argv[]) | |
qInfo() << "Starting preparation for dropout correction processes..."; | ||
// Open the source video metadata | ||
qDebug() << "main(): Opening source video metadata files.."; | ||
QVector<LdDecodeMetaData> ldDecodeMetaData; | ||
QVector<LdDecodeMetaData *> ldDecodeMetaData; | ||
ldDecodeMetaData.resize(totalNumberOfInputFiles); | ||
for (qint32 i = 0; i < totalNumberOfInputFiles; i++) { | ||
// Create an object for the source video | ||
ldDecodeMetaData[i] = new LdDecodeMetaData; | ||
} | ||
|
||
for (qint32 i = 0; i < totalNumberOfInputFiles; i++) { | ||
// Work out the metadata filename | ||
QString jsonFilename = inputFilenames[i] + ".json"; | ||
if (parser.isSet(inputJsonOption) && i == 0) jsonFilename = parser.value(inputJsonOption); | ||
qInfo().nospace().noquote() << "Reading input #" << i << " JSON metadata from " << jsonFilename; | ||
|
||
// Open it | ||
if (!ldDecodeMetaData[i].read(jsonFilename)) { | ||
if (!ldDecodeMetaData[i]->read(jsonFilename)) { | ||
qCritical() << "Unable to open TBC JSON metadata file - cannot continue"; | ||
return -1; | ||
} | ||
|
@@ -257,7 +263,7 @@ int main(int argc, char *argv[]) | |
if (reverse) { | ||
qInfo() << "Expected field order is reversed to second field/first field"; | ||
for (qint32 i = 0; i < totalNumberOfInputFiles; i++) | ||
ldDecodeMetaData[i].setIsFirstFieldFirst(false); | ||
ldDecodeMetaData[i]->setIsFirstFieldFirst(false); | ||
} | ||
|
||
// Intrafield only correction if required | ||
|
@@ -272,42 +278,46 @@ int main(int argc, char *argv[]) | |
|
||
// Show and open input source TBC files | ||
qDebug() << "main(): Opening source video files..."; | ||
QVector<SourceVideo> sourceVideos; | ||
QVector<SourceVideo *> sourceVideos; | ||
sourceVideos.resize(totalNumberOfInputFiles); | ||
for (qint32 i = 0; i < totalNumberOfInputFiles; i++) { | ||
// Create an object for the source video | ||
sourceVideos[i] = new SourceVideo; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
} | ||
|
||
for (qint32 i = 0; i < totalNumberOfInputFiles; i++) { | ||
LdDecodeMetaData::VideoParameters videoParameters = ldDecodeMetaData[i].getVideoParameters(); | ||
LdDecodeMetaData::VideoParameters videoParameters = ldDecodeMetaData[i]->getVideoParameters(); | ||
|
||
qInfo().nospace() << "Opening input #" << i << ": " << videoParameters.fieldWidth << "x" << videoParameters.fieldHeight << | ||
" - input filename is " << inputFilenames[i]; | ||
|
||
// Open the source TBC | ||
if (!sourceVideos[i].open(inputFilenames[i], videoParameters.fieldWidth * videoParameters.fieldHeight)) { | ||
if (!sourceVideos[i]->open(inputFilenames[i], videoParameters.fieldWidth * videoParameters.fieldHeight)) { | ||
// Could not open source video file | ||
qInfo() << "Unable to open input source" << i; | ||
qInfo() << "Please verify that the specified source video files exist with the correct file permissions"; | ||
return 1; | ||
} | ||
|
||
// Verify TBC and JSON input fields match | ||
if (sourceVideos[i].getNumberOfAvailableFields() != ldDecodeMetaData[0].getNumberOfFields()) { | ||
qInfo() << "Warning: TBC file contains" << sourceVideos[i].getNumberOfAvailableFields() << | ||
"fields but the JSON indicates" << ldDecodeMetaData[0].getNumberOfFields() << | ||
if (sourceVideos[i]->getNumberOfAvailableFields() != ldDecodeMetaData[0]->getNumberOfFields()) { | ||
qInfo() << "Warning: TBC file contains" << sourceVideos[i]->getNumberOfAvailableFields() << | ||
"fields but the JSON indicates" << ldDecodeMetaData[0]->getNumberOfFields() << | ||
"fields - some fields will be ignored"; | ||
qInfo() << "Update your copy of ld-decode and try again, this shouldn't happen unless the JSON metadata has been corrupted"; | ||
} | ||
|
||
// Additional checks when using multiple input sources | ||
if (totalNumberOfInputFiles > 1) { | ||
// Ensure source video has VBI data | ||
if (!ldDecodeMetaData[i].getFieldVbi(1).inUse) { | ||
if (!ldDecodeMetaData[i]->getFieldVbi(1).inUse) { | ||
qInfo() << "Source video" << i << "does not appear to have valid VBI data in the JSON metadata."; | ||
qInfo() << "Please try running ld-process-vbi on the source video and then try again"; | ||
return 1; | ||
} | ||
|
||
// Ensure that the video source standard matches the primary source | ||
if (ldDecodeMetaData[0].getVideoParameters().isSourcePal != videoParameters.isSourcePal) { | ||
if (ldDecodeMetaData[0]->getVideoParameters().isSourcePal != videoParameters.isSourcePal) { | ||
qInfo() << "All additional input sources must have the same video format (PAL/NTSC) as the initial source!"; | ||
return 1; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete
these at the end.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done