From 0fda1a63baadcc510127a02231c9c11f3bd0eea7 Mon Sep 17 00:00:00 2001 From: "xueman.ruan" Date: Fri, 19 Apr 2024 10:09:41 +0800 Subject: [PATCH] fix[avs2d_vdpu383]: Optimise dec result Optimise dec result when player seeking. Change-Id: I2de6dfa4ecf91f03c6958ef631a6f256a4189de6 Signed-off-by: xueman.ruan --- mpp/codec/dec/avs2/avs2d_api.c | 7 ++++--- mpp/hal/rkdec/avs2d/hal_avs2d_rkv.c | 1 + mpp/hal/rkdec/avs2d/hal_avs2d_vdpu382.c | 1 + mpp/hal/rkdec/avs2d/hal_avs2d_vdpu383.c | 13 ++++--------- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/mpp/codec/dec/avs2/avs2d_api.c b/mpp/codec/dec/avs2/avs2d_api.c index 22cee3ff6..40b516829 100644 --- a/mpp/codec/dec/avs2/avs2d_api.c +++ b/mpp/codec/dec/avs2/avs2d_api.c @@ -268,6 +268,7 @@ MPP_RET avs2d_callback(void *decoder, void *info) RK_U32 i = 0; RK_U32 error = 0; RK_U32 discard = 0; + RK_U32 ref_used = task_dec->flags.ref_info_valid ? task_dec->flags.ref_used : 0xff; RK_U32 ref_used_flag = 0; AVS2D_PARSE_TRACE("In."); @@ -286,10 +287,10 @@ MPP_RET avs2d_callback(void *decoder, void *info) discard = 1; } } else { - if (task_dec->flags.ref_miss & task_dec->flags.ref_used) { + if (task_dec->flags.ref_miss & ref_used) { discard = 1; AVS2D_DBG(AVS2D_DBG_CALLBACK, "[CALLBACK]: fake ref used, miss 0x%x used 0x%x\n", - task_dec->flags.ref_miss, task_dec->flags.ref_used); + task_dec->flags.ref_miss, ref_used); } } @@ -301,7 +302,7 @@ MPP_RET avs2d_callback(void *decoder, void *info) if (!ref_frm) continue; - ref_used_flag = (task_dec->flags.ref_used >> i) & 1; + ref_used_flag = (ref_used >> i) & 1; //TODO: In fast mode, ref list isn't kept sync with task flag.ref_used AVS2D_DBG(AVS2D_DBG_CALLBACK, "[CALLBACK]: ref_frm poc %d, err %d, dis %d, ref_used %d\n", mpp_frame_get_poc(ref_frm), mpp_frame_get_errinfo(ref_frm), diff --git a/mpp/hal/rkdec/avs2d/hal_avs2d_rkv.c b/mpp/hal/rkdec/avs2d/hal_avs2d_rkv.c index cccf93d7c..bd2ea8e77 100644 --- a/mpp/hal/rkdec/avs2d/hal_avs2d_rkv.c +++ b/mpp/hal/rkdec/avs2d/hal_avs2d_rkv.c @@ -1100,6 +1100,7 @@ MPP_RET hal_avs2d_rkv_wait(void *hal, HalTaskInfo *task) param.hard_err = 0; task->dec.flags.ref_used = p_regs->statistic.reg266_perf_cnt0; + task->dec.flags.ref_info_valid = 1; if (task->dec.flags.ref_miss) { RK_U32 ref_hw_usage = p_regs->statistic.reg266_perf_cnt0; diff --git a/mpp/hal/rkdec/avs2d/hal_avs2d_vdpu382.c b/mpp/hal/rkdec/avs2d/hal_avs2d_vdpu382.c index 23c58dd6f..1e3eafc9b 100644 --- a/mpp/hal/rkdec/avs2d/hal_avs2d_vdpu382.c +++ b/mpp/hal/rkdec/avs2d/hal_avs2d_vdpu382.c @@ -1167,6 +1167,7 @@ MPP_RET hal_avs2d_vdpu382_wait(void *hal, HalTaskInfo *task) param.hard_err = 0; task->dec.flags.ref_used = p_regs->statistic.reg265.link_perf_cnt0; + task->dec.flags.ref_info_valid = 1; if (task->dec.flags.ref_miss) { RK_U32 ref_hw_usage = p_regs->statistic.reg265.link_perf_cnt0; diff --git a/mpp/hal/rkdec/avs2d/hal_avs2d_vdpu383.c b/mpp/hal/rkdec/avs2d/hal_avs2d_vdpu383.c index 79c19b078..46abe2a4f 100644 --- a/mpp/hal/rkdec/avs2d/hal_avs2d_vdpu383.c +++ b/mpp/hal/rkdec/avs2d/hal_avs2d_vdpu383.c @@ -395,6 +395,7 @@ static MPP_RET fill_registers(Avs2dHalCtx_t *p_hal, Vdpu383Avs2dRegSet *regs, Ha if (slot_idx < 0) { AVS2D_HAL_TRACE("missing ref, could not found valid ref"); + task->dec.flags.ref_err = 1; return ret = MPP_ERR_UNKNOW; } @@ -688,6 +689,8 @@ MPP_RET hal_avs2d_vdpu383_start(void *hal, HalTaskInfo *task) regs = p_hal->fast_mode ? reg_ctx->reg_buf[task->dec.reg_index].regs : reg_ctx->regs; dev = p_hal->dev; + p_hal->frame_no++; + do { MppDevRegWrCfg wr_cfg; MppDevRegRdCfg rd_cfg; @@ -876,15 +879,7 @@ MPP_RET hal_avs2d_vdpu383_wait(void *hal, HalTaskInfo *task) else param.hard_err = 0; - // TODO: config refer frame usage check - // task->dec.flags.ref_used = regs->statistic.reg266_perf_cnt0; - - // if (task->dec.flags.ref_miss) { - // RK_U32 ref_hw_usage = regs->statistic.reg266_perf_cnt0; - - // AVS2D_HAL_TRACE("hal frame %d ref miss %x hard_err %d hw_usage %x", p_hal->frame_no, - // task->dec.flags.ref_miss, param.hard_err, ref_hw_usage); - // } + task->dec.flags.ref_info_valid = 0; AVS2D_HAL_TRACE("hal frame %d hard_err= %d", p_hal->frame_no, param.hard_err);