Commit 61a47da8 authored by Dmitry Kovalev's avatar Dmitry Kovalev

Adding is_inter_mode function.

Change-Id: I2d32d46002cb92c63050c2b8328865c406103621
parent 2cf0675a
......@@ -98,6 +98,11 @@ typedef enum {
MB_MODE_COUNT
} MB_PREDICTION_MODE;
static INLINE int is_inter_mode(MB_PREDICTION_MODE mode) {
return mode >= NEARESTMV && mode <= SPLITMV;
}
// Segment level features.
typedef enum {
SEG_LVL_ALT_Q = 0, // Use alternate Quantizer ....
......
......@@ -59,16 +59,14 @@ unsigned char vp9_get_pred_context(const VP9_COMMON *const cm,
case PRED_SWITCHABLE_INTERP: {
// left
const int left_in_image = xd->left_available && left_mi->mbmi.mb_in_image;
const int left_mv_pred = left_mi->mbmi.mode >= NEARESTMV &&
left_mi->mbmi.mode <= SPLITMV;
const int left_mv_pred = is_inter_mode(left_mi->mbmi.mode);
const int left_interp = left_in_image && left_mv_pred ?
vp9_switchable_interp_map[left_mi->mbmi.interp_filter] :
VP9_SWITCHABLE_FILTERS;
// above
const int above_in_image = xd->up_available && above_mi->mbmi.mb_in_image;
const int above_mv_pred = above_mi->mbmi.mode >= NEARESTMV &&
above_mi->mbmi.mode <= SPLITMV;
const int above_mv_pred = is_inter_mode(above_mi->mbmi.mode);
const int above_interp = above_in_image && above_mv_pred ?
vp9_switchable_interp_map[above_mi->mbmi.interp_filter] :
VP9_SWITCHABLE_FILTERS;
......
......@@ -692,7 +692,7 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
#endif
}
if (mbmi->mode >= NEARESTMV && mbmi->mode <= SPLITMV) {
if (is_inter_mode(mbmi->mode)) {
mbmi->interp_filter = cm->mcomp_filter_type == SWITCHABLE
? read_switchable_filter_type(pbi, r)
: cm->mcomp_filter_type;
......
......@@ -794,7 +794,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, MODE_INFO *m,
vp9_accum_mv_refs(&cpi->common, mode, mi->mb_mode_context[rf]);
}
if (mode >= NEARESTMV && mode <= SPLITMV) {
if (is_inter_mode(mode)) {
if (cpi->common.mcomp_filter_type == SWITCHABLE) {
write_token(bc, vp9_switchable_interp_tree,
vp9_get_pred_probs(&cpi->common, xd,
......
......@@ -505,8 +505,7 @@ static void update_state(VP9_COMP *cpi,
}
#endif
if (cpi->common.mcomp_filter_type == SWITCHABLE &&
mbmi->mode >= NEARESTMV &&
mbmi->mode <= SPLITMV) {
is_inter_mode(mbmi->mode)) {
++cpi->switchable_interp_count
[vp9_get_pred_context(&cpi->common, xd, PRED_SWITCHABLE_INTERP)]
[vp9_switchable_interp_map[mbmi->interp_filter]];
......
......@@ -4042,7 +4042,7 @@ static void rd_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
// Accumulate filter usage stats
// TODO(agrange): Use RD criteria to select interpolation filter mode.
if ((best_mode >= NEARESTMV) && (best_mode <= SPLITMV))
if (is_inter_mode(best_mode))
++cpi->best_switchable_interp_count[vp9_switchable_interp_map[best_filter]];
// Reduce the activation RD thresholds for the best choice mode
......@@ -4852,7 +4852,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
// Accumulate filter usage stats
// TODO(agrange): Use RD criteria to select interpolation filter mode.
if ((best_mode >= NEARESTMV) && (best_mode <= SPLITMV))
if (is_inter_mode(best_mode))
++cpi->best_switchable_interp_count[vp9_switchable_interp_map[best_filter]];
// TODO(rbultje) integrate with RD thresholding
......
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