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

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

Issue 11974002: libvpx: Pull from upstream (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 7 years, 11 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/register_state_check.h ('k') | source/libvpx/test/sixtap_predict_test.cc » ('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 10
11 11
12 #include <string.h> 12 #include <string.h>
13 #include <limits.h> 13 #include <limits.h>
14 #include <stdio.h> 14 #include <stdio.h>
15 15
16 extern "C" { 16 extern "C" {
17 #include "./vpx_config.h" 17 #include "./vpx_config.h"
18 #include "./vp8_rtcd.h" 18 #include "./vp8_rtcd.h"
19 #include "vp8/common/blockd.h" 19 #include "vp8/common/blockd.h"
20 #include "vpx_mem/vpx_mem.h" 20 #include "vpx_mem/vpx_mem.h"
21 } 21 }
22 22
23 #include "test/acm_random.h" 23 #include "test/acm_random.h"
24 #include "test/register_state_check.h"
24 #include "test/util.h" 25 #include "test/util.h"
25 #include "third_party/googletest/src/include/gtest/gtest.h" 26 #include "third_party/googletest/src/include/gtest/gtest.h"
26 27
27 28
28 typedef unsigned int (*sad_m_by_n_fn_t)(const unsigned char *source_ptr, 29 typedef unsigned int (*sad_m_by_n_fn_t)(const unsigned char *source_ptr,
29 int source_stride, 30 int source_stride,
30 const unsigned char *reference_ptr, 31 const unsigned char *reference_ptr,
31 int reference_stride, 32 int reference_stride,
32 unsigned int max_sad); 33 unsigned int max_sad);
33 34
(...skipping 24 matching lines...) Expand all
58 sad_fn_ = GET_PARAM(2); 59 sad_fn_ = GET_PARAM(2);
59 height_ = GET_PARAM(1); 60 height_ = GET_PARAM(1);
60 width_ = GET_PARAM(0); 61 width_ = GET_PARAM(0);
61 source_stride_ = width_ * 2; 62 source_stride_ = width_ * 2;
62 reference_stride_ = width_ * 2; 63 reference_stride_ = width_ * 2;
63 rnd_.Reset(ACMRandom::DeterministicSeed()); 64 rnd_.Reset(ACMRandom::DeterministicSeed());
64 } 65 }
65 66
66 sad_m_by_n_fn_t sad_fn_; 67 sad_m_by_n_fn_t sad_fn_;
67 virtual unsigned int SAD(unsigned int max_sad) { 68 virtual unsigned int SAD(unsigned int max_sad) {
68 return sad_fn_(source_data_, source_stride_, 69 unsigned int ret;
69 reference_data_, reference_stride_, 70 REGISTER_STATE_CHECK(ret = sad_fn_(source_data_, source_stride_,
70 max_sad); 71 reference_data_, reference_stride_,
72 max_sad));
73 return ret;
71 } 74 }
72 75
73 // Sum of Absolute Differences. Given two blocks, calculate the absolute 76 // Sum of Absolute Differences. Given two blocks, calculate the absolute
74 // difference between two pixels in the same relative location; accumulate. 77 // difference between two pixels in the same relative location; accumulate.
75 unsigned int ReferenceSAD(unsigned int max_sad) { 78 unsigned int ReferenceSAD(unsigned int max_sad) {
76 unsigned int sad = 0; 79 unsigned int sad = 0;
77 80
78 for (int h = 0; h < height_; ++h) { 81 for (int h = 0; h < height_; ++h) {
79 for (int w = 0; w < width_; ++w) { 82 for (int w = 0; w < width_; ++w) {
80 sad += abs(source_data_[h * source_stride_ + w] 83 sad += abs(source_data_[h * source_stride_ + w]
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 make_tuple(8, 8, sad_8x8_wmt), 244 make_tuple(8, 8, sad_8x8_wmt),
242 make_tuple(4, 4, sad_4x4_wmt))); 245 make_tuple(4, 4, sad_4x4_wmt)));
243 #endif 246 #endif
244 #if HAVE_SSSE3 247 #if HAVE_SSSE3
245 const sad_m_by_n_fn_t sad_16x16_sse3 = vp8_sad16x16_sse3; 248 const sad_m_by_n_fn_t sad_16x16_sse3 = vp8_sad16x16_sse3;
246 INSTANTIATE_TEST_CASE_P(SSE3, SADTest, ::testing::Values( 249 INSTANTIATE_TEST_CASE_P(SSE3, SADTest, ::testing::Values(
247 make_tuple(16, 16, sad_16x16_sse3))); 250 make_tuple(16, 16, sad_16x16_sse3)));
248 #endif 251 #endif
249 252
250 } // namespace 253 } // namespace
OLDNEW
« no previous file with comments | « source/libvpx/test/register_state_check.h ('k') | source/libvpx/test/sixtap_predict_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698