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

Unified · Split

test/vp9_quantize_test.cc+28−20
@@ -111,11 +111,19 @@ TEST_P(VP9QuantizeTest, OperationCheck) { · 110 unmodified lines
111111 ref_eob = eob;
112112 coeff.Set(&rnd, 0, max_value_);
113113 for (int j = 0; j < 2; j++) {
114− zbin_ptr[j] = rnd.RandRange(max_value_);
115− round_ptr[j] = rnd.Rand16();
116− quant_ptr[j] = rnd.Rand16();
117− quant_shift_ptr[j] = rnd.Rand16();
118− dequant_ptr[j] = rnd.Rand16();
114+ // Values determined by deconstructing vp9_init_quantizer().
115+ // zbin may be up to 1143 for 8 and 10 bit Y values, or 1200 for 12 bit Y
116+ // values or U/V values of any bit depth. This is because y_delta is not
117+ // factored into the vp9_ac_quant() call.
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);
119127 }
120128 ref_quantize_op_(
121129 coeff.TopLeftPixel(), count, skip_block, zbin_ptr, round_ptr, quant_ptr,
@@ -169,11 +177,11 @@ TEST_P(VP9Quantize32Test, OperationCheck) { · 47 unmodified lines
169177 ref_eob = eob;
170178 coeff.Set(&rnd, 0, max_value_);
171179 for (int j = 0; j < 2; j++) {
172− zbin_ptr[j] = rnd.RandRange(max_value_);
173− round_ptr[j] = rnd.Rand16();
174− quant_ptr[j] = rnd.Rand16();
175− quant_shift_ptr[j] = rnd.Rand16();
176− dequant_ptr[j] = rnd.Rand16();
180+ zbin_ptr[j] = rnd.RandRange(1200);
181+ round_ptr[j] = rnd.RandRange(914);
182+ quant_ptr[j] = rnd.RandRange(32704) - 32703;
183+ quant_shift_ptr[j] = rnd.RandRange(16384);
184+ dequant_ptr[j] = rnd.RandRange(1828);
177185 }
178186 ref_quantize_op_(
179187 coeff.TopLeftPixel(), count, skip_block, zbin_ptr, round_ptr, quant_ptr,
@@ -230,11 +238,11 @@ TEST_P(VP9QuantizeTest, EOBCheck) { · 50 unmodified lines
230238 coeff.TopLeftPixel()[rnd(count)] = rnd.RandRange(max_value_);
231239 coeff.TopLeftPixel()[rnd(count)] = rnd.RandRange(max_value_);
232240 for (int j = 0; j < 2; j++) {
233− zbin_ptr[j] = rnd.RandRange(max_value_);
234− round_ptr[j] = rnd.Rand16();
235− quant_ptr[j] = rnd.Rand16();
236− quant_shift_ptr[j] = rnd.Rand16();
237− dequant_ptr[j] = rnd.Rand16();
241+ zbin_ptr[j] = rnd.RandRange(1200);
242+ round_ptr[j] = rnd.RandRange(914);
243+ quant_ptr[j] = rnd.RandRange(32704) - 32703;
244+ quant_shift_ptr[j] = rnd.RandRange(16384);
245+ dequant_ptr[j] = rnd.RandRange(1828);
238246 }
239247
240248 ref_quantize_op_(
@@ -292,11 +300,11 @@ TEST_P(VP9Quantize32Test, EOBCheck) { · 51 unmodified lines
292300 coeff.TopLeftPixel()[rnd(count)] = rnd.RandRange(max_value_);
293301 coeff.TopLeftPixel()[rnd(count)] = rnd.RandRange(max_value_);
294302 for (int j = 0; j < 2; j++) {
295− zbin_ptr[j] = rnd.RandRange(max_value_);
296− round_ptr[j] = rnd.Rand16();
297− quant_ptr[j] = rnd.Rand16();
298− quant_shift_ptr[j] = rnd.Rand16();
299− dequant_ptr[j] = rnd.Rand16();
303+ zbin_ptr[j] = rnd.RandRange(1200);
304+ round_ptr[j] = rnd.RandRange(914);
305+ quant_ptr[j] = rnd.RandRange(32704) - 32703;
306+ quant_shift_ptr[j] = rnd.RandRange(16384);
307+ dequant_ptr[j] = rnd.RandRange(1828);
300308 }
301309
302310 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