Partition the ans experiment into 'ans' and 'rans'

The (new) ans experiment replaces the bool coder with uABS bools. The
'rans' experiment adds multisymbol coding.

This matches the setup in aom/master.

Change-Id: Ida8372ccabf1e1e9afc45fe66362cda35a491222
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 948c4f5..4f650e9 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -666,11 +666,11 @@
   while (p < stop && p->token != EOSB_TOKEN) {
     const int token = p->token;
     aom_tree_index index = 0;
-#if !CONFIG_ANS
+#if !CONFIG_RANS
     const struct av1_token *const coef_encoding = &av1_coef_encodings[token];
     int coef_value = coef_encoding->value;
     int coef_length = coef_encoding->len;
-#endif  // !CONFIG_ANS
+#endif  // !CONFIG_RANS
 #if CONFIG_AOM_HIGHBITDEPTH
     const av1_extra_bit *const extra_bits_av1 =
         (bit_depth == AOM_BITS_12)
@@ -682,7 +682,7 @@
     (void)bit_depth;
 #endif  // CONFIG_AOM_HIGHBITDEPTH
 
-#if CONFIG_ANS
+#if CONFIG_RANS
     /* skip one or two nodes */
     if (!p->skip_eob_node) aom_write(w, token != EOB_TOKEN, p->context_tree[0]);
 
@@ -715,7 +715,7 @@
         }
       }
     }
-#endif  // CONFIG_ANS
+#endif  // CONFIG_RANS
 
     if (extra_bits_av1->base_val) {
       const int extra_bits = p->extra;
@@ -1584,7 +1584,7 @@
 #define write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled, \
                               mi_row, mi_col)                              \
   write_modes_b(cpi, tile, w, tok, tok_end, mi_row, mi_col)
-#endif  // CONFIG_ANS && CONFIG_SUPERTX
+#endif  // CONFIG_SUPERTX
 
 static void write_modes_b(AV1_COMP *cpi, const TileInfo *const tile,
                           aom_writer *w, const TOKENEXTRA **tok,
@@ -1598,11 +1598,11 @@
   MODE_INFO *m;
   int plane;
   int bh, bw;
-#if CONFIG_ANS
+#if CONFIG_RANS
   (void)tok;
   (void)tok_end;
   (void)plane;
-#endif  // !CONFIG_ANS
+#endif  // !CONFIG_RANS
 
   xd->mi = cm->mi_grid_visible + (mi_row * cm->mi_stride + mi_col);
   m = xd->mi[0];
@@ -1777,7 +1777,7 @@
 #define write_modes_sb_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled, \
                                mi_row, mi_col, bsize)                       \
   write_modes_sb(cpi, tile, w, tok, tok_end, mi_row, mi_col, bsize)
-#endif  // CONFIG_ANS && CONFIG_SUPERTX
+#endif  // CONFIG_SUPERTX
 
 static void write_modes_sb(AV1_COMP *const cpi, const TileInfo *const tile,
                            aom_writer *const w, const TOKENEXTRA **tok,
@@ -2390,9 +2390,9 @@
   const TX_MODE tx_mode = cpi->common.tx_mode;
   const TX_SIZE max_tx_size = tx_mode_to_biggest_tx_size[tx_mode];
   TX_SIZE tx_size;
-#if CONFIG_ANS
+#if CONFIG_RANS
   int update = 0;
-#endif  // CONFIG_ANS
+#endif  // CONFIG_RANS
 #if CONFIG_ENTROPY
   AV1_COMMON *cm = &cpi->common;
   SUBFRAME_STATS *subframe_stats = &cpi->subframe_stats;
@@ -2440,18 +2440,18 @@
 
         update_coef_probs_subframe(w, cpi, tx_size, cpi->branch_ct_buf,
                                    frame_coef_probs);
-#if CONFIG_ANS
+#if CONFIG_RANS
         update = 1;
-#endif  // CONFIG_ANS
+#endif  // CONFIG_RANS
       } else {
 #endif  // CONFIG_ENTROPY
         build_tree_distribution(cpi, tx_size, frame_branch_ct,
                                 frame_coef_probs);
         update_coef_probs_common(w, cpi, tx_size, frame_branch_ct,
                                  frame_coef_probs);
-#if CONFIG_ANS
+#if CONFIG_RANS
         update = 1;
-#endif  // CONFIG_ANS
+#endif  // CONFIG_RANS
 #if CONFIG_ENTROPY
       }
 #endif  // CONFIG_ENTROPY
@@ -2476,9 +2476,9 @@
     av1_copy(cm->counts.eob_branch, eob_counts_copy);
   }
 #endif  // CONFIG_ENTROPY
