Skip to content

Commit

Permalink
chroma-encoder: Add NTSC-specific chroma component filter
Browse files Browse the repository at this point in the history
Change the filter used in the wideband-yuv/yiq modes to
one suggested by Clarke for NTSC.

Small PSNR improvement, up to 0.03 dB.
  • Loading branch information
ifb authored and atsampson committed Jun 22, 2022
1 parent 797d7ec commit 6bf7d0e
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions tools/ld-chroma-decoder/encoder/ntscencoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,15 +268,13 @@ static double syncPulseGate(double t, double startTime, SyncPulseType type)
return raisedCosineGate(t, startTime, startTime + length, 200.0e-9 / 2.0);
}

// 1.3 MHz low-pass Gaussian filter, as used in pyctools-pal's coder.
// Generated by: c = scipy.signal.gaussian(13, 1.49); c / sum(c)
// 1.3 MHz low-pass filter
//
// The UV filter should be 0 dB at 0 Hz, >= -3 dB at 1.3 MHz, <= -20 dB at
// 4.0 MHz. [Clarke p8]
static constexpr std::array<double, 13> uvFilterCoeffs {
8.06454142158873e-05, 0.0009604748783110286, 0.007290763490157312, 0.035272860169480155, 0.10876496139131472,
0.21375585039760908, 0.2677488885178237, 0.21375585039760908, 0.10876496139131472, 0.035272860169480155,
0.007290763490157312, 0.0009604748783110286, 8.06454142158873e-05
// The filter should be 0 dB at 0 Hz, >= -2 dB at 1.3 MHz, < -20 dB at
// 3.6 MHz. [Clarke p15]
static constexpr std::array<double, 9> uvFilterCoeffs {
0.0021, 0.0191, 0.0903, 0.2308, 0.3153,
0.2308, 0.0903, 0.0191, 0.0021
};
static constexpr auto uvFilter = makeFIRFilter(uvFilterCoeffs);

Expand Down

0 comments on commit 6bf7d0e

Please sign in to comment.