SECAM VHS Method 1 IF clamp and ME-SECAM block-anchored band-pass filter - #348
Merged
harrypm merged 2 commits intoAug 4, 2026
Merged
Conversation
Demodulate the band-passed under carrier to instantaneous frequency, clip it to the carrier pair +-87.5 kHz, and reintegrate the phase for the x4 multiplication. The clipping removes noise and truncation transients that otherwise smear into streaky "fire" in downstream de-emphasis.
The super-Gaussian FFT mask from 9dadc1c anchors on fsc, but the restored SECAM FM block sits at conversion_lo - color_under (4.328125 MHz), ~106 kHz below it, and the mask also drops the tight +0.55 MHz top edge that suppressed high-side FM splatter at saturated transitions. Restore the block-anchored FChromaFinal Butterworth for MESECAM; PAL and NTSC keep the FFT mask.
harrypm
pushed a commit
to harrypm/tape-decode-rust-gui
that referenced
this pull request
Aug 4, 2026
Port of vhs-decode e5d5db5d (oyvindln/vhs-decode#348). The colour-under channel truncates the FM sidebands of pre-emphasized edges; the resulting instantaneous-frequency transients swing outside SECAM's legal deviation range, the x4 phase multiplication scales them up fourfold, and every downstream decoder's de-emphasis then smears them into streaks at saturated transitions. They are provably not signal, so remove them at the one stage where they are still small: the under-carrier domain, before the multiply. BT.470-6 table 2 item 2.12 and BT.1700 part C table 4 item 10e put the per-component deviation maxima at D'B -350/+506 kHz and D'R -506/+350 kHz, which mirror across the carrier pair, so both components share the foB - 350 kHz .. foR + 350 kHz corridor. The Python reference clips np.gradient of the unwrapped phase and reintegrates by cumsum. This port already carries per-sample wrapped phase increments, which are that derivative, so the clamp lands on them directly and the existing phase accumulator reintegrates implicitly. Two consequences, documented at the call site: a legal signal passes through untouched (the gradient/cumsum round trip is a 2-tap average that perturbs the phase even where nothing clips), and the clip bites harder on one-sample transients that the central difference would spread over two. The second half of #348 - restoring the block-anchored final chroma band-pass for ME-SECAM - needs no counterpart here: the super-Gaussian FFT mask that regressed it upstream was never ported, and chroma_bandpass_final already anchors the band on color_under * carrier_mult with the tight +0.55 MHz top edge. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
Description
Two quality improvements for time-base-corrected SECAM output, one a fix for a regression in ME-SECAM filtering, the other a clamp on SECAM Method 1 intermediate chroma bandwidth.
ME-SECAM filter regression
9dadc1c added a super-Gaussian FFT mask anchored on fSC, but the restored SECAM FM block sits ~106 kHz below it. The mask also dropped the tight +0.55 MHz top edge that suppressed high-side FM splatter at saturated
transitions.
SECAM VHS method 1 clamping to studio-range/broadcast-safe SECAM
The VHS color-under channel truncates FM sidebands of pre-emphasized edges, the resulting instantaneous-frequency transients swing outside SECAM's legal deviation range, the x4 phase multiplication scales them up fourfold, and every downstream SECAM decoder's de-emphasis then smears them into streaks. These excursions are provably not signal, so they can be removed at the one stage where they are still small: the under-carrier domain, before the 4x multiply.
Motivation
I performed a new battery of visual quality testing against SECAM VHS method 1 and ME-SECAM samples with upcoming chroma decoding tooling.
Changes Made
FChromaFinalButterworth for ME-SECAM. PAL and NTSC keep the fancy super-Gaussian FFT mask.Testing
pytest --output-on-failure)Screenshots (if applicable)
Before IF clamping:


After IF clamping:
Additional Notes
For specification of the broadcast-safe studio-legal SECAM bandwidth constraints used in the clamping: