History

quantize test: restrict and correct input

Use only valid values for quantize inputs. These were determined by looping over vp9_init_quantizer and looking for max and min values. This allows extending the test to the low bit depth functions which were not designed to handle all possible inputs but only valid inputs.

Johann committed 9 years ago

Commit cb61ba01 parent ad563711 file · +28 −20Browse files

Showing the changes to test (1 of 1 file). Show all

Unified · Split

test/vp9_quantize_test.cc+28−20
@@ -111,11 +111,19 @@ TEST_P(VP9QuantizeTest, OperationCheck) { · 110 unmodified lines
111 ref_eob = eob;111 ref_eob = eob;
112 coeff.Set(&rnd, 0, max_value_);112 coeff.Set(&rnd, 0, max_value_);
113 for (int j = 0; j < 2; j++) {113 for (int j = 0; j < 2; j++) {
114 zbin_ptr[j] = rnd.RandRange(max_value_);114 // Values determined by deconstructing vp9_init_quantizer().
115 round_ptr[j] = rnd.Rand16();115 // zbin may be up to 1143 for 8 and 10 bit Y values, or 1200 for 12 bit Y
116 quant_ptr[j] = rnd.Rand16();116 // values or U/V values of any bit depth. This is because y_delta is not
117 quant_shift_ptr[j] = rnd.Rand16();117 // factored into the vp9_ac_quant() call.
118 dequant_ptr[j] = rnd.Rand16();118 zbin_ptr[j] = rnd.RandRange(1200);
119 // round may be up to 685 for Y values or 914 for U/V.
120 round_ptr[j] = rnd.RandRange(914);
121 // quant ranges from 1 to -32703
122 quant_ptr[j] = rnd.RandRange(32704) - 32703;
123 // quant_shift goes up to 1 << 16.
124 quant_shift_ptr[j] = rnd.RandRange(16384);
125 // dequant maxes out at 1828 for all cases.
126 dequant_ptr[j] = rnd.RandRange(1828);
119 }127 }
120 ref_quantize_op_(128 ref_quantize_op_(
121 coeff.TopLeftPixel(), count, skip_block, zbin_ptr, round_ptr, quant_ptr,129 coeff.TopLeftPixel(), count, skip_block, zbin_ptr, round_ptr, quant_ptr,
@@ -169,11 +177,11 @@ TEST_P(VP9Quantize32Test, OperationCheck) { · 47 unmodified lines
169 ref_eob = eob;177 ref_eob = eob;
170 coeff.Set(&rnd, 0, max_value_);178 coeff.Set(&rnd, 0, max_value_);
171 for (int j = 0; j < 2; j++) {179 for (int j = 0; j < 2; j++) {
172 zbin_ptr[j] = rnd.RandRange(max_value_);180 zbin_ptr[j] = rnd.RandRange(1200);
173 round_ptr[j] = rnd.Rand16();181 round_ptr[j] = rnd.RandRange(914);
174 quant_ptr[j] = rnd.Rand16();182 quant_ptr[j] = rnd.RandRange(32704) - 32703;
175 quant_shift_ptr[j] = rnd.Rand16();183 quant_shift_ptr[j] = rnd.RandRange(16384);
176 dequant_ptr[j] = rnd.Rand16();184 dequant_ptr[j] = rnd.RandRange(1828);
177 }185 }
178 ref_quantize_op_(186 ref_quantize_op_(
179 coeff.TopLeftPixel(), count, skip_block, zbin_ptr, round_ptr, quant_ptr,187 coeff.TopLeftPixel(), count, skip_block, zbin_ptr, round_ptr, quant_ptr,
@@ -230,11 +238,11 @@ TEST_P(VP9QuantizeTest, EOBCheck) { · 50 unmodified lines
230 coeff.TopLeftPixel()[rnd(count)] = rnd.RandRange(max_value_);238 coeff.TopLeftPixel()[rnd(count)] = rnd.RandRange(max_value_);
231 coeff.TopLeftPixel()[rnd(count)] = rnd.RandRange(max_value_);239 coeff.TopLeftPixel()[rnd(count)] = rnd.RandRange(max_value_);
232 for (int j = 0; j < 2; j++) {240 for (int j = 0; j < 2; j++) {
233 zbin_ptr[j] = rnd.RandRange(max_value_);241 zbin_ptr[j] = rnd.RandRange(1200);
234 round_ptr[j] = rnd.Rand16();242 round_ptr[j] = rnd.RandRange(914);
235 quant_ptr[j] = rnd.Rand16();243 quant_ptr[j] = rnd.RandRange(32704) - 32703;
236 quant_shift_ptr[j] = rnd.Rand16();244 quant_shift_ptr[j] = rnd.RandRange(16384);
237 dequant_ptr[j] = rnd.Rand16();245 dequant_ptr[j] = rnd.RandRange(1828);
238 }246 }
239 247
240 ref_quantize_op_(248 ref_quantize_op_(
@@ -292,11 +300,11 @@ TEST_P(VP9Quantize32Test, EOBCheck) { · 51 unmodified lines
292 coeff.TopLeftPixel()[rnd(count)] = rnd.RandRange(max_value_);300 coeff.TopLeftPixel()[rnd(count)] = rnd.RandRange(max_value_);
293 coeff.TopLeftPixel()[rnd(count)] = rnd.RandRange(max_value_);301 coeff.TopLeftPixel()[rnd(count)] = rnd.RandRange(max_value_);
294 for (int j = 0; j < 2; j++) {302 for (int j = 0; j < 2; j++) {
295 zbin_ptr[j] = rnd.RandRange(max_value_);303 zbin_ptr[j] = rnd.RandRange(1200);
296 round_ptr[j] = rnd.Rand16();304 round_ptr[j] = rnd.RandRange(914);
297 quant_ptr[j] = rnd.Rand16();305 quant_ptr[j] = rnd.RandRange(32704) - 32703;
298 quant_shift_ptr[j] = rnd.Rand16();306 quant_shift_ptr[j] = rnd.RandRange(16384);
299 dequant_ptr[j] = rnd.Rand16();307 dequant_ptr[j] = rnd.RandRange(1828);
300 }308 }
301 309
302 ref_quantize_op_(310 ref_quantize_op_(

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t