Linearize extrabits writing.
The decoder is already linear so changing these tables would just create
a mismatch.
Change-Id: Ib888c0dc273e089c38298f569bb35b6e4c32dd60
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index df27fbc..e8c00c5 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -787,20 +787,19 @@
if (extra_bits_av1_length) {
const unsigned char *pb = extra_bits_av1->prob;
const int value = extra_bits >> 1;
- int num_bits = extra_bits_av1_length; // number of bits in value
+ const int num_bits = extra_bits_av1_length; // number of bits in value
assert(num_bits > 0);
- index = 0;
- do {
- const int bb = (value >> --num_bits) & 1;
+ for (index = 0; index < num_bits; ++index) {
+ const int shift = num_bits - index - 1;
+ const int bb = (value >> shift) & 1;
if (skip_bits) {
--skip_bits;
assert(!bb);
} else {
- aom_write(w, bb, pb[index >> 1]);
+ aom_write(w, bb, pb[index]);
}
- index = extra_bits_av1->tree[index + bb];
- } while (num_bits);
+ }
}
aom_write_bit(w, extra_bits & 1);