Commit 92b685eb authored by Sebastian Dröge's avatar Sebastian Dröge
Browse files

video: Add support for NV24 color format

This is semi-planar 4:4:4 YUV.

https://bugzilla.gnome.org/show_bug.cgi?id=703259
parent 4cfda001
......@@ -939,6 +939,26 @@ pack_NV16 (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
GET_PLANE_LINE (1, y), src, width / 2);
}
#define PACK_NV24 GST_VIDEO_FORMAT_AYUV, unpack_NV24, 1, pack_NV24
static void
unpack_NV24 (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)
{
video_orc_unpack_NV12 (dest,
GET_PLANE_LINE (0, y), GET_PLANE_LINE (1, y), width);
}
static void
pack_NV24 (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)
{
video_orc_pack_NV12 (GET_PLANE_LINE (0, y),
GET_PLANE_LINE (1, y), src, width);
}
#define PACK_UYVP GST_VIDEO_FORMAT_AYUV64, unpack_UYVP, 1, pack_UYVP
static void
unpack_UYVP (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
......@@ -2034,9 +2054,10 @@ static VideoFormat formats[] = {
MAKE_RGB_LE_FORMAT (GBR_10LE, "raw video", DPTH10_10_10, PSTR222, PLANE201,
OFFS0, SUB444,
PACK_GBR_10LE),
MAKE_YUV_FORMAT (NV16, "raw video", GST_MAKE_FOURCC ('N', 'V', '1', '6'),
DPTH888, PSTR111, PLANE011, OFFS001, SUB422, PACK_NV16),
MAKE_YUV_FORMAT (NV24, "raw video", GST_MAKE_FOURCC ('N', 'V', '2', '4'),
DPTH888, PSTR111, PLANE011, OFFS001, SUB444, PACK_NV24),
};
static GstVideoFormat
......@@ -2241,6 +2262,8 @@ gst_video_format_from_fourcc (guint32 fourcc)
return GST_VIDEO_FORMAT_NV21;
case GST_MAKE_FOURCC ('N', 'V', '1', '6'):
return GST_VIDEO_FORMAT_NV16;
case GST_MAKE_FOURCC ('N', 'V', '2', '4'):
return GST_VIDEO_FORMAT_NV24;
case GST_MAKE_FOURCC ('v', '3', '0', '8'):
return GST_VIDEO_FORMAT_v308;
case GST_MAKE_FOURCC ('Y', '8', '0', '0'):
......
......@@ -80,6 +80,7 @@ G_BEGIN_DECLS
* @GST_VIDEO_FORMAT_GBR_10BE: planar 4:4:4 RGB, 10 bits per channel
* @GST_VIDEO_FORMAT_GBR_10LE: planar 4:4:4 RGB, 10 bits per channel
* @GST_VIDEO_FORMAT_NV16: planar 4:2:2 YUV with interleaved UV plane
* @GST_VIDEO_FORMAT_NV24: planar 4:4:4 YUV with interleaved UV plane
*
* Enum value describing the most common video formats.
*/
......@@ -136,6 +137,7 @@ typedef enum {
GST_VIDEO_FORMAT_GBR_10BE,
GST_VIDEO_FORMAT_GBR_10LE,
GST_VIDEO_FORMAT_NV16,
GST_VIDEO_FORMAT_NV24,
} GstVideoFormat;
#define GST_VIDEO_MAX_PLANES 4
......@@ -432,7 +434,7 @@ gconstpointer gst_video_format_get_palette (GstVideoFormat format, gsi
#define GST_VIDEO_FORMATS_ALL "{ I420, YV12, YUY2, UYVY, AYUV, RGBx, " \
"BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, " \
"YVYU, Y444, v210, v216, NV12, NV21, NV16, GRAY8, GRAY16_BE, GRAY16_LE, " \
"YVYU, Y444, v210, v216, NV12, NV21, NV16, NV24, GRAY8, GRAY16_BE, GRAY16_LE, " \
"v308, RGB16, BGR16, RGB15, BGR15, UYVP, A420, RGB8P, YUV9, YVU9, " \
"IYU1, ARGB64, AYUV64, r210, I420_10LE, I420_10BE, I422_10LE, I422_10BE, " \
" Y444_10LE, Y444_10BE, GBR, GBR_10LE, GBR_10BE }"
......
......@@ -502,6 +502,13 @@ fill_planes (GstVideoInfo * info)
info->offset[1] = info->stride[0] * height;
info->size = info->stride[0] * height * 2;
break;
case GST_VIDEO_FORMAT_NV24:
info->stride[0] = GST_ROUND_UP_4 (width);
info->stride[1] = GST_ROUND_UP_4 (width * 2);
info->offset[0] = 0;
info->offset[1] = info->stride[0] * height;
info->size = info->stride[0] * height + info->stride[1] * height;
break;
case GST_VIDEO_FORMAT_A420:
info->stride[0] = GST_ROUND_UP_4 (width);
info->stride[1] = GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment