Skip to content
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 first and last fieldNumber to the videoParameters metadata #444

Merged
merged 2 commits into from
Jan 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tools/ld-chroma-decoder/comb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ void Comb::updateConfiguration(const LdDecodeMetaData::VideoParameters &_videoPa
// Set the frame height
frameHeight = ((videoParameters.fieldHeight * 2) - 1);

// Set the first and last active line
configuration.firstActiveLine = videoParameters.firstActiveFrameLine;
configuration.lastActiveLine = videoParameters.lastActiveFrameLine;

configurationSet = true;
}

Expand Down
4 changes: 4 additions & 0 deletions tools/ld-chroma-decoder/palcolour.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ void PalColour::updateConfiguration(const LdDecodeMetaData::VideoParameters &_vi
// Build the look-up tables
buildLookUpTables();

// Set the frame area
configuration.firstActiveLine = videoParameters.firstActiveFrameLine;
configuration.lastActiveLine = videoParameters.lastActiveFrameLine;

if (configuration.chromaFilter == transform2DFilter || configuration.chromaFilter == transform3DFilter) {
// Create the Transform PAL filter
if (configuration.chromaFilter == transform2DFilter) {
Expand Down
12 changes: 1 addition & 11 deletions tools/ld-diffdod/tbcsources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,18 +363,8 @@ void TbcSources::performLumaClip(QVector<SourceVideo::Data> &fields, QVector<QVe
// Get the metadata for the video parameters (all sources are the same, so just grab from the first)
LdDecodeMetaData::VideoParameters videoParameters = sourceVideos[0]->ldDecodeMetaData.getVideoParameters();

qint32 firstActiveFieldLine;
qint32 lastActiveFieldLine;
if (videoParameters.isSourcePal) {
firstActiveFieldLine = 22;
lastActiveFieldLine = 308;
} else {
firstActiveFieldLine = 20;
lastActiveFieldLine = 259;
}

// Process the fields one line at a time
for (qint32 y = firstActiveFieldLine; y < lastActiveFieldLine; y++) {
for (qint32 y = videoParameters.firstActiveFieldLine; y < videoParameters.lastActiveFieldLine; y++) {
qint32 startOfLinePointer = y * videoParameters.fieldWidth;

for (qint32 sourceCounter = 0; sourceCounter < fields.size(); sourceCounter++) {
Expand Down
19 changes: 4 additions & 15 deletions tools/ld-dropout-correct/dropoutcorrect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,17 +257,6 @@ DropOutCorrect::Replacement DropOutCorrect::findReplacementLine(const QVector<QV
bool isColourBurst, bool intraField, QVector<qint32> &availableSourcesForFrame,
QVector<qreal> &sourceFrameQuality)
{
// Determine the first and last active scan line based on the source format
qint32 firstActiveFieldLine;
qint32 lastActiveFieldLine;
if (videoParameters[0].isSourcePal) {
firstActiveFieldLine = 22;
lastActiveFieldLine = 308;
} else {
firstActiveFieldLine = 20;
lastActiveFieldLine = 259;
}

// Define the minimum step size to use when searching for replacement
// lines, and the offset to the nearest replacement line in the other
// field.
Expand Down Expand Up @@ -330,13 +319,13 @@ DropOutCorrect::Replacement DropOutCorrect::findReplacementLine(const QVector<QV
// Look up the field for a replacement
findPotentialReplacementLine(thisFieldDropouts, dropOutIndex,
thisFieldDropouts, true, 0, -stepAmount,
firstActiveFieldLine, lastActiveFieldLine,
videoParameters[0].firstActiveFieldLine, videoParameters[0].lastActiveFieldLine,
candidates, currentSource, sourceFrameQuality);

// Look down the field for a replacement
findPotentialReplacementLine(thisFieldDropouts, dropOutIndex,
thisFieldDropouts, true, stepAmount, stepAmount,
firstActiveFieldLine, lastActiveFieldLine,
videoParameters[0].firstActiveFieldLine, videoParameters[0].lastActiveFieldLine,
candidates, currentSource, sourceFrameQuality);

// Only check the other field for visible line replacements
Expand All @@ -346,13 +335,13 @@ DropOutCorrect::Replacement DropOutCorrect::findReplacementLine(const QVector<QV
// Look up the field for a replacement
findPotentialReplacementLine(thisFieldDropouts, dropOutIndex,
otherFieldDropouts, false, otherFieldOffset, -stepAmount,
firstActiveFieldLine, lastActiveFieldLine,
videoParameters[0].firstActiveFieldLine, videoParameters[0].lastActiveFieldLine,
candidates, currentSource, sourceFrameQuality);

// Look down the field for a replacement
findPotentialReplacementLine(thisFieldDropouts, dropOutIndex,
otherFieldDropouts, false, otherFieldOffset + stepAmount, stepAmount,
firstActiveFieldLine, lastActiveFieldLine,
videoParameters[0].firstActiveFieldLine, videoParameters[0].lastActiveFieldLine,
candidates, currentSource, sourceFrameQuality);
}
}
Expand Down
21 changes: 21 additions & 0 deletions tools/library/tbc/lddecodemetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,27 @@ LdDecodeMetaData::VideoParameters LdDecodeMetaData::getVideoParameters()
return videoParameters;
}

// Add in the active field line range psuedo-metadata
if (videoParameters.isSourcePal) {
// PAL
videoParameters.firstActiveFieldLine = 22;
videoParameters.lastActiveFieldLine = 308;

// Interlaced line 44 is PAL line 23 (the first active half-line)
videoParameters.firstActiveFrameLine = 44;
// Interlaced line 619 is PAL line 623 (the last active half-line)
videoParameters.lastActiveFrameLine = 620;
} else {
// NTSC
videoParameters.firstActiveFieldLine = 20;
videoParameters.lastActiveFieldLine = 259;

// Interlaced line 40 is NTSC line 21 (the closed-caption line before the first active half-line)
videoParameters.firstActiveFrameLine = 40;
// Interlaced line 524 is NTSC line 263 (the last active half-line).
videoParameters.lastActiveFrameLine = 525;
}

return videoParameters;
}

Expand Down
8 changes: 8 additions & 0 deletions tools/library/tbc/lddecodemetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ class LdDecodeMetaData
qint32 fsc;

bool isMapped;

// Note: These are psuedo metadata items - The values are populated by the library
// These are half-open ranges, where lines are numbered sequentially from 0 within
// each field or interlaced frame
qint32 firstActiveFieldLine;
qint32 lastActiveFieldLine;
qint32 firstActiveFrameLine;
qint32 lastActiveFrameLine;
};

// Drop-outs metadata definition
Expand Down