Moving mbs_tested_so_far, mode_test_hit_counts to macroblock struct

Change-Id: Ifa78c0a953fab3e5dd7af0446924846c7022cd09
This commit is contained in:
Scott LaVarnway 2012-12-04 16:52:47 -08:00
parent 9961ad479a
commit bfca084fcd
6 changed files with 18 additions and 14 deletions

View File

@ -140,6 +140,8 @@ typedef struct macroblock
int rd_thresh_mult[MAX_MODES]; int rd_thresh_mult[MAX_MODES];
int rd_threshes[MAX_MODES]; int rd_threshes[MAX_MODES];
unsigned int mbs_tested_so_far;
unsigned int mode_test_hit_counts[MAX_MODES];
void (*short_fdct4x4)(short *input, short *output, int pitch); void (*short_fdct4x4)(short *input, short *output, int pitch);

View File

@ -482,7 +482,7 @@ void vp8cx_init_mbrthread_data(VP8_COMP *cpi,
mb->prediction_error = 0; mb->prediction_error = 0;
mb->intra_error = 0; mb->intra_error = 0;
vp8_zero(mb->count_mb_ref_frame_usage); vp8_zero(mb->count_mb_ref_frame_usage);
mb->mbs_tested_so_far = 0;
} }
} }

View File

@ -640,11 +640,10 @@ void vp8_set_speed_features(VP8_COMP *cpi)
for (i = 0; i < MAX_MODES; i ++) for (i = 0; i < MAX_MODES; i ++)
{ {
cpi->mode_check_freq[i] = 0; cpi->mode_check_freq[i] = 0;
cpi->mode_test_hit_counts[i] = 0;
cpi->mode_chosen_counts[i] = 0; cpi->mode_chosen_counts[i] = 0;
} }
cpi->mbs_tested_so_far = 0; cpi->mb.mbs_tested_so_far = 0;
/* best quality defaults */ /* best quality defaults */
sf->RD = 1; sf->RD = 1;

View File

@ -349,9 +349,7 @@ typedef struct VP8_COMP
int ambient_err; int ambient_err;
unsigned int mode_check_freq[MAX_MODES]; unsigned int mode_check_freq[MAX_MODES];
unsigned int mode_test_hit_counts[MAX_MODES];
unsigned int mode_chosen_counts[MAX_MODES]; unsigned int mode_chosen_counts[MAX_MODES];
unsigned int mbs_tested_so_far;
int rd_baseline_thresh[MAX_MODES]; int rd_baseline_thresh[MAX_MODES];

View File

@ -680,7 +680,7 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
get_predictor_pointers(cpi, plane, recon_yoffset, recon_uvoffset); get_predictor_pointers(cpi, plane, recon_yoffset, recon_uvoffset);
/* Count of the number of MBs tested so far this frame */ /* Count of the number of MBs tested so far this frame */
cpi->mbs_tested_so_far++; x->mbs_tested_so_far++;
*returnintra = INT_MAX; *returnintra = INT_MAX;
x->skip = 0; x->skip = 0;
@ -746,11 +746,11 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
/* Check to see if the testing frequency for this mode is at its max /* Check to see if the testing frequency for this mode is at its max
* If so then prevent it from being tested and increase the threshold * If so then prevent it from being tested and increase the threshold
* for its testing */ * for its testing */
if (cpi->mode_test_hit_counts[mode_index] && if (x->mode_test_hit_counts[mode_index] &&
(cpi->mode_check_freq[mode_index] > 1)) (cpi->mode_check_freq[mode_index] > 1))
{ {
if (cpi->mbs_tested_so_far <= (cpi->mode_check_freq[mode_index] * if (x->mbs_tested_so_far <= (cpi->mode_check_freq[mode_index] *
cpi->mode_test_hit_counts[mode_index])) x->mode_test_hit_counts[mode_index]))
{ {
/* Increase the threshold for coding this mode to make it less /* Increase the threshold for coding this mode to make it less
* likely to be chosen */ * likely to be chosen */
@ -769,7 +769,7 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
/* We have now reached the point where we are going to test the current /* We have now reached the point where we are going to test the current
* mode so increment the counter for the number of times it has been * mode so increment the counter for the number of times it has been
* tested */ * tested */
cpi->mode_test_hit_counts[mode_index] ++; x->mode_test_hit_counts[mode_index] ++;
rate2 = 0; rate2 = 0;
distortion2 = 0; distortion2 = 0;

View File

@ -265,6 +265,11 @@ void vp8_initialize_rd_consts(VP8_COMP *cpi, MACROBLOCK *x, int Qvalue)
vp8_set_speed_features(cpi); vp8_set_speed_features(cpi);
for (i = 0; i < MAX_MODES; i++)
{
x->mode_test_hit_counts[i] = 0;
}
q = (int)pow(Qvalue, 1.25); q = (int)pow(Qvalue, 1.25);
if (q < 8) if (q < 8)
@ -2010,7 +2015,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
*returnintra = INT_MAX; *returnintra = INT_MAX;
/* Count of the number of MBs tested so far this frame */ /* Count of the number of MBs tested so far this frame */
cpi->mbs_tested_so_far++; x->mbs_tested_so_far++;
x->skip = 0; x->skip = 0;
@ -2068,9 +2073,9 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
* max If so then prevent it from being tested and increase the * max If so then prevent it from being tested and increase the
* threshold for its testing * threshold for its testing
*/ */
if (cpi->mode_test_hit_counts[mode_index] && (cpi->mode_check_freq[mode_index] > 1)) if (x->mode_test_hit_counts[mode_index] && (cpi->mode_check_freq[mode_index] > 1))
{ {
if (cpi->mbs_tested_so_far <= cpi->mode_check_freq[mode_index] * cpi->mode_test_hit_counts[mode_index]) if (x->mbs_tested_so_far <= cpi->mode_check_freq[mode_index] * x->mode_test_hit_counts[mode_index])
{ {
/* Increase the threshold for coding this mode to make it /* Increase the threshold for coding this mode to make it
* less likely to be chosen * less likely to be chosen
@ -2092,7 +2097,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
* current mode so increment the counter for the number of times * current mode so increment the counter for the number of times
* it has been tested * it has been tested
*/ */
cpi->mode_test_hit_counts[mode_index] ++; x->mode_test_hit_counts[mode_index] ++;
/* Experimental code. Special case for gf and arf zeromv modes. /* Experimental code. Special case for gf and arf zeromv modes.
* Increase zbin size to supress noise * Increase zbin size to supress noise