Skip to content

Add configurable blackbar scans for subtitles - #1626

Open
dustinreed-info wants to merge 2 commits into
awawa-dev:masterfrom
dustinreed-info:subtitle-blackbar-scanlines
Open

dustinreed-info wants to merge 2 commits into
awawa-dev:masterfrom
dustinreed-info:subtitle-blackbar-scanlines

Conversation

@dustinreed-info

@dustinreed-info dustinreed-info commented Oct 7, 2026 •

Copy link
Copy Markdown

Summary

Add an optional Subtitles blackbar mode for letterboxed video. Subtitles are usually drawn inside the bottom bar, so the bar height is measured at the top across the full width and assumed at the bottom; the bottom is only sampled near its corners (10% and 90%), outside centered captions, so video with a smaller bottom bar is not over-cropped. The smaller of both bounds the existing symmetric crop. There are no extra settings.

While a crop is known, a frame too dark to measure (all samples black) no longer counts towards an unknown border, so dark scenes keep the crop instead of exposing captions in the bar after unknownFrameCnt frames. This only applies to the new mode. Existing modes and the default selection are unchanged.

Related to #821. This handles subtitles in black bars; captions drawn inside the active picture are still sampled by the LEDs.

Design notes (questions from #821)

  • Same height at top and bottom? Yes, the mode assumes symmetric bars, measured at the top. The bottom corner samples catch video with a smaller bottom bar.
  • Vertical scans enough? For bar detection, yes: rows are tested at nine columns at the top and two at the bottom. Known limits: text reaching a bottom corner sample, or an overlay inside the top bar, makes the crop smaller.

What kind of change does this PR introduce?

  • Feature
  • Build-related changes: standalone detector regression tests in CI

Does this PR introduce a breaking change?

  • Yes
  • No

The PR fulfills these requirements:

  • Related issue referenced above.

Validation

Detector regression tests (synthetic frames reproducing #821: wide two-line captions, asymmetric bars, aspect changes, threshold boundaries, black frames, tiny images, known limits) pass. On an LG C1, a v22 backport with equivalent sampling and the dark-frame crop hold runs with WLED output; with borderFrameCnt 15 / unknownFrameCnt 600, captions in the bar of a letterboxed trailer no longer lit the bottom LEDs.

Draft pending wider playback testing.

@dustinreed-info
dustinreed-info force-pushed the subtitle-blackbar-scanlines branch from caa7163 to 21ecc0a Compare October 8, 2026 20:50
Subtitles are usually drawn inside the bottom bar, so the bar height is
now measured at the top across the full width and assumed at the bottom,
which is only sampled near its corners (10% and 90%). This removes the
scan position settings. While a crop is known, a frame too dark to
measure no longer counts towards an unknown border, so dark scenes keep
the crop instead of exposing captions in the bar.
@dustinreed-info
dustinreed-info marked this pull request as ready for review November 4, 2026 03:51
@dustinreed-info

Copy link
Copy Markdown
Author

@awawa-dev when you have a moment, could you approve the CI run for this PR? Happy to change anything in the approach if you'd prefer it done differently.

@awawa-dev

Copy link
Copy Markdown
Owner

Done. I've had an idea for a new black border detector for a while now, as the current solutions in HyperHDR are quite brutally simple and limited, but first Ininite Engine took my all resources and after that unfortunately my free time is getting more and more scarce. But I'm planing it as an alternative solution and current blackbar detector will remain as a fallback option for a long time.

@dustinreed-info

Copy link
Copy Markdown
Author

Thanks for approving the run, all checks pass. Since the current detector is staying as a fallback, would you be open to merging this in the meantime?

This branch has not been deployed

No deployments
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.

2 participants