Skip to content

A Dolby Vision Profile 5 record its own RPU contradicts should be routed as what the RPU says #532

Closed

Description

@superuser404notfound

Follow-up to #529, raised there by @skrew.

#529 gave a host the option to present the HDR10 base layer of a source whose Dolby Vision record is wrong (LoadOptions.dolbyVisionHandling = .baseLayerOnly). That is the right answer when nothing can tell which half of the container is lying. For one class it is not the best answer available, because the file states the contradiction itself.

The class

A container record claiming Profile 5, compatibility 0, over a bitstream whose VUI declares BT.2020 YCbCr with a PQ or HLG transfer. A genuine Profile 5 leaves transfer_characteristics and matrix_coeffs unspecified, IPT-PQ-c2 having no VUI code point, so the pairing is already a contradiction and #529 logs it. The reported instance is a 4K remux of 1917 whose RPU carries disable_residual_flag = 0, an enhancement-layer resampling filter and NLQ, fields only a Profile 7 RPU has.

Why the RPU settles it

A Profile 5 RPU cannot carry a residual or an NLQ, so reading one is not a heuristic, it is a proof that the record is wrong. libdovi already answers this in one field, guessed_profile on dovi_rpu_get_header, and the engine already calls that function for DoviRpuConverter.enhancementLayerType.

Measured here against real media:

Source Container record RPU says
Dolby test kit Profile 5 profile 5 compat 0 dovi_profile: 5, vdr_rpu_profile=0, disable_residual=true
A real Profile 8.1 remux profile 8 compat 1 dovi_profile: 8, vdr_rpu_profile=1
The reported title profile 5 compat 0 7 (residual + NLQ)

What should happen

When the record says Profile 5 and the VUI contradicts it, read the first RPU. If it says 7 or 8, believe the RPU and take the route that profile already has: the Profile 7 to 8.1 conversion on a display with Dolby Vision, the HDR10 base on one without, and a truthful dvcC on the way out through the existing compatibility rewrite. Real Dolby Vision, rather than the base layer #529 falls back to.

The audit is gated on the contradiction, so a genuine Profile 5 and every other source read no packets at all. dolbyVisionHandling = .baseLayerOnly keeps precedence, since a host that asks for the base layer is answering a question the engine did not ask.

AV1 Profile 10.0 is out of scope: its RPU lives in an OBU metadata rather than an unspec62 NAL, so this parser cannot audit it, and #529's option stays the answer for that class.

