OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 DECLARE_ALIGNED_ARRAY(16, int16_t, input_extreme_block, kNumCoeffs); | 129 DECLARE_ALIGNED_ARRAY(16, int16_t, input_extreme_block, kNumCoeffs); |
130 DECLARE_ALIGNED_ARRAY(16, int16_t, output_ref_block, kNumCoeffs); | 130 DECLARE_ALIGNED_ARRAY(16, int16_t, output_ref_block, kNumCoeffs); |
131 DECLARE_ALIGNED_ARRAY(16, int16_t, output_block, kNumCoeffs); | 131 DECLARE_ALIGNED_ARRAY(16, int16_t, output_block, kNumCoeffs); |
132 | 132 |
133 for (int i = 0; i < count_test_block; ++i) { | 133 for (int i = 0; i < count_test_block; ++i) { |
134 // Initialize a test block with input range [-255, 255]. | 134 // Initialize a test block with input range [-255, 255]. |
135 for (int j = 0; j < kNumCoeffs; ++j) { | 135 for (int j = 0; j < kNumCoeffs; ++j) { |
136 input_block[j] = rnd.Rand8() - rnd.Rand8(); | 136 input_block[j] = rnd.Rand8() - rnd.Rand8(); |
137 input_extreme_block[j] = rnd.Rand8() % 2 ? 255 : -255; | 137 input_extreme_block[j] = rnd.Rand8() % 2 ? 255 : -255; |
138 } | 138 } |
139 if (i == 0) | 139 if (i == 0) { |
140 for (int j = 0; j < kNumCoeffs; ++j) | 140 for (int j = 0; j < kNumCoeffs; ++j) |
141 input_extreme_block[j] = 255; | 141 input_extreme_block[j] = 255; |
142 if (i == 1) | 142 } else if (i == 1) { |
143 for (int j = 0; j < kNumCoeffs; ++j) | 143 for (int j = 0; j < kNumCoeffs; ++j) |
144 input_extreme_block[j] = -255; | 144 input_extreme_block[j] = -255; |
| 145 } |
145 | 146 |
146 fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_); | 147 fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_); |
147 REGISTER_STATE_CHECK(RunFwdTxfm(input_extreme_block, | 148 REGISTER_STATE_CHECK(RunFwdTxfm(input_extreme_block, |
148 output_block, pitch_)); | 149 output_block, pitch_)); |
149 | 150 |
150 // The minimum quant value is 4. | 151 // The minimum quant value is 4. |
151 for (int j = 0; j < kNumCoeffs; ++j) { | 152 for (int j = 0; j < kNumCoeffs; ++j) { |
152 EXPECT_EQ(output_block[j], output_ref_block[j]); | 153 EXPECT_EQ(output_block[j], output_ref_block[j]); |
153 EXPECT_GE(4 * DCT_MAX_VALUE, abs(output_block[j])) | 154 EXPECT_GE(4 * DCT_MAX_VALUE, abs(output_block[j])) |
154 << "Error: 16x16 FDCT has coefficient larger than 4*DCT_MAX_VALUE"; | 155 << "Error: 16x16 FDCT has coefficient larger than 4*DCT_MAX_VALUE"; |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 &vp9_idct4x4_16_add_sse2, 0))); | 369 &vp9_idct4x4_16_add_sse2, 0))); |
369 INSTANTIATE_TEST_CASE_P( | 370 INSTANTIATE_TEST_CASE_P( |
370 SSE2, Trans4x4HT, | 371 SSE2, Trans4x4HT, |
371 ::testing::Values( | 372 ::testing::Values( |
372 make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 0), | 373 make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 0), |
373 make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 1), | 374 make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 1), |
374 make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 2), | 375 make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 2), |
375 make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 3))); | 376 make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 3))); |
376 #endif | 377 #endif |
377 | 378 |
| 379 #if HAVE_AVX2 |
| 380 INSTANTIATE_TEST_CASE_P( |
| 381 AVX2, Trans4x4DCT, |
| 382 ::testing::Values( |
| 383 make_tuple(&vp9_fdct4x4_avx2, |
| 384 &vp9_idct4x4_16_add_c, 0))); |
| 385 INSTANTIATE_TEST_CASE_P( |
| 386 AVX2, Trans4x4HT, |
| 387 ::testing::Values( |
| 388 make_tuple(&vp9_fht4x4_avx2, &vp9_iht4x4_16_add_c, 0), |
| 389 make_tuple(&vp9_fht4x4_avx2, &vp9_iht4x4_16_add_c, 1), |
| 390 make_tuple(&vp9_fht4x4_avx2, &vp9_iht4x4_16_add_c, 2), |
| 391 make_tuple(&vp9_fht4x4_avx2, &vp9_iht4x4_16_add_c, 3))); |
| 392 #endif |
| 393 |
378 } // namespace | 394 } // namespace |
OLD | NEW |