Skip to content

Commit

Permalink
fix[avs2d_vdpu383]: Optimise dec result
Browse files Browse the repository at this point in the history
Optimise dec result when player seeking.

Change-Id: I2de6dfa4ecf91f03c6958ef631a6f256a4189de6
Signed-off-by: xueman.ruan <[email protected]>
  • Loading branch information
xueman.ruan authored and HermanChen committed Apr 19, 2024
1 parent 1845e91 commit 0fda1a6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
7 changes: 4 additions & 3 deletions mpp/codec/dec/avs2/avs2d_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
Expand All @@ -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);
}
}

Expand All @@ -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),
Expand Down
1 change: 1 addition & 0 deletions mpp/hal/rkdec/avs2d/hal_avs2d_rkv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions mpp/hal/rkdec/avs2d/hal_avs2d_vdpu382.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
13 changes: 4 additions & 9 deletions mpp/hal/rkdec/avs2d/hal_avs2d_vdpu383.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 0fda1a6

Please sign in to comment.