| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 // Test and time VP9 intra-predictor functions | 10 // Test and time VP9 intra-predictor functions |
| 11 | 11 |
| 12 #include <stdio.h> | 12 #include <stdio.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 | 16 |
| 17 #include "./vp9_rtcd.h" | 17 #include "./vp9_rtcd.h" |
| 18 #include "test/acm_random.h" | 18 #include "test/acm_random.h" |
| 19 #include "test/clear_system_state.h" |
| 19 #include "test/md5_helper.h" | 20 #include "test/md5_helper.h" |
| 20 #include "vpx/vpx_integer.h" | 21 #include "vpx/vpx_integer.h" |
| 21 #include "vpx_ports/mem.h" | 22 #include "vpx_ports/mem.h" |
| 22 #include "vpx_ports/vpx_timer.h" | 23 #include "vpx_ports/vpx_timer.h" |
| 23 | 24 |
| 24 // ----------------------------------------------------------------------------- | 25 // ----------------------------------------------------------------------------- |
| 25 | 26 |
| 26 namespace { | 27 namespace { |
| 27 | 28 |
| 28 typedef void (*VpxPredFunc)(uint8_t *dst, ptrdiff_t y_stride, | 29 typedef void (*VpxPredFunc)(uint8_t *dst, ptrdiff_t y_stride, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 59 memset(above + block_size, above[block_size - 1], 2 * kBPS - block_size); | 60 memset(above + block_size, above[block_size - 1], 2 * kBPS - block_size); |
| 60 | 61 |
| 61 for (int k = 0; k < num_funcs; ++k) { | 62 for (int k = 0; k < num_funcs; ++k) { |
| 62 if (pred_funcs[k] == NULL) continue; | 63 if (pred_funcs[k] == NULL) continue; |
| 63 memcpy(src, ref_src, sizeof(src)); | 64 memcpy(src, ref_src, sizeof(src)); |
| 64 vpx_usec_timer timer; | 65 vpx_usec_timer timer; |
| 65 vpx_usec_timer_start(&timer); | 66 vpx_usec_timer_start(&timer); |
| 66 for (int num_tests = 0; num_tests < kNumTests; ++num_tests) { | 67 for (int num_tests = 0; num_tests < kNumTests; ++num_tests) { |
| 67 pred_funcs[k](src, kBPS, above, left); | 68 pred_funcs[k](src, kBPS, above, left); |
| 68 } | 69 } |
| 70 libvpx_test::ClearSystemState(); |
| 69 vpx_usec_timer_mark(&timer); | 71 vpx_usec_timer_mark(&timer); |
| 70 const int elapsed_time = | 72 const int elapsed_time = |
| 71 static_cast<int>(vpx_usec_timer_elapsed(&timer) / 1000); | 73 static_cast<int>(vpx_usec_timer_elapsed(&timer) / 1000); |
| 72 libvpx_test::MD5 md5; | 74 libvpx_test::MD5 md5; |
| 73 md5.Add(src, sizeof(src)); | 75 md5.Add(src, sizeof(src)); |
| 74 printf("Mode %s[%12s]: %5d ms MD5: %s\n", name, pred_func_names[k], | 76 printf("Mode %s[%12s]: %5d ms MD5: %s\n", name, pred_func_names[k], |
| 75 elapsed_time, md5.Get()); | 77 elapsed_time, md5.Get()); |
| 76 EXPECT_STREQ(signatures[k], md5.Get()); | 78 EXPECT_STREQ(signatures[k], md5.Get()); |
| 77 } | 79 } |
| 78 } | 80 } |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 vp9_d207_predictor_4x4_ssse3, vp9_d63_predictor_4x4_ssse3, NULL) | 201 vp9_d207_predictor_4x4_ssse3, vp9_d63_predictor_4x4_ssse3, NULL) |
| 200 #endif // HAVE_SSSE3 | 202 #endif // HAVE_SSSE3 |
| 201 | 203 |
| 202 #if HAVE_DSPR2 | 204 #if HAVE_DSPR2 |
| 203 INTRA_PRED_TEST(DSPR2, TestIntraPred4, vp9_dc_predictor_4x4_dspr2, NULL, NULL, | 205 INTRA_PRED_TEST(DSPR2, TestIntraPred4, vp9_dc_predictor_4x4_dspr2, NULL, NULL, |
| 204 NULL, NULL, vp9_h_predictor_4x4_dspr2, NULL, NULL, NULL, NULL, | 206 NULL, NULL, vp9_h_predictor_4x4_dspr2, NULL, NULL, NULL, NULL, |
| 205 NULL, NULL, vp9_tm_predictor_4x4_dspr2) | 207 NULL, NULL, vp9_tm_predictor_4x4_dspr2) |
| 206 #endif // HAVE_DSPR2 | 208 #endif // HAVE_DSPR2 |
| 207 | 209 |
| 208 #if HAVE_NEON | 210 #if HAVE_NEON |
| 209 INTRA_PRED_TEST(NEON, TestIntraPred4, NULL, NULL, NULL, NULL, | 211 INTRA_PRED_TEST(NEON, TestIntraPred4, vp9_dc_predictor_4x4_neon, |
| 210 vp9_v_predictor_4x4_neon, vp9_h_predictor_4x4_neon, NULL, NULL, | 212 vp9_dc_left_predictor_4x4_neon, vp9_dc_top_predictor_4x4_neon, |
| 211 NULL, NULL, NULL, NULL, vp9_tm_predictor_4x4_neon) | 213 vp9_dc_128_predictor_4x4_neon, vp9_v_predictor_4x4_neon, |
| 214 vp9_h_predictor_4x4_neon, vp9_d45_predictor_4x4_neon, |
| 215 vp9_d135_predictor_4x4_neon, NULL, NULL, NULL, NULL, |
| 216 vp9_tm_predictor_4x4_neon) |
| 212 #endif // HAVE_NEON | 217 #endif // HAVE_NEON |
| 213 | 218 |
| 219 #if HAVE_MSA |
| 220 INTRA_PRED_TEST(MSA, TestIntraPred4, vp9_dc_predictor_4x4_msa, |
| 221 vp9_dc_left_predictor_4x4_msa, vp9_dc_top_predictor_4x4_msa, |
| 222 vp9_dc_128_predictor_4x4_msa, vp9_v_predictor_4x4_msa, |
| 223 vp9_h_predictor_4x4_msa, NULL, NULL, NULL, NULL, NULL, |
| 224 NULL, vp9_tm_predictor_4x4_msa) |
| 225 #endif // HAVE_MSA |
| 226 |
| 214 // ----------------------------------------------------------------------------- | 227 // ----------------------------------------------------------------------------- |
| 215 // 8x8 | 228 // 8x8 |
| 216 | 229 |
| 217 INTRA_PRED_TEST(C, TestIntraPred8, vp9_dc_predictor_8x8_c, | 230 INTRA_PRED_TEST(C, TestIntraPred8, vp9_dc_predictor_8x8_c, |
| 218 vp9_dc_left_predictor_8x8_c, vp9_dc_top_predictor_8x8_c, | 231 vp9_dc_left_predictor_8x8_c, vp9_dc_top_predictor_8x8_c, |
| 219 vp9_dc_128_predictor_8x8_c, vp9_v_predictor_8x8_c, | 232 vp9_dc_128_predictor_8x8_c, vp9_v_predictor_8x8_c, |
| 220 vp9_h_predictor_8x8_c, vp9_d45_predictor_8x8_c, | 233 vp9_h_predictor_8x8_c, vp9_d45_predictor_8x8_c, |
| 221 vp9_d135_predictor_8x8_c, vp9_d117_predictor_8x8_c, | 234 vp9_d135_predictor_8x8_c, vp9_d117_predictor_8x8_c, |
| 222 vp9_d153_predictor_8x8_c, vp9_d207_predictor_8x8_c, | 235 vp9_d153_predictor_8x8_c, vp9_d207_predictor_8x8_c, |
| 223 vp9_d63_predictor_8x8_c, vp9_tm_predictor_8x8_c) | 236 vp9_d63_predictor_8x8_c, vp9_tm_predictor_8x8_c) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 244 #if HAVE_DSPR2 | 257 #if HAVE_DSPR2 |
| 245 INTRA_PRED_TEST(DSPR2, TestIntraPred8, vp9_dc_predictor_8x8_dspr2, NULL, NULL, | 258 INTRA_PRED_TEST(DSPR2, TestIntraPred8, vp9_dc_predictor_8x8_dspr2, NULL, NULL, |
| 246 NULL, NULL, vp9_h_predictor_8x8_dspr2, NULL, NULL, NULL, NULL, | 259 NULL, NULL, vp9_h_predictor_8x8_dspr2, NULL, NULL, NULL, NULL, |
| 247 NULL, NULL, vp9_tm_predictor_8x8_c) | 260 NULL, NULL, vp9_tm_predictor_8x8_c) |
| 248 #endif // HAVE_DSPR2 | 261 #endif // HAVE_DSPR2 |
| 249 | 262 |
| 250 #if HAVE_NEON | 263 #if HAVE_NEON |
| 251 INTRA_PRED_TEST(NEON, TestIntraPred8, vp9_dc_predictor_8x8_neon, | 264 INTRA_PRED_TEST(NEON, TestIntraPred8, vp9_dc_predictor_8x8_neon, |
| 252 vp9_dc_left_predictor_8x8_neon, vp9_dc_top_predictor_8x8_neon, | 265 vp9_dc_left_predictor_8x8_neon, vp9_dc_top_predictor_8x8_neon, |
| 253 vp9_dc_128_predictor_8x8_neon, vp9_v_predictor_8x8_neon, | 266 vp9_dc_128_predictor_8x8_neon, vp9_v_predictor_8x8_neon, |
| 254 vp9_h_predictor_8x8_neon, NULL, NULL, NULL, NULL, NULL, NULL, | 267 vp9_h_predictor_8x8_neon, vp9_d45_predictor_8x8_neon, NULL, |
| 255 vp9_tm_predictor_8x8_neon) | 268 NULL, NULL, NULL, NULL, vp9_tm_predictor_8x8_neon) |
| 256 | 269 |
| 257 #endif // HAVE_NEON | 270 #endif // HAVE_NEON |
| 258 | 271 |
| 272 #if HAVE_MSA |
| 273 INTRA_PRED_TEST(MSA, TestIntraPred8, vp9_dc_predictor_8x8_msa, |
| 274 vp9_dc_left_predictor_8x8_msa, vp9_dc_top_predictor_8x8_msa, |
| 275 vp9_dc_128_predictor_8x8_msa, vp9_v_predictor_8x8_msa, |
| 276 vp9_h_predictor_8x8_msa, NULL, NULL, NULL, NULL, NULL, |
| 277 NULL, vp9_tm_predictor_8x8_msa) |
| 278 #endif // HAVE_MSA |
| 279 |
| 259 // ----------------------------------------------------------------------------- | 280 // ----------------------------------------------------------------------------- |
| 260 // 16x16 | 281 // 16x16 |
| 261 | 282 |
| 262 INTRA_PRED_TEST(C, TestIntraPred16, vp9_dc_predictor_16x16_c, | 283 INTRA_PRED_TEST(C, TestIntraPred16, vp9_dc_predictor_16x16_c, |
| 263 vp9_dc_left_predictor_16x16_c, vp9_dc_top_predictor_16x16_c, | 284 vp9_dc_left_predictor_16x16_c, vp9_dc_top_predictor_16x16_c, |
| 264 vp9_dc_128_predictor_16x16_c, vp9_v_predictor_16x16_c, | 285 vp9_dc_128_predictor_16x16_c, vp9_v_predictor_16x16_c, |
| 265 vp9_h_predictor_16x16_c, vp9_d45_predictor_16x16_c, | 286 vp9_h_predictor_16x16_c, vp9_d45_predictor_16x16_c, |
| 266 vp9_d135_predictor_16x16_c, vp9_d117_predictor_16x16_c, | 287 vp9_d135_predictor_16x16_c, vp9_d117_predictor_16x16_c, |
| 267 vp9_d153_predictor_16x16_c, vp9_d207_predictor_16x16_c, | 288 vp9_d153_predictor_16x16_c, vp9_d207_predictor_16x16_c, |
| 268 vp9_d63_predictor_16x16_c, vp9_tm_predictor_16x16_c) | 289 vp9_d63_predictor_16x16_c, vp9_tm_predictor_16x16_c) |
| (...skipping 19 matching lines...) Expand all Loading... |
| 288 INTRA_PRED_TEST(DSPR2, TestIntraPred16, vp9_dc_predictor_16x16_dspr2, NULL, | 309 INTRA_PRED_TEST(DSPR2, TestIntraPred16, vp9_dc_predictor_16x16_dspr2, NULL, |
| 289 NULL, NULL, NULL, vp9_h_predictor_16x16_dspr2, NULL, NULL, NULL, | 310 NULL, NULL, NULL, vp9_h_predictor_16x16_dspr2, NULL, NULL, NULL, |
| 290 NULL, NULL, NULL, NULL) | 311 NULL, NULL, NULL, NULL) |
| 291 #endif // HAVE_DSPR2 | 312 #endif // HAVE_DSPR2 |
| 292 | 313 |
| 293 #if HAVE_NEON | 314 #if HAVE_NEON |
| 294 INTRA_PRED_TEST(NEON, TestIntraPred16, vp9_dc_predictor_16x16_neon, | 315 INTRA_PRED_TEST(NEON, TestIntraPred16, vp9_dc_predictor_16x16_neon, |
| 295 vp9_dc_left_predictor_16x16_neon, | 316 vp9_dc_left_predictor_16x16_neon, |
| 296 vp9_dc_top_predictor_16x16_neon, | 317 vp9_dc_top_predictor_16x16_neon, |
| 297 vp9_dc_128_predictor_16x16_neon, vp9_v_predictor_16x16_neon, | 318 vp9_dc_128_predictor_16x16_neon, vp9_v_predictor_16x16_neon, |
| 298 vp9_h_predictor_16x16_neon, NULL, NULL, NULL, NULL, NULL, NULL, | 319 vp9_h_predictor_16x16_neon, vp9_d45_predictor_16x16_neon, NULL, |
| 299 vp9_tm_predictor_16x16_neon) | 320 NULL, NULL, NULL, NULL, vp9_tm_predictor_16x16_neon) |
| 300 #endif // HAVE_NEON | 321 #endif // HAVE_NEON |
| 301 | 322 |
| 323 #if HAVE_MSA |
| 324 INTRA_PRED_TEST(MSA, TestIntraPred16, vp9_dc_predictor_16x16_msa, |
| 325 vp9_dc_left_predictor_16x16_msa, vp9_dc_top_predictor_16x16_msa, |
| 326 vp9_dc_128_predictor_16x16_msa, vp9_v_predictor_16x16_msa, |
| 327 vp9_h_predictor_16x16_msa, NULL, NULL, NULL, NULL, NULL, |
| 328 NULL, vp9_tm_predictor_16x16_msa) |
| 329 #endif // HAVE_MSA |
| 330 |
| 302 // ----------------------------------------------------------------------------- | 331 // ----------------------------------------------------------------------------- |
| 303 // 32x32 | 332 // 32x32 |
| 304 | 333 |
| 305 INTRA_PRED_TEST(C, TestIntraPred32, vp9_dc_predictor_32x32_c, | 334 INTRA_PRED_TEST(C, TestIntraPred32, vp9_dc_predictor_32x32_c, |
| 306 vp9_dc_left_predictor_32x32_c, vp9_dc_top_predictor_32x32_c, | 335 vp9_dc_left_predictor_32x32_c, vp9_dc_top_predictor_32x32_c, |
| 307 vp9_dc_128_predictor_32x32_c, vp9_v_predictor_32x32_c, | 336 vp9_dc_128_predictor_32x32_c, vp9_v_predictor_32x32_c, |
| 308 vp9_h_predictor_32x32_c, vp9_d45_predictor_32x32_c, | 337 vp9_h_predictor_32x32_c, vp9_d45_predictor_32x32_c, |
| 309 vp9_d135_predictor_32x32_c, vp9_d117_predictor_32x32_c, | 338 vp9_d135_predictor_32x32_c, vp9_d117_predictor_32x32_c, |
| 310 vp9_d153_predictor_32x32_c, vp9_d207_predictor_32x32_c, | 339 vp9_d153_predictor_32x32_c, vp9_d207_predictor_32x32_c, |
| 311 vp9_d63_predictor_32x32_c, vp9_tm_predictor_32x32_c) | 340 vp9_d63_predictor_32x32_c, vp9_tm_predictor_32x32_c) |
| 312 | 341 |
| 313 #if HAVE_SSE2 | 342 #if HAVE_SSE2 |
| 343 #if ARCH_X86_64 |
| 314 INTRA_PRED_TEST(SSE2, TestIntraPred32, vp9_dc_predictor_32x32_sse2, | 344 INTRA_PRED_TEST(SSE2, TestIntraPred32, vp9_dc_predictor_32x32_sse2, |
| 315 vp9_dc_left_predictor_32x32_sse2, | 345 vp9_dc_left_predictor_32x32_sse2, |
| 316 vp9_dc_top_predictor_32x32_sse2, | 346 vp9_dc_top_predictor_32x32_sse2, |
| 317 vp9_dc_128_predictor_32x32_sse2, vp9_v_predictor_32x32_sse2, | 347 vp9_dc_128_predictor_32x32_sse2, vp9_v_predictor_32x32_sse2, |
| 318 NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 348 NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
| 319 #if ARCH_X86_64 | 349 vp9_tm_predictor_32x32_sse2) |
| 320 vp9_tm_predictor_32x32_sse2 | |
| 321 #else | 350 #else |
| 322 NULL | 351 INTRA_PRED_TEST(SSE2, TestIntraPred32, vp9_dc_predictor_32x32_sse2, |
| 323 #endif | 352 vp9_dc_left_predictor_32x32_sse2, |
| 324 ) | 353 vp9_dc_top_predictor_32x32_sse2, |
| 354 vp9_dc_128_predictor_32x32_sse2, vp9_v_predictor_32x32_sse2, |
| 355 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) |
| 356 #endif // ARCH_X86_64 |
| 325 #endif // HAVE_SSE2 | 357 #endif // HAVE_SSE2 |
| 326 | 358 |
| 327 #if HAVE_SSSE3 | 359 #if HAVE_SSSE3 |
| 328 INTRA_PRED_TEST(SSSE3, TestIntraPred32, NULL, NULL, NULL, NULL, NULL, | 360 INTRA_PRED_TEST(SSSE3, TestIntraPred32, NULL, NULL, NULL, NULL, NULL, |
| 329 vp9_h_predictor_32x32_ssse3, vp9_d45_predictor_32x32_ssse3, | 361 vp9_h_predictor_32x32_ssse3, vp9_d45_predictor_32x32_ssse3, |
| 330 NULL, NULL, NULL, vp9_d207_predictor_32x32_ssse3, | 362 NULL, NULL, vp9_d153_predictor_32x32_ssse3, |
| 331 vp9_d63_predictor_32x32_ssse3, NULL) | 363 vp9_d207_predictor_32x32_ssse3, vp9_d63_predictor_32x32_ssse3, |
| 364 NULL) |
| 332 #endif // HAVE_SSSE3 | 365 #endif // HAVE_SSSE3 |
| 333 | 366 |
| 334 #if HAVE_NEON | 367 #if HAVE_NEON |
| 335 INTRA_PRED_TEST(NEON, TestIntraPred32, NULL, NULL, NULL, NULL, | 368 INTRA_PRED_TEST(NEON, TestIntraPred32, vp9_dc_predictor_32x32_neon, |
| 336 vp9_v_predictor_32x32_neon, vp9_h_predictor_32x32_neon, NULL, | 369 vp9_dc_left_predictor_32x32_neon, |
| 337 NULL, NULL, NULL, NULL, NULL, vp9_tm_predictor_32x32_neon) | 370 vp9_dc_top_predictor_32x32_neon, |
| 371 vp9_dc_128_predictor_32x32_neon, vp9_v_predictor_32x32_neon, |
| 372 vp9_h_predictor_32x32_neon, NULL, NULL, NULL, NULL, NULL, NULL, |
| 373 vp9_tm_predictor_32x32_neon) |
| 338 #endif // HAVE_NEON | 374 #endif // HAVE_NEON |
| 339 | 375 |
| 376 #if HAVE_MSA |
| 377 INTRA_PRED_TEST(MSA, TestIntraPred32, vp9_dc_predictor_32x32_msa, |
| 378 vp9_dc_left_predictor_32x32_msa, vp9_dc_top_predictor_32x32_msa, |
| 379 vp9_dc_128_predictor_32x32_msa, vp9_v_predictor_32x32_msa, |
| 380 vp9_h_predictor_32x32_msa, NULL, NULL, NULL, NULL, NULL, |
| 381 NULL, vp9_tm_predictor_32x32_msa) |
| 382 #endif // HAVE_MSA |
| 383 |
| 340 #include "test/test_libvpx.cc" | 384 #include "test/test_libvpx.cc" |
| OLD | NEW |