Commit bfca084f authored by Scott LaVarnway's avatar Scott LaVarnway
Browse files

Moving mbs_tested_so_far, mode_test_hit_counts to macroblock struct

Change-Id: Ifa78c0a953fab3e5dd7af0446924846c7022cd09
parent 9961ad47
......@@ -140,6 +140,8 @@ typedef struct macroblock
int rd_thresh_mult[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);
......
......@@ -482,7 +482,7 @@ void vp8cx_init_mbrthread_data(VP8_COMP *cpi,
mb->prediction_error = 0;
mb->intra_error = 0;
vp8_zero(mb->count_mb_ref_frame_usage);
mb->mbs_tested_so_far = 0;
}
}
......
......@@ -640,11 +640,10 @@ void vp8_set_speed_features(VP8_COMP *cpi)
for (i = 0; i < MAX_MODES; i ++)
{
cpi->mode_check_freq[i] = 0;
cpi->mode_test_hit_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 */
sf->RD = 1;
......
......@@ -349,9 +349,7 @@ typedef struct VP8_COMP
int ambient_err;
unsigned int mode_check_freq[MAX_MODES];
unsigned int mode_test_hit_counts[MAX_MODES];
unsigned int mode_chosen_counts[MAX_MODES];
unsigned int mbs_tested_so_far;
int rd_baseline_thresh[MAX_MODES];
......
......@@ -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);
/* Count of the number of MBs tested so far this frame */
cpi->mbs_tested_so_far++;
x->mbs_tested_so_far++;
*returnintra = INT_MAX;
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
* If so then prevent it from being tested and increase the threshold
* 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))
{
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 less
* 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
* mode so increment the counter for the number of times it has been
* tested */
cpi->mode_test_hit_counts[mode_index] ++;
x->mode_test_hit_counts[mode_index] ++;
rate2 = 0;
distortion2 = 0;
......
......@@ -265,6 +265,11 @@ void vp8_initialize_rd_consts(VP8_COMP *cpi, MACROBLOCK *x, int Qvalue)
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);
if (q < 8)
......@@ -2010,7 +2015,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
*returnintra = INT_MAX;
/* Count of the number of MBs tested so far this frame */
cpi->mbs_tested_so_far++;
x->mbs_tested_so_far++;
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
* 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
* 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
* 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.
* Increase zbin size to supress noise
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment