Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Side by Side Diff: source/libvpx/test/variance_test.cc

Issue 390713002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: libvpx: Pull from upstream Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/test/twopass_encoder.sh ('k') | source/libvpx/test/vp8cx_set_ref.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <stdlib.h> 10 #include <stdlib.h>
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 }; 117 };
118 118
119 template<typename VarianceFunctionType> 119 template<typename VarianceFunctionType>
120 void VarianceTest<VarianceFunctionType>::ZeroTest() { 120 void VarianceTest<VarianceFunctionType>::ZeroTest() {
121 for (int i = 0; i <= 255; ++i) { 121 for (int i = 0; i <= 255; ++i) {
122 memset(src_, i, block_size_); 122 memset(src_, i, block_size_);
123 for (int j = 0; j <= 255; ++j) { 123 for (int j = 0; j <= 255; ++j) {
124 memset(ref_, j, block_size_); 124 memset(ref_, j, block_size_);
125 unsigned int sse; 125 unsigned int sse;
126 unsigned int var; 126 unsigned int var;
127 REGISTER_STATE_CHECK(var = variance_(src_, width_, ref_, width_, &sse)); 127 ASM_REGISTER_STATE_CHECK(
128 var = variance_(src_, width_, ref_, width_, &sse));
128 EXPECT_EQ(0u, var) << "src values: " << i << "ref values: " << j; 129 EXPECT_EQ(0u, var) << "src values: " << i << "ref values: " << j;
129 } 130 }
130 } 131 }
131 } 132 }
132 133
133 template<typename VarianceFunctionType> 134 template<typename VarianceFunctionType>
134 void VarianceTest<VarianceFunctionType>::RefTest() { 135 void VarianceTest<VarianceFunctionType>::RefTest() {
135 for (int i = 0; i < 10; ++i) { 136 for (int i = 0; i < 10; ++i) {
136 for (int j = 0; j < block_size_; j++) { 137 for (int j = 0; j < block_size_; j++) {
137 src_[j] = rnd.Rand8(); 138 src_[j] = rnd.Rand8();
138 ref_[j] = rnd.Rand8(); 139 ref_[j] = rnd.Rand8();
139 } 140 }
140 unsigned int sse1, sse2; 141 unsigned int sse1, sse2;
141 unsigned int var1; 142 unsigned int var1;
142 REGISTER_STATE_CHECK(var1 = variance_(src_, width_, ref_, width_, &sse1)); 143 ASM_REGISTER_STATE_CHECK(
144 var1 = variance_(src_, width_, ref_, width_, &sse1));
143 const unsigned int var2 = variance_ref(src_, ref_, log2width_, 145 const unsigned int var2 = variance_ref(src_, ref_, log2width_,
144 log2height_, &sse2); 146 log2height_, &sse2);
145 EXPECT_EQ(sse1, sse2); 147 EXPECT_EQ(sse1, sse2);
146 EXPECT_EQ(var1, var2); 148 EXPECT_EQ(var1, var2);
147 } 149 }
148 } 150 }
149 151
150 template<typename VarianceFunctionType> 152 template<typename VarianceFunctionType>
151 void VarianceTest<VarianceFunctionType>::OneQuarterTest() { 153 void VarianceTest<VarianceFunctionType>::OneQuarterTest() {
152 memset(src_, 255, block_size_); 154 memset(src_, 255, block_size_);
153 const int half = block_size_ / 2; 155 const int half = block_size_ / 2;
154 memset(ref_, 255, half); 156 memset(ref_, 255, half);
155 memset(ref_ + half, 0, half); 157 memset(ref_ + half, 0, half);
156 unsigned int sse; 158 unsigned int sse;
157 unsigned int var; 159 unsigned int var;
158 REGISTER_STATE_CHECK(var = variance_(src_, width_, ref_, width_, &sse)); 160 ASM_REGISTER_STATE_CHECK(var = variance_(src_, width_, ref_, width_, &sse));
159 const unsigned int expected = block_size_ * 255 * 255 / 4; 161 const unsigned int expected = block_size_ * 255 * 255 / 4;
160 EXPECT_EQ(expected, var); 162 EXPECT_EQ(expected, var);
161 } 163 }
162 164
163 #if CONFIG_VP9_ENCODER 165 #if CONFIG_VP9_ENCODER
164 166
165 unsigned int subpel_avg_variance_ref(const uint8_t *ref, 167 unsigned int subpel_avg_variance_ref(const uint8_t *ref,
166 const uint8_t *src, 168 const uint8_t *src,
167 const uint8_t *second_pred, 169 const uint8_t *second_pred,
168 int l2w, int l2h, 170 int l2w, int l2h,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 for (int x = 0; x < 16; ++x) { 241 for (int x = 0; x < 16; ++x) {
240 for (int y = 0; y < 16; ++y) { 242 for (int y = 0; y < 16; ++y) {
241 for (int j = 0; j < block_size_; j++) { 243 for (int j = 0; j < block_size_; j++) {
242 src_[j] = rnd.Rand8(); 244 src_[j] = rnd.Rand8();
243 } 245 }
244 for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) { 246 for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {
245 ref_[j] = rnd.Rand8(); 247 ref_[j] = rnd.Rand8();
246 } 248 }
247 unsigned int sse1, sse2; 249 unsigned int sse1, sse2;
248 unsigned int var1; 250 unsigned int var1;
249 REGISTER_STATE_CHECK(var1 = subpel_variance_(ref_, width_ + 1, x, y, 251 ASM_REGISTER_STATE_CHECK(var1 = subpel_variance_(ref_, width_ + 1, x, y,
250 src_, width_, &sse1)); 252 src_, width_, &sse1));
251 const unsigned int var2 = subpel_variance_ref(ref_, src_, log2width_, 253 const unsigned int var2 = subpel_variance_ref(ref_, src_, log2width_,
252 log2height_, x, y, &sse2); 254 log2height_, x, y, &sse2);
253 EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y; 255 EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y;
254 EXPECT_EQ(var1, var2) << "at position " << x << ", " << y; 256 EXPECT_EQ(var1, var2) << "at position " << x << ", " << y;
255 } 257 }
256 } 258 }
257 } 259 }
258 260
259 template<> 261 template<>
260 void SubpelVarianceTest<vp9_subp_avg_variance_fn_t>::RefTest() { 262 void SubpelVarianceTest<vp9_subp_avg_variance_fn_t>::RefTest() {
261 for (int x = 0; x < 16; ++x) { 263 for (int x = 0; x < 16; ++x) {
262 for (int y = 0; y < 16; ++y) { 264 for (int y = 0; y < 16; ++y) {
263 for (int j = 0; j < block_size_; j++) { 265 for (int j = 0; j < block_size_; j++) {
264 src_[j] = rnd.Rand8(); 266 src_[j] = rnd.Rand8();
265 sec_[j] = rnd.Rand8(); 267 sec_[j] = rnd.Rand8();
266 } 268 }
267 for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) { 269 for (int j = 0; j < block_size_ + width_ + height_ + 1; j++) {
268 ref_[j] = rnd.Rand8(); 270 ref_[j] = rnd.Rand8();
269 } 271 }
270 unsigned int sse1, sse2; 272 unsigned int sse1, sse2;
271 unsigned int var1; 273 unsigned int var1;
272 REGISTER_STATE_CHECK(var1 = subpel_variance_(ref_, width_ + 1, x, y, 274 ASM_REGISTER_STATE_CHECK(
273 src_, width_, &sse1, sec_)); 275 var1 = subpel_variance_(ref_, width_ + 1, x, y,
276 src_, width_, &sse1, sec_));
274 const unsigned int var2 = subpel_avg_variance_ref(ref_, src_, sec_, 277 const unsigned int var2 = subpel_avg_variance_ref(ref_, src_, sec_,
275 log2width_, log2height_, 278 log2width_, log2height_,
276 x, y, &sse2); 279 x, y, &sse2);
277 EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y; 280 EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y;
278 EXPECT_EQ(var1, var2) << "at position " << x << ", " << y; 281 EXPECT_EQ(var1, var2) << "at position " << x << ", " << y;
279 } 282 }
280 } 283 }
281 } 284 }
282 285
283 #endif // CONFIG_VP9_ENCODER 286 #endif // CONFIG_VP9_ENCODER
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 INSTANTIATE_TEST_CASE_P( 754 INSTANTIATE_TEST_CASE_P(
752 DISABLED_AVX2, VP9SubpelAvgVarianceTest, 755 DISABLED_AVX2, VP9SubpelAvgVarianceTest,
753 ::testing::Values(make_tuple(5, 5, subpel_avg_variance32x32_avx2), 756 ::testing::Values(make_tuple(5, 5, subpel_avg_variance32x32_avx2),
754 make_tuple(6, 6, subpel_avg_variance64x64_avx2))); 757 make_tuple(6, 6, subpel_avg_variance64x64_avx2)));
755 #endif // HAVE_AVX2 758 #endif // HAVE_AVX2
756 #endif // CONFIG_VP9_ENCODER 759 #endif // CONFIG_VP9_ENCODER
757 760
758 } // namespace vp9 761 } // namespace vp9
759 762
760 } // namespace 763 } // namespace
OLDNEW
« no previous file with comments | « source/libvpx/test/twopass_encoder.sh ('k') | source/libvpx/test/vp8cx_set_ref.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698