-#if CONFIG_ANS
+#if CONFIG_RANS
   if (update) av1_coef_pareto_cdfs(cpi->common.fc);
-#endif  // CONFIG_ANS
+#endif  // CONFIG_RANS
 }
 
 #if CONFIG_LOOP_RESTORATION
diff --git a/av1/encoder/tokenize.c b/av1/encoder/tokenize.c
index e95e52b..561beed 100644
--- a/av1/encoder/tokenize.c
+++ b/av1/encoder/tokenize.c
@@ -336,12 +336,12 @@
 };
 #endif
 
-#if !CONFIG_ANS
+#if !CONFIG_RANS
 const struct av1_token av1_coef_encodings[ENTROPY_TOKENS] = {
   { 2, 2 },  { 6, 3 },   { 28, 5 },  { 58, 6 },  { 59, 6 },  { 60, 6 },
   { 61, 6 }, { 124, 7 }, { 125, 7 }, { 126, 7 }, { 127, 7 }, { 0, 1 }
 };
-#endif  // !CONFIG_ANS
+#endif  // !CONFIG_RANS
 
 struct tokenize_b_args {
   const AV1_COMP *cpi;
@@ -386,17 +386,17 @@
 }
 
 static INLINE void add_token(TOKENEXTRA **t, const aom_prob *context_tree,
-#if CONFIG_ANS || CONFIG_DAALA_EC
+#if CONFIG_RANS || CONFIG_DAALA_EC
                              const aom_cdf_prob (*token_cdf)[ENTROPY_TOKENS],
-#endif  // CONFIG_ANS
+#endif  // CONFIG_RANS
                              int32_t extra, uint8_t token,
                              uint8_t skip_eob_node, unsigned int *counts) {
   (*t)->token = token;
   (*t)->extra = extra;
   (*t)->context_tree = context_tree;
-#if CONFIG_ANS || CONFIG_DAALA_EC
+#if CONFIG_RANS || CONFIG_DAALA_EC
   (*t)->token_cdf = token_cdf;
-#endif  // CONFIG_ANS
+#endif  // CONFIG_RANS
   (*t)->skip_eob_node = skip_eob_node;
   (*t)++;
   ++counts[token];
@@ -489,10 +489,10 @@
   aom_prob(*const coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] =
       cpi->common.fc->coef_probs[txsize_sqr_map[tx_size]][type][ref];
 #endif  // CONFIG_ENTROPY
-#if CONFIG_ANS || CONFIG_DAALA_EC
+#if CONFIG_RANS || CONFIG_DAALA_EC
   aom_cdf_prob(*const coef_cdfs)[COEFF_CONTEXTS][ENTROPY_TOKENS] =
       cpi->common.fc->coef_cdfs[tx_size][type][ref];
-#endif  // CONFIG_ANS
+#endif
   unsigned int(*const eob_branch)[COEFF_CONTEXTS] =
       td->counts->eob_branch[txsize_sqr_map[tx_size]][type][ref];
   const uint8_t *const band = get_band_translate(tx_size);
@@ -513,9 +513,9 @@
     av1_get_token_extra(v, &token, &extra);
 
     add_token(&t, coef_probs[band[c]][pt],
-#if CONFIG_ANS || CONFIG_DAALA_EC
+#if CONFIG_RANS || CONFIG_DAALA_EC
               (const aom_cdf_prob(*)[ENTROPY_TOKENS]) & coef_cdfs[band[c]][pt],
-#endif  // CONFIG_ANS
+#endif
               extra, (uint8_t)token, (uint8_t)skip_eob, counts[band[c]][pt]);
 
     token_cache[scan[c]] = av1_pt_energy_class[token];
@@ -525,7 +525,7 @@
   }
   if (c < seg_eob) {
     add_token(&t, coef_probs[band[c]][pt],
-#if CONFIG_ANS || CONFIG_DAALA_EC
+#if CONFIG_RANS || CONFIG_DAALA_EC
               NULL,
 #endif
               0, EOB_TOKEN, 0, counts[band[c]][pt]);
diff --git a/av1/encoder/tokenize.h b/av1/encoder/tokenize.h
index e869a19..ae896a6 100644
--- a/av1/encoder/tokenize.h
+++ b/av1/encoder/tokenize.h
@@ -46,9 +46,9 @@
 
 extern const aom_tree_index av1_coef_tree[];
 extern const aom_tree_index av1_coef_con_tree[];
-#if !CONFIG_ANS
+#if !CONFIG_RANS
 extern const struct av1_token av1_coef_encodings[];
-#endif  // !CONFIG_ANS
+#endif  // !CONFIG_RANS
 
 int av1_is_skippable_in_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane);
 int av1_has_high_freq_in_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane);