shithub: libvpx

Download patch

ref: ed5b3db6c5f6dd981c7dbcf4c71c508d8e858ba8
parent: f950248b9b357b21e974e3ace94359d7ee8c7b29
parent: 343352b556f5f61833174c08a35d697d280933e3
author: Jerome Jiang <jianj@google.com>
date: Thu Jun 14 02:56:40 EDT 2018

Merge "vp8: remove assertion in tree coder."

--- a/vp8/common/treecoder.c
+++ b/vp8/common/treecoder.c
@@ -12,6 +12,7 @@
 #include <stdio.h>
 
 #include "vp8/common/treecoder.h"
+#include "vpx/vpx_integer.h"
 
 static void tree2tok(struct vp8_token_struct *const p, vp8_tree t, int i, int v,
                      int L) {
@@ -89,10 +90,9 @@
     const unsigned int *const c = branch_ct[t];
     const unsigned int tot = c[0] + c[1];
 
-    assert(tot < (1 << 24)); /* no overflow below */
-
     if (tot) {
-      const unsigned int p = ((c[0] * Pfac) + (rd ? tot >> 1 : 0)) / tot;
+      const unsigned int p =
+          (unsigned int)(((uint64_t)c[0] * Pfac) + (rd ? tot >> 1 : 0)) / tot;
       probs[t] = p < 256 ? (p ? p : 1) : 255; /* agree w/old version for now */
     } else {
       probs[t] = vp8_prob_half;