diff options
author | Dmitry Kovalev <dkovalev@google.com> | 2014-06-12 12:13:20 -0700 |
---|---|---|
committer | Dmitry Kovalev <dkovalev@google.com> | 2014-06-12 12:13:20 -0700 |
commit | 86583b2bec22a846ab011fa06ee022ff7f3efa36 (patch) | |
tree | bc893f1a78ac3ab98d3f3150daaa77bdd531aa4e | |
parent | d5ae43318e5910e9ed96219aa6345915295bda8e (diff) | |
download | libvpx-86583b2bec22a846ab011fa06ee022ff7f3efa36.tar libvpx-86583b2bec22a846ab011fa06ee022ff7f3efa36.tar.gz libvpx-86583b2bec22a846ab011fa06ee022ff7f3efa36.tar.bz2 libvpx-86583b2bec22a846ab011fa06ee022ff7f3efa36.zip |
Adding is_altref_enabled() function.
Change-Id: I54cdb4ce11590511e6f86bc2fd55771f1c18a20a
-rw-r--r-- | vp9/encoder/vp9_encoder.c | 4 | ||||
-rw-r--r-- | vp9/encoder/vp9_encoder.h | 4 | ||||
-rw-r--r-- | vp9/encoder/vp9_firstpass.c | 2 | ||||
-rw-r--r-- | vp9/encoder/vp9_ratectrl.c | 5 |
4 files changed, 8 insertions, 7 deletions
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 6c0e0b58d..aa7a91dc1 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -588,8 +588,6 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) { 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 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags, 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 diff --git a/vp9/encoder/vp9_encoder.h b/vp9/encoder/vp9_encoder.h index 7e8206119..6b0e228ca 100644 --- a/vp9/encoder/vp9_encoder.h +++ b/vp9/encoder/vp9_encoder.h @@ -284,6 +284,10 @@ typedef struct VP9EncoderConfig { 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; } diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c index d008c63d0..3217313f9 100644 --- a/vp9/encoder/vp9_firstpass.c +++ b/vp9/encoder/vp9_firstpass.c @@ -1526,7 +1526,7 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { 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; diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c index e8e425661..143c23ba9 100644 --- a/vp9/encoder/vp9_ratectrl.c +++ b/vp9/encoder/vp9_ratectrl.c @@ -1129,7 +1129,7 @@ void vp9_rc_postencode_update(VP9_COMP *cpi, uint64_t bytes_used) { 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 @@ void vp9_rc_set_gf_max_interval(const VP9EncoderConfig *const oxcf, // 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; } |