OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 protected: | 74 protected: |
75 vpx_bit_depth_t bit_depth_; | 75 vpx_bit_depth_t bit_depth_; |
76 int mask_; | 76 int mask_; |
77 QuantizeFunc quantize_op_; | 77 QuantizeFunc quantize_op_; |
78 QuantizeFunc ref_quantize_op_; | 78 QuantizeFunc ref_quantize_op_; |
79 }; | 79 }; |
80 | 80 |
81 TEST_P(VP9QuantizeTest, OperationCheck) { | 81 TEST_P(VP9QuantizeTest, OperationCheck) { |
82 ACMRandom rnd(ACMRandom::DeterministicSeed()); | 82 ACMRandom rnd(ACMRandom::DeterministicSeed()); |
83 DECLARE_ALIGNED_ARRAY(16, tran_low_t, coeff_ptr, 256); | 83 DECLARE_ALIGNED(16, tran_low_t, coeff_ptr[256]); |
84 DECLARE_ALIGNED_ARRAY(16, int16_t, zbin_ptr, 2); | 84 DECLARE_ALIGNED(16, int16_t, zbin_ptr[2]); |
85 DECLARE_ALIGNED_ARRAY(16, int16_t, round_ptr, 2); | 85 DECLARE_ALIGNED(16, int16_t, round_ptr[2]); |
86 DECLARE_ALIGNED_ARRAY(16, int16_t, quant_ptr, 2); | 86 DECLARE_ALIGNED(16, int16_t, quant_ptr[2]); |
87 DECLARE_ALIGNED_ARRAY(16, int16_t, quant_shift_ptr, 2); | 87 DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[2]); |
88 DECLARE_ALIGNED_ARRAY(16, tran_low_t, qcoeff_ptr, 256); | 88 DECLARE_ALIGNED(16, tran_low_t, qcoeff_ptr[256]); |
89 DECLARE_ALIGNED_ARRAY(16, tran_low_t, dqcoeff_ptr, 256); | 89 DECLARE_ALIGNED(16, tran_low_t, dqcoeff_ptr[256]); |
90 DECLARE_ALIGNED_ARRAY(16, tran_low_t, ref_qcoeff_ptr, 256); | 90 DECLARE_ALIGNED(16, tran_low_t, ref_qcoeff_ptr[256]); |
91 DECLARE_ALIGNED_ARRAY(16, tran_low_t, ref_dqcoeff_ptr, 256); | 91 DECLARE_ALIGNED(16, tran_low_t, ref_dqcoeff_ptr[256]); |
92 DECLARE_ALIGNED_ARRAY(16, int16_t, dequant_ptr, 2); | 92 DECLARE_ALIGNED(16, int16_t, dequant_ptr[2]); |
93 DECLARE_ALIGNED_ARRAY(16, uint16_t, eob_ptr, 1); | 93 DECLARE_ALIGNED(16, uint16_t, eob_ptr[1]); |
94 DECLARE_ALIGNED_ARRAY(16, uint16_t, ref_eob_ptr, 1); | 94 DECLARE_ALIGNED(16, uint16_t, ref_eob_ptr[1]); |
95 int err_count_total = 0; | 95 int err_count_total = 0; |
96 int first_failure = -1; | 96 int first_failure = -1; |
97 for (int i = 0; i < number_of_iterations; ++i) { | 97 for (int i = 0; i < number_of_iterations; ++i) { |
98 const int skip_block = i == 0; | 98 const int skip_block = i == 0; |
99 const TX_SIZE sz = (TX_SIZE)(i % 3); // TX_4X4, TX_8X8 TX_16X16 | 99 const TX_SIZE sz = (TX_SIZE)(i % 3); // TX_4X4, TX_8X8 TX_16X16 |
100 const TX_TYPE tx_type = (TX_TYPE)((i >> 2) % 3); | 100 const TX_TYPE tx_type = (TX_TYPE)((i >> 2) % 3); |
101 const scan_order *scan_order = &vp9_scan_orders[sz][tx_type]; | 101 const scan_order *scan_order = &vp9_scan_orders[sz][tx_type]; |
102 const int count = (4 << sz) * (4 << sz); // 16, 64, 256 | 102 const int count = (4 << sz) * (4 << sz); // 16, 64, 256 |
103 int err_count = 0; | 103 int err_count = 0; |
104 *eob_ptr = rnd.Rand16(); | 104 *eob_ptr = rnd.Rand16(); |
(...skipping 27 matching lines...) Expand all Loading... |
132 } | 132 } |
133 err_count_total += err_count; | 133 err_count_total += err_count; |
134 } | 134 } |
135 EXPECT_EQ(0, err_count_total) | 135 EXPECT_EQ(0, err_count_total) |
136 << "Error: Quantization Test, C output doesn't match SSE2 output. " | 136 << "Error: Quantization Test, C output doesn't match SSE2 output. " |
137 << "First failed at test case " << first_failure; | 137 << "First failed at test case " << first_failure; |
138 } | 138 } |
139 | 139 |
140 TEST_P(VP9Quantize32Test, OperationCheck) { | 140 TEST_P(VP9Quantize32Test, OperationCheck) { |
141 ACMRandom rnd(ACMRandom::DeterministicSeed()); | 141 ACMRandom rnd(ACMRandom::DeterministicSeed()); |
142 DECLARE_ALIGNED_ARRAY(16, tran_low_t, coeff_ptr, 1024); | 142 DECLARE_ALIGNED(16, tran_low_t, coeff_ptr[1024]); |
143 DECLARE_ALIGNED_ARRAY(16, int16_t, zbin_ptr, 2); | 143 DECLARE_ALIGNED(16, int16_t, zbin_ptr[2]); |
144 DECLARE_ALIGNED_ARRAY(16, int16_t, round_ptr, 2); | 144 DECLARE_ALIGNED(16, int16_t, round_ptr[2]); |
145 DECLARE_ALIGNED_ARRAY(16, int16_t, quant_ptr, 2); | 145 DECLARE_ALIGNED(16, int16_t, quant_ptr[2]); |
146 DECLARE_ALIGNED_ARRAY(16, int16_t, quant_shift_ptr, 2); | 146 DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[2]); |
147 DECLARE_ALIGNED_ARRAY(16, tran_low_t, qcoeff_ptr, 1024); | 147 DECLARE_ALIGNED(16, tran_low_t, qcoeff_ptr[1024]); |
148 DECLARE_ALIGNED_ARRAY(16, tran_low_t, dqcoeff_ptr, 1024); | 148 DECLARE_ALIGNED(16, tran_low_t, dqcoeff_ptr[1024]); |
149 DECLARE_ALIGNED_ARRAY(16, tran_low_t, ref_qcoeff_ptr, 1024); | 149 DECLARE_ALIGNED(16, tran_low_t, ref_qcoeff_ptr[1024]); |
150 DECLARE_ALIGNED_ARRAY(16, tran_low_t, ref_dqcoeff_ptr, 1024); | 150 DECLARE_ALIGNED(16, tran_low_t, ref_dqcoeff_ptr[1024]); |
151 DECLARE_ALIGNED_ARRAY(16, int16_t, dequant_ptr, 2); | 151 DECLARE_ALIGNED(16, int16_t, dequant_ptr[2]); |
152 DECLARE_ALIGNED_ARRAY(16, uint16_t, eob_ptr, 1); | 152 DECLARE_ALIGNED(16, uint16_t, eob_ptr[1]); |
153 DECLARE_ALIGNED_ARRAY(16, uint16_t, ref_eob_ptr, 1); | 153 DECLARE_ALIGNED(16, uint16_t, ref_eob_ptr[1]); |
154 int err_count_total = 0; | 154 int err_count_total = 0; |
155 int first_failure = -1; | 155 int first_failure = -1; |
156 for (int i = 0; i < number_of_iterations; ++i) { | 156 for (int i = 0; i < number_of_iterations; ++i) { |
157 const int skip_block = i == 0; | 157 const int skip_block = i == 0; |
158 const TX_SIZE sz = TX_32X32; | 158 const TX_SIZE sz = TX_32X32; |
159 const TX_TYPE tx_type = (TX_TYPE)(i % 4); | 159 const TX_TYPE tx_type = (TX_TYPE)(i % 4); |
160 const scan_order *scan_order = &vp9_scan_orders[sz][tx_type]; | 160 const scan_order *scan_order = &vp9_scan_orders[sz][tx_type]; |
161 const int count = (4 << sz) * (4 << sz); // 1024 | 161 const int count = (4 << sz) * (4 << sz); // 1024 |
162 int err_count = 0; | 162 int err_count = 0; |
163 *eob_ptr = rnd.Rand16(); | 163 *eob_ptr = rnd.Rand16(); |
(...skipping 27 matching lines...) Expand all Loading... |
191 } | 191 } |
192 err_count_total += err_count; | 192 err_count_total += err_count; |
193 } | 193 } |
194 EXPECT_EQ(0, err_count_total) | 194 EXPECT_EQ(0, err_count_total) |
195 << "Error: Quantization Test, C output doesn't match SSE2 output. " | 195 << "Error: Quantization Test, C output doesn't match SSE2 output. " |
196 << "First failed at test case " << first_failure; | 196 << "First failed at test case " << first_failure; |
197 } | 197 } |
198 | 198 |
199 TEST_P(VP9QuantizeTest, EOBCheck) { | 199 TEST_P(VP9QuantizeTest, EOBCheck) { |
200 ACMRandom rnd(ACMRandom::DeterministicSeed()); | 200 ACMRandom rnd(ACMRandom::DeterministicSeed()); |
201 DECLARE_ALIGNED_ARRAY(16, tran_low_t, coeff_ptr, 256); | 201 DECLARE_ALIGNED(16, tran_low_t, coeff_ptr[256]); |
202 DECLARE_ALIGNED_ARRAY(16, int16_t, zbin_ptr, 2); | 202 DECLARE_ALIGNED(16, int16_t, zbin_ptr[2]); |
203 DECLARE_ALIGNED_ARRAY(16, int16_t, round_ptr, 2); | 203 DECLARE_ALIGNED(16, int16_t, round_ptr[2]); |
204 DECLARE_ALIGNED_ARRAY(16, int16_t, quant_ptr, 2); | 204 DECLARE_ALIGNED(16, int16_t, quant_ptr[2]); |
205 DECLARE_ALIGNED_ARRAY(16, int16_t, quant_shift_ptr, 2); | 205 DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[2]); |
206 DECLARE_ALIGNED_ARRAY(16, tran_low_t, qcoeff_ptr, 256); | 206 DECLARE_ALIGNED(16, tran_low_t, qcoeff_ptr[256]); |
207 DECLARE_ALIGNED_ARRAY(16, tran_low_t, dqcoeff_ptr, 256); | 207 DECLARE_ALIGNED(16, tran_low_t, dqcoeff_ptr[256]); |
208 DECLARE_ALIGNED_ARRAY(16, tran_low_t, ref_qcoeff_ptr, 256); | 208 DECLARE_ALIGNED(16, tran_low_t, ref_qcoeff_ptr[256]); |
209 DECLARE_ALIGNED_ARRAY(16, tran_low_t, ref_dqcoeff_ptr, 256); | 209 DECLARE_ALIGNED(16, tran_low_t, ref_dqcoeff_ptr[256]); |
210 DECLARE_ALIGNED_ARRAY(16, int16_t, dequant_ptr, 2); | 210 DECLARE_ALIGNED(16, int16_t, dequant_ptr[2]); |
211 DECLARE_ALIGNED_ARRAY(16, uint16_t, eob_ptr, 1); | 211 DECLARE_ALIGNED(16, uint16_t, eob_ptr[1]); |
212 DECLARE_ALIGNED_ARRAY(16, uint16_t, ref_eob_ptr, 1); | 212 DECLARE_ALIGNED(16, uint16_t, ref_eob_ptr[1]); |
213 int err_count_total = 0; | 213 int err_count_total = 0; |
214 int first_failure = -1; | 214 int first_failure = -1; |
215 for (int i = 0; i < number_of_iterations; ++i) { | 215 for (int i = 0; i < number_of_iterations; ++i) { |
216 int skip_block = i == 0; | 216 int skip_block = i == 0; |
217 TX_SIZE sz = (TX_SIZE)(i % 3); // TX_4X4, TX_8X8 TX_16X16 | 217 TX_SIZE sz = (TX_SIZE)(i % 3); // TX_4X4, TX_8X8 TX_16X16 |
218 TX_TYPE tx_type = (TX_TYPE)((i >> 2) % 3); | 218 TX_TYPE tx_type = (TX_TYPE)((i >> 2) % 3); |
219 const scan_order *scan_order = &vp9_scan_orders[sz][tx_type]; | 219 const scan_order *scan_order = &vp9_scan_orders[sz][tx_type]; |
220 int count = (4 << sz) * (4 << sz); // 16, 64, 256 | 220 int count = (4 << sz) * (4 << sz); // 16, 64, 256 |
221 int err_count = 0; | 221 int err_count = 0; |
222 *eob_ptr = rnd.Rand16(); | 222 *eob_ptr = rnd.Rand16(); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 } | 255 } |
256 err_count_total += err_count; | 256 err_count_total += err_count; |
257 } | 257 } |
258 EXPECT_EQ(0, err_count_total) | 258 EXPECT_EQ(0, err_count_total) |
259 << "Error: Quantization Test, C output doesn't match SSE2 output. " | 259 << "Error: Quantization Test, C output doesn't match SSE2 output. " |
260 << "First failed at test case " << first_failure; | 260 << "First failed at test case " << first_failure; |
261 } | 261 } |
262 | 262 |
263 TEST_P(VP9Quantize32Test, EOBCheck) { | 263 TEST_P(VP9Quantize32Test, EOBCheck) { |
264 ACMRandom rnd(ACMRandom::DeterministicSeed()); | 264 ACMRandom rnd(ACMRandom::DeterministicSeed()); |
265 DECLARE_ALIGNED_ARRAY(16, tran_low_t, coeff_ptr, 1024); | 265 DECLARE_ALIGNED(16, tran_low_t, coeff_ptr[1024]); |
266 DECLARE_ALIGNED_ARRAY(16, int16_t, zbin_ptr, 2); | 266 DECLARE_ALIGNED(16, int16_t, zbin_ptr[2]); |
267 DECLARE_ALIGNED_ARRAY(16, int16_t, round_ptr, 2); | 267 DECLARE_ALIGNED(16, int16_t, round_ptr[2]); |
268 DECLARE_ALIGNED_ARRAY(16, int16_t, quant_ptr, 2); | 268 DECLARE_ALIGNED(16, int16_t, quant_ptr[2]); |
269 DECLARE_ALIGNED_ARRAY(16, int16_t, quant_shift_ptr, 2); | 269 DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[2]); |
270 DECLARE_ALIGNED_ARRAY(16, tran_low_t, qcoeff_ptr, 1024); | 270 DECLARE_ALIGNED(16, tran_low_t, qcoeff_ptr[1024]); |
271 DECLARE_ALIGNED_ARRAY(16, tran_low_t, dqcoeff_ptr, 1024); | 271 DECLARE_ALIGNED(16, tran_low_t, dqcoeff_ptr[1024]); |
272 DECLARE_ALIGNED_ARRAY(16, tran_low_t, ref_qcoeff_ptr, 1024); | 272 DECLARE_ALIGNED(16, tran_low_t, ref_qcoeff_ptr[1024]); |
273 DECLARE_ALIGNED_ARRAY(16, tran_low_t, ref_dqcoeff_ptr, 1024); | 273 DECLARE_ALIGNED(16, tran_low_t, ref_dqcoeff_ptr[1024]); |
274 DECLARE_ALIGNED_ARRAY(16, int16_t, dequant_ptr, 2); | 274 DECLARE_ALIGNED(16, int16_t, dequant_ptr[2]); |
275 DECLARE_ALIGNED_ARRAY(16, uint16_t, eob_ptr, 1); | 275 DECLARE_ALIGNED(16, uint16_t, eob_ptr[1]); |
276 DECLARE_ALIGNED_ARRAY(16, uint16_t, ref_eob_ptr, 1); | 276 DECLARE_ALIGNED(16, uint16_t, ref_eob_ptr[1]); |
277 int err_count_total = 0; | 277 int err_count_total = 0; |
278 int first_failure = -1; | 278 int first_failure = -1; |
279 for (int i = 0; i < number_of_iterations; ++i) { | 279 for (int i = 0; i < number_of_iterations; ++i) { |
280 int skip_block = i == 0; | 280 int skip_block = i == 0; |
281 TX_SIZE sz = TX_32X32; | 281 TX_SIZE sz = TX_32X32; |
282 TX_TYPE tx_type = (TX_TYPE)(i % 4); | 282 TX_TYPE tx_type = (TX_TYPE)(i % 4); |
283 const scan_order *scan_order = &vp9_scan_orders[sz][tx_type]; | 283 const scan_order *scan_order = &vp9_scan_orders[sz][tx_type]; |
284 int count = (4 << sz) * (4 << sz); // 1024 | 284 int count = (4 << sz) * (4 << sz); // 1024 |
285 int err_count = 0; | 285 int err_count = 0; |
286 *eob_ptr = rnd.Rand16(); | 286 *eob_ptr = rnd.Rand16(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 ::testing::Values( | 340 ::testing::Values( |
341 make_tuple(&vp9_highbd_quantize_b_32x32_sse2, | 341 make_tuple(&vp9_highbd_quantize_b_32x32_sse2, |
342 &vp9_highbd_quantize_b_32x32_c, VPX_BITS_8), | 342 &vp9_highbd_quantize_b_32x32_c, VPX_BITS_8), |
343 make_tuple(&vp9_highbd_quantize_b_32x32_sse2, | 343 make_tuple(&vp9_highbd_quantize_b_32x32_sse2, |
344 &vp9_highbd_quantize_b_32x32_c, VPX_BITS_10), | 344 &vp9_highbd_quantize_b_32x32_c, VPX_BITS_10), |
345 make_tuple(&vp9_highbd_quantize_b_32x32_sse2, | 345 make_tuple(&vp9_highbd_quantize_b_32x32_sse2, |
346 &vp9_highbd_quantize_b_32x32_c, VPX_BITS_12))); | 346 &vp9_highbd_quantize_b_32x32_c, VPX_BITS_12))); |
347 #endif // HAVE_SSE2 | 347 #endif // HAVE_SSE2 |
348 #endif // CONFIG_VP9_HIGHBITDEPTH | 348 #endif // CONFIG_VP9_HIGHBITDEPTH |
349 } // namespace | 349 } // namespace |
OLD | NEW |