Completely new transient analysis algorithm
[opus.git] / libcelt / rangedec.c
index fc83aa6..35bc193 100644 (file)
@@ -141,9 +141,10 @@ void ec_dec_init(ec_dec *_this,ec_byte_buffer *_buf){
   _this->dif=_this->rng-(_this->rem>>EC_SYM_BITS-EC_CODE_EXTRA);
   /*Normalize the interval.*/
   ec_dec_normalize(_this);
-  /*_this->end_byte=ec_byte_look_at_end(_this->buf);*/
+  _this->end_byte=0; /* Required for platforms that have chars > 8 bits */
   _this->end_bits_left=0;
   _this->nb_end_bits=0;
+  _this->error=0;
 }
 
 
@@ -161,7 +162,7 @@ unsigned ec_decode_bin(ec_dec *_this,unsigned _bits){
    return (1<<_bits)-EC_MINI(s+1,1<<_bits);
 }
 
-unsigned ec_decode_raw(ec_dec *_this,unsigned bits){
+unsigned ec_dec_bits(ec_dec *_this,unsigned bits){
   unsigned value=0;
   int count=0;
   _this->nb_end_bits += bits;
@@ -202,10 +203,10 @@ int ec_dec_bit_prob(ec_dec *_this,unsigned _prob){
   return val;
 }
 
-long ec_dec_tell(ec_dec *_this,int _b){
+ec_uint32 ec_dec_tell(ec_dec *_this,int _b){
   ec_uint32 r;
   int       l;
-  long      nbits;
+  ec_uint32      nbits;
   nbits=(ec_byte_bytes(_this->buf)-(EC_CODE_BITS+EC_SYM_BITS-1)/EC_SYM_BITS)*
    EC_SYM_BITS;
   /*To handle the non-integral number of bits still left in the decoder state,