diff --git a/inc/rk_venc_cmd.h b/inc/rk_venc_cmd.h index b5beabf2..b4ad93ee 100644 --- a/inc/rk_venc_cmd.h +++ b/inc/rk_venc_cmd.h @@ -162,6 +162,9 @@ typedef enum MppEncRcCfgChange_e { MPP_ENC_RC_CFG_CHANGE_SKIP_CNT = (1 << 8), MPP_ENC_RC_CFG_CHANGE_MAX_REENC = (1 << 9), MPP_ENC_RC_CFG_CHANGE_DROP_FRM = (1 << 10), + MPP_ENC_RC_CFG_CHANGE_MAX_I_PROP = (1 << 11), + MPP_ENC_RC_CFG_CHANGE_MIN_I_PROP = (1 << 12), + MPP_ENC_RC_CFG_CHANGE_INIT_IP_RATIO = (1 << 13), MPP_ENC_RC_CFG_CHANGE_ALL = (0xFFFFFFFF), } MppEncRcCfgChange; @@ -306,6 +309,10 @@ typedef struct MppEncRcCfg_t { MppEncRcDropFrmMode drop_mode; RK_U32 drop_threshold; RK_U32 drop_gap; + + RK_S32 max_i_prop; + RK_S32 min_i_prop; + RK_S32 init_ip_ratio; } MppEncRcCfg; /* diff --git a/mpp/base/mpp_enc_cfg.cpp b/mpp/base/mpp_enc_cfg.cpp index 05acfb16..d7efd247 100644 --- a/mpp/base/mpp_enc_cfg.cpp +++ b/mpp/base/mpp_enc_cfg.cpp @@ -165,6 +165,9 @@ static const char *cfg_func_names[] = { ENTRY(rc, drop_mode, U32, MppEncRcDropFrmMode, MPP_ENC_RC_CFG_CHANGE_DROP_FRM, rc, drop_mode) \ ENTRY(rc, drop_thd, U32, RK_U32, MPP_ENC_RC_CFG_CHANGE_DROP_FRM, rc, drop_threshold) \ ENTRY(rc, drop_gap, U32, RK_U32, MPP_ENC_RC_CFG_CHANGE_DROP_FRM, rc, drop_gap) \ + ENTRY(rc, max_i_prop, S32, RK_S32, MPP_ENC_RC_CFG_CHANGE_MAX_I_PROP, rc, max_i_prop) \ + ENTRY(rc, min_i_prop, S32, RK_S32, MPP_ENC_RC_CFG_CHANGE_MIN_I_PROP, rc, min_i_prop) \ + ENTRY(rc, init_ip_ratio, S32, RK_S32, MPP_ENC_RC_CFG_CHANGE_INIT_IP_RATIO, rc, init_ip_ratio) \ /* prep config */ \ ENTRY(prep, width, S32, RK_S32, MPP_ENC_PREP_CFG_CHANGE_INPUT, prep, width) \ ENTRY(prep, height, S32, RK_S32, MPP_ENC_PREP_CFG_CHANGE_INPUT, prep, height) \ @@ -255,7 +258,7 @@ RK_S32 const_strlen(const char* str) return *str ? 1 + const_strlen(str + 1) : 0; } -static RK_S32 node_len = ENTRY_TABLE(EXPAND_AS_STRLEN) - 74; +static RK_S32 node_len = ENTRY_TABLE(EXPAND_AS_STRLEN) - 62; class MppEncCfgService { diff --git a/mpp/codec/enc/h264/h264e_api_v2.c b/mpp/codec/enc/h264/h264e_api_v2.c index 9c611bb0..7a1ceb0f 100644 --- a/mpp/codec/enc/h264/h264e_api_v2.c +++ b/mpp/codec/enc/h264/h264e_api_v2.c @@ -355,6 +355,15 @@ static MPP_RET h264e_proc_rc_cfg(MppEncRcCfg *dst, MppEncRcCfg *src) if (change & MPP_ENC_RC_CFG_CHANGE_MAX_REENC) dst->max_reenc_times = src->max_reenc_times; + if (change & MPP_ENC_RC_CFG_CHANGE_MAX_I_PROP) + dst->max_i_prop = src->max_i_prop; + + if (change & MPP_ENC_RC_CFG_CHANGE_MIN_I_PROP) + dst->min_i_prop = src->min_i_prop; + + if (change & MPP_ENC_RC_CFG_CHANGE_INIT_IP_RATIO) + dst->init_ip_ratio = src->init_ip_ratio; + // parameter checking if (dst->rc_mode >= MPP_ENC_RC_MODE_BUTT) { mpp_err("invalid rc mode %d should be RC_MODE_VBR or RC_MODE_CBR\n", diff --git a/mpp/codec/enc/h265/h265e_api_v2.c b/mpp/codec/enc/h265/h265e_api_v2.c index 23db599d..bd9c45f7 100644 --- a/mpp/codec/enc/h265/h265e_api_v2.c +++ b/mpp/codec/enc/h265/h265e_api_v2.c @@ -398,6 +398,18 @@ static MPP_RET h265e_proc_rc_cfg(MppEncRcCfg *dst, MppEncRcCfg *src) if (change & MPP_ENC_RC_CFG_CHANGE_GOP) dst->gop = src->gop; + if (change & MPP_ENC_RC_CFG_CHANGE_MAX_REENC) + dst->max_reenc_times = src->max_reenc_times; + + if (change & MPP_ENC_RC_CFG_CHANGE_MAX_I_PROP) + dst->max_i_prop = src->max_i_prop; + + if (change & MPP_ENC_RC_CFG_CHANGE_MIN_I_PROP) + dst->min_i_prop = src->min_i_prop; + + if (change & MPP_ENC_RC_CFG_CHANGE_INIT_IP_RATIO) + dst->init_ip_ratio = src->init_ip_ratio; + // parameter checking if (dst->rc_mode >= MPP_ENC_RC_MODE_BUTT) { mpp_err("invalid rc mode %d should be RC_MODE_VBR or RC_MODE_CBR\n",