codecs: h265decoder: Fix a typo of NumPocTotalCurr when process ref pic list.

We should use the NumPocTotalCurr value stored in decoder, which is a calculated
valid value, rather than use the invalid value in the slice header. Most of the
time, the NumPocTotalCurr is 0 and make the tmp_refs a very short length, and
causes the decoder's wrong result.
By the way, the NumPocTotalCurr is not the correct name specified in H265 spec,
its name should be NumPicTotalCurr. We change it to the correct name.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2414>
This commit is contained in:
He Junyan 2021-07-16 15:24:11 +08:00
parent 6a9f84a2de
commit 4299596d16
3 changed files with 6 additions and 6 deletions

View file

@ -492,7 +492,7 @@ gst_h265_decoder_process_ref_pic_lists (GstH265Decoder * self,
/* NumRpsCurrTempList0 */ /* NumRpsCurrTempList0 */
num_tmp_refs = MAX (slice->header.num_ref_idx_l0_active_minus1 + 1, num_tmp_refs = MAX (slice->header.num_ref_idx_l0_active_minus1 + 1,
slice->header.NumPocTotalCurr); self->NumPicTotalCurr);
while (tmp_refs->len < num_tmp_refs) { while (tmp_refs->len < num_tmp_refs) {
for (i = 0; i < self->NumPocStCurrBefore && tmp_refs->len < num_tmp_refs; for (i = 0; i < self->NumPocStCurrBefore && tmp_refs->len < num_tmp_refs;
@ -542,7 +542,7 @@ gst_h265_decoder_process_ref_pic_lists (GstH265Decoder * self,
/* NumRpsCurrTempList1 */ /* NumRpsCurrTempList1 */
num_tmp_refs = MAX (slice->header.num_ref_idx_l1_active_minus1 + 1, num_tmp_refs = MAX (slice->header.num_ref_idx_l1_active_minus1 + 1,
slice->header.NumPocTotalCurr); self->NumPicTotalCurr);
while (tmp_refs->len < num_tmp_refs) { while (tmp_refs->len < num_tmp_refs) {
for (i = 0; i < self->NumPocStCurrAfter && tmp_refs->len < num_tmp_refs; for (i = 0; i < self->NumPocStCurrAfter && tmp_refs->len < num_tmp_refs;
@ -1405,7 +1405,7 @@ gst_h265_decoder_prepare_rps (GstH265Decoder * self, const GstH265Slice * slice,
numtotalcurr++; numtotalcurr++;
} }
self->NumPocTotalCurr = numtotalcurr; self->NumPicTotalCurr = numtotalcurr;
/* The variable DeltaPocMsbCycleLt[i] is derived as follows: (7-38) */ /* The variable DeltaPocMsbCycleLt[i] is derived as follows: (7-38) */
for (i = 0; i < num_lt_pics; i++) { for (i = 0; i < num_lt_pics; i++) {
@ -1442,7 +1442,7 @@ gst_h265_decoder_prepare_rps (GstH265Decoder * self, const GstH265Slice * slice,
GST_LOG_OBJECT (self, "NumPocStFoll: %d", self->NumPocStFoll); GST_LOG_OBJECT (self, "NumPocStFoll: %d", self->NumPocStFoll);
GST_LOG_OBJECT (self, "NumPocLtCurr: %d", self->NumPocLtCurr); GST_LOG_OBJECT (self, "NumPocLtCurr: %d", self->NumPocLtCurr);
GST_LOG_OBJECT (self, "NumPocLtFoll: %d", self->NumPocLtFoll); GST_LOG_OBJECT (self, "NumPocLtFoll: %d", self->NumPocLtFoll);
GST_LOG_OBJECT (self, "NumPocTotalCurr: %d", self->NumPocTotalCurr); GST_LOG_OBJECT (self, "NumPicTotalCurr: %d", self->NumPicTotalCurr);
/* the derivation process for the RPS and the picture marking */ /* the derivation process for the RPS and the picture marking */
gst_h265_decoder_derive_and_mark_rps (self, picture, gst_h265_decoder_derive_and_mark_rps (self, picture,

View file

@ -64,7 +64,7 @@ struct _GstH265Decoder
guint NumPocStFoll; guint NumPocStFoll;
guint NumPocLtCurr; guint NumPocLtCurr;
guint NumPocLtFoll; guint NumPocLtFoll;
guint NumPocTotalCurr; guint NumPicTotalCurr;
/*< private >*/ /*< private >*/
GstH265DecoderPrivate *priv; GstH265DecoderPrivate *priv;

View file

@ -740,7 +740,7 @@ gst_nv_h265_dec_start_picture (GstH265Decoder * decoder,
slice_header->short_term_ref_pic_set_size; slice_header->short_term_ref_pic_set_size;
h265_params->NumDeltaPocsOfRefRpsIdx = h265_params->NumDeltaPocsOfRefRpsIdx =
slice_header->short_term_ref_pic_sets.NumDeltaPocsOfRefRpsIdx; slice_header->short_term_ref_pic_sets.NumDeltaPocsOfRefRpsIdx;
h265_params->NumPocTotalCurr = decoder->NumPocTotalCurr; h265_params->NumPocTotalCurr = decoder->NumPicTotalCurr;
h265_params->NumPocStCurrBefore = decoder->NumPocStCurrBefore; h265_params->NumPocStCurrBefore = decoder->NumPocStCurrBefore;
h265_params->NumPocStCurrAfter = decoder->NumPocStCurrAfter; h265_params->NumPocStCurrAfter = decoder->NumPocStCurrAfter;
h265_params->NumPocLtCurr = decoder->NumPocLtCurr; h265_params->NumPocLtCurr = decoder->NumPocLtCurr;