ref: 8b175679be83c228bcf2512df9f5ec46bc6b158c
parent: dc079ab1387bca763d6c6a6ae575c0764453a65b
author: Yaowu Xu <[email protected]>
date: Thu Oct 10 13:29:46 EDT 2013
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
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -737,8 +737,10 @@
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 @@
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 @@
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 @@
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;
--- a/vp9/encoder/vp9_onyx_int.h
+++ b/vp9/encoder/vp9_onyx_int.h
@@ -230,6 +230,7 @@
#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 @@
// 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;
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -1044,7 +1044,7 @@
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 @@
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 @@
// 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;