Inlining vp9_get_pred_probs_switchable_interp function.
There was no benefit having this function. For example, inside read_switchable_filter_type switchable filter context was calculated twice. Change-Id: I79cd5bf95cbc0f6d8bf91a2e32289e01b18dcff1
This commit is contained in:
@@ -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);
|
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);
|
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,
|
static INLINE vp9_prob vp9_get_pred_prob_intra_inter(const VP9_COMMON *cm,
|
||||||
|
|||||||
@@ -370,9 +370,9 @@ static INLINE INTERPOLATIONFILTERTYPE read_switchable_filter_type(
|
|||||||
VP9D_COMP *pbi, vp9_reader *r) {
|
VP9D_COMP *pbi, vp9_reader *r) {
|
||||||
VP9_COMMON *const cm = &pbi->common;
|
VP9_COMMON *const cm = &pbi->common;
|
||||||
MACROBLOCKD *const xd = &pbi->mb;
|
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 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];
|
++cm->counts.switchable_interp[ctx][type];
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,
|
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]);
|
&vp9_switchable_interp_encodings[mi->interp_filter]);
|
||||||
} else {
|
} else {
|
||||||
assert(mi->interp_filter == cpi->common.mcomp_filter_type);
|
assert(mi->interp_filter == pc->mcomp_filter_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bsize < BLOCK_8X8) {
|
if (bsize < BLOCK_8X8) {
|
||||||
|
|||||||
@@ -333,13 +333,14 @@ void vp9_activity_masking(VP9_COMP *cpi, MACROBLOCK *x) {
|
|||||||
static void update_state(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx,
|
static void update_state(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx,
|
||||||
BLOCK_SIZE_TYPE bsize, int output_enabled) {
|
BLOCK_SIZE_TYPE bsize, int output_enabled) {
|
||||||
int i, x_idx, y;
|
int i, x_idx, y;
|
||||||
MACROBLOCK * const x = &cpi->mb;
|
VP9_COMMON *const cm = &cpi->common;
|
||||||
MACROBLOCKD * const xd = &x->e_mbd;
|
MACROBLOCK *const x = &cpi->mb;
|
||||||
|
MACROBLOCKD *const xd = &x->e_mbd;
|
||||||
MODE_INFO *mi = &ctx->mic;
|
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;
|
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_width = num_8x8_blocks_wide_lookup[bsize];
|
||||||
const int mi_height = num_8x8_blocks_high_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
|
// Restore the coding context of the MB to that that was in place
|
||||||
// when the mode was picked for it
|
// when the mode was picked for it
|
||||||
for (y = 0; y < mi_height; y++) {
|
for (y = 0; y < mi_height; y++)
|
||||||
for (x_idx = 0; x_idx < mi_width; x_idx++) {
|
for (x_idx = 0; x_idx < mi_width; x_idx++)
|
||||||
if ((xd->mb_to_right_edge >> (3 + LOG2_MI_SIZE)) + 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) {
|
&& (xd->mb_to_bottom_edge >> (3 + LOG2_MI_SIZE)) + mi_height > y)
|
||||||
MODE_INFO *mi_addr = xd->mode_info_context + x_idx + y * mis;
|
xd->mode_info_context[x_idx + y * mis] = *mi;
|
||||||
*mi_addr = *mi;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// FIXME(rbultje) I'm pretty sure this should go to the end of this block
|
// FIXME(rbultje) I'm pretty sure this should go to the end of this block
|
||||||
// (i.e. after the output_enabled)
|
// (i.e. after the output_enabled)
|
||||||
if (bsize < BLOCK_32X32) {
|
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];
|
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
|
// Restore the coding modes to that held in the coding context
|
||||||
// if (mb_mode == I4X4_PRED)
|
// if (mb_mode == I4X4_PRED)
|
||||||
// for (i = 0; i < 16; i++)
|
// 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;
|
xd->mode_info_context[mis * j + i].mbmi = *mbmi;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cpi->common.mcomp_filter_type == SWITCHABLE
|
if (cm->mcomp_filter_type == SWITCHABLE && is_inter_mode(mbmi->mode)) {
|
||||||
&& is_inter_mode(mbmi->mode)) {
|
const int ctx = vp9_get_pred_context_switchable_interp(xd);
|
||||||
++cpi->common.counts.switchable_interp[
|
++cm->counts.switchable_interp[ctx][mbmi->interp_filter];
|
||||||
vp9_get_pred_context_switchable_interp(xd)][mbmi->interp_filter];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cpi->rd_comp_pred_diff[SINGLE_PREDICTION_ONLY] += ctx->single_pred_diff;
|
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[COMP_PREDICTION_ONLY] += ctx->comp_pred_diff;
|
||||||
cpi->rd_comp_pred_diff[HYBRID_PREDICTION] += ctx->hybrid_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];
|
cpi->rd_filter_diff[i] += ctx->best_filter_diff[i];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2412,13 +2412,12 @@ static YV12_BUFFER_CONFIG *get_scaled_ref_frame(VP9_COMP *cpi, int ref_frame) {
|
|||||||
return scaled_ref_frame;
|
return scaled_ref_frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE int get_switchable_rate(MACROBLOCK *x) {
|
static INLINE int get_switchable_rate(const MACROBLOCK *x) {
|
||||||
MACROBLOCKD *xd = &x->e_mbd;
|
const MACROBLOCKD *const xd = &x->e_mbd;
|
||||||
MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi;
|
const MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi;
|
||||||
|
const int ctx = vp9_get_pred_context_switchable_interp(xd);
|
||||||
const int c = vp9_get_pred_context_switchable_interp(xd);
|
return SWITCHABLE_INTERP_RATE_FACTOR *
|
||||||
const int m = mbmi->interp_filter;
|
x->switchable_interp_costs[ctx][mbmi->interp_filter];
|
||||||
return SWITCHABLE_INTERP_RATE_FACTOR * x->switchable_interp_costs[c][m];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
|
static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
|
||||||
|
|||||||
Reference in New Issue
Block a user