}; #define DEF(TYPE, FORMAT, CAPS_STR) \ GST_VAAPI_IMAGE_FORMAT_TYPE_##TYPE, \ GST_VAAPI_IMAGE_##FORMAT, \ CAPS_STR #define DEF_YUV(FORMAT, FOURCC, ENDIAN, BPP) \ { DEF(YCBCR, FORMAT, GST_VIDEO_CAPS_YUV(#FORMAT)), \ { VA_FOURCC FOURCC, VA_##ENDIAN##_FIRST, BPP, }, } #define DEF_RGB(FORMAT, FOURCC, ENDIAN, BPP, DEPTH, R,G,B,A) \ { DEF(RGB, FORMAT, GST_VIDEO_CAPS_##FORMAT), \ { VA_FOURCC FOURCC, VA_##ENDIAN##_FIRST, BPP, DEPTH, R,G,B,A }, } /* Image formats, listed in HW order preference */ 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), DEF_RGB(ABGR, ('A','B','G','R'), MSB, 32, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000), #elif G_BYTE_ORDER == G_LITTLE_ENDIAN DEF_RGB(BGRA, ('B','G','R','A'), LSB, 32, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000), DEF_RGB(RGBA, ('R','G','B','A'), LSB, 32, 32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000), #endif { 0, }
} GstVideoFormatMap; #define DEF_YUV(FORMAT, FOURCC, ENDIAN, BPP, SUB) \ { G_PASTE(GST_VIDEO_FORMAT_,FORMAT), \ G_PASTE(GST_VAAPI_CHROMA_TYPE_YUV,SUB), \ { VA_FOURCC FOURCC, VA_##ENDIAN##_FIRST, BPP, }, } #define DEF_RGB(FORMAT, FOURCC, ENDIAN, BPP, DEPTH, R,G,B,A) \ { G_PASTE(GST_VIDEO_FORMAT_,FORMAT), \ G_PASTE(GST_VAAPI_CHROMA_TYPE_RGB,BPP), \ { VA_FOURCC FOURCC, VA_##ENDIAN##_FIRST, BPP, DEPTH, R,G,B,A }, } /* Image formats, listed in HW order preference */ /* *INDENT-OFF* */ static const GstVideoFormatMap gst_vaapi_video_formats[] = { DEF_YUV (NV12, ('N', 'V', '1', '2'), LSB, 12, 420), DEF_YUV (YV12, ('Y', 'V', '1', '2'), LSB, 12, 420), DEF_YUV (I420, ('I', '4', '2', '0'), LSB, 12, 420), DEF_YUV (YUY2, ('Y', 'U', 'Y', '2'), LSB, 16, 422), DEF_YUV (UYVY, ('U', 'Y', 'V', 'Y'), LSB, 16, 422), DEF_YUV (AYUV, ('A', 'Y', 'U', 'V'), LSB, 32, 444), #if G_BYTE_ORDER == G_BIG_ENDIAN DEF_RGB (ARGB, ('A', 'R', 'G', 'B'), MSB, 32, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000), DEF_RGB (ABGR, ('A', 'B', 'G', 'R'), MSB, 32, 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