va: Improve the default mapping between rt_format and video format.

We add 12 bits entries into this default mapping. And the old mapping
is not precise. For example, the NV12 should not be used as the default
mapping for VA_RT_FORMAT_YUV422 and VA_RT_FORMAT_YUV444, it is even not
a 422 or 444 format.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2332>
This commit is contained in:
He Junyan 2021-06-16 16:56:14 +08:00 committed by GStreamer Marge Bot
parent 0849583210
commit 8d7e6bfb86

View file

@ -466,14 +466,27 @@ static GstVideoFormat
_default_video_format_from_chroma (guint chroma_type)
{
switch (chroma_type) {
/* 4:2:0 */
case VA_RT_FORMAT_YUV420:
case VA_RT_FORMAT_YUV422:
case VA_RT_FORMAT_YUV444:
return GST_VIDEO_FORMAT_NV12;
case VA_RT_FORMAT_YUV420_10:
case VA_RT_FORMAT_YUV422_10:
case VA_RT_FORMAT_YUV444_10:
return GST_VIDEO_FORMAT_P010_10LE;
case VA_RT_FORMAT_YUV420_12:
return GST_VIDEO_FORMAT_P012_LE;
/* 4:2:2 */
case VA_RT_FORMAT_YUV422:
return GST_VIDEO_FORMAT_UYVY;
case VA_RT_FORMAT_YUV422_10:
return GST_VIDEO_FORMAT_Y210;
case VA_RT_FORMAT_YUV422_12:
return GST_VIDEO_FORMAT_Y212_LE;
/* 4:4:4 */
case VA_RT_FORMAT_YUV444:
return GST_VIDEO_FORMAT_VUYA;
case VA_RT_FORMAT_YUV444_10:
return GST_VIDEO_FORMAT_Y410;
case VA_RT_FORMAT_YUV444_12:
return GST_VIDEO_FORMAT_Y412_LE;
default:
return GST_VIDEO_FORMAT_UNKNOWN;
}