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 |
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/register_state_check.h" |
15 #include "test/util.h" | 16 #include "test/util.h" |
16 #include "third_party/googletest/src/include/gtest/gtest.h" | 17 #include "third_party/googletest/src/include/gtest/gtest.h" |
17 extern "C" { | 18 extern "C" { |
18 #include "./vpx_config.h" | 19 #include "./vpx_config.h" |
19 #include "./vp8_rtcd.h" | 20 #include "./vp8_rtcd.h" |
20 #include "vpx/vpx_integer.h" | 21 #include "vpx/vpx_integer.h" |
21 #include "vpx_mem/vpx_mem.h" | 22 #include "vpx_mem/vpx_mem.h" |
22 } | 23 } |
23 | 24 |
24 namespace { | 25 namespace { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 161, 81, 106, 72, 135, 222, 234, 137, 66, 137, 106, 243, 210, 147, 95, | 130 161, 81, 106, 72, 135, 222, 234, 137, 66, 137, 106, 243, 210, 147, 95, |
130 15, 137, 110, 85, 66, 16, 96, 167, 147, 150, 173, 203, 140, 118, 196, | 131 15, 137, 110, 85, 66, 16, 96, 167, 147, 150, 173, 203, 140, 118, 196, |
131 84, 147, 160, 19, 95, 101, 123, 74, 132, 202, 82, 166, 12, 131, 166, | 132 84, 147, 160, 19, 95, 101, 123, 74, 132, 202, 82, 166, 12, 131, 166, |
132 189, 170, 159, 85, 79, 66, 57, 152, 132, 203, 194, 0, 1, 56, 146, 180, | 133 189, 170, 159, 85, 79, 66, 57, 152, 132, 203, 194, 0, 1, 56, 146, 180, |
133 224, 156, 28, 83, 181, 79, 76, 80, 46, 160, 175, 59, 106, 43, 87, 75, | 134 224, 156, 28, 83, 181, 79, 76, 80, 46, 160, 175, 59, 106, 43, 87, 75, |
134 136, 85, 189, 46, 71, 200, 90 | 135 136, 85, 189, 46, 71, 200, 90 |
135 }; | 136 }; |
136 | 137 |
137 uint8_t *src = const_cast<uint8_t*>(test_data); | 138 uint8_t *src = const_cast<uint8_t*>(test_data); |
138 | 139 |
139 sixtap_predict_(&src[kSrcStride * 2 + 2 + 1], kSrcStride, | 140 REGISTER_STATE_CHECK(sixtap_predict_(&src[kSrcStride * 2 + 2 + 1], kSrcStride, |
140 2, 2, dst_, kDstStride); | 141 2, 2, dst_, kDstStride)); |
141 | 142 |
142 for (int i = 0; i < height_; ++i) | 143 for (int i = 0; i < height_; ++i) |
143 for (int j = 0; j < width_; ++j) | 144 for (int j = 0; j < width_; ++j) |
144 ASSERT_EQ(expected_dst[i * kDstStride + j], dst_[i * kDstStride + j]) | 145 ASSERT_EQ(expected_dst[i * kDstStride + j], dst_[i * kDstStride + j]) |
145 << "i==" << (i * width_ + j); | 146 << "i==" << (i * width_ + j); |
146 } | 147 } |
147 | 148 |
148 using libvpx_test::ACMRandom; | 149 using libvpx_test::ACMRandom; |
149 | 150 |
150 TEST_P(SixtapPredictTest, TestWithRandomData) { | 151 TEST_P(SixtapPredictTest, TestWithRandomData) { |
151 ACMRandom rnd(ACMRandom::DeterministicSeed()); | 152 ACMRandom rnd(ACMRandom::DeterministicSeed()); |
152 for (int i = 0; i < kSrcSize; ++i) | 153 for (int i = 0; i < kSrcSize; ++i) |
153 src_[i] = rnd.Rand8(); | 154 src_[i] = rnd.Rand8(); |
154 | 155 |
155 // Run tests for all possible offsets. | 156 // Run tests for all possible offsets. |
156 for (int xoffset = 0; xoffset < 8; ++xoffset) { | 157 for (int xoffset = 0; xoffset < 8; ++xoffset) { |
157 for (int yoffset = 0; yoffset < 8; ++yoffset) { | 158 for (int yoffset = 0; yoffset < 8; ++yoffset) { |
158 // Call c reference function. | 159 // Call c reference function. |
159 // Move start point to next pixel to test if the function reads | 160 // Move start point to next pixel to test if the function reads |
160 // unaligned data correctly. | 161 // unaligned data correctly. |
161 vp8_sixtap_predict16x16_c(&src_[kSrcStride * 2 + 2 + 1], kSrcStride, | 162 vp8_sixtap_predict16x16_c(&src_[kSrcStride * 2 + 2 + 1], kSrcStride, |
162 xoffset, yoffset, dst_c_, kDstStride); | 163 xoffset, yoffset, dst_c_, kDstStride); |
163 | 164 |
164 // Run test. | 165 // Run test. |
165 sixtap_predict_(&src_[kSrcStride * 2 + 2 + 1], kSrcStride, | 166 REGISTER_STATE_CHECK( |
166 xoffset, yoffset, dst_, kDstStride); | 167 sixtap_predict_(&src_[kSrcStride * 2 + 2 + 1], kSrcStride, |
| 168 xoffset, yoffset, dst_, kDstStride)); |
167 | 169 |
168 for (int i = 0; i < height_; ++i) | 170 for (int i = 0; i < height_; ++i) |
169 for (int j = 0; j < width_; ++j) | 171 for (int j = 0; j < width_; ++j) |
170 ASSERT_EQ(dst_c_[i * kDstStride + j], dst_[i * kDstStride + j]) | 172 ASSERT_EQ(dst_c_[i * kDstStride + j], dst_[i * kDstStride + j]) |
171 << "i==" << (i * width_ + j); | 173 << "i==" << (i * width_ + j); |
172 } | 174 } |
173 } | 175 } |
174 } | 176 } |
175 | 177 |
176 using std::tr1::make_tuple; | 178 using std::tr1::make_tuple; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 const sixtap_predict_fn_t sixtap_8x4_ssse3 = vp8_sixtap_predict8x4_ssse3; | 215 const sixtap_predict_fn_t sixtap_8x4_ssse3 = vp8_sixtap_predict8x4_ssse3; |
214 const sixtap_predict_fn_t sixtap_4x4_ssse3 = vp8_sixtap_predict4x4_ssse3; | 216 const sixtap_predict_fn_t sixtap_4x4_ssse3 = vp8_sixtap_predict4x4_ssse3; |
215 INSTANTIATE_TEST_CASE_P( | 217 INSTANTIATE_TEST_CASE_P( |
216 SSSE3, SixtapPredictTest, ::testing::Values( | 218 SSSE3, SixtapPredictTest, ::testing::Values( |
217 make_tuple(16, 16, sixtap_16x16_ssse3), | 219 make_tuple(16, 16, sixtap_16x16_ssse3), |
218 make_tuple(8, 8, sixtap_8x8_ssse3), | 220 make_tuple(8, 8, sixtap_8x8_ssse3), |
219 make_tuple(8, 4, sixtap_8x4_ssse3), | 221 make_tuple(8, 4, sixtap_8x4_ssse3), |
220 make_tuple(4, 4, sixtap_4x4_ssse3))); | 222 make_tuple(4, 4, sixtap_4x4_ssse3))); |
221 #endif | 223 #endif |
222 } // namespace | 224 } // namespace |
OLD | NEW |