Commit 0eb88c90 authored by Marco Paniconi's avatar Marco Paniconi

Add codec control function for enabling frame_periodic_boost.

Change-Id: I6371ef7301c6bc3138552bd349e9bd154dee3e08
parent 690678fc
......@@ -575,6 +575,7 @@ int main(int argc, char **argv) {
} else if (strncmp(encoder->name, "vp9", 3) == 0) {
vpx_codec_control(&codec, VP8E_SET_CPUUSED, speed);
vpx_codec_control(&codec, VP9E_SET_AQ_MODE, 3);
vpx_codec_control(&codec, VP9E_SET_FRAME_PERIODIC_BOOST, 0);
vpx_codec_control(&codec, VP8E_SET_NOISE_SENSITIVITY, 0);
if (vpx_codec_control(&codec, VP9E_SET_SVC, 1)) {
die_codec(&codec, "Failed to set SVC");
......
......@@ -232,6 +232,9 @@ typedef struct {
int lossless;
AQ_MODE aq_mode; // Adaptive Quantization mode
// Enable feature to reduce the frame quantization every x frames.
int frame_periodic_boost;
// two pass datarate control
int two_pass_vbrbias; // two pass datarate control tweaks
int two_pass_vbrmin_section;
......
......@@ -982,7 +982,7 @@ int vp9_rc_pick_q_and_bounds(const VP9_COMP *cpi,
if (cpi->sf.use_nonrd_pick_mode) {
if (q == 0)
q++;
if (cpi->sf.force_ref_frame == 1)
if (cpi->sf.force_frame_boost == 1)
q -= cpi->sf.max_delta_qindex;
if (q < *bottom_index)
......
......@@ -244,7 +244,7 @@ static void set_rt_speed_feature(VP9_COMMON *cm,
sf->min_partition_size = BLOCK_8X8;
sf->partition_check =
(cm->current_video_frame % sf->last_partitioning_redo_frequency == 1);
sf->force_ref_frame = cm->frame_type == KEY_FRAME ||
sf->force_frame_boost = cm->frame_type == KEY_FRAME ||
(cm->current_video_frame %
(sf->last_partitioning_redo_frequency << 1) == 1);
sf->max_delta_qindex = (cm->frame_type == KEY_FRAME) ? 20 : 15;
......@@ -300,7 +300,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
sf->last_partitioning_redo_frequency = 4;
sf->disable_split_mask = 0;
sf->mode_search_skip_flags = 0;
sf->force_ref_frame = 0;
sf->force_frame_boost = 0;
sf->max_delta_qindex = 0;
sf->disable_split_var_thresh = 0;
sf->disable_filter_search_var_thresh = 0;
......@@ -368,4 +368,8 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
if (sf->disable_split_mask == DISABLE_ALL_SPLIT)
sf->adaptive_pred_interp_filter = 0;
if (!cpi->oxcf.frame_periodic_boost) {
sf->max_delta_qindex = 0;
}
}
......@@ -254,7 +254,7 @@ typedef struct {
// Use finer quantizer in every other few frames that run variable block
// partition type search.
int force_ref_frame;
int force_frame_boost;
// Maximally allowed base quantization index fluctuation.
int max_delta_qindex;
......
......@@ -37,6 +37,7 @@ struct vp9_extracfg {
unsigned int lossless;
unsigned int frame_parallel_decoding_mode;
AQ_MODE aq_mode;
unsigned int frame_periodic_boost;
};
struct extraconfig_map {
......@@ -65,6 +66,7 @@ static const struct extraconfig_map extracfg_map[] = {
0, // lossless
0, // frame_parallel_decoding_mode
NO_AQ, // aq_mode
0, // frame_periodic_delta_q
}
}
};
......@@ -150,7 +152,7 @@ static vpx_codec_err_t validate_config(vpx_codec_alg_priv_t *ctx,
RANGE_CHECK_HI(cfg, rc_min_quantizer, cfg->rc_max_quantizer);
RANGE_CHECK_BOOL(extra_cfg, lossless);
RANGE_CHECK(extra_cfg, aq_mode, 0, AQ_MODE_COUNT - 1);
RANGE_CHECK(extra_cfg, frame_periodic_boost, 0, 1);
RANGE_CHECK_HI(cfg, g_threads, 64);
RANGE_CHECK_HI(cfg, g_lag_in_frames, MAX_LAG_BUFFERS);
RANGE_CHECK(cfg, rc_end_usage, VPX_VBR, VPX_Q);
......@@ -360,6 +362,8 @@ static vpx_codec_err_t set_vp9e_config(VP9_CONFIG *oxcf,
oxcf->aq_mode = extra_cfg->aq_mode;
oxcf->frame_periodic_boost = extra_cfg->frame_periodic_boost;
oxcf->ss_number_layers = cfg->ss_number_layers;
if (oxcf->ss_number_layers > 1) {
......@@ -484,6 +488,7 @@ static vpx_codec_err_t set_param(vpx_codec_alg_priv_t *ctx, int ctrl_id,
MAP(VP9E_SET_FRAME_PARALLEL_DECODING,
extra_cfg.frame_parallel_decoding_mode);
MAP(VP9E_SET_AQ_MODE, extra_cfg.aq_mode);
MAP(VP9E_SET_FRAME_PERIODIC_BOOST, extra_cfg.frame_periodic_boost);
}
res = validate_config(ctx, &ctx->cfg, &extra_cfg);
......@@ -1094,6 +1099,7 @@ static vpx_codec_ctrl_fn_map_t vp9e_ctf_maps[] = {
{VP9E_SET_LOSSLESS, set_param},
{VP9E_SET_FRAME_PARALLEL_DECODING, set_param},
{VP9E_SET_AQ_MODE, set_param},
{VP9E_SET_FRAME_PERIODIC_BOOST, set_param},
{VP9_GET_REFERENCE, get_reference},
{VP9E_SET_SVC, vp9e_set_svc},
{VP9E_SET_SVC_PARAMETERS, vp9e_set_svc_parameters},
......
......@@ -192,6 +192,7 @@ enum vp8e_enc_control_id {
VP9E_SET_TILE_ROWS,
VP9E_SET_FRAME_PARALLEL_DECODING,
VP9E_SET_AQ_MODE,
VP9E_SET_FRAME_PERIODIC_BOOST,
VP9E_SET_SVC,
VP9E_SET_SVC_PARAMETERS,
......@@ -364,6 +365,8 @@ VPX_CTRL_USE_TYPE(VP9E_SET_FRAME_PARALLEL_DECODING, unsigned int)
VPX_CTRL_USE_TYPE(VP9E_SET_AQ_MODE, unsigned int)
VPX_CTRL_USE_TYPE(VP9E_SET_FRAME_PERIODIC_BOOST, unsigned int)
/*! @} - end defgroup vp8_encoder */
#ifdef __cplusplus
} // extern "C"
......
......@@ -400,13 +400,17 @@ static const arg_def_t frame_parallel_decoding = ARG_DEF(
NULL, "frame-parallel", 1, "Enable frame parallel decodability features");
static const arg_def_t aq_mode = ARG_DEF(
NULL, "aq-mode", 1,
"Adaptive q mode (0: off (by default), 1: variance 2: complexity)");
"Adaptive q mode (0: off (by default), 1: variance 2: complexity, "
"3: cyclic refresh)");
static const arg_def_t frame_periodic_boost = ARG_DEF(
NULL, "frame_boost", 1,
"Enable frame periodic boost (0: off (by default), 1: on)");
static const arg_def_t *vp9_args[] = {
&cpu_used, &auto_altref, &noise_sens, &sharpness, &static_thresh,
&tile_cols, &tile_rows, &arnr_maxframes, &arnr_strength, &arnr_type,
&tune_ssim, &cq_level, &max_intra_rate_pct, &lossless,
&frame_parallel_decoding, &aq_mode,
&frame_parallel_decoding, &aq_mode, &frame_periodic_boost,
NULL
};
static const int vp9_arg_ctrl_map[] = {
......@@ -416,6 +420,7 @@ static const int vp9_arg_ctrl_map[] = {
VP8E_SET_ARNR_MAXFRAMES, VP8E_SET_ARNR_STRENGTH, VP8E_SET_ARNR_TYPE,
VP8E_SET_TUNING, VP8E_SET_CQ_LEVEL, VP8E_SET_MAX_INTRA_BITRATE_PCT,
VP9E_SET_LOSSLESS, VP9E_SET_FRAME_PARALLEL_DECODING, VP9E_SET_AQ_MODE,
VP9E_SET_FRAME_PERIODIC_BOOST,
0
};
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment