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 | 14 |
15 #include "third_party/googletest/src/include/gtest/gtest.h" | 15 #include "third_party/googletest/src/include/gtest/gtest.h" |
16 #include "test/acm_random.h" | 16 #include "test/acm_random.h" |
17 #include "test/clear_system_state.h" | 17 #include "test/clear_system_state.h" |
18 #include "test/register_state_check.h" | 18 #include "test/register_state_check.h" |
19 #include "test/util.h" | 19 #include "test/util.h" |
20 | 20 |
21 #include "./vp9_rtcd.h" | 21 #include "./vp9_rtcd.h" |
22 #include "vp9/common/vp9_entropy.h" | 22 #include "vp9/common/vp9_entropy.h" |
| 23 #include "vpx/vpx_codec.h" |
23 #include "vpx/vpx_integer.h" | 24 #include "vpx/vpx_integer.h" |
24 | 25 |
25 extern "C" { | |
26 void vp9_idct4x4_16_add_c(const int16_t *input, uint8_t *output, int pitch); | |
27 } | |
28 | |
29 using libvpx_test::ACMRandom; | 26 using libvpx_test::ACMRandom; |
30 | 27 |
31 namespace { | 28 namespace { |
32 const int kNumCoeffs = 16; | 29 const int kNumCoeffs = 16; |
33 typedef void (*FdctFunc)(const int16_t *in, int16_t *out, int stride); | 30 typedef void (*FdctFunc)(const int16_t *in, tran_low_t *out, int stride); |
34 typedef void (*IdctFunc)(const int16_t *in, uint8_t *out, int stride); | 31 typedef void (*IdctFunc)(const tran_low_t *in, uint8_t *out, int stride); |
35 typedef void (*FhtFunc)(const int16_t *in, int16_t *out, int stride, | 32 typedef void (*FhtFunc)(const int16_t *in, tran_low_t *out, int stride, |
36 int tx_type); | 33 int tx_type); |
37 typedef void (*IhtFunc)(const int16_t *in, uint8_t *out, int stride, | 34 typedef void (*IhtFunc)(const tran_low_t *in, uint8_t *out, int stride, |
38 int tx_type); | 35 int tx_type); |
39 | 36 |
40 typedef std::tr1::tuple<FdctFunc, IdctFunc, int> Dct4x4Param; | 37 typedef std::tr1::tuple<FdctFunc, IdctFunc, int, vpx_bit_depth_t> Dct4x4Param; |
41 typedef std::tr1::tuple<FhtFunc, IhtFunc, int> Ht4x4Param; | 38 typedef std::tr1::tuple<FhtFunc, IhtFunc, int, vpx_bit_depth_t> Ht4x4Param; |
42 | 39 |
43 void fdct4x4_ref(const int16_t *in, int16_t *out, int stride, int /*tx_type*/) { | 40 void fdct4x4_ref(const int16_t *in, tran_low_t *out, int stride, |
| 41 int tx_type) { |
44 vp9_fdct4x4_c(in, out, stride); | 42 vp9_fdct4x4_c(in, out, stride); |
45 } | 43 } |
46 | 44 |
47 void fht4x4_ref(const int16_t *in, int16_t *out, int stride, int tx_type) { | 45 void fht4x4_ref(const int16_t *in, tran_low_t *out, int stride, int tx_type) { |
48 vp9_fht4x4_c(in, out, stride, tx_type); | 46 vp9_fht4x4_c(in, out, stride, tx_type); |
49 } | 47 } |
50 | 48 |
51 void fwht4x4_ref(const int16_t *in, int16_t *out, int stride, int /*tx_type*/) { | 49 void fwht4x4_ref(const int16_t *in, tran_low_t *out, int stride, |
| 50 int tx_type) { |
52 vp9_fwht4x4_c(in, out, stride); | 51 vp9_fwht4x4_c(in, out, stride); |
53 } | 52 } |
54 | 53 |
| 54 #if CONFIG_VP9_HIGHBITDEPTH |
| 55 void idct4x4_10(const tran_low_t *in, uint8_t *out, int stride) { |
| 56 vp9_high_idct4x4_16_add_c(in, out, stride, 10); |
| 57 } |
| 58 |
| 59 void idct4x4_12(const tran_low_t *in, uint8_t *out, int stride) { |
| 60 vp9_high_idct4x4_16_add_c(in, out, stride, 12); |
| 61 } |
| 62 |
| 63 void iht4x4_10(const tran_low_t *in, uint8_t *out, int stride, int tx_type) { |
| 64 vp9_high_iht4x4_16_add_c(in, out, stride, tx_type, 10); |
| 65 } |
| 66 |
| 67 void iht4x4_12(const tran_low_t *in, uint8_t *out, int stride, int tx_type) { |
| 68 vp9_high_iht4x4_16_add_c(in, out, stride, tx_type, 12); |
| 69 } |
| 70 |
| 71 void iwht4x4_10(const tran_low_t *in, uint8_t *out, int stride) { |
| 72 vp9_high_iwht4x4_16_add_c(in, out, stride, 10); |
| 73 } |
| 74 |
| 75 void iwht4x4_12(const tran_low_t *in, uint8_t *out, int stride) { |
| 76 vp9_high_iwht4x4_16_add_c(in, out, stride, 12); |
| 77 } |
| 78 #endif |
| 79 |
55 class Trans4x4TestBase { | 80 class Trans4x4TestBase { |
56 public: | 81 public: |
57 virtual ~Trans4x4TestBase() {} | 82 virtual ~Trans4x4TestBase() {} |
58 | 83 |
59 protected: | 84 protected: |
60 virtual void RunFwdTxfm(const int16_t *in, int16_t *out, int stride) = 0; | 85 virtual void RunFwdTxfm(const int16_t *in, tran_low_t *out, int stride) = 0; |
61 | 86 |
62 virtual void RunInvTxfm(const int16_t *out, uint8_t *dst, int stride) = 0; | 87 virtual void RunInvTxfm(const tran_low_t *out, uint8_t *dst, int stride) = 0; |
63 | 88 |
64 void RunAccuracyCheck(int limit) { | 89 void RunAccuracyCheck(int limit) { |
65 ACMRandom rnd(ACMRandom::DeterministicSeed()); | 90 ACMRandom rnd(ACMRandom::DeterministicSeed()); |
66 uint32_t max_error = 0; | 91 uint32_t max_error = 0; |
67 int64_t total_error = 0; | 92 int64_t total_error = 0; |
68 const int count_test_block = 10000; | 93 const int count_test_block = 10000; |
69 for (int i = 0; i < count_test_block; ++i) { | 94 for (int i = 0; i < count_test_block; ++i) { |
70 DECLARE_ALIGNED_ARRAY(16, int16_t, test_input_block, kNumCoeffs); | 95 DECLARE_ALIGNED_ARRAY(16, int16_t, test_input_block, kNumCoeffs); |
71 DECLARE_ALIGNED_ARRAY(16, int16_t, test_temp_block, kNumCoeffs); | 96 DECLARE_ALIGNED_ARRAY(16, tran_low_t, test_temp_block, kNumCoeffs); |
72 DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, kNumCoeffs); | 97 DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, kNumCoeffs); |
73 DECLARE_ALIGNED_ARRAY(16, uint8_t, src, kNumCoeffs); | 98 DECLARE_ALIGNED_ARRAY(16, uint8_t, src, kNumCoeffs); |
| 99 #if CONFIG_VP9_HIGHBITDEPTH |
| 100 DECLARE_ALIGNED_ARRAY(16, uint16_t, dst16, kNumCoeffs); |
| 101 DECLARE_ALIGNED_ARRAY(16, uint16_t, src16, kNumCoeffs); |
| 102 #endif |
74 | 103 |
75 // Initialize a test block with input range [-255, 255]. | 104 // Initialize a test block with input range [-255, 255]. |
76 for (int j = 0; j < kNumCoeffs; ++j) { | 105 for (int j = 0; j < kNumCoeffs; ++j) { |
77 src[j] = rnd.Rand8(); | 106 if (bit_depth_ == VPX_BITS_8) { |
78 dst[j] = rnd.Rand8(); | 107 src[j] = rnd.Rand8(); |
79 test_input_block[j] = src[j] - dst[j]; | 108 dst[j] = rnd.Rand8(); |
| 109 test_input_block[j] = src[j] - dst[j]; |
| 110 #if CONFIG_VP9_HIGHBITDEPTH |
| 111 } else { |
| 112 src16[j] = rnd.Rand16() & mask_; |
| 113 dst16[j] = rnd.Rand16() & mask_; |
| 114 test_input_block[j] = src16[j] - dst16[j]; |
| 115 #endif |
| 116 } |
80 } | 117 } |
81 | 118 |
82 ASM_REGISTER_STATE_CHECK(RunFwdTxfm(test_input_block, | 119 ASM_REGISTER_STATE_CHECK(RunFwdTxfm(test_input_block, |
83 test_temp_block, pitch_)); | 120 test_temp_block, pitch_)); |
84 ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst, pitch_)); | 121 if (bit_depth_ == VPX_BITS_8) { |
| 122 ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst, pitch_)); |
| 123 #if CONFIG_VP9_HIGHBITDEPTH |
| 124 } else { |
| 125 ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, |
| 126 CONVERT_TO_BYTEPTR(dst16), pitch_)); |
| 127 #endif |
| 128 } |
85 | 129 |
86 for (int j = 0; j < kNumCoeffs; ++j) { | 130 for (int j = 0; j < kNumCoeffs; ++j) { |
| 131 #if CONFIG_VP9_HIGHBITDEPTH |
| 132 const uint32_t diff = |
| 133 bit_depth_ == VPX_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j]; |
| 134 #else |
87 const uint32_t diff = dst[j] - src[j]; | 135 const uint32_t diff = dst[j] - src[j]; |
| 136 #endif |
88 const uint32_t error = diff * diff; | 137 const uint32_t error = diff * diff; |
89 if (max_error < error) | 138 if (max_error < error) |
90 max_error = error; | 139 max_error = error; |
91 total_error += error; | 140 total_error += error; |
92 } | 141 } |
93 } | 142 } |
94 | 143 |
95 EXPECT_GE(static_cast<uint32_t>(limit), max_error) | 144 EXPECT_GE(static_cast<uint32_t>(limit), max_error) |
96 << "Error: 4x4 FHT/IHT has an individual round trip error > " | 145 << "Error: 4x4 FHT/IHT has an individual round trip error > " |
97 << limit; | 146 << limit; |
98 | 147 |
99 EXPECT_GE(count_test_block * limit, total_error) | 148 EXPECT_GE(count_test_block * limit, total_error) |
100 << "Error: 4x4 FHT/IHT has average round trip error > " << limit | 149 << "Error: 4x4 FHT/IHT has average round trip error > " << limit |
101 << " per block"; | 150 << " per block"; |
102 } | 151 } |
103 | 152 |
104 void RunCoeffCheck() { | 153 void RunCoeffCheck() { |
105 ACMRandom rnd(ACMRandom::DeterministicSeed()); | 154 ACMRandom rnd(ACMRandom::DeterministicSeed()); |
106 const int count_test_block = 5000; | 155 const int count_test_block = 5000; |
107 DECLARE_ALIGNED_ARRAY(16, int16_t, input_block, kNumCoeffs); | 156 DECLARE_ALIGNED_ARRAY(16, int16_t, input_block, kNumCoeffs); |
108 DECLARE_ALIGNED_ARRAY(16, int16_t, output_ref_block, kNumCoeffs); | 157 DECLARE_ALIGNED_ARRAY(16, tran_low_t, output_ref_block, kNumCoeffs); |
109 DECLARE_ALIGNED_ARRAY(16, int16_t, output_block, kNumCoeffs); | 158 DECLARE_ALIGNED_ARRAY(16, tran_low_t, output_block, kNumCoeffs); |
110 | 159 |
111 for (int i = 0; i < count_test_block; ++i) { | 160 for (int i = 0; i < count_test_block; ++i) { |
112 // Initialize a test block with input range [-255, 255]. | 161 // Initialize a test block with input range [-mask_, mask_]. |
113 for (int j = 0; j < kNumCoeffs; ++j) | 162 for (int j = 0; j < kNumCoeffs; ++j) |
114 input_block[j] = rnd.Rand8() - rnd.Rand8(); | 163 input_block[j] = (rnd.Rand16() & mask_) - (rnd.Rand16() & mask_); |
115 | 164 |
116 fwd_txfm_ref(input_block, output_ref_block, pitch_, tx_type_); | 165 fwd_txfm_ref(input_block, output_ref_block, pitch_, tx_type_); |
117 ASM_REGISTER_STATE_CHECK(RunFwdTxfm(input_block, output_block, pitch_)); | 166 ASM_REGISTER_STATE_CHECK(RunFwdTxfm(input_block, output_block, pitch_)); |
118 | 167 |
119 // The minimum quant value is 4. | 168 // The minimum quant value is 4. |
120 for (int j = 0; j < kNumCoeffs; ++j) | 169 for (int j = 0; j < kNumCoeffs; ++j) |
121 EXPECT_EQ(output_block[j], output_ref_block[j]); | 170 EXPECT_EQ(output_block[j], output_ref_block[j]); |
122 } | 171 } |
123 } | 172 } |
124 | 173 |
125 void RunMemCheck() { | 174 void RunMemCheck() { |
126 ACMRandom rnd(ACMRandom::DeterministicSeed()); | 175 ACMRandom rnd(ACMRandom::DeterministicSeed()); |
127 const int count_test_block = 5000; | 176 const int count_test_block = 5000; |
128 DECLARE_ALIGNED_ARRAY(16, int16_t, input_block, kNumCoeffs); | 177 DECLARE_ALIGNED_ARRAY(16, int16_t, input_block, kNumCoeffs); |
129 DECLARE_ALIGNED_ARRAY(16, int16_t, input_extreme_block, kNumCoeffs); | 178 DECLARE_ALIGNED_ARRAY(16, int16_t, input_extreme_block, kNumCoeffs); |
130 DECLARE_ALIGNED_ARRAY(16, int16_t, output_ref_block, kNumCoeffs); | 179 DECLARE_ALIGNED_ARRAY(16, tran_low_t, output_ref_block, kNumCoeffs); |
131 DECLARE_ALIGNED_ARRAY(16, int16_t, output_block, kNumCoeffs); | 180 DECLARE_ALIGNED_ARRAY(16, tran_low_t, output_block, kNumCoeffs); |
132 | 181 |
133 for (int i = 0; i < count_test_block; ++i) { | 182 for (int i = 0; i < count_test_block; ++i) { |
134 // Initialize a test block with input range [-255, 255]. | 183 // Initialize a test block with input range [-mask_, mask_]. |
135 for (int j = 0; j < kNumCoeffs; ++j) { | 184 for (int j = 0; j < kNumCoeffs; ++j) { |
136 input_block[j] = rnd.Rand8() - rnd.Rand8(); | 185 input_block[j] = (rnd.Rand16() & mask_) - (rnd.Rand16() & mask_); |
137 input_extreme_block[j] = rnd.Rand8() % 2 ? 255 : -255; | 186 input_extreme_block[j] = rnd.Rand8() % 2 ? mask_ : -mask_; |
138 } | 187 } |
139 if (i == 0) { | 188 if (i == 0) { |
140 for (int j = 0; j < kNumCoeffs; ++j) | 189 for (int j = 0; j < kNumCoeffs; ++j) |
141 input_extreme_block[j] = 255; | 190 input_extreme_block[j] = mask_; |
142 } else if (i == 1) { | 191 } else if (i == 1) { |
143 for (int j = 0; j < kNumCoeffs; ++j) | 192 for (int j = 0; j < kNumCoeffs; ++j) |
144 input_extreme_block[j] = -255; | 193 input_extreme_block[j] = -mask_; |
145 } | 194 } |
146 | 195 |
147 fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_); | 196 fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_); |
148 ASM_REGISTER_STATE_CHECK(RunFwdTxfm(input_extreme_block, | 197 ASM_REGISTER_STATE_CHECK(RunFwdTxfm(input_extreme_block, |
149 output_block, pitch_)); | 198 output_block, pitch_)); |
150 | 199 |
151 // The minimum quant value is 4. | 200 // The minimum quant value is 4. |
152 for (int j = 0; j < kNumCoeffs; ++j) { | 201 for (int j = 0; j < kNumCoeffs; ++j) { |
153 EXPECT_EQ(output_block[j], output_ref_block[j]); | 202 EXPECT_EQ(output_block[j], output_ref_block[j]); |
154 EXPECT_GE(4 * DCT_MAX_VALUE, abs(output_block[j])) | 203 EXPECT_GE(4 * DCT_MAX_VALUE << (bit_depth_ - 8), abs(output_block[j])) |
155 << "Error: 16x16 FDCT has coefficient larger than 4*DCT_MAX_VALUE"; | 204 << "Error: 4x4 FDCT has coefficient larger than 4*DCT_MAX_VALUE"; |
156 } | 205 } |
157 } | 206 } |
158 } | 207 } |
159 | 208 |
160 void RunInvAccuracyCheck(int limit) { | 209 void RunInvAccuracyCheck(int limit) { |
161 ACMRandom rnd(ACMRandom::DeterministicSeed()); | 210 ACMRandom rnd(ACMRandom::DeterministicSeed()); |
162 const int count_test_block = 1000; | 211 const int count_test_block = 1000; |
163 DECLARE_ALIGNED_ARRAY(16, int16_t, in, kNumCoeffs); | 212 DECLARE_ALIGNED_ARRAY(16, int16_t, in, kNumCoeffs); |
164 DECLARE_ALIGNED_ARRAY(16, int16_t, coeff, kNumCoeffs); | 213 DECLARE_ALIGNED_ARRAY(16, tran_low_t, coeff, kNumCoeffs); |
165 DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, kNumCoeffs); | 214 DECLARE_ALIGNED_ARRAY(16, uint8_t, dst, kNumCoeffs); |
166 DECLARE_ALIGNED_ARRAY(16, uint8_t, src, kNumCoeffs); | 215 DECLARE_ALIGNED_ARRAY(16, uint8_t, src, kNumCoeffs); |
| 216 #if CONFIG_VP9_HIGHBITDEPTH |
| 217 DECLARE_ALIGNED_ARRAY(16, uint16_t, dst16, kNumCoeffs); |
| 218 DECLARE_ALIGNED_ARRAY(16, uint16_t, src16, kNumCoeffs); |
| 219 #endif |
167 | 220 |
168 for (int i = 0; i < count_test_block; ++i) { | 221 for (int i = 0; i < count_test_block; ++i) { |
169 // Initialize a test block with input range [-255, 255]. | 222 // Initialize a test block with input range [-mask_, mask_]. |
170 for (int j = 0; j < kNumCoeffs; ++j) { | 223 for (int j = 0; j < kNumCoeffs; ++j) { |
171 src[j] = rnd.Rand8(); | 224 if (bit_depth_ == VPX_BITS_8) { |
172 dst[j] = rnd.Rand8(); | 225 src[j] = rnd.Rand8(); |
173 in[j] = src[j] - dst[j]; | 226 dst[j] = rnd.Rand8(); |
| 227 in[j] = src[j] - dst[j]; |
| 228 #if CONFIG_VP9_HIGHBITDEPTH |
| 229 } else { |
| 230 src16[j] = rnd.Rand16() & mask_; |
| 231 dst16[j] = rnd.Rand16() & mask_; |
| 232 in[j] = src16[j] - dst16[j]; |
| 233 #endif |
| 234 } |
174 } | 235 } |
175 | 236 |
176 fwd_txfm_ref(in, coeff, pitch_, tx_type_); | 237 fwd_txfm_ref(in, coeff, pitch_, tx_type_); |
177 | 238 |
178 ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_)); | 239 if (bit_depth_ == VPX_BITS_8) { |
| 240 ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_)); |
| 241 #if CONFIG_VP9_HIGHBITDEPTH |
| 242 } else { |
| 243 ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), |
| 244 pitch_)); |
| 245 #endif |
| 246 } |
179 | 247 |
180 for (int j = 0; j < kNumCoeffs; ++j) { | 248 for (int j = 0; j < kNumCoeffs; ++j) { |
| 249 #if CONFIG_VP9_HIGHBITDEPTH |
| 250 const uint32_t diff = |
| 251 bit_depth_ == VPX_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j]; |
| 252 #else |
181 const uint32_t diff = dst[j] - src[j]; | 253 const uint32_t diff = dst[j] - src[j]; |
| 254 #endif |
182 const uint32_t error = diff * diff; | 255 const uint32_t error = diff * diff; |
183 EXPECT_GE(static_cast<uint32_t>(limit), error) | 256 EXPECT_GE(static_cast<uint32_t>(limit), error) |
184 << "Error: 4x4 IDCT has error " << error | 257 << "Error: 4x4 IDCT has error " << error |
185 << " at index " << j; | 258 << " at index " << j; |
186 } | 259 } |
187 } | 260 } |
188 } | 261 } |
189 | 262 |
190 int pitch_; | 263 int pitch_; |
191 int tx_type_; | 264 int tx_type_; |
192 FhtFunc fwd_txfm_ref; | 265 FhtFunc fwd_txfm_ref; |
| 266 vpx_bit_depth_t bit_depth_; |
| 267 int mask_; |
193 }; | 268 }; |
194 | 269 |
195 class Trans4x4DCT | 270 class Trans4x4DCT |
196 : public Trans4x4TestBase, | 271 : public Trans4x4TestBase, |
197 public ::testing::TestWithParam<Dct4x4Param> { | 272 public ::testing::TestWithParam<Dct4x4Param> { |
198 public: | 273 public: |
199 virtual ~Trans4x4DCT() {} | 274 virtual ~Trans4x4DCT() {} |
200 | 275 |
201 virtual void SetUp() { | 276 virtual void SetUp() { |
202 fwd_txfm_ = GET_PARAM(0); | 277 fwd_txfm_ = GET_PARAM(0); |
203 inv_txfm_ = GET_PARAM(1); | 278 inv_txfm_ = GET_PARAM(1); |
204 tx_type_ = GET_PARAM(2); | 279 tx_type_ = GET_PARAM(2); |
205 pitch_ = 4; | 280 pitch_ = 4; |
206 fwd_txfm_ref = fdct4x4_ref; | 281 fwd_txfm_ref = fdct4x4_ref; |
| 282 bit_depth_ = GET_PARAM(3); |
| 283 mask_ = (1 << bit_depth_) - 1; |
207 } | 284 } |
208 virtual void TearDown() { libvpx_test::ClearSystemState(); } | 285 virtual void TearDown() { libvpx_test::ClearSystemState(); } |
209 | 286 |
210 protected: | 287 protected: |
211 void RunFwdTxfm(const int16_t *in, int16_t *out, int stride) { | 288 void RunFwdTxfm(const int16_t *in, tran_low_t *out, int stride) { |
212 fwd_txfm_(in, out, stride); | 289 fwd_txfm_(in, out, stride); |
213 } | 290 } |
214 void RunInvTxfm(const int16_t *out, uint8_t *dst, int stride) { | 291 void RunInvTxfm(const tran_low_t *out, uint8_t *dst, int stride) { |
215 inv_txfm_(out, dst, stride); | 292 inv_txfm_(out, dst, stride); |
216 } | 293 } |
217 | 294 |
218 FdctFunc fwd_txfm_; | 295 FdctFunc fwd_txfm_; |
219 IdctFunc inv_txfm_; | 296 IdctFunc inv_txfm_; |
220 }; | 297 }; |
221 | 298 |
222 TEST_P(Trans4x4DCT, AccuracyCheck) { | 299 TEST_P(Trans4x4DCT, AccuracyCheck) { |
223 RunAccuracyCheck(1); | 300 RunAccuracyCheck(1); |
224 } | 301 } |
(...skipping 15 matching lines...) Expand all Loading... |
240 public ::testing::TestWithParam<Ht4x4Param> { | 317 public ::testing::TestWithParam<Ht4x4Param> { |
241 public: | 318 public: |
242 virtual ~Trans4x4HT() {} | 319 virtual ~Trans4x4HT() {} |
243 | 320 |
244 virtual void SetUp() { | 321 virtual void SetUp() { |
245 fwd_txfm_ = GET_PARAM(0); | 322 fwd_txfm_ = GET_PARAM(0); |
246 inv_txfm_ = GET_PARAM(1); | 323 inv_txfm_ = GET_PARAM(1); |
247 tx_type_ = GET_PARAM(2); | 324 tx_type_ = GET_PARAM(2); |
248 pitch_ = 4; | 325 pitch_ = 4; |
249 fwd_txfm_ref = fht4x4_ref; | 326 fwd_txfm_ref = fht4x4_ref; |
| 327 bit_depth_ = GET_PARAM(3); |
| 328 mask_ = (1 << bit_depth_) - 1; |
250 } | 329 } |
251 virtual void TearDown() { libvpx_test::ClearSystemState(); } | 330 virtual void TearDown() { libvpx_test::ClearSystemState(); } |
252 | 331 |
253 protected: | 332 protected: |
254 void RunFwdTxfm(const int16_t *in, int16_t *out, int stride) { | 333 void RunFwdTxfm(const int16_t *in, tran_low_t *out, int stride) { |
255 fwd_txfm_(in, out, stride, tx_type_); | 334 fwd_txfm_(in, out, stride, tx_type_); |
256 } | 335 } |
257 | 336 |
258 void RunInvTxfm(const int16_t *out, uint8_t *dst, int stride) { | 337 void RunInvTxfm(const tran_low_t *out, uint8_t *dst, int stride) { |
259 inv_txfm_(out, dst, stride, tx_type_); | 338 inv_txfm_(out, dst, stride, tx_type_); |
260 } | 339 } |
261 | 340 |
262 FhtFunc fwd_txfm_; | 341 FhtFunc fwd_txfm_; |
263 IhtFunc inv_txfm_; | 342 IhtFunc inv_txfm_; |
264 }; | 343 }; |
265 | 344 |
266 TEST_P(Trans4x4HT, AccuracyCheck) { | 345 TEST_P(Trans4x4HT, AccuracyCheck) { |
267 RunAccuracyCheck(1); | 346 RunAccuracyCheck(1); |
268 } | 347 } |
(...skipping 15 matching lines...) Expand all Loading... |
284 public ::testing::TestWithParam<Dct4x4Param> { | 363 public ::testing::TestWithParam<Dct4x4Param> { |
285 public: | 364 public: |
286 virtual ~Trans4x4WHT() {} | 365 virtual ~Trans4x4WHT() {} |
287 | 366 |
288 virtual void SetUp() { | 367 virtual void SetUp() { |
289 fwd_txfm_ = GET_PARAM(0); | 368 fwd_txfm_ = GET_PARAM(0); |
290 inv_txfm_ = GET_PARAM(1); | 369 inv_txfm_ = GET_PARAM(1); |
291 tx_type_ = GET_PARAM(2); | 370 tx_type_ = GET_PARAM(2); |
292 pitch_ = 4; | 371 pitch_ = 4; |
293 fwd_txfm_ref = fwht4x4_ref; | 372 fwd_txfm_ref = fwht4x4_ref; |
| 373 bit_depth_ = GET_PARAM(3); |
| 374 mask_ = (1 << bit_depth_) - 1; |
294 } | 375 } |
295 virtual void TearDown() { libvpx_test::ClearSystemState(); } | 376 virtual void TearDown() { libvpx_test::ClearSystemState(); } |
296 | 377 |
297 protected: | 378 protected: |
298 void RunFwdTxfm(const int16_t *in, int16_t *out, int stride) { | 379 void RunFwdTxfm(const int16_t *in, tran_low_t *out, int stride) { |
299 fwd_txfm_(in, out, stride); | 380 fwd_txfm_(in, out, stride); |
300 } | 381 } |
301 void RunInvTxfm(const int16_t *out, uint8_t *dst, int stride) { | 382 void RunInvTxfm(const tran_low_t *out, uint8_t *dst, int stride) { |
302 inv_txfm_(out, dst, stride); | 383 inv_txfm_(out, dst, stride); |
303 } | 384 } |
304 | 385 |
305 FdctFunc fwd_txfm_; | 386 FdctFunc fwd_txfm_; |
306 IdctFunc inv_txfm_; | 387 IdctFunc inv_txfm_; |
307 }; | 388 }; |
308 | 389 |
309 TEST_P(Trans4x4WHT, AccuracyCheck) { | 390 TEST_P(Trans4x4WHT, AccuracyCheck) { |
310 RunAccuracyCheck(0); | 391 RunAccuracyCheck(0); |
311 } | 392 } |
312 | 393 |
313 TEST_P(Trans4x4WHT, CoeffCheck) { | 394 TEST_P(Trans4x4WHT, CoeffCheck) { |
314 RunCoeffCheck(); | 395 RunCoeffCheck(); |
315 } | 396 } |
316 | 397 |
317 TEST_P(Trans4x4WHT, MemCheck) { | 398 TEST_P(Trans4x4WHT, MemCheck) { |
318 RunMemCheck(); | 399 RunMemCheck(); |
319 } | 400 } |
320 | 401 |
321 TEST_P(Trans4x4WHT, InvAccuracyCheck) { | 402 TEST_P(Trans4x4WHT, InvAccuracyCheck) { |
322 RunInvAccuracyCheck(0); | 403 RunInvAccuracyCheck(0); |
323 } | 404 } |
324 using std::tr1::make_tuple; | 405 using std::tr1::make_tuple; |
325 | 406 |
| 407 #if CONFIG_VP9_HIGHBITDEPTH |
326 INSTANTIATE_TEST_CASE_P( | 408 INSTANTIATE_TEST_CASE_P( |
327 C, Trans4x4DCT, | 409 C, Trans4x4DCT, |
328 ::testing::Values( | 410 ::testing::Values( |
329 make_tuple(&vp9_fdct4x4_c, &vp9_idct4x4_16_add_c, 0))); | 411 make_tuple(&vp9_high_fdct4x4_c, &idct4x4_10, 0, VPX_BITS_10), |
| 412 make_tuple(&vp9_high_fdct4x4_c, &idct4x4_12, 0, VPX_BITS_12), |
| 413 make_tuple(&vp9_fdct4x4_c, &vp9_idct4x4_16_add_c, 0, VPX_BITS_8))); |
| 414 #else |
| 415 INSTANTIATE_TEST_CASE_P( |
| 416 C, Trans4x4DCT, |
| 417 ::testing::Values( |
| 418 make_tuple(&vp9_fdct4x4_c, &vp9_idct4x4_16_add_c, 0, VPX_BITS_8))); |
| 419 #endif |
| 420 |
| 421 #if CONFIG_VP9_HIGHBITDEPTH |
330 INSTANTIATE_TEST_CASE_P( | 422 INSTANTIATE_TEST_CASE_P( |
331 C, Trans4x4HT, | 423 C, Trans4x4HT, |
332 ::testing::Values( | 424 ::testing::Values( |
333 make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 0), | 425 make_tuple(&vp9_high_fht4x4_c, &iht4x4_10, 0, VPX_BITS_10), |
334 make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 1), | 426 make_tuple(&vp9_high_fht4x4_c, &iht4x4_10, 1, VPX_BITS_10), |
335 make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 2), | 427 make_tuple(&vp9_high_fht4x4_c, &iht4x4_10, 2, VPX_BITS_10), |
336 make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 3))); | 428 make_tuple(&vp9_high_fht4x4_c, &iht4x4_10, 3, VPX_BITS_10), |
| 429 make_tuple(&vp9_high_fht4x4_c, &iht4x4_12, 0, VPX_BITS_12), |
| 430 make_tuple(&vp9_high_fht4x4_c, &iht4x4_12, 1, VPX_BITS_12), |
| 431 make_tuple(&vp9_high_fht4x4_c, &iht4x4_12, 2, VPX_BITS_12), |
| 432 make_tuple(&vp9_high_fht4x4_c, &iht4x4_12, 3, VPX_BITS_12), |
| 433 make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 0, VPX_BITS_8), |
| 434 make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 1, VPX_BITS_8), |
| 435 make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 2, VPX_BITS_8), |
| 436 make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 3, VPX_BITS_8))); |
| 437 #else |
| 438 INSTANTIATE_TEST_CASE_P( |
| 439 C, Trans4x4HT, |
| 440 ::testing::Values( |
| 441 make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 0, VPX_BITS_8), |
| 442 make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 1, VPX_BITS_8), |
| 443 make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 2, VPX_BITS_8), |
| 444 make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_c, 3, VPX_BITS_8))); |
| 445 #endif |
| 446 |
| 447 #if CONFIG_VP9_HIGHBITDEPTH |
337 INSTANTIATE_TEST_CASE_P( | 448 INSTANTIATE_TEST_CASE_P( |
338 C, Trans4x4WHT, | 449 C, Trans4x4WHT, |
339 ::testing::Values( | 450 ::testing::Values( |
340 make_tuple(&vp9_fwht4x4_c, &vp9_iwht4x4_16_add_c, 0))); | 451 make_tuple(&vp9_high_fwht4x4_c, &iwht4x4_10, 0, VPX_BITS_10), |
| 452 make_tuple(&vp9_high_fwht4x4_c, &iwht4x4_12, 0, VPX_BITS_12), |
| 453 make_tuple(&vp9_fwht4x4_c, &vp9_iwht4x4_16_add_c, 0, VPX_BITS_8))); |
| 454 #else |
| 455 INSTANTIATE_TEST_CASE_P( |
| 456 C, Trans4x4WHT, |
| 457 ::testing::Values( |
| 458 make_tuple(&vp9_fwht4x4_c, &vp9_iwht4x4_16_add_c, 0, VPX_BITS_8))); |
| 459 #endif |
341 | 460 |
342 #if HAVE_NEON_ASM | 461 #if HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH |
343 INSTANTIATE_TEST_CASE_P( | 462 INSTANTIATE_TEST_CASE_P( |
344 NEON, Trans4x4DCT, | 463 NEON, Trans4x4DCT, |
345 ::testing::Values( | 464 ::testing::Values( |
346 make_tuple(&vp9_fdct4x4_c, | 465 make_tuple(&vp9_fdct4x4_c, |
347 &vp9_idct4x4_16_add_neon, 0))); | 466 &vp9_idct4x4_16_add_neon, 0, VPX_BITS_8))); |
348 INSTANTIATE_TEST_CASE_P( | 467 INSTANTIATE_TEST_CASE_P( |
349 DISABLED_NEON, Trans4x4HT, | 468 DISABLED_NEON, Trans4x4HT, |
350 ::testing::Values( | 469 ::testing::Values( |
351 make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_neon, 0), | 470 make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_neon, 0, VPX_BITS_8), |
352 make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_neon, 1), | 471 make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_neon, 1, VPX_BITS_8), |
353 make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_neon, 2), | 472 make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_neon, 2, VPX_BITS_8), |
354 make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_neon, 3))); | 473 make_tuple(&vp9_fht4x4_c, &vp9_iht4x4_16_add_neon, 3, VPX_BITS_8))); |
355 #endif | 474 #endif |
356 | 475 |
357 #if CONFIG_USE_X86INC && HAVE_MMX | 476 #if CONFIG_USE_X86INC && HAVE_MMX && !CONFIG_VP9_HIGHBITDEPTH |
358 INSTANTIATE_TEST_CASE_P( | 477 INSTANTIATE_TEST_CASE_P( |
359 MMX, Trans4x4WHT, | 478 MMX, Trans4x4WHT, |
360 ::testing::Values( | 479 ::testing::Values( |
361 make_tuple(&vp9_fwht4x4_mmx, &vp9_iwht4x4_16_add_c, 0))); | 480 make_tuple(&vp9_fwht4x4_mmx, &vp9_iwht4x4_16_add_c, 0, VPX_BITS_8))); |
362 #endif | 481 #endif |
363 | 482 |
364 #if HAVE_SSE2 | 483 #if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH |
365 INSTANTIATE_TEST_CASE_P( | 484 INSTANTIATE_TEST_CASE_P( |
366 SSE2, Trans4x4DCT, | 485 SSE2, Trans4x4DCT, |
367 ::testing::Values( | 486 ::testing::Values( |
368 make_tuple(&vp9_fdct4x4_sse2, | 487 make_tuple(&vp9_fdct4x4_sse2, |
369 &vp9_idct4x4_16_add_sse2, 0))); | 488 &vp9_idct4x4_16_add_sse2, 0, VPX_BITS_8))); |
370 INSTANTIATE_TEST_CASE_P( | 489 INSTANTIATE_TEST_CASE_P( |
371 SSE2, Trans4x4HT, | 490 SSE2, Trans4x4HT, |
372 ::testing::Values( | 491 ::testing::Values( |
373 make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 0), | 492 make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 0, VPX_BITS_8), |
374 make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 1), | 493 make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 1, VPX_BITS_8), |
375 make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 2), | 494 make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 2, VPX_BITS_8), |
376 make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 3))); | 495 make_tuple(&vp9_fht4x4_sse2, &vp9_iht4x4_16_add_sse2, 3, VPX_BITS_8))); |
377 #endif | 496 #endif |
378 | 497 |
379 } // namespace | 498 } // namespace |
OLD | NEW |