mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-30 12:44:07 +00:00
Fix incorrect precedence.
- This bug was due to incorrect translation of ternary to if-expression during refactoring. Addition has higher precedence than bit shift.
This commit is contained in:
parent
33df8e3db5
commit
d6932128aa
|
@ -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 slope = (init_value >> 4) * 5 - 45;
|
||||||
int offset = ((init_value & 15) << 3) - 16;
|
int offset = ((init_value & 15) << 3) - 16;
|
||||||
int init_state = MIN(MAX(1, ((slope * (int)qp) >> 4) + offset), 126);
|
int init_state = MIN(MAX(1, ((slope * (int)qp) >> 4) + offset), 126);
|
||||||
uint8_t mp_state = (init_state >= 64) ? 1 : 0;
|
|
||||||
|
|
||||||
if (mp_state) {
|
if (init_state >= 64) {
|
||||||
ctx->uc_state = (init_state - 64) << 1 + mp_state;
|
ctx->uc_state = ((init_state - 64) << 1) + 1;
|
||||||
} else {
|
} else {
|
||||||
ctx->uc_state = (63 - init_state) << 1;
|
ctx->uc_state = (63 - init_state) << 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue