shithub: libvpx

Download patch

ref: 6a4e2ddabc7af605ab65b6510539e6aa9d63b5d2
parent: e78c174e540117dcfcdff505d38478d4ac6df844
author: Yaowu Xu <yaowu@google.com>
date: Thu Jan 30 13:33:26 EST 2014

Properly merge two different real time modes

--rt --cpu-used=-5 uses the progressive rtc mode
--rt --cpu-used=-6 uses the new super fast rtc mode

Change-Id: Id6469ca996100cdf794a0e42d76430161f22f976

--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -2787,7 +2787,7 @@
     cm->reference_mode = reference_mode;
     cm->interp_filter = interp_filter;
 
-    if (cpi->oxcf.mode == MODE_REALTIME)
+    if (cpi->sf.super_fast_rtc)
       encode_rtc_frame_internal(cpi);
     else
       encode_frame_internal(cpi);
@@ -2868,7 +2868,10 @@
       }
     }
   } else {
-    encode_rtc_frame_internal(cpi);
+    if (cpi->sf.super_fast_rtc)
+      encode_rtc_frame_internal(cpi);
+    else
+      encode_frame_internal(cpi);
   }
 }
 
@@ -2945,7 +2948,7 @@
   const int mi_height = num_8x8_blocks_high_lookup[bsize];
   x->skip_recode = !x->select_txfm_size && mbmi->sb_type >= BLOCK_8X8 &&
                    (cpi->oxcf.aq_mode != COMPLEXITY_AQ) &&
-                   cpi->oxcf.mode != MODE_REALTIME;
+                   !cpi->sf.super_fast_rtc;
   x->skip_optimize = ctx->is_coded;
   ctx->is_coded = 1;
   x->use_lp32x32fdct = cpi->sf.use_lp32x32fdct;
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -851,6 +851,9 @@
     }
     sf->use_fast_lpf_pick = 2;
   }
+  if (speed >= 6) {
+    sf->super_fast_rtc = 1;
+  }
 }
 
 void vp9_set_speed_features(VP9_COMP *cpi) {
@@ -908,6 +911,7 @@
   sf->use_fast_coef_updates = 0;
   sf->using_small_partition_info = 0;
   sf->mode_skip_start = MAX_MODES;  // Mode index at which mode skip mask set
+  sf->super_fast_rtc = 0;
 
   switch (cpi->oxcf.mode) {
     case MODE_BESTQUALITY:
@@ -917,9 +921,8 @@
     case MODE_FIRSTPASS:
     case MODE_GOODQUALITY:
     case MODE_SECONDPASS:
-     set_good_speed_feature(cm, sf, speed);
+      set_good_speed_feature(cm, sf, speed);
       break;
-      break;
     case MODE_REALTIME:
       set_rt_speed_feature(cm, sf, speed);
       break;
@@ -2550,10 +2553,7 @@
 
     vpx_usec_timer_start(&timer);
 
-    if (cpi->oxcf.mode == MODE_REALTIME)
-      lf->filter_level = 4;
-    else
-      vp9_pick_filter_level(cpi->Source, cpi, cpi->sf.use_fast_lpf_pick);
+    vp9_pick_filter_level(cpi->Source, cpi, cpi->sf.use_fast_lpf_pick);
 
     vpx_usec_timer_mark(&timer);
     cpi->time_pick_lpf += vpx_usec_timer_elapsed(&timer);
@@ -2742,7 +2742,7 @@
     if (cpi->sf.recode_loop != 0) {
       vp9_save_coding_context(cpi);
       cpi->dummy_packing = 1;
-      if (cpi->oxcf.mode != MODE_REALTIME)
+      if (!cpi->sf.super_fast_rtc)
         vp9_pack_bitstream(cpi, dest, size);
 
       cpi->rc.projected_frame_size = (*size) << 3;
@@ -3101,7 +3101,7 @@
   // JBB : This is realtime mode.  In real time mode the first frame
   // should be larger. Q of 0 is disabled because we force tx size to be
   // 16x16...
-  if (cpi->oxcf.mode == MODE_REALTIME) {
+  if (cpi->sf.super_fast_rtc) {
     if (cpi->common.current_video_frame == 0)
       q /= 3;
 
--- a/vp9/encoder/vp9_onyx_int.h
+++ b/vp9/encoder/vp9_onyx_int.h
@@ -416,6 +416,9 @@
   // This feature limits the number of coefficients updates we actually do
   // by only looking at counts from 1/2 the bands.
   int use_fast_coef_updates;  // 0: 2-loop, 1: 1-loop, 2: 1-loop reduced
+
+  // This flag control the use of the new super fast rtc mode
+  int super_fast_rtc;
 } SPEED_FEATURES;
 
 typedef struct VP9_COMP {
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -296,7 +296,7 @@
 
   fill_token_costs(x->token_costs, cm->fc.coef_probs);
 
-  if (cpi->oxcf.mode != MODE_REALTIME) {
+  if (!cpi->sf.super_fast_rtc) {
     for (i = 0; i < PARTITION_CONTEXTS; i++)
       vp9_cost_tokens(x->partition_cost[i], get_partition_probs(cm, i),
                       vp9_partition_tree);
@@ -443,7 +443,7 @@
 
     if (i == 0)
       x->pred_sse[ref] = sse;
-    if (cpi->oxcf.mode == MODE_REALTIME) {
+    if (cpi->sf.super_fast_rtc) {
       dist_sum += (int)sse;
     } else {
       int rate;
@@ -2489,7 +2489,6 @@
     for (i = 0; i < MAX_MB_PLANE; i++)
       xd->plane[i].pre[0] = backup_yv12[i];
   }
-  return;
 }
 
 static void joint_motion_search(VP9_COMP *cpi, MACROBLOCK *x,