Add more video formats.

Add new video format mappings to VA image formats:
- YUV: packed YUV (YUY2, UYVY), grayscale (Y800) ;
- RGB: 32-bit RGB without alpha channel (XRGB, XBGR, RGBX, BGRX).
This commit is contained in:
Gwenole Beauchesne 2013-07-09 18:03:36 +02:00
parent d469b7274c
commit 97c0316fe4
2 changed files with 24 additions and 1 deletions

View file

@ -105,15 +105,27 @@ vaapi_image_is_linear(const VAImage *va_image)
case VA_FOURCC('I','4','2','0'): case VA_FOURCC('I','4','2','0'):
data_size = width * height + 2 * width2 * height2; data_size = width * height + 2 * width2 * height2;
break; break;
case VA_FOURCC('Y','U','Y','2'):
case VA_FOURCC('U','Y','V','Y'):
data_size = 2 * width * height;
break;
case VA_FOURCC('Y','8','0','0'):
data_size = width * height;
break;
case VA_FOURCC('A','Y','U','V'): case VA_FOURCC('A','Y','U','V'):
case VA_FOURCC('A','R','G','B'): case VA_FOURCC('A','R','G','B'):
case VA_FOURCC('R','G','B','A'): case VA_FOURCC('R','G','B','A'):
case VA_FOURCC('A','B','G','R'): case VA_FOURCC('A','B','G','R'):
case VA_FOURCC('B','G','R','A'): case VA_FOURCC('B','G','R','A'):
case VA_FOURCC('X','R','G','B'):
case VA_FOURCC('R','G','B','X'):
case VA_FOURCC('X','B','G','R'):
case VA_FOURCC('B','G','R','X'):
data_size = 4 * width * height; data_size = 4 * width * height;
break; break;
default: default:
g_error("FIXME: incomplete formats"); g_error("FIXME: incomplete formats %" GST_FOURCC_FORMAT,
GST_FOURCC_ARGS(va_image->format.fourcc));
break; break;
} }
return va_image->data_size == data_size; return va_image->data_size == data_size;

View file

@ -63,18 +63,29 @@ static const GstVideoFormatMap gst_video_formats[] = {
DEF_YUV(NV12, ('N','V','1','2'), LSB, 12), DEF_YUV(NV12, ('N','V','1','2'), LSB, 12),
DEF_YUV(YV12, ('Y','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(I420, ('I','4','2','0'), LSB, 12),
DEF_YUV(YUY2, ('Y','U','Y','2'), LSB, 16),
DEF_YUV(UYVY, ('U','Y','V','Y'), LSB, 16),
DEF_YUV(AYUV, ('A','Y','U','V'), LSB, 32), DEF_YUV(AYUV, ('A','Y','U','V'), LSB, 32),
#if G_BYTE_ORDER == G_BIG_ENDIAN #if G_BYTE_ORDER == G_BIG_ENDIAN
DEF_RGB(ARGB, ('A','R','G','B'), MSB, 32, DEF_RGB(ARGB, ('A','R','G','B'), MSB, 32,
32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000), 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000),
DEF_RGB(ABGR, ('A','B','G','R'), MSB, 32, DEF_RGB(ABGR, ('A','B','G','R'), MSB, 32,
32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000), 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000),
DEF_RGB(xRGB, ('X','R','G','B'), MSB, 32,
24, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000),
DEF_RGB(xBGR, ('X','B','G','R'), MSB, 32,
24, 0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000),
#elif G_BYTE_ORDER == G_LITTLE_ENDIAN #elif G_BYTE_ORDER == G_LITTLE_ENDIAN
DEF_RGB(BGRA, ('B','G','R','A'), LSB, 32, DEF_RGB(BGRA, ('B','G','R','A'), LSB, 32,
32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000), 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000),
DEF_RGB(RGBA, ('R','G','B','A'), LSB, 32, DEF_RGB(RGBA, ('R','G','B','A'), LSB, 32,
32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000), 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000),
DEF_RGB(BGRx, ('B','G','R','X'), LSB, 32,
24, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000),
DEF_RGB(RGBx, ('R','G','B','X'), LSB, 32,
24, 0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000),
#endif #endif
DEF_YUV(GRAY8, ('Y','8','0','0'), LSB, 8),
{ 0, } { 0, }
}; };