ref: ba42ce64b7d838f2ebc2227a6b43e06ba081e4b9
parent: 57f49db81f43df38421091eff3061ba6f9ecd9b1
author: Linfeng Zhang <linfengz@google.com>
date: Fri Aug 5 13:28:58 EDT 2016
Fix a bug in test/lpf_8_test.cc This bug is introduced in 36608af524bb65e39177f229301111f669bf0d20, where buffer tmp_s is not fully initialized. Change-Id: I125b966cf054a82bc63c72647cdd463f434eda17
--- a/test/lpf_8_test.cc
+++ b/test/lpf_8_test.cc
@@ -126,8 +126,7 @@
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 @@
}
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 @@
}
}
}
+
for (j = 0; j < kNumCoeffs; j++) {
if (i % 2) {
s[j] = tmp_s[j] & mask_;
@@ -304,8 +311,7 @@
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 @@
}
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 @@
}
}
}
+
for (j = 0; j < kNumCoeffs; j++) {
if (i % 2) {
s[j] = tmp_s[j] & mask_;