Merge "Inlining vp9_get_pred_probs_switchable_interp function."

This commit is contained in:
Dmitry Kovalev 2013-08-06 11:57:45 -07:00 committed by Gerrit Code Review
commit 8725ca2ed2
5 changed files with 27 additions and 37 deletions

View File

@ -57,12 +57,6 @@ void vp9_set_pred_flag_mbskip(VP9_COMMON *cm, BLOCK_SIZE_TYPE bsize,
unsigned char vp9_get_pred_context_switchable_interp(const MACROBLOCKD *xd);
static INLINE const vp9_prob *vp9_get_pred_probs_switchable_interp(
const VP9_COMMON *cm, const MACROBLOCKD *xd) {
const int pred_context = vp9_get_pred_context_switchable_interp(xd);
return &cm->fc.switchable_interp_prob[pred_context][0];
}
unsigned char vp9_get_pred_context_intra_inter(const MACROBLOCKD *xd);
static INLINE vp9_prob vp9_get_pred_prob_intra_inter(const VP9_COMMON *cm,

View File

@ -370,9 +370,9 @@ static INLINE INTERPOLATIONFILTERTYPE read_switchable_filter_type(
VP9D_COMP *pbi, vp9_reader *r) {
VP9_COMMON *const cm = &pbi->common;
MACROBLOCKD *const xd = &pbi->mb;
const vp9_prob *probs = vp9_get_pred_probs_switchable_interp(cm, xd);
const int type = treed_read(r, vp9_switchable_interp_tree, probs);
const int ctx = vp9_get_pred_context_switchable_interp(xd);
const int type = treed_read(r, vp9_switchable_interp_tree,
cm->fc.switchable_interp_prob[ctx]);
++cm->counts.switchable_interp[ctx][type];
return type;
}

View File

@ -477,12 +477,13 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m, vp9_writer *bc) {
}
}
if (cpi->common.mcomp_filter_type == SWITCHABLE) {
if (pc->mcomp_filter_type == SWITCHABLE) {
const int ctx = vp9_get_pred_context_switchable_interp(xd);
write_token(bc, vp9_switchable_interp_tree,
vp9_get_pred_probs_switchable_interp(&cpi->common, xd),
pc->fc.switchable_interp_prob[ctx],
&vp9_switchable_interp_encodings[mi->interp_filter]);
} else {
assert(mi->interp_filter == cpi->common.mcomp_filter_type);
assert(mi->interp_filter == pc->mcomp_filter_type);
}
if (bsize < BLOCK_8X8) {

View File

@ -333,13 +333,14 @@ void vp9_activity_masking(VP9_COMP *cpi, MACROBLOCK *x) {
static void update_state(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx,
BLOCK_SIZE_TYPE bsize, int output_enabled) {
int i, x_idx, y;
MACROBLOCK * const x = &cpi->mb;
MACROBLOCKD * const xd = &x->e_mbd;
VP9_COMMON *const cm = &cpi->common;
MACROBLOCK *const x = &cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
MODE_INFO *mi = &ctx->mic;
MB_MODE_INFO * const mbmi = &xd->mode_info_context->mbmi;
MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi;
int mb_mode_index = ctx->best_mode_index;
const int mis = cpi->common.mode_info_stride;
const int mis = cm->mode_info_stride;
const int mi_width = num_8x8_blocks_wide_lookup[bsize];
const int mi_height = num_8x8_blocks_high_lookup[bsize];
@ -351,15 +352,12 @@ static void update_state(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx,
// Restore the coding context of the MB to that that was in place
// when the mode was picked for it
for (y = 0; y < mi_height; y++) {
for (x_idx = 0; x_idx < mi_width; x_idx++) {
for (y = 0; y < mi_height; y++)
for (x_idx = 0; x_idx < mi_width; x_idx++)
if ((xd->mb_to_right_edge >> (3 + LOG2_MI_SIZE)) + mi_width > x_idx
&& (xd->mb_to_bottom_edge >> (3 + LOG2_MI_SIZE)) + mi_height > y) {
MODE_INFO *mi_addr = xd->mode_info_context + x_idx + y * mis;
*mi_addr = *mi;
}
}
}
&& (xd->mb_to_bottom_edge >> (3 + LOG2_MI_SIZE)) + mi_height > y)
xd->mode_info_context[x_idx + y * mis] = *mi;
// FIXME(rbultje) I'm pretty sure this should go to the end of this block
// (i.e. after the output_enabled)
if (bsize < BLOCK_32X32) {
@ -383,7 +381,7 @@ static void update_state(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx,
cpi->rd_tx_select_diff[i] += ctx->tx_rd_diff[i];
}
if (cpi->common.frame_type == KEY_FRAME) {
if (cm->frame_type == KEY_FRAME) {
// Restore the coding modes to that held in the coding context
// if (mb_mode == I4X4_PRED)
// for (i = 0; i < 16; i++)
@ -436,19 +434,17 @@ static void update_state(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx,
xd->mode_info_context[mis * j + i].mbmi = *mbmi;
}
if (cpi->common.mcomp_filter_type == SWITCHABLE
&& is_inter_mode(mbmi->mode)) {
++cpi->common.counts.switchable_interp[
vp9_get_pred_context_switchable_interp(xd)][mbmi->interp_filter];
if (cm->mcomp_filter_type == SWITCHABLE && is_inter_mode(mbmi->mode)) {
const int ctx = vp9_get_pred_context_switchable_interp(xd);
++cm->counts.switchable_interp[ctx][mbmi->interp_filter];
}
cpi->rd_comp_pred_diff[SINGLE_PREDICTION_ONLY] += ctx->single_pred_diff;
cpi->rd_comp_pred_diff[COMP_PREDICTION_ONLY] += ctx->comp_pred_diff;
cpi->rd_comp_pred_diff[HYBRID_PREDICTION] += ctx->hybrid_pred_diff;
for (i = 0; i <= VP9_SWITCHABLE_FILTERS; i++) {
for (i = 0; i <= VP9_SWITCHABLE_FILTERS; i++)
cpi->rd_filter_diff[i] += ctx->best_filter_diff[i];
}
}
}

View File

@ -2412,13 +2412,12 @@ static YV12_BUFFER_CONFIG *get_scaled_ref_frame(VP9_COMP *cpi, int ref_frame) {
return scaled_ref_frame;
}
static INLINE int get_switchable_rate(MACROBLOCK *x) {
MACROBLOCKD *xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi;
const int c = vp9_get_pred_context_switchable_interp(xd);
const int m = mbmi->interp_filter;
return SWITCHABLE_INTERP_RATE_FACTOR * x->switchable_interp_costs[c][m];
static INLINE int get_switchable_rate(const MACROBLOCK *x) {
const MACROBLOCKD *const xd = &x->e_mbd;
const MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi;
const int ctx = vp9_get_pred_context_switchable_interp(xd);
return SWITCHABLE_INTERP_RATE_FACTOR *
x->switchable_interp_costs[ctx][mbmi->interp_filter];
}
static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x,