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

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

Issue 394353005: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: 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/encode_test_driver.cc ('k') | source/libvpx/test/fdct8x8_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
(...skipping 12 matching lines...) Expand all
23 #include "vpx/vpx_integer.h" 23 #include "vpx/vpx_integer.h"
24 24
25 extern "C" { 25 extern "C" {
26 void vp9_idct4x4_16_add_c(const int16_t *input, uint8_t *output, int pitch); 26 void vp9_idct4x4_16_add_c(const int16_t *input, uint8_t *output, int pitch);
27 } 27 }
28 28
29 using libvpx_test::ACMRandom; 29 using libvpx_test::ACMRandom;
30 30
31 namespace { 31 namespace {
32 const int kNumCoeffs = 16; 32 const int kNumCoeffs = 16;
33 typedef void (*fdct_t)(const int16_t *in, int16_t *out, int stride); 33 typedef void (*FdctFunc)(const int16_t *in, int16_t *out, int stride);
34 typedef void (*idct_t)(const int16_t *in, uint8_t *out, int stride); 34 typedef void (*IdctFunc)(const int16_t *in, uint8_t *out, int stride);
35 typedef void (*fht_t) (const int16_t *in, int16_t *out, int stride, 35 typedef void (*FhtFunc)(const int16_t *in, int16_t *out, int stride,
36 int tx_type); 36 int tx_type);
37 typedef void (*iht_t) (const int16_t *in, uint8_t *out, int stride, 37 typedef void (*IhtFunc)(const int16_t *in, uint8_t *out, int stride,
38 int tx_type); 38 int tx_type);
39 39
40 typedef std::tr1::tuple<fdct_t, idct_t, int> dct_4x4_param_t; 40 typedef std::tr1::tuple<FdctFunc, IdctFunc, int> Dct4x4Param;
41 typedef std::tr1::tuple<fht_t, iht_t, int> ht_4x4_param_t; 41 typedef std::tr1::tuple<FhtFunc, IhtFunc, int> Ht4x4Param;
42 42
43 void fdct4x4_ref(const int16_t *in, int16_t *out, int stride, int tx_type) { 43 void fdct4x4_ref(const int16_t *in, int16_t *out, int stride, int tx_type) {
44 vp9_fdct4x4_c(in, out, stride); 44 vp9_fdct4x4_c(in, out, stride);
45 } 45 }
46 46
47 void fht4x4_ref(const int16_t *in, int16_t *out, int stride, int tx_type) { 47 void fht4x4_ref(const int16_t *in, int16_t *out, int stride, int tx_type) {
48 vp9_fht4x4_c(in, out, stride, tx_type); 48 vp9_fht4x4_c(in, out, stride, tx_type);
49 } 49 }
50 50
51 void fwht4x4_ref(const int16_t *in, int16_t *out, int stride, int tx_type) { 51 void fwht4x4_ref(const int16_t *in, int16_t *out, int stride, int tx_type) {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 const uint32_t error = diff * diff; 182 const uint32_t error = diff * diff;
183 EXPECT_GE(static_cast<uint32_t>(limit), error) 183 EXPECT_GE(static_cast<uint32_t>(limit), error)
184 << "Error: 4x4 IDCT has error " << error 184 << "Error: 4x4 IDCT has error " << error
185 << " at index " << j; 185 << " at index " << j;
186 } 186 }
187 } 187 }
188 } 188 }
189 189
190 int pitch_; 190 int pitch_;
191 int tx_type_; 191 int tx_type_;
192 fht_t fwd_txfm_ref; 192 FhtFunc fwd_txfm_ref;
193 }; 193 };
194 194
195 class Trans4x4DCT 195 class Trans4x4DCT
196 : public Trans4x4TestBase, 196 : public Trans4x4TestBase,
197 public ::testing::TestWithParam<dct_4x4_param_t> { 197 public ::testing::TestWithParam<Dct4x4Param> {
198 public: 198 public:
199 virtual ~Trans4x4DCT() {} 199 virtual ~Trans4x4DCT() {}
200 200
201 virtual void SetUp() { 201 virtual void SetUp() {
202 fwd_txfm_ = GET_PARAM(0); 202 fwd_txfm_ = GET_PARAM(0);
203 inv_txfm_ = GET_PARAM(1); 203 inv_txfm_ = GET_PARAM(1);
204 tx_type_ = GET_PARAM(2); 204 tx_type_ = GET_PARAM(2);
205 pitch_ = 4; 205 pitch_ = 4;
206 fwd_txfm_ref = fdct4x4_ref; 206 fwd_txfm_ref = fdct4x4_ref;
207 } 207 }
208 virtual void TearDown() { libvpx_test::ClearSystemState(); } 208 virtual void TearDown() { libvpx_test::ClearSystemState(); }
209 209
210 protected: 210 protected:
211 void RunFwdTxfm(const int16_t *in, int16_t *out, int stride) { 211 void RunFwdTxfm(const int16_t *in, int16_t *out, int stride) {
212 fwd_txfm_(in, out, stride); 212 fwd_txfm_(in, out, stride);
213 } 213 }
214 void RunInvTxfm(const int16_t *out, uint8_t *dst, int stride) { 214 void RunInvTxfm(const int16_t *out, uint8_t *dst, int stride) {
215 inv_txfm_(out, dst, stride); 215 inv_txfm_(out, dst, stride);
216 } 216 }
217 217
218 fdct_t fwd_txfm_; 218 FdctFunc fwd_txfm_;
219 idct_t inv_txfm_; 219 IdctFunc inv_txfm_;
220 }; 220 };
221 221
222 TEST_P(Trans4x4DCT, AccuracyCheck) { 222 TEST_P(Trans4x4DCT, AccuracyCheck) {
223 RunAccuracyCheck(1); 223 RunAccuracyCheck(1);
224 } 224 }
225 225
226 TEST_P(Trans4x4DCT, CoeffCheck) { 226 TEST_P(Trans4x4DCT, CoeffCheck) {
227 RunCoeffCheck(); 227 RunCoeffCheck();
228 } 228 }
229 229
230 TEST_P(Trans4x4DCT, MemCheck) { 230 TEST_P(Trans4x4DCT, MemCheck) {
231 RunMemCheck(); 231 RunMemCheck();
232 } 232 }
233 233
234 TEST_P(Trans4x4DCT, InvAccuracyCheck) { 234 TEST_P(Trans4x4DCT, InvAccuracyCheck) {
235 RunInvAccuracyCheck(1); 235 RunInvAccuracyCheck(1);
236 } 236 }
237 237
238 class Trans4x4HT 238 class Trans4x4HT
239 : public Trans4x4TestBase, 239 : public Trans4x4TestBase,
240 public ::testing::TestWithParam<ht_4x4_param_t> { 240 public ::testing::TestWithParam<Ht4x4Param> {
241 public: 241 public:
242 virtual ~Trans4x4HT() {} 242 virtual ~Trans4x4HT() {}
243 243
244 virtual void SetUp() { 244 virtual void SetUp() {
245 fwd_txfm_ = GET_PARAM(0); 245 fwd_txfm_ = GET_PARAM(0);
246 inv_txfm_ = GET_PARAM(1); 246 inv_txfm_ = GET_PARAM(1);
247 tx_type_ = GET_PARAM(2); 247 tx_type_ = GET_PARAM(2);
248 pitch_ = 4; 248 pitch_ = 4;
249 fwd_txfm_ref = fht4x4_ref; 249 fwd_txfm_ref = fht4x4_ref;
250 } 250 }
251 virtual void TearDown() { libvpx_test::ClearSystemState(); } 251 virtual void TearDown() { libvpx_test::ClearSystemState(); }
252 252
253 protected: 253 protected:
254 void RunFwdTxfm(const int16_t *in, int16_t *out, int stride) { 254 void RunFwdTxfm(const int16_t *in, int16_t *out, int stride) {
255 fwd_txfm_(in, out, stride, tx_type_); 255 fwd_txfm_(in, out, stride, tx_type_);
256 } 256 }
257 257
258 void RunInvTxfm(const int16_t *out, uint8_t *dst, int stride) { 258 void RunInvTxfm(const int16_t *out, uint8_t *dst, int stride) {
259 inv_txfm_(out, dst, stride, tx_type_); 259 inv_txfm_(out, dst, stride, tx_type_);
260 } 260 }
261 261
262 fht_t fwd_txfm_; 262 FhtFunc fwd_txfm_;
263 iht_t inv_txfm_; 263 IhtFunc inv_txfm_;
264 }; 264 };
265 265
266 TEST_P(Trans4x4HT, AccuracyCheck) { 266 TEST_P(Trans4x4HT, AccuracyCheck) {
267 RunAccuracyCheck(1); 267 RunAccuracyCheck(1);
268 } 268 }
269 269
270 TEST_P(Trans4x4HT, CoeffCheck) { 270 TEST_P(Trans4x4HT, CoeffCheck) {
271 RunCoeffCheck(); 271 RunCoeffCheck();
272 } 272 }
273 273
274 TEST_P(Trans4x4HT, MemCheck) { 274 TEST_P(Trans4x4HT, MemCheck) {
275 RunMemCheck(); 275 RunMemCheck();
276 } 276 }
277 277
278 TEST_P(Trans4x4HT, InvAccuracyCheck) { 278 TEST_P(Trans4x4HT, InvAccuracyCheck) {
279 RunInvAccuracyCheck(1); 279 RunInvAccuracyCheck(1);
280 } 280 }
281 281
282 class Trans4x4WHT 282 class Trans4x4WHT
283 : public Trans4x4TestBase, 283 : public Trans4x4TestBase,
284 public ::testing::TestWithParam<dct_4x4_param_t> { 284 public ::testing::TestWithParam<Dct4x4Param> {
285 public: 285 public:
286 virtual ~Trans4x4WHT() {} 286 virtual ~Trans4x4WHT() {}
287 287
288 virtual void SetUp() { 288 virtual void SetUp() {
289 fwd_txfm_ = GET_PARAM(0); 289 fwd_txfm_ = GET_PARAM(0);
290 inv_txfm_ = GET_PARAM(1); 290 inv_txfm_ = GET_PARAM(1);
291 tx_type_ = GET_PARAM(2); 291 tx_type_ = GET_PARAM(2);
292 pitch_ = 4; 292 pitch_ = 4;
293 fwd_txfm_ref = fwht4x4_ref; 293 fwd_txfm_ref = fwht4x4_ref;
294 } 294 }
295 virtual void TearDown() { libvpx_test::ClearSystemState(); } 295 virtual void TearDown() { libvpx_test::ClearSystemState(); }
296 296
297 protected: 297 protected:
298 void RunFwdTxfm(const int16_t *in, int16_t *out, int stride) { 298 void RunFwdTxfm(const int16_t *in, int16_t *out, int stride) {
299 fwd_txfm_(in, out, stride); 299 fwd_txfm_(in, out, stride);
300 } 300 }
301 void RunInvTxfm(const int16_t *out, uint8_t *dst, int stride) { 301 void RunInvTxfm(const int16_t *out, uint8_t *dst, int stride) {
302 inv_txfm_(out, dst, stride); 302 inv_txfm_(out, dst, stride);
303 } 303 }
304 304
305 fdct_t fwd_txfm_; 305 FdctFunc fwd_txfm_;
306 idct_t inv_txfm_; 306 IdctFunc inv_txfm_;
307 }; 307 };
308 308
309 TEST_P(Trans4x4WHT, AccuracyCheck) { 309 TEST_P(Trans4x4WHT, AccuracyCheck) {
310 RunAccuracyCheck(0); 310 RunAccuracyCheck(0);
311 } 311 }
312 312
313 TEST_P(Trans4x4WHT, CoeffCheck) { 313 TEST_P(Trans4x4WHT, CoeffCheck) {
314 RunCoeffCheck(); 314 RunCoeffCheck();
315 } 315 }
316 316
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 INSTANTIATE_TEST_CASE_P( 385 INSTANTIATE_TEST_CASE_P(
386 AVX2, Trans4x4HT, 386 AVX2, Trans4x4HT,
387 ::testing::Values( 387 ::testing::Values(
388 make_tuple(&vp9_fht4x4_avx2, &vp9_iht4x4_16_add_c, 0), 388 make_tuple(&vp9_fht4x4_avx2, &vp9_iht4x4_16_add_c, 0),
389 make_tuple(&vp9_fht4x4_avx2, &vp9_iht4x4_16_add_c, 1), 389 make_tuple(&vp9_fht4x4_avx2, &vp9_iht4x4_16_add_c, 1),
390 make_tuple(&vp9_fht4x4_avx2, &vp9_iht4x4_16_add_c, 2), 390 make_tuple(&vp9_fht4x4_avx2, &vp9_iht4x4_16_add_c, 2),
391 make_tuple(&vp9_fht4x4_avx2, &vp9_iht4x4_16_add_c, 3))); 391 make_tuple(&vp9_fht4x4_avx2, &vp9_iht4x4_16_add_c, 3)));
392 #endif 392 #endif
393 393
394 } // namespace 394 } // namespace
OLDNEW
« no previous file with comments | « source/libvpx/test/encode_test_driver.cc ('k') | source/libvpx/test/fdct8x8_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698