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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 double temp_in[32], temp_out[32]; | 64 double temp_in[32], temp_out[32]; |
65 for (int j = 0; j < 32; ++j) | 65 for (int j = 0; j < 32; ++j) |
66 temp_in[j] = output[j + i*32]; | 66 temp_in[j] = output[j + i*32]; |
67 reference_32x32_dct_1d(temp_in, temp_out, 1); | 67 reference_32x32_dct_1d(temp_in, temp_out, 1); |
68 // Scale by some magic number | 68 // Scale by some magic number |
69 for (int j = 0; j < 32; ++j) | 69 for (int j = 0; j < 32; ++j) |
70 output[j + i * 32] = temp_out[j] / 4; | 70 output[j + i * 32] = temp_out[j] / 4; |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 typedef void (*fwd_txfm_t)(const int16_t *in, int16_t *out, int stride); | 74 typedef void (*FwdTxfmFunc)(const int16_t *in, int16_t *out, int stride); |
75 typedef void (*inv_txfm_t)(const int16_t *in, uint8_t *out, int stride); | 75 typedef void (*InvTxfmFunc)(const int16_t *in, uint8_t *out, int stride); |
76 | 76 |
77 typedef std::tr1::tuple<fwd_txfm_t, inv_txfm_t, int> trans_32x32_param_t; | 77 typedef std::tr1::tuple<FwdTxfmFunc, InvTxfmFunc, int> Trans32x32Param; |
78 | 78 |
79 class Trans32x32Test : public ::testing::TestWithParam<trans_32x32_param_t> { | 79 class Trans32x32Test : public ::testing::TestWithParam<Trans32x32Param> { |
80 public: | 80 public: |
81 virtual ~Trans32x32Test() {} | 81 virtual ~Trans32x32Test() {} |
82 virtual void SetUp() { | 82 virtual void SetUp() { |
83 fwd_txfm_ = GET_PARAM(0); | 83 fwd_txfm_ = GET_PARAM(0); |
84 inv_txfm_ = GET_PARAM(1); | 84 inv_txfm_ = GET_PARAM(1); |
85 version_ = GET_PARAM(2); // 0: high precision forward transform | 85 version_ = GET_PARAM(2); // 0: high precision forward transform |
86 // 1: low precision version for rd loop | 86 // 1: low precision version for rd loop |
87 } | 87 } |
88 | 88 |
89 virtual void TearDown() { libvpx_test::ClearSystemState(); } | 89 virtual void TearDown() { libvpx_test::ClearSystemState(); } |
90 | 90 |
91 protected: | 91 protected: |
92 int version_; | 92 int version_; |
93 fwd_txfm_t fwd_txfm_; | 93 FwdTxfmFunc fwd_txfm_; |
94 inv_txfm_t inv_txfm_; | 94 InvTxfmFunc inv_txfm_; |
95 }; | 95 }; |
96 | 96 |
97 TEST_P(Trans32x32Test, AccuracyCheck) { | 97 TEST_P(Trans32x32Test, AccuracyCheck) { |
98 ACMRandom rnd(ACMRandom::DeterministicSeed()); | 98 ACMRandom rnd(ACMRandom::DeterministicSeed()); |
99 uint32_t max_error = 0; | 99 uint32_t max_error = 0; |
100 int64_t total_error = 0; | 100 int64_t total_error = 0; |
101 const int count_test_block = 1000; | 101 const int count_test_block = 1000; |
102 DECLARE_ALIGNED_ARRAY(16, int16_t, test_input_block, kNumCoeffs); | 102 DECLARE_ALIGNED_ARRAY(16, int16_t, test_input_block, kNumCoeffs); |
103 DECLARE_ALIGNED_ARRAY(16, int16_t, test_temp_block, kNumCoeffs); | 103 DECLARE_ALIGNED_ARRAY(16, int16_t, test_temp_block, kNumCoeffs); |
104 DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, kNumCoeffs); | 104 DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, kNumCoeffs); |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 #if HAVE_AVX2 | 273 #if HAVE_AVX2 |
274 INSTANTIATE_TEST_CASE_P( | 274 INSTANTIATE_TEST_CASE_P( |
275 AVX2, Trans32x32Test, | 275 AVX2, Trans32x32Test, |
276 ::testing::Values( | 276 ::testing::Values( |
277 make_tuple(&vp9_fdct32x32_avx2, | 277 make_tuple(&vp9_fdct32x32_avx2, |
278 &vp9_idct32x32_1024_add_sse2, 0), | 278 &vp9_idct32x32_1024_add_sse2, 0), |
279 make_tuple(&vp9_fdct32x32_rd_avx2, | 279 make_tuple(&vp9_fdct32x32_rd_avx2, |
280 &vp9_idct32x32_1024_add_sse2, 1))); | 280 &vp9_idct32x32_1024_add_sse2, 1))); |
281 #endif | 281 #endif |
282 } // namespace | 282 } // namespace |
OLD | NEW |