support H264 monochroma stream decoding
authorLi Xiaowei <xiaowei.a.li@intel.com>
Wed, 30 Jan 2013 06:21:36 +0000 (14:21 +0800)
committerWind Yuan <feng.yuan@intel.com>
Tue, 12 Mar 2013 09:01:45 +0000 (17:01 +0800)
one workaround to help YUV400 pass the chroma
type check, actually the render surface is still set to
YUV420 mandatorily and the UV components are ignored.

Signed-off-by: Li Xiaowei <xiaowei.a.li@intel.com>
gst-libs/gst/vaapi/gstvaapidecoder_h264.c
gst-libs/gst/vaapi/gstvaapisurface.c
gst-libs/gst/vaapi/gstvaapisurface.h

index 0601731..64413c1 100755 (executable)
@@ -972,6 +972,9 @@ h264_get_chroma_type(GstH264SPS *sps)
     guint chroma_type = 0;
 
     switch (sps->chroma_format_idc) {
+    case 0:
+        chroma_type = GST_VAAPI_CHROMA_TYPE_YUV400;
+        break;
     case 1:
         chroma_type = GST_VAAPI_CHROMA_TYPE_YUV420;
         break;
@@ -1043,7 +1046,8 @@ ensure_context(GstVaapiDecoderH264 *decoder, GstH264SPS *sps)
     }
 
     chroma_type = h264_get_chroma_type(sps);
-    if (!chroma_type || chroma_type != GST_VAAPI_CHROMA_TYPE_YUV420) {
+    if (chroma_type != GST_VAAPI_CHROMA_TYPE_YUV400 && 
+        chroma_type != GST_VAAPI_CHROMA_TYPE_YUV420) {
         GST_ERROR("unsupported chroma_format_idc %u", sps->chroma_format_idc);
         return GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CHROMA_FORMAT;
     }
index 965912c..05202f7 100755 (executable)
@@ -146,6 +146,11 @@ gst_vaapi_surface_create(GstVaapiSurface *surface)
         break;
     case 0:
         switch (priv->chroma_type) {
+#if VA_CHECK_VERSION(0,34,0)
+        case GST_VAAPI_CHROMA_TYPE_YUV400:
+            format = VA_RT_FORMAT_YUV400;
+            break;
+#endif
         case GST_VAAPI_CHROMA_TYPE_YUV420:
             format = VA_RT_FORMAT_YUV420;
             break;
index 0e4f114..b286029 100755 (executable)
@@ -53,6 +53,7 @@ G_BEGIN_DECLS
 
 /**
  * GstVaapiChromaType:
+ * @GST_VAAPI_CHROMA_TYPE_YUV400: 4:0:0 chroma format
  * @GST_VAAPI_CHROMA_TYPE_YUV420: 4:2:0 chroma format
  * @GST_VAAPI_CHROMA_TYPE_YUV422: 4:2:2 chroma format
  * @GST_VAAPI_CHROMA_TYPE_YUV444: 4:4:4 chroma format
@@ -60,7 +61,8 @@ G_BEGIN_DECLS
  * The set of all chroma types for #GstVaapiSurface.
  */
 typedef enum {
-    GST_VAAPI_CHROMA_TYPE_YUV420 = 1,
+    GST_VAAPI_CHROMA_TYPE_YUV400,
+    GST_VAAPI_CHROMA_TYPE_YUV420,
     GST_VAAPI_CHROMA_TYPE_YUV422,
     GST_VAAPI_CHROMA_TYPE_YUV444
 } GstVaapiChromaType;