Commit 9713d1a9 authored by gb's avatar gb

Add support for AYUV format.

parent 992df181
gst-vaapi NEWS -- summary of changes. 2010-03-23
gst-vaapi NEWS -- summary of changes. 2010-03-DD
Copyright (C) 2010 Splitted-Desktop Systems
Version 0.1.2 - DD.Mar.2010
* Add AYUV image format
Version 0.1.1 - 23.Mar.2010
* Document public API for libgstvaapi-*.so.*
* Optimize `vaapiconvert' pipeline (direct-rendering)
......
......@@ -129,6 +129,7 @@ vaapi_image_is_linear(const VAImage *va_image)
case VA_FOURCC('I','4','2','0'):
data_size = width * height + 2 * width2 * height2;
break;
case VA_FOURCC('A','Y','U','V'):
case VA_FOURCC('A','R','G','B'):
case VA_FOURCC('R','G','B','A'):
case VA_FOURCC('A','B','G','R'):
......
......@@ -60,6 +60,7 @@ static const GstVaapiImageFormatMap gst_vaapi_image_formats[] = {
DEF_YUV(NV12, ('N','V','1','2'), LSB, 12),
DEF_YUV(YV12, ('Y','V','1','2'), LSB, 12),
DEF_YUV(I420, ('I','4','2','0'), LSB, 12),
DEF_YUV(AYUV, ('A','Y','U','V'), LSB, 32),
#if G_BYTE_ORDER == G_BIG_ENDIAN
DEF_RGB(ARGB, ('A','R','G','B'), MSB, 32,
32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000),
......
......@@ -36,6 +36,8 @@ typedef enum _GstVaapiImageFormat GstVaapiImageFormat;
* planar YUV 4:2:0, 12-bit, 3 planes for Y V U
* @GST_VAAPI_IMAGE_I420:
* planar YUV 4:2:0, 12-bit, 3 planes for Y U V
* @GST_VAAPI_IMAGE_AYUV:
* packed YUV 4:4:4, 32-bit, A Y U V, native endian byte-order
* @GST_VAAPI_IMAGE_ARGB:
* packed RGB 8:8:8, 32-bit, A R G B
* @GST_VAAPI_IMAGE_RGBA:
......@@ -51,6 +53,7 @@ enum _GstVaapiImageFormat {
GST_VAAPI_IMAGE_NV12 = VA_FOURCC('N','V','1','2'),
GST_VAAPI_IMAGE_YV12 = VA_FOURCC('Y','V','1','2'),
GST_VAAPI_IMAGE_I420 = VA_FOURCC('I','4','2','0'),
GST_VAAPI_IMAGE_AYUV = VA_FOURCC('A','Y','U','V'),
GST_VAAPI_IMAGE_ARGB = VA_FOURCC('A','R','G','B'),
GST_VAAPI_IMAGE_RGBA = VA_FOURCC('R','G','B','A'),
GST_VAAPI_IMAGE_ABGR = VA_FOURCC('A','B','G','R'),
......
......@@ -179,6 +179,27 @@ static void draw_rect_YV12( // Y, U, V planes
}
}
static void draw_rect_AYUV(
guchar *pixels[3],
guint stride[3],
gint x,
gint y,
guint width,
guint height,
guint32 color
)
{
guint i, j;
color = color | 0xff000000;
for (j = 0; j < height; j++) {
guint32 *p = (guint32 *)(pixels[0] + (y + j) * stride[0] + x * 4);
for (i = 0; i < width; i++)
p[i] = color;
}
}
static gboolean draw_rgb_rects(GstVaapiImage *image)
{
GstVaapiImageFormat format = GST_VAAPI_IMAGE_FORMAT(image);
......@@ -236,6 +257,11 @@ static gboolean draw_rgb_rects(GstVaapiImage *image)
stride[1] = gst_vaapi_image_get_pitch(image, 1);
pixels[2] = gst_vaapi_image_get_plane(image, 2);
stride[2] = gst_vaapi_image_get_pitch(image, 2);
goto YUV_colors;
case GST_VAAPI_IMAGE_AYUV:
draw_rect = draw_rect_AYUV;
pixels[0] = gst_vaapi_image_get_plane(image, 0);
stride[0] = gst_vaapi_image_get_pitch(image, 0);
YUV_colors:
red_color = 0x515af0;
green_color = 0x913622;
......@@ -311,6 +337,7 @@ main(int argc, char *argv[])
GST_VAAPI_IMAGE_NV12,
GST_VAAPI_IMAGE_YV12,
GST_VAAPI_IMAGE_I420,
GST_VAAPI_IMAGE_AYUV,
GST_VAAPI_IMAGE_ARGB,
GST_VAAPI_IMAGE_BGRA,
GST_VAAPI_IMAGE_RGBA,
......
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