Commit 7fdf2d2f authored by Alex Converse's avatar Alex Converse
Browse files

ans: Optimize rabs unbiased bit decode

Change-Id: Icb4ab1de851db9f4016af8757e17fcb935a2db5a
parent 8c687d2f
......@@ -84,9 +84,16 @@ static INLINE int rabs_read(struct AnsDecoder *ans, AnsP8 p0) {
// Decode one rABS encoded boolean where the probability of the value being zero
// is one half.
static INLINE int rabs_read_bit(struct AnsDecoder *ans) {
// TODO(aconverse@google.com): Provide an optimized implementation of this
// routine.
return rabs_read(ans, 128);
#if ANS_MAX_SYMBOLS
if (ans->symbols_left-- == 0) {
ans_read_reinit(ans);
ans->symbols_left--;
}
#endif
unsigned state = refill_state(ans, ans->state);
const int value = !!(state & 0x80);
ans->state = ((state >> 1) & ~0x7F) | (state & 0x7F);
return value;
}
struct rans_dec_sym {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment