diff --git a/gst-libs/gst/vaapi/gstvaapicontext.c b/gst-libs/gst/vaapi/gstvaapicontext.c index 113c960f9e..36fc18af3a 100644 --- a/gst-libs/gst/vaapi/gstvaapicontext.c +++ b/gst-libs/gst/vaapi/gstvaapicontext.c @@ -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; } diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_h265.c b/gst-libs/gst/vaapi/gstvaapidecoder_h265.c index c308d27899..26b8a4a625 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_h265.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_h265.c @@ -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; diff --git a/gst-libs/gst/vaapi/gstvaapiutils_h265.c b/gst-libs/gst/vaapi/gstvaapiutils_h265.c index 0a80d3db7d..5eebf9b2c0 100644 --- a/gst-libs/gst/vaapi/gstvaapiutils_h265.c +++ b/gst-libs/gst/vaapi/gstvaapiutils_h265.c @@ -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: diff --git a/gst-libs/gst/vaapi/gstvaapiutils_h265_priv.h b/gst-libs/gst/vaapi/gstvaapiutils_h265_priv.h index 3991ee96a4..5e9f53211d 100644 --- a/gst-libs/gst/vaapi/gstvaapiutils_h265_priv.h +++ b/gst-libs/gst/vaapi/gstvaapiutils_h265_priv.h @@ -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