diff --git a/mpp/codec/dec/h265/h265d_parser.c b/mpp/codec/dec/h265/h265d_parser.c index 7b180e18..00fbd529 100644 --- a/mpp/codec/dec/h265/h265d_parser.c +++ b/mpp/codec/dec/h265/h265d_parser.c @@ -716,6 +716,9 @@ static RK_S32 hls_slice_header(HEVCContext *s) if (s->nal_unit_type >= 16 && s->nal_unit_type <= 23) READ_ONEBIT(gb, &sh->no_output_of_prior_pics_flag); + if(IS_IRAP(s) && s->miss_ref_flag){ + s->miss_ref_flag = 0; + } READ_UE(gb, &pps_id); if (pps_id >= MAX_PPS_COUNT || !s->pps_list[pps_id]) { @@ -1129,6 +1132,12 @@ static RK_S32 hevc_frame_start(HEVCContext *s) ret = mpp_hevc_frame_rps(s); + if(s->miss_ref_flag){ + mpp_frame_set_errinfo(s->frame,VPU_FRAME_ERR_UNKNOW); + } + + 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; diff --git a/mpp/codec/dec/h265/h265d_parser.h b/mpp/codec/dec/h265/h265d_parser.h index 38a990e7..5d4eba89 100644 --- a/mpp/codec/dec/h265/h265d_parser.h +++ b/mpp/codec/dec/h265/h265d_parser.h @@ -696,6 +696,7 @@ typedef struct HEVCContext { RK_S64 pts; RK_U8 has_get_eos; + RK_U8 miss_ref_flag; } HEVCContext; RK_S32 mpp_hevc_decode_short_term_rps(HEVCContext *s, ShortTermRPS *rps, diff --git a/mpp/codec/dec/h265/h265d_refs.c b/mpp/codec/dec/h265/h265d_refs.c index c2c0adc9..f4a31be0 100644 --- a/mpp/codec/dec/h265/h265d_refs.c +++ b/mpp/codec/dec/h265/h265d_refs.c @@ -95,6 +95,7 @@ static HEVCFrame *alloc_frame(HEVCContext *s) mpp_frame_set_hor_stride(frame->frame, (s->h265dctx->coded_width * s->h265dctx->nBitDepth) >> 3); mpp_frame_set_ver_stride(frame->frame, s->h265dctx->coded_height); mpp_frame_set_fmt(frame->frame, s->h265dctx->pix_fmt); + mpp_frame_set_errinfo(frame->frame,0); h265d_dbg(H265D_DBG_GLOBAL, "w_stride %d h_stride %d\n", s->h265dctx->coded_width, s->h265dctx->coded_height); @@ -161,7 +162,6 @@ int mpp_hevc_set_new_ref(HEVCContext *s, MppFrame *mframe, int poc) mpp_buf_slot_set_flag(s->slots, ref->slot_index, SLOT_CODEC_USE); mpp_buf_slot_set_flag(s->slots, ref->slot_index, SLOT_HAL_OUTPUT); - mpp_buf_slot_set_prop(s->slots, ref->slot_index, SLOT_FRAME, ref->frame); s->task->output = ref->slot_index; ref->sequence = s->seq_decode; @@ -333,6 +333,7 @@ static int add_candidate_ref(HEVCContext *s, RefPicList *list, return MPP_ERR_STREAM; if (!ref) { + s->miss_ref_flag = 1; ref = generate_missing_ref(s, poc); if (!ref) return MPP_ERR_NOMEM; diff --git a/mpp/hal/rkdec/h265d/hal_h265d_reg.c b/mpp/hal/rkdec/h265d/hal_h265d_reg.c index 5b6acfa7..3d621d61 100644 --- a/mpp/hal/rkdec/h265d/hal_h265d_reg.c +++ b/mpp/hal/rkdec/h265d/hal_h265d_reg.c @@ -1392,6 +1392,7 @@ MPP_RET hal_h265d_gen_regs(void *hal, HalTaskInfo *syn) H265d_REGS_t *hw_regs; RK_S32 ret = MPP_SUCCESS; MppBuffer streambuf = NULL; + RK_S32 valid_ref; #ifdef ANDROID MppBuffer framebuf = NULL; @@ -1515,8 +1516,9 @@ MPP_RET hal_h265d_gen_regs(void *hal, HalTaskInfo *syn) mpp_buf_slot_get_prop(reg_cxt->slots, dxva_cxt->pp.RefPicList[i].Index7Bits, SLOT_BUFFER, &framebuf); if (framebuf != NULL) { hw_regs->sw_refer_base[i] = mpp_buffer_get_fd(framebuf); + valid_ref = hw_regs->sw_refer_base[i]; } else { - hw_regs->sw_refer_base[i] = hw_regs->sw_decout_base; + hw_regs->sw_refer_base[i] = valid_ref; } hw_regs->sw_ref_valid |= (1 << i); } else {