ref: 0eb88c9064c9e5e163d0771dac974c1ea321c3eb
parent: 690678fc422c2527ca74a86b2e9382f2f4ca2313
author: Marco Paniconi <[email protected]>
date: Thu Apr 3 11:49:03 EDT 2014
Add codec control function for enabling frame_periodic_boost. Change-Id: I6371ef7301c6bc3138552bd349e9bd154dee3e08
--- a/examples/vpx_temporal_scalable_patterns.c
+++ b/examples/vpx_temporal_scalable_patterns.c
@@ -575,6 +575,7 @@
} 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");
--- a/vp9/encoder/vp9_onyx_int.h
+++ b/vp9/encoder/vp9_onyx_int.h
@@ -232,6 +232,9 @@
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;
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -982,7 +982,7 @@
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)
--- a/vp9/encoder/vp9_speed_features.c
+++ b/vp9/encoder/vp9_speed_features.c
@@ -244,7 +244,7 @@
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 @@
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 @@
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;
+ }
}
--- a/vp9/encoder/vp9_speed_features.h
+++ b/vp9/encoder/vp9_speed_features.h
@@ -254,7 +254,7 @@
// 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;
--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -37,6 +37,7 @@
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 @@
0, // lossless
0, // frame_parallel_decoding_mode
NO_AQ, // aq_mode
+ 0, // frame_periodic_delta_q
}
}
};
@@ -150,7 +152,7 @@
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 @@
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 @@
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 @@
{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},
--- a/vpx/vp8cx.h
+++ b/vpx/vp8cx.h
@@ -192,6 +192,7 @@
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,
@@ -363,6 +364,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
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -400,13 +400,17 @@
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 @@
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