Skip to content
  • Timothy B. Terriberry's avatar
    Replace ec_{enc|dec}_bit_prob() with ec_{enc|dec}_bit_logp(). · e86fb268
    Timothy B. Terriberry authored and Jean-Marc Valin's avatar Jean-Marc Valin committed
    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.
    e86fb268