Add 10 HEVC 10 bit decoding support
authorSreerenj Balachandran <sreerenj.balachandran@intel.com>
Tue, 8 Dec 2015 14:14:11 +0000 (16:14 +0200)
committerSreerenj Balachandran <sreerenj.balachandran@intel.com>
Tue, 8 Dec 2015 14:14:11 +0000 (16:14 +0200)
Only supporting vaapidecode ! vaapisink combination for now.

Missing dependencies:
1: No support for P010 video format in GStreamer
2: No support for P010 vaGetImage()/vaPutimage() in vaapi-intel-driver
3: As a result of 1&2 , we have no support for Vaapi Video memory mapping
   through GstVideoMeta.

Right now we only set chroma format (YUV420 with more than 8 bits per channel)
for surface pool and keeping GST_VIDEO_FORMAT as ENCODED. The underlying format
of the surfaces is implementation (driver) defined, which is P010.

gst-libs/gst/vaapi/gstvaapicontext.c
gst-libs/gst/vaapi/gstvaapidecoder_h265.c
gst-libs/gst/vaapi/gstvaapiutils_h265.c
gst-libs/gst/vaapi/gstvaapiutils_h265_priv.h

index 113c960..36fc18a 100644 (file)
@@ -149,8 +149,9 @@ context_create_surfaces (GstVaapiContext * context)
 
   if (!context->surfaces_pool) {
     context->surfaces_pool =
-        gst_vaapi_surface_pool_new (GST_VAAPI_OBJECT_DISPLAY (context),
-        GST_VIDEO_FORMAT_ENCODED, cip->width, cip->height);
+        gst_vaapi_surface_pool_new_with_chroma_type (GST_VAAPI_OBJECT_DISPLAY (context),
+        cip->chroma_type, cip->width, cip->height);
+
     if (!context->surfaces_pool)
       return FALSE;
   }
index c308d27..26b8a4a 100644 (file)
@@ -1102,7 +1102,7 @@ ensure_context (GstVaapiDecoderH265 * decoder, GstH265SPS * sps)
     priv->profile = profile;
   }
 
-  chroma_type = gst_vaapi_utils_h265_get_chroma_type (sps->chroma_format_idc);
+  chroma_type = gst_vaapi_utils_h265_get_chroma_type (sps->chroma_format_idc, sps->bit_depth_luma_minus8 + 8);
   if (!chroma_type) {
     GST_ERROR ("unsupported chroma_format_idc %u", sps->chroma_format_idc);
     return GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CHROMA_FORMAT;
index 0a80d3d..5eebf9b 100644 (file)
@@ -281,16 +281,19 @@ gst_vaapi_utils_h265_get_level_limits_table (guint * out_length_ptr)
 
 /** Returns GstVaapiChromaType from H.265 chroma_format_idc value */
 GstVaapiChromaType
-gst_vaapi_utils_h265_get_chroma_type (guint chroma_format_idc)
+gst_vaapi_utils_h265_get_chroma_type (guint chroma_format_idc, guint luma_bit_depth)
 {
-  GstVaapiChromaType chroma_type;
+  GstVaapiChromaType chroma_type = (GstVaapiChromaType) 0;
 
   switch (chroma_format_idc) {
     case 0:
       chroma_type = GST_VAAPI_CHROMA_TYPE_YUV400;
       break;
     case 1:
-      chroma_type = GST_VAAPI_CHROMA_TYPE_YUV420;
+      if (luma_bit_depth == 8)
+        chroma_type = GST_VAAPI_CHROMA_TYPE_YUV420;
+      else if (luma_bit_depth > 8)
+        chroma_type = GST_VAAPI_CHROMA_TYPE_YUV420_10BPP;
       break;
     case 2:
       chroma_type = GST_VAAPI_CHROMA_TYPE_YUV422;
@@ -317,6 +320,7 @@ gst_vaapi_utils_h265_get_chroma_format_idc (GstVaapiChromaType chroma_type)
       chroma_format_idc = 0;
       break;
     case GST_VAAPI_CHROMA_TYPE_YUV420:
+    case GST_VAAPI_CHROMA_TYPE_YUV420_10BPP:
       chroma_format_idc = 1;
       break;
     case GST_VAAPI_CHROMA_TYPE_YUV422:
index 3991ee9..5e9f532 100644 (file)
@@ -93,7 +93,7 @@ gst_vaapi_utils_h265_get_level_limits_table (guint * out_length_ptr);
 /* Returns GstVaapiChromaType from H.265 chroma_format_idc value */
 G_GNUC_INTERNAL
 GstVaapiChromaType
-gst_vaapi_utils_h265_get_chroma_type (guint chroma_format_idc);
+gst_vaapi_utils_h265_get_chroma_type (guint chroma_format_idc, guint luma_bit_depth);
 
 /* Returns H.265 chroma_format_idc value from GstVaapiChromaType */
 G_GNUC_INTERNAL