From cb3c24287ec37814fe6b524191bee132ccfc4985 Mon Sep 17 00:00:00 2001 From: Rishab Nair Date: Fri, 12 Jun 2026 20:00:13 +0100 Subject: [PATCH] Dolby Vision: don't map dovi metadata for full enhancement layer Dolby Vision Full Enhancement Layer requires the extra enhancement layer for mapping. Applying the Poly and MMR curves to the base layer without properly merging the enhancement layer may lead to undesirable results. --- Source/VideoProcessor.cpp | 4 ++++ Source/VideoProcessor.h | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/Source/VideoProcessor.cpp b/Source/VideoProcessor.cpp index fa139bac..73939470 100644 --- a/Source/VideoProcessor.cpp +++ b/Source/VideoProcessor.cpp @@ -278,6 +278,10 @@ bool CVideoProcessor::CheckDoviMetadata(const MediaSideDataDOVIMetadata* pDOVIMe return false; } + // Ignore Profile 7 Full Enhancement Layer as its currently not supported + if (SourceIsDoviFel(pDOVIMetadata)) + return false; + for (const auto& curve : pDOVIMetadata->Mapping.curves) { if (curve.num_pivots < 2 || curve.num_pivots > 9) { return false; diff --git a/Source/VideoProcessor.h b/Source/VideoProcessor.h index 7d8bbe6e..bda3ef5d 100644 --- a/Source/VideoProcessor.h +++ b/Source/VideoProcessor.h @@ -244,6 +244,24 @@ class CVideoProcessor return SourceIsPQorHLG() || m_Dovi.bValid; } + // Check if source is Dolby Vision Full Enhancement Layer + inline bool SourceIsDoviFel(const MediaSideDataDOVIMetadata* pDOVIMetadata) { + if (pDOVIMetadata->Header.disable_residual_flag) + return false; + + if (pDOVIMetadata->Mapping.nlq_method_idc == 0) { + for (uint8_t i = 0; i < 3; i++) { + if (pDOVIMetadata->Mapping.nlq[i].nlq_offset != 0 || + pDOVIMetadata->Mapping.nlq[i].vdr_in_max != (1ULL << pDOVIMetadata->Header.coef_log2_denom) || + pDOVIMetadata->Mapping.nlq[i].linear_deadzone_slope != 0 || + pDOVIMetadata->Mapping.nlq[i].linear_deadzone_threshold != 0) + return true; + } + } + + return false; + } + void UpdateStatsInputFmt(); CRefTime m_streamTime;