Adapt mode based rd_threshold for similar block size

The rd_thresholds are adaptively changed based on best mode tested.
It was only changed for the same block size, this commit makes the
adaptation for similar block sizes too. The commit also made minor
adjustment and code cleanups.

The impact on encoding time for _ped:
118089 ms -> 111927 ms

The impact on compression:
derf:  -0.339%
stdhd: -0.303%

Change-Id: I8817fed1102350497f2ec631849e43f753878e5d
This commit is contained in:
Yaowu Xu 2014-09-23 12:14:51 -07:00 коммит произвёл Gerrit Code Review
Родитель 56032b471d
Коммит 4a101310e8
2 изменённых файлов: 14 добавлений и 18 удалений

Просмотреть файл

@ -2510,24 +2510,23 @@ void vp9_rd_pick_intra_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
ctx->mic = *xd->mi[0].src_mi;
}
// Updating rd_thresh_freq_fact[] here means that the different
// partition/block sizes are handled independently based on the best
// choice for the current partition. It may well be better to keep a scaled
// best rd so far value and update rd_thresh_freq_fact based on the mode/size
// combination that wins out.
static void update_rd_thresh_fact(VP9_COMP *cpi, int bsize,
int best_mode_index) {
if (cpi->sf.adaptive_rd_thresh > 0) {
const int top_mode = bsize < BLOCK_8X8 ? MAX_REFS : MAX_MODES;
int mode;
for (mode = 0; mode < top_mode; ++mode) {
int *const fact = &cpi->rd.thresh_freq_fact[bsize][mode];
if (mode == best_mode_index) {
*fact -= (*fact >> 3);
} else {
*fact = MIN(*fact + RD_THRESH_INC,
cpi->sf.adaptive_rd_thresh * RD_THRESH_MAX_FACT);
const BLOCK_SIZE min_size = MAX(bsize - 1, BLOCK_4X4);
const BLOCK_SIZE max_size = MIN(bsize + 2, BLOCK_64X64);
BLOCK_SIZE bs;
for (bs = min_size; bs <= max_size; ++bs) {
int *const fact = &cpi->rd.thresh_freq_fact[bs][mode];
if (mode == best_mode_index) {
*fact -= (*fact >> 4);
} else {
*fact = MIN(*fact + RD_THRESH_INC,
cpi->sf.adaptive_rd_thresh * RD_THRESH_MAX_FACT);
}
}
}
}

Просмотреть файл

@ -96,28 +96,24 @@ static void set_good_speed_feature(VP9_COMP *cpi, VP9_COMMON *cm,
if (MIN(cm->width, cm->height) >= 720) {
sf->disable_split_mask = DISABLE_ALL_SPLIT;
sf->schedule_mode_search = cm->base_qindex < 220 ? 1 : 0;
sf->partition_search_breakout_dist_thr = (1 << 25);
} else {
sf->max_intra_bsize = BLOCK_32X32;
sf->disable_split_mask = DISABLE_ALL_INTER_SPLIT;
sf->schedule_mode_search = cm->base_qindex < 175 ? 1 : 0;
sf->partition_search_breakout_dist_thr = (1 << 23);
}
sf->adaptive_pred_interp_filter = 0;
sf->adaptive_mode_search = 1;
sf->cb_partition_search = !boosted;
sf->cb_pred_filter_search = 1;
sf->alt_ref_search_fp = 1;
sf->motion_field_mode_search = !boosted;
sf->recode_loop = ALLOW_RECODE_KFMAXBW;
sf->adaptive_rd_thresh = 3;
sf->mode_skip_start = 6;
sf->intra_y_mode_mask[TX_32X32] = INTRA_DC;
sf->intra_uv_mode_mask[TX_32X32] = INTRA_DC;
sf->adaptive_interp_filter_search = 1;
if (MIN(cm->width, cm->height) >= 720)
sf->partition_search_breakout_dist_thr = (1 << 25);
else
sf->partition_search_breakout_dist_thr = (1 << 23);
sf->partition_search_breakout_rate_thr = 1000;
}
@ -133,6 +129,7 @@ static void set_good_speed_feature(VP9_COMP *cpi, VP9_COMMON *cm,
sf->use_lp32x32fdct = 1;
sf->use_fast_coef_updates = ONE_LOOP_REDUCED;
sf->use_fast_coef_costing = 1;
sf->motion_field_mode_search = !boosted;
if (MIN(cm->width, cm->height) >= 720)
sf->partition_search_breakout_dist_thr = (1 << 26);