[vlc-commits] fourcc: define NV12 as semiplanar with the width multiplied and divided by two
Steve Lhomme
git at videolan.org
Wed Apr 18 10:50:19 CEST 2018
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Apr 17 14:20:39 2018 +0200| [9b8944c7042fdbb374d43f87b326f2d65fe984d9] | committer: Steve Lhomme
fourcc: define NV12 as semiplanar with the width multiplied and divided by two
This way we know from the description that the combined UV plane needs to be a
multiple of 2 and we have the proper width for the line (2/2 instead of 1/1 of
the original size)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9b8944c7042fdbb374d43f87b326f2d65fe984d9
---
src/misc/fourcc.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/misc/fourcc.c b/src/misc/fourcc.c
index 1b8682af13..e0c15328d2 100644
--- a/src/misc/fourcc.c
+++ b/src/misc/fourcc.c
@@ -669,6 +669,13 @@ bool vlc_fourcc_IsYUV(vlc_fourcc_t fcc)
#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 SEMIPLANAR(w_den, h_den, size, bits) \
+ { .plane_count = 2, \
+ .p = { {.w = {1, 1}, .h = {1, 1}}, \
+ {.w = {2,w_den}, .h = {1,h_den}} }, \
+ .pixel_size = size, \
+ .pixel_bits = bits }
+
#define PACKED_FMT(size, bits) \
{ .plane_count = 1, \
.p = { {.w = {1,1}, .h = {1,1}} }, \
@@ -690,7 +697,7 @@ static const struct
{ { VLC_CODEC_I411 }, PLANAR_8(3, 4, 1) },
{ { VLC_CODEC_YUV_PLANAR_410 }, PLANAR_8(3, 4, 4) },
{ { VLC_CODEC_YUV_PLANAR_420 }, PLANAR_8(3, 2, 2) },
- { { VLC_CODEC_NV12, VLC_CODEC_NV21 }, PLANAR_8(2, 1, 2) },
+ { { VLC_CODEC_NV12, VLC_CODEC_NV21 }, SEMIPLANAR(2, 2, 1, 8) },
{ { VLC_CODEC_YUV_PLANAR_422 }, PLANAR_8(3, 2, 1) },
{ { VLC_CODEC_NV16, VLC_CODEC_NV61 }, PLANAR_8(2, 1, 1) },
{ { VLC_CODEC_YUV_PLANAR_440 }, PLANAR_8(3, 1, 2) },
@@ -731,7 +738,7 @@ static const struct
VLC_CODEC_I444_16B }, PLANAR_16(3, 1, 1, 16) },
{ { VLC_CODEC_YUVA_444_10L,
VLC_CODEC_YUVA_444_10B }, PLANAR_16(4, 1, 1, 10) },
- { { VLC_CODEC_P010 }, PLANAR_16(2, 1, 2, 10) },
+ { { VLC_CODEC_P010 }, SEMIPLANAR(2, 2, 2, 10) },
{ { VLC_CODEC_YUV_PACKED }, PACKED_FMT(2, 16) },
{ { VLC_CODEC_RGB8, VLC_CODEC_GREY,
More information about the vlc-commits
mailing list