]> granicus.if.org Git - libvpx/commitdiff
Turn off tx type selection for intra blocks by default
authorhui su <huisu@google.com>
Wed, 18 Nov 2015 19:24:26 +0000 (11:24 -0800)
committerhui su <huisu@google.com>
Thu, 19 Nov 2015 07:16:25 +0000 (23:16 -0800)
Coding gain on derflr drops to +1.83%.

Change-Id: If68c429f09422a70513d9f1e8e36e10c928e034a

vp10/common/blockd.h
vp10/decoder/decodemv.c
vp10/encoder/bitstream.c
vp10/encoder/rdopt.c

index 3b94cc53c4e798c2772ef52faecc5d1c3fb5abf1..bb943970ed5f5b54be1e3b40aef62ad9a355dad4 100644 (file)
@@ -274,6 +274,8 @@ static const TX_TYPE intra_mode_to_tx_type_lookup[INTRA_MODES] = {
 };
 
 #if CONFIG_EXT_TX
+#define ALLOW_INTRA_EXT_TX 1
+
 static const int num_ext_tx_set_inter[EXT_TX_SETS_INTER] = {
   1, 17, 10, 2
 };
@@ -368,7 +370,8 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type,
       return DCT_DCT;
 
 #if CONFIG_EXT_TX
-    if (mbmi->sb_type >= BLOCK_8X8 && plane_type == PLANE_TYPE_Y)
+    if (mbmi->sb_type >= BLOCK_8X8 && plane_type == PLANE_TYPE_Y &&
+        ALLOW_INTRA_EXT_TX)
       return mbmi->tx_type;
 #endif  // CONFIG_EXT_TX
 
