[vlc-commits] [Git][videolan/vlc][3.0.x] dav1d: fix gbrp mapping

Tristan Matthews (@tmatth) gitlab at videolan.org
Mon Jan 30 16:31:04 UTC 2023



Tristan Matthews pushed to branch 3.0.x at VideoLAN / VLC


Commits:
6a661074 by Tristan Matthews at 2023-01-29T11:26:06-05:00
dav1d: fix gbrp mapping

Fixes #27586

(cherry picked from commit f28a4b2b34be9cc3d342c258d698c8f34751205e)

- - - - -


1 changed file:

- modules/codec/dav1d.c


Changes:

=====================================
modules/codec/dav1d.c
=====================================
@@ -89,27 +89,35 @@ 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_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_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_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_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/6a661074216638cf9f3e25c6b9dc842e0a81fd0a

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6a661074216638cf9f3e25c6b9dc842e0a81fd0a
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