shithub: libvpx

Download patch

ref: ebadd5287a4456541daf36a6a718ea2467bb8c7e
parent: 59b7f2f36f534ec53caba6ee049bfafca02511c6
author: Hien Ho <hienho@google.com>
date: Fri Aug 9 08:21:17 EDT 2019

test/acm_random.h: int sanitizer warning

runtime error: implicit conversion from type 'int' of value
-61240 (32-bit, signed) to type 'int16_t' (aka 'short') changed the
value to 4296 (16-bit, signed)

BUG=webm:1615

Change-Id: I213fc153f0df9ea46737a7fb98d909e670125724

--- a/test/acm_random.h
+++ b/test/acm_random.h
@@ -42,8 +42,7 @@
 
   int16_t Rand16Signed(void) {
     // Use 16 bits: values between 32767 and -32768.
-    const uint32_t value = random_.Generate(65536);
-    return static_cast<int16_t>(value) - 32768;
+    return static_cast<int16_t>(random_.Generate(65536));
   }
 
   int16_t Rand13Signed(void) {
@@ -69,7 +68,7 @@
     // Returns a random value near 0 or near 255, to better exercise
     // saturation behavior.
     const uint8_t r = Rand8();
-    return r < 128 ? r << 4 : r >> 4;
+    return static_cast<uint8_t>((r < 128) ? r << 4 : r >> 4);
   }
 
   uint32_t RandRange(const uint32_t range) {
--- a/test/avg_test.cc
+++ b/test/avg_test.cc
@@ -425,10 +425,10 @@
 TEST_P(SatdLowbdTest, Random) {
   int expected;
   switch (satd_size_) {
-    case 16: expected = 263252; break;
-    case 64: expected = 1105420; break;
-    case 256: expected = 4252250; break;
-    case 1024: expected = 16876840; break;
+    case 16: expected = 261036; break;
+    case 64: expected = 991732; break;
+    case 256: expected = 4136358; break;
+    case 1024: expected = 16677592; break;
     default:
       FAIL() << "Invalid satd size (" << satd_size_
              << ") valid: 16/64/256/1024";