• Home
  • Raw
  • Download

Lines Matching +full:- +full:ac

9  *  http://www.apache.org/licenses/LICENSE-2.0
22 * - Arthmetic coder put bits while increasing memory addresses
25 * - Plain bits are puts starting the end of the buffer, with memeory
28 * .---------------------------------------------------.
30 * '---------------------------------------------------'
31 * |---------------------> - - - - - - - - - - - - - ->|
32 * |< - - - <-------------------|
36 * - The forward writing is protected against buffer overflow, it cannot
40 * - The backward writing is protected against overwrite of the arithmetic
44 * .---------------------------------------------------.
46 * '---------------------------------------------------'
47 * |---------------------> - - - - - - - - - - - - - ->|
48 * |< - - - - - - - - - - - - - - <-------------------|
52 * - Reading is limited to read of the complementary end of the buffer.
54 * - The procedure `lc3_check_bits()` returns indication that read has been
114 struct lc3_bits_ac ac; member
139 * return 0: Ok -1: Bitstream overflow or AC reading error
153 * v, n Value, in range 0 to 2^n - 1, and bits count (1 to 32)
196 /* ----------------------------------------------------------------------------
198 * -------------------------------------------------------------------------- */
221 struct lc3_bits_accu *accu = &bits->accu; in lc3_put_bits()
223 if (accu->n + n <= LC3_ACCU_BITS) { in lc3_put_bits()
224 accu->v |= v << accu->n; in lc3_put_bits()
225 accu->n += n; in lc3_put_bits()
244 struct lc3_bits_accu *accu = &bits->accu; in lc3_get_bits()
246 if (accu->n + n <= LC3_ACCU_BITS) { in lc3_get_bits()
247 int v = (accu->v >> accu->n) & ((1u << n) - 1); in lc3_get_bits()
248 return (accu->n += n), v; in lc3_get_bits()
261 const struct lc3_ac_symbol *symbols = model->s; in lc3_put_symbol()
262 struct lc3_bits_ac *ac = &bits->ac; in lc3_put_symbol() local
263 unsigned range = ac->range >> 10; in lc3_put_symbol()
265 ac->low += range * symbols[s].low; in lc3_put_symbol()
266 ac->range = range * symbols[s].range; in lc3_put_symbol()
268 ac->carry |= ac->low >> 24; in lc3_put_symbol()
269 ac->low &= 0xffffff; in lc3_put_symbol()
271 if (ac->range < 0x10000) in lc3_put_symbol()
281 const struct lc3_ac_symbol *symbols = model->s; in lc3_get_symbol()
282 struct lc3_bits_ac *ac = &bits->ac; in lc3_get_symbol() local
284 unsigned range = (ac->range >> 10) & 0xffff; in lc3_get_symbol()
286 ac->error |= (ac->low >= (range << 10)); in lc3_get_symbol()
287 if (ac->error) in lc3_get_symbol()
288 ac->low = 0; in lc3_get_symbol()
292 if (ac->low < range * symbols[s].low) { in lc3_get_symbol()
294 s -= ac->low < range * symbols[s].low ? 4 : -4; in lc3_get_symbol()
295 s -= ac->low < range * symbols[s].low ? 2 : -2; in lc3_get_symbol()
296 s -= ac->low < range * symbols[s].low ? 1 : -1; in lc3_get_symbol()
297 s -= ac->low < range * symbols[s].low; in lc3_get_symbol()
300 ac->low -= range * symbols[s].low; in lc3_get_symbol()
301 ac->range = range * symbols[s].range; in lc3_get_symbol()
303 if (ac->range < 0x10000) in lc3_get_symbol()