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

Side by Side Diff: source/libvpx/test/idctllm_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/encode_test_driver.cc ('k') | source/libvpx/test/intrapred_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) 2010 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2010 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 extern "C" { 12 extern "C" {
13 #include "vpx_config.h" 13 #include "vpx_config.h"
14 #include "vp8_rtcd.h" 14 #include "vp8_rtcd.h"
15 } 15 }
16 #include "test/register_state_check.h"
16 #include "third_party/googletest/src/include/gtest/gtest.h" 17 #include "third_party/googletest/src/include/gtest/gtest.h"
17 18
18 typedef void (*idct_fn_t)(short *input, unsigned char *pred_ptr, 19 typedef void (*idct_fn_t)(short *input, unsigned char *pred_ptr,
19 int pred_stride, unsigned char *dst_ptr, 20 int pred_stride, unsigned char *dst_ptr,
20 int dst_stride); 21 int dst_stride);
21 namespace { 22 namespace {
22 class IDCTTest : public ::testing::TestWithParam<idct_fn_t> 23 class IDCTTest : public ::testing::TestWithParam<idct_fn_t>
23 { 24 {
24 protected: 25 protected:
25 virtual void SetUp() 26 virtual void SetUp()
(...skipping 21 matching lines...) Expand all
47 if((i&0xF) < 4 && i<64) 48 if((i&0xF) < 4 && i<64)
48 EXPECT_EQ(0, output[i]) << i; 49 EXPECT_EQ(0, output[i]) << i;
49 else 50 else
50 EXPECT_EQ(255, output[i]); 51 EXPECT_EQ(255, output[i]);
51 } 52 }
52 53
53 TEST_P(IDCTTest, TestAllZeros) 54 TEST_P(IDCTTest, TestAllZeros)
54 { 55 {
55 int i; 56 int i;
56 57
57 UUT(input, output, 16, output, 16); 58 REGISTER_STATE_CHECK(UUT(input, output, 16, output, 16));
58 59
59 for(i=0; i<256; i++) 60 for(i=0; i<256; i++)
60 if((i&0xF) < 4 && i<64) 61 if((i&0xF) < 4 && i<64)
61 EXPECT_EQ(0, output[i]) << "i==" << i; 62 EXPECT_EQ(0, output[i]) << "i==" << i;
62 else 63 else
63 EXPECT_EQ(255, output[i]) << "i==" << i; 64 EXPECT_EQ(255, output[i]) << "i==" << i;
64 } 65 }
65 66
66 TEST_P(IDCTTest, TestAllOnes) 67 TEST_P(IDCTTest, TestAllOnes)
67 { 68 {
68 int i; 69 int i;
69 70
70 input[0] = 4; 71 input[0] = 4;
71 UUT(input, output, 16, output, 16); 72 REGISTER_STATE_CHECK(UUT(input, output, 16, output, 16));
72 73
73 for(i=0; i<256; i++) 74 for(i=0; i<256; i++)
74 if((i&0xF) < 4 && i<64) 75 if((i&0xF) < 4 && i<64)
75 EXPECT_EQ(1, output[i]) << "i==" << i; 76 EXPECT_EQ(1, output[i]) << "i==" << i;
76 else 77 else
77 EXPECT_EQ(255, output[i]) << "i==" << i; 78 EXPECT_EQ(255, output[i]) << "i==" << i;
78 } 79 }
79 80
80 TEST_P(IDCTTest, TestAddOne) 81 TEST_P(IDCTTest, TestAddOne)
81 { 82 {
82 int i; 83 int i;
83 84
84 for(i=0; i<256; i++) 85 for(i=0; i<256; i++)
85 predict[i] = i; 86 predict[i] = i;
86 87
87 input[0] = 4; 88 input[0] = 4;
88 UUT(input, predict, 16, output, 16); 89 REGISTER_STATE_CHECK(UUT(input, predict, 16, output, 16));
89 90
90 for(i=0; i<256; i++) 91 for(i=0; i<256; i++)
91 if((i&0xF) < 4 && i<64) 92 if((i&0xF) < 4 && i<64)
92 EXPECT_EQ(i+1, output[i]) << "i==" << i; 93 EXPECT_EQ(i+1, output[i]) << "i==" << i;
93 else 94 else
94 EXPECT_EQ(255, output[i]) << "i==" << i; 95 EXPECT_EQ(255, output[i]) << "i==" << i;
95 } 96 }
96 97
97 TEST_P(IDCTTest, TestWithData) 98 TEST_P(IDCTTest, TestWithData)
98 { 99 {
99 int i; 100 int i;
100 101
101 for(i=0; i<16; i++) 102 for(i=0; i<16; i++)
102 input[i] = i; 103 input[i] = i;
103 104
104 UUT(input, output, 16, output, 16); 105 REGISTER_STATE_CHECK(UUT(input, output, 16, output, 16));
105 106
106 for(i=0; i<256; i++) 107 for(i=0; i<256; i++)
107 if((i&0xF) > 3 || i>63) 108 if((i&0xF) > 3 || i>63)
108 EXPECT_EQ(255, output[i]) << "i==" << i; 109 EXPECT_EQ(255, output[i]) << "i==" << i;
109 else if(i == 0) 110 else if(i == 0)
110 EXPECT_EQ(11, output[i]) << "i==" << i; 111 EXPECT_EQ(11, output[i]) << "i==" << i;
111 else if(i == 34) 112 else if(i == 34)
112 EXPECT_EQ(1, output[i]) << "i==" << i; 113 EXPECT_EQ(1, output[i]) << "i==" << i;
113 else if(i == 2 || i == 17 || i == 32) 114 else if(i == 2 || i == 17 || i == 32)
114 EXPECT_EQ(3, output[i]) << "i==" << i; 115 EXPECT_EQ(3, output[i]) << "i==" << i;
115 else 116 else
116 EXPECT_EQ(0, output[i]) << "i==" << i; 117 EXPECT_EQ(0, output[i]) << "i==" << i;
117 } 118 }
118 119
119 INSTANTIATE_TEST_CASE_P(C, IDCTTest, 120 INSTANTIATE_TEST_CASE_P(C, IDCTTest,
120 ::testing::Values(vp8_short_idct4x4llm_c)); 121 ::testing::Values(vp8_short_idct4x4llm_c));
121 #if HAVE_MMX 122 #if HAVE_MMX
122 INSTANTIATE_TEST_CASE_P(MMX, IDCTTest, 123 INSTANTIATE_TEST_CASE_P(MMX, IDCTTest,
123 ::testing::Values(vp8_short_idct4x4llm_mmx)); 124 ::testing::Values(vp8_short_idct4x4llm_mmx));
124 #endif 125 #endif
125 } 126 }
OLDNEW
« no previous file with comments | « source/libvpx/test/encode_test_driver.cc ('k') | source/libvpx/test/intrapred_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698