We are currently experiencing downtime impacting viewing & cloning the Mesa repo, and some GitLab pages returning 503. Please see #freedesktop on IRC for more updates.

Commit cc0bcd58 authored by wangfei's avatar wangfei Committed by Nicolas Dufresne

video: add Y210 pixel format.

This pixel format is packed format with 4:2:2 sample and 10
available bits of each channel.

https://bugzilla.gnome.org/show_bug.cgi?id=797267
parent 3c8ac7de
......@@ -5850,6 +5850,7 @@ get_scale_format (GstVideoFormat format, gint plane)
case GST_VIDEO_FORMAT_ENCODED:
case GST_VIDEO_FORMAT_v210:
case GST_VIDEO_FORMAT_v216:
case GST_VIDEO_FORMAT_Y210:
case GST_VIDEO_FORMAT_UYVP:
case GST_VIDEO_FORMAT_RGB8P:
case GST_VIDEO_FORMAT_IYU1:
......
......@@ -784,6 +784,68 @@ pack_v216 (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
}
}
#define PACK_Y210 GST_VIDEO_FORMAT_AYUV64, unpack_Y210, 1, pack_Y210
static void
unpack_Y210 (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 *restrict s = GET_LINE (y);
guint16 *restrict d = dest;
guint Y0, Y1, U, V;
for (i = 0; i < width / 2; i++) {
Y0 = GST_READ_UINT16_LE (s + i * 8 + 0);
U = GST_READ_UINT16_LE (s + i * 8 + 2);
V = GST_READ_UINT16_LE (s + i * 8 + 6);
Y1 = GST_READ_UINT16_LE (s + i * 8 + 4);
if (!(flags & GST_VIDEO_PACK_FLAG_TRUNCATE_RANGE)) {
Y0 |= (Y0 >> 10);
U |= (U >> 10);
V |= (V >> 10);
}
d[i * 8 + 0] = 0xffff;
d[i * 8 + 1] = Y0;
d[i * 8 + 2] = U;
d[i * 8 + 3] = V;
d[i * 8 + 4] = 0xffff;
d[i * 8 + 5] = Y1;
d[i * 8 + 6] = U;
d[i * 8 + 7] = V;
}
}
static void
pack_Y210 (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 Y0, Y1, U, V;
guint8 *restrict d = GET_LINE (y);
const guint16 *restrict s = src;
for (i = 0; i < width; i += 2) {
Y0 = s[i * 4 + 1] & 0xffc0;
U = s[i * 4 + 2] & 0xffc0;
V = s[i * 4 + 3] & 0xffc0;
if (i == width - 1)
Y1 = s[i * 4 + 1] & 0xffc0;
else
Y1 = s[(i + 1) * 4 + 1] & 0xffc0;
GST_WRITE_UINT16_LE (d + i * 4 + 0, Y0);
GST_WRITE_UINT16_LE (d + i * 4 + 2, U);
GST_WRITE_UINT16_LE (d + i * 4 + 4, Y1);
GST_WRITE_UINT16_LE (d + i * 4 + 6, V);
}
}
#define PACK_Y41B GST_VIDEO_FORMAT_AYUV, unpack_Y41B, 1, pack_Y41B
static void
unpack_Y41B (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
......@@ -5266,6 +5328,8 @@ static const VideoFormat formats[] = {
DPTH10_10_10, PSTR0, PLANE0, OFFS0, SUB422, PACK_v210),
MAKE_YUV_FORMAT (v216, "raw video", GST_MAKE_FOURCC ('v', '2', '1', '6'),
DPTH16_16_16, PSTR488, PLANE0, OFFS204, SUB422, PACK_v216),
MAKE_YUV_FORMAT (Y210, "raw video", GST_MAKE_FOURCC ('Y', '2', '1', '0'),
DPTH10_10_10, PSTR488, PLANE0, OFFS0, SUB422, PACK_Y210),
MAKE_YUV_FORMAT (NV12, "raw video", GST_MAKE_FOURCC ('N', 'V', '1', '2'),
DPTH888, PSTR122, PLANE011, OFFS001, SUB420, PACK_NV12),
MAKE_YUV_FORMAT (NV21, "raw video", GST_MAKE_FOURCC ('N', 'V', '2', '1'),
......@@ -5612,6 +5676,8 @@ gst_video_format_from_fourcc (guint32 fourcc)
return GST_VIDEO_FORMAT_v210;
case GST_MAKE_FOURCC ('v', '2', '1', '6'):
return GST_VIDEO_FORMAT_v216;
case GST_MAKE_FOURCC ('Y', '2', '1', '0'):
return GST_VIDEO_FORMAT_Y210;
case GST_MAKE_FOURCC ('N', 'V', '1', '2'):
return GST_VIDEO_FORMAT_NV12;
case GST_MAKE_FOURCC ('N', 'V', '2', '1'):
......
......@@ -141,6 +141,7 @@ typedef enum {
GST_VIDEO_FORMAT_Y444,
GST_VIDEO_FORMAT_v210,
GST_VIDEO_FORMAT_v216,
GST_VIDEO_FORMAT_Y210,
GST_VIDEO_FORMAT_NV12,
GST_VIDEO_FORMAT_NV21,
GST_VIDEO_FORMAT_GRAY8,
......@@ -544,7 +545,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, GRAY8, GRAY16_BE, GRAY16_LE, v308, RGB16, " \
"Y444, v210, v216, Y210, NV12, NV21, GRAY8, GRAY16_BE, GRAY16_LE, v308, RGB16, " \
"BGR16, RGB15, BGR15, UYVP, A420, RGB8P, YUV9, YVU9, IYU1, ARGB64, " \
"AYUV64, r210, I420_10BE, I420_10LE, I422_10BE, I422_10LE, Y444_10BE, " \
"Y444_10LE, GBR, GBR_10BE, GBR_10LE, NV16, NV24, NV12_64Z32, A420_10BE, " \
......
......@@ -788,6 +788,7 @@ fill_planes (GstVideoInfo * info)
info->size = info->stride[0] * height;
break;
case GST_VIDEO_FORMAT_v216:
case GST_VIDEO_FORMAT_Y210:
info->stride[0] = GST_ROUND_UP_8 (width * 4);
info->offset[0] = 0;
info->size = info->stride[0] * height;
......
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