| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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_blockd.h" | 22 #include "vp9/common/vp9_blockd.h" |
| 23 #include "vp9/common/vp9_scan.h" | 23 #include "vp9/common/vp9_scan.h" |
| 24 #include "vpx/vpx_integer.h" | 24 #include "vpx/vpx_integer.h" |
| 25 | 25 |
| 26 using libvpx_test::ACMRandom; | 26 using libvpx_test::ACMRandom; |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 typedef void (*FwdTxfmFunc)(const int16_t *in, int16_t *out, int stride); | 29 typedef void (*FwdTxfmFunc)(const int16_t *in, tran_low_t *out, int stride); |
| 30 typedef void (*InvTxfmFunc)(const int16_t *in, uint8_t *out, int stride); | 30 typedef void (*InvTxfmFunc)(const tran_low_t *in, uint8_t *out, int stride); |
| 31 typedef std::tr1::tuple<FwdTxfmFunc, | 31 typedef std::tr1::tuple<FwdTxfmFunc, |
| 32 InvTxfmFunc, | 32 InvTxfmFunc, |
| 33 InvTxfmFunc, | 33 InvTxfmFunc, |
| 34 TX_SIZE, int> PartialInvTxfmParam; | 34 TX_SIZE, int> PartialInvTxfmParam; |
| 35 const int kMaxNumCoeffs = 1024; | 35 const int kMaxNumCoeffs = 1024; |
| 36 class PartialIDctTest : public ::testing::TestWithParam<PartialInvTxfmParam> { | 36 class PartialIDctTest : public ::testing::TestWithParam<PartialInvTxfmParam> { |
| 37 public: | 37 public: |
| 38 virtual ~PartialIDctTest() {} | 38 virtual ~PartialIDctTest() {} |
| 39 virtual void SetUp() { | 39 virtual void SetUp() { |
| 40 ftxfm_ = GET_PARAM(0); | 40 ftxfm_ = GET_PARAM(0); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 67 case TX_16X16: | 67 case TX_16X16: |
| 68 size = 16; | 68 size = 16; |
| 69 break; | 69 break; |
| 70 case TX_32X32: | 70 case TX_32X32: |
| 71 size = 32; | 71 size = 32; |
| 72 break; | 72 break; |
| 73 default: | 73 default: |
| 74 FAIL() << "Wrong Size!"; | 74 FAIL() << "Wrong Size!"; |
| 75 break; | 75 break; |
| 76 } | 76 } |
| 77 DECLARE_ALIGNED_ARRAY(16, int16_t, test_coef_block1, kMaxNumCoeffs); | 77 DECLARE_ALIGNED_ARRAY(16, tran_low_t, test_coef_block1, kMaxNumCoeffs); |
| 78 DECLARE_ALIGNED_ARRAY(16, int16_t, test_coef_block2, kMaxNumCoeffs); | 78 DECLARE_ALIGNED_ARRAY(16, tran_low_t, test_coef_block2, kMaxNumCoeffs); |
| 79 DECLARE_ALIGNED_ARRAY(16, uint8_t, dst1, kMaxNumCoeffs); | 79 DECLARE_ALIGNED_ARRAY(16, uint8_t, dst1, kMaxNumCoeffs); |
| 80 DECLARE_ALIGNED_ARRAY(16, uint8_t, dst2, kMaxNumCoeffs); | 80 DECLARE_ALIGNED_ARRAY(16, uint8_t, dst2, kMaxNumCoeffs); |
| 81 | 81 |
| 82 const int count_test_block = 1000; | 82 const int count_test_block = 1000; |
| 83 const int block_size = size * size; | 83 const int block_size = size * size; |
| 84 | 84 |
| 85 DECLARE_ALIGNED_ARRAY(16, int16_t, input_extreme_block, kMaxNumCoeffs); | 85 DECLARE_ALIGNED_ARRAY(16, int16_t, input_extreme_block, kMaxNumCoeffs); |
| 86 DECLARE_ALIGNED_ARRAY(16, int16_t, output_ref_block, kMaxNumCoeffs); | 86 DECLARE_ALIGNED_ARRAY(16, tran_low_t, output_ref_block, kMaxNumCoeffs); |
| 87 | 87 |
| 88 int max_error = 0; | 88 int max_error = 0; |
| 89 for (int i = 0; i < count_test_block; ++i) { | 89 for (int i = 0; i < count_test_block; ++i) { |
| 90 // clear out destination buffer | 90 // clear out destination buffer |
| 91 memset(dst1, 0, sizeof(*dst1) * block_size); | 91 memset(dst1, 0, sizeof(*dst1) * block_size); |
| 92 memset(dst2, 0, sizeof(*dst2) * block_size); | 92 memset(dst2, 0, sizeof(*dst2) * block_size); |
| 93 memset(test_coef_block1, 0, sizeof(*test_coef_block1) * block_size); | 93 memset(test_coef_block1, 0, sizeof(*test_coef_block1) * block_size); |
| 94 memset(test_coef_block2, 0, sizeof(*test_coef_block2) * block_size); | 94 memset(test_coef_block2, 0, sizeof(*test_coef_block2) * block_size); |
| 95 | 95 |
| 96 ACMRandom rnd(ACMRandom::DeterministicSeed()); | 96 ACMRandom rnd(ACMRandom::DeterministicSeed()); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 case TX_16X16: | 146 case TX_16X16: |
| 147 size = 16; | 147 size = 16; |
| 148 break; | 148 break; |
| 149 case TX_32X32: | 149 case TX_32X32: |
| 150 size = 32; | 150 size = 32; |
| 151 break; | 151 break; |
| 152 default: | 152 default: |
| 153 FAIL() << "Wrong Size!"; | 153 FAIL() << "Wrong Size!"; |
| 154 break; | 154 break; |
| 155 } | 155 } |
| 156 DECLARE_ALIGNED_ARRAY(16, int16_t, test_coef_block1, kMaxNumCoeffs); | 156 DECLARE_ALIGNED_ARRAY(16, tran_low_t, test_coef_block1, kMaxNumCoeffs); |
| 157 DECLARE_ALIGNED_ARRAY(16, int16_t, test_coef_block2, kMaxNumCoeffs); | 157 DECLARE_ALIGNED_ARRAY(16, tran_low_t, test_coef_block2, kMaxNumCoeffs); |
| 158 DECLARE_ALIGNED_ARRAY(16, uint8_t, dst1, kMaxNumCoeffs); | 158 DECLARE_ALIGNED_ARRAY(16, uint8_t, dst1, kMaxNumCoeffs); |
| 159 DECLARE_ALIGNED_ARRAY(16, uint8_t, dst2, kMaxNumCoeffs); | 159 DECLARE_ALIGNED_ARRAY(16, uint8_t, dst2, kMaxNumCoeffs); |
| 160 const int count_test_block = 1000; | 160 const int count_test_block = 1000; |
| 161 const int max_coeff = 32766 / 4; | 161 const int max_coeff = 32766 / 4; |
| 162 const int block_size = size * size; | 162 const int block_size = size * size; |
| 163 int max_error = 0; | 163 int max_error = 0; |
| 164 for (int i = 0; i < count_test_block; ++i) { | 164 for (int i = 0; i < count_test_block; ++i) { |
| 165 // clear out destination buffer | 165 // clear out destination buffer |
| 166 memset(dst1, 0, sizeof(*dst1) * block_size); | 166 memset(dst1, 0, sizeof(*dst1) * block_size); |
| 167 memset(dst2, 0, sizeof(*dst2) * block_size); | 167 memset(dst2, 0, sizeof(*dst2) * block_size); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 &vp9_idct8x8_12_add_c, | 222 &vp9_idct8x8_12_add_c, |
| 223 TX_8X8, 12), | 223 TX_8X8, 12), |
| 224 make_tuple(&vp9_fdct8x8_c, | 224 make_tuple(&vp9_fdct8x8_c, |
| 225 &vp9_idct8x8_64_add_c, | 225 &vp9_idct8x8_64_add_c, |
| 226 &vp9_idct8x8_1_add_c, | 226 &vp9_idct8x8_1_add_c, |
| 227 TX_8X8, 1), | 227 TX_8X8, 1), |
| 228 make_tuple(&vp9_fdct4x4_c, | 228 make_tuple(&vp9_fdct4x4_c, |
| 229 &vp9_idct4x4_16_add_c, | 229 &vp9_idct4x4_16_add_c, |
| 230 &vp9_idct4x4_1_add_c, | 230 &vp9_idct4x4_1_add_c, |
| 231 TX_4X4, 1))); | 231 TX_4X4, 1))); |
| 232 |
| 232 #if HAVE_NEON_ASM | 233 #if HAVE_NEON_ASM |
| 233 INSTANTIATE_TEST_CASE_P( | 234 INSTANTIATE_TEST_CASE_P( |
| 234 NEON, PartialIDctTest, | 235 NEON, PartialIDctTest, |
| 235 ::testing::Values( | 236 ::testing::Values( |
| 236 make_tuple(&vp9_fdct32x32_c, | 237 make_tuple(&vp9_fdct32x32_c, |
| 237 &vp9_idct32x32_1024_add_c, | 238 &vp9_idct32x32_1024_add_c, |
| 238 &vp9_idct32x32_1_add_neon, | 239 &vp9_idct32x32_1_add_neon, |
| 239 TX_32X32, 1), | 240 TX_32X32, 1), |
| 240 make_tuple(&vp9_fdct16x16_c, | 241 make_tuple(&vp9_fdct16x16_c, |
| 241 &vp9_idct16x16_256_add_c, | 242 &vp9_idct16x16_256_add_c, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 252 make_tuple(&vp9_fdct8x8_c, | 253 make_tuple(&vp9_fdct8x8_c, |
| 253 &vp9_idct8x8_64_add_c, | 254 &vp9_idct8x8_64_add_c, |
| 254 &vp9_idct8x8_1_add_neon, | 255 &vp9_idct8x8_1_add_neon, |
| 255 TX_8X8, 1), | 256 TX_8X8, 1), |
| 256 make_tuple(&vp9_fdct4x4_c, | 257 make_tuple(&vp9_fdct4x4_c, |
| 257 &vp9_idct4x4_16_add_c, | 258 &vp9_idct4x4_16_add_c, |
| 258 &vp9_idct4x4_1_add_neon, | 259 &vp9_idct4x4_1_add_neon, |
| 259 TX_4X4, 1))); | 260 TX_4X4, 1))); |
| 260 #endif | 261 #endif |
| 261 | 262 |
| 262 #if HAVE_SSE2 | 263 #if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH |
| 263 INSTANTIATE_TEST_CASE_P( | 264 INSTANTIATE_TEST_CASE_P( |
| 264 SSE2, PartialIDctTest, | 265 SSE2, PartialIDctTest, |
| 265 ::testing::Values( | 266 ::testing::Values( |
| 266 make_tuple(&vp9_fdct32x32_c, | 267 make_tuple(&vp9_fdct32x32_c, |
| 267 &vp9_idct32x32_1024_add_c, | 268 &vp9_idct32x32_1024_add_c, |
| 268 &vp9_idct32x32_34_add_sse2, | 269 &vp9_idct32x32_34_add_sse2, |
| 269 TX_32X32, 34), | 270 TX_32X32, 34), |
| 270 make_tuple(&vp9_fdct32x32_c, | 271 make_tuple(&vp9_fdct32x32_c, |
| 271 &vp9_idct32x32_1024_add_c, | 272 &vp9_idct32x32_1024_add_c, |
| 272 &vp9_idct32x32_1_add_sse2, | 273 &vp9_idct32x32_1_add_sse2, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 286 make_tuple(&vp9_fdct8x8_c, | 287 make_tuple(&vp9_fdct8x8_c, |
| 287 &vp9_idct8x8_64_add_c, | 288 &vp9_idct8x8_64_add_c, |
| 288 &vp9_idct8x8_1_add_sse2, | 289 &vp9_idct8x8_1_add_sse2, |
| 289 TX_8X8, 1), | 290 TX_8X8, 1), |
| 290 make_tuple(&vp9_fdct4x4_c, | 291 make_tuple(&vp9_fdct4x4_c, |
| 291 &vp9_idct4x4_16_add_c, | 292 &vp9_idct4x4_16_add_c, |
| 292 &vp9_idct4x4_1_add_sse2, | 293 &vp9_idct4x4_1_add_sse2, |
| 293 TX_4X4, 1))); | 294 TX_4X4, 1))); |
| 294 #endif | 295 #endif |
| 295 | 296 |
| 296 #if HAVE_SSSE3 && ARCH_X86_64 | 297 #if HAVE_SSSE3 && ARCH_X86_64 && !CONFIG_VP9_HIGHBITDEPTH |
| 297 INSTANTIATE_TEST_CASE_P( | 298 INSTANTIATE_TEST_CASE_P( |
| 298 SSSE3_64, PartialIDctTest, | 299 SSSE3_64, PartialIDctTest, |
| 299 ::testing::Values( | 300 ::testing::Values( |
| 300 make_tuple(&vp9_fdct8x8_c, | 301 make_tuple(&vp9_fdct8x8_c, |
| 301 &vp9_idct8x8_64_add_c, | 302 &vp9_idct8x8_64_add_c, |
| 302 &vp9_idct8x8_12_add_ssse3, | 303 &vp9_idct8x8_12_add_ssse3, |
| 303 TX_8X8, 12))); | 304 TX_8X8, 12))); |
| 304 #endif | 305 #endif |
| 305 | 306 |
| 306 #if HAVE_SSSE3 | 307 #if HAVE_SSSE3 && !CONFIG_VP9_HIGHBITDEPTH |
| 307 INSTANTIATE_TEST_CASE_P( | 308 INSTANTIATE_TEST_CASE_P( |
| 308 SSSE3, PartialIDctTest, | 309 SSSE3, PartialIDctTest, |
| 309 ::testing::Values( | 310 ::testing::Values( |
| 310 make_tuple(&vp9_fdct16x16_c, | 311 make_tuple(&vp9_fdct16x16_c, |
| 311 &vp9_idct16x16_256_add_c, | 312 &vp9_idct16x16_256_add_c, |
| 312 &vp9_idct16x16_10_add_ssse3, | 313 &vp9_idct16x16_10_add_ssse3, |
| 313 TX_16X16, 10))); | 314 TX_16X16, 10))); |
| 314 #endif | 315 #endif |
| 315 } // namespace | 316 } // namespace |
| OLD | NEW |