decoder: h264: add support for constrained baseline profile.

Recognize streams marked as conforming to the "Constrained Baseline
Profile". If VA driver supports that as is, fine. Otherwise, fallback
to baseline, main or high profile.

Constrained Baseline Profile conveys coding tools that are common
to baseline profile and main profile.

https://bugzilla.gnome.org/show_bug.cgi?id=719947

[Added fallbacks to main and high profiles]
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
Wind Yuan 2013-12-06 15:08:26 +08:00 committed by Gwenole Beauchesne
parent bd5ae1b220
commit 009e4522bf
2 changed files with 12 additions and 3 deletions

View file

@ -757,15 +757,22 @@ get_profile(GstVaapiDecoderH264 *decoder, GstH264SPS *sps)
{
GstVaapiDecoderH264Private * const priv = &decoder->priv;
GstVaapiDisplay * const display = GST_VAAPI_DECODER_DISPLAY(decoder);
GstVaapiProfile profile, profiles[2];
GstVaapiProfile profile, profiles[4];
guint i, n_profiles = 0;
profile = gst_vaapi_utils_h264_get_profile(sps->profile_idc);
if (!profile)
return GST_VAAPI_PROFILE_UNKNOWN;
if (sps->constraint_set1_flag && profile == GST_VAAPI_PROFILE_H264_BASELINE)
profile = GST_VAAPI_PROFILE_H264_CONSTRAINED_BASELINE;
profiles[n_profiles++] = profile;
switch (profile) {
case GST_VAAPI_PROFILE_H264_CONSTRAINED_BASELINE:
profiles[n_profiles++] = GST_VAAPI_PROFILE_H264_BASELINE;
profiles[n_profiles++] = GST_VAAPI_PROFILE_H264_MAIN;
// fall-through
case GST_VAAPI_PROFILE_H264_MAIN:
profiles[n_profiles++] = GST_VAAPI_PROFILE_H264_HIGH;
break;

View file

@ -176,7 +176,7 @@ static GstVaapiProfile
gst_vaapi_profile_from_codec_data_h264(GstBuffer *buffer)
{
/* MPEG-4 Part 15: Advanced Video Coding (AVC) file format */
guchar buf[2];
guchar buf[3];
if (gst_buffer_extract(buffer, 0, buf, sizeof(buf)) != sizeof(buf))
return 0;
@ -185,7 +185,9 @@ gst_vaapi_profile_from_codec_data_h264(GstBuffer *buffer)
return 0;
switch (buf[1]) { /* AVCProfileIndication */
case 66: return GST_VAAPI_PROFILE_H264_BASELINE;
case 66: return ((buf[2] & 0x40) ?
GST_VAAPI_PROFILE_H264_CONSTRAINED_BASELINE :
GST_VAAPI_PROFILE_H264_BASELINE);
case 77: return GST_VAAPI_PROFILE_H264_MAIN;
case 100: return GST_VAAPI_PROFILE_H264_HIGH;
}