Remove ANS experiment

This experiment has been abandonned for AV1.

Change-Id: I8110720cef1b56dbce4008a998d8f4281dd2fe44
diff --git a/aom_dsp/ans.h b/aom_dsp/ans.h
deleted file mode 100644
index a7a2f0e..0000000
--- a/aom_dsp/ans.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2016, Alliance for Open Media. All rights reserved
- *
- * This source code is subject to the terms of the BSD 2 Clause License and
- * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
- * was not distributed with this source code in the LICENSE file, you can
- * obtain it at www.aomedia.org/license/software. If the Alliance for Open
- * Media Patent License 1.0 was not distributed with this source code in the
- * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
- */
-
-#ifndef AOM_DSP_ANS_H_
-#define AOM_DSP_ANS_H_
-// Constants, types and utilities for Asymmetric Numeral Systems
-// http://arxiv.org/abs/1311.2540v2
-
-#include <assert.h>
-#include "./aom_config.h"
-#include "aom/aom_integer.h"
-#include "aom_dsp/prob.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif  // __cplusplus
-
-// Use windowed ANS, size is passed in at initialization
-#define ANS_MAX_SYMBOLS 1
-#define ANS_REVERSE 1
-
-typedef uint8_t AnsP8;
-#define ANS_P8_PRECISION 256u
-#define ANS_P8_SHIFT 8
-#define RANS_PROB_BITS 15
-#define RANS_PRECISION (1u << RANS_PROB_BITS)
-
-// L_BASE is the ANS base state. L_BASE % PRECISION must be 0.
-#define L_BASE (1u << 17)
-#define IO_BASE 256
-// Range I = { L_BASE, L_BASE + 1, ..., L_BASE * IO_BASE - 1 }
-
-#ifdef __cplusplus
-}  // extern "C"
-#endif  // __cplusplus
-#endif  // AOM_DSP_ANS_H_
diff --git a/aom_dsp/ansreader.h b/aom_dsp/ansreader.h
deleted file mode 100644
index 4971ff1..0000000
--- a/aom_dsp/ansreader.h
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Copyright (c) 2016, Alliance for Open Media. All rights reserved
- *
- * This source code is subject to the terms of the BSD 2 Clause License and
- * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
- * was not distributed with this source code in the LICENSE file, you can
- * obtain it at www.aomedia.org/license/software. If the Alliance for Open
- * Media Patent License 1.0 was not distributed with this source code in the
- * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
- */
-
-#ifndef AOM_DSP_ANSREADER_H_
-#define AOM_DSP_ANSREADER_H_
-// An implementation of Asymmetric Numeral Systems
-// http://arxiv.org/abs/1311.2540v2
-// Implements decoding of:
-// * rABS (range Asymmetric Binary Systems), a boolean coder
-// * rANS (range Asymmetric Numeral Systems), a multi-symbol coder
-
-#include <assert.h>
-#include "./aom_config.h"
-#include "aom/aom_integer.h"
-#include "aom_dsp/prob.h"
-#include "aom_dsp/ans.h"
-#include "aom_ports/mem_ops.h"
-#if CONFIG_ACCOUNTING
-#include "av1/decoder/accounting.h"
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif  // __cplusplus
-
-struct AnsDecoder {
-  const uint8_t *buf;
-  int buf_offset;
-  uint32_t state;
-#if ANS_MAX_SYMBOLS
-  int symbols_left;
-  int window_size;
-#endif
-#if CONFIG_ACCOUNTING
-  Accounting *accounting;
-#endif
-  uint8_t allow_update_cdf;
-};
-
-static INLINE int ans_read_reinit(struct AnsDecoder *const ans);
-
-static INLINE unsigned refill_state(struct AnsDecoder *const ans,
-                                    unsigned state) {
-#if ANS_REVERSE
-  while (state < L_BASE && ans->buf_offset < 0) {
-    state = state * IO_BASE + ans->buf[ans->buf_offset++];
-  }
-#else
-  while (state < L_BASE && ans->buf_offset > 0) {
-    state = state * IO_BASE + ans->buf[--ans->buf_offset];
-  }
-#endif
-  return state;
-}
-
-// Decode one rABS encoded boolean where the probability of the value being zero
-// is p0.
-static INLINE int rabs_read(struct AnsDecoder *ans, AnsP8 p0) {
-#if ANS_MAX_SYMBOLS
-  if (ans->symbols_left-- == 0) {
-    ans_read_reinit(ans);
-    ans->symbols_left--;
-  }
-#endif
-  unsigned state = refill_state(ans, ans->state);
-  const unsigned quotient = state / ANS_P8_PRECISION;
-  const unsigned remainder = state % ANS_P8_PRECISION;
-  const int value = remainder >= p0;
-  const unsigned qp0 = quotient * p0;
-  if (value)
-    state = state - qp0 - p0;
-  else
-    state = qp0 + remainder;
-  ans->state = state;
-  return value;
-}
-
-// Decode one rABS encoded boolean where the probability of the value being zero
-// is one half.
-static INLINE int rabs_read_bit(struct AnsDecoder *ans) {
-#if ANS_MAX_SYMBOLS
-  if (ans->symbols_left-- == 0) {
-    ans_read_reinit(ans);
-    ans->symbols_left--;
-  }
-#endif
-  unsigned state = refill_state(ans, ans->state);
-  const int value = !!(state & 0x80);
-  ans->state = ((state >> 1) & ~0x7F) | (state & 0x7F);
-  return value;
-}
-
-struct rans_dec_sym {
-  uint8_t val;
-  aom_cdf_prob prob;
-  aom_cdf_prob cum_prob;  // not-inclusive
-};
-
-static INLINE void fetch_sym(struct rans_dec_sym *out, const aom_cdf_prob *cdf,
-                             aom_cdf_prob rem) {
-  int i;
-  aom_cdf_prob cum_prob = 0, top_prob;
-  // TODO(skal): if critical, could be a binary search.
-  // Or, better, an O(1) alias-table.
-  for (i = 0; rem >= (top_prob = cdf[i]); ++i) {
-    cum_prob = top_prob;
-  }
-  out->val = i;
-  out->prob = top_prob - cum_prob;
-  out->cum_prob = cum_prob;
-}
-
-static INLINE int rans_read(struct AnsDecoder *ans, const aom_cdf_prob *tab) {
-  unsigned rem;
-  unsigned quo;
-  struct rans_dec_sym sym;
-#if ANS_MAX_SYMBOLS
-  if (ans->symbols_left-- == 0) {
-    ans_read_reinit(ans);
-    ans->symbols_left--;
-  }
-#endif
-  ans->state = refill_state(ans, ans->state);
-  quo = ans->state / RANS_PRECISION;
-  rem = ans->state % RANS_PRECISION;
-  fetch_sym(&sym, tab, rem);
-  ans->state = quo * sym.prob + rem - sym.cum_prob;
-  return sym.val;
-}
-
-static INLINE int ans_read_init(struct AnsDecoder *const ans,
-                                const uint8_t *const buf, int offset) {
-  unsigned x;
-  if (offset < 1) return 1;
-#if ANS_REVERSE
-  ans->buf = buf + offset;
-  ans->buf_offset = -offset;
-  x = buf[0];
-  if ((x & 0x80) == 0) {  // Marker is 0xxx xxxx
-    if (offset < 2) return 1;
-    ans->buf_offset += 2;
-    ans->state = mem_get_be16(buf) & 0x7FFF;
-#if L_BASE * IO_BASE > (1 << 23)
-  } else if ((x & 0xC0) == 0x80) {  // Marker is 10xx xxxx
-    if (offset < 3) return 1;
-    ans->buf_offset += 3;
-    ans->state = mem_get_be24(buf) & 0x3FFFFF;
-  } else {  // Marker is 11xx xxxx
-    if (offset < 4) return 1;
-    ans->buf_offset += 4;
-    ans->state = mem_get_be32(buf) & 0x3FFFFFFF;
-#else
-  } else {  // Marker is 1xxx xxxx
-    if (offset < 3) return 1;
-    ans->buf_offset += 3;
-    ans->state = mem_get_be24(buf) & 0x7FFFFF;
-#endif
-  }
-#else
-  ans->buf = buf;
-  x = buf[offset - 1];
-  if ((x & 0x80) == 0) {  // Marker is 0xxx xxxx
-    if (offset < 2) return 1;
-    ans->buf_offset = offset - 2;
-    ans->state = mem_get_le16(buf + offset - 2) & 0x7FFF;
-  } else if ((x & 0xC0) == 0x80) {  // Marker is 10xx xxxx
-    if (offset < 3) return 1;
-    ans->buf_offset = offset - 3;
-    ans->state = mem_get_le24(buf + offset - 3) & 0x3FFFFF;
-  } else if ((x & 0xE0) == 0xE0) {  // Marker is 111x xxxx
-    if (offset < 4) return 1;
-    ans->buf_offset = offset - 4;
-    ans->state = mem_get_le32(buf + offset - 4) & 0x1FFFFFFF;
-  } else {
-    // Marker 110x xxxx implies this byte is a superframe marker
-    return 1;
-  }
-#endif  // ANS_REVERSE
-#if CONFIG_ACCOUNTING
-  ans->accounting = NULL;
-#endif
-  ans->state += L_BASE;
-  if (ans->state >= L_BASE * IO_BASE) return 1;
-#if ANS_MAX_SYMBOLS
-  assert(ans->window_size > 1);
-  ans->symbols_left = ans->window_size;
-#endif
-  return 0;
-}
-
-#if ANS_REVERSE
-static INLINE int ans_read_reinit(struct AnsDecoder *const ans) {
-  return ans_read_init(ans, ans->buf + ans->buf_offset, -ans->buf_offset);
-}
-#endif
-
-static INLINE int ans_read_end(const struct AnsDecoder *const ans) {
-  return ans->buf_offset == 0 && ans->state < L_BASE;
-}
-
-static INLINE int ans_reader_has_error(const struct AnsDecoder *const ans) {
-  return ans->state < L_BASE / RANS_PRECISION;
-}
-#ifdef __cplusplus
-}  // extern "C"
-#endif  // __cplusplus
-#endif  // AOM_DSP_ANSREADER_H_
diff --git a/aom_dsp/answriter.h b/aom_dsp/answriter.h
deleted file mode 100644
index 353acf1..0000000
--- a/aom_dsp/answriter.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2016, Alliance for Open Media. All rights reserved
- *
- * This source code is subject to the terms of the BSD 2 Clause License and
- * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
- * was not distributed with this source code in the LICENSE file, you can
- * obtain it at www.aomedia.org/license/software. If the Alliance for Open
- * Media Patent License 1.0 was not distributed with this source code in the
- * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
- */
-
-#ifndef AOM_DSP_ANSWRITER_H_
-#define AOM_DSP_ANSWRITER_H_
-// An implementation of Asymmetric Numeral Systems
-// http://arxiv.org/abs/1311.2540v2
-// Implements encoding of:
-// * rABS (range Asymmetric Binary Systems), a boolean coder
-// * rANS (range Asymmetric Numeral Systems), a multi-symbol coder
-
-#include <assert.h>
-#include "./aom_config.h"
-#include "aom/aom_integer.h"
-#include "aom_dsp/ans.h"
-#include "aom_dsp/prob.h"
-#include "aom_ports/mem_ops.h"
-#include "av1/common/odintrin.h"
-
-#if RANS_PRECISION <= OD_DIVU_DMAX
-#define ANS_DIVREM(quotient, remainder, dividend, divisor) \
-  do {                                                     \
-    quotient = OD_DIVU_SMALL((dividend), (divisor));       \
-    remainder = (dividend) - (quotient) * (divisor);       \
-  } while (0)
-#else
-#define ANS_DIVREM(quotient, remainder, dividend, divisor) \
-  do {                                                     \
-    quotient = (dividend) / (divisor);                     \
-    remainder = (dividend) % (divisor);                    \
-  } while (0)
-#endif
-
-#define ANS_DIV8(dividend, divisor) OD_DIVU_SMALL((dividend), (divisor))
-
-#ifdef __cplusplus
-extern "C" {
-#endif  // __cplusplus
-
-struct AnsCoder {
-  uint8_t *buf;
-  int buf_offset;
-  uint32_t state;
-};
-
-static INLINE void ans_write_init(struct AnsCoder *const ans,
-                                  uint8_t *const buf) {
-  ans->buf = buf;
-  ans->buf_offset = 0;
-  ans->state = L_BASE;
-}
-
-static INLINE int ans_write_end(struct AnsCoder *const ans) {
-  uint32_t state;
-  int ans_size;
-  assert(ans->state >= L_BASE);
-  assert(ans->state < L_BASE * IO_BASE);
-  state = ans->state - L_BASE;
-  if (state < (1u << 15)) {
-    mem_put_le16(ans->buf + ans->buf_offset, (0x00u << 15) + state);
-    ans_size = ans->buf_offset + 2;
-#if ANS_REVERSE
-#if L_BASE * IO_BASE > (1 << 23)
-  } else if (state < (1u << 22)) {
-    mem_put_le24(ans->buf + ans->buf_offset, (0x02u << 22) + state);
-    ans_size = ans->buf_offset + 3;
-  } else if (state < (1u << 30)) {
-    mem_put_le32(ans->buf + ans->buf_offset, (0x03u << 30) + state);
-    ans_size = ans->buf_offset + 4;
-#else
-  } else if (state < (1u << 23)) {
-    mem_put_le24(ans->buf + ans->buf_offset, (0x01u << 23) + state);
-    ans_size = ans->buf_offset + 3;
-#endif
-#else
-  } else if (state < (1u << 22)) {
-    mem_put_le24(ans->buf + ans->buf_offset, (0x02u << 22) + state);
-    ans_size = ans->buf_offset + 3;
-  } else if (state < (1u << 29)) {
-    mem_put_le32(ans->buf + ans->buf_offset, (0x07u << 29) + state);
-    ans_size = ans->buf_offset + 4;
-#endif
-  } else {
-    assert(0 && "State is too large to be serialized");
-    return ans->buf_offset;
-  }
-#if ANS_REVERSE
-  {
-    int i;
-    uint8_t tmp;
-    for (i = 0; i < (ans_size >> 1); i++) {
-      tmp = ans->buf[i];
-      ans->buf[i] = ans->buf[ans_size - 1 - i];
-      ans->buf[ans_size - 1 - i] = tmp;
-    }
-    ans->buf += ans_size;
-    ans->buf_offset = 0;
-    ans->state = L_BASE;
-  }
-#endif
-  return ans_size;
-}
-
-// Write one boolean using rABS where p0 is the probability of the value being
-// zero.
-static INLINE void rabs_write(struct AnsCoder *ans, int value, AnsP8 p0) {
-  const AnsP8 p = ANS_P8_PRECISION - p0;
-  const unsigned l_s = value ? p : p0;
-  unsigned state = ans->state;
-  while (state >= L_BASE / ANS_P8_PRECISION * IO_BASE * l_s) {
-    ans->buf[ans->buf_offset++] = state % IO_BASE;
-    state /= IO_BASE;
-  }
-  const unsigned quotient = ANS_DIV8(state, l_s);
-  const unsigned remainder = state - quotient * l_s;
-  ans->state = quotient * ANS_P8_PRECISION + remainder + (value ? p0 : 0);
-}
-
-// Encode one symbol using rANS.
-// cum_prob: The cumulative probability before this symbol (the offset of
-// the symbol in the symbol cycle)
-// prob: The probability of this symbol (l_s from the paper)
-// RANS_PRECISION takes the place of m from the paper.
-static INLINE void rans_write(struct AnsCoder *ans, aom_cdf_prob cum_prob,
-                              aom_cdf_prob prob) {
-  unsigned quotient, remainder;
-  while (ans->state >= L_BASE / RANS_PRECISION * IO_BASE * prob) {
-    ans->buf[ans->buf_offset++] = ans->state % IO_BASE;
-    ans->state /= IO_BASE;
-  }
-  ANS_DIVREM(quotient, remainder, ans->state, prob);
-  ans->state = quotient * RANS_PRECISION + remainder + cum_prob;
-}
-
-#undef ANS_DIV8
-#undef ANS_DIVREM
-#ifdef __cplusplus
-}  // extern "C"
-#endif  // __cplusplus
-#endif  // AOM_DSP_ANSWRITER_H_
diff --git a/aom_dsp/aom_dsp.cmake b/aom_dsp/aom_dsp.cmake
index 61140ab..1f0e172 100644
--- a/aom_dsp/aom_dsp.cmake
+++ b/aom_dsp/aom_dsp.cmake
@@ -269,16 +269,10 @@
       "${AOM_ROOT}/aom_dsp/mips/itrans8_dspr2.c")
 endif ()
 
-if (CONFIG_ANS)
-  set(AOM_DSP_COMMON_SOURCES
-      ${AOM_DSP_COMMON_SOURCES}
-      "${AOM_ROOT}/aom_dsp/ans.h")
-else ()
-  set(AOM_DSP_COMMON_SOURCES
-      ${AOM_DSP_COMMON_SOURCES}
-      "${AOM_ROOT}/aom_dsp/entcode.c"
-      "${AOM_ROOT}/aom_dsp/entcode.h")
-endif ()
+set(AOM_DSP_COMMON_SOURCES
+    ${AOM_DSP_COMMON_SOURCES}
+    "${AOM_ROOT}/aom_dsp/entcode.c"
+    "${AOM_ROOT}/aom_dsp/entcode.h")
 
 if (CONFIG_AV1)
   set(AOM_DSP_COMMON_SOURCES
@@ -304,18 +298,12 @@
       "${AOM_ROOT}/aom_dsp/bitreader_buffer.c"
       "${AOM_ROOT}/aom_dsp/bitreader_buffer.h")
 
-  if (CONFIG_ANS)
-    set(AOM_DSP_DECODER_SOURCES
-        ${AOM_DSP_DECODER_SOURCES}
-        "${AOM_ROOT}/aom_dsp/ansreader.h")
-  else ()
-    set(AOM_DSP_DECODER_SOURCES
-        ${AOM_DSP_DECODER_SOURCES}
-        "${AOM_ROOT}/aom_dsp/daalaboolreader.c"
-        "${AOM_ROOT}/aom_dsp/daalaboolreader.h"
-        "${AOM_ROOT}/aom_dsp/entdec.c"
-        "${AOM_ROOT}/aom_dsp/entdec.h")
-  endif ()
+  set(AOM_DSP_DECODER_SOURCES
+      ${AOM_DSP_DECODER_SOURCES}
+      "${AOM_ROOT}/aom_dsp/daalaboolreader.c"
+      "${AOM_ROOT}/aom_dsp/daalaboolreader.h"
+      "${AOM_ROOT}/aom_dsp/entdec.c"
+      "${AOM_ROOT}/aom_dsp/entdec.h")
 endif ()
 
 if (CONFIG_AV1_ENCODER)
