From cd475da8ed054187ed5e2013cc71f46a28202575 Mon Sep 17 00:00:00 2001
From: John Koleszar <jkoleszar@google.com>
Date: Sat, 12 Jun 2010 14:11:51 -0400
Subject: [PATCH] Make this/next iiratio unsigned.

This patch addresses issue #79, which is a regression since commit
28de670 "Fix RD bug." If the coded error value is zero, the iiratio
calculation effectively multiplies by 1000000 by the
DOUBLE_DIVIDE_CHECK macro. This can result in a value larger than
INT_MAX, giving a negative ratio. Since the error values are
conceptually unsigned (though they're stored in a double) this patch
makes the iiratio values unsigned, which allows the clamping to work
as expected.
---
 vp8/encoder/onyx_int.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h
index b934d98c78..889bf735fd 100644
--- a/vp8/encoder/onyx_int.h
+++ b/vp8/encoder/onyx_int.h
@@ -523,8 +523,8 @@ typedef struct
     int motion_lvl;
     int motion_speed;
     int motion_var;
-    int next_iiratio;
-    int this_iiratio;
+    unsigned int next_iiratio;
+    unsigned int this_iiratio;
     int this_frame_modified_error;
 
     double norm_intra_err_per_mb;
-- 
GitLab