From: James Zern Date: Thu, 18 Jul 2013 21:09:21 +0000 (-0700) Subject: VP[89]_COMMON: remove golden/altref frame counts X-Git-Tag: v1.3.0~781^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5f30a0c687821081f313054b3e06320c989722cd;p=platform%2Fupstream%2Flibvpx.git VP[89]_COMMON: remove golden/altref frame counts these are only used in the encoder. frames_since_golden / frames_till_alt_ref_frame -> VP[89]_COMP Change-Id: Ie14a6f46987bced685ddb449b85dc261caba6dfe --- diff --git a/vp8/common/onyxc_int.h b/vp8/common/onyxc_int.h index a0c97a1..e9bb7af 100644 --- a/vp8/common/onyxc_int.h +++ b/vp8/common/onyxc_int.h @@ -114,9 +114,6 @@ typedef struct VP8Common int uvdc_delta_q; int uvac_delta_q; - unsigned int frames_since_golden; - unsigned int frames_till_alt_ref_frame; - /* We allocate a MODE_INFO struct for each macroblock, together with an extra row on top and column on the left to simplify prediction. */ diff --git a/vp8/encoder/firstpass.c b/vp8/encoder/firstpass.c index 4eac3b6..ded0c43 100644 --- a/vp8/encoder/firstpass.c +++ b/vp8/encoder/firstpass.c @@ -2398,7 +2398,7 @@ static void assign_std_frame_bits(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame) target_frame_size += cpi->min_frame_bandwidth; /* Every other frame gets a few extra bits */ - if ( (cpi->common.frames_since_golden & 0x01) && + if ( (cpi->frames_since_golden & 0x01) && (cpi->frames_till_gf_update_due > 0) ) { target_frame_size += cpi->twopass.alt_extra_bits; diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c index c73060f..7c07975 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@ -2750,7 +2750,7 @@ static void update_alt_ref_frame_stats(VP8_COMP *cpi) cpi->gf_active_count = cm->mb_rows * cm->mb_cols; /* this frame refreshes means next frames don't unless specified by user */ - cpi->common.frames_since_golden = 0; + cpi->frames_since_golden = 0; /* Clear the alternate reference update pending flag. */ cpi->source_alt_ref_pending = 0; @@ -2802,7 +2802,7 @@ static void update_golden_frame_stats(VP8_COMP *cpi) * user */ cm->refresh_golden_frame = 0; - cpi->common.frames_since_golden = 0; + cpi->frames_since_golden = 0; cpi->recent_ref_frame_usage[INTRA_FRAME] = 1; cpi->recent_ref_frame_usage[LAST_FRAME] = 1; @@ -2834,12 +2834,12 @@ static void update_golden_frame_stats(VP8_COMP *cpi) if (cpi->frames_till_gf_update_due > 0) cpi->frames_till_gf_update_due--; - if (cpi->common.frames_till_alt_ref_frame) - cpi->common.frames_till_alt_ref_frame --; + if (cpi->frames_till_alt_ref_frame) + cpi->frames_till_alt_ref_frame --; - cpi->common.frames_since_golden ++; + cpi->frames_since_golden ++; - if (cpi->common.frames_since_golden > 1) + if (cpi->frames_since_golden > 1) { cpi->recent_ref_frame_usage[INTRA_FRAME] += cpi->mb.count_mb_ref_frame_usage[INTRA_FRAME]; @@ -2890,11 +2890,11 @@ static void update_rd_ref_frame_probs(VP8_COMP *cpi) cpi->prob_last_coded = 200; cpi->prob_gf_coded = 1; } - else if (cpi->common.frames_since_golden == 0) + else if (cpi->frames_since_golden == 0) { cpi->prob_last_coded = 214; } - else if (cpi->common.frames_since_golden == 1) + else if (cpi->frames_since_golden == 1) { cpi->prob_last_coded = 192; cpi->prob_gf_coded = 220; @@ -4934,7 +4934,7 @@ int vp8_get_compressed_data(VP8_COMP *cpi, unsigned int *frame_flags, unsigned l cpi->frames_till_gf_update_due); force_src_buffer = &cpi->alt_ref_buffer; } - cm->frames_till_alt_ref_frame = cpi->frames_till_gf_update_due; + cpi->frames_till_alt_ref_frame = cpi->frames_till_gf_update_due; cm->refresh_alt_ref_frame = 1; cm->refresh_golden_frame = 0; cm->refresh_last_frame = 0; diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h index f49cfe3..3ab0fe8 100644 --- a/vp8/encoder/onyx_int.h +++ b/vp8/encoder/onyx_int.h @@ -320,6 +320,7 @@ typedef struct VP8_COMP YV12_BUFFER_CONFIG scaled_source; YV12_BUFFER_CONFIG *last_frame_unscaled_source; + unsigned int frames_till_alt_ref_frame; /* frame in src_buffers has been identified to be encoded as an alt ref */ int source_alt_ref_pending; /* an alt ref frame has been encoded and is usable */ @@ -369,6 +370,7 @@ typedef struct VP8_COMP double key_frame_rate_correction_factor; double gf_rate_correction_factor; + unsigned int frames_since_golden; /* Count down till next GF */ int frames_till_gf_update_due; diff --git a/vp8/encoder/ratectrl.c b/vp8/encoder/ratectrl.c index fd71b9a..1e8259c 100644 --- a/vp8/encoder/ratectrl.c +++ b/vp8/encoder/ratectrl.c @@ -234,7 +234,7 @@ void vp8_save_coding_context(VP8_COMP *cpi) cc->frames_since_key = cpi->frames_since_key; cc->filter_level = cpi->common.filter_level; cc->frames_till_gf_update_due = cpi->frames_till_gf_update_due; - cc->frames_since_golden = cpi->common.frames_since_golden; + cc->frames_since_golden = cpi->frames_since_golden; vp8_copy(cc->mvc, cpi->common.fc.mvc); vp8_copy(cc->mvcosts, cpi->rd_costs.mvcosts); @@ -271,7 +271,7 @@ void vp8_restore_coding_context(VP8_COMP *cpi) cpi->frames_since_key = cc->frames_since_key; cpi->common.filter_level = cc->filter_level; cpi->frames_till_gf_update_due = cc->frames_till_gf_update_due; - cpi->common.frames_since_golden = cc->frames_since_golden; + cpi->frames_since_golden = cc->frames_since_golden; vp8_copy(cpi->common.fc.mvc, cc->mvc); @@ -715,7 +715,7 @@ static void calc_pframe_target_size(VP8_COMP *cpi) if (Adjustment > (cpi->this_frame_target - min_frame_target)) Adjustment = (cpi->this_frame_target - min_frame_target); - if (cpi->common.frames_since_golden == (cpi->current_gf_interval >> 1)) + if (cpi->frames_since_golden == (cpi->current_gf_interval >> 1)) cpi->this_frame_target += ((cpi->current_gf_interval - 1) * Adjustment); else cpi->this_frame_target -= Adjustment; diff --git a/vp9/common/vp9_onyxc_int.h b/vp9/common/vp9_onyxc_int.h index 8d5743b..8ee2e27 100644 --- a/vp9/common/vp9_onyxc_int.h +++ b/vp9/common/vp9_onyxc_int.h @@ -192,9 +192,6 @@ typedef struct VP9Common { int a_ac_delta_q; #endif - unsigned int frames_since_golden; - unsigned int frames_till_alt_ref_frame; - /* We allocate a MODE_INFO struct for each macroblock, together with an extra row on top and column on the left to simplify prediction. */ diff --git a/vp9/encoder/vp9_mbgraph.c b/vp9/encoder/vp9_mbgraph.c index 9637393..7d6db07 100644 --- a/vp9/encoder/vp9_mbgraph.c +++ b/vp9/encoder/vp9_mbgraph.c @@ -406,8 +406,8 @@ void vp9_update_mbgraph_stats(VP9_COMP *cpi) { // being a GF - so exit if we don't look ahead beyond that if (n_frames <= cpi->frames_till_gf_update_due) return; - if (n_frames > (int)cpi->common.frames_till_alt_ref_frame) - n_frames = cpi->common.frames_till_alt_ref_frame; + if (n_frames > (int)cpi->frames_till_alt_ref_frame) + n_frames = cpi->frames_till_alt_ref_frame; if (n_frames > MAX_LAG_BUFFERS) n_frames = MAX_LAG_BUFFERS; diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c index 500bdfe..a8e0d67 100644 --- a/vp9/encoder/vp9_onyx_if.c +++ b/vp9/encoder/vp9_onyx_if.c @@ -351,7 +351,7 @@ static void configure_static_seg_features(VP9_COMP *cpi) { // All other frames if segmentation has been enabled // First normal frame in a valid gf or alt ref group - if (cpi->common.frames_since_golden == 0) { + if (cpi->frames_since_golden == 0) { // Set up segment features for normal frames in an arf group if (cpi->source_alt_ref_active) { xd->seg.update_map = 0; @@ -2151,7 +2151,7 @@ static void scale_and_extend_frame(YV12_BUFFER_CONFIG *src_fb, static void update_alt_ref_frame_stats(VP9_COMP *cpi) { // this frame refreshes means next frames don't unless specified by user - cpi->common.frames_since_golden = 0; + cpi->frames_since_golden = 0; #if CONFIG_MULTIPLE_ARF if (!cpi->multi_arf_enabled) @@ -2167,7 +2167,7 @@ static void update_golden_frame_stats(VP9_COMP *cpi) { if (cpi->refresh_golden_frame) { // this frame refreshes means next frames don't unless specified by user cpi->refresh_golden_frame = 0; - cpi->common.frames_since_golden = 0; + cpi->frames_since_golden = 0; // ******** Fixed Q test code only ************ // If we are going to use the ALT reference for the next group of frames set a flag to say so. @@ -2189,10 +2189,10 @@ static void update_golden_frame_stats(VP9_COMP *cpi) { if (cpi->frames_till_gf_update_due > 0) cpi->frames_till_gf_update_due--; - if (cpi->common.frames_till_alt_ref_frame) - cpi->common.frames_till_alt_ref_frame--; + if (cpi->frames_till_alt_ref_frame) + cpi->frames_till_alt_ref_frame--; - cpi->common.frames_since_golden++; + cpi->frames_since_golden++; } } @@ -3596,7 +3596,7 @@ int vp9_get_compressed_data(VP9_PTR ptr, unsigned int *frame_flags, cpi->is_src_frame_alt_ref = 0; // TODO(agrange) This needs to vary depending on where the next ARF is. - cm->frames_till_alt_ref_frame = frames_to_arf; + cpi->frames_till_alt_ref_frame = frames_to_arf; #if CONFIG_MULTIPLE_ARF if (!cpi->multi_arf_enabled) diff --git a/vp9/encoder/vp9_onyx_int.h b/vp9/encoder/vp9_onyx_int.h index 19b1e3a..6c5248f 100644 --- a/vp9/encoder/vp9_onyx_int.h +++ b/vp9/encoder/vp9_onyx_int.h @@ -313,6 +313,7 @@ typedef struct VP9_COMP { YV12_BUFFER_CONFIG *un_scaled_source; YV12_BUFFER_CONFIG scaled_source; + unsigned int frames_till_alt_ref_frame; int source_alt_ref_pending; // frame in src_buffers has been identified to be encoded as an alt ref int source_alt_ref_active; // an alt ref frame has been encoded and is usable @@ -395,6 +396,7 @@ typedef struct VP9_COMP { double key_frame_rate_correction_factor; double gf_rate_correction_factor; + unsigned int frames_since_golden; int frames_till_gf_update_due; // Count down till next GF int gf_overspend_bits; // Total bits overspent becasue of GF boost (cumulative)