From 95670aa475b61812a457a041736e9dcb47d9b65d Mon Sep 17 00:00:00 2001 From: Herman Chen Date: Thu, 10 Sep 2020 16:19:24 +0800 Subject: [PATCH] [mpi]: Add rk_venc_rc.h 1. Add rk_venc_rc.h for rate control definitions. 2. Add drop parameter to set_rc_cfg. Change-Id: Iab27a1505ba187f512815f7ab00cd0ea7f863cb8 Signed-off-by: Herman Chen --- inc/mpp_rc_api.h | 5 +++++ inc/rk_venc_cmd.h | 16 +--------------- inc/rk_venc_rc.h | 38 ++++++++++++++++++++++++++++++++++++++ mpp/codec/mpp_enc_v2.cpp | 3 +++ 4 files changed, 47 insertions(+), 15 deletions(-) create mode 100644 inc/rk_venc_rc.h diff --git a/inc/mpp_rc_api.h b/inc/mpp_rc_api.h index 89eedf68..30b9eed2 100644 --- a/inc/mpp_rc_api.h +++ b/inc/mpp_rc_api.h @@ -18,6 +18,7 @@ #define __MPP_RC_API_H__ #include "mpp_err.h" +#include "rk_venc_rc.h" #include "mpp_rc_defs.h" /* @@ -151,6 +152,10 @@ typedef struct RcCfg_s { */ RK_S32 vbr_hi_prop; RK_S32 vbr_lo_prop; + + MppEncRcDropFrmMode drop_mode; + RK_U32 drop_thd; + RK_U32 drop_gap; } RcCfg; /* diff --git a/inc/rk_venc_cmd.h b/inc/rk_venc_cmd.h index ef2aa0df..5697ea31 100644 --- a/inc/rk_venc_cmd.h +++ b/inc/rk_venc_cmd.h @@ -18,6 +18,7 @@ #define __RK_VENC_CMD_H__ #include "mpp_frame.h" +#include "rk_venc_rc.h" /* * Configure of encoder is very complicated. So we divide configures into @@ -164,14 +165,6 @@ typedef enum MppEncRcCfgChange_e { MPP_ENC_RC_CFG_CHANGE_ALL = (0xFFFFFFFF), } MppEncRcCfgChange; -typedef enum MppEncRcMode_e { - MPP_ENC_RC_MODE_VBR, - MPP_ENC_RC_MODE_CBR, - MPP_ENC_RC_MODE_FIXQP, - MPP_ENC_RC_MODE_AVBR, - MPP_ENC_RC_MODE_BUTT -} MppEncRcMode; - typedef enum MppEncRcQuality_e { MPP_ENC_RC_QUALITY_WORST, MPP_ENC_RC_QUALITY_WORSE, @@ -183,13 +176,6 @@ typedef enum MppEncRcQuality_e { MPP_ENC_RC_QUALITY_BUTT } MppEncRcQuality; -typedef enum MppEncRcDropFrmMode_e { - MPP_ENC_RC_DROP_FRM_DISABLED, - MPP_ENC_RC_DROP_FRM_NORMAL, - MPP_ENC_RC_DROP_FRM_PSKIP, - MPP_ENC_RC_DROP_FRM_BUTT -} MppEncRcDropFrmMode; - typedef struct MppEncRcCfg_t { RK_U32 change; diff --git a/inc/rk_venc_rc.h b/inc/rk_venc_rc.h new file mode 100644 index 00000000..2017d66f --- /dev/null +++ b/inc/rk_venc_rc.h @@ -0,0 +1,38 @@ +/* + * Copyright 2015 Rockchip Electronics Co. LTD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __RK_VENC_RC_H__ +#define __RK_VENC_RC_H__ + +#include "rk_type.h" + +/* Rate control parameter */ +typedef enum MppEncRcMode_e { + MPP_ENC_RC_MODE_VBR, + MPP_ENC_RC_MODE_CBR, + MPP_ENC_RC_MODE_FIXQP, + MPP_ENC_RC_MODE_AVBR, + MPP_ENC_RC_MODE_BUTT +} MppEncRcMode; + +typedef enum MppEncRcDropFrmMode_e { + MPP_ENC_RC_DROP_FRM_DISABLED, + MPP_ENC_RC_DROP_FRM_NORMAL, + MPP_ENC_RC_DROP_FRM_PSKIP, + MPP_ENC_RC_DROP_FRM_BUTT +} MppEncRcDropFrmMode; + +#endif /*__RK_VENC_RC_H__*/ diff --git a/mpp/codec/mpp_enc_v2.cpp b/mpp/codec/mpp_enc_v2.cpp index a95cf566..cd50ff12 100644 --- a/mpp/codec/mpp_enc_v2.cpp +++ b/mpp/codec/mpp_enc_v2.cpp @@ -750,6 +750,9 @@ static void set_rc_cfg(RcCfg *cfg, MppEncCfgSet *cfg_set) cfg->layer_bit_prop[3] = 0; cfg->max_reencode_times = rc->max_reenc_times; + cfg->drop_mode = rc->drop_mode; + cfg->drop_thd = rc->drop_threshold; + cfg->drop_gap = rc->drop_gap; if (info->st_gop) { cfg->vgop = info->st_gop;