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) {
}
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) {
}
}
}
+
for (j = 0; j < kNumCoeffs; j++) {
if (i % 2) {
s[j] = tmp_s[j] & mask_;
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) {
}
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) {
}
}
}
+
for (j = 0; j < kNumCoeffs; j++) {
if (i % 2) {
s[j] = tmp_s[j] & mask_;