]> granicus.if.org Git - libvpx/commitdiff
Add a speed feature for inter tx type search
authorhui su <huisu@google.com>
Sat, 28 May 2016 17:51:05 +0000 (10:51 -0700)
committerhui su <huisu@google.com>
Tue, 31 May 2016 17:34:35 +0000 (10:34 -0700)
Seperate prediction mode and tx type search for inter
modes. Enabled for speed >=1.

baseline:
speed increase     40%
compression drop   0.30%/0.29% on lowres/midres

ext-tx:
speed increase    160%
compression drop  1.08%/0.95% on lowres/midres

Change-Id: Ieb34b1ee80df6980d16e26a5783e08cc0deae55b

vp10/encoder/block.h
vp10/encoder/rdopt.c
vp10/encoder/speed_features.c
vp10/encoder/speed_features.h

index 941252667b3070018963f10d10fe5e92e91eca26..4b5831d1618c61a0e5bb578f2da50c9041d15fed 100644 (file)
@@ -183,6 +183,8 @@ struct macroblock {
 
   // use default transform and skip transform type search for intra modes
   int use_default_intra_tx_type;
+  // use default transform and skip transform type search for inter modes
+  int use_default_inter_tx_type;
 };
 
 #ifdef __cplusplus
index 58a7042f40db5806edbfeb407cbeb410b5a183f7..133f1621ec012393f8f8f055e44a44aa03b7517a 100644 (file)
@@ -1579,6 +1579,9 @@ static int64_t choose_tx_size_fix_type(VP10_COMP *cpi,
     if (!is_inter && x->use_default_intra_tx_type &&
         tx_type != get_default_tx_type(0, xd, 0, n))
       continue;
+    if (is_inter && x->use_default_inter_tx_type &&
+        tx_type != get_default_tx_type(0, xd, 0, n))
+      continue;
     if (max_tx_size == TX_32X32 && n == TX_4X4)
       continue;
 #if CONFIG_EXT_TX
@@ -1688,6 +1691,9 @@ static void choose_largest_tx_size(VP10_COMP *cpi, MACROBLOCK *x,
       !xd->lossless[mbmi->segment_id]) {
     for (tx_type = 0; tx_type < TX_TYPES; ++tx_type) {
       if (is_inter) {
+        if (x->use_default_inter_tx_type &&
+            tx_type != get_default_tx_type(0, xd, 0, mbmi->tx_size))
+          continue;
         if (!ext_tx_used_inter[ext_tx_set][tx_type])
           continue;
         if (cpi->sf.tx_type_search.prune_mode > NO_PRUNE) {
@@ -1749,6 +1755,9 @@ static void choose_largest_tx_size(VP10_COMP *cpi, MACROBLOCK *x,
       if (!is_inter && x->use_default_intra_tx_type &&
           tx_type != get_default_tx_type(0, xd, 0, mbmi->tx_size))
         continue;
+      if (is_inter && x->use_default_inter_tx_type &&
+          tx_type != get_default_tx_type(0, xd, 0, mbmi->tx_size))
+        continue;
       mbmi->tx_type = tx_type;
       txfm_rd_in_plane(x,
                        cpi,
@@ -8627,6 +8636,10 @@ void vp10_rd_pick_inter_mode_sb(VP10_COMP *cpi,
     x->use_default_intra_tx_type = 1;
   else
     x->use_default_intra_tx_type = 0;
+  if (cpi->sf.tx_type_search.fast_inter_tx_type_search)
+    x->use_default_inter_tx_type = 1;
+  else
+    x->use_default_inter_tx_type = 0;
 
   for (midx = 0; midx <= FINAL_MODE_SEARCH; ++midx) {
     int mode_index;
@@ -8649,10 +8662,15 @@ void vp10_rd_pick_inter_mode_sb(VP10_COMP *cpi,
 #endif
 
     if (midx == FINAL_MODE_SEARCH) {
-      if (!is_inter_mode(best_mbmode.mode) && best_mode_index >= 0 &&
+      if (best_mode_index < 0)
+        break;
+      mode_index = best_mode_index;
+      if (!is_inter_mode(best_mbmode.mode) &&
           x->use_default_intra_tx_type == 1) {
-        mode_index = best_mode_index;
         x->use_default_intra_tx_type = 0;
+      } else if (is_inter_mode(best_mbmode.mode) &&
+          x->use_default_inter_tx_type == 1) {
+        x->use_default_inter_tx_type = 0;
       } else {
         break;
       }
index f395fac155c089859cb3cb1e80b316c375e92c79..92b071e73c81e5b5d5aea562f8b07cf88d9cc6db 100644 (file)
@@ -161,6 +161,7 @@ static void set_good_speed_feature(VP10_COMP *cpi, VP10_COMMON *cm,
     sf->partition_search_breakout_rate_thr = 80;
     sf->tx_type_search.prune_mode = PRUNE_ONE;
     sf->tx_type_search.fast_intra_tx_type_search = 1;
+    sf->tx_type_search.fast_inter_tx_type_search = 1;
     // Use transform domain distortion.
     // Note var-tx expt always uses pixel domain distortion.
     sf->use_transform_domain_distortion = 1;
@@ -499,6 +500,7 @@ void vp10_set_speed_features_framesize_independent(VP10_COMP *cpi) {
   sf->partition_search_type = SEARCH_PARTITION;
   sf->tx_type_search.prune_mode = NO_PRUNE;
   sf->tx_type_search.fast_intra_tx_type_search = 0;
+  sf->tx_type_search.fast_inter_tx_type_search = 0;
   sf->less_rectangular_check = 0;
   sf->use_square_partition_only = 0;
   sf->auto_min_max_partition_size = NOT_IN_USE;
index db574347c4cecc15ede3716655dc9dcca0add14b..dc966e9acba34aa01bc57e50414ca970e13543ab 100644 (file)
@@ -195,6 +195,7 @@ typedef enum {
 typedef struct {
   TX_TYPE_PRUNE_MODE prune_mode;
   int fast_intra_tx_type_search;
+  int fast_inter_tx_type_search;
 } TX_TYPE_SEARCH;
 
 typedef enum {