Skip to content

HEVC: strip HDR10+ wherever it sits in an SEI NAL - #822

Merged
GLinnik21 merged 2 commits into
plxnative:mainfrom
tiper:hevc-hdr10plus-sei-walk
Oct 18, 2026
Merged

GLinnik21 merged 2 commits into
plxnative:mainfrom
tiper:hevc-hdr10plus-sei-walk

Conversation

@tiper

@tiper tiper commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Before: is_hdr10plus_sei read only the first message of an HEVC SEI NAL. An SEI NAL can carry several messages, so when an HDR10+ (ST 2094-40, T.35 B5 00 3C) message sat behind another one, such as a mastering-display message, the NAL was kept and the HDR10+ metadata reached webOS's decoder, which stalls on it.

After: every message in the NAL is walked, and the NAL is dropped if any of them is HDR10+. Message sizes are read after emulation-prevention bytes (00 00 03) are removed, so a size that spans one no longer lands short of the next message. Static HDR10 metadata (payloadType 137/144) in a NAL of its own is still kept; one that shares a NAL with HDR10+ goes with it, since the NAL is dropped whole.

How: is_hdr10plus_sei now unescapes the SEI RBSP (sei_rbsp) and loops over payloadType/payloadSize pairs until the 0x80 trailing byte, with bounds-checked slices throughout (listed in ci/list-caps.ini). Four tests in ff_packet_framing_tests.rs cover HDR10+ alone and behind another message, static metadata and non-HDR10+ T.35 payloads being kept, a size that spans an emulation-prevention byte, and every truncation of a NAL returning without a panic.

Verification on this branch (upstream main at 1c89b03 plus this commit):

  • make check: passed, every suite ok with 0 failed
  • cargo +nightly check --lib --no-default-features: clean

tiper and others added 2 commits October 16, 2026 11:59
is_hdr10plus_sei read only the first message of an SEI NAL, so an
HDR10+ message behind another one reached webOS's decoder, which stalls
on it. Walk every message, with sizes counted after emulation-prevention
bytes are removed.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: Tiago Pereira <[email protected]>
…ring its NAL

An HEVC SEI NAL holding HDR10+ (payloadType 4, T.35 B5 00 3C) alongside mastering
display (137) or content light level (144) used to be dropped whole, taking the static
metadata the pipeline builds the panel's HDR envelope from with it. strip_hdr10plus_sei
now rebuilds the NAL from the remaining messages (emulation prevention re-inserted) and
drops it only when nothing else is left; an SEI that does not parse cleanly keeps the old
whole-NAL rule. Fixes the truncated-SEI test, which asserted nothing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@GLinnik21
GLinnik21 merged commit 2cb7707 into plxnative:main Oct 18, 2026
13 checks passed
GLinnik21 added a commit to RichiL10/plx-native that referenced this pull request Oct 18, 2026
Resolve packet_to_annexb against plxnative#822: the Dolby Vision P7 enhancement-layer
drop and RPU rewrite run first, then strip_hdr10plus_sei.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
RichiL10 added a commit to RichiL10/plx-native that referenced this pull request Oct 18, 2026
Brings in the upstream commits since 84759b9:
- plxnative#822 HEVC: strip HDR10+ wherever it sits in an SEI NAL
- plxnative#817 Direct play: recover a plain-http body that ends early, goes silent or cannot be crossed
- plxnative#825 Dolby Vision P7 -> 8.1 (the fork's own b0856d6, squashed upstream with the author's
  resolution against plxnative#822)
- plxnative#835 Hungarian UI language, plxnative#836 ARM binary size budget re-baseline, plxnative#666 webOS 1-3 opt-in
  interface resolution

Conflict in rust-modules/media/src/ff.rs only:
- the DV definitions and packet_to_annexb are taken from upstream, which is the author's own
  resolution of plxnative#825 against plxnative#822 (EL drop and RPU rewrite first, then strip_hdr10plus_sei);
  packet_to_annexb is now identical to upstream main
- the fork keeps its video-copy remux fallback that arms the P7 conversion from the route's
  frozen source facts when PMS's Matroska remux omits the DOVI configuration record (remux_dv)
@tiper
tiper deleted the hevc-hdr10plus-sei-walk branch October 19, 2026 09:56
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