ref: 6f7e5cb38edfe6dc3899f0ddf7d508e508f21f81
parent: f0f73b4cff0bfb2d2fa9bfa0a7656ddadf526ae1
author: Henrik Gramner <[email protected]>
date: Wed Dec 2 09:10:44 EST 2020
Simplify msac subexp decoding
--- a/src/msac.c
+++ b/src/msac.c
@@ -101,17 +101,17 @@
}
int dav1d_msac_decode_subexp(MsacContext *const s, const int ref,
- const int n, const unsigned k)
+ const int n, unsigned k)
{
- int i = 0;
- int a = 0;
- int b = k;
- while ((2 << b) < n) {
- if (!dav1d_msac_decode_bool_equi(s)) break;
- b = k + i++;
- a = (1 << b);
+ assert(n >> k == 8);
+
+ unsigned a = 0;
+ if (dav1d_msac_decode_bool_equi(s)) {
+ if (dav1d_msac_decode_bool_equi(s))
+ k += dav1d_msac_decode_bool_equi(s) + 1;
+ a = 1 << k;
}
- const unsigned v = dav1d_msac_decode_bools(s, b) + a;
+ const unsigned v = dav1d_msac_decode_bools(s, k) + a;
return ref * 2 <= n ? inv_recenter(ref, v) :
n - 1 - inv_recenter(n - 1 - ref, v);
}