OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 |
11 #include <math.h> | 11 #include <math.h> |
12 #include <stdlib.h> | 12 #include <stdlib.h> |
13 #include <string.h> | 13 #include <string.h> |
14 #include "test/acm_random.h" | 14 #include "test/acm_random.h" |
15 #include "test/clear_system_state.h" | 15 #include "test/clear_system_state.h" |
16 #include "test/register_state_check.h" | 16 #include "test/register_state_check.h" |
17 #include "test/util.h" | 17 #include "test/util.h" |
18 #include "third_party/googletest/src/include/gtest/gtest.h" | 18 #include "third_party/googletest/src/include/gtest/gtest.h" |
19 #include "./vpx_config.h" | 19 #include "./vpx_config.h" |
20 #include "./vp8_rtcd.h" | 20 #include "./vp8_rtcd.h" |
21 #include "vpx/vpx_integer.h" | 21 #include "vpx/vpx_integer.h" |
22 #include "vpx_mem/vpx_mem.h" | 22 #include "vpx_mem/vpx_mem.h" |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 typedef void (*sixtap_predict_fn_t)(uint8_t *src_ptr, | 26 typedef void (*SixtapPredictFunc)(uint8_t *src_ptr, |
27 int src_pixels_per_line, | 27 int src_pixels_per_line, |
28 int xoffset, | 28 int xoffset, |
29 int yoffset, | 29 int yoffset, |
30 uint8_t *dst_ptr, | 30 uint8_t *dst_ptr, |
31 int dst_pitch); | 31 int dst_pitch); |
32 | 32 |
33 typedef std::tr1::tuple<int, int, sixtap_predict_fn_t> sixtap_predict_param_t; | 33 typedef std::tr1::tuple<int, int, SixtapPredictFunc> SixtapPredictParam; |
34 | 34 |
35 class SixtapPredictTest | 35 class SixtapPredictTest |
36 : public ::testing::TestWithParam<sixtap_predict_param_t> { | 36 : public ::testing::TestWithParam<SixtapPredictParam> { |
37 public: | 37 public: |
38 static void SetUpTestCase() { | 38 static void SetUpTestCase() { |
39 src_ = reinterpret_cast<uint8_t*>(vpx_memalign(kDataAlignment, kSrcSize)); | 39 src_ = reinterpret_cast<uint8_t*>(vpx_memalign(kDataAlignment, kSrcSize)); |
40 dst_ = reinterpret_cast<uint8_t*>(vpx_memalign(kDataAlignment, kDstSize)); | 40 dst_ = reinterpret_cast<uint8_t*>(vpx_memalign(kDataAlignment, kDstSize)); |
41 dst_c_ = reinterpret_cast<uint8_t*>(vpx_memalign(kDataAlignment, kDstSize)); | 41 dst_c_ = reinterpret_cast<uint8_t*>(vpx_memalign(kDataAlignment, kDstSize)); |
42 } | 42 } |
43 | 43 |
44 static void TearDownTestCase() { | 44 static void TearDownTestCase() { |
45 vpx_free(src_); | 45 vpx_free(src_); |
46 src_ = NULL; | 46 src_ = NULL; |
(...skipping 20 matching lines...) Expand all Loading... |
67 width_ = GET_PARAM(0); | 67 width_ = GET_PARAM(0); |
68 height_ = GET_PARAM(1); | 68 height_ = GET_PARAM(1); |
69 sixtap_predict_ = GET_PARAM(2); | 69 sixtap_predict_ = GET_PARAM(2); |
70 memset(src_, 0, kSrcSize); | 70 memset(src_, 0, kSrcSize); |
71 memset(dst_, 0, kDstSize); | 71 memset(dst_, 0, kDstSize); |
72 memset(dst_c_, 0, kDstSize); | 72 memset(dst_c_, 0, kDstSize); |
73 } | 73 } |
74 | 74 |
75 int width_; | 75 int width_; |
76 int height_; | 76 int height_; |
77 sixtap_predict_fn_t sixtap_predict_; | 77 SixtapPredictFunc sixtap_predict_; |
78 // The src stores the macroblock we will filter on, and makes it 1 byte larger | 78 // The src stores the macroblock we will filter on, and makes it 1 byte larger |
79 // in order to test unaligned access. The result is stored in dst and dst_c(c | 79 // in order to test unaligned access. The result is stored in dst and dst_c(c |
80 // reference code result). | 80 // reference code result). |
81 static uint8_t* src_; | 81 static uint8_t* src_; |
82 static uint8_t* dst_; | 82 static uint8_t* dst_; |
83 static uint8_t* dst_c_; | 83 static uint8_t* dst_c_; |
84 }; | 84 }; |
85 | 85 |
86 uint8_t* SixtapPredictTest::src_ = NULL; | 86 uint8_t* SixtapPredictTest::src_ = NULL; |
87 uint8_t* SixtapPredictTest::dst_ = NULL; | 87 uint8_t* SixtapPredictTest::dst_ = NULL; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 for (int i = 0; i < height_; ++i) | 177 for (int i = 0; i < height_; ++i) |
178 for (int j = 0; j < width_; ++j) | 178 for (int j = 0; j < width_; ++j) |
179 ASSERT_EQ(dst_c_[i * kDstStride + j], dst_[i * kDstStride + j]) | 179 ASSERT_EQ(dst_c_[i * kDstStride + j], dst_[i * kDstStride + j]) |
180 << "i==" << (i * width_ + j); | 180 << "i==" << (i * width_ + j); |
181 } | 181 } |
182 } | 182 } |
183 } | 183 } |
184 | 184 |
185 using std::tr1::make_tuple; | 185 using std::tr1::make_tuple; |
186 | 186 |
187 const sixtap_predict_fn_t sixtap_16x16_c = vp8_sixtap_predict16x16_c; | 187 const SixtapPredictFunc sixtap_16x16_c = vp8_sixtap_predict16x16_c; |
188 const sixtap_predict_fn_t sixtap_8x8_c = vp8_sixtap_predict8x8_c; | 188 const SixtapPredictFunc sixtap_8x8_c = vp8_sixtap_predict8x8_c; |
189 const sixtap_predict_fn_t sixtap_8x4_c = vp8_sixtap_predict8x4_c; | 189 const SixtapPredictFunc sixtap_8x4_c = vp8_sixtap_predict8x4_c; |
190 const sixtap_predict_fn_t sixtap_4x4_c = vp8_sixtap_predict4x4_c; | 190 const SixtapPredictFunc sixtap_4x4_c = vp8_sixtap_predict4x4_c; |
191 INSTANTIATE_TEST_CASE_P( | 191 INSTANTIATE_TEST_CASE_P( |
192 C, SixtapPredictTest, ::testing::Values( | 192 C, SixtapPredictTest, ::testing::Values( |
193 make_tuple(16, 16, sixtap_16x16_c), | 193 make_tuple(16, 16, sixtap_16x16_c), |
194 make_tuple(8, 8, sixtap_8x8_c), | 194 make_tuple(8, 8, sixtap_8x8_c), |
195 make_tuple(8, 4, sixtap_8x4_c), | 195 make_tuple(8, 4, sixtap_8x4_c), |
196 make_tuple(4, 4, sixtap_4x4_c))); | 196 make_tuple(4, 4, sixtap_4x4_c))); |
197 #if HAVE_NEON | 197 #if HAVE_NEON |
198 const sixtap_predict_fn_t sixtap_16x16_neon = vp8_sixtap_predict16x16_neon; | 198 const SixtapPredictFunc sixtap_16x16_neon = vp8_sixtap_predict16x16_neon; |
199 const sixtap_predict_fn_t sixtap_8x8_neon = vp8_sixtap_predict8x8_neon; | 199 const SixtapPredictFunc sixtap_8x8_neon = vp8_sixtap_predict8x8_neon; |
200 const sixtap_predict_fn_t sixtap_8x4_neon = vp8_sixtap_predict8x4_neon; | 200 const SixtapPredictFunc sixtap_8x4_neon = vp8_sixtap_predict8x4_neon; |
201 INSTANTIATE_TEST_CASE_P( | 201 INSTANTIATE_TEST_CASE_P( |
202 DISABLED_NEON, SixtapPredictTest, ::testing::Values( | 202 DISABLED_NEON, SixtapPredictTest, ::testing::Values( |
203 make_tuple(16, 16, sixtap_16x16_neon), | 203 make_tuple(16, 16, sixtap_16x16_neon), |
204 make_tuple(8, 8, sixtap_8x8_neon), | 204 make_tuple(8, 8, sixtap_8x8_neon), |
205 make_tuple(8, 4, sixtap_8x4_neon))); | 205 make_tuple(8, 4, sixtap_8x4_neon))); |
206 #endif | 206 #endif |
207 #if HAVE_MMX | 207 #if HAVE_MMX |
208 const sixtap_predict_fn_t sixtap_16x16_mmx = vp8_sixtap_predict16x16_mmx; | 208 const SixtapPredictFunc sixtap_16x16_mmx = vp8_sixtap_predict16x16_mmx; |
209 const sixtap_predict_fn_t sixtap_8x8_mmx = vp8_sixtap_predict8x8_mmx; | 209 const SixtapPredictFunc sixtap_8x8_mmx = vp8_sixtap_predict8x8_mmx; |
210 const sixtap_predict_fn_t sixtap_8x4_mmx = vp8_sixtap_predict8x4_mmx; | 210 const SixtapPredictFunc sixtap_8x4_mmx = vp8_sixtap_predict8x4_mmx; |
211 const sixtap_predict_fn_t sixtap_4x4_mmx = vp8_sixtap_predict4x4_mmx; | 211 const SixtapPredictFunc sixtap_4x4_mmx = vp8_sixtap_predict4x4_mmx; |
212 INSTANTIATE_TEST_CASE_P( | 212 INSTANTIATE_TEST_CASE_P( |
213 MMX, SixtapPredictTest, ::testing::Values( | 213 MMX, SixtapPredictTest, ::testing::Values( |
214 make_tuple(16, 16, sixtap_16x16_mmx), | 214 make_tuple(16, 16, sixtap_16x16_mmx), |
215 make_tuple(8, 8, sixtap_8x8_mmx), | 215 make_tuple(8, 8, sixtap_8x8_mmx), |
216 make_tuple(8, 4, sixtap_8x4_mmx), | 216 make_tuple(8, 4, sixtap_8x4_mmx), |
217 make_tuple(4, 4, sixtap_4x4_mmx))); | 217 make_tuple(4, 4, sixtap_4x4_mmx))); |
218 #endif | 218 #endif |
219 #if HAVE_SSE2 | 219 #if HAVE_SSE2 |
220 const sixtap_predict_fn_t sixtap_16x16_sse2 = vp8_sixtap_predict16x16_sse2; | 220 const SixtapPredictFunc sixtap_16x16_sse2 = vp8_sixtap_predict16x16_sse2; |
221 const sixtap_predict_fn_t sixtap_8x8_sse2 = vp8_sixtap_predict8x8_sse2; | 221 const SixtapPredictFunc sixtap_8x8_sse2 = vp8_sixtap_predict8x8_sse2; |
222 const sixtap_predict_fn_t sixtap_8x4_sse2 = vp8_sixtap_predict8x4_sse2; | 222 const SixtapPredictFunc sixtap_8x4_sse2 = vp8_sixtap_predict8x4_sse2; |
223 INSTANTIATE_TEST_CASE_P( | 223 INSTANTIATE_TEST_CASE_P( |
224 SSE2, SixtapPredictTest, ::testing::Values( | 224 SSE2, SixtapPredictTest, ::testing::Values( |
225 make_tuple(16, 16, sixtap_16x16_sse2), | 225 make_tuple(16, 16, sixtap_16x16_sse2), |
226 make_tuple(8, 8, sixtap_8x8_sse2), | 226 make_tuple(8, 8, sixtap_8x8_sse2), |
227 make_tuple(8, 4, sixtap_8x4_sse2))); | 227 make_tuple(8, 4, sixtap_8x4_sse2))); |
228 #endif | 228 #endif |
229 #if HAVE_SSSE3 | 229 #if HAVE_SSSE3 |
230 const sixtap_predict_fn_t sixtap_16x16_ssse3 = vp8_sixtap_predict16x16_ssse3; | 230 const SixtapPredictFunc sixtap_16x16_ssse3 = vp8_sixtap_predict16x16_ssse3; |
231 const sixtap_predict_fn_t sixtap_8x8_ssse3 = vp8_sixtap_predict8x8_ssse3; | 231 const SixtapPredictFunc sixtap_8x8_ssse3 = vp8_sixtap_predict8x8_ssse3; |
232 const sixtap_predict_fn_t sixtap_8x4_ssse3 = vp8_sixtap_predict8x4_ssse3; | 232 const SixtapPredictFunc sixtap_8x4_ssse3 = vp8_sixtap_predict8x4_ssse3; |
233 const sixtap_predict_fn_t sixtap_4x4_ssse3 = vp8_sixtap_predict4x4_ssse3; | 233 const SixtapPredictFunc sixtap_4x4_ssse3 = vp8_sixtap_predict4x4_ssse3; |
234 INSTANTIATE_TEST_CASE_P( | 234 INSTANTIATE_TEST_CASE_P( |
235 SSSE3, SixtapPredictTest, ::testing::Values( | 235 SSSE3, SixtapPredictTest, ::testing::Values( |
236 make_tuple(16, 16, sixtap_16x16_ssse3), | 236 make_tuple(16, 16, sixtap_16x16_ssse3), |
237 make_tuple(8, 8, sixtap_8x8_ssse3), | 237 make_tuple(8, 8, sixtap_8x8_ssse3), |
238 make_tuple(8, 4, sixtap_8x4_ssse3), | 238 make_tuple(8, 4, sixtap_8x4_ssse3), |
239 make_tuple(4, 4, sixtap_4x4_ssse3))); | 239 make_tuple(4, 4, sixtap_4x4_ssse3))); |
240 #endif | 240 #endif |
241 } // namespace | 241 } // namespace |
OLD | NEW |