Skip to content

Rework Level Detection / Chroma Transient Improvement#341

Open
eshaz wants to merge 18 commits into
oyvindln:vhs_decodefrom
eshaz:level-adjust
Open

Rework Level Detection / Chroma Transient Improvement#341
eshaz wants to merge 18 commits into
oyvindln:vhs_decodefrom
eshaz:level-adjust

Conversation

@eshaz

@eshaz eshaz commented Jul 18, 2026

Copy link
Copy Markdown

Level Detection

  • Rewrite level detection so hsync pulses are detected first, measured, and then used to detect vsync.
  • This also moves the level detection before the sync logic so that out of spec / multi-generation tapes with AGC baked in should properly decode.
  • Rewrite sync pulse detection logic so it can lock on to multiple sets of sync pulses. This helps the downstream logic sync to valid lines when recording gaps or recording overlaps happen.
  • Detect levels in vsync area after sync is established.
  • ire0_adjust is informed by the sync tips and vsync area now during pulse detection

Chroma Transient Improvement

  • Add chroma transient improvement to focuses the color phase transitions. This helps to reverse blurriness caused by the slower transient response of color-under.
  --cti_mix CTI_MIX     Sets Chroma Transient Improvement amount (color-under only). This is wet/dry mix of the overall effect. Set to 0 to disable. Default is 1. Set to 0 to disable CTI.
                          Chroma Transient Improvement helps to re-focus edges the up-converted color under. This increases how quickly color can change.
  --cti_width CTI_WIDTH
                        Sets Chroma Transient Improvement width (color-under only). This controls how sharply to focus the chroma in units of subcarrier cycles. Default is 2.
                          Since color under has lower bandwidth than the source, some of the hue detail is lost and sharper edges can be recovered with CTI
                          * Larger width  -> more edge sharpness, less hue detail.
                          * Smaller width -> more hue detail, less edge sharpness.

Other Chroma Improvements

  • Shift chroma during downscaling to compensate for recording filter group delay. This fixes the phase issue that required NTSC phase compensation in the downstream decoder.
  • Replace final chroma sosfiltfilt with super-gauss fft. This filter has zero phase delay and is actually faster on my machine.

Examples

Color Bars (VHS)

vhs_decode branch (before changes)

bars_upstream

--cti_width 0

bars_cti_0

--cti_width 2

bars_cti_2

Vectorscope

vhs_decode branch (before changes)

vec_upstream

--cti_width 0

vec_cti_0

--cti_width 2

vec_cti_2

Linescope

vhs_decode branch (before changes)

scope_upstream

--cti_width 0

scope_cti_0

--cti_width 2

scope_cti_2

@eshaz eshaz changed the title Rework Level Detection Rework Level Detection / Chroma Transient Improvement Jul 18, 2026
@eshaz
eshaz marked this pull request as ready for review July 18, 2026 23:13
@eshaz
eshaz marked this pull request as draft July 19, 2026 00:37
@eshaz
eshaz marked this pull request as ready for review July 19, 2026 03:38
@eshaz
eshaz marked this pull request as draft July 19, 2026 20:48
@eshaz
eshaz marked this pull request as ready for review July 21, 2026 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant