va: Improve the default mapping between rt_format and video format.
authorHe Junyan <junyan.he@intel.com>
Wed, 16 Jun 2021 08:56:14 +0000 (16:56 +0800)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Wed, 16 Jun 2021 14:12:59 +0000 (14:12 +0000)
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>

sys/va/gstvabasedec.c

index 028e0cf0ae11e52c1a1d05b8e253b9818e8345ad..f62ac281d5d6a883c96ec89054c697186df0e258 100644 (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:
+      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_P010_10LE;
+      return GST_VIDEO_FORMAT_Y410;
+    case VA_RT_FORMAT_YUV444_12:
+      return GST_VIDEO_FORMAT_Y412_LE;
     default:
       return GST_VIDEO_FORMAT_UNKNOWN;
   }