[h265d_parser]: decode rps and update dpb before alloc frame

Alloc_frame function is before mpp_hevc_frame_rps,
In the max order/ref num case, all dpb slots are used
before update rps. But alloc_frame fail first, could not
get a unused slots.

Change-Id: I08cb36004825cd2f99caf1f668b33c25e55c354c
Signed-off-by: james.lin <james.lin@rock-chips.com>
This commit is contained in:
james.lin
2017-04-27 15:07:42 +08:00
committed by Herman Chen
parent 0bfe09555d
commit 756d6df22d
2 changed files with 7 additions and 12 deletions

14
mpp/codec/dec/h265/h265d_parser.c Normal file → Executable file
View File

@@ -1182,14 +1182,18 @@ static RK_S32 hevc_frame_start(HEVCContext *s)
s->is_decoded = 0;
s->first_nal_type = s->nal_unit_type;
s->miss_ref_flag = 0;
ret = mpp_hevc_frame_rps(s);
if (ret < 0) {
mpp_err("Error constructing the frame RPS.\n");
goto fail;
}
ret = mpp_hevc_set_new_ref(s, &s->frame, s->poc);
if (ret < 0)
goto fail;
s->miss_ref_flag = 0;
ret = mpp_hevc_frame_rps(s);
if (s->miss_ref_flag) {
if (!IS_IRAP(s)) {
mpp_frame_set_errinfo(s->frame, MPP_FRAME_ERR_UNKNOW);
@@ -1222,10 +1226,6 @@ static RK_S32 hevc_frame_start(HEVCContext *s)
mpp_buf_slot_set_prop(s->slots, s->ref->slot_index, SLOT_FRAME, s->ref->frame);
if (ret < 0) {
mpp_err("Error constructing the frame RPS.\n");
goto fail;
}
return 0;
fail:

5
mpp/codec/dec/h265/h265d_refs.c Normal file → Executable file
View File

@@ -217,9 +217,6 @@ static int add_candidate_ref(HEVCContext *s, RefPicList *list,
{
HEVCFrame *ref = find_ref_idx(s, poc);
if (ref == s->ref)
return MPP_ERR_STREAM;
if (!ref) {
ref = generate_missing_ref(s, poc);
if (!ref)
@@ -258,8 +255,6 @@ RK_S32 mpp_hevc_frame_rps(HEVCContext *s)
/* clear the reference flags on all frames except the current one */
for (i = 0; i < MPP_ARRAY_ELEMS(s->DPB); i++) {
HEVCFrame *frame = &s->DPB[i];
if (frame == s->ref)
continue;
mark_ref(frame, 0);
}