| OLD | NEW |
| 1 /* Copyright (c) 2001-2011 Timothy B. Terriberry | 1 /* Copyright (c) 2001-2011 Timothy B. Terriberry |
| 2 Copyright (c) 2008-2009 Xiph.Org Foundation */ | 2 Copyright (c) 2008-2009 Xiph.Org Foundation */ |
| 3 /* | 3 /* |
| 4 Redistribution and use in source and binary forms, with or without | 4 Redistribution and use in source and binary forms, with or without |
| 5 modification, are permitted provided that the following conditions | 5 modification, are permitted provided that the following conditions |
| 6 are met: | 6 are met: |
| 7 | 7 |
| 8 - Redistributions of source code must retain the above copyright | 8 - Redistributions of source code must retain the above copyright |
| 9 notice, this list of conditions and the following disclaimer. | 9 notice, this list of conditions and the following disclaimer. |
| 10 | 10 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 _this->rng=1U<<EC_CODE_EXTRA; | 131 _this->rng=1U<<EC_CODE_EXTRA; |
| 132 _this->rem=ec_read_byte(_this); | 132 _this->rem=ec_read_byte(_this); |
| 133 _this->val=_this->rng-1-(_this->rem>>(EC_SYM_BITS-EC_CODE_EXTRA)); | 133 _this->val=_this->rng-1-(_this->rem>>(EC_SYM_BITS-EC_CODE_EXTRA)); |
| 134 _this->error=0; | 134 _this->error=0; |
| 135 /*Normalize the interval.*/ | 135 /*Normalize the interval.*/ |
| 136 ec_dec_normalize(_this); | 136 ec_dec_normalize(_this); |
| 137 } | 137 } |
| 138 | 138 |
| 139 unsigned ec_decode(ec_dec *_this,unsigned _ft){ | 139 unsigned ec_decode(ec_dec *_this,unsigned _ft){ |
| 140 unsigned s; | 140 unsigned s; |
| 141 _this->ext=_this->rng/_ft; | 141 _this->ext=celt_udiv(_this->rng,_ft); |
| 142 s=(unsigned)(_this->val/_this->ext); | 142 s=(unsigned)(_this->val/_this->ext); |
| 143 return _ft-EC_MINI(s+1,_ft); | 143 return _ft-EC_MINI(s+1,_ft); |
| 144 } | 144 } |
| 145 | 145 |
| 146 unsigned ec_decode_bin(ec_dec *_this,unsigned _bits){ | 146 unsigned ec_decode_bin(ec_dec *_this,unsigned _bits){ |
| 147 unsigned s; | 147 unsigned s; |
| 148 _this->ext=_this->rng>>_bits; | 148 _this->ext=_this->rng>>_bits; |
| 149 s=(unsigned)(_this->val/_this->ext); | 149 s=(unsigned)(_this->val/_this->ext); |
| 150 return (1U<<_bits)-EC_MINI(s+1U,1U<<_bits); | 150 return (1U<<_bits)-EC_MINI(s+1U,1U<<_bits); |
| 151 } | 151 } |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 while(available<=EC_WINDOW_SIZE-EC_SYM_BITS); | 236 while(available<=EC_WINDOW_SIZE-EC_SYM_BITS); |
| 237 } | 237 } |
| 238 ret=(opus_uint32)window&(((opus_uint32)1<<_bits)-1U); | 238 ret=(opus_uint32)window&(((opus_uint32)1<<_bits)-1U); |
| 239 window>>=_bits; | 239 window>>=_bits; |
| 240 available-=_bits; | 240 available-=_bits; |
| 241 _this->end_window=window; | 241 _this->end_window=window; |
| 242 _this->nend_bits=available; | 242 _this->nend_bits=available; |
| 243 _this->nbits_total+=_bits; | 243 _this->nbits_total+=_bits; |
| 244 return ret; | 244 return ret; |
| 245 } | 245 } |
| OLD | NEW |