Replace ec_{enc|dec}_bit_prob() with ec_{enc|dec}_bit_logp().

All of our usage of ec_{enc|dec}_bit_prob had the probability of a
 "one" being a power of two.
This adds a new ec_{enc|dec}_bit_logp() function that takes this
 explicitly into account.
It introduces less rounding error than the bit_prob version, does not
 require 17-bit integers to be emulated by ec_{encode|decode}_bin(),
 and does not require any multiplies or divisions at all.
It is exactly equivalent to
 ec_encode_bin(enc,_val?0:(1<<_logp)-1,(1<<_logp)-(_val?1:0),1<<_logp)

The old ec_{enc|dec}_bit_prob functions are left in place for now,
 because I am not sure if SILK is still using them or not when
 combined in Opus.
This commit is contained in:
Timothy B. Terriberry 2010-12-17 14:50:19 -08:00 committed by Jean-Marc Valin
parent 8c23a3a0fd
commit e86fb268b0
8 changed files with 61 additions and 25 deletions

View file

@ -163,7 +163,7 @@ static void quant_coarse_energy_impl(const CELTMode *m, int start, int end,
celt_word16 coef;
celt_word16 beta;
ec_enc_bit_prob(enc, intra, 8192);
ec_enc_bit_logp(enc, intra, 3);
if (intra)
{
coef = 0;