Merge "VP[89]_COMMON: remove golden/altref frame counts"
This commit is contained in:
commit
76db4d599a
@ -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. */
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -171,9 +171,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. */
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -378,7 +378,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;
|
||||
@ -2175,7 +2175,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)
|
||||
@ -2191,7 +2191,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.
|
||||
@ -2213,10 +2213,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++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3620,7 +3620,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)
|
||||
|
@ -310,6 +310,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
|
||||
|
||||
@ -392,6 +393,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)
|
||||
|
Loading…
Reference in New Issue
Block a user