From 579aa4cab1910d87c548b195dead6583b3704529 Mon Sep 17 00:00:00 2001 From: He Junyan Date: Thu, 2 Jul 2020 23:33:31 +0800 Subject: [PATCH] libs: encoder: h265: No need to check hw_max_profile. In h265, higher profile idc number does not mean better compression performance and may be not compatible with the lower profile idc. So, it is not suitable to find the heighest idc for hw to ensure the compatibility. On the other side, when the entrypoint of the selected profile is valid, it means the hw really support this profile, no need to check it again. Part-of: --- gst-libs/gst/vaapi/gstvaapiencoder_h265.c | 38 ------------------------------- 1 file changed, 38 deletions(-) diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h265.c b/gst-libs/gst/vaapi/gstvaapiencoder_h265.c index 0e0a766..17e7a4d 100644 --- a/gst-libs/gst/vaapi/gstvaapiencoder_h265.c +++ b/gst-libs/gst/vaapi/gstvaapiencoder_h265.c @@ -98,7 +98,6 @@ struct _GstVaapiEncoderH265 GstVaapiEntrypoint entrypoint; guint8 profile_idc; guint8 max_profile_idc; - guint8 hw_max_profile_idc; guint8 level_idc; guint32 idr_period; guint32 init_qp; @@ -1058,37 +1057,6 @@ _check_vps_sps_pps_status (GstVaapiEncoderH265 * encoder, } } -/* Determines the largest supported profile by the underlying hardware */ -static gboolean -ensure_hw_profile_limits (GstVaapiEncoderH265 * encoder) -{ - GstVaapiDisplay *const display = GST_VAAPI_ENCODER_DISPLAY (encoder); - GArray *profiles; - guint i, profile_idc, max_profile_idc; - - if (encoder->hw_max_profile_idc) - return TRUE; - - profiles = gst_vaapi_display_get_encode_profiles (display); - if (!profiles) - return FALSE; - - max_profile_idc = 0; - for (i = 0; i < profiles->len; i++) { - const GstVaapiProfile profile = - g_array_index (profiles, GstVaapiProfile, i); - profile_idc = gst_vaapi_utils_h265_get_profile_idc (profile); - if (!profile_idc) - continue; - if (max_profile_idc < profile_idc) - max_profile_idc = profile_idc; - } - g_array_unref (profiles); - - encoder->hw_max_profile_idc = max_profile_idc; - return TRUE; -} - /* Derives the profile supported by the underlying hardware */ static gboolean ensure_hw_profile (GstVaapiEncoderH265 * encoder) @@ -2300,12 +2268,6 @@ ensure_profile_tier_level (GstVaapiEncoderH265 * encoder) return GST_VAAPI_ENCODER_STATUS_ERROR_UNSUPPORTED_PROFILE; } - /* Check HW constraints */ - if (!ensure_hw_profile_limits (encoder)) - return GST_VAAPI_ENCODER_STATUS_ERROR_UNSUPPORTED_PROFILE; - if (encoder->profile_idc > encoder->hw_max_profile_idc) - return GST_VAAPI_ENCODER_STATUS_ERROR_UNSUPPORTED_PROFILE; - /* Ensure bitrate if not set already and derive the right level to use */ ensure_bitrate (encoder); -- 2.7.4