From 22caf3f1f8562f43b2c95e01cfb166cb5d1ef97b Mon Sep 17 00:00:00 2001 From: "toby.zhang" Date: Mon, 7 Mar 2022 19:38:24 +0800 Subject: [PATCH] [hal_vepu580]: Add scene_mode to distinguish ipc and none ipc scene. Signed-off-by: toby.zhang Change-Id: Ib62c3eccbcce4b7517cf4a5d930260e982080ea9 --- mpp/hal/rkenc/h264e/hal_h264e_vepu580_tune.c | 12 ++++++++++-- mpp/hal/rkenc/h265e/hal_h265e_vepu580_tune.c | 12 +++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/mpp/hal/rkenc/h264e/hal_h264e_vepu580_tune.c b/mpp/hal/rkenc/h264e/hal_h264e_vepu580_tune.c index 8e597caf..0cbe89be 100644 --- a/mpp/hal/rkenc/h264e/hal_h264e_vepu580_tune.c +++ b/mpp/hal/rkenc/h264e/hal_h264e_vepu580_tune.c @@ -102,12 +102,14 @@ static RK_S32 rime_multi[4][3] = { static HalH264eVepu580Tune *vepu580_h264e_tune_init(HalH264eVepu580Ctx *ctx) { HalH264eVepu580Tune *tune = mpp_malloc(HalH264eVepu580Tune, 1); + RK_S32 scene_mode = ctx->cfg->tune.scene_mode == MPP_ENC_SCENE_MODE_IPC ? 0 : 1; + if (NULL == tune) return tune; tune->ctx = ctx; tune->curr_scene_motion_flag = 0; - tune->ap_motion_flag = 0; + tune->ap_motion_flag = scene_mode; memset(tune->md_madp, 0, sizeof(tune->md_madp)); memset(tune->txtr_madi, 0, sizeof(tune->txtr_madi)); memset(tune->md_flag_matrix, 0, sizeof(tune->md_flag_matrix)); @@ -127,13 +129,17 @@ static void vepu580_h264e_tune_reg_patch(void *p) { HalH264eVepu580Tune *tune = (HalH264eVepu580Tune *)p; HalH264eVepu580Ctx *ctx = NULL; + RK_S32 scene_mode = 0; if (NULL == tune) return; ctx = tune->ctx; + scene_mode = ctx->cfg->tune.scene_mode == MPP_ENC_SCENE_MODE_IPC ? 0 : 1; + H264eSlice *slice = ctx->slice; HalVepu580RegSet *regs = ctx->regs_set; + tune->ap_motion_flag = scene_mode; RK_U32 scene_motion_flag = tune->ap_motion_flag * 2 + tune->curr_scene_motion_flag; if (scene_motion_flag > 3) { @@ -230,12 +236,14 @@ static void vepu580_h264e_tune_stat_update(void *p, HalEncTask *task) HalH264eVepu580Tune *tune = (HalH264eVepu580Tune *)p; HalH264eVepu580Ctx *ctx = NULL; EncRcTaskInfo *rc_info = &task->rc_task->info; + RK_S32 scene_mode = 0; if (NULL == tune) return; ctx = tune->ctx; - + scene_mode = ctx->cfg->tune.scene_mode == MPP_ENC_SCENE_MODE_IPC ? 0 : 1; + tune->ap_motion_flag = scene_mode; /* update statistic info here */ RK_S32 mb_num = 0; RK_S32 madp = 0; diff --git a/mpp/hal/rkenc/h265e/hal_h265e_vepu580_tune.c b/mpp/hal/rkenc/h265e/hal_h265e_vepu580_tune.c index 14e3d199..ad52dde4 100644 --- a/mpp/hal/rkenc/h265e/hal_h265e_vepu580_tune.c +++ b/mpp/hal/rkenc/h265e/hal_h265e_vepu580_tune.c @@ -141,12 +141,14 @@ static RK_S32 rime_multi[4][3] = { static HalH265eVepu580Tune *vepu580_h265e_tune_init(H265eV580HalContext *ctx) { HalH265eVepu580Tune *tune = mpp_malloc(HalH265eVepu580Tune, 1); + RK_S32 scene_mode = ctx->cfg->tune.scene_mode == MPP_ENC_SCENE_MODE_IPC ? 0 : 1; + if (NULL == tune) return tune; tune->ctx = ctx; tune->curr_scene_motion_flag = 0; - tune->ap_motion_flag = 0; + tune->ap_motion_flag = scene_mode; memset(tune->md_madp, 0, sizeof(tune->md_madp)); memset(tune->txtr_madi, 0, sizeof(tune->txtr_madi)); memset(tune->md_flag_matrix, 0, sizeof(tune->md_flag_matrix)); @@ -166,12 +168,14 @@ static void vepu580_h265e_tune_reg_patch(void *p) { HalH265eVepu580Tune *tune = (HalH265eVepu580Tune *)p; H265eV580HalContext *ctx = NULL; + RK_S32 scene_mode = 0; if (NULL == tune) return; ctx = tune->ctx; - + scene_mode = ctx->cfg->tune.scene_mode == MPP_ENC_SCENE_MODE_IPC ? 0 : 1; + tune->ap_motion_flag = scene_mode; /* modify register here */ H265eV580RegSet *regs = (H265eV580RegSet *)ctx->regs[0]; hevc_vepu580_rc_klut *rc_regs = ®s->reg_rc_klut; @@ -351,12 +355,14 @@ static void vepu580_h265e_tune_stat_update(void *p) { HalH265eVepu580Tune *tune = (HalH265eVepu580Tune *)p; H265eV580HalContext *ctx = NULL; + RK_S32 scene_mode = 0; if (NULL == tune) return; ctx = tune->ctx; - + scene_mode = ctx->cfg->tune.scene_mode == MPP_ENC_SCENE_MODE_IPC ? 0 : 1; + tune->ap_motion_flag = scene_mode; /* update statistic info here */ RK_S32 j; RK_S32 i = 0;