Merge "Separate intra and inter tx_size counting" into nextgenv2
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c
index 07c745d..38900c1 100644
--- a/av1/decoder/decodemv.c
+++ b/av1/decoder/decodemv.c
@@ -1792,12 +1792,11 @@
       const int width = num_4x4_blocks_wide_lookup[bsize];
       const int height = num_4x4_blocks_high_lookup[bsize];
       int idx, idy;
-      int tx_size_cat = inter_tx_size_cat_lookup[bsize];
 #if CONFIG_EXT_TX && CONFIG_RECT_TX
       int is_rect_tx_allowed = inter_block && is_rect_tx_allowed_bsize(bsize) &&
                                !xd->lossless[mbmi->segment_id];
       int use_rect_tx = 0;
-
+      int tx_size_cat = inter_tx_size_cat_lookup[bsize];
       if (is_rect_tx_allowed) {
         use_rect_tx = aom_read(r, cm->fc->rect_tx_prob[tx_size_cat], ACCT_STR);
         if (xd->counts) {
@@ -1817,11 +1816,6 @@
 #if CONFIG_EXT_TX && CONFIG_RECT_TX
       }
 #endif
-      if (xd->counts) {
-        const int ctx = get_tx_size_context(xd);
-        ++xd->counts->tx_size[tx_size_cat][ctx]
-                             [txsize_sqr_up_map[mbmi->tx_size]];
-      }
     } else {
       if (inter_block)
         mbmi->tx_size = read_tx_size_inter(cm, xd, !mbmi->skip, r);
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 9dc6a2e..7d5db71 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -5261,11 +5261,15 @@
 #endif  // CONFIG_EXT_TX && CONFIG_RECT_TX
         if (is_inter)
           tx_partition_count_update(cm, xd, bsize, mi_row, mi_col, td->counts);
+        else
+          ++td->counts->tx_size[tx_size_cat][tx_size_ctx][coded_tx_size];
 #if CONFIG_EXT_TX && CONFIG_RECT_TX
       }
 #endif
 #endif
+#if !CONFIG_VAR_TX
       ++td->counts->tx_size[tx_size_cat][tx_size_ctx][coded_tx_size];
+#endif
     } else {
       int i, j;
       TX_SIZE tx_size;