[vlc-devel] [PATCH] dav1d: Add support for hdr10 metadata
Vittorio Giovara
vittorio.giovara at gmail.com
Thu Feb 14 13:10:15 CET 2019
---
This probably needs to wait for 0.2.0 to be tagged in git and contrib.
Vittorio
modules/codec/dav1d.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/modules/codec/dav1d.c b/modules/codec/dav1d.c
index eb47d17f8a..c52a896b94 100644
--- a/modules/codec/dav1d.c
+++ b/modules/codec/dav1d.c
@@ -141,6 +141,32 @@ static int NewPicture(Dav1dPicture *img, void *cookie)
v->pose = dec->fmt_in.video.pose;
dec->fmt_out.video.i_chroma = dec->fmt_out.i_codec = FindVlcChroma(img);
+ if (img->mastering_display) {
+#define ST2086_RED 2
+#define ST2086_GREEN 0
+#define ST2086_BLUE 1
+#define DAV1D_RED 0
+#define DAV1D_GREEN 1
+#define DAV1D_BLUE 2
+ v->mastering.primaries[ST2086_RED + 0] = (float)img->mastering_display->primaries[DAV1D_RED][0] / (1 << 16);
+ v->mastering.primaries[ST2086_RED + 1] = (float)img->mastering_display->primaries[DAV1D_RED][1] / (1 << 16);
+ v->mastering.primaries[ST2086_GREEN + 0] = (float)img->mastering_display->primaries[DAV1D_GREEN][0] / (1 << 16);
+ v->mastering.primaries[ST2086_GREEN + 1] = (float)img->mastering_display->primaries[DAV1D_GREEN][1] / (1 << 16);
+ v->mastering.primaries[ST2086_BLUE + 0] = (float)img->mastering_display->primaries[DAV1D_BLUE][0] / (1 << 16);
+ v->mastering.primaries[ST2086_BLUE + 1] = (float)img->mastering_display->primaries[DAV1D_BLUE][1] / (1 << 16);
+
+ v->mastering.white_point[0] = (float)img->mastering_display->white_point[0] / (1 << 16);
+ v->mastering.white_point[1] = (float)img->mastering_display->white_point[1] / (1 << 16);
+
+ v->mastering.max_luminance = (float)img->mastering_display->max_luminance / (1 << 8);
+ v->mastering.min_luminance = (float)img->mastering_display->min_luminance / (1 << 14);
+ }
+
+ if (img->content_light) {
+ v->lighting.MaxCLL = img->content_light->max_content_light_level;
+ v->lighting.MaxFALL = img->content_light->max_frame_average_light_level;
+ }
+
if (decoder_UpdateVideoFormat(dec) == VLC_SUCCESS)
{
picture_t *pic = decoder_NewPicture(dec);
--
2.20.1
More information about the vlc-devel
mailing list