Bug 1293996: Workaround AMD hardware related crash. r=jya a=ritu
authorRonald S. Bultje <rsbultje@gmail.com>
Wed, 12 Oct 2016 21:19:54 +1100
changeset 350705 5ffa4de2f3437676a6b54f5cae4ab3af10a6aad6
parent 350704 6bed7eb94f82c7f1bb28604c817d8aa3acdd44b5
child 350706 7685b4f9ab3f70a0bbd7693a6df01c871fea9cd2
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya, ritu
bugs1293996
milestone50.0
Bug 1293996: Workaround AMD hardware related crash. r=jya a=ritu MozReview-Commit-ID: IONAxzyag1b
media/ffvpx/libavcodec/vp9.c
--- a/media/ffvpx/libavcodec/vp9.c
+++ b/media/ffvpx/libavcodec/vp9.c
@@ -3698,21 +3698,20 @@ static void set_tile_offset(int *start, 
 static av_always_inline void adapt_prob(uint8_t *p, unsigned ct0, unsigned ct1,
                                         int max_count, int update_factor)
 {
     unsigned ct = ct0 + ct1, p2, p1;
 
     if (!ct)
         return;
 
+    update_factor = FASTDIV(update_factor * FFMIN(ct, max_count), max_count);
     p1 = *p;
-    p2 = ((ct0 << 8) + (ct >> 1)) / ct;
+    p2 = ((((int64_t) ct0) << 8) + (ct >> 1)) / ct;
     p2 = av_clip(p2, 1, 255);
-    ct = FFMIN(ct, max_count);
-    update_factor = FASTDIV(update_factor * ct, max_count);
 
     // (p1 * (256 - update_factor) + p2 * update_factor + 128) >> 8
     *p = p1 + (((p2 - p1) * update_factor + 128) >> 8);
 }
 
 static void adapt_probs(VP9Context *s)
 {
     int i, j, k, l, m;