[vlc-commits] codec: dav1d: apply HDR MDCV

Francois Cartegnie git at videolan.org
Thu Feb 13 22:41:38 CET 2020


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Feb 13 14:15:22 2020 +0100| [8a1cad5e825d74275dfd0f187a8e2c6baa005cb2] | committer: Francois Cartegnie

codec: dav1d: apply HDR MDCV

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8a1cad5e825d74275dfd0f187a8e2c6baa005cb2
---

 modules/codec/dav1d.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/modules/codec/dav1d.c b/modules/codec/dav1d.c
index 7b43391461..208558c8cc 100644
--- a/modules/codec/dav1d.c
+++ b/modules/codec/dav1d.c
@@ -136,6 +136,17 @@ static int NewPicture(Dav1dPicture *img, void *cookie)
         v->color_range = img->seq_hdr->color_range ? COLOR_RANGE_FULL : COLOR_RANGE_LIMITED;
     }
 
+    const Dav1dMasteringDisplay *md = img->mastering_display;
+    if( dec->fmt_in.video.mastering.max_luminance == 0 && md )
+    {
+        for( size_t i=0;i<6; i++ )
+            v->mastering.primaries[i] = md->primaries[i >> 1][i % 2];
+        v->mastering.min_luminance = md->min_luminance;
+        v->mastering.max_luminance = md->max_luminance;
+        v->mastering.white_point[0] = md->white_point[0];
+        v->mastering.white_point[1] = md->white_point[1];
+    }
+
     v->projection_mode = dec->fmt_in.video.projection_mode;
     v->multiview_mode = dec->fmt_in.video.multiview_mode;
     v->pose = dec->fmt_in.video.pose;
@@ -320,6 +331,7 @@ static int OpenDecoder(vlc_object_t *p_this)
     dec->fmt_out.video.transfer    = dec->fmt_in.video.transfer;
     dec->fmt_out.video.space       = dec->fmt_in.video.space;
     dec->fmt_out.video.color_range = dec->fmt_in.video.color_range;
+    dec->fmt_out.video.mastering   = dec->fmt_in.video.mastering;
 
     return VLC_SUCCESS;
 }



More information about the vlc-commits mailing list