From 1aa2d1a44409dfb6e02f1a5fe8f0f0a04fbcdc9f Mon Sep 17 00:00:00 2001 From: Adrian Grange <agrange@google.com> Date: Wed, 23 Apr 2014 11:11:23 -0700 Subject: [PATCH] Remove key_frame_frequency variable from VP9_COMP This member of VP9_COMP seemed unnecessary since it only shadowed VP9EncoderConfig.key_freq that is accessible through VP9_COMP. Change-Id: Ib751bb1cf1b0b3c50a2a527d7c34f6829dd6fee3 --- vp9/encoder/vp9_encoder.c | 1 - vp9/encoder/vp9_encoder.h | 2 -- vp9/encoder/vp9_firstpass.c | 12 ++++++------ vp9/encoder/vp9_ratectrl.c | 8 ++++---- vp9/encoder/vp9_svc_layercontext.c | 2 +- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 370825883b..6816f555ee 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -829,7 +829,6 @@ VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf) { sizeof(*cpi->mbgraph_stats[i].mb_stats), 1)); } - cpi->key_frame_frequency = cpi->oxcf.key_freq; cpi->refresh_alt_ref_frame = 0; #if CONFIG_MULTIPLE_ARF diff --git a/vp9/encoder/vp9_encoder.h b/vp9/encoder/vp9_encoder.h index de8f3c9148..8f3249407a 100644 --- a/vp9/encoder/vp9_encoder.h +++ b/vp9/encoder/vp9_encoder.h @@ -337,8 +337,6 @@ typedef struct VP9_COMP { YV12_BUFFER_CONFIG *unscaled_last_source; YV12_BUFFER_CONFIG scaled_last_source; - int key_frame_frequency; - int gold_is_last; // gold same as last frame ( short circuit gold searches) int alt_is_last; // Alt same as last ( short circuit altref search) int gold_is_alt; // don't do both alt and gold search ( just do gold). diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c index 1879b15e28..3d4b962590 100644 --- a/vp9/encoder/vp9_firstpass.c +++ b/vp9/encoder/vp9_firstpass.c @@ -1936,7 +1936,7 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { // Find the next keyframe. i = 0; while (twopass->stats_in < twopass->stats_in_end && - rc->frames_to_key < cpi->key_frame_frequency) { + rc->frames_to_key < cpi->oxcf.key_freq) { // Accumulate kf group error. kf_group_err += calculate_modified_err(cpi, this_frame); @@ -1966,7 +1966,7 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { // Special check for transition or high motion followed by a // static scene. - if (detect_transition_to_still(twopass, i, cpi->key_frame_frequency - i, + if (detect_transition_to_still(twopass, i, cpi->oxcf.key_freq - i, loop_decay_rate, decay_accumulator)) break; @@ -1974,8 +1974,8 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { ++rc->frames_to_key; // If we don't have a real key frame within the next two - // key_frame_frequency intervals then break out of the loop. - if (rc->frames_to_key >= 2 * (int)cpi->key_frame_frequency) + // key_freq intervals then break out of the loop. + if (rc->frames_to_key >= 2 * cpi->oxcf.key_freq) break; } else { ++rc->frames_to_key; @@ -1988,7 +1988,7 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { // This code centers the extra kf if the actual natural interval // is between 1x and 2x. if (cpi->oxcf.auto_key && - rc->frames_to_key > (int)cpi->key_frame_frequency) { + rc->frames_to_key > cpi->oxcf.key_freq) { FIRSTPASS_STATS tmp_frame = first_frame; rc->frames_to_key /= 2; @@ -2005,7 +2005,7 @@ static void find_next_key_frame(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) { } rc->next_key_frame_forced = 1; } else if (twopass->stats_in == twopass->stats_in_end || - rc->frames_to_key >= cpi->key_frame_frequency) { + rc->frames_to_key >= cpi->oxcf.key_freq) { rc->next_key_frame_forced = 1; } else { rc->next_key_frame_forced = 0; diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c index 2e35e5fbc7..6ebd9f3fa4 100644 --- a/vp9/encoder/vp9_ratectrl.c +++ b/vp9/encoder/vp9_ratectrl.c @@ -1215,7 +1215,7 @@ void vp9_rc_get_one_pass_vbr_params(VP9_COMP *cpi) { cm->frame_type = KEY_FRAME; rc->this_key_frame_forced = cm->current_video_frame != 0 && rc->frames_to_key == 0; - rc->frames_to_key = cpi->key_frame_frequency; + rc->frames_to_key = cpi->oxcf.key_freq; rc->kf_boost = DEFAULT_KF_BOOST; rc->source_alt_ref_active = 0; } else { @@ -1302,7 +1302,7 @@ void vp9_rc_get_svc_params(VP9_COMP *cpi) { if ((cm->current_video_frame == 0) || (cpi->frame_flags & FRAMEFLAGS_KEY) || (cpi->oxcf.auto_key && (rc->frames_since_key % - cpi->key_frame_frequency == 0))) { + cpi->oxcf.key_freq == 0))) { cm->frame_type = KEY_FRAME; rc->source_alt_ref_active = 0; if (cpi->pass == 0 && cpi->oxcf.rc_mode == RC_MODE_CBR) { @@ -1330,7 +1330,7 @@ void vp9_rc_get_one_pass_cbr_params(VP9_COMP *cpi) { cm->frame_type = KEY_FRAME; rc->this_key_frame_forced = cm->current_video_frame != 0 && rc->frames_to_key == 0; - rc->frames_to_key = cpi->key_frame_frequency; + rc->frames_to_key = cpi->oxcf.key_freq; rc->kf_boost = DEFAULT_KF_BOOST; rc->source_alt_ref_active = 0; target = calc_iframe_target_size_one_pass_cbr(cpi); @@ -1415,7 +1415,7 @@ void vp9_rc_update_framerate(VP9_COMP *cpi) { rc->max_gf_interval = 16; // Extended interval for genuinely static scenes - rc->static_scene_max_gf_interval = cpi->key_frame_frequency >> 1; + rc->static_scene_max_gf_interval = cpi->oxcf.key_freq >> 1; // Special conditions when alt ref frame enabled in lagged compress mode if (oxcf->play_alternate && oxcf->lag_in_frames) { diff --git a/vp9/encoder/vp9_svc_layercontext.c b/vp9/encoder/vp9_svc_layercontext.c index f59670d060..2379f35b51 100644 --- a/vp9/encoder/vp9_svc_layercontext.c +++ b/vp9/encoder/vp9_svc_layercontext.c @@ -153,7 +153,7 @@ void vp9_update_spatial_layer_framerate(VP9_COMP *const cpi, double framerate) { oxcf->two_pass_vbrmax_section) / 100); lrc->max_gf_interval = 16; - lrc->static_scene_max_gf_interval = cpi->key_frame_frequency >> 1; + lrc->static_scene_max_gf_interval = cpi->oxcf.key_freq >> 1; if (oxcf->play_alternate && oxcf->lag_in_frames) { if (lrc->max_gf_interval > oxcf->lag_in_frames - 1) -- GitLab