daala_ec: Remove dead code. Change-Id: Ief9581c8060132f20ca81f4c1be15e2772b6c9eb
diff --git a/aom_dsp/entcode.c b/aom_dsp/entcode.c index ff8e8e2..ad76b7e 100644 --- a/aom_dsp/entcode.c +++ b/aom_dsp/entcode.c
@@ -15,33 +15,6 @@ #include "aom_dsp/entcode.h" -/*CDFs for uniform probability distributions of small sizes (2 through 16, - inclusive).*/ -// clang-format off -const uint16_t OD_UNIFORM_CDFS_Q15[135] = { - 16384, 32768, - 10923, 21845, 32768, - 8192, 16384, 24576, 32768, - 6554, 13107, 19661, 26214, 32768, - 5461, 10923, 16384, 21845, 27307, 32768, - 4681, 9362, 14043, 18725, 23406, 28087, 32768, - 4096, 8192, 12288, 16384, 20480, 24576, 28672, 32768, - 3641, 7282, 10923, 14564, 18204, 21845, 25486, 29127, 32768, - 3277, 6554, 9830, 13107, 16384, 19661, 22938, 26214, 29491, 32768, - 2979, 5958, 8937, 11916, 14895, 17873, 20852, 23831, 26810, 29789, 32768, - 2731, 5461, 8192, 10923, 13653, 16384, 19115, 21845, 24576, 27307, 30037, - 32768, - 2521, 5041, 7562, 10082, 12603, 15124, 17644, 20165, 22686, 25206, 27727, - 30247, 32768, - 2341, 4681, 7022, 9362, 11703, 14043, 16384, 18725, 21065, 23406, 25746, - 28087, 30427, 32768, - 2185, 4369, 6554, 8738, 10923, 13107, 15292, 17476, 19661, 21845, 24030, - 26214, 28399, 30583, 32768, - 2048, 4096, 6144, 8192, 10240, 12288, 14336, 16384, 18432, 20480, 22528, - 24576, 26624, 28672, 30720, 32768 -}; -// clang-format on - /*Given the current total integer number of bits used and the current value of rng, computes the fraction number of bits used to OD_BITRES precision. This is used by od_ec_enc_tell_frac() and od_ec_dec_tell_frac().
diff --git a/aom_dsp/entcode.h b/aom_dsp/entcode.h index 91fcb67..80e1e0c 100644 --- a/aom_dsp/entcode.h +++ b/aom_dsp/entcode.h
@@ -90,13 +90,6 @@ 3 => 1/8th bits.*/ #define OD_BITRES (3) -extern const uint16_t OD_UNIFORM_CDFS_Q15[135]; - -/*Returns a Q15 CDF for a uniform probability distribution of the given size. - n: The size of the distribution. - This must be at least 2, and no more than 16.*/ -#define OD_UNIFORM_CDF_Q15(n) (OD_UNIFORM_CDFS_Q15 + ((n) * ((n)-1) >> 1) - 1) - /*See entcode.c for further documentation.*/ OD_WARN_UNUSED_RESULT uint32_t od_ec_tell_frac(uint32_t nbits_total,
diff --git a/aom_dsp/entdec.c b/aom_dsp/entdec.c index 4ba4954..28d1388 100644 --- a/aom_dsp/entdec.c +++ b/aom_dsp/entdec.c
@@ -350,50 +350,6 @@ return od_ec_dec_normalize(dec, dif, r, ret); } -/*Decodes a symbol given a cumulative distribution function (CDF) table that - sums to a power of two. - This is a simpler, lower overhead version of od_ec_decode_cdf() for use when - cdf[nsyms - 1] is a power of two. - To be decoded properly by this function, symbols cannot have been encoded by - od_ec_encode(), but must have been encoded with one of the equivalent _q15() - functions instead. - 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 exactly 1 << ftb. - nsyms: The number of symbols in the alphabet. - This should be at most 16. - ftb: The number of bits of precision in the cumulative distribution. - This must be no more than 15. - Return: The decoded symbol s.*/ -int od_ec_decode_cdf_unscaled_dyadic(od_ec_dec *dec, const uint16_t *cdf, - int nsyms, unsigned ftb) { - od_ec_window dif; - unsigned r; - unsigned c; - unsigned u; - unsigned v; - int ret; - (void)nsyms; - dif = dec->dif; - r = dec->rng; - OD_ASSERT(dif >> (OD_EC_WINDOW_SIZE - 16) < r); - OD_ASSERT(ftb <= 15); - OD_ASSERT(cdf[nsyms - 1] == 1U << ftb); - OD_ASSERT(32768U <= r); - c = (unsigned)(dif >> (OD_EC_WINDOW_SIZE - 16)); - v = 0; - ret = -1; - do { - u = v; - v = cdf[++ret] * (uint32_t)r >> ftb; - } while (v <= c); - OD_ASSERT(v <= r); - r = v - u; - dif -= (od_ec_window)u << (OD_EC_WINDOW_SIZE - 16); - return od_ec_dec_normalize(dec, dif, r, ret); -} - /*Decodes a symbol given a cumulative distribution function (CDF) table in Q15. This is a simpler, lower overhead version of od_ec_decode_cdf() for use when cdf[nsyms - 1] == 32768. @@ -408,34 +364,32 @@ 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) { - return od_ec_decode_cdf_unscaled_dyadic(dec, cdf, nsyms, 15); + od_ec_window dif; + unsigned r; + unsigned c; + unsigned u; + unsigned v; + int ret; + (void)nsyms; + dif = dec->dif; + r = dec->rng; + OD_ASSERT(dif >> (OD_EC_WINDOW_SIZE - 16) < r); + OD_ASSERT(cdf[nsyms - 1] == 32768U); + OD_ASSERT(32768U <= r); + 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(v <= r); + r = v - u; + dif -= (od_ec_window)u << (OD_EC_WINDOW_SIZE - 16); + return od_ec_dec_normalize(dec, dif, r, ret); } #if CONFIG_RAWBITS -/*Extracts a raw unsigned integer with a non-power-of-2 range from the stream. - The integer must have been encoded with od_ec_enc_uint(). - ft: The number of integers that can be decoded (one more than the max). - This must be at least 2, and no more than 2**29. - Return: The decoded bits.*/ -uint32_t od_ec_dec_uint(od_ec_dec *dec, uint32_t ft) { - OD_ASSERT(ft >= 2); - OD_ASSERT(ft <= (uint32_t)1 << (25 + OD_EC_UINT_BITS)); - if (ft > 1U << OD_EC_UINT_BITS) { - uint32_t t; - int ft1; - int ftb; - ft--; - ftb = OD_ILOG_NZ(ft) - OD_EC_UINT_BITS; - ft1 = (int)(ft >> ftb) + 1; - t = od_ec_decode_cdf_q15(dec, OD_UNIFORM_CDF_Q15(ft1), ft1); - t = t << ftb | od_ec_dec_bits(dec, ftb, ""); - if (t <= ft) return t; - dec->error = 1; - return ft; - } - return od_ec_decode_cdf_q15(dec, OD_UNIFORM_CDF_Q15(ft), (int)ft); -} - /*Extracts a sequence of raw bits from the stream. The bits must have been encoded with od_ec_enc_bits(). ftb: The number of bits to extract.
diff --git a/aom_dsp/entdec.h b/aom_dsp/entdec.h index 6d6e2b5..cd90b2c 100644 --- a/aom_dsp/entdec.h +++ b/aom_dsp/entdec.h
@@ -77,14 +77,6 @@ const uint16_t *cdf, int nsyms) OD_ARG_NONNULL(1) OD_ARG_NONNULL(2); -OD_WARN_UNUSED_RESULT int od_ec_decode_cdf_unscaled_dyadic(od_ec_dec *dec, - const uint16_t *cdf, - int nsyms, - unsigned _ftb) - OD_ARG_NONNULL(1) OD_ARG_NONNULL(2); - -OD_WARN_UNUSED_RESULT uint32_t od_ec_dec_uint(od_ec_dec *dec, uint32_t ft) - OD_ARG_NONNULL(1); OD_WARN_UNUSED_RESULT uint32_t od_ec_dec_bits_(od_ec_dec *dec, unsigned ftb) OD_ARG_NONNULL(1);
diff --git a/aom_dsp/entenc.c b/aom_dsp/entenc.c index ad13a72..3a7a47e 100644 --- a/aom_dsp/entenc.c +++ b/aom_dsp/entenc.c
@@ -367,51 +367,7 @@ od_ec_encode_unscaled(enc, s > 0 ? cdf[s - 1] : 0, cdf[s], cdf[nsyms - 1]); } -/*Equivalent to od_ec_encode_cdf_q15() with the cdf scaled by - (1 << (15 - ftb)). - 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 1 << ftb. - nsyms: The number of symbols in the alphabet. - This should be at most 16. - ftb: The number of bits of precision in the cumulative distribution. - This must be no more than 15.*/ -void od_ec_encode_cdf_unscaled_dyadic(od_ec_enc *enc, int s, - const uint16_t *cdf, int nsyms, - unsigned ftb) { - (void)nsyms; - OD_ASSERT(s >= 0); - OD_ASSERT(s < nsyms); - OD_ASSERT(ftb <= 15); - OD_ASSERT(cdf[nsyms - 1] == 1U << ftb); - od_ec_encode_q15(enc, s > 0 ? cdf[s - 1] << (15 - ftb) : 0, - cdf[s] << (15 - ftb)); -} - #if CONFIG_RAWBITS -/*Encodes a raw unsigned integer in the stream. - fl: The integer to encode. - ft: The number of integers that can be encoded (one more than the max). - This must be at least 2, and no more than 2**29.*/ -void od_ec_enc_uint(od_ec_enc *enc, uint32_t fl, uint32_t ft) { - OD_ASSERT(ft >= 2); - OD_ASSERT(fl < ft); - OD_ASSERT(ft <= (uint32_t)1 << (25 + OD_EC_UINT_BITS)); - if (ft > 1U << OD_EC_UINT_BITS) { - int ft1; - int ftb; - ft--; - ftb = OD_ILOG_NZ(ft) - OD_EC_UINT_BITS; - ft1 = (int)(ft >> ftb) + 1; - od_ec_encode_cdf_q15(enc, (int)(fl >> ftb), OD_UNIFORM_CDF_Q15(ft1), ft1); - od_ec_enc_bits(enc, fl & (((uint32_t)1 << ftb) - 1), ftb); - } else { - od_ec_encode_cdf_q15(enc, (int)fl, OD_UNIFORM_CDF_Q15(ft), (int)ft); - } -} - /*Encodes a sequence of raw bits in the stream. fl: The bits to encode. ftb: The number of bits to encode.
diff --git a/aom_dsp/entenc.h b/aom_dsp/entenc.h index 5e121b6..f2a1f2a 100644 --- a/aom_dsp/entenc.h +++ b/aom_dsp/entenc.h
@@ -72,12 +72,6 @@ OD_ARG_NONNULL(1) OD_ARG_NONNULL(3); void od_ec_encode_cdf_unscaled(od_ec_enc *enc, int s, const uint16_t *cdf, int nsyms) OD_ARG_NONNULL(1) OD_ARG_NONNULL(3); -void od_ec_encode_cdf_unscaled_dyadic(od_ec_enc *enc, int s, - const uint16_t *cdf, int nsyms, - unsigned ftb) OD_ARG_NONNULL(1) - OD_ARG_NONNULL(3); - -void od_ec_enc_uint(od_ec_enc *enc, uint32_t fl, uint32_t ft) OD_ARG_NONNULL(1); void od_ec_enc_bits(od_ec_enc *enc, uint32_t fl, unsigned ftb) OD_ARG_NONNULL(1);