Commit 92a7cfc8 authored by Jingning Han's avatar Jingning Han
Browse files

Adaptively adjust mode test kick-off thresholds in RTC coding

This commit allows the encoder to increase the mode test kick-off
thresholds if the previous best mode renders all zero quantized
coefficients, thereby saving motion search runs when possible.
The compression performance of speed -5 and -6 is down by -0.446%
and 0.591%, respectively. The runtime of speed -6 is improved by
10% for many test clips.

vidyo1, 1000 kbps
16578 b/f, 40.316 dB, 7873 ms -> 16575 b/f, 40.262 dB, 7126 ms

nik720p, 1000 kbps
33311 b/f, 38.651 dB, 7263 ms -> 33304 b/f, 38.629 dB, 6865 ms

dark720p, 1000 kbps
33331 b/f, 39.718 dB, 13596 ms -> 33324 b/f, 39.651 dB, 12000 ms

mmoving, 1000 kbps
33263 b/f, 40.983 dB, 7566 ms -> 33259 b/f, 40.978 dB, 7531 ms

Change-Id: I7591617ff113e91125ec32c9b853e257fbc41d90
parent 30104207
...@@ -530,7 +530,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, ...@@ -530,7 +530,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
static const int flag_list[4] = { 0, VP9_LAST_FLAG, VP9_GOLD_FLAG, static const int flag_list[4] = { 0, VP9_LAST_FLAG, VP9_GOLD_FLAG,
VP9_ALT_FLAG }; VP9_ALT_FLAG };
RD_COST this_rdc, best_rdc; RD_COST this_rdc, best_rdc;
uint8_t skip_txfm = 0; uint8_t skip_txfm = 0, best_mode_skip_txfm = 0;
// var_y and sse_y are saved to be used in skipping checking // var_y and sse_y are saved to be used in skipping checking
unsigned int var_y = UINT_MAX; unsigned int var_y = UINT_MAX;
unsigned int sse_y = UINT_MAX; unsigned int sse_y = UINT_MAX;
...@@ -678,7 +678,8 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, ...@@ -678,7 +678,8 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
if (!(cpi->sf.inter_mode_mask[bsize] & (1 << this_mode))) if (!(cpi->sf.inter_mode_mask[bsize] & (1 << this_mode)))
continue; continue;
mode_rd_thresh = rd_threshes[mode_index]; mode_rd_thresh = best_mode_skip_txfm ? rd_threshes[mode_index] << 1 :
rd_threshes[mode_index];
if (rd_less_than_thresh(best_rdc.rdcost, mode_rd_thresh, if (rd_less_than_thresh(best_rdc.rdcost, mode_rd_thresh,
rd_thresh_freq_fact[mode_index])) rd_thresh_freq_fact[mode_index]))
continue; continue;
...@@ -809,7 +810,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, ...@@ -809,7 +810,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
best_pred_filter = mbmi->interp_filter; best_pred_filter = mbmi->interp_filter;
best_tx_size = mbmi->tx_size; best_tx_size = mbmi->tx_size;
best_ref_frame = ref_frame; best_ref_frame = ref_frame;
skip_txfm = x->skip_txfm[0]; best_mode_skip_txfm = x->skip_txfm[0];
if (reuse_inter_pred) { if (reuse_inter_pred) {
free_pred_buffer(best_pred); free_pred_buffer(best_pred);
...@@ -837,7 +838,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, ...@@ -837,7 +838,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
mbmi->ref_frame[0] = best_ref_frame; mbmi->ref_frame[0] = best_ref_frame;
mbmi->mv[0].as_int = frame_mv[best_mode][best_ref_frame].as_int; mbmi->mv[0].as_int = frame_mv[best_mode][best_ref_frame].as_int;
xd->mi[0].src_mi->bmi[0].as_mv[0].as_int = mbmi->mv[0].as_int; xd->mi[0].src_mi->bmi[0].as_mv[0].as_int = mbmi->mv[0].as_int;
x->skip_txfm[0] = skip_txfm; x->skip_txfm[0] = best_mode_skip_txfm;
// Perform intra prediction search, if the best SAD is above a certain // Perform intra prediction search, if the best SAD is above a certain
// threshold. // threshold.
...@@ -887,7 +888,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, ...@@ -887,7 +888,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
mbmi->uv_mode = this_mode; mbmi->uv_mode = this_mode;
mbmi->mv[0].as_int = INVALID_MV; mbmi->mv[0].as_int = INVALID_MV;
} else { } else {
x->skip_txfm[0] = skip_txfm; x->skip_txfm[0] = best_mode_skip_txfm;
mbmi->tx_size = saved_tx_size; mbmi->tx_size = saved_tx_size;
} }
} }
......
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