Skip to content

Commit

Permalink
Changed luma filter settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Inns committed Feb 6, 2020
1 parent 41f99ba commit d762223
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion tools/ld-diffdod/diffdod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ void DiffDod::getFieldErrorByMedian(QVector<SourceVideo::Data> &fields, QVector<
float threshold = static_cast<float>(dodThreshold) / 100.0;

// Calculate the linear threshold for the colourburst region
qint32 cbThreshold = ((65535 / 100) * dodThreshold) / 8; // Note: The /8 is just a guess
qint32 cbThreshold = ((65535 / 100) * dodThreshold) / 4; // Note: The /4 is just a guess

for (qint32 y = 0; y < videoParameters.fieldHeight; y++) {
qint32 startOfLinePointer = y * videoParameters.fieldWidth;
Expand Down
4 changes: 2 additions & 2 deletions tools/ld-diffdod/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ int main(int argc, char *argv[])

// Option to select DOD threshold (-x / --dod-threshold)
QCommandLineOption dodThresholdOption(QStringList() << "x" << "dod-threshold",
QCoreApplication::translate("main", "Specify the DOD threshold percent (1 to 100% default: 5"),
QCoreApplication::translate("main", "Specify the DOD threshold percent (1 to 100% default: 7%"),
QCoreApplication::translate("main", "number"));
parser.addOption(dodThresholdOption);

Expand Down Expand Up @@ -124,7 +124,7 @@ int main(int argc, char *argv[])
return -1;
}

qint32 dodThreshold = 5;
qint32 dodThreshold = 7;
if (parser.isSet(dodThresholdOption)) {
dodThreshold = parser.value(dodThresholdOption).toInt();

Expand Down
20 changes: 8 additions & 12 deletions tools/library/tbc/filters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,21 @@
#include <array>

// PAL - Filter at Fsc/2 (Fsc = 4433618 (/2 = 2,216,809), sample rate = 17,734,472)
// 2.2 MHz LPF - 15 Taps
// 2.2 MHz LPF - 5 Taps
// import scipy.signal
// scipy.signal.firwin(15, [2.2e6/17734472], window='hamming')
static constexpr std::array<double, 15> palLumaFilterCoeffs {
0.00188029, 0.00616523, 0.01927009, 0.04479076, 0.08068761,
0.11896474, 0.14846274, 0.15955709, 0.14846274, 0.11896474,
0.08068761, 0.04479076, 0.01927009, 0.00616523, 0.00188029
// scipy.signal.firwin(5, [2.2e6/17734472], window='hamming')
static constexpr std::array<double, 5> palLumaFilterCoeffs {
0.03283437, 0.23959832, 0.45513461, 0.23959832, 0.03283437
};

static constexpr auto palLumaFilter = makeFIRFilter(palLumaFilterCoeffs);

// NTSC - Filter at Fsc/2 (Fsc = 3579545 (/2 = 1,789,772.5), sample rate = 14,318,180)
// 1.8 MHz LPF - 15 Taps
// 1.8 MHz LPF - 5 Taps
// import scipy.signal
// scipy.signal.firwin(15, [1.8e6/14318180], window='hamming')
static constexpr std::array<double, 15> ntscLumaFilterCoeffs {
0.00170818, 0.00592632, 0.01890583, 0.04442077, 0.0805412 ,
0.11921885, 0.14910167, 0.16035437, 0.14910167, 0.11921885,
0.0805412 , 0.04442077, 0.01890583, 0.00592632, 0.00170818
// scipy.signal.firwin(5, [1.8e6/14318180], window='hamming')
static constexpr std::array<double, 5> ntscLumaFilterCoeffs {
0.03275786, 0.23955702, 0.45537024, 0.23955702, 0.03275786
};
static constexpr auto ntscLumaFilter = makeFIRFilter(ntscLumaFilterCoeffs);

Expand Down

0 comments on commit d762223

Please sign in to comment.