mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
nvh265sldec: Sync up with d3d11h265dec implementation
Each RefPicSetStCurrBefore/RefPicSetStCurrAfter/RefPicSetLtCurr array might have empty element (i.e., reference pictures might not be stored sequentially). Don't error out for the empty element case, but instead, iterates each array and fill NVDEC's reference list as much as possible Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1441 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3039>
This commit is contained in:
parent
f4260ecdc5
commit
b6ca76eb68
1 changed files with 31 additions and 42 deletions
|
@ -725,7 +725,7 @@ gst_nv_h265_dec_start_picture (GstH265Decoder * decoder,
|
||||||
GstNvDecoderFrame *frame;
|
GstNvDecoderFrame *frame;
|
||||||
GArray *dpb_array;
|
GArray *dpb_array;
|
||||||
gint num_ref_pic;
|
gint num_ref_pic;
|
||||||
gint i, j;
|
gint i, j, k;
|
||||||
const GstH265ScalingList *scaling_list = NULL;
|
const GstH265ScalingList *scaling_list = NULL;
|
||||||
|
|
||||||
/* both NVDEC and h265parser are using the same order */
|
/* both NVDEC and h265parser are using the same order */
|
||||||
|
@ -819,7 +819,6 @@ gst_nv_h265_dec_start_picture (GstH265Decoder * decoder,
|
||||||
}
|
}
|
||||||
|
|
||||||
other_frame = gst_nv_h265_dec_get_decoder_frame_from_picture (self, other);
|
other_frame = gst_nv_h265_dec_get_decoder_frame_from_picture (self, other);
|
||||||
|
|
||||||
if (other_frame)
|
if (other_frame)
|
||||||
picture_index = other_frame->index;
|
picture_index = other_frame->index;
|
||||||
|
|
||||||
|
@ -829,65 +828,55 @@ gst_nv_h265_dec_start_picture (GstH265Decoder * decoder,
|
||||||
|
|
||||||
num_ref_pic++;
|
num_ref_pic++;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_array_unref (dpb_array);
|
g_array_unref (dpb_array);
|
||||||
|
|
||||||
for (i = num_ref_pic; i < G_N_ELEMENTS (h265_params->RefPicIdx); i++)
|
for (i = 0, j = 0; i < num_ref_pic; i++) {
|
||||||
h265_params->RefPicIdx[i] = -1;
|
GstH265Picture *other = NULL;
|
||||||
|
|
||||||
for (i = 0; i < decoder->NumPocStCurrBefore; i++) {
|
while (!other && j < decoder->NumPocStCurrBefore)
|
||||||
GstH265Picture *other;
|
other = decoder->RefPicSetStCurrBefore[j++];
|
||||||
|
|
||||||
if (!decoder->RefPicSetStCurrBefore[i]) {
|
if (other) {
|
||||||
GST_ERROR_OBJECT (self, "Empty RefPicSetStCurrBefore[%d]", i);
|
for (k = 0; k < num_ref_pic; k++) {
|
||||||
return GST_FLOW_ERROR;
|
if (h265_params->PicOrderCntVal[k] == other->pic_order_cnt) {
|
||||||
}
|
h265_params->RefPicSetStCurrBefore[i] = k;
|
||||||
|
|
||||||
other = decoder->RefPicSetStCurrBefore[i];
|
|
||||||
|
|
||||||
for (j = 0; j < num_ref_pic; j++) {
|
|
||||||
if (h265_params->PicOrderCntVal[j] == other->pic_order_cnt) {
|
|
||||||
h265_params->RefPicSetStCurrBefore[i] = j;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < decoder->NumPocStCurrAfter; i++) {
|
|
||||||
GstH265Picture *other;
|
|
||||||
|
|
||||||
if (!decoder->RefPicSetStCurrAfter[i]) {
|
|
||||||
GST_ERROR_OBJECT (self, "Empty RefPicSetStCurrAfter[%d]", i);
|
|
||||||
return GST_FLOW_ERROR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
other = decoder->RefPicSetStCurrAfter[i];
|
for (i = 0, j = 0; i < num_ref_pic; i++) {
|
||||||
|
GstH265Picture *other = NULL;
|
||||||
|
|
||||||
for (j = 0; j < num_ref_pic; j++) {
|
while (!other && j < decoder->NumPocStCurrAfter)
|
||||||
if (h265_params->PicOrderCntVal[j] == other->pic_order_cnt) {
|
other = decoder->RefPicSetStCurrAfter[j++];
|
||||||
h265_params->RefPicSetStCurrAfter[i] = j;
|
|
||||||
|
if (other) {
|
||||||
|
for (k = 0; k < num_ref_pic; k++) {
|
||||||
|
if (h265_params->PicOrderCntVal[k] == other->pic_order_cnt) {
|
||||||
|
h265_params->RefPicSetStCurrAfter[i] = k;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < decoder->NumPocLtCurr; i++) {
|
|
||||||
GstH265Picture *other;
|
|
||||||
|
|
||||||
if (!decoder->RefPicSetLtCurr[i]) {
|
|
||||||
GST_ERROR_OBJECT (self, "Empty RefPicSetLtCurr[%d]", i);
|
|
||||||
return GST_FLOW_ERROR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
other = decoder->RefPicSetLtCurr[i];
|
for (i = 0, j = 0; i < num_ref_pic; i++) {
|
||||||
|
GstH265Picture *other = NULL;
|
||||||
|
|
||||||
for (j = 0; j < num_ref_pic; j++) {
|
while (!other && j < decoder->NumPocLtCurr)
|
||||||
if (h265_params->PicOrderCntVal[j] == other->pic_order_cnt) {
|
other = decoder->RefPicSetLtCurr[j++];
|
||||||
h265_params->RefPicSetLtCurr[i] = j;
|
|
||||||
|
if (other) {
|
||||||
|
for (k = 0; k < num_ref_pic; k++) {
|
||||||
|
if (h265_params->PicOrderCntVal[k] == other->pic_order_cnt) {
|
||||||
|
h265_params->RefPicSetLtCurr[i] = k;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Fill scaling list */
|
/* Fill scaling list */
|
||||||
if (pps->scaling_list_data_present_flag ||
|
if (pps->scaling_list_data_present_flag ||
|
||||||
|
|
Loading…
Reference in a new issue