From: Sreerenj Balachandran Date: Fri, 7 Aug 2015 05:43:44 +0000 (+0300) Subject: decoder: hevc: Workaround to recognize wrongly encoded main profile streams X-Git-Tag: 1.19.3~503^2~1686 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=95b8ca0cda7e34b9e9c1f033f176ab24f4d5ba34;p=platform%2Fupstream%2Fgstreamer.git decoder: hevc: Workaround to recognize wrongly encoded main profile streams 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 have any of the profile_idc values mentioned in Annex-A, instead general_profile_idc has been set as zero and having general_profile_compatibility_flag[general_profile_idc] is TRUE. Assuming them as MAIN profile for now. https://bugzilla.gnome.org/show_bug.cgi?id=753226 Signed-off-by: Sreerenj Balachandran --- diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_h265.c b/gst-libs/gst/vaapi/gstvaapidecoder_h265.c index 50a0125..3ab7445 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_h265.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_h265.c @@ -608,7 +608,8 @@ get_max_dec_frame_buffering (GstH265SPS * sps) /* Fixme: Add limit check based on Annex A */ /* Assuming HighestTid as sps_max_sub_layers_minus1 */ - return MAX (1, (sps->max_dec_pic_buffering_minus1[sps->max_sub_layers_minus1] + 1)); + return MAX (1, + (sps->max_dec_pic_buffering_minus1[sps->max_sub_layers_minus1] + 1)); } static void @@ -1022,8 +1023,21 @@ get_profile (GstVaapiDecoderH265 * decoder, GstH265SPS * sps, guint dpb_size) profile = gst_vaapi_utils_h265_get_profile (sps->profile_tier_level.profile_idc); - if (!profile) - return GST_VAAPI_PROFILE_UNKNOWN; + 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 + * have any of the profile_idc values mentioned in Annex-A, instead general_profile_idc + * has been set as zero and having general_profile_compatibility_flag[general_profile_idc] + * is TRUE. Assuming them as MAIN profile for now */ + if (sps->profile_tier_level.profile_space == 0 && + sps->profile_tier_level.profile_idc == 0 && + sps->profile_tier_level.profile_compatibility_flag[0] == 1) { + GST_WARNING ("Wrong profile_idc, blindly setting it as main profile !!"); + profile = GST_VAAPI_PROFILE_H265_MAIN; + } else + return GST_VAAPI_PROFILE_UNKNOWN; + } + fill_profiles (profiles, &n_profiles, profile); switch (profile) { case GST_VAAPI_PROFILE_H265_MAIN10: