[vlc-commits] [Git][videolan/vlc][master] dav1d: fix gbrp mapping

Tristan Matthews (@tmatth) gitlab at videolan.org
Sat Jan 28 15:10:05 UTC 2023



Tristan Matthews pushed to branch master at VideoLAN / VLC


Commits:
f28a4b2b by Tristan Matthews at 2023-01-28T14:53:01+00:00
dav1d: fix gbrp mapping

Fixes #27586

- - - - -


1 changed file:

- modules/codec/dav1d.c


Changes:

=====================================
modules/codec/dav1d.c
=====================================
@@ -102,29 +102,37 @@ static const struct
     vlc_fourcc_t          i_chroma;
     enum Dav1dPixelLayout i_chroma_id;
     uint8_t               i_bitdepth;
+    enum Dav1dTransferCharacteristics transfer_characteristics;
 } chroma_table[] =
 {
-    {VLC_CODEC_GREY, DAV1D_PIXEL_LAYOUT_I400, 8},
-    {VLC_CODEC_I420, DAV1D_PIXEL_LAYOUT_I420, 8},
-    {VLC_CODEC_I422, DAV1D_PIXEL_LAYOUT_I422, 8},
-    {VLC_CODEC_I444, DAV1D_PIXEL_LAYOUT_I444, 8},
-
-    {VLC_CODEC_GREY_10L, DAV1D_PIXEL_LAYOUT_I400, 10},
-    {VLC_CODEC_I420_10L, DAV1D_PIXEL_LAYOUT_I420, 10},
-    {VLC_CODEC_I422_10L, DAV1D_PIXEL_LAYOUT_I422, 10},
-    {VLC_CODEC_I444_10L, DAV1D_PIXEL_LAYOUT_I444, 10},
-
-    {VLC_CODEC_GREY_12L, DAV1D_PIXEL_LAYOUT_I400, 12},
-    {VLC_CODEC_I420_12L, DAV1D_PIXEL_LAYOUT_I420, 12},
-    {VLC_CODEC_I422_12L, DAV1D_PIXEL_LAYOUT_I422, 12},
-    {VLC_CODEC_I444_12L, DAV1D_PIXEL_LAYOUT_I444, 12},
+    /* Transfer characteristic-dependent mappings must come first */
+    {VLC_CODEC_GBR_PLANAR, DAV1D_PIXEL_LAYOUT_I444, 8, DAV1D_TRC_SRGB},
+    {VLC_CODEC_GBR_PLANAR_10L, DAV1D_PIXEL_LAYOUT_I444, 10, DAV1D_TRC_SRGB},
+
+    {VLC_CODEC_GREY, DAV1D_PIXEL_LAYOUT_I400, 8, DAV1D_TRC_UNKNOWN},
+    {VLC_CODEC_I420, DAV1D_PIXEL_LAYOUT_I420, 8, DAV1D_TRC_UNKNOWN},
+    {VLC_CODEC_I422, DAV1D_PIXEL_LAYOUT_I422, 8, DAV1D_TRC_UNKNOWN},
+    {VLC_CODEC_I444, DAV1D_PIXEL_LAYOUT_I444, 8, DAV1D_TRC_UNKNOWN},
+
+    {VLC_CODEC_GREY_10L, DAV1D_PIXEL_LAYOUT_I400, 10, DAV1D_TRC_UNKNOWN},
+    {VLC_CODEC_I420_10L, DAV1D_PIXEL_LAYOUT_I420, 10, DAV1D_TRC_UNKNOWN},
+    {VLC_CODEC_I422_10L, DAV1D_PIXEL_LAYOUT_I422, 10, DAV1D_TRC_UNKNOWN},
+    {VLC_CODEC_I444_10L, DAV1D_PIXEL_LAYOUT_I444, 10, DAV1D_TRC_UNKNOWN},
+
+    {VLC_CODEC_GREY_12L, DAV1D_PIXEL_LAYOUT_I400, 12, DAV1D_TRC_UNKNOWN},
+    {VLC_CODEC_I420_12L, DAV1D_PIXEL_LAYOUT_I420, 12, DAV1D_TRC_UNKNOWN},
+    {VLC_CODEC_I422_12L, DAV1D_PIXEL_LAYOUT_I422, 12, DAV1D_TRC_UNKNOWN},
+    {VLC_CODEC_I444_12L, DAV1D_PIXEL_LAYOUT_I444, 12, DAV1D_TRC_UNKNOWN},
 };
 
 static vlc_fourcc_t FindVlcChroma(const Dav1dPicture *img)
 {
+
     for (unsigned int i = 0; i < ARRAY_SIZE(chroma_table); i++)
         if (chroma_table[i].i_chroma_id == img->p.layout &&
-            chroma_table[i].i_bitdepth == img->p.bpc)
+            chroma_table[i].i_bitdepth == img->p.bpc &&
+            (chroma_table[i].transfer_characteristics == DAV1D_TRC_UNKNOWN ||
+             chroma_table[i].transfer_characteristics == img->seq_hdr->trc))
             return chroma_table[i].i_chroma;
 
     return 0;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/f28a4b2b34be9cc3d342c258d698c8f34751205e

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/f28a4b2b34be9cc3d342c258d698c8f34751205e
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list