Remove USE_CAUSAL_BR_CTX flag

Change-Id: I103547d5bd4c9537cc0640a10d50f5c3cb6b7771
diff --git a/av1/common/entropy.h b/av1/common/entropy.h
index 87a2eb6..1a75957 100644
--- a/av1/common/entropy.h
+++ b/av1/common/entropy.h
@@ -63,7 +63,6 @@
 
 #define SIG_COEF_CONTEXTS_2D 26
 #define SIG_COEF_CONTEXTS_1D 16
-#define USE_CAUSAL_BR_CTX 1
 #define SIG_COEF_CONTEXTS_EOB 4
 #define SIG_COEF_CONTEXTS (SIG_COEF_CONTEXTS_2D + SIG_COEF_CONTEXTS_1D)
 
@@ -72,11 +71,7 @@
 
 #define BR_TMP_OFFSET 12
 #define BR_REF_CAT 4
-#if USE_CAUSAL_BR_CTX
 #define LEVEL_CONTEXTS 21
-#else
-#define LEVEL_CONTEXTS (BR_TMP_OFFSET * BR_REF_CAT)
-#endif
 
 #define NUM_BASE_LEVELS 2
 
diff --git a/av1/common/txb_common.h b/av1/common/txb_common.h
index ab18d97..fafb9af 100644
--- a/av1/common/txb_common.h
+++ b/av1/common/txb_common.h
@@ -43,13 +43,11 @@
 };
 
 #define CONTEXT_MAG_POSITION_NUM 3
-#if USE_CAUSAL_BR_CTX
 static const int mag_ref_offset_with_txclass[3][CONTEXT_MAG_POSITION_NUM][2] = {
   { { 0, 1 }, { 1, 0 }, { 1, 1 } },
   { { 0, 1 }, { 1, 0 }, { 0, 2 } },
   { { 0, 1 }, { 1, 0 }, { 2, 0 } }
 };
-#endif
 static const int mag_ref_offset[CONTEXT_MAG_POSITION_NUM][2] = {
   { 0, 1 }, { 1, 0 }, { 1, 1 }
 };
@@ -195,7 +193,6 @@
   return count;
 }
 
-#if USE_CAUSAL_BR_CTX
 static INLINE void get_level_mag_with_txclass(const uint8_t *const levels,
                                               const int stride, const int row,
                                               const int col, int *const mag,
@@ -207,7 +204,6 @@
     mag[idx] = levels[pos];
   }
 }
-#endif
 
 static INLINE void get_level_mag(const uint8_t *const levels, const int stride,
                                  const int row, const int col, int *const mag) {
@@ -363,18 +359,13 @@
 
 static INLINE int get_br_ctx(const uint8_t *const levels,
                              const int c,  // raster order
-                             const int bwl, const int count
-#if USE_CAUSAL_BR_CTX
-                             ,
-                             const TX_TYPE tx_type
-#endif
-) {
+                             const int bwl, const int count,
+                             const TX_TYPE tx_type) {
   const int row = c >> bwl;
   const int col = c - (row << bwl);
   const int stride = (1 << bwl) + TX_PAD_HOR;
   int mag = 0;
   int nb_mag[3] = { 0 };
-#if USE_CAUSAL_BR_CTX
   (void)count;
   const TX_CLASS tx_class = tx_type_to_class[tx_type];
   get_level_mag_with_txclass(levels, stride, row, col, nb_mag, tx_class);
@@ -396,12 +387,6 @@
     }
   }
   return mag + 14;
-#else
-  get_level_mag(levels, stride, row, col, nb_mag);
-  for (int idx = 0; idx < 3; ++idx) mag = AOMMAX(mag, nb_mag[idx]);
-  const int ctx = get_br_ctx_from_count_mag(row, col, count, mag);
-  return ctx;
-#endif
 }
 
 #define SIG_REF_OFFSET_NUM 5
diff --git a/av1/decoder/decodetxb.c b/av1/decoder/decodetxb.c
index dd6a8bc..6a2b0a8 100644
--- a/av1/decoder/decodetxb.c
+++ b/av1/decoder/decodetxb.c
@@ -195,26 +195,21 @@
       break;
   }
 
-  // printf("Dec: ");
   if (k_eob_offset_bits[eob_pt] > 0) {
     int bit = aom_read_symbol(
         r, ec_ctx->eob_extra_cdf[txs_ctx][plane_type][eob_pt], 2, ACCT_STR);
-    // printf("eob_extra_cdf: %d %d %2d\n", txs_ctx, plane_type, eob_pt);
     if (bit) {
       eob_extra += (1 << (k_eob_offset_bits[eob_pt] - 1));
     }
 
     for (int i = 1; i < k_eob_offset_bits[eob_pt]; i++) {
       bit = aom_read_bit(r, ACCT_STR);
-      // printf("eob_bit:\n");
       if (bit) {
         eob_extra += (1 << (k_eob_offset_bits[eob_pt] - 1 - i));
       }
-      //  printf("%d ", bit);
     }
   }
   *eob = rec_eob_pos(eob_pt, eob_extra);
