diff options
author | Martin Storsjö <martin@martin.st> | 2013-11-11 17:02:09 +0400 |
---|---|---|
committer | Clément Bœsch <u@pkh.me> | 2013-11-16 23:25:25 +0400 |
commit | ab80d7e8c52d912b94aeca52f77c03492c71ea94 (patch) | |
tree | bba033476b2dd611deca969103ad308cd63ce638 /libavcodec/vp9.c | |
parent | 7cd555dfa54a9b9b83749977e7eec3f023ff2b36 (diff) |
vp9: Ensure that the arithmetic coder values are read in the right order
The operands of an addition can be evaluated in any order, since
the addition isn't a sequence point. The only operators that
have a defined evaluation order are &&, ||, ?: and the sequence
operator ','.
This fixes fate-vp9 on ARM RVCT.
Diffstat (limited to 'libavcodec/vp9.c')
-rw-r--r-- | libavcodec/vp9.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c index 05af2e8d60..4978915bc4 100644 --- a/libavcodec/vp9.c +++ b/libavcodec/vp9.c @@ -1843,43 +1843,43 @@ static int decode_coeffs_b(VP56RangeCoder *c, int16_t *coef, int n_coeffs, if (!vp56_rac_get_prob_branchy(c, tp[7])) { val = 5 + vp56_rac_get_prob(c, 159); } else { - val = 7 + (vp56_rac_get_prob(c, 165) << 1) + - vp56_rac_get_prob(c, 145); + val = 7 + (vp56_rac_get_prob(c, 165) << 1); + val += vp56_rac_get_prob(c, 145); } } else { // cat 3-6 cache[rc] = 5; if (!vp56_rac_get_prob_branchy(c, tp[8])) { if (!vp56_rac_get_prob_branchy(c, tp[9])) { - val = 11 + (vp56_rac_get_prob(c, 173) << 2) + - (vp56_rac_get_prob(c, 148) << 1) + - vp56_rac_get_prob(c, 140); + val = 11 + (vp56_rac_get_prob(c, 173) << 2); + val += (vp56_rac_get_prob(c, 148) << 1); + val += vp56_rac_get_prob(c, 140); } else { - val = 19 + (vp56_rac_get_prob(c, 176) << 3) + - (vp56_rac_get_prob(c, 155) << 2) + - (vp56_rac_get_prob(c, 140) << 1) + - vp56_rac_get_prob(c, 135); + val = 19 + (vp56_rac_get_prob(c, 176) << 3); + val += (vp56_rac_get_prob(c, 155) << 2); + val += (vp56_rac_get_prob(c, 140) << 1); + val += vp56_rac_get_prob(c, 135); } } else if (!vp56_rac_get_prob_branchy(c, tp[10])) { - val = 35 + (vp56_rac_get_prob(c, 180) << 4) + - (vp56_rac_get_prob(c, 157) << 3) + - (vp56_rac_get_prob(c, 141) << 2) + - (vp56_rac_get_prob(c, 134) << 1) + - vp56_rac_get_prob(c, 130); + val = 35 + (vp56_rac_get_prob(c, 180) << 4); + val += (vp56_rac_get_prob(c, 157) << 3); + val += (vp56_rac_get_prob(c, 141) << 2); + val += (vp56_rac_get_prob(c, 134) << 1); + val += vp56_rac_get_prob(c, 130); } else { - val = 67 + (vp56_rac_get_prob(c, 254) << 13) + - (vp56_rac_get_prob(c, 254) << 12) + - (vp56_rac_get_prob(c, 254) << 11) + - (vp56_rac_get_prob(c, 252) << 10) + - (vp56_rac_get_prob(c, 249) << 9) + - (vp56_rac_get_prob(c, 243) << 8) + - (vp56_rac_get_prob(c, 230) << 7) + - (vp56_rac_get_prob(c, 196) << 6) + - (vp56_rac_get_prob(c, 177) << 5) + - (vp56_rac_get_prob(c, 153) << 4) + - (vp56_rac_get_prob(c, 140) << 3) + - (vp56_rac_get_prob(c, 133) << 2) + - (vp56_rac_get_prob(c, 130) << 1) + - vp56_rac_get_prob(c, 129); + val = 67 + (vp56_rac_get_prob(c, 254) << 13); + val += (vp56_rac_get_prob(c, 254) << 12); + val += (vp56_rac_get_prob(c, 254) << 11); + val += (vp56_rac_get_prob(c, 252) << 10); + val += (vp56_rac_get_prob(c, 249) << 9); + val += (vp56_rac_get_prob(c, 243) << 8); + val += (vp56_rac_get_prob(c, 230) << 7); + val += (vp56_rac_get_prob(c, 196) << 6); + val += (vp56_rac_get_prob(c, 177) << 5); + val += (vp56_rac_get_prob(c, 153) << 4); + val += (vp56_rac_get_prob(c, 140) << 3); + val += (vp56_rac_get_prob(c, 133) << 2); + val += (vp56_rac_get_prob(c, 130) << 1); + val += vp56_rac_get_prob(c, 129); } } } |