Remove the EC_SMALLMUL experimental flag.

This experiment has been fully adopted and is now an integral part
of the draft AV1 bitstream definition.

objdump -d libaom.a gives identical output before and after this
patch.

Change-Id: I6f936f4b10de23a9471e0ccadf9cf178fb62be69
diff --git a/aom_dsp/daalaboolreader.h b/aom_dsp/daalaboolreader.h
index 428d74d..36637f5 100644
--- a/aom_dsp/daalaboolreader.h
+++ b/aom_dsp/daalaboolreader.h
@@ -45,11 +45,7 @@
 
 static INLINE int aom_daala_read(daala_reader *r, int prob) {
   int bit;
-#if CONFIG_EC_SMALLMUL
   int p = (0x7FFFFF - (prob << 15) + prob) >> 8;
-#else
-  int p = ((prob << 15) + 256 - prob) >> 8;
-#endif
 #if CONFIG_BITSTREAM_DEBUG
 /*{
   const int queue_r = bitstream_queue_get_read();
diff --git a/aom_dsp/daalaboolwriter.h b/aom_dsp/daalaboolwriter.h
index bbaf53c..6ec0f0b 100644
--- a/aom_dsp/daalaboolwriter.h
+++ b/aom_dsp/daalaboolwriter.h
@@ -36,11 +36,7 @@
 void aom_daala_stop_encode(daala_writer *w);
 
 static INLINE void aom_daala_write(daala_writer *w, int bit, int prob) {
-#if CONFIG_EC_SMALLMUL
   int p = (0x7FFFFF - (prob << 15) + prob) >> 8;
-#else
-  int p = ((prob << 15) + 256 - prob) >> 8;
-#endif
 #if CONFIG_BITSTREAM_DEBUG
   aom_cdf_prob cdf[2] = { (aom_cdf_prob)p, 32767 };
   /*int queue_r = 0;
diff --git a/aom_dsp/entcode.h b/aom_dsp/entcode.h
index 534959e..981a951 100644
--- a/aom_dsp/entcode.h
+++ b/aom_dsp/entcode.h
@@ -28,15 +28,11 @@
    3 => 1/8th bits.*/
 #define OD_BITRES (3)
 
-/*With CONFIG_EC_SMALLMUL, the value stored in a CDF is 32768 minus the actual
-   Q15 cumulative probability (an "inverse" CDF).
+/*The value stored in an iCDF is 32768 minus the actual Q15 cumulative
+   probability (an "inverse" CDF).
   This function converts from one representation to the other (and is its own
    inverse).*/
-#if CONFIG_EC_SMALLMUL
 #define OD_ICDF(x) (32768U - (x))
-#else
-#define OD_ICDF(x) (x)
-#endif
 
 /*See entcode.c for further documentation.*/
 
diff --git a/aom_dsp/entdec.c b/aom_dsp/entdec.c
index 49b176c..71dad0d 100644
--- a/aom_dsp/entdec.c
+++ b/aom_dsp/entdec.c
@@ -114,12 +114,8 @@
   OD_ASSERT(rng <= 65535U);
   d = 16 - OD_ILOG_NZ(rng);
   dec->cnt -= d;
-#if CONFIG_EC_SMALLMUL
   /*This is equivalent to shifting in 1's instead of 0's.*/
   dec->dif = ((dif + 1) << d) - 1;
-#else
-  dec->dif = dif << d;
-#endif
   dec->rng = rng << d;
   if (dec->cnt < 0) od_ec_dec_refill(dec);
   return ret;
@@ -137,11 +133,7 @@
   dec->tell_offs = 10 - (OD_EC_WINDOW_SIZE - 8);
   dec->end = buf + storage;
   dec->bptr = buf;
-#if CONFIG_EC_SMALLMUL
   dec->dif = ((od_ec_window)1 << (OD_EC_WINDOW_SIZE - 1)) - 1;
-#else
-  dec->dif = 0;
-#endif
   dec->rng = 0x8000;
   dec->cnt = -15;
   dec->error = 0;
@@ -149,8 +141,7 @@
 }
 
 /*Decode a single binary value.
-  {EC_SMALLMUL} f: The probability that the bit is one, scaled by 32768.
-  {else} f: The probability that the bit is zero, scaled by 32768.
+  f: The probability that the bit is one, scaled by 32768.
   Return: The value decoded (0 or 1).*/
 int od_ec_decode_bool_q15(od_ec_dec *dec, unsigned f) {
   od_ec_window dif;
@@ -165,7 +156,6 @@
   r = dec->rng;
   OD_ASSERT(dif >> (OD_EC_WINDOW_SIZE - 16) < r);
   OD_ASSERT(32768U <= r);
-#if CONFIG_EC_SMALLMUL
   v = (r >> 8) * (uint32_t)f >> 7;
   vw = (od_ec_window)v << (OD_EC_WINDOW_SIZE - 16);
   ret = 1;
@@ -175,30 +165,19 @@
     dif -= vw;
     ret = 0;
   }
-#else
-  v = f * (uint32_t)r >> 15;
-  vw = (od_ec_window)v << (OD_EC_WINDOW_SIZE - 16);
-  ret = 0;
-  r_new = v;
-  if (dif >= vw) {
-    r_new = r - v;
-    dif -= vw;
-    ret = 1;
-  }
-#endif
   return od_ec_dec_normalize(dec, dif, r_new, ret);
 }
 
-/*Decodes a symbol given a cumulative distribution function (CDF) table in Q15.
-  cdf: The CDF, such that symbol s falls in the range
-        [s > 0 ? cdf[s - 1] : 0, cdf[s]).
-       The values must be monotonically non-increasing, and cdf[nsyms - 1]
-        must be 32768.
-       {EC_SMALLMUL}: The CDF contains 32768 minus those values.
+/*Decodes a symbol given an inverse cumulative distribution function (CDF)
+   table in Q15.
+  icdf: 32768 minus the CDF, such that symbol s falls in the range
+         [s > 0 ? (32768 - icdf[s - 1]) : 0, 32768 - icdf[s]).
+        The values must be monotonically non-increasing, and icdf[nsyms - 1]
+         must be 0.
   nsyms: The number of symbols in the alphabet.
          This should be at most 16.
   Return: The decoded symbol s.*/
-int od_ec_decode_cdf_q15(od_ec_dec *dec, const uint16_t *cdf, int nsyms) {
+int od_ec_decode_cdf_q15(od_ec_dec *dec, const uint16_t *icdf, int nsyms) {
   od_ec_window dif;
   unsigned r;
   unsigned c;
@@ -209,33 +188,19 @@
   dif = dec->dif;
   r = dec->rng;
   OD_ASSERT(dif >> (OD_EC_WINDOW_SIZE - 16) < r);
-  OD_ASSERT(cdf[nsyms - 1] == OD_ICDF(32768U));
+  OD_ASSERT(icdf[nsyms - 1] == OD_ICDF(32768U));
   OD_ASSERT(32768U <= r);
-#if CONFIG_EC_SMALLMUL
   c = (unsigned)(dif >> (OD_EC_WINDOW_SIZE - 16));
   v = r;
   ret = -1;
   do {
     u = v;
-    v = (r >> 8) * (uint32_t)cdf[++ret] >> 7;
+    v = (r >> 8) * (uint32_t)icdf[++ret] >> 7;
   } while (c < v);
   OD_ASSERT(v < u);
   OD_ASSERT(u <= r);
   r = u - v;
   dif -= (od_ec_window)v << (OD_EC_WINDOW_SIZE - 16);
-#else
-  c = (unsigned)(dif >> (OD_EC_WINDOW_SIZE - 16));
-  v = 0;
-  ret = -1;
-  do {
-    u = v;
-    v = cdf[++ret] * (uint32_t)r >> 15;
-  } while (v <= c);
-  OD_ASSERT(u < v);
-  OD_ASSERT(v <= r);
-  r = v - u;
-  dif -= (od_ec_window)u << (OD_EC_WINDOW_SIZE - 16);
-#endif
   return od_ec_dec_normalize(dec, dif, r, ret);
 }
 
diff --git a/aom_dsp/entdec.h b/aom_dsp/entdec.h
index e1145e8..35ac7fe 100644
--- a/aom_dsp/entdec.h
+++ b/aom_dsp/entdec.h
@@ -47,10 +47,8 @@
   const unsigned char *end;
   /*The read pointer for the entropy-coded bits.*/
   const unsigned char *bptr;
-  /*The difference between the coded value and the low end of the current
-     range.
-    {EC_SMALLMUL} The difference between the high end of the current range,
-     (low + rng), and the coded value, minus 1.
+  /*The difference between the high end of the current range, (low + rng), and
+     the coded value, minus 1.
     This stores up to OD_EC_WINDOW_SIZE bits of that difference, but the
      decoder only uses the top 16 bits of the window to decode the next symbol.
     As we shift up during renormalization, if we don't have enough bits left in
diff --git a/aom_dsp/entenc.c b/aom_dsp/entenc.c
index a350f27..b8c4dc0 100644
--- a/aom_dsp/entenc.c
+++ b/aom_dsp/entenc.c
@@ -143,11 +143,10 @@
 }
 
 /*Encodes a symbol given its frequency in Q15.
-  fl: The cumulative frequency of all symbols that come before the one to be
-       encoded.
-  fh: The cumulative frequency of all symbols up to and including the one to
-       be encoded.
-  {EC_SMALLMUL} Both values are 32768 minus that.*/
+  fl: 32768 minus the cumulative frequency of all symbols that come before the
+       one to be encoded.
+  fh: 32768 minus the cumulative frequency of all symbols up to and including
+       the one to be encoded.*/
 static void od_ec_encode_q15(od_ec_enc *enc, unsigned fl, unsigned fh) {
   od_ec_window l;
   unsigned r;
@@ -156,7 +155,6 @@
   l = enc->low;
   r = enc->rng;
   OD_ASSERT(32768U <= r);
-#if CONFIG_EC_SMALLMUL
   OD_ASSERT(fh < fl);
   OD_ASSERT(fl <= 32768U);
   if (fl < 32768U) {
@@ -167,14 +165,6 @@
   } else {
     r -= (r >> 8) * (uint32_t)fh >> 7;
   }
-#else
-  OD_ASSERT(fl < fh);
-  OD_ASSERT(fh <= 32768U);
-  u = fl * (uint32_t)r >> 15;
-  v = fh * (uint32_t)r >> 15;
-  r = v - u;
-  l += u;
-#endif
   od_ec_enc_normalize(enc, l, r);
 #if OD_MEASURE_EC_OVERHEAD
   enc->entropy -= OD_LOG2((double)(OD_ICDF(fh) - OD_ICDF(fl)) / 32768.);
@@ -184,8 +174,7 @@
 
 /*Encode a single binary value.
   val: The value to encode (0 or 1).
-  {EC_SMALLMUL} f: The probability that the val is one, scaled by 32768.
-  {else} f: The probability that val is zero, scaled by 32768.*/
+  f: The probability that the val is one, scaled by 32768.*/
 void od_ec_encode_bool_q15(od_ec_enc *enc, int val, unsigned f) {
   od_ec_window l;
   unsigned r;
@@ -195,15 +184,9 @@
   l = enc->low;
   r = enc->rng;
   OD_ASSERT(32768U <= r);
-#if CONFIG_EC_SMALLMUL
   v = (r >> 8) * (uint32_t)f >> 7;
   if (val) l += r - v;
   r = val ? v : r - v;
-#else
-  v = f * (uint32_t)r >> 15;
-  if (val) l += v;
-  r = val ? r - v : v;
-#endif
   od_ec_enc_normalize(enc, l, r);
 #if OD_MEASURE_EC_OVERHEAD
   enc->entropy -=
@@ -214,19 +197,19 @@
 
 /*Encodes a symbol given a cumulative distribution function (CDF) table in Q15.
   s: The index of the symbol to encode.
-  cdf: The CDF, such that symbol s falls in the range
-        [s > 0 ? cdf[s - 1] : 0, cdf[s]).
-       The values must be monotonically non-decreasing, and the last value
-        must be exactly 32768.
+  icdf: 32768 minus the CDF, such that symbol s falls in the range
+         [s > 0 ? (32768 - icdf[s - 1]) : 0, 32768 - icdf[s]).
+        The values must be monotonically decreasing, and icdf[nsyms - 1] must
+         be 0.
   nsyms: The number of symbols in the alphabet.
          This should be at most 16.*/
-void od_ec_encode_cdf_q15(od_ec_enc *enc, int s, const uint16_t *cdf,
+void od_ec_encode_cdf_q15(od_ec_enc *enc, int s, const uint16_t *icdf,
                           int nsyms) {
   (void)nsyms;
   OD_ASSERT(s >= 0);
   OD_ASSERT(s < nsyms);
-  OD_ASSERT(cdf[nsyms - 1] == OD_ICDF(32768U));
-  od_ec_encode_q15(enc, s > 0 ? cdf[s - 1] : OD_ICDF(0), cdf[s]);
+  OD_ASSERT(icdf[nsyms - 1] == OD_ICDF(32768U));
+  od_ec_encode_q15(enc, s > 0 ? icdf[s - 1] : OD_ICDF(0), icdf[s]);
 }
 
 #if CONFIG_RAWBITS
diff --git a/aom_dsp/prob.h b/aom_dsp/prob.h
index 27211b9..ad410ab 100644
--- a/aom_dsp/prob.h
+++ b/aom_dsp/prob.h
@@ -160,7 +160,7 @@
   tmp = AOM_ICDF(tmp0);
   diff = ((CDF_PROB_TOP - (nsymbs << rate2)) >> rate) << rate;
 // Single loop (faster)
-#if !CONFIG_ANS && CONFIG_EC_SMALLMUL
+#if !CONFIG_ANS
   for (i = 0; i < nsymbs - 1; ++i, tmp -= tmp0) {
     tmp -= (i == val ? diff : 0);
     cdf[i] += ((tmp - cdf[i]) >> rate);
diff --git a/build/cmake/aom_config_defaults.cmake b/build/cmake/aom_config_defaults.cmake
index d6f51d41..1b1a9a1 100644
--- a/build/cmake/aom_config_defaults.cmake
+++ b/build/cmake/aom_config_defaults.cmake
@@ -133,7 +133,6 @@
 set(CONFIG_DIST_8X8 0 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_DPCM_INTRA 0 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_DUAL_FILTER 1 CACHE NUMBER "AV1 experiment flag.")
-set(CONFIG_EC_SMALLMUL 1 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_ENTROPY_STATS 0 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_EXT_COMP_REFS 1 CACHE NUMBER "AV1 experiment flag.")
 set(CONFIG_EXT_DELTA_Q 1 CACHE NUMBER "AV1 experiment flag.")
diff --git a/configure b/configure
index fc96233..609e52f 100755
--- a/configure
+++ b/configure
@@ -288,7 +288,6 @@
     inter_stats_only
     palette_delta_encoding
     rawbits
-    ec_smallmul
     pvq
     cfl
     xiphrc
@@ -510,7 +509,6 @@
     soft_enable warped_motion
     soft_enable ext_delta_q
     soft_enable loopfiltering_across_tiles
-    soft_enable ec_smallmul
     soft_enable var_tx
     soft_enable ext_inter
     soft_enable wedge
@@ -569,10 +567,6 @@
       log_echo "rawbits requires not ans, so disabling rawbits"
       disable_feature rawbits
     fi
-    if enabled ec_smallmul && enabled ans; then
-      log_echo "ec_smallmul requires not ans, so disabling ec_smallmul"
-      disable_feature ec_smallmul
-    fi
     if enabled daala_dct64; then
       enable_feature tx64x64
     fi
diff --git a/test/boolcoder_test.cc b/test/boolcoder_test.cc
index a4b08e3..916a544 100644
--- a/test/boolcoder_test.cc
+++ b/test/boolcoder_test.cc
@@ -86,11 +86,7 @@
   }
 }
 
-#if CONFIG_EC_SMALLMUL
 #define FRAC_DIFF_TOTAL_ERROR 0.16
-#else
-#define FRAC_DIFF_TOTAL_ERROR 0.07
-#endif
 
 TEST(AV1, TestTell) {
   const int kBufferSize = 10000;