]> granicus.if.org Git - libvpx/commitdiff
Fix a bug in test/lpf_8_test.cc
authorLinfeng Zhang <linfengz@google.com>
Sat, 6 Aug 2016 00:28:58 +0000 (17:28 -0700)
committerLinfeng Zhang <linfengz@google.com>
Sat, 6 Aug 2016 00:52:10 +0000 (17:52 -0700)
This bug is introduced in 36608af524bb65e39177f229301111f669bf0d20,
where buffer tmp_s is not fully initialized.

Change-Id: I125b966cf054a82bc63c72647cdd463f434eda17

test/lpf_8_test.cc

index 4d28f8cad9b86564f9eeaf8a6026d17744397c73..2f843d799d0fe729223d3cb351b03665e7063edc 100644 (file)
@@ -126,8 +126,7 @@ TEST_P(Loop8Test6Param, OperationCheck) {
       if (val & 0x80) {  // 50% chance to choose a new value.
         tmp_s[j] = rnd.Rand16();
         j++;
-      } else if (val & 0x40) {
-        // 25% chance to repeat previous value in row X times.
+      } else {  // 50% chance to repeat previous value in row X times.
         int k = 0;
         while (k++ < ((val & 0x1f) + 1) && j < kNumCoeffs) {
           if (j < 1) {
@@ -139,7 +138,14 @@ TEST_P(Loop8Test6Param, OperationCheck) {
           }
           j++;
         }
-      } else {  // 25% chance to repeat previous value in column X times.
+      }
+    }
+
+    for (j = 0; j < kNumCoeffs;) {
+      const uint8_t val = rnd.Rand8();
+      if (val & 0x80) {
+        j++;
+      } else {  // 50% chance to repeat previous value in column X times.
         int k = 0;
         while (k++ < ((val & 0x1f) + 1) && j < kNumCoeffs) {
           if (j < 1) {
@@ -155,6 +161,7 @@ TEST_P(Loop8Test6Param, OperationCheck) {
         }
       }
     }
+
     for (j = 0; j < kNumCoeffs; j++) {
       if (i % 2) {
         s[j] = tmp_s[j] & mask_;
@@ -304,8 +311,7 @@ TEST_P(Loop8Test9Param, OperationCheck) {
       if (val & 0x80) {  // 50% chance to choose a new value.
         tmp_s[j] = rnd.Rand16();
         j++;
-      } else if (val & 0x40) {
-        // 25% chance to repeat previous value in row X times.
+      } else {  // 50% chance to repeat previous value in row X times.
         int k = 0;
         while (k++ < ((val & 0x1f) + 1) && j < kNumCoeffs) {
           if (j < 1) {
@@ -317,7 +323,14 @@ TEST_P(Loop8Test9Param, OperationCheck) {
           }
           j++;
         }
-      } else {  // 25% chance to repeat previous value in column X times.
+      }
+    }
+
+    for (j = 0; j < kNumCoeffs;) {
+      const uint8_t val = rnd.Rand8();
+      if (val & 0x80) {
+        j++;
+      } else {  // 50% chance to repeat previous value in column X times.
         int k = 0;
         while (k++ < ((val & 0x1f) + 1) && j < kNumCoeffs) {
           if (j < 1) {
@@ -333,6 +346,7 @@ TEST_P(Loop8Test9Param, OperationCheck) {
         }
       }
     }
+
     for (j = 0; j < kNumCoeffs; j++) {
       if (i % 2) {
         s[j] = tmp_s[j] & mask_;