Commit bbc8c9d2 authored by Alex Converse's avatar Alex Converse
Browse files

Prune RT mode decisions for BLOCK_32x32 and up

* Remove all non-DC intra modes for BLOCK_32x32 and up
* Remove all intra modes for blocks bigger than BLOCK_32x32
* Remove ZEROMV for BLOCK_32x32 and up
* Only consider NEARESTMV for blocks bigger than BLOCK_32x32

Change-Id: Ia18351a238213e2f072f9e481d622949346a245f
parent 02b8baf3
......@@ -852,9 +852,15 @@ static void set_rt_speed_feature(VP9_COMMON *cm,
sf->intra_y_mode_mask[i] = INTRA_DC_H_V;
sf->intra_uv_mode_mask[i] = INTRA_DC_ONLY;
}
sf->intra_y_mode_mask[TX_32X32] = INTRA_DC_ONLY;
sf->frame_parameter_update = 0;
sf->encode_breakout_thresh = 1000;
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->max_intra_bsize = BLOCK_32X32;
}
if (speed >= 6) {
sf->partition_search_type = VAR_BASED_FIXED_PARTITION;
......@@ -933,6 +939,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
sf->encode_breakout_thresh = 0;
for (i = 0; i < BLOCK_SIZES; ++i)
sf->disable_inter_mode_mask[i] = 0;
sf->max_intra_bsize = BLOCK_64X64;
switch (cpi->oxcf.mode) {
case MODE_BESTQUALITY:
......
......@@ -424,6 +424,11 @@ typedef struct {
// This feature controls whether we do the expensive context update and
// calculation in the rd coefficient costing loop.
int use_fast_coef_costing;
// This variable controls the maximum block size where intra blocks can be
// used in inter frames.
// TODO(aconverse): Fold this into one of the other many mode skips
BLOCK_SIZE max_intra_bsize;
} SPEED_FEATURES;
typedef struct {
......
......@@ -1704,6 +1704,7 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
int mode_idx;
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];
vpx_memcpy(t_above, pd->above_context, sizeof(t_above));
vpx_memcpy(t_left, pd->left_context, sizeof(t_left));
......@@ -1741,11 +1742,12 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
mode_idx = INTER_OFFSET(this_mode);
bsi->rdstat[i][mode_idx].brdcost = INT64_MAX;
if (cpi->sf.disable_inter_mode_mask[bsize] & (1 << mode_idx))
if (disable_inter_mode_mask & (1 << mode_idx))
continue;
// if we're near/nearest and mv == 0,0, compare to zeromv
if ((this_mode == NEARMV || this_mode == NEARESTMV ||
if (!(disable_inter_mode_mask & (1 << INTER_OFFSET(ZEROMV))) &&
(this_mode == NEARMV || this_mode == NEARESTMV ||
this_mode == ZEROMV) &&
frame_mv[this_mode][mbmi->ref_frame[0]].as_int == 0 &&
(!has_second_rf ||
......@@ -3184,6 +3186,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]];
const int disable_inter_mode_mask = cpi->sf.disable_inter_mode_mask[bsize];
x->skip_encode = cpi->sf.skip_encode_frame && x->q_index < QIDX_SKIP_THRESH;
......@@ -3282,6 +3285,10 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
mode_skip_mask |= new_modes_mask;
}
if (bsize > cpi->sf.max_intra_bsize) {
mode_skip_mask |= 0xFF30808;
}
for (mode_index = 0; mode_index < MAX_MODES; ++mode_index) {
int mode_excluded = 0;
int64_t this_rd = INT64_MAX;
......@@ -3328,7 +3335,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 &&
cpi->sf.disable_inter_mode_mask[bsize] & (1 << INTER_OFFSET(this_mode)))
disable_inter_mode_mask & (1 << INTER_OFFSET(this_mode)))
continue;
second_ref_frame = vp9_mode_order[mode_index].ref_frame[1];
......@@ -3372,7 +3379,8 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
}
} else {
// if we're near/nearest and mv == 0,0, compare to zeromv
if ((this_mode == NEARMV || this_mode == NEARESTMV ||
if (!(disable_inter_mode_mask & (1 << INTER_OFFSET(ZEROMV))) &&
(this_mode == NEARMV || this_mode == NEARESTMV ||
this_mode == ZEROMV) &&
frame_mv[this_mode][ref_frame].as_int == 0 &&
!vp9_segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP) &&
......
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