Activity

  1. superuser404notfound commented on Sep 11, 2026

    @superuser404notfound
    OwnerAuthor

    Built and merged as 08ff5ee. @skrew, this is your follow-up from #529.

    What landed

    DolbyVisionRecordAudit keeps the three questions apart: the gate (a Profile 5 record over a BT.2020 YCbCr PQ or HLG VUI, and nothing else, so a genuine Profile 5 reads no packet), the read (libdovi's guessed_profile out of the first unspec62 NAL) and the verdict (7 or 8 correct the record, an RPU that agrees or cannot be read leaves it standing).

    The correction is applied to the record before the classification, which is why no new packaging was needed: an RPU that reads 7 lands on the Profile 7 branch and one that reads 8 on the Profile 8.1 branch, whose compatibility rewrite turns the record's 0 into the 1 it should have carried. The verdict reaches the four places that were reading the record: the served route, the VT-probe bypass and the software-path refusal from #176, and the reload refusal. A reload reuses it rather than auditing twice. dolbyVisionHandling = .baseLayerOnly keeps precedence.

    The read is a second open on the source, because the session's probe demuxer is handed to the software path as it stands and packets taken out of it here would be packets that path never sees.

    Measured

    Dolby's own Profile 8.1 signal with two bytes of its dvvC rewritten to Profile 5 / compatibility 0, bitstream untouched, so the RPU underneath still reads 8. The recipe is in DolbyVisionRecordAuditTests.

    before after
    the relabelled file CODECS="dvh1.05.06" CODECS="hvc1.2.4.L150" + SUPPLEMENTAL-CODECS="dvh1.08.06/db1p"
    its served init.mp4 dvvC profile 5 compat 0 dvvC profile 8 compat 1
    through a full session the IPT misread item videoFormat=hdr10 subType='hvc1' transfer=SMPTE_ST_2084_PQ
    Dolby's genuine Profile 5 dvh1.05.06 unchanged, and no packet read at all

    Profile 8.1, Profile 8.4, plain HDR10 and SDR come out identical to before. Full suite green on both runners (631 XCTest, 2908 swift-testing), CI green on the branch including the tvOS, iOS and visionOS simulator builds.

    One trap worth naming, since it cost a red test: the DOVI record and the colour description arrive only with find_stream_info, so the gate cannot run on the cheap open the packet walk uses, while the extradata that walk needs for its framing survives it.

    Left open deliberately

    The reported title is not available here, so the Profile 7 arm is covered by unit tests only while the Profile 8 arm is measured on real bytes. @skrew, if you still have the 1917 remux, a run on the next release would close that: the line to look for is AE#532: DV Profile 5 record contradicted by its own RPU (RPU reads profile 7), and the picture should be Dolby Vision rather than the HDR10 base .baseLayerOnly gives you today. Leaving this open until then.

    AV1 Profile 10.0 stays out: its RPU rides in a T.35 metadata OBU rather than an unspec62 NAL, so #529's option remains the answer for that class.

  2. superuser404notfound commented on Sep 11, 2026

    @superuser404notfound
    OwnerAuthor

    Released in 6.81.0 (08ff5ee7). Both consumers are pinned to it.

    @skrew, this is the build to try the 1917 remux on. The line to look for is AE#532: DV Profile 5 record contradicted by its own RPU (RPU reads profile 7), and the picture should be Dolby Vision rather than the HDR10 base. Leaving this open for that one run, since the Profile 7 arm is the half no file here could measure.

  3. skrew commented on Sep 11, 2026

    @skrew
    Contributor

    Run on the 1917 remux with 6.81.0, dolbyVisionHandling = .automatic (the host's per-title option left at its default), Apple TV 4K, tvOS 26, Dolby Vision panel, same file as #529 (MKV, HEVC Main10 3840x2160 23.976, dvcC Profile 5 / compat 0 / level 6, VUI BT.2020 / PQ / BT.2020-NCL, RPU with residual + NLQ, 11.8 GB over HTTP).

    The Profile 7 arm fires:

    [HLSVideoEngine] AE#532: DV Profile 5 record contradicted by its own RPU (RPU reads profile 7); serving it as Profile 7, not as Profile 5. A Profile 5 RPU cannot carry a residual or an NLQ
    [HLSVideoEngine] DV source: profile=5 compat=0 level=6 rpu=1 el=0 bl=1 color_primaries=9 color_trc=16 color_space=9
    [HLSVideoEngine] rebuilt hvcC with in-band parameter sets: 23 B → 164 B
    [HLSVideoEngine] prepared: codec=hvc1.2.4.L153,ac-3 supplemental=dvh1.08.06/db1p resolution=3840x2160 fps=23.976 range=PQ DV=profile7 segments=1783 duration=7133.1s
    [HLSVideoEngine] serving on http://127.0.0.1:…/master.m3u8 (dvModeAvailable=true effectiveDvMode=true panelIsHDR=true displaySupportsHDR=true matchContent=true sourceIsHDR=true useMaster=true videoRange=pq dvVariant=profile7 audioLang=fra)
    

    Picture correct, the panel reports Dolby Vision; no green / violet, and no need for .baseLayerOnly on this title any more. Segments serve and seek normally (seg10 5.6 MB, seg18 7.9 MB, no restart).

    Before 6.81.0 the same file logged DV Profile 5 record over a BT.2020 YCbCr VUI and served dvh1.05.06, as in the #529 test plan. This closes the Profile 7 arm on real bytes. Thank you for building it.

  4. superuser404notfound commented on Sep 11, 2026

    @superuser404notfound
    OwnerAuthor

    That is the half no file here could measure, so this is done.

    The whole verdict chain is visible in one place in that log, which is worth recording for the next report of this shape:

    • the gate, a Profile 5 record over a BT.2020 YCbCr PQ VUI (color_primaries=9 color_trc=16 color_space=9)
    • the read, RPU reads profile 7, out of the residual and the NLQ a Profile 5 RPU cannot carry
    • the route, supplemental=dvh1.08.06/db1p with DV=profile7, the existing Profile 7 to 8.1 conversion rather than the base layer, and a panel that reports Dolby Vision

    Thanks for making the case for this in #529 and then going back to the file to measure it. The option you contributed there keeps its job for the class the bitstream does not settle, a Dolby Vision record that is wrong while its RPU agrees with it or says nothing that contradicts it. AV1 Profile 10.0 also stays outside this audit, its RPU riding in a T.35 metadata OBU rather than an unspec62 NAL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions