mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-11-03 09:40:50 +08:00
[mpp_enc_cfg]: Add encoder I frame tuning config
Add max_i_prop, min_i_prop and init_ip_ration for I frame tuning config. max_i_prop: The max percentage of intra frame size in one gop. min_i_prop: The min percentage of intra frame size in one gop. init_ip_ration: Define the first I frame size is how many times of one P frame size. Set to 16 mean I frame size is equal to P frame size. Set to 160 mean I frame size is 10 times of P frame size. These three parameters are for tuning Intra frame quality. Change-Id: Iac1e700fe2a51fb3a6ad94753784cd54ee789176 Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
/*
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user