Dolby Vision: Parse CMv4.0 extension metadata blocks L15, L16, L18 (stacked on #2392) - #2655
Dolby Vision: Parse CMv4.0 extension metadata blocks L15, L16, L18 (stacked on #2392)#2655MeeeetRain wants to merge 1 commit into
Conversation
There is no missing So no one has info on the remaining bits of L11 yet... By the way, #2392 is now affected by #2541 since RPU in AV1 is in the T.35 part. |
1c8ca23 to
dd11d79
Compare
Adds Dolby Vision RPU (Reference Processing Unit, NAL type 62) parsing for HEVC streams, including the DV2 / CMv4.0 extension metadata blocks L15, L16 and L18 that are not yet handled anywhere. ## Provenance A focused slice of cjee21's PR MediaArea#2392 ('Dolby Vision: Parse RPU in HEVC and AV1'), restricted to the HEVC path, plus L15/L16/L18 field parsing that MediaArea#2392 leaves as Skip_BS stubs (L15, L16) or misses (L18). The AV1/EMDF portion of MediaArea#2392 is intentionally omitted, per @JeromeMartinez's request in MediaArea#2392 to defer AV1 until a File_T35.cpp parser exists. Once MediaArea#2392 lands, this PR should be rebased onto it and reduced to just the L15/L16/L18 delta. ## Files (5, source only — no CI/CMake/project changes) - File__Analyze.h / File__Analyze_MinimizeSize.h: DV_RPU struct + parser decl - File__Analyze_Streams.cpp: Get_DolbyVision_ReferenceProcessingUnit() — the RPU parser, with the CMv4.0 ext_metadata_block switch handling: - L15 (11 B): confidence, precision_rendering_strength, d_local_contrast, d_brightness, d_saturation_plus_one, d_contrast_plus_one, {confidence,d_brightness,d_saturation,d_contrast}_no_pr, revision, reserved - L16 (variable): revision, count, count x Level16Params - L18 (7 B): surround/min/adaptation/max_preserved_luminance_PQ, revision, reserved (L17 stays Skip_BS: Spec v1.5.1 removed its grammar, superseded by L18. Each new case has its own break; the existing case 17 already had one.) - File_Hevc.cpp / File_Hevc.h: HEVC NAL type 62 dispatch + member Also fixes signed/unsigned comparison warnings (C4018) in the imported DV code so it passes the current -warnaserror CI standard. ## Validation — three independent sources agree Field layouts cross-validated against Dolby Vision Metadata Spec v1.5.1, quietvoid/dovi_tool (PR quietvoid/dovi_tool#412), and the official Dolby Vision TV SDK v6.0 test vectors (MFV-L15/L16/L18, CST-DV2). This C++ impl and the Rust dovi_tool produce bit-identical values, e.g. CST-DV2 frame 0: L15 confidence=255, L16 contrast_target=64, L18 adaptation_luminance_PQ=1741. cc @cjee21 @JeromeMartinez
|
Thanks @cjee21 — you're right about the
There is authoritative info on L11 byte 3 from the Dolby Vision Metadata Spec v1.5.1 (Level 11 definition). Byte 3 is not reserved — it carries the DV2 Max Authentic Motion fields This is corroborated by the official DV2 TV SDK v6.0 test vectors: the I implemented this in dovi_tool (PR quietvoid/dovi_tool#412) — relaxed the For this PR: I've restructured it to a single commit on |
Any info on byte 2? |
|
@ cjee21 — per the Dolby Vision Metadata Spec v1.5.1 (Level 11), byte 2 is reserved and expected to be The official DV2 TV SDK v6.0 test vectors confirm this: across That said, in the wild there are streams from third-party encoders (notably some iPhone recordings) where byte 2 is non-zero. quietvoid/dovi_tool relaxed its For MediaInfo I'd suggest: keep byte 2 as a skip today (matching the spec), but don't enforce |
Summary
Implements proper bitstream parsing for the three DV2 (CMv4.0) extension metadata blocks that PR #2392 currently leaves as
Skip_BSstubs (L15, L16) or does not handle at all (L18).Stacked on top of #2392 (
@cjee21's "Dolby Vision: Parse RPU in HEVC and AV1"). Commit 1 (f64e3d4) is an unmodified import of cjee21'sDVbranch so the history is reviewable; commit 2 (1c8ca23) is the only actual change — please review just that one. It should be rebased ontomasteronce #2392 lands.Per
@JeromeMartinez's request in #2392 to split FFmpeg-derived parsing from other-source additions: the L15/L16/L18 layouts here come from the Dolby Vision Metadata Spec v1.5.1, not FFmpeg, so they belong in the "separate PR" bucket Jérôme asked for.What changed
In
File__Analyze_Streams.cpp,Get_DolbyVision_ReferenceProcessingUnit(), the CMv4.0switch (ext_block_level):confidence,precision_rendering_strength,d_local_contrast,d_brightness,d_saturation_plus_one,d_contrast_plus_one,{confidence,d_brightness,d_saturation,d_contrast}_no_pr,revision,reserved.revision,count, thencount × Level16Params[contrast_target, precision_rendering_strength, d_local_contrast, max_d_brightness, max_d_saturation_plus_one].case 18:surround_luminance_PQ,min_preserved_luminance_PQ,adaptation_luminance_PQ,max_preserved_luminance_PQ,revision,reserved(4×12-bit + 4b + 4b).Skip_BS— Spec v1.5.1 removed the L17 grammar (superseded by L18); it should be skipped for forward compatibility, not parsed.breakincase 17(it was falling through tocase 254).Validation — three independent sources agree
The field layouts are cross-validated against:
MFV-L15,MFV-L16,MFV-L18,CST-DV2(Profile 5 HEVC VES)This C++ implementation and the Rust dovi_tool produce bit-identical values on the official samples, e.g.
CST-DV2frame 0:Built and verified on macOS arm64 with
MEDIAINFO_HEVC=ON MEDIAINFO_AV1=ON; the CLI surfaces the fields in--Details=1(Trace) output.Out of scope (future work)
Fill()output (currently Trace-only, same as the rest of Dolby Vision: Parse RPU in HEVC and AV1 #2392).cc @cjee21 @JeromeMartinez