convert all speed things to speed features
authorJim Bankoski <jimbankoski@google.com>
Wed, 19 Jun 2013 22:53:47 +0000 (15:53 -0700)
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>
Thu, 20 Jun 2013 16:42:44 +0000 (09:42 -0700)
Change-Id: Ie24489a4d39f3e53e816eeebf75a1c9c7d94515a

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

index bcc6236..0518fad 100644 (file)
@@ -594,7 +594,7 @@ static void set_rd_speed_thresholds(VP9_COMP *cpi, int mode, int speed) {
   sf->thresh_mult[THR_COMP_SPLITLA  ] += speed_multiplier * 4500;
   sf->thresh_mult[THR_COMP_SPLITGA  ] += speed_multiplier * 4500;
 
-  if (speed > 4) {
+  if (cpi->sf.skip_lots_of_modes) {
     for (i = 0; i < MAX_MODES; ++i)
       sf->thresh_mult[i] = INT_MAX;
 
@@ -688,6 +688,11 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
   sf->comp_inter_joint_search_thresh = BLOCK_SIZE_AB4X4;
   sf->adpative_rd_thresh = 0;
   sf->use_lastframe_partitioning = 0;
+  sf->use_largest_txform = 0;
+  sf->use_8tap_always = 0;
+  sf->use_avoid_tested_higherror = 0;
+  sf->skip_lots_of_modes = 0;
+  sf->adjust_thresholds_by_speed = 0;
 
 #if CONFIG_MULTIPLE_ARF
   // Switch segmentation off.
@@ -715,15 +720,21 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
         sf->optimize_coefficients = 0;
         sf->first_step = 1;
       }
-      if (speed == 2)
+      if (speed == 2) {
+        sf->comp_inter_joint_search_thresh = BLOCK_SIZE_SB8X8;
         sf->use_lastframe_partitioning = 1;
+        sf->first_step = 0;
+      }
 
      break;
 
   }; /* switch */
 
   // Set rd thresholds based on mode and speed setting
-  set_rd_speed_thresholds(cpi, mode, speed);
+  if(cpi->sf.adjust_thresholds_by_speed)
+    set_rd_speed_thresholds(cpi, mode, speed);
+  else
+    set_rd_speed_thresholds(cpi, mode, 0);
 
   // Slow quant, dct and trellis not worthwhile for first pass
   // so make sure they are always turned off.
index 6d09dcc..5d55e01 100644 (file)
@@ -217,6 +217,11 @@ typedef struct {
   int comp_inter_joint_search_thresh;
   int adpative_rd_thresh;
   int use_lastframe_partitioning;
+  int use_largest_txform;
+  int use_8tap_always;
+  int use_avoid_tested_higherror;
+  int skip_lots_of_modes;
+  int adjust_thresholds_by_speed;
 } SPEED_FEATURES;
 
 enum BlockSize {
index 9cb7ab0..99b238f 100644 (file)
@@ -614,7 +614,7 @@ static void super_block_yrd(VP9_COMP *cpi,
   if (mbmi->ref_frame[0] > INTRA_FRAME)
     vp9_subtract_sby(x, bs);
 
-  if (cpi->speed > 4) {
+  if (cpi->sf.use_largest_txform) {
     if (bs >= BLOCK_SIZE_SB32X32) {
       mbmi->txfm_size = TX_32X32;
     } else if (bs >= BLOCK_SIZE_MB16X16) {
@@ -2236,7 +2236,7 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
         (mbmi->mv[1].as_mv.col & 15) == 0;
   // Search for best switchable filter by checking the variance of
   // pred error irrespective of whether the filter will be used
-  if (cpi->speed > 4) {
+  if (cpi->sf.use_8tap_always) {
     *best_filter = EIGHTTAP;
   } else {
     int i, newbest;
@@ -2536,7 +2536,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
     best_txfm_rd[i] = INT64_MAX;
 
   // Create a mask set to 1 for each frame used by a smaller resolution.
-  if (cpi->speed > 0) {
+  if (cpi->sf.use_avoid_tested_higherror) {
     switch (block_size) {
       case BLOCK_64X64:
         for (i = 0; i < 4; i++) {
@@ -2576,8 +2576,9 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
     frame_mv[NEWMV][ref_frame].as_int = INVALID_MV;
     frame_mv[ZEROMV][ref_frame].as_int = 0;
   }
-  if (cpi->speed == 0
-      || (cpi->speed > 0 && (ref_frame_mask & (1 << INTRA_FRAME)))) {
+  if (!cpi->sf.use_avoid_tested_higherror
+      || (cpi->sf.use_avoid_tested_higherror
+          && (ref_frame_mask & (1 << INTRA_FRAME)))) {
     mbmi->mode = DC_PRED;
     mbmi->ref_frame[0] = INTRA_FRAME;
     for (i = 0; i <= (bsize < BLOCK_SIZE_MB16X16 ? TX_4X4 :
@@ -2623,7 +2624,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
     this_mode = vp9_mode_order[mode_index].mode;
     ref_frame = vp9_mode_order[mode_index].ref_frame;
 
-    if (cpi->speed > 0 && bsize >= BLOCK_SIZE_SB8X8) {
+    if (cpi->sf.use_avoid_tested_higherror && bsize >= BLOCK_SIZE_SB8X8) {
       if (!(ref_frame_mask & (1 << ref_frame))) {
         continue;
       }