From c43b99b6710f758a2c3a47dd6c2bdcaa0e5e32f3 Mon Sep 17 00:00:00 2001 From: Johnson Ding Date: Thu, 25 Jan 2024 15:53:24 +0800 Subject: [PATCH] fix[h265e]: disable tmvp by default When setting drop-gap to 0, continuous dropping frame at p-skip mode will make the following encodeing result go wrong, if temporal motion vector prediction is enabled. So tmvp should be turn off at this case. Since TMVP doesn't contribute much bit rate, turn it off as a default. Also SAO should be disabled. Change-Id: I0cefca33981966dfeae260e450d731e059748911 Signed-off-by: Johnson Ding --- mpp/codec/enc/h265/h265e_api.c | 3 +-- mpp/codec/enc/h265/h265e_ps.c | 8 ++++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/mpp/codec/enc/h265/h265e_api.c b/mpp/codec/enc/h265/h265e_api.c index bf5d7954..4435723d 100644 --- a/mpp/codec/enc/h265/h265e_api.c +++ b/mpp/codec/enc/h265/h265e_api.c @@ -90,13 +90,12 @@ static MPP_RET h265e_init(void *ctx, EncImplCfg *ctrlCfg) if (mpp_get_soc_type() == ROCKCHIP_SOC_RK3528) { h265->ctu_size = 32; h265->max_cu_size = 32; - h265->tmvp_enable = 0; } else { h265->ctu_size = 64; h265->max_cu_size = 64; - h265->tmvp_enable = 1; } + h265->tmvp_enable = 0; h265->amp_enable = 0; h265->sao_enable = 1; diff --git a/mpp/codec/enc/h265/h265e_ps.c b/mpp/codec/enc/h265/h265e_ps.c index 0e76e8d1..240344c8 100644 --- a/mpp/codec/enc/h265/h265e_ps.c +++ b/mpp/codec/enc/h265/h265e_ps.c @@ -321,6 +321,14 @@ MPP_RET h265e_set_sps(H265eCtx *ctx, H265eSps *sps, H265eVps *vps) } else if (cpb_info->max_st_tid) { sps->m_TMVPFlagsPresent = 0; } + + if (rc->drop_mode == MPP_ENC_RC_DROP_FRM_PSKIP) { + codec->tmvp_enable = 0; + sps->m_TMVPFlagsPresent = 0; + codec->sao_enable = 0; + sps->m_bUseSAO = 0; + } + sps->m_ptl = &vps->m_ptl; sps->m_vuiParametersPresentFlag = 1; if (sps->m_vuiParametersPresentFlag) {