ref: e334d9fd1b440e3fb9722334da244f502e22e643
parent: 5fd3c083a9ba29841afedcf1e11357841ef9461c
parent: b6fa0f20565ce10b4724a120ff0c8d6faff0926b
author: James Zern <jzern@google.com>
date: Mon May 11 20:32:03 EDT 2020
Merge "Temporarily convert to 64 bits to avoid overflows"
--- a/vp8/encoder/treewriter.h
+++ b/vp8/encoder/treewriter.h
@@ -14,6 +14,8 @@
/* Trees map alphabets into huffman-like codes suitable for an arithmetic
bit coder. Timothy S Murphy 11 October 2004 */
+#include <stdint.h>
+
#include "./vpx_config.h"
#include "vp8/common/treecoder.h"
@@ -48,7 +50,9 @@
vp8_prob p) {
/* Imitate existing calculation */
- return ((ct[0] * vp8_cost_zero(p)) + (ct[1] * vp8_cost_one(p))) >> 8;
+ return (unsigned int)(((((uint64_t)ct[0]) * vp8_cost_zero(p)) +
+ (((uint64_t)ct[1]) * vp8_cost_one(p))) >>
+ 8);
}
/* Small functions to write explicit values and tokens, as well as