Adding is_altref_enabled() function.

Change-Id: I54cdb4ce11590511e6f86bc2fd55771f1c18a20a
This commit is contained in:
Dmitry Kovalev 2014-06-12 12:13:20 -07:00
parent d5ae43318e
commit 86583b2bec
4 changed files with 8 additions and 7 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}