mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
libs: decoder: update reference list for SCC.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/311>
This commit is contained in:
parent
c956d91807
commit
5f92699a4b
1 changed files with 39 additions and 1 deletions
|
@ -1345,7 +1345,21 @@ decode_current_picture (GstVaapiDecoderH265 * decoder)
|
||||||
|
|
||||||
priv->decoder_state |= sps_pi->state;
|
priv->decoder_state |= sps_pi->state;
|
||||||
if (!(priv->decoder_state & GST_H265_VIDEO_STATE_GOT_I_FRAME)) {
|
if (!(priv->decoder_state & GST_H265_VIDEO_STATE_GOT_I_FRAME)) {
|
||||||
if (priv->decoder_state & GST_H265_VIDEO_STATE_GOT_P_SLICE)
|
const GstH265PPS *pps = get_pps (decoder);
|
||||||
|
/* 7.4.3.3.3: the picture is an IRAP picture, nuh_layer_id is equal to 0,
|
||||||
|
and pps_curr_pic_ref_enabled_flag is equal to 0, slice_type shall be
|
||||||
|
equal to 2(I Slice).
|
||||||
|
And F.8.3.4: Decoding process for reference picture lists construction
|
||||||
|
is invoked at the beginning of the decoding process for each P or B
|
||||||
|
slice.
|
||||||
|
so if pps_curr_pic_ref_enabled_flag is set, which means the picture can
|
||||||
|
ref to itself, the IRAP picture may be set to P/B slice, in order to
|
||||||
|
generate the ref lists. If the slice_type is I, no ref list will be
|
||||||
|
constructed and no MV data for that slice according to the syntax.
|
||||||
|
That kind of CVS may start with P/B slice, but in fact it is a intra
|
||||||
|
frame. */
|
||||||
|
if (priv->decoder_state & GST_H265_VIDEO_STATE_GOT_P_SLICE &&
|
||||||
|
!pps->pps_scc_extension_params.pps_curr_pic_ref_enabled_flag)
|
||||||
goto drop_frame;
|
goto drop_frame;
|
||||||
sps_pi->state |= GST_H265_VIDEO_STATE_GOT_I_FRAME;
|
sps_pi->state |= GST_H265_VIDEO_STATE_GOT_I_FRAME;
|
||||||
}
|
}
|
||||||
|
@ -1670,6 +1684,7 @@ init_picture_refs (GstVaapiDecoderH265 * decoder,
|
||||||
guint num_ref_idx_l0_active_minus1 = 0;
|
guint num_ref_idx_l0_active_minus1 = 0;
|
||||||
guint num_ref_idx_l1_active_minus1 = 0;
|
guint num_ref_idx_l1_active_minus1 = 0;
|
||||||
GstH265RefPicListModification *ref_pic_list_modification;
|
GstH265RefPicListModification *ref_pic_list_modification;
|
||||||
|
GstH265PPS *const pps = get_pps (decoder);
|
||||||
guint type;
|
guint type;
|
||||||
|
|
||||||
memset (priv->RefPicList0, 0, sizeof (GstVaapiPictureH265 *) * 16);
|
memset (priv->RefPicList0, 0, sizeof (GstVaapiPictureH265 *) * 16);
|
||||||
|
@ -1702,6 +1717,8 @@ init_picture_refs (GstVaapiDecoderH265 * decoder,
|
||||||
for (i = 0; i < priv->NumPocLtCurr && rIdx < NumRpsCurrTempList0;
|
for (i = 0; i < priv->NumPocLtCurr && rIdx < NumRpsCurrTempList0;
|
||||||
rIdx++, i++)
|
rIdx++, i++)
|
||||||
RefPicListTemp0[rIdx] = priv->RefPicSetLtCurr[i];
|
RefPicListTemp0[rIdx] = priv->RefPicSetLtCurr[i];
|
||||||
|
if (pps->pps_scc_extension_params.pps_curr_pic_ref_enabled_flag)
|
||||||
|
RefPicListTemp0[rIdx++] = picture;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* construct RefPicList0 (8-9) */
|
/* construct RefPicList0 (8-9) */
|
||||||
|
@ -1710,6 +1727,10 @@ init_picture_refs (GstVaapiDecoderH265 * decoder,
|
||||||
ref_pic_list_modification->ref_pic_list_modification_flag_l0 ?
|
ref_pic_list_modification->ref_pic_list_modification_flag_l0 ?
|
||||||
RefPicListTemp0[ref_pic_list_modification->list_entry_l0[rIdx]] :
|
RefPicListTemp0[ref_pic_list_modification->list_entry_l0[rIdx]] :
|
||||||
RefPicListTemp0[rIdx];
|
RefPicListTemp0[rIdx];
|
||||||
|
if (pps->pps_scc_extension_params.pps_curr_pic_ref_enabled_flag
|
||||||
|
&& !ref_pic_list_modification->ref_pic_list_modification_flag_l0
|
||||||
|
&& (NumRpsCurrTempList0 > num_ref_idx_l0_active_minus1 + 1))
|
||||||
|
priv->RefPicList0[rIdx++] = picture;
|
||||||
priv->RefPicList0_count = rIdx;
|
priv->RefPicList0_count = rIdx;
|
||||||
|
|
||||||
if (type == GST_H265_B_SLICE) {
|
if (type == GST_H265_B_SLICE) {
|
||||||
|
@ -1726,6 +1747,8 @@ init_picture_refs (GstVaapiDecoderH265 * decoder,
|
||||||
for (i = 0; i < priv->NumPocLtCurr && rIdx < NumRpsCurrTempList1;
|
for (i = 0; i < priv->NumPocLtCurr && rIdx < NumRpsCurrTempList1;
|
||||||
rIdx++, i++)
|
rIdx++, i++)
|
||||||
RefPicListTemp1[rIdx] = priv->RefPicSetLtCurr[i];
|
RefPicListTemp1[rIdx] = priv->RefPicSetLtCurr[i];
|
||||||
|
if (pps->pps_scc_extension_params.pps_curr_pic_ref_enabled_flag)
|
||||||
|
RefPicListTemp1[rIdx++] = picture;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* construct RefPicList1 (8-10) */
|
/* construct RefPicList1 (8-10) */
|
||||||
|
@ -1898,6 +1921,17 @@ fill_picture (GstVaapiDecoderH265 * decoder, GstVaapiPictureH265 * picture)
|
||||||
if (n >= G_N_ELEMENTS (pic_param->ReferenceFrames))
|
if (n >= G_N_ELEMENTS (pic_param->ReferenceFrames))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/* 7.4.3.3.3, the current decoded picture is marked as "used for
|
||||||
|
long-term reference", no matter TwoVersionsOfCurrDecPicFlag */
|
||||||
|
if (pps->pps_scc_extension_params.pps_curr_pic_ref_enabled_flag
|
||||||
|
&& n < G_N_ELEMENTS (pic_param->ReferenceFrames) - 1) {
|
||||||
|
gst_vaapi_picture_h265_set_reference (picture,
|
||||||
|
GST_VAAPI_PICTURE_FLAG_LONG_TERM_REFERENCE);
|
||||||
|
vaapi_fill_picture (&pic_param->ReferenceFrames[n++], picture,
|
||||||
|
picture->structure);
|
||||||
|
gst_vaapi_picture_h265_set_reference (picture, 0);
|
||||||
|
}
|
||||||
|
|
||||||
for (; n < G_N_ELEMENTS (pic_param->ReferenceFrames); n++)
|
for (; n < G_N_ELEMENTS (pic_param->ReferenceFrames); n++)
|
||||||
vaapi_init_picture (&pic_param->ReferenceFrames[n]);
|
vaapi_init_picture (&pic_param->ReferenceFrames[n]);
|
||||||
|
|
||||||
|
@ -2277,6 +2311,7 @@ decode_ref_pic_set (GstVaapiDecoderH265 * decoder,
|
||||||
GstVaapiDecoderH265Private *const priv = &decoder->priv;
|
GstVaapiDecoderH265Private *const priv = &decoder->priv;
|
||||||
GstH265SliceHdr *const slice_hdr = &pi->data.slice_hdr;
|
GstH265SliceHdr *const slice_hdr = &pi->data.slice_hdr;
|
||||||
GstH265SPS *const sps = get_sps (decoder);
|
GstH265SPS *const sps = get_sps (decoder);
|
||||||
|
GstH265PPS *const pps = get_pps (decoder);
|
||||||
const gint32 MaxPicOrderCntLsb =
|
const gint32 MaxPicOrderCntLsb =
|
||||||
1 << (sps->log2_max_pic_order_cnt_lsb_minus4 + 4);
|
1 << (sps->log2_max_pic_order_cnt_lsb_minus4 + 4);
|
||||||
|
|
||||||
|
@ -2297,6 +2332,7 @@ decode_ref_pic_set (GstVaapiDecoderH265 * decoder,
|
||||||
memset (priv->PocLtFoll, 0, sizeof (guint) * 16);
|
memset (priv->PocLtFoll, 0, sizeof (guint) * 16);
|
||||||
priv->NumPocStCurrBefore = priv->NumPocStCurrAfter = priv->NumPocStFoll = 0;
|
priv->NumPocStCurrBefore = priv->NumPocStCurrAfter = priv->NumPocStFoll = 0;
|
||||||
priv->NumPocLtCurr = priv->NumPocLtFoll = 0;
|
priv->NumPocLtCurr = priv->NumPocLtFoll = 0;
|
||||||
|
priv->NumPocTotalCurr = 0;
|
||||||
} else {
|
} else {
|
||||||
GstH265ShortTermRefPicSet *stRefPic = NULL;
|
GstH265ShortTermRefPicSet *stRefPic = NULL;
|
||||||
gint32 num_lt_pics, pocLt;
|
gint32 num_lt_pics, pocLt;
|
||||||
|
@ -2346,6 +2382,8 @@ decode_ref_pic_set (GstVaapiDecoderH265 * decoder,
|
||||||
numtotalcurr++;
|
numtotalcurr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pps->pps_scc_extension_params.pps_curr_pic_ref_enabled_flag)
|
||||||
|
numtotalcurr++;
|
||||||
priv->NumPocTotalCurr = numtotalcurr;
|
priv->NumPocTotalCurr = numtotalcurr;
|
||||||
|
|
||||||
/* The variable DeltaPocMsbCycleLt[i] is derived as follows: (7-38) */
|
/* The variable DeltaPocMsbCycleLt[i] is derived as follows: (7-38) */
|
||||||
|
|
Loading…
Reference in a new issue