[vlc-commits] [Git][videolan/vlc][master] 2 commits: codec: aom: use same chroma lookup logic as dav1d

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Mar 1 15:39:54 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
cf69a7c6 by Tristan Matthews at 2023-03-01T15:25:13+00:00
codec: aom: use same chroma lookup logic as dav1d

This was done in dav1d in commit f28a4b2b34be9cc3d342c258d698c8f34751205e.

No functional change.

- - - - -
6bdb0bc0 by Tristan Matthews at 2023-03-01T15:25:13+00:00
codec: vpx: use same chroma lookup logic as dav1d

This was done in dav1d in commit f28a4b2b34be9cc3d342c258d698c8f34751205e.

No functional change.

- - - - -


2 changed files:

- modules/codec/aom.c
- modules/codec/vpx.c


Changes:

=====================================
modules/codec/aom.c
=====================================
@@ -168,38 +168,38 @@ static const struct
     vlc_fourcc_t     i_chroma;
     enum aom_img_fmt i_chroma_id;
     uint8_t          i_bitdepth;
-    uint8_t          i_needs_hack;
+    enum aom_transfer_characteristics transfer_characteristics;
 
 } chroma_table[] =
 {
-    { VLC_CODEC_I420, AOM_IMG_FMT_I420, 8, 0 },
-    { VLC_CODEC_I422, AOM_IMG_FMT_I422, 8, 0 },
-    { VLC_CODEC_I444, AOM_IMG_FMT_I444, 8, 0 },
+    /* Transfer characteristic-dependent mappings must come first */
+    { VLC_CODEC_GBR_PLANAR, AOM_IMG_FMT_I444, 8, AOM_CICP_TC_SRGB },
+    { VLC_CODEC_GBR_PLANAR_10L, AOM_IMG_FMT_I44416, 10, AOM_CICP_TC_SRGB },
 
-    { VLC_CODEC_YV12, AOM_IMG_FMT_YV12, 8, 0 },
+    { VLC_CODEC_I420, AOM_IMG_FMT_I420, 8, AOM_CICP_TC_UNSPECIFIED },
+    { VLC_CODEC_I422, AOM_IMG_FMT_I422, 8, AOM_CICP_TC_UNSPECIFIED },
+    { VLC_CODEC_I444, AOM_IMG_FMT_I444, 8, AOM_CICP_TC_UNSPECIFIED },
 
-    { VLC_CODEC_GBR_PLANAR, AOM_IMG_FMT_I444, 8, 1 },
-    { VLC_CODEC_GBR_PLANAR_10L, AOM_IMG_FMT_I44416, 10, 1 },
+    { VLC_CODEC_YV12, AOM_IMG_FMT_YV12, 8, AOM_CICP_TC_UNSPECIFIED },
 
-    { VLC_CODEC_I420_10L, AOM_IMG_FMT_I42016, 10, 0 },
-    { VLC_CODEC_I422_10L, AOM_IMG_FMT_I42216, 10, 0 },
-    { VLC_CODEC_I444_10L, AOM_IMG_FMT_I44416, 10, 0 },
+    { VLC_CODEC_I420_10L, AOM_IMG_FMT_I42016, 10, AOM_CICP_TC_UNSPECIFIED },
+    { VLC_CODEC_I422_10L, AOM_IMG_FMT_I42216, 10, AOM_CICP_TC_UNSPECIFIED },
+    { VLC_CODEC_I444_10L, AOM_IMG_FMT_I44416, 10, AOM_CICP_TC_UNSPECIFIED },
 
-    { VLC_CODEC_I420_12L, AOM_IMG_FMT_I42016, 12, 0 },
-    { VLC_CODEC_I422_12L, AOM_IMG_FMT_I42216, 12, 0 },
-    { VLC_CODEC_I444_12L, AOM_IMG_FMT_I44416, 12, 0 },
+    { VLC_CODEC_I420_12L, AOM_IMG_FMT_I42016, 12, AOM_CICP_TC_UNSPECIFIED },
+    { VLC_CODEC_I422_12L, AOM_IMG_FMT_I42216, 12, AOM_CICP_TC_UNSPECIFIED },
+    { VLC_CODEC_I444_12L, AOM_IMG_FMT_I44416, 12, AOM_CICP_TC_UNSPECIFIED },
 
-    { VLC_CODEC_I444_16L, AOM_IMG_FMT_I44416, 16, 0 },
+    { VLC_CODEC_I444_16L, AOM_IMG_FMT_I44416, 16, AOM_CICP_TC_UNSPECIFIED },
 };
 
 static vlc_fourcc_t FindVlcChroma( struct aom_image *img )
 {
-    uint8_t hack = (img->fmt & AOM_IMG_FMT_I444) && (img->tc == AOM_CICP_TC_SRGB);
-
     for( unsigned int i = 0; i < ARRAY_SIZE(chroma_table); i++ )
         if( chroma_table[i].i_chroma_id == img->fmt &&
             chroma_table[i].i_bitdepth == img->bit_depth &&
-            chroma_table[i].i_needs_hack == hack )
+            ( chroma_table[i].transfer_characteristics == AOM_CICP_TC_UNSPECIFIED ||
+              chroma_table[i].transfer_characteristics == img->tc ) )
             return chroma_table[i].i_chroma;
 
     return 0;


