Skip to content

P7 to 8.1 field notes: edge cases from our client-side implementation #135

Closed

Description

@rrgomes

Follow-up to #132 as requested. We compared our (now retiring) client-side P7→8.1 implementation line-by-line against DoviRpuConverter/MP4SegmentMuxer/CodecRoutePolicy on 5.6.2, then confirmed the engine path on device. The cores are identical (libdovi dovi_convert_rpu_with_mode(rpu, 2), EL NAL 63 dropped, dvcC rewritten to profile 8 / bl_compat 1 / el_present 0, supplemental codec string from the source dv_level), so RPU output should be byte-identical. Differences that may be worth hardening:

  1. In-band VPS still declares dual-layer after EL strip. Ours rewrites VPS max_layers_minus1 1→0 per keyframe; we added that after diagnosing a black screen on device. Caveat: our sample entry was dvh1-primary (forces the DV decode pipeline), while the engine routes hvc1 + dvvC with DV as a supplemental brand — and our 5.6.2 device confirmation shows that shape decodes fine with the stale VPS. Likely moot in your architecture; noting it because it was load-bearing in ours.

  2. FEL is indistinguishable from MEL in the logs. Ours parses the first RPU and warns on FEL ("enhancement layer discarded, quality loss expected"). The converted output is the same either way, but a one-line log would help users triage why a FEL disc looks flatter than on a UHD player. Our confirmation source was MEL.

  3. Conversion-failure posture. On a libdovi failure the producer logs once and muxes the packet unconverted, so a P7 RPU rides inside a stream declared 8.1 for the rest of the session. Ours kept per-session failure counters. Suggestion: after N failures, drop the RPU NAL instead — degrading to clean HDR10 beats shipping mixed-profile DV to the decoder.

  4. Small shared gaps, for completeness: a source whose dvcC carries dv_level 0 produces "dvh1.08.00" (neither side recomputes level from the bitstream); Annex-B-framed input passes the NAL walk untouched (both assume length-prefixed framing, which the MKV demuxer guarantees).

Per-packet conversion cost on our side (same libdovi call) measured 0.2-0.4 ms/frame on AppleTV14,1 — comfortably inside a 41.7 ms frame budget — in case that's useful for the AdvancedStats work.

Activity

  1. superuser404notfound commented on Jul 18, 2026

    @superuser404notfound
    Owner

    Thanks for the field notes, this is exactly the kind of follow-up worth folding in. I went through all four against the current engine path; two are now in 5.8.1, the other two turned out to be non-issues here for reasons worth writing down.

    Shipped in 5.8.1

    3. Conversion-failure posture. Agreed, and this was the real gap. The producer previously logged once and muxed the packet unconverted, so a failed P7 RPU rode inside a container already declared 8.1. It now drops the offending RPU (and its EL NAL) on any libdovi failure, so the frame degrades to the clean HDR10 base instead of handing mixed-profile DV to the decoder. I went with a per-packet drop rather than a session N-failure counter: it is strictly safer from the first failure, degrades per frame instead of cutting the whole session over, and a sporadic missing RPU is held by last-good metadata anyway. (Our docs already claimed "any per-packet conversion failure falls back to the HDR10 strip", which turns out to have been aspirational until now.)

    2. FEL vs MEL logging. Added. The first RPU's el_type is probed once via libdovi and a FEL source emits a one-line log noting the enhancement layer is discarded. Also surfaced on DoviConvertProbeResult.enhancementLayerType, so aetherctl dovitest now prints FEL/MEL for offline validation against a real remux.

    Non-issues here

    1. In-band VPS still declaring dual-layer. Moot in this architecture, and your own 5.6.2 device confirmation is the proof. The engine routes the base layer as an hvc1 sample entry with DV carried as a SUPPLEMENTAL-CODECS brand, not the dvh1-primary entry that forces the layered DV decode path, so nothing walks the VPS max_layers_minus1 to instantiate a second layer and the EL NALs are already gone. Your rewrite was load-bearing precisely because your sample entry was dvh1-primary. I left the VPS untouched.

    4. Shared gaps. The dv_level 0 to dvh1.08.00 case is already guarded: the level derivation floors a zero dv_level to 6 (so dvh1.08.06), and the engine never emits .00, though like you it does not recompute the level from the bitstream. Annex-B framing does not occur on this path (the loopback producer only sees length-prefixed MP4/MKV packets, as you note the MKV demuxer guarantees), so the AVCC-only NAL walk is safe here; I kept that as a documented assumption rather than add a start-code branch that can never fire.

    On the perf note: 0.2 to 0.4 ms/frame matches what we see, thanks for the AppleTV14,1 figure. No per-packet DV cost surfaced in AdvancedStats yet, but it is on the list.

    And thanks for retiring your client-side path on the strength of the 5.6.2 confirmation, that is the outcome we were hoping for. Closing this as shipped in 5.8.1.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions