From 455514a6839b5d087d5e4c06c29959b9a0fb68f0 Mon Sep 17 00:00:00 2001 From: Jingning Han Date: Wed, 17 Dec 2014 14:26:00 -0800 Subject: [PATCH] Rework mode search threshold update for RTC coding mode In RTC coding mode, the alternate reference frame modes and compound inter prediction modes are disabled. This commit reworks the related mode search threshold update process to skip interacting with these coding modes. It provides about 1.5% speed-up for speed -6 on average. vidyo1 16551 b/f, 40.451 dB, 6261 ms -> 16550 b/f, 40.459 dB, 6190 ms nik720p 33316 b/f, 38.795 dB, 6335 ms -> 33310 b/f, 38.798 dB, 6237 ms mmmoving 33265 b/f, 41.055 dB, 7176 ms -> 33267 b/f, 41.064 dB, 7084 ms dark720 33329 b/f, 39.729 dB, 11235 ms -> 33331 b/f, 39.733 dB, 10731 ms Change-Id: If2a4090a371cd28f579be219c013b972d7d9b97f --- vp9/encoder/vp9_pickmode.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/vp9/encoder/vp9_pickmode.c b/vp9/encoder/vp9_pickmode.c index 54423789b..bae507f02 100644 --- a/vp9/encoder/vp9_pickmode.c +++ b/vp9/encoder/vp9_pickmode.c @@ -926,14 +926,23 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, } } - if (is_inter_block(mbmi)) - vp9_update_rd_thresh_fact(tile_data->thresh_freq_fact, - cpi->sf.adaptive_rd_thresh, bsize, - mode_idx[best_ref_frame][INTER_OFFSET(mbmi->mode)]); - else - vp9_update_rd_thresh_fact(tile_data->thresh_freq_fact, - cpi->sf.adaptive_rd_thresh, bsize, - mode_idx[INTRA_FRAME][mbmi->mode]); + if (cpi->sf.adaptive_rd_thresh) { + THR_MODES best_mode_idx = is_inter_block(mbmi) ? + mode_idx[best_ref_frame][INTER_OFFSET(mbmi->mode)] : + mode_idx[INTRA_FRAME][mbmi->mode]; + PREDICTION_MODE this_mode; + for (ref_frame = LAST_FRAME; ref_frame <= GOLDEN_FRAME; ++ref_frame) { + for (this_mode = NEARESTMV; this_mode <= NEWMV; ++this_mode) { + THR_MODES thr_mode_idx = mode_idx[ref_frame][INTER_OFFSET(this_mode)]; + int *freq_fact = &tile_data->thresh_freq_fact[bsize][thr_mode_idx]; + if (thr_mode_idx == best_mode_idx) + *freq_fact -= (*freq_fact >> 4); + else + *freq_fact = MIN(*freq_fact + RD_THRESH_INC, + cpi->sf.adaptive_rd_thresh * RD_THRESH_MAX_FACT); + } + } + } *rd_cost = best_rdc; } -- 2.40.0