shithub: libvpx

Download patch

ref: 455514a6839b5d087d5e4c06c29959b9a0fb68f0
parent: 56a8bc54a61619f675694f06be7fe5cce2a6dc56
author: Jingning Han <jingning@google.com>
date: Wed Dec 17 09:26:00 EST 2014

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

--- a/vp9/encoder/vp9_pickmode.c
+++ b/vp9/encoder/vp9_pickmode.c
@@ -926,14 +926,23 @@
     }
   }
 
-  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;
 }