Commit 40371996 authored by Dmitry Kovalev's avatar Dmitry Kovalev

Converting disable_inter_mode_mask to inter_mode_mask.

Making this consistent with intra mode masks: you need to specify
allowed inter/intra modes to use.

Change-Id: Iaecd28bf79047259707d8e7a59a57bb7b856383e
parent 60866b03
......@@ -280,8 +280,7 @@ int64_t vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
for (this_mode = NEARESTMV; this_mode <= NEWMV; ++this_mode) {
int rate_mv = 0;
if (cpi->sf.disable_inter_mode_mask[bsize] &
(1 << INTER_OFFSET(this_mode)))
if (!(cpi->sf.inter_mode_mask[bsize] & (1 << this_mode)))
continue;
if (rd_less_than_thresh(best_rd, rd_threshes[mode_idx[this_mode]],
......
......@@ -1675,9 +1675,9 @@ static INLINE int mv_has_subpel(const MV *mv) {
static int check_best_zero_mv(
const VP9_COMP *cpi, const uint8_t mode_context[MAX_REF_FRAMES],
int_mv frame_mv[MB_MODE_COUNT][MAX_REF_FRAMES],
int disable_inter_mode_mask, int this_mode,
int inter_mode_mask, int this_mode,
const MV_REFERENCE_FRAME ref_frames[2]) {
if (!(disable_inter_mode_mask & (1 << INTER_OFFSET(ZEROMV))) &&
if ((inter_mode_mask & (1 << ZEROMV)) &&
(this_mode == NEARMV || this_mode == NEARESTMV || this_mode == ZEROMV) &&
frame_mv[this_mode][ref_frames[0]].as_int == 0 &&
(ref_frames[1] == NONE ||
......@@ -1743,7 +1743,7 @@ static int64_t rd_pick_best_sub8x8_mode(VP9_COMP *cpi, MACROBLOCK *x,
ENTROPY_CONTEXT t_above[2], t_left[2];
int subpelmv = 1, have_ref = 0;
const int has_second_rf = has_second_ref(mbmi);
const int disable_inter_mode_mask = cpi->sf.disable_inter_mode_mask[bsize];
const int inter_mode_mask = cpi->sf.inter_mode_mask[bsize];
vp9_zero(*bsi);
......@@ -1792,11 +1792,11 @@ static int64_t rd_pick_best_sub8x8_mode(VP9_COMP *cpi, MACROBLOCK *x,
mode_idx = INTER_OFFSET(this_mode);
bsi->rdstat[i][mode_idx].brdcost = INT64_MAX;
if (disable_inter_mode_mask & (1 << mode_idx))
if (!(inter_mode_mask & (1 << this_mode)))
continue;
if (!check_best_zero_mv(cpi, mbmi->mode_context, frame_mv,
disable_inter_mode_mask,
inter_mode_mask,
this_mode, mbmi->ref_frame))
continue;
......@@ -3063,7 +3063,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
const int mode_search_skip_flags = cpi->sf.mode_search_skip_flags;
const int intra_y_mode_mask =
cpi->sf.intra_y_mode_mask[max_txsize_lookup[bsize]];
int disable_inter_mode_mask = cpi->sf.disable_inter_mode_mask[bsize];
int inter_mode_mask = cpi->sf.inter_mode_mask[bsize];
vp9_zero(best_mbmode);
x->skip_encode = cpi->sf.skip_encode_frame && x->q_index < QIDX_SKIP_THRESH;
......@@ -3130,7 +3130,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
const int inter_non_zero_mode_mask = 0x1F7F7;
mode_skip_mask |= inter_non_zero_mode_mask;
mode_skip_mask &= ~(1 << THR_ZEROMV);
disable_inter_mode_mask = ~(1 << INTER_OFFSET(ZEROMV));
inter_mode_mask = (1 << ZEROMV);
}
// Disable this drop out case if the ref frame
......@@ -3182,7 +3182,8 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
mode_index = THR_ZEROMV;
mode_skip_mask = ~(1 << mode_index);
mode_skip_start = MAX_MODES;
disable_inter_mode_mask = 0;
inter_mode_mask = (1 << NEARESTMV) | (1 << NEARMV) | (1 << ZEROMV) |
(1 << NEWMV);
}
for (mode_index = 0; mode_index < MAX_MODES; ++mode_index) {
......@@ -3229,8 +3230,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
this_mode = vp9_mode_order[mode_index].mode;
ref_frame = vp9_mode_order[mode_index].ref_frame[0];
if (ref_frame != INTRA_FRAME &&
disable_inter_mode_mask & (1 << INTER_OFFSET(this_mode)))
if (ref_frame != INTRA_FRAME && !(inter_mode_mask & (1 << this_mode)))
continue;
second_ref_frame = vp9_mode_order[mode_index].ref_frame[1];
......@@ -3279,7 +3279,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
!vp9_segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
const MV_REFERENCE_FRAME ref_frames[2] = {ref_frame, second_ref_frame};
if (!check_best_zero_mv(cpi, mbmi->mode_context, frame_mv,
disable_inter_mode_mask, this_mode, ref_frames))
inter_mode_mask, this_mode, ref_frames))
continue;
}
}
......
......@@ -30,6 +30,12 @@ enum {
INTRA_DC_TM_H_V = INTRA_DC_TM | (1 << V_PRED) | (1 << H_PRED)
};
enum {
INTER_ALL = (1 << NEARESTMV) | (1 << NEARMV) | (1 << ZEROMV) | (1 << NEWMV),
INTER_NEAREST = (1 << NEARESTMV),
INTER_NEAREST_NEAR_NEW = (1 << NEARESTMV) | (1 << NEARMV) | (1 << NEWMV)
};
enum {
DISABLE_ALL_INTER_SPLIT = (1 << THR_COMP_GA) |
(1 << THR_COMP_LA) |
......@@ -237,10 +243,10 @@ static void set_rt_speed_feature(VP9_COMP *cpi, SPEED_FEATURES *sf,
sf->intra_y_mode_mask[TX_32X32] = INTRA_DC_ONLY;
sf->frame_parameter_update = 0;
sf->search_method = FAST_HEX;
sf->disable_inter_mode_mask[BLOCK_32X32] = 1 << INTER_OFFSET(ZEROMV);
sf->disable_inter_mode_mask[BLOCK_32X64] = ~(1 << INTER_OFFSET(NEARESTMV));
sf->disable_inter_mode_mask[BLOCK_64X32] = ~(1 << INTER_OFFSET(NEARESTMV));
sf->disable_inter_mode_mask[BLOCK_64X64] = ~(1 << INTER_OFFSET(NEARESTMV));
sf->inter_mode_mask[BLOCK_32X32] = INTER_NEAREST_NEAR_NEW;
sf->inter_mode_mask[BLOCK_32X64] = INTER_NEAREST;
sf->inter_mode_mask[BLOCK_64X32] = INTER_NEAREST;
sf->inter_mode_mask[BLOCK_64X64] = INTER_NEAREST;
sf->max_intra_bsize = BLOCK_32X32;
sf->allow_skip_recode = 1;
}
......@@ -271,7 +277,7 @@ static void set_rt_speed_feature(VP9_COMP *cpi, SPEED_FEATURES *sf,
if (speed >= 7) {
int i;
for (i = 0; i < BLOCK_SIZES; ++i)
sf->disable_inter_mode_mask[i] = ~(1 << INTER_OFFSET(NEARESTMV));
sf->inter_mode_mask[i] = INTER_NEAREST;
}
}
......@@ -329,7 +335,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
sf->mode_skip_start = MAX_MODES; // Mode index at which mode skip mask set
sf->use_nonrd_pick_mode = 0;
for (i = 0; i < BLOCK_SIZES; ++i)
sf->disable_inter_mode_mask[i] = 0;
sf->inter_mode_mask[i] = INTER_ALL;
sf->max_intra_bsize = BLOCK_64X64;
// This setting only takes effect when partition_search_type is set
// to FIXED_PARTITION.
......
......@@ -331,8 +331,8 @@ typedef struct SPEED_FEATURES {
int use_nonrd_pick_mode;
// A binary mask indicating if NEARESTMV, NEARMV, ZEROMV, NEWMV
// modes are disabled in order from LSB to MSB for each BLOCK_SIZE.
int disable_inter_mode_mask[BLOCK_SIZES];
// modes are used in order from LSB to MSB for each BLOCK_SIZE.
int inter_mode_mask[BLOCK_SIZES];
// This feature controls whether we do the expensive context update and
// calculation in the rd coefficient costing loop.
......
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