vp9: change order of operations in adapt_prob().
authorRonald S. Bultje <rsbultje@gmail.com>
Fri, 14 Oct 2016 17:01:27 +0000 (13:01 -0400)
committerMichael Niedermayer <michael@niedermayer.cc>
Sat, 26 Nov 2016 14:12:26 +0000 (15:12 +0100)
commite25441912baf76d61ce216f6efc24ffcc83f707a
tree1aa00e3042e8bf5ac98c73ae89690bbd86c68777
parentabe16359ba805037da0866ce07c962a57f71bcf1
vp9: change order of operations in adapt_prob().

This is intended to workaround bug "665 Integer Divide Instruction May
Cause Unpredictable Behavior" on some early AMD CPUs, which causes a
div-by-zero in this codepath, such as reported in Mozilla bug #1293996.

Note that this isn't guaranteed to fix the bug, since a compiler is free
to reorder instructions that don't depend on each other. However, it
appears to fix the bug in Firefox, and a similar patch was applied to
libvpx also (see Chrome bug #599899).

(cherry picked from commit be885da3427c5d9a6fa68229d16318afffe67193)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/vp9.c