[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 <herman.chen@rock-chips.com>
This commit is contained in:
Herman Chen
2020-09-10 16:19:24 +08:00
parent a620c88e80
commit 95670aa475
4 changed files with 47 additions and 15 deletions

View File

@@ -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;
/*

View File

@@ -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;

38
inc/rk_venc_rc.h Normal file
View File

@@ -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__*/

View File

@@ -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;