Add main-422-10 profile which support 422 chroma format stream.
Currently, this feature is only supported by media-driver in Icelake.
https://bugzilla.gnome.org/show_bug.cgi?id=797143
GstVaapiProfile profile, profiles[3];
guint i, n_profiles = 0;
- profile =
- gst_vaapi_utils_h265_get_profile (sps->profile_tier_level.profile_idc);
+ profile = gst_vaapi_utils_h265_get_profile (sps);
if (!profile) {
/* HACK: This is a work-around to identify some main profile streams having wrong profile_idc.
* There are some wrongly encoded main profile streams(eg: ENTP_C_LG_3.bin) which doesn't
{GST_VAAPI_PROFILE_H265_MAIN10, VAProfileHEVCMain10,
"video/x-h265", "main-10"},
#endif
+#if VA_CHECK_VERSION(1,2,0)
+ {GST_VAAPI_PROFILE_H265_MAIN_422_10, VAProfileHEVCMain422_10,
+ "video/x-h265", "main-422-10"},
+#endif
#if VA_CHECK_VERSION(0,38,0)
{GST_VAAPI_PROFILE_VP9_0, VAProfileVP9Profile0,
"video/x-vp9", "profile0"},
return GST_VAAPI_PROFILE_H265_MAIN10;
case 3:
return GST_VAAPI_PROFILE_H265_MAIN_STILL_PICTURE;
+ case 4:
+ return GST_VAAPI_PROFILE_H265_MAIN_422_10;
}
return 0;
}
* H.265 main 10 profile [A.3.3]
* @GST_VAAPI_PROFILE_H265_MAIN_STILL_PICTURE:
* H.265 main still picture profile [A.3.4]
+ * @GST_VAAPI_PROFILE_H265_MAIN_422_10:
+ * H.265 main still picture profile [A.3.5]
* @GST_VAAPI_PROFILE_VP9_0:
* VP9 prfile 0, bitdepth=8, 420
* @GST_VAAPI_PROFILE_VP9_1:
GST_VAAPI_PROFILE_H265_MAIN10 = GST_VAAPI_MAKE_PROFILE(H265,2),
GST_VAAPI_PROFILE_H265_MAIN_STILL_PICTURE =
GST_VAAPI_MAKE_PROFILE(H265,3),
+ GST_VAAPI_PROFILE_H265_MAIN_422_10 = GST_VAAPI_MAKE_PROFILE(H265,4),
GST_VAAPI_PROFILE_VP9_0 = GST_VAAPI_MAKE_PROFILE(VP9,1),
GST_VAAPI_PROFILE_VP9_1 = GST_VAAPI_MAKE_PROFILE(VP9,2),
GST_VAAPI_PROFILE_VP9_2 = GST_VAAPI_MAKE_PROFILE(VP9,3),
if (!surface)
return NULL;
+ /* first try a recent version of vaCreateSurface, and later use as
+ * fallback its old version */
+#if VA_CHECK_VERSION(0,34,0)
+ {
+ GstVideoInfo vi;
+ GstVideoFormat surface_format;
+
+ surface_format = gst_vaapi_video_format_from_chroma (chroma_type);
+ gst_video_info_set_format (&vi, surface_format, width, height);
+
+ if (gst_vaapi_surface_create_full (surface, &vi, 0))
+ return surface;
+ }
+#endif
if (!gst_vaapi_surface_create (surface, chroma_type, width, height))
goto error;
return surface;
MAP (H264MultiviewHigh);
MAP (H264StereoHigh);
#endif
+#if VA_CHECK_VERSION(1,2,0)
+ MAP (HEVCMain422_10);
+#endif
#if VA_CHECK_VERSION(0,37,1)
MAP (HEVCMain);
MAP (HEVCMain10);
/** Returns GstVaapiProfile from H.265 profile_idc value */
GstVaapiProfile
-gst_vaapi_utils_h265_get_profile (guint8 profile_idc)
+gst_vaapi_utils_h265_get_profile (GstH265SPS * sps)
{
GstVaapiProfile profile;
- switch (profile_idc) {
+ switch (sps->profile_tier_level.profile_idc) {
case GST_H265_PROFILE_IDC_MAIN:
profile = GST_VAAPI_PROFILE_H265_MAIN;
break;
case GST_H265_PROFILE_IDC_MAIN_STILL_PICTURE:
profile = GST_VAAPI_PROFILE_H265_MAIN_STILL_PICTURE;
break;
+ case GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION:
+ if (sps->profile_tier_level.max_12bit_constraint_flag == 1
+ && sps->profile_tier_level.max_10bit_constraint_flag == 1
+ && sps->profile_tier_level.max_8bit_constraint_flag == 0
+ && sps->profile_tier_level.max_422chroma_constraint_flag == 1
+ && sps->profile_tier_level.max_420chroma_constraint_flag == 0
+ && sps->profile_tier_level.max_monochrome_constraint_flag == 0
+ && sps->profile_tier_level.intra_constraint_flag == 0
+ && sps->profile_tier_level.one_picture_only_constraint_flag == 0
+ && sps->profile_tier_level.lower_bit_rate_constraint_flag == 1) {
+ profile = GST_VAAPI_PROFILE_H265_MAIN_422_10;
+ break;
+ }
default:
g_debug ("unsupported profile_idc value");
profile = GST_VAAPI_PROFILE_UNKNOWN;
case GST_VAAPI_PROFILE_H265_MAIN_STILL_PICTURE:
profile_idc = GST_H265_PROFILE_MAIN_STILL_PICTURE;
break;
+ case GST_VAAPI_PROFILE_H265_MAIN_422_10:
+ profile_idc = GST_H265_PROFILE_MAIN_422_10;
+ break;
default:
g_debug ("unsupported GstVaapiProfile value");
profile_idc = 0;
/* Returns GstVaapiProfile from H.265 profile_idc value */
G_GNUC_INTERNAL
GstVaapiProfile
-gst_vaapi_utils_h265_get_profile (guint8 profile_idc);
+gst_vaapi_utils_h265_get_profile (GstH265SPS * sps);
/* Returns H.265 profile_idc value from GstVaapiProfile */
G_GNUC_INTERNAL
}
/**
+ * gst_vaapi_video_format_from_chroma:
+ * @chroma_type: a #GstVaapiChromaType
+ *
+ * Returns the "preferred" pixel format that matches with
+ * @chroma_type.
+ *
+ * Returns: the preferred pixel format for @chroma_type
+ **/
+GstVideoFormat
+gst_vaapi_video_format_from_chroma (guint chroma_type)
+{
+ switch (chroma_type) {
+ case GST_VAAPI_CHROMA_TYPE_YUV422:
+ return GST_VIDEO_FORMAT_YUY2;
+ case GST_VAAPI_CHROMA_TYPE_YUV400:
+ return GST_VIDEO_FORMAT_GRAY8;
+ case GST_VAAPI_CHROMA_TYPE_YUV420:
+ case GST_VAAPI_CHROMA_TYPE_RGB32: /* GstVideoGLTextureUploadMeta */
+ return GST_VIDEO_FORMAT_NV12;
+ case GST_VAAPI_CHROMA_TYPE_YUV420_10BPP:
+ return GST_VIDEO_FORMAT_P010_10LE;
+ case GST_VAAPI_CHROMA_TYPE_YUV444:
+ return GST_VIDEO_FORMAT_AYUV;
+ default:
+ return GST_VIDEO_FORMAT_UNKNOWN;
+ }
+}
+
+/**
* gst_vaapi_video_format_get_best_native:
* @format: a #GstVideoFormat
*
return GST_VIDEO_FORMAT_NV12;
chroma_type = gst_vaapi_video_format_get_chroma_type (format);
- switch (chroma_type) {
- case GST_VAAPI_CHROMA_TYPE_YUV422:
- return GST_VIDEO_FORMAT_YUY2;
- case GST_VAAPI_CHROMA_TYPE_YUV400:
- return GST_VIDEO_FORMAT_GRAY8;
- case GST_VAAPI_CHROMA_TYPE_YUV420:
- case GST_VAAPI_CHROMA_TYPE_RGB32: /* GstVideoGLTextureUploadMeta */
- return GST_VIDEO_FORMAT_NV12;
- case GST_VAAPI_CHROMA_TYPE_YUV420_10BPP:
- return GST_VIDEO_FORMAT_P010_10LE;
- default:
- return GST_VIDEO_FORMAT_UNKNOWN;
- };
+ return gst_vaapi_video_format_from_chroma (chroma_type);
}
gst_vaapi_video_format_get_score (GstVideoFormat format);
GstVideoFormat
+gst_vaapi_video_format_from_chroma (guint chroma);
+
+GstVideoFormat
gst_vaapi_video_format_get_best_native (GstVideoFormat format);
G_END_DECLS
#if (USE_GLX || USE_EGL)
GST_VAAPI_MAKE_GLTEXUPLOAD_CAPS ";"
#endif
- GST_VIDEO_CAPS_MAKE("{ NV12, I420, YV12, P010_10LE }") ";"
+ GST_VIDEO_CAPS_MAKE("{ NV12, I420, YV12, YUY2, UYVY, P010_10LE }") ";"
GST_VAAPI_MAKE_DMABUF_CAPS;
static GstStaticPadTemplate gst_vaapidecode_src_factory =
#endif
}
-static gboolean
-ensure_allowed_raw_caps (GstVaapiPluginBase * plugin)
+static GArray *
+extract_allowed_surface_formats (GstVaapiDisplay * display, GArray * formats)
{
- GArray *formats, *out_formats;
- GstVaapiSurface *surface;
- GstVaapiDisplay *display;
guint i;
- GstCaps *out_caps;
- gboolean ret = FALSE;
-
- if (plugin->allowed_raw_caps)
- return TRUE;
-
- out_formats = formats = NULL;
- surface = NULL;
-
- display = gst_object_ref (plugin->display);
- formats = gst_vaapi_display_get_image_formats (display);
- if (!formats)
- goto bail;
+ GArray *out_formats;
out_formats =
g_array_sized_new (FALSE, FALSE, sizeof (GstVideoFormat), formats->len);
if (!out_formats)
- goto bail;
-
- surface =
- gst_vaapi_surface_new (display, GST_VAAPI_CHROMA_TYPE_YUV420, 64, 64);
- if (!surface)
- goto bail;
+ return NULL;
for (i = 0; i < formats->len; i++) {
const GstVideoFormat format = g_array_index (formats, GstVideoFormat, i);
+ GstVaapiChromaType chroma_type;
+ GstVaapiSurface *surface;
GstVaapiImage *image;
if (format == GST_VIDEO_FORMAT_UNKNOWN)
continue;
+ chroma_type = gst_vaapi_video_format_get_chroma_type (format);
+ if (chroma_type == 0)
+ continue;
+ surface = gst_vaapi_surface_new (display, chroma_type, 64, 64);
+ if (!surface)
+ continue;
image = gst_vaapi_image_new (display, format, 64, 64);
- if (!image)
+ if (!image) {
+ gst_vaapi_object_unref (surface);
continue;
+ }
+
if (gst_vaapi_surface_put_image (surface, image))
g_array_append_val (out_formats, format);
+
gst_vaapi_object_unref (image);
+ gst_vaapi_object_unref (surface);
}
+ if (out_formats->len == 0) {
+ g_array_unref (out_formats);
+ return NULL;
+ }
+ return out_formats;
+}
+
+static gboolean
+ensure_allowed_raw_caps (GstVaapiPluginBase * plugin)
+{
+ GArray *formats, *out_formats;
+ GstVaapiDisplay *display;
+ GstCaps *out_caps;
+ gboolean ret = FALSE;
+
+ if (plugin->allowed_raw_caps)
+ return TRUE;
+
+ out_formats = NULL;
+ display = gst_object_ref (plugin->display);
+ formats = gst_vaapi_display_get_image_formats (display);
+ if (!formats)
+ goto bail;
+ out_formats = extract_allowed_surface_formats (display, formats);
+ if (!out_formats)
+ goto bail;
out_caps = gst_vaapi_video_format_new_template_caps_from_list (out_formats);
if (!out_caps)
goto bail;
g_array_unref (formats);
if (out_formats)
g_array_unref (out_formats);
- if (surface)
- gst_vaapi_object_unref (surface);
gst_object_unref (display);
return ret;
#define GST_VAAPI_MAKE_SURFACE_CAPS \
GST_VIDEO_CAPS_MAKE_WITH_FEATURES( \
- GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE, "{ ENCODED, NV12, I420, YV12, P010_10LE }")
+ GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE, "{ ENCODED, NV12, I420, YV12, YUY2, UYVY, P010_10LE }")
#define GST_VAAPI_MAKE_GLTEXUPLOAD_CAPS \
GST_VIDEO_CAPS_MAKE_WITH_FEATURES( \