ref: ab449cd9ba4e84b0ba594996d53910169fe41466
parent: f80a346e0e0171632c3422407245e4a382ce6b2d
parent: 86583b2bec22a846ab011fa06ee022ff7f3efa36
author: Dmitry Kovalev <[email protected]>
date: Thu Jun 12 09:24:42 EDT 2014
Merge "Adding is_altref_enabled() function."
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -588,8 +588,6 @@
cpi->oxcf = *oxcf;
cpi->pass = get_pass(cpi->oxcf.mode);
- if (cpi->oxcf.mode == REALTIME)
- cpi->oxcf.play_alternate = 0;
rc->baseline_gf_interval = DEFAULT_GF_INTERVAL;
cpi->ref_frame_flags = VP9_ALT_FLAG | VP9_GOLD_FLAG | VP9_LAST_FLAG;
@@ -2416,7 +2414,7 @@
cpi->refresh_alt_ref_frame = 0;
// Should we code an alternate reference frame.
- if (cpi->oxcf.play_alternate && rc->source_alt_ref_pending) {
+ if (is_altref_enabled(&cpi->oxcf) && rc->source_alt_ref_pending) {
int frames_to_arf;
#if CONFIG_MULTIPLE_ARF
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -284,6 +284,10 @@
vp8e_tuning tuning;
} VP9EncoderConfig;
+static INLINE int is_altref_enabled(const VP9EncoderConfig *cfg) {
+ return cfg->mode != REALTIME && cfg->play_alternate && cfg->lag_in_frames > 0;
+}
+
static INLINE int is_lossless_requested(const VP9EncoderConfig *cfg) {
return cfg->best_allowed_q == 0 && cfg->worst_allowed_q == 0;
}
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -1526,7 +1526,7 @@
double mv_in_out_accumulator = 0.0;
double abs_mv_in_out_accumulator = 0.0;
double mv_ratio_accumulator_thresh;
- unsigned int allow_alt_ref = oxcf->play_alternate && oxcf->lag_in_frames;
+ unsigned int allow_alt_ref = is_altref_enabled(oxcf);
int f_boost = 0;
int b_boost = 0;
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -1129,7 +1129,7 @@
rc->total_target_vs_actual = rc->total_actual_bits - rc->total_target_bits;
- if (oxcf->play_alternate && cpi->refresh_alt_ref_frame &&
+ if (is_altref_enabled(oxcf) && cpi->refresh_alt_ref_frame &&
(cm->frame_type != KEY_FRAME))
// Update the alternate reference frame stats as appropriate.
update_alt_ref_frame_stats(cpi);
@@ -1389,8 +1389,7 @@
// Extended interval for genuinely static scenes
rc->static_scene_max_gf_interval = oxcf->key_freq >> 1;
- // Special conditions when alt ref frame enabled
- if (oxcf->play_alternate && oxcf->lag_in_frames) {
+ if (is_altref_enabled(oxcf)) {
if (rc->static_scene_max_gf_interval > oxcf->lag_in_frames - 1)
rc->static_scene_max_gf_interval = oxcf->lag_in_frames - 1;
}