@@ -435,20 +423,12 @@
         "${AOM_ROOT}/aom_dsp/x86/sad_highbd_avx2.c")
   endif ()
 
-  if (CONFIG_ANS)
-    set(AOM_DSP_ENCODER_SOURCES
-        ${AOM_DSP_ENCODER_SOURCES}
-        "${AOM_ROOT}/aom_dsp/answriter.h"
-        "${AOM_ROOT}/aom_dsp/buf_ans.c"
-        "${AOM_ROOT}/aom_dsp/buf_ans.h")
-  else ()
-    set(AOM_DSP_ENCODER_SOURCES
-        ${AOM_DSP_ENCODER_SOURCES}
-        "${AOM_ROOT}/aom_dsp/daalaboolwriter.c"
-        "${AOM_ROOT}/aom_dsp/daalaboolwriter.h"
-        "${AOM_ROOT}/aom_dsp/entenc.c"
-        "${AOM_ROOT}/aom_dsp/entenc.h")
-  endif ()
+  set(AOM_DSP_ENCODER_SOURCES
+      ${AOM_DSP_ENCODER_SOURCES}
+      "${AOM_ROOT}/aom_dsp/daalaboolwriter.c"
+      "${AOM_ROOT}/aom_dsp/daalaboolwriter.h"
+      "${AOM_ROOT}/aom_dsp/entenc.c"
+      "${AOM_ROOT}/aom_dsp/entenc.h")
 
   if (CONFIG_INTERNAL_STATS)
     set(AOM_DSP_ENCODER_SOURCES
diff --git a/aom_dsp/aom_dsp.mk b/aom_dsp/aom_dsp.mk
index a682d68..a501a3a 100644
--- a/aom_dsp/aom_dsp.mk
+++ b/aom_dsp/aom_dsp.mk
@@ -20,19 +20,12 @@
 # bit reader
 DSP_SRCS-yes += prob.h
 DSP_SRCS-yes += prob.c
-DSP_SRCS-$(CONFIG_ANS) += ans.h
 
 ifeq ($(CONFIG_AV1_ENCODER),yes)
-ifeq ($(CONFIG_ANS),yes)
-DSP_SRCS-yes += answriter.h
-DSP_SRCS-yes += buf_ans.h
-DSP_SRCS-yes += buf_ans.c
-else
 DSP_SRCS-yes += entenc.c
 DSP_SRCS-yes += entenc.h
 DSP_SRCS-yes += daalaboolwriter.c
 DSP_SRCS-yes += daalaboolwriter.h
-endif
 DSP_SRCS-yes += bitwriter.h
 DSP_SRCS-yes += bitwriter_buffer.c
 DSP_SRCS-yes += bitwriter_buffer.h
@@ -47,14 +40,10 @@
 endif
 
 ifeq ($(CONFIG_AV1_DECODER),yes)
-ifeq ($(CONFIG_ANS),yes)
-DSP_SRCS-yes += ansreader.h
-else
 DSP_SRCS-yes += entdec.c
 DSP_SRCS-yes += entdec.h
 DSP_SRCS-yes += daalaboolreader.c
 DSP_SRCS-yes += daalaboolreader.h
-endif
 DSP_SRCS-yes += bitreader.h
 DSP_SRCS-yes += bitreader_buffer.c
 DSP_SRCS-yes += bitreader_buffer.h
@@ -66,10 +55,8 @@
 DSP_SRCS-yes += intrapred.c
 DSP_SRCS-yes += intrapred_common.h
 
-ifneq ($(CONFIG_ANS),yes)
 DSP_SRCS-yes += entcode.c
 DSP_SRCS-yes += entcode.h
-endif
 
 DSP_SRCS-$(HAVE_SSE) += x86/intrapred_sse2.asm
 DSP_SRCS-$(HAVE_SSE2) += x86/intrapred_sse2.asm
diff --git a/aom_dsp/bitreader.h b/aom_dsp/bitreader.h
index 1122e38..69709d9 100644
--- a/aom_dsp/bitreader.h
+++ b/aom_dsp/bitreader.h
@@ -19,11 +19,7 @@
 
 #include "aom/aomdx.h"
 #include "aom/aom_integer.h"
-#if CONFIG_ANS
-#include "aom_dsp/ansreader.h"
-#else
 #include "aom_dsp/daalaboolreader.h"
-#endif
 #include "aom_dsp/prob.h"
 #include "av1/common/odintrin.h"
 
@@ -63,63 +59,32 @@
 extern "C" {
 #endif
 
-#if CONFIG_ANS
-typedef struct AnsDecoder aom_reader;
-#else
 typedef struct daala_reader aom_reader;
-#endif
 
 static INLINE int aom_reader_init(aom_reader *r, const uint8_t *buffer,
                                   size_t size, aom_decrypt_cb decrypt_cb,
                                   void *decrypt_state) {
   (void)decrypt_cb;
   (void)decrypt_state;
-#if CONFIG_ANS
-  if (size > INT_MAX) return 1;
-  return ans_read_init(r, buffer, (int)size);
-#else
   return aom_daala_reader_init(r, buffer, (int)size);
-#endif
 }
 
 static INLINE const uint8_t *aom_reader_find_end(aom_reader *r) {
-#if CONFIG_ANS
-  (void)r;
-  assert(0 && "Use the raw buffer size with ANS");
-  return NULL;
-#else
   return aom_daala_reader_find_end(r);
-#endif
 }
 
 static INLINE int aom_reader_has_error(aom_reader *r) {
-#if CONFIG_ANS
-  return ans_reader_has_error(r);
-#else
   return aom_daala_reader_has_error(r);
-#endif
 }
 
 // Returns the position in the bit reader in bits.
 static INLINE uint32_t aom_reader_tell(const aom_reader *r) {
-#if CONFIG_ANS
-  (void)r;
-  assert(0 && "aom_reader_tell() is unimplemented for ANS");
-  return 0;
-#else
   return aom_daala_reader_tell(r);
-#endif
 }
 
 // Returns the position in the bit reader in 1/8th bits.
 static INLINE uint32_t aom_reader_tell_frac(const aom_reader *r) {
-#if CONFIG_ANS
-  (void)r;
-  assert(0 && "aom_reader_tell_frac() is unimplemented for ANS");
-  return 0;
-#else
   return aom_daala_reader_tell_frac(r);
-#endif
 }
 
 #if CONFIG_ACCOUNTING
@@ -143,11 +108,7 @@
 
 static INLINE int aom_read_(aom_reader *r, int prob ACCT_STR_PARAM) {
   int ret;
-#if CONFIG_ANS
-  ret = rabs_read(r, prob);
-#else
   ret = aom_daala_read(r, prob);
-#endif
 #if CONFIG_ACCOUNTING
   if (ACCT_STR_NAME) aom_process_accounting(r, ACCT_STR_NAME);
   aom_update_symb_counts(r, 1);
@@ -157,11 +118,7 @@
 
 static INLINE int aom_read_bit_(aom_reader *r ACCT_STR_PARAM) {
   int ret;
-#if CONFIG_ANS
-  ret = rabs_read_bit(r);  // Non trivial optimization at half probability
-#else
   ret = aom_read(r, 128, NULL);  // aom_prob_half
-#endif
 #if CONFIG_ACCOUNTING
   if (ACCT_STR_NAME) aom_process_accounting(r, ACCT_STR_NAME);
 #endif
@@ -181,12 +138,7 @@
 static INLINE int aom_read_cdf_(aom_reader *r, const aom_cdf_prob *cdf,
                                 int nsymbs ACCT_STR_PARAM) {
   int ret;
-#if CONFIG_ANS
-  (void)nsymbs;
-  ret = rans_read(r, cdf);
-#else
   ret = daala_read_symbol(r, cdf, nsymbs);
-#endif
 
 #if CONFIG_ACCOUNTING
   if (ACCT_STR_NAME) aom_process_accounting(r, ACCT_STR_NAME);
diff --git a/aom_dsp/bitwriter.h b/aom_dsp/bitwriter.h
index 50d0abc..d3f70bf 100644
--- a/aom_dsp/bitwriter.h
+++ b/aom_dsp/bitwriter.h
@@ -15,11 +15,7 @@
 #include <assert.h>
 #include "./aom_config.h"
 
-#if CONFIG_ANS
-#include "aom_dsp/buf_ans.h"
-#else
 #include "aom_dsp/daalaboolwriter.h"
-#endif
 #include "aom_dsp/prob.h"
 
 #if CONFIG_RD_DEBUG
@@ -31,11 +27,7 @@
 extern "C" {
 #endif
 
-#if CONFIG_ANS
-typedef struct BufAnsCoder aom_writer;
-#else
 typedef struct daala_writer aom_writer;
-#endif
 
 typedef struct TOKEN_STATS {
   int cost;
@@ -57,29 +49,15 @@
 }
 
 static INLINE void aom_start_encode(aom_writer *bc, uint8_t *buffer) {
-#if CONFIG_ANS
-  aom_buf_ans_alloc(bc, /* error context*/ NULL);
-  buf_ans_write_init(bc, buffer);
-#else
   aom_daala_start_encode(bc, buffer);
-#endif
 }
 
 static INLINE void aom_stop_encode(aom_writer *bc) {
-#if CONFIG_ANS
-  aom_buf_ans_flush(bc);
-  bc->pos = buf_ans_write_end(bc);
-#else
   aom_daala_stop_encode(bc);
-#endif
 }
 
 static INLINE void aom_write(aom_writer *br, int bit, int probability) {
-#if CONFIG_ANS
-  buf_rabs_write(br, bit, probability);
-#else
   aom_daala_write(br, bit, probability);
-#endif
 }
 
 static INLINE void aom_write_record(aom_writer *br, int bit, int probability,
@@ -93,11 +71,7 @@
 }
 
 static INLINE void aom_write_bit(aom_writer *w, int bit) {
-#if CONFIG_ANS
-  buf_rabs_write_bit(w, bit);
-#else
   aom_write(w, bit, 128);  // aom_prob_half
-#endif
 }
 
 static INLINE void aom_write_bit_record(aom_writer *w, int bit,
@@ -118,15 +92,7 @@
 
 static INLINE void aom_write_cdf(aom_writer *w, int symb,
                                  const aom_cdf_prob *cdf, int nsymbs) {
-#if CONFIG_ANS
-  (void)nsymbs;
-  assert(cdf);
-  const aom_cdf_prob cum_prob = symb > 0 ? cdf[symb - 1] : 0;
-  const aom_cdf_prob prob = cdf[symb] - cum_prob;
-  buf_rans_write(w, cum_prob, prob);
-#else
   daala_write_symbol(w, symb, cdf, nsymbs);
-#endif
 }
 
 static INLINE void aom_write_symbol(aom_writer *w, int symb, aom_cdf_prob *cdf,
diff --git a/aom_dsp/prob.h b/aom_dsp/prob.h
index f355f09..577d714 100644
--- a/aom_dsp/prob.h
+++ b/aom_dsp/prob.h
@@ -21,9 +21,7 @@
 #include "aom_ports/bitops.h"
 #include "aom_ports/mem.h"
 
-#if !CONFIG_ANS
 #include "aom_dsp/entcode.h"
-#endif
 
 #ifdef __cplusplus
 extern "C" {
@@ -39,11 +37,7 @@
 #define CDF_PROB_BITS 15
 #define CDF_PROB_TOP (1 << CDF_PROB_BITS)
 
-#if !CONFIG_ANS
 #define AOM_ICDF OD_ICDF
-#else
-#define AOM_ICDF(x) (x)
-#endif
 
 #define AOM_CDF2(a0) AOM_ICDF(a0), AOM_ICDF(CDF_PROB_TOP), 0
 #define AOM_CDF3(a0, a1) AOM_ICDF(a0), AOM_ICDF(a1), AOM_ICDF(CDF_PROB_TOP), 0
@@ -249,18 +243,11 @@
   tmp = AOM_ICDF(tmp0);
   diff = ((CDF_PROB_TOP - (nsymbs << rate2)) >> rate) << rate;
 
-// Single loop (faster)
-#if !CONFIG_ANS
+  // Single loop (faster)
   for (i = 0; i < nsymbs - 1; ++i, tmp -= tmp0) {
     tmp -= (i == val ? diff : 0);
     cdf[i] += ((tmp - cdf[i]) >> rate);
   }
-#else
-  for (i = 0; i < nsymbs - 1; ++i, tmp += tmp0) {
-    tmp += (i == val ? diff : 0);
-    cdf[i] -= ((cdf[i] - tmp) >> rate);
-  }
-#endif
 
 #endif
 
diff --git a/av1/av1_cx_iface.c b/av1/av1_cx_iface.c
index 09dd3a2..754cab9 100644
--- a/av1/av1_cx_iface.c
+++ b/av1/av1_cx_iface.c
@@ -84,9 +84,6 @@
   int render_width;
   int render_height;
   aom_superblock_size_t superblock_size;
-#if CONFIG_ANS && ANS_MAX_SYMBOLS
-  int ans_window_size_log2;
-#endif
 #if CONFIG_EXT_TILE
   unsigned int single_tile_decoding;
 #endif  // CONFIG_EXT_TILE
@@ -149,9 +146,6 @@
   0,                            // render width
   0,                            // render height
   AOM_SUPERBLOCK_SIZE_DYNAMIC,  // superblock_size
-#if CONFIG_ANS && ANS_MAX_SYMBOLS
-  23,  // ans_window_size_log2
-#endif
 #if CONFIG_EXT_TILE
   0,    // Single tile decoding is off by default.
 #endif  // CONFIG_EXT_TILE
@@ -397,9 +391,6 @@
   RANGE_CHECK(extra_cfg, color_space, AOM_CS_UNKNOWN, AOM_CS_SRGB);
 #endif
   RANGE_CHECK(extra_cfg, color_range, 0, 1);
-#if CONFIG_ANS && ANS_MAX_SYMBOLS
-  RANGE_CHECK(extra_cfg, ans_window_size_log2, 8, 23);
-#endif
 
 #if CONFIG_DIST_8X8
   if (extra_cfg->enable_dist_8x8 && extra_cfg->lossless)
@@ -616,9 +607,6 @@
 #if CONFIG_EXT_PARTITION
   oxcf->superblock_size = extra_cfg->superblock_size;
 #endif  // CONFIG_EXT_PARTITION
-#if CONFIG_ANS && ANS_MAX_SYMBOLS
-  oxcf->ans_window_size_log2 = extra_cfg->ans_window_size_log2;
-#endif  // CONFIG_ANS && ANS_MAX_SYMBOLS
 
 #if CONFIG_EXT_TILE
   oxcf->large_scale_tile = cfg->large_scale_tile;
@@ -1578,15 +1566,6 @@
   return update_extra_cfg(ctx, &extra_cfg);
 }
 
-#if CONFIG_ANS && ANS_MAX_SYMBOLS
-static aom_codec_err_t ctrl_set_ans_window_size_log2(aom_codec_alg_priv_t *ctx,
-                                                     va_list args) {
-  struct av1_extracfg extra_cfg = ctx->extra_cfg;
-  extra_cfg.ans_window_size_log2 = CAST(AV1E_SET_ANS_WINDOW_SIZE_LOG2, args);
-  return update_extra_cfg(ctx, &extra_cfg);
-}
-#endif
-
 static aom_codec_ctrl_fn_map_t encoder_ctrl_maps[] = {
   { AV1_COPY_REFERENCE, ctrl_copy_reference },
   { AOME_USE_REFERENCE, ctrl_use_reference },
@@ -1649,9 +1628,6 @@
   { AV1E_SET_MAX_GF_INTERVAL, ctrl_set_max_gf_interval },
   { AV1E_SET_RENDER_SIZE, ctrl_set_render_size },
   { AV1E_SET_SUPERBLOCK_SIZE, ctrl_set_superblock_size },
-#if CONFIG_ANS && ANS_MAX_SYMBOLS
-  { AV1E_SET_ANS_WINDOW_SIZE_LOG2, ctrl_set_ans_window_size_log2 },
-#endif
 #if CONFIG_EXT_TILE
   { AV1E_SET_SINGLE_TILE_DECODING, ctrl_set_single_tile_decoding },
 #endif  // CONFIG_EXT_TILE
diff --git a/av1/common/onyxc_int.h b/av1/common/onyxc_int.h
index 2faac10..6c256be 100644
--- a/av1/common/onyxc_int.h
+++ b/av1/common/onyxc_int.h
@@ -16,9 +16,6 @@
 #include "./av1_rtcd.h"
 #include "aom/internal/aom_codec_internal.h"
 #include "aom_util/aom_thread.h"
-#if CONFIG_ANS
-#include "aom_dsp/ans.h"
-#endif
 #include "av1/common/alloccommon.h"
 #include "av1/common/av1_loopfilter.h"
 #include "av1/common/entropy.h"
@@ -567,9 +564,6 @@
   int refresh_mask;
   int invalid_delta_frame_id_minus1;
 #endif  // CONFIG_REFERENCE_BUFFER
-#if CONFIG_ANS && ANS_MAX_SYMBOLS
-  int ans_window_size_log2;
-#endif
 #if CONFIG_LV_MAP
   LV_MAP_CTX_TABLE coeff_ctx_table;
 #endif
@@ -977,11 +971,7 @@
 static INLINE aom_cdf_prob cdf_element_prob(const aom_cdf_prob *cdf,
                                             size_t element) {
   assert(cdf != NULL);
-#if !CONFIG_ANS
   return (element > 0 ? cdf[element - 1] : CDF_PROB_TOP) - cdf[element];
-#else
-  return cdf[element] - (element > 0 ? cdf[element - 1] : 0);
-#endif
 }
 
 static INLINE void partition_gather_horz_alike(aom_cdf_prob *out,
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 0f17c53..1c26ad1 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -922,9 +922,6 @@
                                const size_t read_size,
                                struct aom_internal_error_info *error_info,
                                aom_reader *r, uint8_t allow_update_cdf,
-#if CONFIG_ANS && ANS_MAX_SYMBOLS
-                               int window_size,
-#endif  // CONFIG_ANS && ANS_MAX_SYMBOLS
                                aom_decrypt_cb decrypt_cb, void *decrypt_state) {
   // Validate the calculated partition length. If the buffer
   // described by the partition can't be fully read, then restrict
@@ -933,9 +930,6 @@
     aom_internal_error(error_info, AOM_CODEC_CORRUPT_FRAME,
                        "Truncated packet or corrupt tile length");
 
-#if CONFIG_ANS && ANS_MAX_SYMBOLS
-  r->window_size = window_size;
-#endif
   if (aom_reader_init(r, data, read_size, decrypt_cb, decrypt_state))
     aom_internal_error(error_info, AOM_CODEC_MEM_ERROR,
                        "Failed to allocate bool decoder %d", 1);
@@ -2198,11 +2192,8 @@
       av1_zero(td->dqcoeff);
       av1_tile_init(&td->xd.tile, td->cm, tile_row, tile_col);
       setup_bool_decoder(buf->data, data_end, buf->size, &cm->error,
-                         &td->bit_reader, allow_update_cdf,
-#if CONFIG_ANS && ANS_MAX_SYMBOLS
-                         1 << cm->ans_window_size_log2,
-#endif  // CONFIG_ANS && ANS_MAX_SYMBOLS
-                         pbi->decrypt_cb, pbi->decrypt_state);
+                         &td->bit_reader, allow_update_cdf, pbi->decrypt_cb,
+                         pbi->decrypt_state);
 #if CONFIG_ACCOUNTING
       if (pbi->acct_enabled) {
         td->bit_reader.accounting = &pbi->accounting;
@@ -2341,32 +2332,24 @@
 #if CONFIG_EXT_TILE
   if (cm->large_scale_tile) {
     if (n_tiles == 1) {
-#if CONFIG_ANS
-      return data_end;
-#else
       // Find the end of the single tile buffer
       return aom_reader_find_end(&pbi->tile_data->bit_reader);
-#endif  // CONFIG_ANS
     } else {
       // Return the end of the last tile buffer
       return tile_buffers[tile_rows - 1][tile_cols - 1].raw_data_end;
     }
   } else {
 #endif  // CONFIG_EXT_TILE
-#if CONFIG_ANS
-    return data_end;
-#else
 #if !CONFIG_OBU
-  {
-    // Get last tile data.
-    TileData *const td = pbi->tile_data + tile_cols * tile_rows - 1;
-    return aom_reader_find_end(&td->bit_reader);
-  }
+    {
+      // Get last tile data.
+      TileData *const td = pbi->tile_data + tile_cols * tile_rows - 1;
+      return aom_reader_find_end(&td->bit_reader);
+    }
 #else
   TileData *const td = pbi->tile_data + endTile;
   return aom_reader_find_end(&td->bit_reader);
 #endif
-#endif  // CONFIG_ANS
 #if CONFIG_EXT_TILE
   }
 #endif  // CONFIG_EXT_TILE
@@ -2764,9 +2747,6 @@
       memset(&cm->ref_frame_map, -1, sizeof(cm->ref_frame_map));
       pbi->need_resync = 0;
     }
-#if CONFIG_ANS && ANS_MAX_SYMBOLS
-    cm->ans_window_size_log2 = aom_rb_read_literal(rb, 4) + 8;
-#endif  // CONFIG_ANS && ANS_MAX_SYMBOLS
     cm->allow_screen_content_tools = aom_rb_read_bit(rb);
 #if CONFIG_INTRABC
     if (cm->allow_screen_content_tools) cm->allow_intrabc = aom_rb_read_bit(rb);
@@ -2828,9 +2808,6 @@
         memset(&cm->ref_frame_map, -1, sizeof(cm->ref_frame_map));
         pbi->need_resync = 0;
       }
-#if CONFIG_ANS && ANS_MAX_SYMBOLS
-      cm->ans_window_size_log2 = aom_rb_read_literal(rb, 4) + 8;
-#endif
       cm->allow_screen_content_tools = aom_rb_read_bit(rb);
 #if CONFIG_INTRABC
       if (cm->allow_screen_content_tools)
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index a86cd96..078eb3f 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -3060,9 +3060,6 @@
         // Initialise tile context from the frame context
         this_tile->tctx = *cm->fc;
         cpi->td.mb.e_mbd.tile_ctx = &this_tile->tctx;
-#if CONFIG_ANS
-        mode_bc.size = 1 << cpi->common.ans_window_size_log2;
-#endif
         mode_bc.allow_update_cdf = !cm->large_scale_tile;
 #if CONFIG_LOOP_RESTORATION
         av1_reset_loop_restoration(&cpi->td.mb.e_mbd);
@@ -3244,9 +3241,6 @@
         // Initialise tile context from the frame context
         this_tile->tctx = *cm->fc;
         cpi->td.mb.e_mbd.tile_ctx = &this_tile->tctx;
-#if CONFIG_ANS
-        mode_bc.size = 1 << cpi->common.ans_window_size_log2;
-#endif  // CONFIG_ANS
         mode_bc.allow_update_cdf = 1;
 #if CONFIG_LOOP_RESTORATION
         av1_reset_loop_restoration(&cpi->td.mb.e_mbd);
@@ -3715,11 +3709,6 @@
 #endif
     write_sb_size(cm, wb);
 
-#if CONFIG_ANS && ANS_MAX_SYMBOLS
-    assert(cpi->common.ans_window_size_log2 >= 8);
-    assert(cpi->common.ans_window_size_log2 < 24);
-    aom_wb_write_literal(wb, cpi->common.ans_window_size_log2 - 8, 4);
-#endif  // CONFIG_ANS && ANS_MAX_SYMBOLS
     aom_wb_write_bit(wb, cm->allow_screen_content_tools);
 #if CONFIG_INTRABC
     if (cm->allow_screen_content_tools) aom_wb_write_bit(wb, cm->allow_intrabc);
@@ -3761,11 +3750,6 @@
       write_frame_size(cm, wb);
 #endif
       write_sb_size(cm, wb);
-#if CONFIG_ANS && ANS_MAX_SYMBOLS
-      assert(cpi->common.ans_window_size_log2 >= 8);
-      assert(cpi->common.ans_window_size_log2 < 24);
-      aom_wb_write_literal(wb, cpi->common.ans_window_size_log2 - 8, 4);
-#endif  // CONFIG_ANS && ANS_MAX_SYMBOLS
       aom_wb_write_bit(wb, cm->allow_screen_content_tools);
 #if CONFIG_INTRABC
       if (cm->allow_screen_content_tools)
@@ -4041,11 +4025,6 @@
 #endif
     write_sb_size(cm, wb);
 
-#if CONFIG_ANS && ANS_MAX_SYMBOLS
-    assert(cpi->common.ans_window_size_log2 >= 8);
-    assert(cpi->common.ans_window_size_log2 < 24);
-    aom_wb_write_literal(wb, cpi->common.ans_window_size_log2 - 8, 4);
-#endif  // CONFIG_ANS && ANS_MAX_SYMBOLS
     aom_wb_write_bit(wb, cm->allow_screen_content_tools);
 #if CONFIG_AMVR
     if (cm->allow_screen_content_tools) {
@@ -4076,12 +4055,6 @@
 #else
       write_frame_size(cm, wb);
 #endif
-
-#if CONFIG_ANS && ANS_MAX_SYMBOLS
-      assert(cpi->common.ans_window_size_log2 >= 8);
-      assert(cpi->common.ans_window_size_log2 < 24);
-      aom_wb_write_literal(wb, cpi->common.ans_window_size_log2 - 8, 4);
-#endif  // CONFIG_ANS && ANS_MAX_SYMBOLS
     }
   } else if (cm->frame_type == INTER_FRAME) {
     MV_REFERENCE_FRAME ref_frame;
@@ -4325,9 +4298,6 @@
 
   aom_writer real_header_bc;
   header_bc = &real_header_bc;
-#if CONFIG_ANS
-  header_bc->size = 1 << cpi->common.ans_window_size_log2;
-#endif
   aom_start_encode(header_bc, data);
 
   if (!frame_is_intra_only(cm)) {
@@ -4633,9 +4603,6 @@
         // Initialise tile context from the frame context
         this_tile->tctx = *cm->fc;
         cpi->td.mb.e_mbd.tile_ctx = &this_tile->tctx;
-#if CONFIG_ANS
-        mode_bc.size = 1 << cpi->common.ans_window_size_log2;
-#endif
         mode_bc.allow_update_cdf = !cm->large_scale_tile;
         aom_start_encode(&mode_bc, buf->data + data_offset);
         write_modes(cpi, &tile_info, &mode_bc, &tok, tok_end);
@@ -4755,9 +4722,6 @@
         // Initialise tile context from the frame context
         this_tile->tctx = *cm->fc;
         cpi->td.mb.e_mbd.tile_ctx = &this_tile->tctx;
-#if CONFIG_ANS
-        mode_bc.size = 1 << cpi->common.ans_window_size_log2;
-#endif  // CONFIG_ANS
         mode_bc.allow_update_cdf = 1;
 #if CONFIG_LOOP_RESTORATION
         av1_reset_loop_restoration(&cpi->td.mb.e_mbd);
@@ -4969,9 +4933,5 @@
 #if CONFIG_EXT_TILE
   }
 #endif  // CONFIG_EXT_TILE
-#if CONFIG_ANS && ANS_REVERSE
-  // Avoid aliasing the superframe index
-  *data++ = 0;
-#endif
   *size = data - dst;
 }
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index c9d3c9e..4bd17d0 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -31,9 +31,6 @@
 #if CONFIG_BGSPRITE
 #include "av1/encoder/bgsprite.h"
 #endif  // CONFIG_BGSPRITE
-#if CONFIG_ANS
-#include "aom_dsp/buf_ans.h"
-#endif
 #include "av1/encoder/context_tree.h"
 #include "av1/encoder/encodeframe.h"
 #include "av1/encoder/encodemv.h"
@@ -544,10 +541,6 @@
   av1_free_pc_tree(&cpi->td);
 
   aom_free(cpi->td.mb.palette_buffer);
-
-#if CONFIG_ANS
-  aom_buf_ans_free(&cpi->buf_ans);
-#endif  // CONFIG_ANS
 }
 
 static void save_coding_context(AV1_COMP *cpi) {
@@ -2538,9 +2531,6 @@
 #if CONFIG_HIGHBITDEPTH
   highbd_set_var_fns(cpi);
 #endif
-#if CONFIG_ANS && ANS_MAX_SYMBOLS
-  cpi->common.ans_window_size_log2 = cpi->oxcf.ans_window_size_log2;
-#endif  // CONFIG_ANS && ANS_MAX_SYMBOLS
 #if CONFIG_AMVR
   cm->seq_force_integer_mv = 2;
 #endif
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index 84dcb27..21f0d30 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -23,10 +23,6 @@
 #include "av1/common/onyxc_int.h"
 #include "av1/common/resize.h"
 #include "av1/encoder/aq_cyclicrefresh.h"
-#if CONFIG_ANS
-#include "aom_dsp/ans.h"
-#include "aom_dsp/buf_ans.h"
-#endif
 #include "av1/encoder/av1_quantize.h"
 #include "av1/encoder/context_tree.h"
 #include "av1/encoder/encodemb.h"
@@ -296,9 +292,6 @@
 #if CONFIG_EXT_PARTITION
   aom_superblock_size_t superblock_size;
 #endif  // CONFIG_EXT_PARTITION
-#if CONFIG_ANS && ANS_MAX_SYMBOLS
-  int ans_window_size_log2;
-#endif  // CONFIG_ANS && ANS_MAX_SYMBOLS
 #if CONFIG_EXT_TILE
   unsigned int large_scale_tile;
   unsigned int single_tile_decoding;
@@ -595,9 +588,6 @@
   AVxWorker *workers;
   struct EncWorkerData *tile_thr_data;
   AV1LfSync lf_row_sync;
-#if CONFIG_ANS
-  struct BufAnsCoder buf_ans;
-#endif
   int refresh_frame_mask;
   int existing_fb_idx_to_show;
   int is_arf_filter_off[MAX_EXT_ARFS + 1];
diff --git a/av1/encoder/rd.h b/av1/encoder/rd.h
index 58b3c18..20c7eeb 100644
--- a/av1/encoder/rd.h
+++ b/av1/encoder/rd.h
@@ -14,9 +14,6 @@
 
 #include <limits.h>
 
-#if CONFIG_ANS
-#include "aom_dsp/ans.h"
-#endif  // CONFIG_ANS
 #include "av1/common/blockd.h"
 
 #include "av1/encoder/block.h"
diff --git a/build/cmake/aom_config_defaults.cmake b/build/cmake/aom_config_defaults.cmake
index 7d3387d..ac9709b 100644
--- a/build/cmake/aom_config_defaults.cmake
+++ b/build/cmake/aom_config_defaults.cmake
@@ -108,7 +108,6 @@
 set(CONFIG_ADAPT_SCAN 0 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_ADD_4BYTES_OBUSIZE 0 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_AMVR 0 CACHE NUMBER "AV1 experiment flag.")
-set(CONFIG_ANS 0 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_AOM_QM 1 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_BGSPRITE 0 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_CDEF_SINGLEPASS 1 CACHE NUMBER "AV1 experiment flag.")
diff --git a/configure b/configure
index fada0c3..20483dd 100755
--- a/configure
+++ b/configure
@@ -262,7 +262,6 @@
     ext_intra_mod
     intrabc
     new_quant
-    ans
     loop_restoration
     striped_loop_restoration
     ext_partition
diff --git a/test/accounting_test.cc b/test/accounting_test.cc
index e8387d0..abe0369 100644
--- a/test/accounting_test.cc
+++ b/test/accounting_test.cc
@@ -35,9 +35,6 @@
   }
   aom_stop_encode(&bw);
   aom_reader br;
-#if CONFIG_ANS && ANS_MAX_SYMBOLS
-  br.window_size = 1 << 16;
-#endif
   aom_reader_init(&br, bw_buffer, bw.pos, NULL, NULL);
 
   Accounting accounting;
diff --git a/test/test.cmake b/test/test.cmake
index 06a356e..a0cce48 100644
--- a/test/test.cmake
+++ b/test/test.cmake
@@ -296,17 +296,10 @@
         "${AOM_ROOT}/test/superframe_test.cc"
         "${AOM_ROOT}/test/tile_independence_test.cc")
 
-    if (CONFIG_ANS)
-      set(AOM_UNIT_TEST_COMMON_SOURCES
-          ${AOM_UNIT_TEST_COMMON_SOURCES}
-          "${AOM_ROOT}/test/ans_codec_test.cc"
-          "${AOM_ROOT}/test/ans_test.cc")
-    else ()
-      set(AOM_UNIT_TEST_COMMON_SOURCES
-          ${AOM_UNIT_TEST_COMMON_SOURCES}
-          "${AOM_ROOT}/test/binary_codes_test.cc"
-          "${AOM_ROOT}/test/boolcoder_test.cc")
-    endif ()
+    set(AOM_UNIT_TEST_COMMON_SOURCES
+        ${AOM_UNIT_TEST_COMMON_SOURCES}
+        "${AOM_ROOT}/test/binary_codes_test.cc"
+        "${AOM_ROOT}/test/boolcoder_test.cc")
 
     if (CONFIG_EXT_TILE)
       set(AOM_UNIT_TEST_COMMON_SOURCES
diff --git a/test/test.mk b/test/test.mk
index 39b6887..2389a2f 100644
--- a/test/test.mk
+++ b/test/test.mk
@@ -113,21 +113,14 @@
 LIBAOM_TEST_SRCS-yes                   += tile_independence_test.cc
 LIBAOM_TEST_SRCS-yes                   += ethread_test.cc
 LIBAOM_TEST_SRCS-yes                   += motion_vector_test.cc
-ifneq ($(CONFIG_ANS),yes)
 LIBAOM_TEST_SRCS-yes                   += binary_codes_test.cc
-endif
 ifeq ($(CONFIG_EXT_TILE),yes)
 LIBAOM_TEST_SRCS-yes                   += av1_ext_tile_test.cc
 endif
-ifeq ($(CONFIG_ANS),yes)
-LIBAOM_TEST_SRCS-yes                   += ans_test.cc
-LIBAOM_TEST_SRCS-yes                   += ans_codec_test.cc
-else
 LIBAOM_TEST_SRCS-yes                   += boolcoder_test.cc
 ifeq ($(CONFIG_ACCOUNTING),yes)
 LIBAOM_TEST_SRCS-yes                   += accounting_test.cc
 endif
-endif
 LIBAOM_TEST_SRCS-yes                   += divu_small_test.cc
 #LIBAOM_TEST_SRCS-yes                   += encoder_parms_get_to_decoder.cc
 endif