Commit 69d07484 authored by Scott LaVarnway's avatar Scott LaVarnway
Browse files

Moving count_mb_ref_frame_usage to macroblock struct

Change-Id: I44e4e3869f231ae270cca98c9565f23c512e3ddf
parent 80fe4723
......@@ -493,7 +493,7 @@ static void write_mb_features(vp8_writer *w, const MB_MODE_INFO *mi, const MACRO
}
void vp8_convert_rfct_to_prob(VP8_COMP *const cpi)
{
const int *const rfct = cpi->count_mb_ref_frame_usage;
const int *const rfct = cpi->mb.count_mb_ref_frame_usage;
const int rf_intra = rfct[INTRA_FRAME];
const int rf_inter = rfct[LAST_FRAME] + rfct[GOLDEN_FRAME] + rfct[ALTREF_FRAME];
......@@ -996,7 +996,7 @@ int vp8_estimate_entropy_savings(VP8_COMP *cpi)
{
int savings = 0;
const int *const rfct = cpi->count_mb_ref_frame_usage;
const int *const rfct = cpi->mb.count_mb_ref_frame_usage;
const int rf_intra = rfct[INTRA_FRAME];
const int rf_inter = rfct[LAST_FRAME] + rfct[GOLDEN_FRAME] + rfct[ALTREF_FRAME];
int new_intra, new_last, new_garf, oldtotal, newtotal;
......
......@@ -134,6 +134,7 @@ typedef struct macroblock
int uv_mode_count[VP8_UV_MODES]; /* intra MB type cts this frame */
int64_t prediction_error;
int64_t intra_error;
int count_mb_ref_frame_usage[MAX_REF_FRAMES];
void (*short_fdct4x4)(short *input, short *output, int pitch);
......
......@@ -642,8 +642,6 @@ static void init_encode_frame_mb_context(VP8_COMP *cpi)
xd->left_context = &cm->left_context;
vp8_zero(cpi->count_mb_ref_frame_usage)
x->mvc = cm->fc.mvc;
vpx_memset(cm->above_context, 0,
......@@ -678,6 +676,7 @@ static void init_encode_frame_mb_context(VP8_COMP *cpi)
vp8_zero(x->uv_mode_count)
x->prediction_error = 0;
x->intra_error = 0;
vp8_zero(x->count_mb_ref_frame_usage);
}
static void sum_coef_counts(MACROBLOCK *x, MACROBLOCK *x_thread)
......@@ -868,7 +867,7 @@ void vp8_encode_frame(VP8_COMP *cpi)
for (i = 0; i < cpi->encoding_thread_count; i++)
{
int mode_count;
int mv_vals;
int c_idx;
totalrate += cpi->mb_row_ei[i].totalrate;
cpi->mb.skip_true_count += cpi->mb_row_ei[i].mb.skip_true_count;
......@@ -881,18 +880,22 @@ void vp8_encode_frame(VP8_COMP *cpi)
cpi->mb.uv_mode_count[mode_count] +=
cpi->mb_row_ei[i].mb.uv_mode_count[mode_count];
for(mv_vals = 0; mv_vals < MVvals; mv_vals++)
for(c_idx = 0; c_idx < MVvals; c_idx++)
{
cpi->mb.MVcount[0][mv_vals] +=
cpi->mb_row_ei[i].mb.MVcount[0][mv_vals];
cpi->mb.MVcount[1][mv_vals] +=
cpi->mb_row_ei[i].mb.MVcount[1][mv_vals];
cpi->mb.MVcount[0][c_idx] +=
cpi->mb_row_ei[i].mb.MVcount[0][c_idx];
cpi->mb.MVcount[1][c_idx] +=
cpi->mb_row_ei[i].mb.MVcount[1][c_idx];
}
cpi->mb.prediction_error +=
cpi->mb_row_ei[i].mb.prediction_error;
cpi->mb.intra_error += cpi->mb_row_ei[i].mb.intra_error;
for(c_idx = 0; c_idx < MAX_REF_FRAMES; c_idx++)
cpi->mb.count_mb_ref_frame_usage[c_idx] +=
x->count_mb_ref_frame_usage[c_idx];
/* add up counts for each thread */
sum_coef_counts(x, &cpi->mb_row_ei[i].mb);
}
......@@ -987,13 +990,14 @@ void vp8_encode_frame(VP8_COMP *cpi)
{
int tot_modes;
tot_modes = cpi->count_mb_ref_frame_usage[INTRA_FRAME]
+ cpi->count_mb_ref_frame_usage[LAST_FRAME]
+ cpi->count_mb_ref_frame_usage[GOLDEN_FRAME]
+ cpi->count_mb_ref_frame_usage[ALTREF_FRAME];
tot_modes = cpi->mb.count_mb_ref_frame_usage[INTRA_FRAME]
+ cpi->mb.count_mb_ref_frame_usage[LAST_FRAME]
+ cpi->mb.count_mb_ref_frame_usage[GOLDEN_FRAME]
+ cpi->mb.count_mb_ref_frame_usage[ALTREF_FRAME];
if (tot_modes)
cpi->this_frame_percent_intra = cpi->count_mb_ref_frame_usage[INTRA_FRAME] * 100 / tot_modes;
cpi->this_frame_percent_intra =
cpi->mb.count_mb_ref_frame_usage[INTRA_FRAME] * 100 / tot_modes;
}
......@@ -1318,7 +1322,7 @@ int vp8cx_encode_inter_macroblock
vp8_update_zbin_extra(cpi, x);
}
cpi->count_mb_ref_frame_usage[xd->mode_info_context->mbmi.ref_frame] ++;
x->count_mb_ref_frame_usage[xd->mode_info_context->mbmi.ref_frame] ++;
if (xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME)
{
......
......@@ -478,6 +478,8 @@ void vp8cx_init_mbrthread_data(VP8_COMP *cpi,
vp8_zero(mb->MVcount);
mb->prediction_error = 0;
mb->intra_error = 0;
vp8_zero(mb->count_mb_ref_frame_usage);
}
}
......
......@@ -246,8 +246,8 @@ static void save_layer_context(VP8_COMP *cpi)
lc->last_frame_percent_intra = cpi->last_frame_percent_intra;
memcpy (lc->count_mb_ref_frame_usage,
cpi->count_mb_ref_frame_usage,
sizeof(cpi->count_mb_ref_frame_usage));
cpi->mb.count_mb_ref_frame_usage,
sizeof(cpi->mb.count_mb_ref_frame_usage));
}
static void restore_layer_context(VP8_COMP *cpi, const int layer)
......@@ -283,9 +283,9 @@ static void restore_layer_context(VP8_COMP *cpi, const int layer)
cpi->last_frame_percent_intra = lc->last_frame_percent_intra;
memcpy (cpi->count_mb_ref_frame_usage,
memcpy (cpi->mb.count_mb_ref_frame_usage,
lc->count_mb_ref_frame_usage,
sizeof(cpi->count_mb_ref_frame_usage));
sizeof(cpi->mb.count_mb_ref_frame_usage));
}
static void setup_features(VP8_COMP *cpi)
......@@ -2775,10 +2775,14 @@ static void update_golden_frame_stats(VP8_COMP *cpi)
if (cpi->common.frames_since_golden > 1)
{
cpi->recent_ref_frame_usage[INTRA_FRAME] += cpi->count_mb_ref_frame_usage[INTRA_FRAME];
cpi->recent_ref_frame_usage[LAST_FRAME] += cpi->count_mb_ref_frame_usage[LAST_FRAME];
cpi->recent_ref_frame_usage[GOLDEN_FRAME] += cpi->count_mb_ref_frame_usage[GOLDEN_FRAME];
cpi->recent_ref_frame_usage[ALTREF_FRAME] += cpi->count_mb_ref_frame_usage[ALTREF_FRAME];
cpi->recent_ref_frame_usage[INTRA_FRAME] +=
cpi->mb.count_mb_ref_frame_usage[INTRA_FRAME];
cpi->recent_ref_frame_usage[LAST_FRAME] +=
cpi->mb.count_mb_ref_frame_usage[LAST_FRAME];
cpi->recent_ref_frame_usage[GOLDEN_FRAME] +=
cpi->mb.count_mb_ref_frame_usage[GOLDEN_FRAME];
cpi->recent_ref_frame_usage[ALTREF_FRAME] +=
cpi->mb.count_mb_ref_frame_usage[ALTREF_FRAME];
}
}
}
......@@ -2790,7 +2794,7 @@ static void update_rd_ref_frame_probs(VP8_COMP *cpi)
{
VP8_COMMON *cm = &cpi->common;
const int *const rfct = cpi->count_mb_ref_frame_usage;
const int *const rfct = cpi->mb.count_mb_ref_frame_usage;
const int rf_intra = rfct[INTRA_FRAME];
const int rf_inter = rfct[LAST_FRAME] + rfct[GOLDEN_FRAME] + rfct[ALTREF_FRAME];
......@@ -4709,7 +4713,9 @@ static void check_gf_quality(VP8_COMP *cpi)
{
VP8_COMMON *cm = &cpi->common;
int gf_active_pct = (100 * cpi->gf_active_count) / (cm->mb_rows * cm->mb_cols);
int gf_ref_usage_pct = (cpi->count_mb_ref_frame_usage[GOLDEN_FRAME] * 100) / (cm->mb_rows * cm->mb_cols);
int gf_ref_usage_pct =
(cpi->mb.count_mb_ref_frame_usage[GOLDEN_FRAME] * 100) /
(cm->mb_rows * cm->mb_cols);
int last_ref_zz_useage = (cpi->inter_zz_count * 100) / (cm->mb_rows * cm->mb_cols);
/* Gf refresh is not currently being signalled */
......
......@@ -493,7 +493,6 @@ typedef struct VP8_COMP
int last_skip_probs_q[3];
int recent_ref_frame_usage[MAX_REF_FRAMES];
int count_mb_ref_frame_usage[MAX_REF_FRAMES];
int this_frame_percent_intra;
int last_frame_percent_intra;
......
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