=====================================
modules/codec/vpx.c
=====================================
@@ -110,29 +110,29 @@ static const struct
     vlc_fourcc_t     i_chroma;
     enum vpx_img_fmt i_chroma_id;
     uint8_t          i_bitdepth;
-    uint8_t          i_needs_hack;
-
+    enum vpx_color_space cs;
 } chroma_table[] =
 {
-    { VLC_CODEC_I420, VPX_IMG_FMT_I420, 8, 0 },
-    { VLC_CODEC_I422, VPX_IMG_FMT_I422, 8, 0 },
-    { VLC_CODEC_I444, VPX_IMG_FMT_I444, 8, 0 },
-    { VLC_CODEC_I440, VPX_IMG_FMT_I440, 8, 0 },
+    /* Transfer characteristic-dependent mappings must come first */
+    { VLC_CODEC_GBR_PLANAR, VPX_IMG_FMT_I444, 8, VPX_CS_SRGB },
+    { VLC_CODEC_GBR_PLANAR_10L, VPX_IMG_FMT_I44416, 10, VPX_CS_SRGB },
 
-    { VLC_CODEC_YV12, VPX_IMG_FMT_YV12, 8, 0 },
+    { VLC_CODEC_I420, VPX_IMG_FMT_I420, 8, VPX_CS_UNKNOWN },
+    { VLC_CODEC_I422, VPX_IMG_FMT_I422, 8, VPX_CS_UNKNOWN },
+    { VLC_CODEC_I444, VPX_IMG_FMT_I444, 8, VPX_CS_UNKNOWN },
+    { VLC_CODEC_I440, VPX_IMG_FMT_I440, 8, VPX_CS_UNKNOWN },
 
-    { VLC_CODEC_GBR_PLANAR, VPX_IMG_FMT_I444, 8, 1 },
-    { VLC_CODEC_GBR_PLANAR_10L, VPX_IMG_FMT_I44416, 10, 1 },
+    { VLC_CODEC_YV12, VPX_IMG_FMT_YV12, 8, VPX_CS_UNKNOWN },
 
-    { VLC_CODEC_I420_10L, VPX_IMG_FMT_I42016, 10, 0 },
-    { VLC_CODEC_I422_10L, VPX_IMG_FMT_I42216, 10, 0 },
-    { VLC_CODEC_I444_10L, VPX_IMG_FMT_I44416, 10, 0 },
+    { VLC_CODEC_I420_10L, VPX_IMG_FMT_I42016, 10, VPX_CS_UNKNOWN },
+    { VLC_CODEC_I422_10L, VPX_IMG_FMT_I42216, 10, VPX_CS_UNKNOWN },
+    { VLC_CODEC_I444_10L, VPX_IMG_FMT_I44416, 10, VPX_CS_UNKNOWN },
 
-    { VLC_CODEC_I420_12L, VPX_IMG_FMT_I42016, 12, 0 },
-    { VLC_CODEC_I422_12L, VPX_IMG_FMT_I42216, 12, 0 },
-    { VLC_CODEC_I444_12L, VPX_IMG_FMT_I44416, 12, 0 },
+    { VLC_CODEC_I420_12L, VPX_IMG_FMT_I42016, 12, VPX_CS_UNKNOWN },
+    { VLC_CODEC_I422_12L, VPX_IMG_FMT_I42216, 12, VPX_CS_UNKNOWN },
+    { VLC_CODEC_I444_12L, VPX_IMG_FMT_I44416, 12, VPX_CS_UNKNOWN },
 
-    { VLC_CODEC_I444_16L, VPX_IMG_FMT_I44416, 16, 0 },
+    { VLC_CODEC_I444_16L, VPX_IMG_FMT_I44416, 16, VPX_CS_UNKNOWN },
 };
 
 struct video_color
@@ -172,12 +172,11 @@ const struct video_color vpx_color_mapping_table[] =
 
 static vlc_fourcc_t FindVlcChroma( struct vpx_image *img )
 {
-    uint8_t hack = (img->fmt & VPX_IMG_FMT_I444) && (img->cs == VPX_CS_SRGB);
-
     for( unsigned int i = 0; i < ARRAY_SIZE(chroma_table); i++ )
         if( chroma_table[i].i_chroma_id == img->fmt &&
             chroma_table[i].i_bitdepth == img->bit_depth &&
-            chroma_table[i].i_needs_hack == hack )
+            ( chroma_table[i].cs == VPX_CS_UNKNOWN ||
+              chroma_table[i].cs == img->cs ) )
             return chroma_table[i].i_chroma;
 
     return 0;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/47105d950ece235da8273cdcd867b0021a2b1ac9...6bdb0bc002d860793eb10e3f48952adf1f1cc766

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/47105d950ece235da8273cdcd867b0021a2b1ac9...6bdb0bc002d860793eb10e3f48952adf1f1cc766
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