| 85 | } |
| 86 | |
| 87 | static inline void put_rac(RangeCoder *c, uint8_t *const state, int bit) |
| 88 | { |
| 89 | int range1 = (c->range * (*state)) >> 8; |
| 90 | |
| 91 | av_assert2(*state); |
| 92 | av_assert2(range1 < c->range); |
| 93 | av_assert2(range1 > 0); |
| 94 | if (!bit) { |
| 95 | c->range -= range1; |
| 96 | *state = c->zero_state[*state]; |
| 97 | } else { |
| 98 | c->low += c->range - range1; |
| 99 | c->range = range1; |
| 100 | *state = c->one_state[*state]; |
| 101 | } |
| 102 | |
| 103 | if (c->range < 0x100) |
| 104 | renorm_encoder(c); |
| 105 | } |
| 106 | |
| 107 | static inline void refill(RangeCoder *c) |
| 108 | { |