summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco <marpan@google.com>2017-09-26 10:18:43 -0700
committerMarco <marpan@google.com>2017-09-26 11:16:50 -0700
commitd5094cfde8850293bc7790190300533483651f9d (patch)
treee93767d2bcee4c6ef62bcd7ff1719942d9ffa265
parent9e52d3910bcb36789bc04b9be2db10c7c3fc459f (diff)
downloadlibvpx-d5094cfde8850293bc7790190300533483651f9d.tar
libvpx-d5094cfde8850293bc7790190300533483651f9d.tar.gz
libvpx-d5094cfde8850293bc7790190300533483651f9d.tar.bz2
libvpx-d5094cfde8850293bc7790190300533483651f9d.zip
Replace flag USE_ALTREF_FOR_ONE_PASS with speed feature.
To be used for 1 pass VBR. Off by default in speed features. Change-Id: I5d6110d6d191990db526fe68ec9715379a4d1754
-rw-r--r--vp9/encoder/vp9_ratectrl.c25
-rw-r--r--vp9/encoder/vp9_speed_features.c1
-rw-r--r--vp9/encoder/vp9_speed_features.h3
3 files changed, 12 insertions, 17 deletions
diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c
index 073c76ac0..fdf280d38 100644
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -46,9 +46,6 @@
#define FRAME_OVERHEAD_BITS 200
-// Use this macro to turn on/off use of alt-refs in one-pass vbr mode.
-#define USE_ALTREF_FOR_ONE_PASS 0
-
#if CONFIG_VP9_HIGHBITDEPTH
#define ASSIGN_MINQ_TABLE(bit_depth, name) \
do { \
@@ -594,13 +591,12 @@ int vp9_rc_regulate_q(const VP9_COMP *cpi, int target_bits_per_frame,
q = clamp(q, VPXMIN(cpi->rc.q_1_frame, cpi->rc.q_2_frame),
VPXMAX(cpi->rc.q_1_frame, cpi->rc.q_2_frame));
}
-#if USE_ALTREF_FOR_ONE_PASS
- if (cpi->oxcf.enable_auto_arf && cpi->oxcf.pass == 0 &&
- cpi->oxcf.rc_mode == VPX_VBR && cpi->oxcf.lag_in_frames > 0 &&
- cpi->rc.is_src_frame_alt_ref && !cpi->rc.alt_ref_gf_group) {
+ if (cpi->sf.use_altref_onepass && cpi->oxcf.enable_auto_arf &&
+ cpi->oxcf.pass == 0 && cpi->oxcf.rc_mode == VPX_VBR &&
+ cpi->oxcf.lag_in_frames > 0 && cpi->rc.is_src_frame_alt_ref &&
+ !cpi->rc.alt_ref_gf_group) {
q = VPXMIN(q, (q + cpi->rc.last_boosted_qindex) >> 1);
}
-#endif
return q;
}
@@ -1569,12 +1565,10 @@ void vp9_rc_get_one_pass_vbr_params(VP9_COMP *cpi) {
cpi->refresh_golden_frame = 1;
rc->source_alt_ref_pending = 0;
rc->alt_ref_gf_group = 0;
-#if USE_ALTREF_FOR_ONE_PASS
- if (cpi->oxcf.enable_auto_arf) {
+ if (cpi->sf.use_altref_onepass && cpi->oxcf.enable_auto_arf) {
rc->source_alt_ref_pending = 1;
rc->alt_ref_gf_group = 1;
}
-#endif
}
if (cm->frame_type == KEY_FRAME)
target = calc_iframe_target_size_one_pass_vbr(cpi);
@@ -2207,8 +2201,7 @@ static void adjust_gf_boost_lag_one_pass_vbr(VP9_COMP *cpi,
rc->af_ratio_onepass_vbr = 5;
rc->gfu_boost = DEFAULT_GF_BOOST >> 2;
}
-#if USE_ALTREF_FOR_ONE_PASS
- if (cpi->oxcf.enable_auto_arf) {
+ if (cpi->sf.use_altref_onepass && cpi->oxcf.enable_auto_arf) {
// Don't use alt-ref if there is a scene cut within the group,
// or content is not low.
if ((rc->high_source_sad_lagindex > 0 &&
@@ -2226,7 +2219,6 @@ static void adjust_gf_boost_lag_one_pass_vbr(VP9_COMP *cpi,
}
}
}
-#endif
target = calc_pframe_target_size_one_pass_vbr(cpi);
vp9_rc_set_frame_target(cpi, target);
}
@@ -2378,9 +2370,8 @@ void vp9_scene_detection_onepass(VP9_COMP *cpi) {
int target;
cpi->refresh_golden_frame = 1;
rc->source_alt_ref_pending = 0;
-#if USE_ALTREF_FOR_ONE_PASS
- if (cpi->oxcf.enable_auto_arf) rc->source_alt_ref_pending = 1;
-#endif
+ if (cpi->sf.use_altref_onepass && cpi->oxcf.enable_auto_arf)
+ rc->source_alt_ref_pending = 1;
rc->gfu_boost = DEFAULT_GF_BOOST >> 1;
rc->baseline_gf_interval =
VPXMIN(20, VPXMAX(10, rc->baseline_gf_interval));
diff --git a/vp9/encoder/vp9_speed_features.c b/vp9/encoder/vp9_speed_features.c
index 51abb2880..d7dac2660 100644
--- a/vp9/encoder/vp9_speed_features.c
+++ b/vp9/encoder/vp9_speed_features.c
@@ -365,6 +365,7 @@ static void set_rt_speed_feature_framesize_independent(
sf->use_source_sad = 0;
sf->use_simple_block_yrd = 0;
sf->adapt_partition_source_sad = 0;
+ sf->use_altref_onepass = 0;
if (speed >= 1) {
sf->allow_txfm_domain_distortion = 1;
diff --git a/vp9/encoder/vp9_speed_features.h b/vp9/encoder/vp9_speed_features.h
index bf266c4a3..517369dae 100644
--- a/vp9/encoder/vp9_speed_features.h
+++ b/vp9/encoder/vp9_speed_features.h
@@ -496,6 +496,9 @@ typedef struct SPEED_FEATURES {
// based on the nonrd-pickmode).
int adapt_partition_source_sad;
int adapt_partition_thresh;
+
+ // Enable use of alt-refs in 1 pass VBR.
+ int use_altref_onepass;
} SPEED_FEATURES;
struct VP9_COMP;