Add table av1_nz_map_ctx_offset[]

There are too much if branches in get_nz_map_ctx_from_stats().
Look up the table to get the ctx offset when tx_class is TX_CLASS_2D.

Change-Id: Id08d450add5d17aeff8ab27c699d7e97ff88993d
diff --git a/av1/encoder/encodetxb.c b/av1/encoder/encodetxb.c
index 6d1750d..71bc63c 100644
--- a/av1/encoder/encodetxb.c
+++ b/av1/encoder/encodetxb.c
@@ -270,7 +270,7 @@
   }
 #else
   const int coeff_ctx = get_nz_map_ctx(levels, coeff_idx, txb_info->bwl,
-                                       txb_info->height, txb_info->tx_type);
+                                       txb_info->tx_size, txb_info->tx_type);
   if ((stats->rd_low < stats->rd) && (stats->low_qc == 0)) {
     stats->nz_rate = txb_costs->nz_map_cost[coeff_ctx][0];
   } else {
@@ -389,8 +389,8 @@
     const int pos = scan[c];
 
 #if CONFIG_LV_MAP_MULTI
-    coeff_ctx =
-        get_nz_map_ctx(levels, pos, bwl, height, c, c == eob - 1, tx_type);
+    coeff_ctx = get_nz_map_ctx(levels, pos, bwl, height, c, c == eob - 1,
+                               tx_size, tx_type);
     const tran_low_t v = tcoeff[pos];
 #if USE_BASE_EOB_ALPHABET
     if (c == eob - 1) {
@@ -410,7 +410,7 @@
                      ec_ctx->coeff_base_cdf[txs_ctx][plane_type][coeff_ctx], 4);
 #endif
 #else
-    coeff_ctx = get_nz_map_ctx(levels, pos, bwl, height, tx_type);
+    coeff_ctx = get_nz_map_ctx(levels, pos, bwl, tx_size, tx_type);
     const tran_low_t v = tcoeff[pos];
     const int is_nz = (v != 0);
 
@@ -436,7 +436,7 @@
   for (int i = 1; i < eob; ++i) {
     c = eob - 1 - i;
     const int pos = scan[c];
-    const int coeff_ctx = get_nz_map_ctx(levels, pos, bwl, height, tx_type);
+    const int coeff_ctx = get_nz_map_ctx(levels, pos, bwl, tx_size, tx_type);
     const tran_low_t v = tcoeff[pos];
     const int is_nz = (v != 0);
 
@@ -717,8 +717,8 @@
     const int is_nz = (v != 0);
     const int level = abs(v);
 #if CONFIG_LV_MAP_MULTI
-    coeff_ctx =
-        get_nz_map_ctx(levels, pos, bwl, height, c, c == eob - 1, tx_type);
+    coeff_ctx = get_nz_map_ctx(levels, pos, bwl, height, c, c == eob - 1,
+                               tx_size, tx_type);
 #if USE_BASE_EOB_ALPHABET
     if (c == eob - 1) {
       cost += coeff_costs
@@ -732,12 +732,12 @@
 #endif
 #else  // CONFIG_LV_MAP_MULTI
 #if USE_CAUSAL_BASE_CTX
-    coeff_ctx = get_nz_map_ctx(levels, pos, bwl, height, tx_type);
+    coeff_ctx = get_nz_map_ctx(levels, pos, bwl, tx_size, tx_type);
 #endif
 
     if (c < eob - 1) {
 #if !USE_CAUSAL_BASE_CTX
-      const int coeff_ctx = get_nz_map_ctx(levels, pos, bwl, height, tx_type);
+      const int coeff_ctx = get_nz_map_ctx(levels, pos, bwl, tx_size, tx_type);
 #endif
       cost += coeff_costs->nz_map_cost[coeff_ctx][is_nz];
     }
@@ -879,7 +879,7 @@
 #else
         txb_cache->nz_count_arr[coeff_idx],
 #endif
-        coeff_idx, bwl, height, txb_info->tx_type);
+        coeff_idx, bwl, txb_info->tx_size, txb_info->tx_type);
 
     // gen_base_count_mag_arr
     if (!has_base(qcoeff[coeff_idx], 0)) continue;
@@ -1101,7 +1101,7 @@
 #else
         count - 1,
 #endif
-        coeff_idx, txb_info->bwl, txb_info->height, txb_info->tx_type);
+        coeff_idx, txb_info->bwl, txb_info->tx_size, txb_info->tx_type);
     update_qcoeff(nb_coeff_idx, nb_coeff, txb_info);
     const int ctx = txb_cache->nz_ctx_arr[coeff_idx];
 #if CONFIG_LV_MAP_MULTI
@@ -1497,7 +1497,7 @@
 #else
             txb_cache->nz_count_arr[nb_coeff_idx],
 #endif
-            nb_coeff_idx, txb_info->bwl, txb_info->height, txb_info->tx_type);
+            nb_coeff_idx, txb_info->bwl, txb_info->tx_size, txb_info->tx_type);
       }
     }
   }
@@ -1591,7 +1591,7 @@
 #if CONFIG_LV_MAP_MULTI
   const int coeff_ctx =
       get_nz_map_ctx(txb_info->levels, pos, txb_info->bwl, txb_info->height,
-                     scan_idx, is_eob, txb_info->tx_type);
+                     scan_idx, is_eob, txb_info->tx_size, txb_info->tx_type);
 #if USE_BASE_EOB_ALPHABET
   if (is_eob) {
     cost +=
@@ -1607,12 +1607,12 @@
 #else
 #if USE_CAUSAL_BASE_CTX
   const int coeff_ctx = get_nz_map_ctx(txb_info->levels, pos, txb_info->bwl,
-                                       txb_info->height, txb_info->tx_type);
+                                       txb_info->tx_size, txb_info->tx_type);
 #endif
   if (scan_idx < txb_info->eob - 1) {
 #if !USE_CAUSAL_BASE_CTX
     const int coeff_ctx = get_nz_map_ctx(txb_info->levels, pos, txb_info->bwl,
-                                         txb_info->height, txb_info->tx_type);
+                                         txb_info->tx_size, txb_info->tx_type);
 #endif
     cost += txb_costs->nz_map_cost[coeff_ctx][is_nz];
   }
@@ -2288,8 +2288,8 @@
 #if CONFIG_LV_MAP_MULTI
     (void)is_nz;
     (void)nz_map_count;
-    coeff_ctx =
-        get_nz_map_ctx(levels, pos, bwl, height, c, c == eob - 1, tx_type);
+    coeff_ctx = get_nz_map_ctx(levels, pos, bwl, height, c, c == eob - 1,
+                               tx_size, tx_type);
 #if USE_BASE_EOB_ALPHABET
     if (c == eob - 1) {
       update_cdf(ec_ctx->coeff_base_eob_cdf[txsize_ctx][plane_type]
@@ -2318,7 +2318,7 @@
                AOMMIN(abs(v), 3), 4);
 #endif
 #elif USE_CAUSAL_BASE_CTX
-    coeff_ctx = get_nz_map_ctx(levels, pos, bwl, height, tx_type);
+    coeff_ctx = get_nz_map_ctx(levels, pos, bwl, tx_size, tx_type);
 
     if (c < eob - 1) {
       ++(*nz_map_count)[coeff_ctx][is_nz];
@@ -2341,7 +2341,7 @@
       }
     }
 #else
-    const int coeff_ctx = get_nz_map_ctx(levels, pos, bwl, height, tx_type);
+    const int coeff_ctx = get_nz_map_ctx(levels, pos, bwl, tx_size, tx_type);
 
     if (c == eob - 1) continue;