Start to anonymize reference frames

Remove lst_fb_idx, gld_fb_idx, alt_fb_idx, refresh_last_frame,
refresh_golden_frame, refresh_alt_ref_frame from common. Gold/Alt are
encode side conventions. From the decoder's perspective, we want to be
dealing with numbered references.

Updates to active_ref 2 signal mode context switches, vestigial from
refresh_alt_ref_frame. This needs some clean up to make sense with
increased numbers of reference frames, as well as reimplementing the
swapping of alt/golden which was previously done using the
buffer-to-buffer copy mechanism removed in an earlier commit.

Change-Id: I7334445158b7666f9295d2a2dd22aa03f4485f58
This commit is contained in:
John Koleszar
2013-01-15 13:49:44 -08:00
parent 394b0a6a30
commit da832a80e4
16 changed files with 242 additions and 238 deletions

View File

@@ -258,8 +258,8 @@ void vp9_setup_key_frame(VP9_COMP *cpi) {
// interval before next GF
cpi->frames_till_gf_update_due = cpi->baseline_gf_interval;
cpi->common.refresh_golden_frame = TRUE;
cpi->common.refresh_alt_ref_frame = TRUE;
cpi->refresh_golden_frame = TRUE;
cpi->refresh_alt_ref_frame = TRUE;
vp9_init_mode_contexts(&cpi->common);
vpx_memcpy(&cpi->common.lfc, &cpi->common.fc, sizeof(cpi->common.fc));
@@ -285,7 +285,7 @@ void vp9_setup_key_frame(VP9_COMP *cpi) {
}
void vp9_setup_inter_frame(VP9_COMP *cpi) {
if (cpi->common.refresh_alt_ref_frame) {
if (cpi->refresh_alt_ref_frame) {
vpx_memcpy(&cpi->common.fc,
&cpi->common.lfc_a,
sizeof(cpi->common.fc));
@@ -358,7 +358,7 @@ static void calc_pframe_target_size(VP9_COMP *cpi) {
// Special alt reference frame case
if (cpi->common.refresh_alt_ref_frame) {
if (cpi->refresh_alt_ref_frame) {
// Per frame bit target for the alt ref frame
cpi->per_frame_bandwidth = cpi->twopass.gf_bits;
cpi->this_frame_target = cpi->per_frame_bandwidth;
@@ -377,7 +377,7 @@ static void calc_pframe_target_size(VP9_COMP *cpi) {
if (cpi->this_frame_target < min_frame_target)
cpi->this_frame_target = min_frame_target;
if (!cpi->common.refresh_alt_ref_frame)
if (!cpi->refresh_alt_ref_frame)
// Note the baseline target data rate for this inter frame.
cpi->inter_frame_target = cpi->this_frame_target;
@@ -386,7 +386,7 @@ static void calc_pframe_target_size(VP9_COMP *cpi) {
// int Boost = 0;
int Q = (cpi->oxcf.fixed_q < 0) ? cpi->last_q[INTER_FRAME] : cpi->oxcf.fixed_q;
cpi->common.refresh_golden_frame = TRUE;
cpi->refresh_golden_frame = TRUE;
calc_gf_params(cpi);
@@ -431,7 +431,7 @@ void vp9_update_rate_correction_factors(VP9_COMP *cpi, int damp_var) {
if (cpi->common.frame_type == KEY_FRAME) {
rate_correction_factor = cpi->key_frame_rate_correction_factor;
} else {
if (cpi->common.refresh_alt_ref_frame || cpi->common.refresh_golden_frame)
if (cpi->refresh_alt_ref_frame || cpi->refresh_golden_frame)
rate_correction_factor = cpi->gf_rate_correction_factor;
else
rate_correction_factor = cpi->rate_correction_factor;
@@ -505,7 +505,7 @@ void vp9_update_rate_correction_factors(VP9_COMP *cpi, int damp_var) {
if (cpi->common.frame_type == KEY_FRAME)
cpi->key_frame_rate_correction_factor = rate_correction_factor;
else {
if (cpi->common.refresh_alt_ref_frame || cpi->common.refresh_golden_frame)
if (cpi->refresh_alt_ref_frame || cpi->refresh_golden_frame)
cpi->gf_rate_correction_factor = rate_correction_factor;
else
cpi->rate_correction_factor = rate_correction_factor;
@@ -529,7 +529,7 @@ int vp9_regulate_q(VP9_COMP *cpi, int target_bits_per_frame) {
if (cpi->common.frame_type == KEY_FRAME)
correction_factor = cpi->key_frame_rate_correction_factor;
else {
if (cpi->common.refresh_alt_ref_frame || cpi->common.refresh_golden_frame)
if (cpi->refresh_alt_ref_frame || cpi->refresh_golden_frame)
correction_factor = cpi->gf_rate_correction_factor;
else
correction_factor = cpi->rate_correction_factor;
@@ -570,7 +570,8 @@ int vp9_regulate_q(VP9_COMP *cpi, int target_bits_per_frame) {
if (cpi->common.frame_type == KEY_FRAME)
zbin_oqmax = 0; // ZBIN_OQ_MAX/16
else if (cpi->common.refresh_alt_ref_frame || (cpi->common.refresh_golden_frame && !cpi->source_alt_ref_active))
else if (cpi->refresh_alt_ref_frame
|| (cpi->refresh_golden_frame && !cpi->source_alt_ref_active))
zbin_oqmax = 16;
else
zbin_oqmax = ZBIN_OQ_MAX;
@@ -671,7 +672,7 @@ void vp9_compute_frame_size_bounds(VP9_COMP *cpi, int *frame_under_shoot_limit,
*frame_over_shoot_limit = cpi->this_frame_target * 9 / 8;
*frame_under_shoot_limit = cpi->this_frame_target * 7 / 8;
} else {
if (cpi->common.refresh_alt_ref_frame || cpi->common.refresh_golden_frame) {
if (cpi->refresh_alt_ref_frame || cpi->refresh_golden_frame) {
*frame_over_shoot_limit = cpi->this_frame_target * 9 / 8;
*frame_under_shoot_limit = cpi->this_frame_target * 7 / 8;
} else {