Masking intra mode choice adaptively

The commit changes to mask available intra prediction modes for test
based on prediction block size.

With this patch, encoding time of CpuUsed 2 reduces from 10% to 20% for
HD clips with a compression drop of 0.2%

Change-Id: I65f320f1237c0f5ae3a355bf7caf447f55625455
This commit is contained in:
Yaowu Xu 2013-10-10 17:29:46 -07:00
parent dc079ab138
commit 8b175679be
3 changed files with 23 additions and 10 deletions

View File

@ -737,8 +737,10 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
sf->mode_search_skip_flags = 0;
sf->disable_split_var_thresh = 0;
sf->disable_filter_search_var_thresh = 0;
sf->intra_y_mode_mask = ALL_INTRA_MODES;
sf->intra_uv_mode_mask = ALL_INTRA_MODES;
for (i = 0; i < TX_SIZES; i++) {
sf->intra_y_mode_mask[i] = ALL_INTRA_MODES;
sf->intra_uv_mode_mask[i] = ALL_INTRA_MODES;
}
sf->use_rd_breakout = 0;
sf->skip_encode_sb = 0;
sf->use_uv_intra_rd_estimate = 0;
@ -788,6 +790,9 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
sf->auto_mv_step_size = 1;
sf->adaptive_rd_thresh = 2;
sf->recode_loop = 2;
sf->intra_y_mode_mask[TX_32X32] = INTRA_DC_H_V;
sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC_H_V;
sf->intra_uv_mode_mask[TX_16X16] = INTRA_DC_H_V;
}
if (speed == 2) {
sf->use_square_partition_only = !(cpi->common.frame_type == KEY_FRAME ||
@ -823,6 +828,10 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
sf->adaptive_rd_thresh = 2;
sf->mode_skip_start = 11;
sf->intra_y_mode_mask[TX_32X32] = INTRA_DC_H_V;
sf->intra_y_mode_mask[TX_16X16] = INTRA_DC_H_V;
sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC_H_V;
sf->intra_uv_mode_mask[TX_16X16] = INTRA_DC_H_V;
}
if (speed == 3) {
sf->use_square_partition_only = 1;
@ -923,8 +932,10 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
sf->subpel_iters_per_step = 1;
sf->disable_split_var_thresh = 64;
sf->disable_filter_search_var_thresh = 96;
sf->intra_y_mode_mask = INTRA_DC_ONLY;
sf->intra_uv_mode_mask = INTRA_DC_ONLY;
for (i = 0; i < TX_SIZES; i++) {
sf->intra_y_mode_mask[i] = INTRA_DC_ONLY;
sf->intra_uv_mode_mask[i] = INTRA_DC_ONLY;
}
sf->use_fast_coef_updates = 2;
sf->adaptive_rd_thresh = 4;
sf->mode_skip_start = 6;

View File

@ -230,6 +230,7 @@ typedef enum {
#define ALL_INTRA_MODES 0x3FF
#define INTRA_DC_ONLY 0x01
#define INTRA_DC_TM ((1 << TM_PRED) | (1 << DC_PRED))
#define INTRA_DC_H_V ((1 << DC_PRED) | (1 << V_PRED) | (1 << H_PRED))
#define INTRA_DC_TM_H_V (INTRA_DC_TM | (1 << V_PRED) | (1 << H_PRED))
typedef enum {
@ -285,8 +286,8 @@ typedef struct {
// A source variance threshold below which filter search is disabled
// Choose a very large value (UINT_MAX) to use 8-tap always
unsigned int disable_filter_search_var_thresh;
int intra_y_mode_mask;
int intra_uv_mode_mask;
int intra_y_mode_mask[TX_SIZES];
int intra_uv_mode_mask[TX_SIZES];
int use_rd_breakout;
int use_uv_intra_rd_estimate;
int use_fast_lpf_pick;

View File

@ -1044,7 +1044,7 @@ static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib,
int64_t this_rd;
int ratey = 0;
if (!(cpi->sf.intra_y_mode_mask & (1 << mode)))
if (!(cpi->sf.intra_y_mode_mask[TX_4X4] & (1 << mode)))
continue;
// Only do the oblique modes if the best so far is
@ -1236,7 +1236,7 @@ static int64_t rd_pick_intra_sby_mode(VP9_COMP *cpi, MACROBLOCK *x,
MODE_INFO *above_mi = xd->mi_8x8[-xd->mode_info_stride];
MODE_INFO *left_mi = xd->mi_8x8[-1];
if (!(cpi->sf.intra_y_mode_mask & (1 << mode)))
if (!(cpi->sf.intra_y_mode_mask[max_txsize_lookup[bsize]] & (1 << mode)))
continue;
if (cpi->common.frame_type == KEY_FRAME) {
@ -1339,9 +1339,10 @@ static int64_t rd_pick_intra_sbuv_mode(VP9_COMP *cpi, MACROBLOCK *x,
// int mode_mask = (bsize <= BLOCK_8X8)
// ? ALL_INTRA_MODES : cpi->sf.intra_uv_mode_mask;
for (mode = DC_PRED; mode <= TM_PRED; mode++) {
for (mode = DC_PRED; mode <= TM_PRED; mode ++) {
// if (!(mode_mask & (1 << mode)))
if (!(cpi->sf.intra_uv_mode_mask & (1 << mode)))
if (!(cpi->sf.intra_uv_mode_mask[max_uv_txsize_lookup[bsize]]
& (1 << mode)))
continue;
x->e_mbd.mi_8x8[0]->mbmi.uv_mode = mode;