]> granicus.if.org Git - libvpx/commitdiff
Properly merge two different real time modes
authorYaowu Xu <yaowu@google.com>
Fri, 31 Jan 2014 02:33:26 +0000 (18:33 -0800)
committerYaowu Xu <yaowu@google.com>
Fri, 31 Jan 2014 23:07:51 +0000 (15:07 -0800)
--rt --cpu-used=-5 uses the progressive rtc mode
--rt --cpu-used=-6 uses the new super fast rtc mode

Change-Id: Id6469ca996100cdf794a0e42d76430161f22f976

vp9/encoder/vp9_encodeframe.c
vp9/encoder/vp9_onyx_if.c
vp9/encoder/vp9_onyx_int.h
vp9/encoder/vp9_rdopt.c

index 60f06ba9c33fc32dbe621047d7fd6071c9bb89f4..18bb66ead9a04396efce8c3bef3ee1816b98cf8a 100644 (file)
@@ -2787,7 +2787,7 @@ void vp9_encode_frame(VP9_COMP *cpi) {
     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 @@ void vp9_encode_frame(VP9_COMP *cpi) {
       }
     }
   } 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 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
   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;
index 2d20f7ed38e124c3f544078b76aea3da51af3cb8..d87304c2fe52c7408646c33d1c77a64f3faf0a30 100644 (file)
@@ -851,6 +851,9 @@ static void set_rt_speed_feature(VP9_COMMON *cm,
     }
     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 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
   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,8 +921,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
     case MODE_FIRSTPASS:
     case MODE_GOODQUALITY:
     case MODE_SECONDPASS:
-     set_good_speed_feature(cm, sf, speed);
-      break;
+      set_good_speed_feature(cm, sf, speed);
       break;
     case MODE_REALTIME:
       set_rt_speed_feature(cm, sf, speed);
@@ -2550,10 +2553,7 @@ static void loopfilter_frame(VP9_COMP *cpi, VP9_COMMON *cm) {
 
     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 @@ static void encode_with_recode_loop(VP9_COMP *cpi,
     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 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
   // 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;
 
index 82b9901702b68f918179200c5ea842f749f9c9e4..2971aa8e5ee6b11ae1aac1f95af2a078477fc9aa 100644 (file)
@@ -416,6 +416,9 @@ typedef struct {
   // 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 {
index 4fd4457b723180d991768f419ee622e3c05e21ce..91248803f6d5bd2a4873ad1767cc4955d80af2f0 100644 (file)
@@ -296,7 +296,7 @@ void vp9_initialize_rd_consts(VP9_COMP *cpi) {
 
   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 @@ static void model_rd_for_sb(VP9_COMP *cpi, BLOCK_SIZE bsize,
 
     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 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x,
     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,