• Home
  • Raw
  • Download

Lines Matching +full:fast +full:- +full:fifo

1 /* Copyright (c) 2001-2011 Timothy B. Terriberry
2 Copyright (c) 2008-2009 Xiph.Org Foundation */
8 - Redistributions of source code must retain the above copyright
11 - Redistributions in binary form must reproduce the above copyright
40 rediscovery of the FIFO arithmetic code introduced by \cite{Pas76}.
47 This only seems true when using near-infinite precision arithmetic so that
53 encoding for efficiency actually re-discovers many of the principles
64 title="Source coding algorithms for fast data compression",
86 pages="256--294",
92 return _this->offs<_this->storage?_this->buf[_this->offs++]:0; in ec_read_byte()
96 return _this->end_offs<_this->storage? in ec_read_byte_from_end()
97 _this->buf[_this->storage-++(_this->end_offs)]:0; in ec_read_byte_from_end()
101 high-order symbol.*/
104 while(_this->rng<=EC_CODE_BOT){ in ec_dec_normalize()
106 _this->nbits_total+=EC_SYM_BITS; in ec_dec_normalize()
107 _this->rng<<=EC_SYM_BITS; in ec_dec_normalize()
109 sym=_this->rem; in ec_dec_normalize()
111 _this->rem=ec_read_byte(_this); in ec_dec_normalize()
113 sym=(sym<<EC_SYM_BITS|_this->rem)>>(EC_SYM_BITS-EC_CODE_EXTRA); in ec_dec_normalize()
115 _this->val=((_this->val<<EC_SYM_BITS)+(EC_SYM_MAX&~sym))&(EC_CODE_TOP-1); in ec_dec_normalize()
120 _this->buf=_buf; in ec_dec_init()
121 _this->storage=_storage; in ec_dec_init()
122 _this->end_offs=0; in ec_dec_init()
123 _this->end_window=0; in ec_dec_init()
124 _this->nend_bits=0; in ec_dec_init()
128 _this->nbits_total=EC_CODE_BITS+1 in ec_dec_init()
129 -((EC_CODE_BITS-EC_CODE_EXTRA)/EC_SYM_BITS)*EC_SYM_BITS; in ec_dec_init()
130 _this->offs=0; in ec_dec_init()
131 _this->rng=1U<<EC_CODE_EXTRA; in ec_dec_init()
132 _this->rem=ec_read_byte(_this); in ec_dec_init()
133 _this->val=_this->rng-1-(_this->rem>>(EC_SYM_BITS-EC_CODE_EXTRA)); in ec_dec_init()
134 _this->error=0; in ec_dec_init()
141 _this->ext=celt_udiv(_this->rng,_ft); in ec_decode()
142 s=(unsigned)(_this->val/_this->ext); in ec_decode()
143 return _ft-EC_MINI(s+1,_ft); in ec_decode()
148 _this->ext=_this->rng>>_bits; in ec_decode_bin()
149 s=(unsigned)(_this->val/_this->ext); in ec_decode_bin()
150 return (1U<<_bits)-EC_MINI(s+1U,1U<<_bits); in ec_decode_bin()
155 s=IMUL32(_this->ext,_ft-_fh); in ec_dec_update()
156 _this->val-=s; in ec_dec_update()
157 _this->rng=_fl>0?IMUL32(_this->ext,_fh-_fl):_this->rng-s; in ec_dec_update()
167 r=_this->rng; in ec_dec_bit_logp()
168 d=_this->val; in ec_dec_bit_logp()
171 if(!ret)_this->val=d-s; in ec_dec_bit_logp()
172 _this->rng=ret?s:r-s; in ec_dec_bit_logp()
183 s=_this->rng; in ec_dec_icdf()
184 d=_this->val; in ec_dec_icdf()
186 ret=-1; in ec_dec_icdf()
192 _this->val=d-s; in ec_dec_icdf()
193 _this->rng=t-s; in ec_dec_icdf()
204 s=_this->rng; in ec_dec_icdf16()
205 d=_this->val; in ec_dec_icdf16()
207 ret=-1; in ec_dec_icdf16()
213 _this->val=d-s; in ec_dec_icdf16()
214 _this->rng=t-s; in ec_dec_icdf16()
225 _ft--; in ec_dec_uint()
229 ftb-=EC_UINT_BITS; in ec_dec_uint()
235 _this->error=1; in ec_dec_uint()
250 window=_this->end_window; in ec_dec_bits()
251 available=_this->nend_bits; in ec_dec_bits()
257 while(available<=EC_WINDOW_SIZE-EC_SYM_BITS); in ec_dec_bits()
259 ret=(opus_uint32)window&(((opus_uint32)1<<_bits)-1U); in ec_dec_bits()
261 available-=_bits; in ec_dec_bits()
262 _this->end_window=window; in ec_dec_bits()
263 _this->nend_bits=available; in ec_dec_bits()
264 _this->nbits_total+=_bits; in ec_dec_bits()