From 77f802f8e6549b473a3101577916c95e7e6d5944 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 16 Mar 2017 17:12:17 +0200 Subject: [PATCH] video: Add I420/I422/Y444_12LE/BE and GBRA video formats https://bugzilla.gnome.org/show_bug.cgi?id=780100 --- gst-libs/gst/video/video-converter.c | 7 + gst-libs/gst/video/video-format.c | 506 +++++++++++++++++++++++++++++++++++ gst-libs/gst/video/video-format.h | 17 +- gst-libs/gst/video/video-info.c | 17 ++ 4 files changed, 546 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/video/video-converter.c b/gst-libs/gst/video/video-converter.c index d6b28a6..cc5031e 100644 --- a/gst-libs/gst/video/video-converter.c +++ b/gst-libs/gst/video/video-converter.c @@ -5802,6 +5802,7 @@ get_scale_format (GstVideoFormat format, gint plane) case GST_VIDEO_FORMAT_YUV9: case GST_VIDEO_FORMAT_YVU9: case GST_VIDEO_FORMAT_GBR: + case GST_VIDEO_FORMAT_GBRA: res = GST_VIDEO_FORMAT_GRAY8; break; case GST_VIDEO_FORMAT_GRAY16_BE: @@ -5856,6 +5857,12 @@ get_scale_format (GstVideoFormat format, gint plane) case GST_VIDEO_FORMAT_I422_10LE: case GST_VIDEO_FORMAT_Y444_10BE: case GST_VIDEO_FORMAT_Y444_10LE: + case GST_VIDEO_FORMAT_I420_12BE: + case GST_VIDEO_FORMAT_I420_12LE: + case GST_VIDEO_FORMAT_I422_12BE: + case GST_VIDEO_FORMAT_I422_12LE: + case GST_VIDEO_FORMAT_Y444_12BE: + case GST_VIDEO_FORMAT_Y444_12LE: case GST_VIDEO_FORMAT_GBR_10BE: case GST_VIDEO_FORMAT_GBR_10LE: case GST_VIDEO_FORMAT_GBRA_10BE: diff --git a/gst-libs/gst/video/video-format.c b/gst-libs/gst/video/video-format.c index 8ce5ee3..b4b74f5 100644 --- a/gst-libs/gst/video/video-format.c +++ b/gst-libs/gst/video/video-format.c @@ -1012,6 +1012,64 @@ pack_GBR (const GstVideoFormatInfo * info, GstVideoPackFlags flags, video_orc_pack_Y444 (dr, dg, db, src, width); } +#define PACK_GBRA GST_VIDEO_FORMAT_ARGB, unpack_GBRA, 1, pack_GBRA +static void +unpack_GBRA (const GstVideoFormatInfo * info, GstVideoPackFlags flags, + gpointer dest, const gpointer data[GST_VIDEO_MAX_PLANES], + const gint stride[GST_VIDEO_MAX_PLANES], gint x, gint y, gint width) +{ + int i; + const guint8 *sg = GET_G_LINE (y); + const guint8 *sb = GET_B_LINE (y); + const guint8 *sr = GET_R_LINE (y); + const guint8 *sa = GET_A_LINE (y); + guint8 *d = dest, G, B, R, A; + + sg += x; + sb += x; + sr += x; + sa += x; + + for (i = 0; i < width; i++) { + G = GST_READ_UINT8 (sg + i); + B = GST_READ_UINT8 (sb + i); + R = GST_READ_UINT8 (sr + i); + A = GST_READ_UINT8 (sa + i); + + d[i * 4 + 0] = A; + d[i * 4 + 1] = R; + d[i * 4 + 2] = G; + d[i * 4 + 3] = B; + } +} + +static void +pack_GBRA (const GstVideoFormatInfo * info, GstVideoPackFlags flags, + const gpointer src, gint sstride, gpointer data[GST_VIDEO_MAX_PLANES], + const gint stride[GST_VIDEO_MAX_PLANES], GstVideoChromaSite chroma_site, + gint y, gint width) +{ + int i; + guint8 *restrict dg = GET_G_LINE (y); + guint8 *restrict db = GET_B_LINE (y); + guint8 *restrict dr = GET_R_LINE (y); + guint8 *restrict da = GET_A_LINE (y); + guint8 G, B, R, A; + const guint8 *restrict s = src; + + for (i = 0; i < width; i++) { + G = (s[i * 4 + 2]); + B = (s[i * 4 + 3]); + R = (s[i * 4 + 1]); + A = (s[i * 4 + 0]); + + GST_WRITE_UINT8 (dg + i, G); + GST_WRITE_UINT8 (db + i, B); + GST_WRITE_UINT8 (dr + i, R); + GST_WRITE_UINT8 (da + i, A); + } +} + #define PACK_GRAY8 GST_VIDEO_FORMAT_AYUV, unpack_GRAY8, 1, pack_GRAY8 static void unpack_GRAY8 (const GstVideoFormatInfo * info, GstVideoPackFlags flags, @@ -3165,6 +3223,440 @@ pack_I422_10BE (const GstVideoFormatInfo * info, GstVideoPackFlags flags, } } +#define PACK_Y444_12LE GST_VIDEO_FORMAT_AYUV64, unpack_Y444_12LE, 1, pack_Y444_12LE +static void +unpack_Y444_12LE (const GstVideoFormatInfo * info, GstVideoPackFlags flags, + gpointer dest, const gpointer data[GST_VIDEO_MAX_PLANES], + const gint stride[GST_VIDEO_MAX_PLANES], gint x, gint y, gint width) +{ + int i; + guint16 *restrict sy = GET_Y_LINE (y); + guint16 *restrict su = GET_U_LINE (y); + guint16 *restrict sv = GET_V_LINE (y); + guint16 *restrict d = dest, Y, U, V; + + sy += x; + su += x; + sv += x; + + for (i = 0; i < width; i++) { + Y = GST_READ_UINT16_LE (sy + i) << 4; + U = GST_READ_UINT16_LE (su + i) << 4; + V = GST_READ_UINT16_LE (sv + i) << 4; + + if (!(flags & GST_VIDEO_PACK_FLAG_TRUNCATE_RANGE)) { + Y |= (Y >> 12); + U |= (U >> 12); + V |= (V >> 12); + } + + d[i * 4 + 0] = 0xffff; + d[i * 4 + 1] = Y; + d[i * 4 + 2] = U; + d[i * 4 + 3] = V; + } +} + +static void +pack_Y444_12LE (const GstVideoFormatInfo * info, GstVideoPackFlags flags, + const gpointer src, gint sstride, gpointer data[GST_VIDEO_MAX_PLANES], + const gint stride[GST_VIDEO_MAX_PLANES], GstVideoChromaSite chroma_site, + gint y, gint width) +{ + int i; + guint16 *restrict dy = GET_Y_LINE (y); + guint16 *restrict du = GET_U_LINE (y); + guint16 *restrict dv = GET_V_LINE (y); + guint16 Y, U, V; + const guint16 *restrict s = src; + + for (i = 0; i < width; i++) { + Y = (s[i * 4 + 1]) >> 4; + U = (s[i * 4 + 2]) >> 4; + V = (s[i * 4 + 3]) >> 4; + + GST_WRITE_UINT16_LE (dy + i, Y); + GST_WRITE_UINT16_LE (du + i, U); + GST_WRITE_UINT16_LE (dv + i, V); + } +} + +#define PACK_Y444_12BE GST_VIDEO_FORMAT_AYUV64, unpack_Y444_12BE, 1, pack_Y444_12BE +static void +unpack_Y444_12BE (const GstVideoFormatInfo * info, GstVideoPackFlags flags, + gpointer dest, const gpointer data[GST_VIDEO_MAX_PLANES], + const gint stride[GST_VIDEO_MAX_PLANES], gint x, gint y, gint width) +{ + int i; + const guint16 *restrict sy = GET_Y_LINE (y); + const guint16 *restrict su = GET_U_LINE (y); + const guint16 *restrict sv = GET_V_LINE (y); + guint16 *restrict d = dest, Y, U, V; + + sy += x; + su += x; + sv += x; + + for (i = 0; i < width; i++) { + Y = GST_READ_UINT16_BE (sy + i) << 4; + U = GST_READ_UINT16_BE (su + i) << 4; + V = GST_READ_UINT16_BE (sv + i) << 4; + + if (!(flags & GST_VIDEO_PACK_FLAG_TRUNCATE_RANGE)) { + Y |= (Y >> 12); + U |= (U >> 12); + V |= (V >> 12); + } + + d[i * 4 + 0] = 0xffff; + d[i * 4 + 1] = Y; + d[i * 4 + 2] = U; + d[i * 4 + 3] = V; + } +} + +static void +pack_Y444_12BE (const GstVideoFormatInfo * info, GstVideoPackFlags flags, + const gpointer src, gint sstride, gpointer data[GST_VIDEO_MAX_PLANES], + const gint stride[GST_VIDEO_MAX_PLANES], GstVideoChromaSite chroma_site, + gint y, gint width) +{ + int i; + guint16 *restrict dy = GET_Y_LINE (y); + guint16 *restrict du = GET_U_LINE (y); + guint16 *restrict dv = GET_V_LINE (y); + guint16 Y, U, V; + const guint16 *restrict s = src; + + for (i = 0; i < width; i++) { + Y = s[i * 4 + 1] >> 4; + U = s[i * 4 + 2] >> 4; + V = s[i * 4 + 3] >> 4; + + GST_WRITE_UINT16_BE (dy + i, Y); + GST_WRITE_UINT16_BE (du + i, U); + GST_WRITE_UINT16_BE (dv + i, V); + } +} + +#define PACK_I420_12LE GST_VIDEO_FORMAT_AYUV64, unpack_I420_12LE, 1, pack_I420_12LE +static void +unpack_I420_12LE (const GstVideoFormatInfo * info, GstVideoPackFlags flags, + gpointer dest, const gpointer data[GST_VIDEO_MAX_PLANES], + const gint stride[GST_VIDEO_MAX_PLANES], gint x, gint y, gint width) +{ + int i; + gint uv = GET_UV_420 (y, flags); + const guint16 *restrict sy = GET_Y_LINE (y); + const guint16 *restrict su = GET_U_LINE (uv); + const guint16 *restrict sv = GET_V_LINE (uv); + guint16 *restrict d = dest, Y, U, V; + + sy += x; + su += x >> 1; + sv += x >> 1; + + for (i = 0; i < width; i++) { + Y = GST_READ_UINT16_LE (sy + i) << 4; + U = GST_READ_UINT16_LE (su + (i >> 1)) << 4; + V = GST_READ_UINT16_LE (sv + (i >> 1)) << 4; + + if (!(flags & GST_VIDEO_PACK_FLAG_TRUNCATE_RANGE)) { + Y |= (Y >> 12); + U |= (U >> 12); + V |= (V >> 12); + } + + d[i * 4 + 0] = 0xffff; + d[i * 4 + 1] = Y; + d[i * 4 + 2] = U; + d[i * 4 + 3] = V; + + if (x & 1) { + x = 0; + su++; + sv++; + } + } +} + +static void +pack_I420_12LE (const GstVideoFormatInfo * info, GstVideoPackFlags flags, + const gpointer src, gint sstride, gpointer data[GST_VIDEO_MAX_PLANES], + const gint stride[GST_VIDEO_MAX_PLANES], GstVideoChromaSite chroma_site, + gint y, gint width) +{ + int i; + gint uv = GET_UV_420 (y, flags); + guint16 *restrict dy = GET_Y_LINE (y); + guint16 *restrict du = GET_U_LINE (uv); + guint16 *restrict dv = GET_V_LINE (uv); + guint16 Y0, Y1, U, V; + const guint16 *restrict s = src; + + if (IS_CHROMA_LINE_420 (y, flags)) { + for (i = 0; i < width - 1; i += 2) { + Y0 = s[i * 4 + 1] >> 4; + Y1 = s[i * 4 + 5] >> 4; + U = s[i * 4 + 2] >> 4; + V = s[i * 4 + 3] >> 4; + + GST_WRITE_UINT16_LE (dy + i + 0, Y0); + GST_WRITE_UINT16_LE (dy + i + 1, Y1); + GST_WRITE_UINT16_LE (du + (i >> 1), U); + GST_WRITE_UINT16_LE (dv + (i >> 1), V); + } + if (i == width - 1) { + Y0 = s[i * 4 + 1] >> 4; + U = s[i * 4 + 2] >> 4; + V = s[i * 4 + 3] >> 4; + + GST_WRITE_UINT16_LE (dy + i, Y0); + GST_WRITE_UINT16_LE (du + (i >> 1), U); + GST_WRITE_UINT16_LE (dv + (i >> 1), V); + } + } else { + for (i = 0; i < width; i++) { + Y0 = s[i * 4 + 1] >> 4; + GST_WRITE_UINT16_LE (dy + i, Y0); + } + } +} + +#define PACK_I420_12BE GST_VIDEO_FORMAT_AYUV64, unpack_I420_12BE, 1, pack_I420_12BE +static void +unpack_I420_12BE (const GstVideoFormatInfo * info, GstVideoPackFlags flags, + gpointer dest, const gpointer data[GST_VIDEO_MAX_PLANES], + const gint stride[GST_VIDEO_MAX_PLANES], gint x, gint y, gint width) +{ + int i; + gint uv = GET_UV_420 (y, flags); + const guint16 *restrict sy = GET_Y_LINE (y); + const guint16 *restrict su = GET_U_LINE (uv); + const guint16 *restrict sv = GET_V_LINE (uv); + guint16 *restrict d = dest, Y, U, V; + + sy += x; + su += x >> 1; + sv += x >> 1; + + for (i = 0; i < width; i++) { + Y = GST_READ_UINT16_BE (sy + i) << 4; + U = GST_READ_UINT16_BE (su + (i >> 1)) << 4; + V = GST_READ_UINT16_BE (sv + (i >> 1)) << 4; + + if (!(flags & GST_VIDEO_PACK_FLAG_TRUNCATE_RANGE)) { + Y |= (Y >> 12); + U |= (U >> 12); + V |= (V >> 12); + } + + d[i * 4 + 0] = 0xffff; + d[i * 4 + 1] = Y; + d[i * 4 + 2] = U; + d[i * 4 + 3] = V; + + if (x & 1) { + x = 0; + su++; + sv++; + } + } +} + +static void +pack_I420_12BE (const GstVideoFormatInfo * info, GstVideoPackFlags flags, + const gpointer src, gint sstride, gpointer data[GST_VIDEO_MAX_PLANES], + const gint stride[GST_VIDEO_MAX_PLANES], GstVideoChromaSite chroma_site, + gint y, gint width) +{ + int i; + gint uv = GET_UV_420 (y, flags); + guint16 *restrict dy = GET_Y_LINE (y); + guint16 *restrict du = GET_U_LINE (uv); + guint16 *restrict dv = GET_V_LINE (uv); + guint16 Y0, Y1, U, V; + const guint16 *restrict s = src; + + if (IS_CHROMA_LINE_420 (y, flags)) { + for (i = 0; i < width - 1; i += 2) { + Y0 = s[i * 4 + 1] >> 4; + Y1 = s[i * 4 + 5] >> 4; + U = s[i * 4 + 2] >> 4; + V = s[i * 4 + 3] >> 4; + + GST_WRITE_UINT16_BE (dy + i + 0, Y0); + GST_WRITE_UINT16_BE (dy + i + 1, Y1); + GST_WRITE_UINT16_BE (du + (i >> 1), U); + GST_WRITE_UINT16_BE (dv + (i >> 1), V); + } + if (i == width - 1) { + Y0 = s[i * 4 + 1] >> 4; + U = s[i * 4 + 2] >> 4; + V = s[i * 4 + 3] >> 4; + + GST_WRITE_UINT16_BE (dy + i, Y0); + GST_WRITE_UINT16_BE (du + (i >> 1), U); + GST_WRITE_UINT16_BE (dv + (i >> 1), V); + } + } else { + for (i = 0; i < width; i++) { + Y0 = s[i * 4 + 1] >> 6; + GST_WRITE_UINT16_BE (dy + i, Y0); + } + } +} + +#define PACK_I422_12LE GST_VIDEO_FORMAT_AYUV64, unpack_I422_12LE, 1, pack_I422_12LE +static void +unpack_I422_12LE (const GstVideoFormatInfo * info, GstVideoPackFlags flags, + gpointer dest, const gpointer data[GST_VIDEO_MAX_PLANES], + const gint stride[GST_VIDEO_MAX_PLANES], gint x, gint y, gint width) +{ + int i; + const guint16 *restrict sy = GET_Y_LINE (y); + const guint16 *restrict su = GET_U_LINE (y); + const guint16 *restrict sv = GET_V_LINE (y); + guint16 *restrict d = dest, Y, U, V; + + sy += x; + su += x >> 1; + sv += x >> 1; + + for (i = 0; i < width; i++) { + Y = GST_READ_UINT16_LE (sy + i) << 4; + U = GST_READ_UINT16_LE (su + (i >> 1)) << 4; + V = GST_READ_UINT16_LE (sv + (i >> 1)) << 4; + + if (!(flags & GST_VIDEO_PACK_FLAG_TRUNCATE_RANGE)) { + Y |= (Y >> 12); + U |= (U >> 12); + V |= (V >> 12); + } + + d[i * 4 + 0] = 0xffff; + d[i * 4 + 1] = Y; + d[i * 4 + 2] = U; + d[i * 4 + 3] = V; + + if (x & 1) { + x = 0; + su++; + sv++; + } + } +} + +static void +pack_I422_12LE (const GstVideoFormatInfo * info, GstVideoPackFlags flags, + const gpointer src, gint sstride, gpointer data[GST_VIDEO_MAX_PLANES], + const gint stride[GST_VIDEO_MAX_PLANES], GstVideoChromaSite chroma_site, + gint y, gint width) +{ + int i; + guint16 *restrict dy = GET_Y_LINE (y); + guint16 *restrict du = GET_U_LINE (y); + guint16 *restrict dv = GET_V_LINE (y); + guint16 Y0, Y1, U, V; + const guint16 *restrict s = src; + + for (i = 0; i < width - 1; i += 2) { + Y0 = s[i * 4 + 1] >> 4; + Y1 = s[i * 4 + 5] >> 4; + U = s[i * 4 + 2] >> 4; + V = s[i * 4 + 3] >> 4; + + GST_WRITE_UINT16_LE (dy + i + 0, Y0); + GST_WRITE_UINT16_LE (dy + i + 1, Y1); + GST_WRITE_UINT16_LE (du + (i >> 1), U); + GST_WRITE_UINT16_LE (dv + (i >> 1), V); + } + if (i == width - 1) { + Y0 = s[i * 4 + 1] >> 4; + U = s[i * 4 + 2] >> 4; + V = s[i * 4 + 3] >> 4; + + GST_WRITE_UINT16_LE (dy + i, Y0); + GST_WRITE_UINT16_LE (du + (i >> 1), U); + GST_WRITE_UINT16_LE (dv + (i >> 1), V); + } +} + +#define PACK_I422_12BE GST_VIDEO_FORMAT_AYUV64, unpack_I422_12BE, 1, pack_I422_12BE +static void +unpack_I422_12BE (const GstVideoFormatInfo * info, GstVideoPackFlags flags, + gpointer dest, const gpointer data[GST_VIDEO_MAX_PLANES], + const gint stride[GST_VIDEO_MAX_PLANES], gint x, gint y, gint width) +{ + int i; + const guint16 *restrict sy = GET_Y_LINE (y); + const guint16 *restrict su = GET_U_LINE (y); + const guint16 *restrict sv = GET_V_LINE (y); + guint16 *restrict d = dest, Y, U, V; + + sy += x; + su += x >> 1; + sv += x >> 1; + + for (i = 0; i < width; i++) { + Y = GST_READ_UINT16_BE (sy + i) << 4; + U = GST_READ_UINT16_BE (su + (i >> 1)) << 4; + V = GST_READ_UINT16_BE (sv + (i >> 1)) << 4; + + if (!(flags & GST_VIDEO_PACK_FLAG_TRUNCATE_RANGE)) { + Y |= (Y >> 12); + U |= (U >> 12); + V |= (V >> 12); + } + + d[i * 4 + 0] = 0xffff; + d[i * 4 + 1] = Y; + d[i * 4 + 2] = U; + d[i * 4 + 3] = V; + + if (x & 1) { + x = 0; + su++; + sv++; + } + } +} + +static void +pack_I422_12BE (const GstVideoFormatInfo * info, GstVideoPackFlags flags, + const gpointer src, gint sstride, gpointer data[GST_VIDEO_MAX_PLANES], + const gint stride[GST_VIDEO_MAX_PLANES], GstVideoChromaSite chroma_site, + gint y, gint width) +{ + int i; + guint16 *restrict dy = GET_Y_LINE (y); + guint16 *restrict du = GET_U_LINE (y); + guint16 *restrict dv = GET_V_LINE (y); + guint16 Y0, Y1, U, V; + const guint16 *restrict s = src; + + for (i = 0; i < width - 1; i += 2) { + Y0 = s[i * 4 + 1] >> 4; + Y1 = s[i * 4 + 5] >> 4; + U = s[i * 4 + 2] >> 4; + V = s[i * 4 + 3] >> 4; + + GST_WRITE_UINT16_BE (dy + i + 0, Y0); + GST_WRITE_UINT16_BE (dy + i + 1, Y1); + GST_WRITE_UINT16_BE (du + (i >> 1), U); + GST_WRITE_UINT16_BE (dv + (i >> 1), V); + } + if (i == width - 1) { + Y0 = s[i * 4 + 1] >> 4; + U = s[i * 4 + 2] >> 4; + V = s[i * 4 + 3] >> 4; + + GST_WRITE_UINT16_BE (dy + i, Y0); + GST_WRITE_UINT16_BE (du + (i >> 1), U); + GST_WRITE_UINT16_BE (dv + (i >> 1), V); + } +} + #define PACK_A444_10LE GST_VIDEO_FORMAT_AYUV64, unpack_A444_10LE, 1, pack_A444_10LE static void unpack_A444_10LE (const GstVideoFormatInfo * info, GstVideoPackFlags flags, @@ -4321,6 +4813,8 @@ static const VideoFormat formats[] = { DPTH888, PSTR333, PLANE0, OFFS102, SUB444, PACK_IYU2), MAKE_YUV_FORMAT (VYUY, "raw video", GST_MAKE_FOURCC ('V', 'Y', 'U', 'Y'), DPTH888, PSTR244, PLANE0, OFFS102, SUB422, PACK_VYUY), + MAKE_RGBA_FORMAT (GBRA, "raw video", DPTH8888, PSTR1111, PLANE2013, + OFFS0, SUB4444, PACK_GBRA), MAKE_RGBA_FORMAT (GBRA_10BE, "raw video", DPTH10_10_10_10, PSTR222, PLANE2013, OFFS0, SUB4444, PACK_GBRA_10BE), MAKE_RGBA_LE_FORMAT (GBRA_10LE, "raw video", DPTH10_10_10_10, PSTR222, @@ -4334,6 +4828,18 @@ static const VideoFormat formats[] = { OFFS0, SUB4444, PACK_GBRA_12BE), MAKE_RGBA_LE_PACK_FORMAT (GBRA_12LE, "raw video", DPTH12_12_12_12, PSTR222, PLANE2013, OFFS0, SUB4444, PACK_GBRA_12LE), + MAKE_YUV_FORMAT (I420_12BE, "raw video", 0x00000000, DPTH12_12_12, + PSTR222, PLANE012, OFFS0, SUB420, PACK_I420_12BE), + MAKE_YUV_LE_FORMAT (I420_12LE, "raw video", 0x00000000, DPTH12_12_12, + PSTR222, PLANE012, OFFS0, SUB420, PACK_I420_12LE), + MAKE_YUV_FORMAT (I422_12BE, "raw video", 0x00000000, DPTH12_12_12, + PSTR222, PLANE012, OFFS0, SUB422, PACK_I422_12BE), + MAKE_YUV_LE_FORMAT (I422_12LE, "raw video", 0x00000000, DPTH12_12_12, + PSTR222, PLANE012, OFFS0, SUB422, PACK_I422_12LE), + MAKE_YUV_FORMAT (Y444_12BE, "raw video", 0x00000000, DPTH12_12_12, + PSTR222, PLANE012, OFFS0, SUB444, PACK_Y444_12BE), + MAKE_YUV_LE_FORMAT (Y444_12LE, "raw video", 0x00000000, DPTH12_12_12, + PSTR222, PLANE012, OFFS0, SUB444, PACK_Y444_12LE), }; static GstVideoFormat diff --git a/gst-libs/gst/video/video-format.h b/gst-libs/gst/video/video-format.h index fa211e2..02716a2 100644 --- a/gst-libs/gst/video/video-format.h +++ b/gst-libs/gst/video/video-format.h @@ -97,12 +97,19 @@ G_BEGIN_DECLS * @GST_VIDEO_FORMAT_A444_10LE: planar 4:4:4:4 YUV, 10 bits per channel * @GST_VIDEO_FORMAT_P010_10BE: planar 4:2:0 YUV with interleaved UV plane, 10 bits per channel * @GST_VIDEO_FORMAT_P010_10LE: planar 4:2:0 YUV with interleaved UV plane, 10 bits per channel + * @GST_VIDEO_FORMAT_GBRA: planar 4:4:4:4 ARGB, 8 bits per channel * @GST_VIDEO_FORMAT_GBRA_10BE: planar 4:4:4:4 ARGB, 10 bits per channel * @GST_VIDEO_FORMAT_GBRA_10LE: planar 4:4:4:4 ARGB, 10 bits per channel * @GST_VIDEO_FORMAT_GBR_12BE: planar 4:4:4 RGB, 12 bits per channel * @GST_VIDEO_FORMAT_GBR_12LE: planar 4:4:4 RGB, 12 bits per channel * @GST_VIDEO_FORMAT_GBRA_12BE: planar 4:4:4:4 ARGB, 12 bits per channel * @GST_VIDEO_FORMAT_GBRA_12LE: planar 4:4:4:4 ARGB, 12 bits per channel + * @GST_VIDEO_FORMAT_I420_12BE: planar 4:2:0 YUV, 12 bits per channel + * @GST_VIDEO_FORMAT_I420_12LE: planar 4:2:0 YUV, 12 bits per channel + * @GST_VIDEO_FORMAT_I422_12BE: planar 4:2:2 YUV, 12 bits per channel + * @GST_VIDEO_FORMAT_I422_12LE: planar 4:2:2 YUV, 12 bits per channel + * @GST_VIDEO_FORMAT_Y444_12BE: planar 4:4:4 YUV, 12 bits per channel + * @GST_VIDEO_FORMAT_Y444_12LE: planar 4:4:4 YUV, 12 bits per channel * * Enum value describing the most common video formats. */ @@ -172,12 +179,19 @@ typedef enum { GST_VIDEO_FORMAT_P010_10LE, GST_VIDEO_FORMAT_IYU2, GST_VIDEO_FORMAT_VYUY, + GST_VIDEO_FORMAT_GBRA, GST_VIDEO_FORMAT_GBRA_10BE, GST_VIDEO_FORMAT_GBRA_10LE, GST_VIDEO_FORMAT_GBR_12BE, GST_VIDEO_FORMAT_GBR_12LE, GST_VIDEO_FORMAT_GBRA_12BE, GST_VIDEO_FORMAT_GBRA_12LE, + GST_VIDEO_FORMAT_I420_12BE, + GST_VIDEO_FORMAT_I420_12LE, + GST_VIDEO_FORMAT_I422_12BE, + GST_VIDEO_FORMAT_I422_12LE, + GST_VIDEO_FORMAT_Y444_12BE, + GST_VIDEO_FORMAT_Y444_12LE, } GstVideoFormat; #define GST_VIDEO_MAX_PLANES 4 @@ -517,7 +531,8 @@ gconstpointer gst_video_format_get_palette (GstVideoFormat format, gsi "IYU1, ARGB64, AYUV64, r210, I420_10LE, I420_10BE, I422_10LE, I422_10BE, " \ "Y444_10LE, Y444_10BE, GBR, GBR_10LE, GBR_10BE, NV12_64Z32, A420_10LE, "\ "A420_10BE, A422_10LE, A422_10BE, A444_10LE, A444_10BE, P010_10LE, P010_10BE, "\ - "GBRA_10LE, GBRA_10BE, GBR_12LE, GBR_12BE, GBRA_12LE, GBRA_12BE }" + "GBRA, GBRA_10LE, GBRA_10BE, GBRA_12LE, GBRA_12BE, GBR_12LE, GBR_12BE, GBRA_12LE, "\ + "GBRA_12BE, I420_12LE, I420_12BE, I422_12LE, I422_12BE, Y444_12LE, Y444_12BE }" /** * GST_VIDEO_CAPS_MAKE: diff --git a/gst-libs/gst/video/video-info.c b/gst-libs/gst/video/video-info.c index 7081826..7685b0e 100644 --- a/gst-libs/gst/video/video-info.c +++ b/gst-libs/gst/video/video-info.c @@ -822,6 +822,17 @@ fill_planes (GstVideoInfo * info) info->offset[2] = info->offset[1] * 2; info->size = info->stride[0] * height * 3; break; + case GST_VIDEO_FORMAT_GBRA: + info->stride[0] = GST_ROUND_UP_4 (width); + info->stride[1] = info->stride[0]; + info->stride[2] = info->stride[0]; + info->stride[3] = info->stride[0]; + info->offset[0] = 0; + info->offset[1] = info->stride[0] * height; + info->offset[2] = info->offset[1] * 2; + info->offset[3] = info->offset[1] * 3; + info->size = info->stride[0] * height * 4; + break; case GST_VIDEO_FORMAT_NV12: case GST_VIDEO_FORMAT_NV21: info->stride[0] = GST_ROUND_UP_4 (width); @@ -877,6 +888,8 @@ fill_planes (GstVideoInfo * info) break; case GST_VIDEO_FORMAT_I420_10LE: case GST_VIDEO_FORMAT_I420_10BE: + case GST_VIDEO_FORMAT_I420_12LE: + case GST_VIDEO_FORMAT_I420_12BE: info->stride[0] = GST_ROUND_UP_4 (width * 2); info->stride[1] = GST_ROUND_UP_4 (width); info->stride[2] = info->stride[1]; @@ -890,6 +903,8 @@ fill_planes (GstVideoInfo * info) break; case GST_VIDEO_FORMAT_I422_10LE: case GST_VIDEO_FORMAT_I422_10BE: + case GST_VIDEO_FORMAT_I422_12LE: + case GST_VIDEO_FORMAT_I422_12BE: info->stride[0] = GST_ROUND_UP_4 (width * 2); info->stride[1] = GST_ROUND_UP_4 (width); info->stride[2] = info->stride[1]; @@ -901,6 +916,8 @@ fill_planes (GstVideoInfo * info) break; case GST_VIDEO_FORMAT_Y444_10LE: case GST_VIDEO_FORMAT_Y444_10BE: + case GST_VIDEO_FORMAT_Y444_12LE: + case GST_VIDEO_FORMAT_Y444_12BE: case GST_VIDEO_FORMAT_GBR_10LE: case GST_VIDEO_FORMAT_GBR_10BE: case GST_VIDEO_FORMAT_GBR_12LE: -- 2.7.4