| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 MaskCpuFlags(disable_cpu_flags_); \ | 80 MaskCpuFlags(disable_cpu_flags_); \ |
| 81 SRC_FMT_PLANAR##To##FMT_PLANAR(src_y + OFF, kWidth, \ | 81 SRC_FMT_PLANAR##To##FMT_PLANAR(src_y + OFF, kWidth, \ |
| 82 src_u + OFF, \ | 82 src_u + OFF, \ |
| 83 SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \ | 83 SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \ |
| 84 src_v + OFF, \ | 84 src_v + OFF, \ |
| 85 SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \ | 85 SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \ |
| 86 dst_y_c, kWidth, \ | 86 dst_y_c, kWidth, \ |
| 87 dst_u_c, SUBSAMPLE(kWidth, SUBSAMP_X), \ | 87 dst_u_c, SUBSAMPLE(kWidth, SUBSAMP_X), \ |
| 88 dst_v_c, SUBSAMPLE(kWidth, SUBSAMP_X), \ | 88 dst_v_c, SUBSAMPLE(kWidth, SUBSAMP_X), \ |
| 89 kWidth, NEG kHeight); \ | 89 kWidth, NEG kHeight); \ |
| 90 MaskCpuFlags(-1); \ | 90 MaskCpuFlags(benchmark_cpu_info_); \ |
| 91 for (int i = 0; i < benchmark_iterations_; ++i) { \ | 91 for (int i = 0; i < benchmark_iterations_; ++i) { \ |
| 92 SRC_FMT_PLANAR##To##FMT_PLANAR(src_y + OFF, kWidth, \ | 92 SRC_FMT_PLANAR##To##FMT_PLANAR(src_y + OFF, kWidth, \ |
| 93 src_u + OFF, \ | 93 src_u + OFF, \ |
| 94 SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \ | 94 SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \ |
| 95 src_v + OFF, \ | 95 src_v + OFF, \ |
| 96 SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \ | 96 SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \ |
| 97 dst_y_opt, kWidth, \ | 97 dst_y_opt, kWidth, \ |
| 98 dst_u_opt, SUBSAMPLE(kWidth, SUBSAMP_X), \ | 98 dst_u_opt, SUBSAMPLE(kWidth, SUBSAMP_X), \ |
| 99 dst_v_opt, SUBSAMPLE(kWidth, SUBSAMP_X), \ | 99 dst_v_opt, SUBSAMPLE(kWidth, SUBSAMP_X), \ |
| 100 kWidth, NEG kHeight); \ | 100 kWidth, NEG kHeight); \ |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ | 211 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ |
| 212 MaskCpuFlags(disable_cpu_flags_); \ | 212 MaskCpuFlags(disable_cpu_flags_); \ |
| 213 SRC_FMT_PLANAR##To##FMT_PLANAR(src_y + OFF, kWidth, \ | 213 SRC_FMT_PLANAR##To##FMT_PLANAR(src_y + OFF, kWidth, \ |
| 214 src_u + OFF, \ | 214 src_u + OFF, \ |
| 215 SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \ | 215 SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \ |
| 216 src_v + OFF, \ | 216 src_v + OFF, \ |
| 217 SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \ | 217 SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \ |
| 218 dst_y_c, kWidth, \ | 218 dst_y_c, kWidth, \ |
| 219 dst_uv_c, SUBSAMPLE(kWidth * 2, SUBSAMP_X), \ | 219 dst_uv_c, SUBSAMPLE(kWidth * 2, SUBSAMP_X), \ |
| 220 kWidth, NEG kHeight); \ | 220 kWidth, NEG kHeight); \ |
| 221 MaskCpuFlags(-1); \ | 221 MaskCpuFlags(benchmark_cpu_info_); \ |
| 222 for (int i = 0; i < benchmark_iterations_; ++i) { \ | 222 for (int i = 0; i < benchmark_iterations_; ++i) { \ |
| 223 SRC_FMT_PLANAR##To##FMT_PLANAR(src_y + OFF, kWidth, \ | 223 SRC_FMT_PLANAR##To##FMT_PLANAR(src_y + OFF, kWidth, \ |
| 224 src_u + OFF, \ | 224 src_u + OFF, \ |
| 225 SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \ | 225 SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \ |
| 226 src_v + OFF, \ | 226 src_v + OFF, \ |
| 227 SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \ | 227 SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \ |
| 228 dst_y_opt, kWidth, \ | 228 dst_y_opt, kWidth, \ |
| 229 dst_uv_opt, \ | 229 dst_uv_opt, \ |
| 230 SUBSAMPLE(kWidth * 2, SUBSAMP_X), \ | 230 SUBSAMPLE(kWidth * 2, SUBSAMP_X), \ |
| 231 kWidth, NEG kHeight); \ | 231 kWidth, NEG kHeight); \ |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 memset(dst_v_opt, 103, SUBSAMPLE(kWidth, SUBSAMP_X) * \ | 324 memset(dst_v_opt, 103, SUBSAMPLE(kWidth, SUBSAMP_X) * \ |
| 325 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ | 325 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ |
| 326 MaskCpuFlags(disable_cpu_flags_); \ | 326 MaskCpuFlags(disable_cpu_flags_); \ |
| 327 SRC_FMT_PLANAR##To##FMT_PLANAR(src_y + OFF, kWidth, \ | 327 SRC_FMT_PLANAR##To##FMT_PLANAR(src_y + OFF, kWidth, \ |
| 328 src_uv + OFF, \ | 328 src_uv + OFF, \ |
| 329 2 * SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \ | 329 2 * SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \ |
| 330 dst_y_c, kWidth, \ | 330 dst_y_c, kWidth, \ |
| 331 dst_u_c, SUBSAMPLE(kWidth, SUBSAMP_X), \ | 331 dst_u_c, SUBSAMPLE(kWidth, SUBSAMP_X), \ |
| 332 dst_v_c, SUBSAMPLE(kWidth, SUBSAMP_X), \ | 332 dst_v_c, SUBSAMPLE(kWidth, SUBSAMP_X), \ |
| 333 kWidth, NEG kHeight); \ | 333 kWidth, NEG kHeight); \ |
| 334 MaskCpuFlags(-1); \ | 334 MaskCpuFlags(benchmark_cpu_info_); \ |
| 335 for (int i = 0; i < benchmark_iterations_; ++i) { \ | 335 for (int i = 0; i < benchmark_iterations_; ++i) { \ |
| 336 SRC_FMT_PLANAR##To##FMT_PLANAR(src_y + OFF, kWidth, \ | 336 SRC_FMT_PLANAR##To##FMT_PLANAR(src_y + OFF, kWidth, \ |
| 337 src_uv + OFF, \ | 337 src_uv + OFF, \ |
| 338 2 * SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \ | 338 2 * SUBSAMPLE(kWidth, SRC_SUBSAMP_X), \ |
| 339 dst_y_opt, kWidth, \ | 339 dst_y_opt, kWidth, \ |
| 340 dst_u_opt, SUBSAMPLE(kWidth, SUBSAMP_X), \ | 340 dst_u_opt, SUBSAMPLE(kWidth, SUBSAMP_X), \ |
| 341 dst_v_opt, SUBSAMPLE(kWidth, SUBSAMP_X), \ | 341 dst_v_opt, SUBSAMPLE(kWidth, SUBSAMP_X), \ |
| 342 kWidth, NEG kHeight); \ | 342 kWidth, NEG kHeight); \ |
| 343 } \ | 343 } \ |
| 344 int max_diff = 0; \ | 344 int max_diff = 0; \ |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 src_v[i + OFF] = (fastrand() & 0xff); \ | 430 src_v[i + OFF] = (fastrand() & 0xff); \ |
| 431 } \ | 431 } \ |
| 432 memset(dst_argb_c + OFF, 1, kStrideB * kHeight); \ | 432 memset(dst_argb_c + OFF, 1, kStrideB * kHeight); \ |
| 433 memset(dst_argb_opt + OFF, 101, kStrideB * kHeight); \ | 433 memset(dst_argb_opt + OFF, 101, kStrideB * kHeight); \ |
| 434 MaskCpuFlags(disable_cpu_flags_); \ | 434 MaskCpuFlags(disable_cpu_flags_); \ |
| 435 FMT_PLANAR##To##FMT_B(src_y + OFF, kWidth, \ | 435 FMT_PLANAR##To##FMT_B(src_y + OFF, kWidth, \ |
| 436 src_u + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \ | 436 src_u + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \ |
| 437 src_v + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \ | 437 src_v + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \ |
| 438 dst_argb_c + OFF, kStrideB, \ | 438 dst_argb_c + OFF, kStrideB, \ |
| 439 kWidth, NEG kHeight); \ | 439 kWidth, NEG kHeight); \ |
| 440 MaskCpuFlags(-1); \ | 440 MaskCpuFlags(benchmark_cpu_info_); \ |
| 441 for (int i = 0; i < benchmark_iterations_; ++i) { \ | 441 for (int i = 0; i < benchmark_iterations_; ++i) { \ |
| 442 FMT_PLANAR##To##FMT_B(src_y + OFF, kWidth, \ | 442 FMT_PLANAR##To##FMT_B(src_y + OFF, kWidth, \ |
| 443 src_u + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \ | 443 src_u + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \ |
| 444 src_v + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \ | 444 src_v + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \ |
| 445 dst_argb_opt + OFF, kStrideB, \ | 445 dst_argb_opt + OFF, kStrideB, \ |
| 446 kWidth, NEG kHeight); \ | 446 kWidth, NEG kHeight); \ |
| 447 } \ | 447 } \ |
| 448 int max_diff = 0; \ | 448 int max_diff = 0; \ |
| 449 /* Convert to ARGB so 565 is expanded to bytes that can be compared. */ \ | 449 /* Convert to ARGB so 565 is expanded to bytes that can be compared. */ \ |
| 450 align_buffer_64(dst_argb32_c, kWidth * BPP_C * kHeight); \ | 450 align_buffer_64(dst_argb32_c, kWidth * BPP_C * kHeight); \ |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 } \ | 542 } \ |
| 543 memset(dst_argb_c + OFF, 1, kStrideB * kHeight); \ | 543 memset(dst_argb_c + OFF, 1, kStrideB * kHeight); \ |
| 544 memset(dst_argb_opt + OFF, 101, kStrideB * kHeight); \ | 544 memset(dst_argb_opt + OFF, 101, kStrideB * kHeight); \ |
| 545 MaskCpuFlags(disable_cpu_flags_); \ | 545 MaskCpuFlags(disable_cpu_flags_); \ |
| 546 FMT_PLANAR##To##FMT_B(src_y + OFF, kWidth, \ | 546 FMT_PLANAR##To##FMT_B(src_y + OFF, kWidth, \ |
| 547 src_u + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \ | 547 src_u + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \ |
| 548 src_v + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \ | 548 src_v + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \ |
| 549 src_a + OFF, kWidth, \ | 549 src_a + OFF, kWidth, \ |
| 550 dst_argb_c + OFF, kStrideB, \ | 550 dst_argb_c + OFF, kStrideB, \ |
| 551 kWidth, NEG kHeight, ATTEN); \ | 551 kWidth, NEG kHeight, ATTEN); \ |
| 552 MaskCpuFlags(-1); \ | 552 MaskCpuFlags(benchmark_cpu_info_); \ |
| 553 for (int i = 0; i < benchmark_iterations_; ++i) { \ | 553 for (int i = 0; i < benchmark_iterations_; ++i) { \ |
| 554 FMT_PLANAR##To##FMT_B(src_y + OFF, kWidth, \ | 554 FMT_PLANAR##To##FMT_B(src_y + OFF, kWidth, \ |
| 555 src_u + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \ | 555 src_u + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \ |
| 556 src_v + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \ | 556 src_v + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \ |
| 557 src_a + OFF, kWidth, \ | 557 src_a + OFF, kWidth, \ |
| 558 dst_argb_opt + OFF, kStrideB, \ | 558 dst_argb_opt + OFF, kStrideB, \ |
| 559 kWidth, NEG kHeight, ATTEN); \ | 559 kWidth, NEG kHeight, ATTEN); \ |
| 560 } \ | 560 } \ |
| 561 int max_diff = 0; \ | 561 int max_diff = 0; \ |
| 562 for (int i = 0; i < kWidth * BPP_B * kHeight; ++i) { \ | 562 for (int i = 0; i < kWidth * BPP_B * kHeight; ++i) { \ |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 (fastrand() & 0xff); \ | 613 (fastrand() & 0xff); \ |
| 614 } \ | 614 } \ |
| 615 } \ | 615 } \ |
| 616 memset(dst_argb_c, 1, kStrideB * kHeight); \ | 616 memset(dst_argb_c, 1, kStrideB * kHeight); \ |
| 617 memset(dst_argb_opt, 101, kStrideB * kHeight); \ | 617 memset(dst_argb_opt, 101, kStrideB * kHeight); \ |
| 618 MaskCpuFlags(disable_cpu_flags_); \ | 618 MaskCpuFlags(disable_cpu_flags_); \ |
| 619 FMT_PLANAR##To##FMT_B(src_y + OFF, kWidth, \ | 619 FMT_PLANAR##To##FMT_B(src_y + OFF, kWidth, \ |
| 620 src_uv + OFF, SUBSAMPLE(kWidth, SUBSAMP_X) * 2, \ | 620 src_uv + OFF, SUBSAMPLE(kWidth, SUBSAMP_X) * 2, \ |
| 621 dst_argb_c, kWidth * BPP_B, \ | 621 dst_argb_c, kWidth * BPP_B, \ |
| 622 kWidth, NEG kHeight); \ | 622 kWidth, NEG kHeight); \ |
| 623 MaskCpuFlags(-1); \ | 623 MaskCpuFlags(benchmark_cpu_info_); \ |
| 624 for (int i = 0; i < benchmark_iterations_; ++i) { \ | 624 for (int i = 0; i < benchmark_iterations_; ++i) { \ |
| 625 FMT_PLANAR##To##FMT_B(src_y + OFF, kWidth, \ | 625 FMT_PLANAR##To##FMT_B(src_y + OFF, kWidth, \ |
| 626 src_uv + OFF, SUBSAMPLE(kWidth, SUBSAMP_X) * 2, \ | 626 src_uv + OFF, SUBSAMPLE(kWidth, SUBSAMP_X) * 2, \ |
| 627 dst_argb_opt, kWidth * BPP_B, \ | 627 dst_argb_opt, kWidth * BPP_B, \ |
| 628 kWidth, NEG kHeight); \ | 628 kWidth, NEG kHeight); \ |
| 629 } \ | 629 } \ |
| 630 /* Convert to ARGB so 565 is expanded to bytes that can be compared. */ \ | 630 /* Convert to ARGB so 565 is expanded to bytes that can be compared. */ \ |
| 631 align_buffer_64(dst_argb32_c, kWidth * 4 * kHeight); \ | 631 align_buffer_64(dst_argb32_c, kWidth * 4 * kHeight); \ |
| 632 align_buffer_64(dst_argb32_opt, kWidth * 4 * kHeight); \ | 632 align_buffer_64(dst_argb32_opt, kWidth * 4 * kHeight); \ |
| 633 memset(dst_argb32_c, 2, kWidth * 4 * kHeight); \ | 633 memset(dst_argb32_c, 2, kWidth * 4 * kHeight); \ |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y)); \ | 706 SUBSAMPLE(kWidth, SUBSAMP_X) * SUBSAMPLE(kHeight, SUBSAMP_Y)); \ |
| 707 for (int i = 0; i < kHeight; ++i) \ | 707 for (int i = 0; i < kHeight; ++i) \ |
| 708 for (int j = 0; j < kStride; ++j) \ | 708 for (int j = 0; j < kStride; ++j) \ |
| 709 src_argb[(i * kStride) + j + OFF] = (fastrand() & 0xff); \ | 709 src_argb[(i * kStride) + j + OFF] = (fastrand() & 0xff); \ |
| 710 MaskCpuFlags(disable_cpu_flags_); \ | 710 MaskCpuFlags(disable_cpu_flags_); \ |
| 711 FMT_A##To##FMT_PLANAR(src_argb + OFF, kStride, \ | 711 FMT_A##To##FMT_PLANAR(src_argb + OFF, kStride, \ |
| 712 dst_y_c, kWidth, \ | 712 dst_y_c, kWidth, \ |
| 713 dst_u_c, SUBSAMPLE(kWidth, SUBSAMP_X), \ | 713 dst_u_c, SUBSAMPLE(kWidth, SUBSAMP_X), \ |
| 714 dst_v_c, SUBSAMPLE(kWidth, SUBSAMP_X), \ | 714 dst_v_c, SUBSAMPLE(kWidth, SUBSAMP_X), \ |
| 715 kWidth, NEG kHeight); \ | 715 kWidth, NEG kHeight); \ |
| 716 MaskCpuFlags(-1); \ | 716 MaskCpuFlags(benchmark_cpu_info_); \ |
| 717 for (int i = 0; i < benchmark_iterations_; ++i) { \ | 717 for (int i = 0; i < benchmark_iterations_; ++i) { \ |
| 718 FMT_A##To##FMT_PLANAR(src_argb + OFF, kStride, \ | 718 FMT_A##To##FMT_PLANAR(src_argb + OFF, kStride, \ |
| 719 dst_y_opt, kWidth, \ | 719 dst_y_opt, kWidth, \ |
| 720 dst_u_opt, SUBSAMPLE(kWidth, SUBSAMP_X), \ | 720 dst_u_opt, SUBSAMPLE(kWidth, SUBSAMP_X), \ |
| 721 dst_v_opt, SUBSAMPLE(kWidth, SUBSAMP_X), \ | 721 dst_v_opt, SUBSAMPLE(kWidth, SUBSAMP_X), \ |
| 722 kWidth, NEG kHeight); \ | 722 kWidth, NEG kHeight); \ |
| 723 } \ | 723 } \ |
| 724 for (int i = 0; i < kHeight; ++i) { \ | 724 for (int i = 0; i < kHeight; ++i) { \ |
| 725 for (int j = 0; j < kWidth; ++j) { \ | 725 for (int j = 0; j < kWidth; ++j) { \ |
| 726 EXPECT_NEAR(static_cast<int>(dst_y_c[i * kWidth + j]), \ | 726 EXPECT_NEAR(static_cast<int>(dst_y_c[i * kWidth + j]), \ |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 memset(dst_uv_c, 2, SUBSAMPLE(kWidth, SUBSAMP_X) * 2 * \ | 812 memset(dst_uv_c, 2, SUBSAMPLE(kWidth, SUBSAMP_X) * 2 * \ |
| 813 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ | 813 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ |
| 814 memset(dst_y_opt, 101, kWidth * kHeight); \ | 814 memset(dst_y_opt, 101, kWidth * kHeight); \ |
| 815 memset(dst_uv_opt, 102, SUBSAMPLE(kWidth, SUBSAMP_X) * 2 * \ | 815 memset(dst_uv_opt, 102, SUBSAMPLE(kWidth, SUBSAMP_X) * 2 * \ |
| 816 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ | 816 SUBSAMPLE(kHeight, SUBSAMP_Y)); \ |
| 817 MaskCpuFlags(disable_cpu_flags_); \ | 817 MaskCpuFlags(disable_cpu_flags_); \ |
| 818 FMT_A##To##FMT_PLANAR(src_argb + OFF, kStride, \ | 818 FMT_A##To##FMT_PLANAR(src_argb + OFF, kStride, \ |
| 819 dst_y_c, kWidth, \ | 819 dst_y_c, kWidth, \ |
| 820 dst_uv_c, SUBSAMPLE(kWidth, SUBSAMP_X) * 2, \ | 820 dst_uv_c, SUBSAMPLE(kWidth, SUBSAMP_X) * 2, \ |
| 821 kWidth, NEG kHeight); \ | 821 kWidth, NEG kHeight); \ |
| 822 MaskCpuFlags(-1); \ | 822 MaskCpuFlags(benchmark_cpu_info_); \ |
| 823 for (int i = 0; i < benchmark_iterations_; ++i) { \ | 823 for (int i = 0; i < benchmark_iterations_; ++i) { \ |
| 824 FMT_A##To##FMT_PLANAR(src_argb + OFF, kStride, \ | 824 FMT_A##To##FMT_PLANAR(src_argb + OFF, kStride, \ |
| 825 dst_y_opt, kWidth, \ | 825 dst_y_opt, kWidth, \ |
| 826 dst_uv_opt, SUBSAMPLE(kWidth, SUBSAMP_X) * 2, \ | 826 dst_uv_opt, SUBSAMPLE(kWidth, SUBSAMP_X) * 2, \ |
| 827 kWidth, NEG kHeight); \ | 827 kWidth, NEG kHeight); \ |
| 828 } \ | 828 } \ |
| 829 int max_diff = 0; \ | 829 int max_diff = 0; \ |
| 830 for (int i = 0; i < kHeight; ++i) { \ | 830 for (int i = 0; i < kHeight; ++i) { \ |
| 831 for (int j = 0; j < kWidth; ++j) { \ | 831 for (int j = 0; j < kWidth; ++j) { \ |
| 832 int abs_diff = \ | 832 int abs_diff = \ |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 align_buffer_64(dst_argb_opt, kStrideB * kHeightB); \ | 888 align_buffer_64(dst_argb_opt, kStrideB * kHeightB); \ |
| 889 for (int i = 0; i < kStrideA * kHeightA; ++i) { \ | 889 for (int i = 0; i < kStrideA * kHeightA; ++i) { \ |
| 890 src_argb[i + OFF] = (fastrand() & 0xff); \ | 890 src_argb[i + OFF] = (fastrand() & 0xff); \ |
| 891 } \ | 891 } \ |
| 892 memset(dst_argb_c, 1, kStrideB * kHeightB); \ | 892 memset(dst_argb_c, 1, kStrideB * kHeightB); \ |
| 893 memset(dst_argb_opt, 101, kStrideB * kHeightB); \ | 893 memset(dst_argb_opt, 101, kStrideB * kHeightB); \ |
| 894 MaskCpuFlags(disable_cpu_flags_); \ | 894 MaskCpuFlags(disable_cpu_flags_); \ |
| 895 FMT_A##To##FMT_B(src_argb + OFF, kStrideA, \ | 895 FMT_A##To##FMT_B(src_argb + OFF, kStrideA, \ |
| 896 dst_argb_c, kStrideB, \ | 896 dst_argb_c, kStrideB, \ |
| 897 kWidth, NEG kHeight); \ | 897 kWidth, NEG kHeight); \ |
| 898 MaskCpuFlags(-1); \ | 898 MaskCpuFlags(benchmark_cpu_info_); \ |
| 899 for (int i = 0; i < benchmark_iterations_; ++i) { \ | 899 for (int i = 0; i < benchmark_iterations_; ++i) { \ |
| 900 FMT_A##To##FMT_B(src_argb + OFF, kStrideA, \ | 900 FMT_A##To##FMT_B(src_argb + OFF, kStrideA, \ |
| 901 dst_argb_opt, kStrideB, \ | 901 dst_argb_opt, kStrideB, \ |
| 902 kWidth, NEG kHeight); \ | 902 kWidth, NEG kHeight); \ |
| 903 } \ | 903 } \ |
| 904 int max_diff = 0; \ | 904 int max_diff = 0; \ |
| 905 for (int i = 0; i < kStrideB * kHeightB; ++i) { \ | 905 for (int i = 0; i < kStrideB * kHeightB; ++i) { \ |
| 906 int abs_diff = \ | 906 int abs_diff = \ |
| 907 abs(static_cast<int>(dst_argb_c[i]) - \ | 907 abs(static_cast<int>(dst_argb_c[i]) - \ |
| 908 static_cast<int>(dst_argb_opt[i])); \ | 908 static_cast<int>(dst_argb_opt[i])); \ |
| (...skipping 22 matching lines...) Expand all Loading... |
| 931 align_buffer_page_end(dst_argb_opt, kStrideB * kHeightB); \ | 931 align_buffer_page_end(dst_argb_opt, kStrideB * kHeightB); \ |
| 932 for (int i = 0; i < kStrideA * kHeightA; ++i) { \ | 932 for (int i = 0; i < kStrideA * kHeightA; ++i) { \ |
| 933 src_argb[i] = (fastrand() & 0xff); \ | 933 src_argb[i] = (fastrand() & 0xff); \ |
| 934 } \ | 934 } \ |
| 935 memset(dst_argb_c, 123, kStrideB * kHeightB); \ | 935 memset(dst_argb_c, 123, kStrideB * kHeightB); \ |
| 936 memset(dst_argb_opt, 123, kStrideB * kHeightB); \ | 936 memset(dst_argb_opt, 123, kStrideB * kHeightB); \ |
| 937 MaskCpuFlags(disable_cpu_flags_); \ | 937 MaskCpuFlags(disable_cpu_flags_); \ |
| 938 FMT_A##To##FMT_B(src_argb, kStrideA, \ | 938 FMT_A##To##FMT_B(src_argb, kStrideA, \ |
| 939 dst_argb_c, kStrideB, \ | 939 dst_argb_c, kStrideB, \ |
| 940 kWidth, kHeight); \ | 940 kWidth, kHeight); \ |
| 941 MaskCpuFlags(-1); \ | 941 MaskCpuFlags(benchmark_cpu_info_);
\ |
| 942 FMT_A##To##FMT_B(src_argb, kStrideA, \ | 942 FMT_A##To##FMT_B(src_argb, kStrideA, \ |
| 943 dst_argb_opt, kStrideB, \ | 943 dst_argb_opt, kStrideB, \ |
| 944 kWidth, kHeight); \ | 944 kWidth, kHeight); \ |
| 945 int max_diff = 0; \ | 945 int max_diff = 0; \ |
| 946 for (int i = 0; i < kStrideB * kHeightB; ++i) { \ | 946 for (int i = 0; i < kStrideB * kHeightB; ++i) { \ |
| 947 int abs_diff = \ | 947 int abs_diff = \ |
| 948 abs(static_cast<int>(dst_argb_c[i]) - \ | 948 abs(static_cast<int>(dst_argb_c[i]) - \ |
| 949 static_cast<int>(dst_argb_opt[i])); \ | 949 static_cast<int>(dst_argb_opt[i])); \ |
| 950 if (abs_diff > max_diff) { \ | 950 if (abs_diff > max_diff) { \ |
| 951 max_diff = abs_diff; \ | 951 max_diff = abs_diff; \ |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1021 align_buffer_64(dst_argb_opt, kStrideB * kHeightB); \ | 1021 align_buffer_64(dst_argb_opt, kStrideB * kHeightB); \ |
| 1022 for (int i = 0; i < kStrideA * kHeightA; ++i) { \ | 1022 for (int i = 0; i < kStrideA * kHeightA; ++i) { \ |
| 1023 src_argb[i + OFF] = (fastrand() & 0xff); \ | 1023 src_argb[i + OFF] = (fastrand() & 0xff); \ |
| 1024 } \ | 1024 } \ |
| 1025 memset(dst_argb_c, 1, kStrideB * kHeightB); \ | 1025 memset(dst_argb_c, 1, kStrideB * kHeightB); \ |
| 1026 memset(dst_argb_opt, 101, kStrideB * kHeightB); \ | 1026 memset(dst_argb_opt, 101, kStrideB * kHeightB); \ |
| 1027 MaskCpuFlags(disable_cpu_flags_); \ | 1027 MaskCpuFlags(disable_cpu_flags_); \ |
| 1028 FMT_A##To##FMT_B##Dither(src_argb + OFF, kStrideA, \ | 1028 FMT_A##To##FMT_B##Dither(src_argb + OFF, kStrideA, \ |
| 1029 dst_argb_c, kStrideB, \ | 1029 dst_argb_c, kStrideB, \ |
| 1030 NULL, kWidth, NEG kHeight); \ | 1030 NULL, kWidth, NEG kHeight); \ |
| 1031 MaskCpuFlags(-1); \ | 1031 MaskCpuFlags(benchmark_cpu_info_); \ |
| 1032 for (int i = 0; i < benchmark_iterations_; ++i) { \ | 1032 for (int i = 0; i < benchmark_iterations_; ++i) { \ |
| 1033 FMT_A##To##FMT_B##Dither(src_argb + OFF, kStrideA, \ | 1033 FMT_A##To##FMT_B##Dither(src_argb + OFF, kStrideA, \ |
| 1034 dst_argb_opt, kStrideB, \ | 1034 dst_argb_opt, kStrideB, \ |
| 1035 NULL, kWidth, NEG kHeight); \ | 1035 NULL, kWidth, NEG kHeight); \ |
| 1036 } \ | 1036 } \ |
| 1037 int max_diff = 0; \ | 1037 int max_diff = 0; \ |
| 1038 for (int i = 0; i < kStrideB * kHeightB; ++i) { \ | 1038 for (int i = 0; i < kStrideB * kHeightB; ++i) { \ |
| 1039 int abs_diff = \ | 1039 int abs_diff = \ |
| 1040 abs(static_cast<int>(dst_argb_c[i]) - \ | 1040 abs(static_cast<int>(dst_argb_c[i]) - \ |
| 1041 static_cast<int>(dst_argb_opt[i])); \ | 1041 static_cast<int>(dst_argb_opt[i])); \ |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1064 align_buffer_page_end(dst_argb_opt, kStrideB * kHeightB); \ | 1064 align_buffer_page_end(dst_argb_opt, kStrideB * kHeightB); \ |
| 1065 for (int i = 0; i < kStrideA * kHeightA; ++i) { \ | 1065 for (int i = 0; i < kStrideA * kHeightA; ++i) { \ |
| 1066 src_argb[i] = (fastrand() & 0xff); \ | 1066 src_argb[i] = (fastrand() & 0xff); \ |
| 1067 } \ | 1067 } \ |
| 1068 memset(dst_argb_c, 123, kStrideB * kHeightB); \ | 1068 memset(dst_argb_c, 123, kStrideB * kHeightB); \ |
| 1069 memset(dst_argb_opt, 123, kStrideB * kHeightB); \ | 1069 memset(dst_argb_opt, 123, kStrideB * kHeightB); \ |
| 1070 MaskCpuFlags(disable_cpu_flags_); \ | 1070 MaskCpuFlags(disable_cpu_flags_); \ |
| 1071 FMT_A##To##FMT_B##Dither(src_argb, kStrideA, \ | 1071 FMT_A##To##FMT_B##Dither(src_argb, kStrideA, \ |
| 1072 dst_argb_c, kStrideB, \ | 1072 dst_argb_c, kStrideB, \ |
| 1073 NULL, kWidth, kHeight); \ | 1073 NULL, kWidth, kHeight); \ |
| 1074 MaskCpuFlags(-1); \ | 1074 MaskCpuFlags(benchmark_cpu_info_);
\ |
| 1075 FMT_A##To##FMT_B##Dither(src_argb, kStrideA, \ | 1075 FMT_A##To##FMT_B##Dither(src_argb, kStrideA, \ |
| 1076 dst_argb_opt, kStrideB, \ | 1076 dst_argb_opt, kStrideB, \ |
| 1077 NULL, kWidth, kHeight); \ | 1077 NULL, kWidth, kHeight); \ |
| 1078 int max_diff = 0; \ | 1078 int max_diff = 0; \ |
| 1079 for (int i = 0; i < kStrideB * kHeightB; ++i) { \ | 1079 for (int i = 0; i < kStrideB * kHeightB; ++i) { \ |
| 1080 int abs_diff = \ | 1080 int abs_diff = \ |
| 1081 abs(static_cast<int>(dst_argb_c[i]) - \ | 1081 abs(static_cast<int>(dst_argb_c[i]) - \ |
| 1082 static_cast<int>(dst_argb_opt[i])); \ | 1082 static_cast<int>(dst_argb_opt[i])); \ |
| 1083 if (abs_diff > max_diff) { \ | 1083 if (abs_diff > max_diff) { \ |
| 1084 max_diff = abs_diff; \ | 1084 max_diff = abs_diff; \ |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1122 align_buffer_64(dst_argb_opt, kStrideA * kHeightA); \ | 1122 align_buffer_64(dst_argb_opt, kStrideA * kHeightA); \ |
| 1123 for (int i = 0; i < kStrideA * kHeightA; ++i) { \ | 1123 for (int i = 0; i < kStrideA * kHeightA; ++i) { \ |
| 1124 src_argb[i + OFF] = (fastrand() & 0xff); \ | 1124 src_argb[i + OFF] = (fastrand() & 0xff); \ |
| 1125 } \ | 1125 } \ |
| 1126 memset(dst_argb_c, 1, kStrideA * kHeightA); \ | 1126 memset(dst_argb_c, 1, kStrideA * kHeightA); \ |
| 1127 memset(dst_argb_opt, 101, kStrideA * kHeightA); \ | 1127 memset(dst_argb_opt, 101, kStrideA * kHeightA); \ |
| 1128 MaskCpuFlags(disable_cpu_flags_); \ | 1128 MaskCpuFlags(disable_cpu_flags_); \ |
| 1129 FMT_ATOB(src_argb + OFF, kStrideA, \ | 1129 FMT_ATOB(src_argb + OFF, kStrideA, \ |
| 1130 dst_argb_c, kStrideA, \ | 1130 dst_argb_c, kStrideA, \ |
| 1131 kWidth, NEG kHeight); \ | 1131 kWidth, NEG kHeight); \ |
| 1132 MaskCpuFlags(-1); \ | 1132 MaskCpuFlags(benchmark_cpu_info_); \ |
| 1133 for (int i = 0; i < benchmark_iterations_; ++i) { \ | 1133 for (int i = 0; i < benchmark_iterations_; ++i) { \ |
| 1134 FMT_ATOB(src_argb + OFF, kStrideA, \ | 1134 FMT_ATOB(src_argb + OFF, kStrideA, \ |
| 1135 dst_argb_opt, kStrideA, \ | 1135 dst_argb_opt, kStrideA, \ |
| 1136 kWidth, NEG kHeight); \ | 1136 kWidth, NEG kHeight); \ |
| 1137 } \ | 1137 } \ |
| 1138 MaskCpuFlags(disable_cpu_flags_); \ | 1138 MaskCpuFlags(disable_cpu_flags_); \ |
| 1139 FMT_ATOB(dst_argb_c, kStrideA, \ | 1139 FMT_ATOB(dst_argb_c, kStrideA, \ |
| 1140 dst_argb_c, kStrideA, \ | 1140 dst_argb_c, kStrideA, \ |
| 1141 kWidth, NEG kHeight); \ | 1141 kWidth, NEG kHeight); \ |
| 1142 MaskCpuFlags(-1); \ | 1142 MaskCpuFlags(benchmark_cpu_info_); \ |
| 1143 FMT_ATOB(dst_argb_opt, kStrideA, \ | 1143 FMT_ATOB(dst_argb_opt, kStrideA, \ |
| 1144 dst_argb_opt, kStrideA, \ | 1144 dst_argb_opt, kStrideA, \ |
| 1145 kWidth, NEG kHeight); \ | 1145 kWidth, NEG kHeight); \ |
| 1146 for (int i = 0; i < kStrideA * kHeightA; ++i) { \ | 1146 for (int i = 0; i < kStrideA * kHeightA; ++i) { \ |
| 1147 EXPECT_EQ(src_argb[i + OFF], dst_argb_opt[i]); \ | 1147 EXPECT_EQ(src_argb[i + OFF], dst_argb_opt[i]); \ |
| 1148 EXPECT_EQ(dst_argb_c[i], dst_argb_opt[i]); \ | 1148 EXPECT_EQ(dst_argb_c[i], dst_argb_opt[i]); \ |
| 1149 } \ | 1149 } \ |
| 1150 free_aligned_buffer_64(src_argb); \ | 1150 free_aligned_buffer_64(src_argb); \ |
| 1151 free_aligned_buffer_64(dst_argb_c); \ | 1151 free_aligned_buffer_64(dst_argb_c); \ |
| 1152 free_aligned_buffer_64(dst_argb_opt); \ | 1152 free_aligned_buffer_64(dst_argb_opt); \ |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1563 src_v[i + OFF] = (fastrand() & 0xff); \ | 1563 src_v[i + OFF] = (fastrand() & 0xff); \ |
| 1564 } \ | 1564 } \ |
| 1565 memset(dst_argb_c + OFF, 1, kStrideB * kHeight); \ | 1565 memset(dst_argb_c + OFF, 1, kStrideB * kHeight); \ |
| 1566 memset(dst_argb_opt + OFF, 101, kStrideB * kHeight); \ | 1566 memset(dst_argb_opt + OFF, 101, kStrideB * kHeight); \ |
| 1567 MaskCpuFlags(disable_cpu_flags_); \ | 1567 MaskCpuFlags(disable_cpu_flags_); \ |
| 1568 FMT_PLANAR##To##FMT_B##Dither(src_y + OFF, kWidth, \ | 1568 FMT_PLANAR##To##FMT_B##Dither(src_y + OFF, kWidth, \ |
| 1569 src_u + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \ | 1569 src_u + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \ |
| 1570 src_v + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \ | 1570 src_v + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \ |
| 1571 dst_argb_c + OFF, kStrideB, \ | 1571 dst_argb_c + OFF, kStrideB, \ |
| 1572 NULL, kWidth, NEG kHeight); \ | 1572 NULL, kWidth, NEG kHeight); \ |
| 1573 MaskCpuFlags(-1); \ | 1573 MaskCpuFlags(benchmark_cpu_info_); \ |
| 1574 for (int i = 0; i < benchmark_iterations_; ++i) { \ | 1574 for (int i = 0; i < benchmark_iterations_; ++i) { \ |
| 1575 FMT_PLANAR##To##FMT_B##Dither(src_y + OFF, kWidth, \ | 1575 FMT_PLANAR##To##FMT_B##Dither(src_y + OFF, kWidth, \ |
| 1576 src_u + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \ | 1576 src_u + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \ |
| 1577 src_v + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \ | 1577 src_v + OFF, SUBSAMPLE(kWidth, SUBSAMP_X), \ |
| 1578 dst_argb_opt + OFF, kStrideB, \ | 1578 dst_argb_opt + OFF, kStrideB, \ |
| 1579 NULL, kWidth, NEG kHeight); \ | 1579 NULL, kWidth, NEG kHeight); \ |
| 1580 } \ | 1580 } \ |
| 1581 int max_diff = 0; \ | 1581 int max_diff = 0; \ |
| 1582 /* Convert to ARGB so 565 is expanded to bytes that can be compared. */ \ | 1582 /* Convert to ARGB so 565 is expanded to bytes that can be compared. */ \ |
| 1583 align_buffer_64(dst_argb32_c, kWidth * BPP_C * kHeight); \ | 1583 align_buffer_64(dst_argb32_c, kWidth * BPP_C * kHeight); \ |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1786 TESTPLANARTOE(J444, 1, 1, ARGB, 4, ARGB, 4) | 1786 TESTPLANARTOE(J444, 1, 1, ARGB, 4, ARGB, 4) |
| 1787 TESTPLANARTOE(I444, 1, 1, ABGR, 4, ARGB, 4) | 1787 TESTPLANARTOE(I444, 1, 1, ABGR, 4, ARGB, 4) |
| 1788 // TESTPLANARTOE(I420, 2, 2, YUY2, 2, ARGB, 4) | 1788 // TESTPLANARTOE(I420, 2, 2, YUY2, 2, ARGB, 4) |
| 1789 // TESTPLANARTOE(I420, 2, 2, UYVY, 2, ARGB, 4) | 1789 // TESTPLANARTOE(I420, 2, 2, UYVY, 2, ARGB, 4) |
| 1790 TESTPLANARTOE(I422, 2, 1, YUY2, 2, ARGB, 4) | 1790 TESTPLANARTOE(I422, 2, 1, YUY2, 2, ARGB, 4) |
| 1791 TESTPLANARTOE(I422, 2, 1, UYVY, 2, ARGB, 4) | 1791 TESTPLANARTOE(I422, 2, 1, UYVY, 2, ARGB, 4) |
| 1792 // TESTPLANARTOE(I420, 2, 2, ARGB, 4, I400, 1) | 1792 // TESTPLANARTOE(I420, 2, 2, ARGB, 4, I400, 1) |
| 1793 // TESTPLANARTOE(J420, 2, 2, ARGB, 4, J400, 1) | 1793 // TESTPLANARTOE(J420, 2, 2, ARGB, 4, J400, 1) |
| 1794 | 1794 |
| 1795 } // namespace libyuv | 1795 } // namespace libyuv |
| OLD | NEW |