vaapih265dec: fixed st_rps_bits setting in h265 decoding.

According to va_dec_hevc.h, pic_param->st_rps_bits should be set
for accelorater to skip parsing the *short_term_ref_pic_set
(num_short_term_ref_pic_sets) structure.
Also modified fill_picture to get parser info as a parameter,
in order to get slide_hdr->short_term_ref_pic_set_size.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1886>
This commit is contained in:
GuYanjie 2022-03-08 14:54:34 +08:00 committed by Víctor Manuel Jáquez Leal
parent 2a8fa45ba8
commit f39174fbc4

View file

@ -1889,10 +1889,12 @@ get_index_for_RefPicListX (VAPictureHEVC * ReferenceFrames,
}
static gboolean
fill_picture (GstVaapiDecoderH265 * decoder, GstVaapiPictureH265 * picture)
fill_picture (GstVaapiDecoderH265 * decoder, GstVaapiPictureH265 * picture,
GstVaapiParserInfoH265 * pi)
{
GstVaapiDecoderH265Private *const priv = &decoder->priv;
GstVaapiPicture *const base_picture = &picture->base;
GstH265SliceHdr *const slice_hdr = &pi->data.slice_hdr;
GstH265PPS *const pps = get_pps (decoder);
GstH265SPS *const sps = get_sps (decoder);
VAPictureParameterBufferHEVC *pic_param = base_picture->param;
@ -2034,8 +2036,10 @@ fill_picture (GstVaapiDecoderH265 * decoder, GstVaapiPictureH265 * picture)
pic_param->pps_tc_offset_div2 = pps->tc_offset_div2;
COPY_FIELD (pps, num_extra_slice_header_bits);
/* FIXME: Set correct value as mentioned in va_dec_hevc.h */
pic_param->st_rps_bits = 0;
if (slice_hdr->short_term_ref_pic_set_sps_flag == 0)
pic_param->st_rps_bits = slice_hdr->short_term_ref_pic_set_size;
else
pic_param->st_rps_bits = 0;
#if VA_CHECK_VERSION(1,2,0)
if (pic_rext_param) {
@ -2497,7 +2501,7 @@ decode_picture (GstVaapiDecoderH265 * decoder, GstVaapiDecoderUnit * unit)
if (!dpb_init (decoder, picture, pi))
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
if (!fill_picture (decoder, picture))
if (!fill_picture (decoder, picture, pi))
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
priv->decoder_state = pi->state;