mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
video: add NV16 format
This format is usually used by hardware video decoders for 4:2:2 sampling https://bugzilla.gnome.org/show_bug.cgi?id=700377
This commit is contained in:
parent
74a31a02fc
commit
af24e23880
4 changed files with 59 additions and 1 deletions
|
@ -921,6 +921,26 @@ pack_NV21 (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
|
|||
GET_PLANE_LINE (1, uv), src, width / 2);
|
||||
}
|
||||
|
||||
#define PACK_NV16 GST_VIDEO_FORMAT_AYUV, unpack_NV16, 1, pack_NV16
|
||||
static void
|
||||
unpack_NV16 (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_NV16 (dest,
|
||||
GET_PLANE_LINE (0, y), GET_PLANE_LINE (1, y), width);
|
||||
}
|
||||
|
||||
static void
|
||||
pack_NV16 (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_NV16 (GET_PLANE_LINE (0, y),
|
||||
GET_PLANE_LINE (1, y), src, width / 2);
|
||||
}
|
||||
|
||||
#define PACK_UYVP GST_VIDEO_FORMAT_AYUV64, unpack_UYVP, 1, pack_UYVP
|
||||
static void
|
||||
unpack_UYVP (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
|
||||
|
@ -2020,6 +2040,9 @@ 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),
|
||||
};
|
||||
|
||||
static GstVideoFormat
|
||||
|
@ -2221,6 +2244,8 @@ gst_video_format_from_fourcc (guint32 fourcc)
|
|||
return GST_VIDEO_FORMAT_NV12;
|
||||
case GST_MAKE_FOURCC ('N', 'V', '2', '1'):
|
||||
return GST_VIDEO_FORMAT_NV21;
|
||||
case GST_MAKE_FOURCC ('N', 'V', '1', '6'):
|
||||
return GST_VIDEO_FORMAT_NV16;
|
||||
case GST_MAKE_FOURCC ('v', '3', '0', '8'):
|
||||
return GST_VIDEO_FORMAT_v308;
|
||||
case GST_MAKE_FOURCC ('Y', '8', '0', '0'):
|
||||
|
|
|
@ -79,6 +79,7 @@ G_BEGIN_DECLS
|
|||
* @GST_VIDEO_FORMAT_GBR: planar 4:4:4 RGB, 8 bits per channel
|
||||
* @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
|
||||
*
|
||||
* Enum value describing the most common video formats.
|
||||
*/
|
||||
|
@ -134,6 +135,7 @@ typedef enum {
|
|||
GST_VIDEO_FORMAT_GBR,
|
||||
GST_VIDEO_FORMAT_GBR_10BE,
|
||||
GST_VIDEO_FORMAT_GBR_10LE,
|
||||
GST_VIDEO_FORMAT_NV16,
|
||||
} GstVideoFormat;
|
||||
|
||||
#define GST_VIDEO_MAX_PLANES 4
|
||||
|
@ -451,7 +453,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, " \
|
||||
"YVYU, Y444, v210, v216, NV12, NV21, NV16, 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 }"
|
||||
|
|
|
@ -495,6 +495,13 @@ fill_planes (GstVideoInfo * info)
|
|||
info->offset[1] = info->stride[0] * GST_ROUND_UP_2 (height);
|
||||
info->size = info->stride[0] * GST_ROUND_UP_2 (height) * 3 / 2;
|
||||
break;
|
||||
case GST_VIDEO_FORMAT_NV16:
|
||||
info->stride[0] = GST_ROUND_UP_4 (width);
|
||||
info->stride[1] = info->stride[0];
|
||||
info->offset[0] = 0;
|
||||
info->offset[1] = info->stride[0] * height;
|
||||
info->size = info->stride[0] * height * 2;
|
||||
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);
|
||||
|
|
|
@ -440,6 +440,30 @@ x2 avgub uv, uv1, uv2
|
|||
swapw vu, uv
|
||||
|
||||
|
||||
.function video_orc_unpack_NV16
|
||||
.dest 4 d guint8
|
||||
.source 1 y guint8
|
||||
.source 2 uv guint8
|
||||
.const 1 c255 255
|
||||
.temp 2 ay
|
||||
.temp 2 tuv
|
||||
|
||||
x2 loadupdb tuv, uv
|
||||
mergebw ay, c255, y
|
||||
mergewl d, ay, tuv
|
||||
|
||||
.function video_orc_pack_NV16
|
||||
.dest 2 y guint8
|
||||
.dest 2 uv guint8
|
||||
.source 8 ayuv guint8
|
||||
.temp 4 ay
|
||||
.temp 4 tuv
|
||||
|
||||
x2 splitlw tuv, ay, ayuv
|
||||
x2 select1wb y, ay
|
||||
select0lw uv, tuv
|
||||
|
||||
|
||||
.function video_orc_unpack_A420
|
||||
.dest 4 d guint8
|
||||
.source 1 y guint8
|
||||
|
|
Loading…
Reference in a new issue