h264: set default values for some header fields.

The SPS, PPS and slice headers are not fully zero-initialized in the
codecparsers/ library. Rather, the standard upstream behaviour is to
initialize only certain syntax elements with some inferred values if
they are not present in the bitstream.

At the gstreamer-vaapi decoder level, we need to further initialize
certain syntax elements with some sensible default values so that to
not complicate VA drivers that just pass those verbatim to the HW,
and also avoid an memset() of the whole decoder unit.

Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
Sreerenj Balachandran 2013-01-05 12:33:06 +02:00 committed by Gwenole Beauchesne
parent cc769f0c2d
commit 0963afce0b

View file

@ -983,6 +983,10 @@ parse_sps(GstVaapiDecoderH264 *decoder, GstVaapiDecoderUnitH264 *unit)
GST_DEBUG("parse SPS");
/* Variables that don't have inferred values per the H.264
standard but that should get a default value anyway */
sps->log2_max_pic_order_cnt_lsb_minus4 = 0;
result = gst_h264_parser_parse_sps(priv->parser, &unit->nalu, sps, TRUE);
if (result != GST_H264_PARSER_OK)
return get_status(result);
@ -1000,6 +1004,11 @@ parse_pps(GstVaapiDecoderH264 *decoder, GstVaapiDecoderUnitH264 *unit)
GST_DEBUG("parse PPS");
/* Variables that don't have inferred values per the H.264
standard but that should get a default value anyway */
pps->slice_group_map_type = 0;
pps->slice_group_change_rate_minus1 = 0;
result = gst_h264_parser_parse_pps(priv->parser, &unit->nalu, pps);
if (result != GST_H264_PARSER_OK)
return get_status(result);
@ -1036,6 +1045,11 @@ parse_slice(GstVaapiDecoderH264 *decoder, GstVaapiDecoderUnitH264 *unit)
GST_DEBUG("parse slice");
/* Variables that don't have inferred values per the H.264
standard but that should get a default value anyway */
slice_hdr->cabac_init_idc = 0;
slice_hdr->direct_spatial_mv_pred_flag = 0;
result = gst_h264_parser_parse_slice_hdr(priv->parser, &unit->nalu,
slice_hdr, TRUE, TRUE);
if (result != GST_H264_PARSER_OK)