Add RC mode to vpx external RC interface
Bug: b/295507002 Change-Id: Id2dd21482828ec64eef9abdf6a1cca83100d21ba
This commit is contained in:
+10
-1
@@ -1949,7 +1949,7 @@ static vpx_codec_err_t ctrl_set_external_rate_control(vpx_codec_alg_priv_t *ctx,
|
||||
// TODO(angiebird): Check the possibility of this flag being set at pass == 1
|
||||
if (oxcf->pass == 2) {
|
||||
const FRAME_INFO *frame_info = &cpi->frame_info;
|
||||
vpx_rc_config_t ratectrl_config;
|
||||
vpx_rc_config_t ratectrl_config = {};
|
||||
vpx_codec_err_t codec_status;
|
||||
|
||||
ratectrl_config.frame_width = frame_info->frame_width;
|
||||
@@ -1962,6 +1962,15 @@ static vpx_codec_err_t ctrl_set_external_rate_control(vpx_codec_alg_priv_t *ctx,
|
||||
ratectrl_config.frame_rate_num = oxcf->g_timebase.den;
|
||||
ratectrl_config.frame_rate_den = oxcf->g_timebase.num;
|
||||
|
||||
if (oxcf->rc_mode == VPX_VBR) {
|
||||
ratectrl_config.rc_mode = VPX_RC_VBR;
|
||||
ratectrl_config.overshoot_percent = oxcf->over_shoot_pct;
|
||||
ratectrl_config.undershoot_percent = oxcf->under_shoot_pct;
|
||||
} else if (oxcf->rc_mode == VPX_Q) {
|
||||
ratectrl_config.rc_mode = VPX_RC_QMODE;
|
||||
} else {
|
||||
return VPX_CODEC_INVALID_PARAM;
|
||||
}
|
||||
codec_status = vp9_extrc_create(funcs, ratectrl_config, ext_ratectrl);
|
||||
if (codec_status != VPX_CODEC_OK) {
|
||||
return codec_status;
|
||||
|
||||
@@ -48,6 +48,13 @@ typedef enum vpx_rc_type {
|
||||
VPX_RC_GOP_QP_RDMULT = VPX_RC_QP | VPX_RC_GOP | VPX_RC_RDMULT
|
||||
} vpx_rc_type_t;
|
||||
|
||||
/*!\brief The rate control mode for the external rate control model.
|
||||
*/
|
||||
typedef enum vpx_ext_rc_mode {
|
||||
VPX_RC_QMODE = 0,
|
||||
VPX_RC_VBR = 1,
|
||||
} vpx_ext_rc_mode_t;
|
||||
|
||||
/*!\brief Abstract rate control model handler
|
||||
*
|
||||
* The encoder will receive the model handler from create_model() defined in
|
||||
@@ -305,6 +312,13 @@ typedef struct vpx_rc_config {
|
||||
int target_bitrate_kbps;
|
||||
int frame_rate_num; /**< numerator of frame rate */
|
||||
int frame_rate_den; /**< denominator of frame rate */
|
||||
/*!
|
||||
* The following fields are only for external rate control models that support
|
||||
* different rate control modes.
|
||||
*/
|
||||
vpx_ext_rc_mode_t rc_mode; /**< Q mode or VBR mode */
|
||||
int overshoot_percent; /**< for VBR mode only */
|
||||
int undershoot_percent; /**< for VBR mode only */
|
||||
} vpx_rc_config_t;
|
||||
|
||||
/*!\brief Information passed to the external rate control model to
|
||||
|
||||
Reference in New Issue
Block a user