-  // printf("=>[%d, %d], (%d, %d)\n", seg_eob, *eob, eob_pt, eob_extra);
 
   for (int i = 0; i < *eob; ++i) {
     const int c = *eob - 1 - i;
@@ -232,12 +227,8 @@
     }
     int level = aom_read_symbol(r, cdf, nsymbs, ACCT_STR) + (c == *eob - 1);
     if (level > NUM_BASE_LEVELS) {
-#if USE_CAUSAL_BR_CTX
       const int br_ctx =
           get_br_ctx(levels, pos, bwl, level_counts[pos], tx_type);
-#else
-      const int br_ctx = get_br_ctx(levels, pos, bwl, level_counts[pos]);
-#endif
       for (int idx = 0; idx < COEFF_BASE_RANGE; idx += BR_CDF_SIZE - 1) {
         const int k = aom_read_symbol(
             r,
diff --git a/av1/encoder/encodetxb.c b/av1/encoder/encodetxb.c
index 5eb9007..83d4598 100644
--- a/av1/encoder/encodetxb.c
+++ b/av1/encoder/encodetxb.c
@@ -560,13 +560,8 @@
     if (level > NUM_BASE_LEVELS) {
       // level is above 1.
       const int base_range = level - 1 - NUM_BASE_LEVELS;
-#if USE_CAUSAL_BR_CTX
       const int br_ctx =
           get_br_ctx(levels, pos, bwl, level_counts[pos], tx_type);
-
-#else
-      const int br_ctx = get_br_ctx(levels, pos, bwl, level_counts[pos]);
-#endif
       for (int idx = 0; idx < COEFF_BASE_RANGE; idx += BR_CDF_SIZE - 1) {
         const int k = AOMMIN(base_range - idx, BR_CDF_SIZE - 1);
         aom_write_symbol(w, k,
@@ -757,11 +752,7 @@
       }
       if (level > NUM_BASE_LEVELS) {
         int ctx;
-#if USE_CAUSAL_BR_CTX
         ctx = get_br_ctx(levels, pos, bwl, level_counts[pos], tx_type);
-#else
-        ctx = get_br_ctx(levels, pos, bwl, level_counts[pos]);
-#endif
         const int base_range = level - 1 - NUM_BASE_LEVELS;
         if (base_range < COEFF_BASE_RANGE) {
           cost += coeff_costs->lps_cost[ctx][base_range];
@@ -1384,17 +1375,10 @@
       const int row = pos >> txb_info->bwl;
       const int col = pos - (row << txb_info->bwl);
 
-#if USE_CAUSAL_BR_CTX
       (void)col;
       const int count = 0;
       const int ctx = get_br_ctx(txb_info->levels, pos, txb_info->bwl, count,
                                  txb_info->tx_type);
-#else
-      const int count = get_level_count(
-          txb_info->levels, (1 << txb_info->bwl) + TX_PAD_HOR, row, col,
-          NUM_BASE_LEVELS, br_ref_offset, BR_CONTEXT_POSITION_NUM);
-      const int ctx = get_br_ctx(txb_info->levels, pos, txb_info->bwl, count);
-#endif
       cost += get_br_cost(abs_qc, ctx, txb_costs->lps_cost[ctx]);
       cost += get_golomb_cost(abs_qc);
     }
@@ -2357,33 +2341,19 @@
     }
     if (level > NUM_BASE_LEVELS) {
       const int base_range = level - 1 - NUM_BASE_LEVELS;
-#if USE_CAUSAL_BR_CTX
       const int br_ctx =
           get_br_ctx(levels, pos, bwl, level_counts[pos], tx_type);
-#else
-      const int br_ctx = get_br_ctx(levels, pos, bwl, level_counts[pos]);
-#endif
       for (int idx = 0; idx < COEFF_BASE_RANGE; idx += BR_CDF_SIZE - 1) {
         const int k = AOMMIN(base_range - idx, BR_CDF_SIZE - 1);
         if (allow_update_cdf) {
-          update_cdf(
-#if 0
-         ec_ctx->coeff_br_cdf[AOMMIN(txsize_ctx, TX_16X16)][plane_type][br_ctx],
-#else
-              ec_ctx->coeff_br_cdf[AOMMIN(txsize_ctx, TX_32X32)][plane_type]
-                                  [br_ctx],
-#endif
-              k, BR_CDF_SIZE);
+          update_cdf(ec_ctx->coeff_br_cdf[AOMMIN(txsize_ctx, TX_32X32)]
+                                         [plane_type][br_ctx],
+                     k, BR_CDF_SIZE);
         }
         for (int lps = 0; lps < BR_CDF_SIZE - 1; lps++) {
 #if CONFIG_ENTROPY_STATS
-#if 0
-         ++td->counts->coeff_lps[AOMMIN(txsize_ctx, TX_16X16)][plane_type][lps]
-                                 [ctx][lps == k];
-#else
           ++td->counts->coeff_lps[AOMMIN(txsize_ctx, TX_32X32)][plane_type][lps]
                                  [br_ctx][lps == k];
-#endif
 #endif  // CONFIG_ENTROPY_STATS
           if (lps == k) break;
         }