[vlc-commits] [Git][videolan/vlc][master] 2 commits: fourcc: deduce "pixel size" from the bits per component for SEMIPLANAR

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Oct 21 06:29:21 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
ca2d4ed0 by Steve Lhomme at 2023-10-21T06:05:33+00:00
fourcc: deduce "pixel size" from the bits per component for SEMIPLANAR

It's always the number of bytes to hold the bits.

- - - - -
cc618d5c by Steve Lhomme at 2023-10-21T06:05:33+00:00
fourcc: deduce "pixel size" from the bits per component for PLANAR

It's always the number of bytes to hold the bits. Either for 8 bits or anything
between 9 and 16 bits.

- - - - -


1 changed file:

- src/misc/fourcc.c


Changes:

=====================================
src/misc/fourcc.c
=====================================
@@ -656,23 +656,23 @@ bool vlc_fourcc_IsYUV(vlc_fourcc_t fcc)
     return false;
 }
 
-#define PLANAR(n, w_den, h_den, size, bits) \
+#define PLANAR(n, w_den, h_den, bits) \
       .plane_count = n, \
       .p = { {.w = {1,    1}, .h = {1,    1}}, \
              {.w = {1,w_den}, .h = {1,h_den}}, \
              {.w = {1,w_den}, .h = {1,h_den}}, \
              {.w = {1,    1}, .h = {1,    1}} }, \
-      .pixel_size = size, \
+      .pixel_size = ((bits + 7) / 8), \
       .pixel_bits = bits
 
-#define PLANAR_8(n, w_den, h_den)        PLANAR(n, w_den, h_den, 1, 8)
-#define PLANAR_16(n, w_den, h_den, bits) PLANAR(n, w_den, h_den, 2, bits)
+#define PLANAR_8(n, w_den, h_den)        PLANAR(n, w_den, h_den, 8)
+#define PLANAR_16(n, w_den, h_den, bits) PLANAR(n, w_den, h_den, bits)
 
-#define SEMIPLANAR(w_den, h_den, size, bits) \
+#define SEMIPLANAR(w_den, h_den, bits) \
       .plane_count = 2, \
       .p = { {.w = {1,    1}, .h = {1,    1}}, \
              {.w = {2,w_den}, .h = {1,h_den}} }, \
-      .pixel_size = size, \
+      .pixel_size = ((bits + 7) / 8), \
       .pixel_bits = bits
 
 #define PACKED_FMT(size, bits) \
@@ -693,15 +693,15 @@ static const vlc_chroma_description_t p_list_chroma_description[] = {
     { VLC_CODEC_I410,                  PLANAR_8(3, 4, 4) },
     { VLC_CODEC_I420,                  PLANAR_8(3, 2, 2) },
     { VLC_CODEC_YV12,                  PLANAR_8(3, 2, 2) },
-    { VLC_CODEC_NV12,                  SEMIPLANAR(2, 2, 1, 8) },
-    { VLC_CODEC_NV21,                  SEMIPLANAR(2, 2, 1, 8) },
+    { VLC_CODEC_NV12,                  SEMIPLANAR(2, 2, 8) },
+    { VLC_CODEC_NV21,                  SEMIPLANAR(2, 2, 8) },
     { VLC_CODEC_I422,                  PLANAR_8(3, 2, 1) },
-    { VLC_CODEC_NV16,                  SEMIPLANAR(2, 1, 1, 8) },
-    { VLC_CODEC_NV61,                  SEMIPLANAR(2, 1, 1, 8) },
+    { VLC_CODEC_NV16,                  SEMIPLANAR(2, 1, 8) },
+    { VLC_CODEC_NV61,                  SEMIPLANAR(2, 1, 8) },
     { VLC_CODEC_I440,                  PLANAR_8(3, 1, 2) },
     { VLC_CODEC_I444,                  PLANAR_8(3, 1, 1) },
-    { VLC_CODEC_NV24,                  SEMIPLANAR(1, 1, 1, 8) },
-    { VLC_CODEC_NV42,                  SEMIPLANAR(1, 1, 1, 8) },
+    { VLC_CODEC_NV24,                  SEMIPLANAR(1, 1, 8) },
+    { VLC_CODEC_NV42,                  SEMIPLANAR(1, 1, 8) },
     { VLC_CODEC_YUVA,                  PLANAR_8(4, 1, 1) },
     { VLC_CODEC_YUV420A,               PLANAR_8(4, 2, 2) },
     { VLC_CODEC_YUV422A,               PLANAR_8(4, 2, 1) },
@@ -753,8 +753,8 @@ static const vlc_chroma_description_t p_list_chroma_description[] = {
     { VLC_CODEC_YUVA_444_10B,          PLANAR_16(4, 1, 1, 10) },
     { VLC_CODEC_YUVA_444_12L,          PLANAR_16(4, 1, 1, 12) },
     { VLC_CODEC_YUVA_444_12B,          PLANAR_16(4, 1, 1, 12) },
-    { VLC_CODEC_P010,                  SEMIPLANAR(2, 2, 2, 10) },
-    { VLC_CODEC_P016,                  SEMIPLANAR(2, 2, 2, 16) },
+    { VLC_CODEC_P010,                  SEMIPLANAR(2, 2, 10) },
+    { VLC_CODEC_P016,                  SEMIPLANAR(2, 2, 16) },
 
     { VLC_CODEC_YUYV,                  PACKED_FMT(2, 16) },
     { VLC_CODEC_YVYU,                  PACKED_FMT(2, 16) },



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0ef14bde4d6b7a722e50efef30555f893cd0ee5d...cc618d5c4bdc5a54ed2bf94de77742cbe72628f8

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/0ef14bde4d6b7a722e50efef30555f893cd0ee5d...cc618d5c4bdc5a54ed2bf94de77742cbe72628f8
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