@@ -405,8 +408,10 @@ static INLINE TX_TYPE get_tx_type(PLANE_TYPE plane_type,
 #endif
     return DCT_DCT;
   if (mbmi->sb_type >= BLOCK_8X8) {
-    if (plane_type == PLANE_TYPE_Y)
+    if (plane_type == PLANE_TYPE_Y) {
+      if (is_inter_block(mbmi) || ALLOW_INTRA_EXT_TX)
       return mbmi->tx_type;
+    }
     if (is_inter_block(mbmi))
       // UV Inter only
       return (mbmi->tx_type == IDTX && tx_size == TX_32X32 ?
index 34d2c73806254501f6413a5d6a1ad7753f40491f..d66ddd9f9811bfabed01d204aac6e630d8106375 100644 (file)
@@ -422,7 +422,8 @@ static void read_intra_frame_mode_info(VP10_COMMON *const cm,
 #if CONFIG_EXT_TX
     if (get_ext_tx_types(mbmi->tx_size, mbmi->sb_type, 0) > 1 &&
         cm->base_qindex > 0 && !mbmi->skip &&
-        !segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
+        !segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP) &&
+        ALLOW_INTRA_EXT_TX) {
       FRAME_COUNTS *counts = xd->counts;
       int eset = get_ext_tx_set(mbmi->tx_size, mbmi->sb_type, 0);
       if (eset > 0) {
@@ -887,7 +888,7 @@ static void read_inter_frame_mode_info(VP10Decoder *const pbi,
           if (counts)
             ++counts->inter_ext_tx[eset][mbmi->tx_size][mbmi->tx_type];
         }
-      } else {
+      } else if (ALLOW_INTRA_EXT_TX) {
         if (eset > 0) {
           mbmi->tx_type = vpx_read_tree(r, vp10_ext_tx_intra_tree[eset],
                                         cm->fc->intra_ext_tx_prob[eset]
index 59edec25c3b39c5d89fb1dc0aea536d9587bfbc8..a80e5bd563bfa92778b328c2742fbe8a8f4186c6 100644 (file)
@@ -693,7 +693,7 @@ static void pack_inter_mode_mvs(VP10_COMP *cpi, const MODE_INFO *mi,
         vp10_write_token(w, vp10_ext_tx_inter_tree[eset],
                          cm->fc->inter_ext_tx_prob[eset][mbmi->tx_size],
                          &ext_tx_inter_encodings[eset][mbmi->tx_type]);
-    } else {
+    } else if (ALLOW_INTRA_EXT_TX) {
       if (eset > 0)
         vp10_write_token(
             w, vp10_ext_tx_intra_tree[eset],
@@ -790,7 +790,8 @@ static void write_mb_modes_kf(const VP10_COMMON *cm, const MACROBLOCKD *xd,
 #if CONFIG_EXT_TX
   if (get_ext_tx_types(mbmi->tx_size, bsize, 0) > 1 &&
       cm->base_qindex > 0 && !mbmi->skip &&
-      !segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) {
+      !segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP) &&
+      ALLOW_INTRA_EXT_TX) {
     int eset = get_ext_tx_set(mbmi->tx_size, bsize, 0);
     if (eset > 0)
       vp10_write_token(
index e0912b5dbb472a3ac27a0aab6048eb08968c1b22..7562b600b84597c382a56ffb76ca5596f5ad9dda 100644 (file)
@@ -691,6 +691,10 @@ static void choose_largest_tx_size(VP10_COMP *cpi, MACROBLOCK *x,
         if (!ext_tx_used_inter[ext_tx_set][tx_type])
           continue;
       } else {
+        if (!ALLOW_INTRA_EXT_TX && bs >= BLOCK_8X8) {
+          if (tx_type != intra_mode_to_tx_type_lookup[mbmi->mode])
+            continue;
+        }
         if (!ext_tx_used_intra[ext_tx_set][tx_type])
           continue;
       }
@@ -719,7 +723,7 @@ static void choose_largest_tx_size(VP10_COMP *cpi, MACROBLOCK *x,
             r += cpi->inter_tx_type_costs[ext_tx_set]
                                          [mbmi->tx_size][mbmi->tx_type];
         } else {
-          if (ext_tx_set > 0)
+          if (ext_tx_set > 0 && ALLOW_INTRA_EXT_TX)
             r += cpi->intra_tx_type_costs[ext_tx_set][mbmi->tx_size]
                                          [mbmi->mode][mbmi->tx_type];
         }
@@ -754,12 +758,16 @@ static void choose_largest_tx_size(VP10_COMP *cpi, MACROBLOCK *x,
   if (get_ext_tx_types(mbmi->tx_size, bs, is_inter) > 1 &&
       !xd->lossless[mbmi->segment_id] && *rate != INT_MAX) {
     int ext_tx_set = get_ext_tx_set(mbmi->tx_size, bs, is_inter);
-    if (is_inter)
-      *rate += cpi->inter_tx_type_costs[ext_tx_set][mbmi->tx_size]
-                                       [mbmi->tx_type];
-    else
-      *rate += cpi->intra_tx_type_costs[ext_tx_set][mbmi->tx_size]
-                                       [mbmi->mode][mbmi->tx_type];
+    if (is_inter) {
+      if (ext_tx_set > 0)
+        *rate += cpi->inter_tx_type_costs[ext_tx_set][mbmi->tx_size]
+                                                      [mbmi->tx_type];
+    } else {
+      if (ext_tx_set > 0 && ALLOW_INTRA_EXT_TX)
+        *rate +=
+            cpi->intra_tx_type_costs[ext_tx_set][mbmi->tx_size]
+                                                 [mbmi->mode][mbmi->tx_type];
+    }
   }
 #endif  // CONFIG_EXT_TX
 }
@@ -849,6 +857,10 @@ static void choose_tx_size_from_rd(VP10_COMP *cpi, MACROBLOCK *x,
         if (!ext_tx_used_inter[ext_tx_set][tx_type])
           continue;
       } else {
+        if (!ALLOW_INTRA_EXT_TX && bs >= BLOCK_8X8) {
+          if (tx_type != intra_mode_to_tx_type_lookup[mbmi->mode])
+            continue;
+        }
         if (!ext_tx_used_intra[ext_tx_set][tx_type])
           continue;
       }
@@ -874,7 +886,7 @@ static void choose_tx_size_from_rd(VP10_COMP *cpi, MACROBLOCK *x,
             r += cpi->inter_tx_type_costs[ext_tx_set]
                                          [mbmi->tx_size][mbmi->tx_type];
         } else {
-          if (ext_tx_set > 0)
+          if (ext_tx_set > 0 && ALLOW_INTRA_EXT_TX)
             r += cpi->intra_tx_type_costs[ext_tx_set][mbmi->tx_size]
                                          [mbmi->mode][mbmi->tx_type];
         }
@@ -2227,6 +2239,10 @@ static void select_tx_type_yrd(const VP10_COMP *cpi, MACROBLOCK *x,
       if (!ext_tx_used_inter[ext_tx_set][tx_type])
         continue;
     } else {
+      if (!ALLOW_INTRA_EXT_TX && bsize >= BLOCK_8X8) {
+        if (tx_type != intra_mode_to_tx_type_lookup[mbmi->mode])
+          continue;
+      }
       if (!ext_tx_used_intra[ext_tx_set][tx_type])
         continue;
     }
@@ -2251,7 +2267,7 @@ static void select_tx_type_yrd(const VP10_COMP *cpi, MACROBLOCK *x,
           this_rate += cpi->inter_tx_type_costs[ext_tx_set]
                                        [max_tx_size][mbmi->tx_type];
       } else {
-        if (ext_tx_set > 0)
+        if (ext_tx_set > 0 && ALLOW_INTRA_EXT_TX)
           this_rate += cpi->intra_tx_type_costs[ext_tx_set][max_tx_size]
                                        [mbmi->mode][mbmi->tx_type];
       }