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 |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "vp9/common/vp9_entropy.h" | 22 #include "vp9/common/vp9_entropy.h" |
23 #include "vpx/vpx_integer.h" | 23 #include "vpx/vpx_integer.h" |
24 | 24 |
25 extern "C" { | 25 extern "C" { |
26 void vp9_idct8x8_64_add_c(const int16_t *input, uint8_t *output, int pitch); | 26 void vp9_idct8x8_64_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 typedef void (*fdct_t)(const int16_t *in, int16_t *out, int stride); | 32 typedef void (*FdctFunc)(const int16_t *in, int16_t *out, int stride); |
33 typedef void (*idct_t)(const int16_t *in, uint8_t *out, int stride); | 33 typedef void (*IdctFunc)(const int16_t *in, uint8_t *out, int stride); |
34 typedef void (*fht_t) (const int16_t *in, int16_t *out, int stride, | 34 typedef void (*FhtFunc)(const int16_t *in, int16_t *out, int stride, |
35 int tx_type); | 35 int tx_type); |
36 typedef void (*iht_t) (const int16_t *in, uint8_t *out, int stride, | 36 typedef void (*IhtFunc)(const int16_t *in, uint8_t *out, int stride, |
37 int tx_type); | 37 int tx_type); |
38 | 38 |
39 typedef std::tr1::tuple<fdct_t, idct_t, int> dct_8x8_param_t; | 39 typedef std::tr1::tuple<FdctFunc, IdctFunc, int> Dct8x8Param; |
40 typedef std::tr1::tuple<fht_t, iht_t, int> ht_8x8_param_t; | 40 typedef std::tr1::tuple<FhtFunc, IhtFunc, int> Ht8x8Param; |
41 | 41 |
42 void fdct8x8_ref(const int16_t *in, int16_t *out, int stride, int tx_type) { | 42 void fdct8x8_ref(const int16_t *in, int16_t *out, int stride, int tx_type) { |
43 vp9_fdct8x8_c(in, out, stride); | 43 vp9_fdct8x8_c(in, out, stride); |
44 } | 44 } |
45 | 45 |
46 void fht8x8_ref(const int16_t *in, int16_t *out, int stride, int tx_type) { | 46 void fht8x8_ref(const int16_t *in, int16_t *out, int stride, int tx_type) { |
47 vp9_fht8x8_c(in, out, stride, tx_type); | 47 vp9_fht8x8_c(in, out, stride, tx_type); |
48 } | 48 } |
49 | 49 |
50 class FwdTrans8x8TestBase { | 50 class FwdTrans8x8TestBase { |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 << " roundtrip error > 1/5 per block"; | 229 << " roundtrip error > 1/5 per block"; |
230 | 230 |
231 EXPECT_EQ(0, total_coeff_error) | 231 EXPECT_EQ(0, total_coeff_error) |
232 << "Error: Extremal 8x8 FDCT/FHT has" | 232 << "Error: Extremal 8x8 FDCT/FHT has" |
233 << "overflow issues in the intermediate steps > 1"; | 233 << "overflow issues in the intermediate steps > 1"; |
234 } | 234 } |
235 } | 235 } |
236 | 236 |
237 int pitch_; | 237 int pitch_; |
238 int tx_type_; | 238 int tx_type_; |
239 fht_t fwd_txfm_ref; | 239 FhtFunc fwd_txfm_ref; |
240 }; | 240 }; |
241 | 241 |
242 class FwdTrans8x8DCT | 242 class FwdTrans8x8DCT |
243 : public FwdTrans8x8TestBase, | 243 : public FwdTrans8x8TestBase, |
244 public ::testing::TestWithParam<dct_8x8_param_t> { | 244 public ::testing::TestWithParam<Dct8x8Param> { |
245 public: | 245 public: |
246 virtual ~FwdTrans8x8DCT() {} | 246 virtual ~FwdTrans8x8DCT() {} |
247 | 247 |
248 virtual void SetUp() { | 248 virtual void SetUp() { |
249 fwd_txfm_ = GET_PARAM(0); | 249 fwd_txfm_ = GET_PARAM(0); |
250 inv_txfm_ = GET_PARAM(1); | 250 inv_txfm_ = GET_PARAM(1); |
251 tx_type_ = GET_PARAM(2); | 251 tx_type_ = GET_PARAM(2); |
252 pitch_ = 8; | 252 pitch_ = 8; |
253 fwd_txfm_ref = fdct8x8_ref; | 253 fwd_txfm_ref = fdct8x8_ref; |
254 } | 254 } |
255 | 255 |
256 virtual void TearDown() { libvpx_test::ClearSystemState(); } | 256 virtual void TearDown() { libvpx_test::ClearSystemState(); } |
257 | 257 |
258 protected: | 258 protected: |
259 void RunFwdTxfm(int16_t *in, int16_t *out, int stride) { | 259 void RunFwdTxfm(int16_t *in, int16_t *out, int stride) { |
260 fwd_txfm_(in, out, stride); | 260 fwd_txfm_(in, out, stride); |
261 } | 261 } |
262 void RunInvTxfm(int16_t *out, uint8_t *dst, int stride) { | 262 void RunInvTxfm(int16_t *out, uint8_t *dst, int stride) { |
263 inv_txfm_(out, dst, stride); | 263 inv_txfm_(out, dst, stride); |
264 } | 264 } |
265 | 265 |
266 fdct_t fwd_txfm_; | 266 FdctFunc fwd_txfm_; |
267 idct_t inv_txfm_; | 267 IdctFunc inv_txfm_; |
268 }; | 268 }; |
269 | 269 |
270 TEST_P(FwdTrans8x8DCT, SignBiasCheck) { | 270 TEST_P(FwdTrans8x8DCT, SignBiasCheck) { |
271 RunSignBiasCheck(); | 271 RunSignBiasCheck(); |
272 } | 272 } |
273 | 273 |
274 TEST_P(FwdTrans8x8DCT, RoundTripErrorCheck) { | 274 TEST_P(FwdTrans8x8DCT, RoundTripErrorCheck) { |
275 RunRoundTripErrorCheck(); | 275 RunRoundTripErrorCheck(); |
276 } | 276 } |
277 | 277 |
278 TEST_P(FwdTrans8x8DCT, ExtremalCheck) { | 278 TEST_P(FwdTrans8x8DCT, ExtremalCheck) { |
279 RunExtremalCheck(); | 279 RunExtremalCheck(); |
280 } | 280 } |
281 | 281 |
282 class FwdTrans8x8HT | 282 class FwdTrans8x8HT |
283 : public FwdTrans8x8TestBase, | 283 : public FwdTrans8x8TestBase, |
284 public ::testing::TestWithParam<ht_8x8_param_t> { | 284 public ::testing::TestWithParam<Ht8x8Param> { |
285 public: | 285 public: |
286 virtual ~FwdTrans8x8HT() {} | 286 virtual ~FwdTrans8x8HT() {} |
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_ = 8; | 292 pitch_ = 8; |
293 fwd_txfm_ref = fht8x8_ref; | 293 fwd_txfm_ref = fht8x8_ref; |
294 } | 294 } |
295 | 295 |
296 virtual void TearDown() { libvpx_test::ClearSystemState(); } | 296 virtual void TearDown() { libvpx_test::ClearSystemState(); } |
297 | 297 |
298 protected: | 298 protected: |
299 void RunFwdTxfm(int16_t *in, int16_t *out, int stride) { | 299 void RunFwdTxfm(int16_t *in, int16_t *out, int stride) { |
300 fwd_txfm_(in, out, stride, tx_type_); | 300 fwd_txfm_(in, out, stride, tx_type_); |
301 } | 301 } |
302 void RunInvTxfm(int16_t *out, uint8_t *dst, int stride) { | 302 void RunInvTxfm(int16_t *out, uint8_t *dst, int stride) { |
303 inv_txfm_(out, dst, stride, tx_type_); | 303 inv_txfm_(out, dst, stride, tx_type_); |
304 } | 304 } |
305 | 305 |
306 fht_t fwd_txfm_; | 306 FhtFunc fwd_txfm_; |
307 iht_t inv_txfm_; | 307 IhtFunc inv_txfm_; |
308 }; | 308 }; |
309 | 309 |
310 TEST_P(FwdTrans8x8HT, SignBiasCheck) { | 310 TEST_P(FwdTrans8x8HT, SignBiasCheck) { |
311 RunSignBiasCheck(); | 311 RunSignBiasCheck(); |
312 } | 312 } |
313 | 313 |
314 TEST_P(FwdTrans8x8HT, RoundTripErrorCheck) { | 314 TEST_P(FwdTrans8x8HT, RoundTripErrorCheck) { |
315 RunRoundTripErrorCheck(); | 315 RunRoundTripErrorCheck(); |
316 } | 316 } |
317 | 317 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 make_tuple(&vp9_fdct8x8_avx2, &vp9_idct8x8_64_add_c, 0))); | 375 make_tuple(&vp9_fdct8x8_avx2, &vp9_idct8x8_64_add_c, 0))); |
376 INSTANTIATE_TEST_CASE_P( | 376 INSTANTIATE_TEST_CASE_P( |
377 AVX2, FwdTrans8x8HT, | 377 AVX2, FwdTrans8x8HT, |
378 ::testing::Values( | 378 ::testing::Values( |
379 make_tuple(&vp9_fht8x8_avx2, &vp9_iht8x8_64_add_c, 0), | 379 make_tuple(&vp9_fht8x8_avx2, &vp9_iht8x8_64_add_c, 0), |
380 make_tuple(&vp9_fht8x8_avx2, &vp9_iht8x8_64_add_c, 1), | 380 make_tuple(&vp9_fht8x8_avx2, &vp9_iht8x8_64_add_c, 1), |
381 make_tuple(&vp9_fht8x8_avx2, &vp9_iht8x8_64_add_c, 2), | 381 make_tuple(&vp9_fht8x8_avx2, &vp9_iht8x8_64_add_c, 2), |
382 make_tuple(&vp9_fht8x8_avx2, &vp9_iht8x8_64_add_c, 3))); | 382 make_tuple(&vp9_fht8x8_avx2, &vp9_iht8x8_64_add_c, 3))); |
383 #endif | 383 #endif |
384 } // namespace | 384 } // namespace |
OLD | NEW |