| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 The LibYuv Project Authors. All rights reserved. | 2 * Copyright 2011 The LibYuv 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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ | 420 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ |
| 421 benchmark_width_, _Invert, -, 0) \ | 421 benchmark_width_, _Invert, -, 0) \ |
| 422 TESTPLANARTOBPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \ | 422 TESTPLANARTOBPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \ |
| 423 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ | 423 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ |
| 424 benchmark_width_, _Opt, +, 0) | 424 benchmark_width_, _Opt, +, 0) |
| 425 | 425 |
| 426 TESTPLANARTOBP(I420, 2, 2, NV12, 2, 2) | 426 TESTPLANARTOBP(I420, 2, 2, NV12, 2, 2) |
| 427 TESTPLANARTOBP(I420, 2, 2, NV21, 2, 2) | 427 TESTPLANARTOBP(I420, 2, 2, NV21, 2, 2) |
| 428 | 428 |
| 429 #define TESTBIPLANARTOPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \ | 429 #define TESTBIPLANARTOPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \ |
| 430 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, W1280, N, NEG, OFF) \ | 430 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, W1280, N, NEG, OFF, \ |
| 431 DOY) \ |
| 431 TEST_F(LibYUVConvertTest, SRC_FMT_PLANAR##To##FMT_PLANAR##N) { \ | 432 TEST_F(LibYUVConvertTest, SRC_FMT_PLANAR##To##FMT_PLANAR##N) { \ |
| 432 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \ | 433 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \ |
| 433 const int kHeight = benchmark_height_; \ | 434 const int kHeight = benchmark_height_; \ |
| 434 align_buffer_page_end(src_y, kWidth * kHeight + OFF); \ | 435 align_buffer_page_end(src_y, kWidth * kHeight + OFF); \ |
| 435 align_buffer_page_end(src_uv, 2 * SUBSAMPLE(kWidth, SRC_SUBSAMP_X) * \ | 436 align_buffer_page_end(src_uv, 2 * SUBSAMPLE(kWidth, SRC_SUBSAMP_X) * \ |
| 436 SUBSAMPLE(kHeight, SRC_SUBSAMP_Y) + OFF); \ | 437 SUBSAMPLE(kHeight, SRC_SUBSAMP_Y) + OFF); \ |
| 437 align_buffer_page_end(dst_y_c, kWidth * kHeight); \ | 438 align_buffer_page_end(dst_y_c, kWidth * kHeight); \ |
| 438 align_buffer_page_end(dst_u_c, \ | 439 align_buffer_page_end(dst_u_c, \ |
| 439 SUBSAMPLE(kWidth, SUBSAMP_X) * \ | 440 SUBSAMPLE(kWidth, SUBSAMP_X) * \ |
| 440 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ | 441 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ |
| (...skipping 23 matching lines...) Expand all Loading... |
| 464 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ | 465 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ |
| 465 memset(dst_y_opt, 101, kWidth * kHeight); \ | 466 memset(dst_y_opt, 101, kWidth * kHeight); \ |
| 466 memset(dst_u_opt, 102, SUBSAMPLE(kWidth, SUBSAMP_X) * \ | 467 memset(dst_u_opt, 102, SUBSAMPLE(kWidth, SUBSAMP_X) * \ |
| 467 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ | 468 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ |
| 468 memset(dst_v_opt, 103, SUBSAMPLE(kWidth, SUBSAMP_X) * \ | 469 memset(dst_v_opt, 103, SUBSAMPLE(kWidth, SUBSAMP_X) * \ |
| 469 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ | 470 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ |
| 470 MaskCpuFlags(disable_cpu_flags_); \ | 471 MaskCpuFlags(disable_cpu_flags_); \ |
| 471 SRC_FMT_PLANAR##To##FMT_PLANAR(src_y + OFF, kWidth, \ | 472 SRC_FMT_PLANAR##To##FMT_PLANAR(src_y + OFF, kWidth, \ |
| 472 src_uv + OFF, \ | 473 src_uv + OFF, \ |
| 473 2 * SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \ | 474 2 * SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \ |
| 474 dst_y_c, kWidth, \ | 475 DOY ? dst_y_c : NULL, kWidth, \ |
| 475 dst_u_c, SUBSAMPLE(kWidth, SUBSAMP_X), \ | 476 dst_u_c, SUBSAMPLE(kWidth, SUBSAMP_X), \ |
| 476 dst_v_c, SUBSAMPLE(kWidth, SUBSAMP_X), \ | 477 dst_v_c, SUBSAMPLE(kWidth, SUBSAMP_X), \ |
| 477 kWidth, NEG kHeight); \ | 478 kWidth, NEG kHeight); \ |
| 478 MaskCpuFlags(benchmark_cpu_info_); \ | 479 MaskCpuFlags(benchmark_cpu_info_); \ |
| 479 for (int i = 0; i < benchmark_iterations_; ++i) { \ | 480 for (int i = 0; i < benchmark_iterations_; ++i) { \ |
| 480 SRC_FMT_PLANAR##To##FMT_PLANAR(src_y + OFF, kWidth, \ | 481 SRC_FMT_PLANAR##To##FMT_PLANAR(src_y + OFF, kWidth, \ |
| 481 src_uv + OFF, \ | 482 src_uv + OFF, \ |
| 482 2 * SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \ | 483 2 * SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \ |
| 483 dst_y_opt, kWidth, \ | 484 DOY ? dst_y_opt : NULL, kWidth, \ |
| 484 dst_u_opt, SUBSAMPLE(kWidth, SUBSAMP_X), \ | 485 dst_u_opt, SUBSAMPLE(kWidth, SUBSAMP_X), \ |
| 485 dst_v_opt, SUBSAMPLE(kWidth, SUBSAMP_X), \ | 486 dst_v_opt, SUBSAMPLE(kWidth, SUBSAMP_X), \ |
| 486 kWidth, NEG kHeight); \ | 487 kWidth, NEG kHeight); \ |
| 487 } \ | 488 } \ |
| 488 int max_diff = 0; \ | 489 int max_diff = 0; \ |
| 489 for (int i = 0; i < kHeight; ++i) { \ | 490 if (DOY) { \ |
| 490 for (int j = 0; j < kWidth; ++j) { \ | 491 for (int i = 0; i < kHeight; ++i) { \ |
| 491 int abs_diff = \ | 492 for (int j = 0; j < kWidth; ++j) { \ |
| 492 abs(static_cast<int>(dst_y_c[i * kWidth + j]) - \ | 493 int abs_diff = \ |
| 493 static_cast<int>(dst_y_opt[i * kWidth + j])); \ | 494 abs(static_cast<int>(dst_y_c[i * kWidth + j]) - \ |
| 494 if (abs_diff > max_diff) { \ | 495 static_cast<int>(dst_y_opt[i * kWidth + j])); \ |
| 495 max_diff = abs_diff; \ | 496 if (abs_diff > max_diff) { \ |
| 497 max_diff = abs_diff; \ |
| 498 } \ |
| 496 } \ | 499 } \ |
| 497 } \ | 500 } \ |
| 501 EXPECT_LE(max_diff, 1); \ |
| 498 } \ | 502 } \ |
| 499 EXPECT_LE(max_diff, 1); \ | |
| 500 for (int i = 0; i < SUBSAMPLE(kHeight, SUBSAMP_Y); ++i) { \ | 503 for (int i = 0; i < SUBSAMPLE(kHeight, SUBSAMP_Y); ++i) { \ |
| 501 for (int j = 0; j < SUBSAMPLE(kWidth, SUBSAMP_X); ++j) { \ | 504 for (int j = 0; j < SUBSAMPLE(kWidth, SUBSAMP_X); ++j) { \ |
| 502 int abs_diff = \ | 505 int abs_diff = \ |
| 503 abs(static_cast<int>(dst_u_c[i * \ | 506 abs(static_cast<int>(dst_u_c[i * \ |
| 504 SUBSAMPLE(kWidth, SUBSAMP_X) + j]) - \ | 507 SUBSAMPLE(kWidth, SUBSAMP_X) + j]) - \ |
| 505 static_cast<int>(dst_u_opt[i * \ | 508 static_cast<int>(dst_u_opt[i * \ |
| 506 SUBSAMPLE(kWidth, SUBSAMP_X) + j])); \ | 509 SUBSAMPLE(kWidth, SUBSAMP_X) + j])); \ |
| 507 if (abs_diff > max_diff) { \ | 510 if (abs_diff > max_diff) { \ |
| 508 max_diff = abs_diff; \ | 511 max_diff = abs_diff; \ |
| 509 } \ | 512 } \ |
| (...skipping 20 matching lines...) Expand all Loading... |
| 530 free_aligned_buffer_page_end(dst_u_opt); \ | 533 free_aligned_buffer_page_end(dst_u_opt); \ |
| 531 free_aligned_buffer_page_end(dst_v_opt); \ | 534 free_aligned_buffer_page_end(dst_v_opt); \ |
| 532 free_aligned_buffer_page_end(src_y); \ | 535 free_aligned_buffer_page_end(src_y); \ |
| 533 free_aligned_buffer_page_end(src_uv); \ | 536 free_aligned_buffer_page_end(src_uv); \ |
| 534 } | 537 } |
| 535 | 538 |
| 536 #define TESTBIPLANARTOP(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \ | 539 #define TESTBIPLANARTOP(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \ |
| 537 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y) \ | 540 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y) \ |
| 538 TESTBIPLANARTOPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \ | 541 TESTBIPLANARTOPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \ |
| 539 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ | 542 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ |
| 540 benchmark_width_ - 4, _Any, +, 0) \ | 543 benchmark_width_ - 4, _Any, +, 0, 1) \ |
| 541 TESTBIPLANARTOPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \ | 544 TESTBIPLANARTOPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \ |
| 542 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ | 545 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ |
| 543 benchmark_width_, _Unaligned, +, 1) \ | 546 benchmark_width_, _Unaligned, +, 1, 1) \ |
| 544 TESTBIPLANARTOPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \ | 547 TESTBIPLANARTOPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \ |
| 545 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ | 548 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ |
| 546 benchmark_width_, _Invert, -, 0) \ | 549 benchmark_width_, _Invert, -, 0, 1) \ |
| 547 TESTBIPLANARTOPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \ | 550 TESTBIPLANARTOPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \ |
| 548 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ | 551 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ |
| 549 benchmark_width_, _Opt, +, 0) | 552 benchmark_width_, _Opt, +, 0, 1) \ |
| 553 TESTBIPLANARTOPI(SRC_FMT_PLANAR, SRC_SUBSAMP_X, SRC_SUBSAMP_Y, \ |
| 554 FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ |
| 555 benchmark_width_, _NullY, +, 0, 0) |
| 550 | 556 |
| 551 TESTBIPLANARTOP(NV12, 2, 2, I420, 2, 2) | 557 TESTBIPLANARTOP(NV12, 2, 2, I420, 2, 2) |
| 552 TESTBIPLANARTOP(NV21, 2, 2, I420, 2, 2) | 558 TESTBIPLANARTOP(NV21, 2, 2, I420, 2, 2) |
| 553 | 559 |
| 554 #define ALIGNINT(V, ALIGN) (((V) + (ALIGN) - 1) / (ALIGN) * (ALIGN)) | 560 #define ALIGNINT(V, ALIGN) (((V) + (ALIGN) - 1) / (ALIGN) * (ALIGN)) |
| 555 | 561 |
| 556 #define TESTPLANARTOBI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, BPP_B, ALIGN, \ | 562 #define TESTPLANARTOBI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, BPP_B, ALIGN, \ |
| 557 YALIGN, W1280, DIFF, N, NEG, OFF, FMT_C, BPP_C) \ | 563 YALIGN, W1280, DIFF, N, NEG, OFF, FMT_C, BPP_C) \ |
| 558 TEST_F(LibYUVConvertTest, FMT_PLANAR##To##FMT_B##N) { \ | 564 TEST_F(LibYUVConvertTest, FMT_PLANAR##To##FMT_B##N) { \ |
| 559 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \ | 565 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \ |
| (...skipping 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1996 benchmark_width_, _Invert, -, 0, FMT_C, BPP_C, 0) \ | 2002 benchmark_width_, _Invert, -, 0, FMT_C, BPP_C, 0) \ |
| 1997 TESTQPLANARTOEI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, SUB_B, BPP_B, \ | 2003 TESTQPLANARTOEI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, SUB_B, BPP_B, \ |
| 1998 benchmark_width_, _Opt, +, 0, FMT_C, BPP_C, 0) \ | 2004 benchmark_width_, _Opt, +, 0, FMT_C, BPP_C, 0) \ |
| 1999 TESTQPLANARTOEI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, SUB_B, BPP_B, \ | 2005 TESTQPLANARTOEI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, SUB_B, BPP_B, \ |
| 2000 benchmark_width_, _Premult, +, 0, FMT_C, BPP_C, 1) | 2006 benchmark_width_, _Premult, +, 0, FMT_C, BPP_C, 1) |
| 2001 | 2007 |
| 2002 TESTQPLANARTOE(I420Alpha, 2, 2, ARGB, 1, 4, ABGR, 4) | 2008 TESTQPLANARTOE(I420Alpha, 2, 2, ARGB, 1, 4, ABGR, 4) |
| 2003 TESTQPLANARTOE(I420Alpha, 2, 2, ABGR, 1, 4, ARGB, 4) | 2009 TESTQPLANARTOE(I420Alpha, 2, 2, ABGR, 1, 4, ARGB, 4) |
| 2004 | 2010 |
| 2005 } // namespace libyuv | 2011 } // namespace libyuv |
| OLD | NEW |