mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-10 17:35:59 +00:00
video: Add Y444_16LE and Y444_16BE formats
Add 16 bits planar 4:4:4 YUV formats.
This commit is contained in:
parent
2bba48c9b5
commit
90cf991337
4 changed files with 118 additions and 1 deletions
|
@ -5901,6 +5901,8 @@ get_scale_format (GstVideoFormat format, gint plane)
|
|||
case GST_VIDEO_FORMAT_NV12_10LE40:
|
||||
case GST_VIDEO_FORMAT_BGR10A2_LE:
|
||||
case GST_VIDEO_FORMAT_RGB10A2_LE:
|
||||
case GST_VIDEO_FORMAT_Y444_16BE:
|
||||
case GST_VIDEO_FORMAT_Y444_16LE:
|
||||
res = format;
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
|
|
|
@ -5398,6 +5398,110 @@ pack_rgb10a2_le (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
|
|||
}
|
||||
}
|
||||
|
||||
#define PACK_Y444_16BE GST_VIDEO_FORMAT_AYUV64, unpack_Y444_16BE, 1, pack_Y444_16BE
|
||||
static void
|
||||
unpack_Y444_16BE (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_BE (sy + i);
|
||||
U = GST_READ_UINT16_BE (su + i);
|
||||
V = GST_READ_UINT16_BE (sv + i);
|
||||
|
||||
d[i * 4 + 0] = 0xffff;
|
||||
d[i * 4 + 1] = Y;
|
||||
d[i * 4 + 2] = U;
|
||||
d[i * 4 + 3] = V;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
pack_Y444_16BE (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];
|
||||
U = s[i * 4 + 2];
|
||||
V = s[i * 4 + 3];
|
||||
|
||||
GST_WRITE_UINT16_BE (dy + i, Y);
|
||||
GST_WRITE_UINT16_BE (du + i, U);
|
||||
GST_WRITE_UINT16_BE (dv + i, V);
|
||||
}
|
||||
}
|
||||
|
||||
#define PACK_Y444_16LE GST_VIDEO_FORMAT_AYUV64, unpack_Y444_16LE, 1, pack_Y444_16LE
|
||||
static void
|
||||
unpack_Y444_16LE (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);
|
||||
U = GST_READ_UINT16_LE (su + i);
|
||||
V = GST_READ_UINT16_LE (sv + i);
|
||||
|
||||
d[i * 4 + 0] = 0xffff;
|
||||
d[i * 4 + 1] = Y;
|
||||
d[i * 4 + 2] = U;
|
||||
d[i * 4 + 3] = V;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
pack_Y444_16LE (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];
|
||||
U = s[i * 4 + 2];
|
||||
V = s[i * 4 + 3];
|
||||
|
||||
GST_WRITE_UINT16_LE (dy + i, Y);
|
||||
GST_WRITE_UINT16_LE (du + i, U);
|
||||
GST_WRITE_UINT16_LE (dv + i, V);
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
guint32 fourcc;
|
||||
|
@ -5732,6 +5836,10 @@ static const VideoFormat formats[] = {
|
|||
OFFS0, SUB4444, PACK_BGR10A2_LE),
|
||||
MAKE_RGBA_LE_PACK_FORMAT (RGB10A2_LE, "raw video", DPTH10_10_10_2, PSTR4444,
|
||||
PLANE0, OFFS0, SUB4444, PACK_RGB10A2_LE),
|
||||
MAKE_YUV_FORMAT (Y444_16BE, "raw video", 0x00000000, DPTH16_16_16,
|
||||
PSTR222, PLANE012, OFFS0, SUB444, PACK_Y444_16BE),
|
||||
MAKE_YUV_LE_FORMAT (Y444_16LE, "raw video", 0x00000000, DPTH16_16_16,
|
||||
PSTR222, PLANE012, OFFS0, SUB444, PACK_Y444_16LE),
|
||||
};
|
||||
|
||||
static GstVideoFormat
|
||||
|
|
|
@ -119,6 +119,8 @@ G_BEGIN_DECLS
|
|||
* @GST_VIDEO_FORMAT_VUYA: packed 4:4:4 YUV with alpha channel (V0-U0-Y0-A0...) (Since: 1.16)
|
||||
* @GST_VIDEO_FORMAT_BGR10A2_LE: packed 4:4:4 RGB with alpha channel(B-G-R-A), 10 bits for R/G/B channel and MSB 2 bits for alpha channel (Since: 1.16)
|
||||
* @GST_VIDEO_FORMAT_RGB10A2_LE: packed 4:4:4 RGB with alpha channel(R-G-B-A), 10 bits for R/G/B channel and MSB 2 bits for alpha channel (Since: 1.18)
|
||||
* @GST_VIDEO_FORMAT_Y444_16BE: planar 4:4:4 YUV, 16 bits per channel (Since: 1.18)
|
||||
* @GST_VIDEO_FORMAT_Y444_16LE: planar 4:4:4 YUV, 16 bits per channel (Since: 1.18)
|
||||
*
|
||||
* Enum value describing the most common video formats.
|
||||
*
|
||||
|
@ -213,6 +215,8 @@ typedef enum {
|
|||
GST_VIDEO_FORMAT_VUYA,
|
||||
GST_VIDEO_FORMAT_BGR10A2_LE,
|
||||
GST_VIDEO_FORMAT_RGB10A2_LE,
|
||||
GST_VIDEO_FORMAT_Y444_16BE,
|
||||
GST_VIDEO_FORMAT_Y444_16LE,
|
||||
} GstVideoFormat;
|
||||
|
||||
#define GST_VIDEO_MAX_PLANES 4
|
||||
|
@ -567,7 +571,8 @@ gconstpointer gst_video_format_get_palette (GstVideoFormat format, gsi
|
|||
"A420_10LE, A422_10BE, A422_10LE, A444_10BE, A444_10LE, NV61, P010_10BE, " \
|
||||
"P010_10LE, IYU2, VYUY, GBRA, GBRA_10BE, GBRA_10LE, BGR10A2_LE, RGB10A2_LE, GBR_12BE, GBR_12LE, " \
|
||||
"GBRA_12BE, GBRA_12LE, I420_12BE, I420_12LE, I422_12BE, I422_12LE, " \
|
||||
"Y444_12BE, Y444_12LE, GRAY10_LE32, NV12_10LE32, NV16_10LE32, NV12_10LE40 }"
|
||||
"Y444_12BE, Y444_12LE, GRAY10_LE32, NV12_10LE32, NV16_10LE32, NV12_10LE40, " \
|
||||
"Y444_16BE, Y444_16LE }"
|
||||
|
||||
/**
|
||||
* GST_VIDEO_CAPS_MAKE:
|
||||
|
|
|
@ -1006,6 +1006,8 @@ fill_planes (GstVideoInfo * info)
|
|||
case GST_VIDEO_FORMAT_GBR_10BE:
|
||||
case GST_VIDEO_FORMAT_GBR_12LE:
|
||||
case GST_VIDEO_FORMAT_GBR_12BE:
|
||||
case GST_VIDEO_FORMAT_Y444_16LE:
|
||||
case GST_VIDEO_FORMAT_Y444_16BE:
|
||||
info->stride[0] = GST_ROUND_UP_4 (width * 2);
|
||||
info->stride[1] = info->stride[0];
|
||||
info->stride[2] = info->stride[0];
|
||||
|
|
Loading…
Reference in a new issue