diff --git a/src/context.c b/src/context.c index 3dfed865..2eabeec3 100644 --- a/src/context.c +++ b/src/context.c @@ -55,10 +55,9 @@ void ctx_init(cabac_ctx *ctx, uint32_t qp, uint32_t init_value) int slope = (init_value >> 4) * 5 - 45; int offset = ((init_value & 15) << 3) - 16; int init_state = MIN(MAX(1, ((slope * (int)qp) >> 4) + offset), 126); - uint8_t mp_state = (init_state >= 64) ? 1 : 0; - if (mp_state) { - ctx->uc_state = (init_state - 64) << 1 + mp_state; + if (init_state >= 64) { + ctx->uc_state = ((init_state - 64) << 1) + 1; } else { ctx->uc_state = (63 - init_state) << 1; }