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 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 TESTATOPLANAR(ARGB, 4, 1, I411, 4, 1, 4) | 783 TESTATOPLANAR(ARGB, 4, 1, I411, 4, 1, 4) |
784 TESTATOPLANAR(ARGB, 4, 1, I422, 2, 1, 2) | 784 TESTATOPLANAR(ARGB, 4, 1, I422, 2, 1, 2) |
785 TESTATOPLANAR(ARGB, 4, 1, I444, 1, 1, 2) | 785 TESTATOPLANAR(ARGB, 4, 1, I444, 1, 1, 2) |
786 TESTATOPLANAR(YUY2, 2, 1, I420, 2, 2, 2) | 786 TESTATOPLANAR(YUY2, 2, 1, I420, 2, 2, 2) |
787 TESTATOPLANAR(UYVY, 2, 1, I420, 2, 2, 2) | 787 TESTATOPLANAR(UYVY, 2, 1, I420, 2, 2, 2) |
788 TESTATOPLANAR(YUY2, 2, 1, I422, 2, 1, 2) | 788 TESTATOPLANAR(YUY2, 2, 1, I422, 2, 1, 2) |
789 TESTATOPLANAR(UYVY, 2, 1, I422, 2, 1, 2) | 789 TESTATOPLANAR(UYVY, 2, 1, I422, 2, 1, 2) |
790 TESTATOPLANAR(I400, 1, 1, I420, 2, 2, 2) | 790 TESTATOPLANAR(I400, 1, 1, I420, 2, 2, 2) |
791 TESTATOPLANAR(J400, 1, 1, J420, 2, 2, 2) | 791 TESTATOPLANAR(J400, 1, 1, J420, 2, 2, 2) |
792 | 792 |
793 #define TESTATOBIPLANARI(FMT_A, BPP_A, FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ | 793 #define TESTATOBIPLANARI(FMT_A, SUB_A, BPP_A, FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y,\ |
794 W1280, N, NEG, OFF) \ | 794 W1280, N, NEG, OFF) \ |
795 TEST_F(LibYUVConvertTest, FMT_A##To##FMT_PLANAR##N) { \ | 795 TEST_F(LibYUVConvertTest, FMT_A##To##FMT_PLANAR##N) { \ |
796 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \ | 796 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \ |
797 const int kHeight = benchmark_height_; \ | 797 const int kHeight = benchmark_height_; \ |
798 const int kStride = (kWidth * 8 * BPP_A + 7) / 8; \ | 798 const int kStride = SUBSAMPLE(kWidth, SUB_A) * BPP_A; \ |
799 const int kStrideUV = SUBSAMPLE(kWidth, SUBSAMP_X); \ | 799 const int kStrideUV = SUBSAMPLE(kWidth, SUBSAMP_X); \ |
800 align_buffer_64(src_argb, kStride * kHeight + OFF); \ | 800 align_buffer_64(src_argb, kStride * kHeight + OFF); \ |
801 align_buffer_64(dst_y_c, kWidth * kHeight); \ | 801 align_buffer_64(dst_y_c, kWidth * kHeight); \ |
802 align_buffer_64(dst_uv_c, kStrideUV * 2 * SUBSAMPLE(kHeight, SUBSAMP_Y)); \ | 802 align_buffer_64(dst_uv_c, kStrideUV * 2 * SUBSAMPLE(kHeight, SUBSAMP_Y)); \ |
803 align_buffer_64(dst_y_opt, kWidth * kHeight); \ | 803 align_buffer_64(dst_y_opt, kWidth * kHeight); \ |
804 align_buffer_64(dst_uv_opt, kStrideUV * 2 * SUBSAMPLE(kHeight, SUBSAMP_Y)); \ | 804 align_buffer_64(dst_uv_opt, kStrideUV * 2 * SUBSAMPLE(kHeight, SUBSAMP_Y)); \ |
805 for (int i = 0; i < kHeight; ++i) \ | 805 for (int i = 0; i < kHeight; ++i) \ |
806 for (int j = 0; j < kStride; ++j) \ | 806 for (int j = 0; j < kStride; ++j) \ |
807 src_argb[(i * kStride) + j + OFF] = (fastrand() & 0xff); \ | 807 src_argb[(i * kStride) + j + OFF] = (fastrand() & 0xff); \ |
808 memset(dst_y_c, 1, kWidth * kHeight); \ | 808 memset(dst_y_c, 1, kWidth * kHeight); \ |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 } \ | 842 } \ |
843 } \ | 843 } \ |
844 EXPECT_LE(max_diff, 4); \ | 844 EXPECT_LE(max_diff, 4); \ |
845 free_aligned_buffer_64(dst_y_c); \ | 845 free_aligned_buffer_64(dst_y_c); \ |
846 free_aligned_buffer_64(dst_uv_c); \ | 846 free_aligned_buffer_64(dst_uv_c); \ |
847 free_aligned_buffer_64(dst_y_opt); \ | 847 free_aligned_buffer_64(dst_y_opt); \ |
848 free_aligned_buffer_64(dst_uv_opt); \ | 848 free_aligned_buffer_64(dst_uv_opt); \ |
849 free_aligned_buffer_64(src_argb); \ | 849 free_aligned_buffer_64(src_argb); \ |
850 } | 850 } |
851 | 851 |
852 #define TESTATOBIPLANAR(FMT_A, BPP_A, FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y) \ | 852 #define TESTATOBIPLANAR(FMT_A, SUB_A, BPP_A, FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y) \ |
853 TESTATOBIPLANARI(FMT_A, BPP_A, FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ | 853 TESTATOBIPLANARI(FMT_A, SUB_A, BPP_A, FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ |
854 benchmark_width_ - 4, _Any, +, 0) \ | 854 benchmark_width_ - 4, _Any, +, 0) \ |
855 TESTATOBIPLANARI(FMT_A, BPP_A, FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ | 855 TESTATOBIPLANARI(FMT_A, SUB_A, BPP_A, FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ |
856 benchmark_width_, _Unaligned, +, 1) \ | 856 benchmark_width_, _Unaligned, +, 1) \ |
857 TESTATOBIPLANARI(FMT_A, BPP_A, FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ | 857 TESTATOBIPLANARI(FMT_A, SUB_A, BPP_A, FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ |
858 benchmark_width_, _Invert, -, 0) \ | 858 benchmark_width_, _Invert, -, 0) \ |
859 TESTATOBIPLANARI(FMT_A, BPP_A, FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ | 859 TESTATOBIPLANARI(FMT_A, SUB_A, BPP_A, FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ |
860 benchmark_width_, _Opt, +, 0) | 860 benchmark_width_, _Opt, +, 0) |
861 | 861 |
862 TESTATOBIPLANAR(ARGB, 4, NV12, 2, 2) | 862 TESTATOBIPLANAR(ARGB, 1, 4, NV12, 2, 2) |
863 TESTATOBIPLANAR(ARGB, 4, NV21, 2, 2) | 863 TESTATOBIPLANAR(ARGB, 1, 4, NV21, 2, 2) |
864 TESTATOBIPLANAR(YUY2, 2, NV12, 2, 2) | 864 TESTATOBIPLANAR(YUY2, 2, 4, NV12, 2, 2) |
865 TESTATOBIPLANAR(UYVY, 2, NV12, 2, 2) | 865 TESTATOBIPLANAR(UYVY, 2, 4, NV12, 2, 2) |
866 | 866 |
867 #define TESTATOBI(FMT_A, BPP_A, STRIDE_A, HEIGHT_A, \ | 867 #define TESTATOBI(FMT_A, BPP_A, STRIDE_A, HEIGHT_A, \ |
868 FMT_B, BPP_B, STRIDE_B, HEIGHT_B, \ | 868 FMT_B, BPP_B, STRIDE_B, HEIGHT_B, \ |
869 W1280, DIFF, N, NEG, OFF) \ | 869 W1280, DIFF, N, NEG, OFF) \ |
870 TEST_F(LibYUVConvertTest, FMT_A##To##FMT_B##N) { \ | 870 TEST_F(LibYUVConvertTest, FMT_A##To##FMT_B##N) { \ |
871 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \ | 871 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \ |
872 const int kHeight = benchmark_height_; \ | 872 const int kHeight = benchmark_height_; \ |
873 const int kHeightA = (kHeight + HEIGHT_A - 1) / HEIGHT_A * HEIGHT_A; \ | 873 const int kHeightA = (kHeight + HEIGHT_A - 1) / HEIGHT_A * HEIGHT_A; \ |
874 const int kHeightB = (kHeight + HEIGHT_B - 1) / HEIGHT_B * HEIGHT_B; \ | 874 const int kHeightB = (kHeight + HEIGHT_B - 1) / HEIGHT_B * HEIGHT_B; \ |
875 const int kStrideA = (kWidth * BPP_A + STRIDE_A - 1) / STRIDE_A * STRIDE_A; \ | 875 const int kStrideA = (kWidth * BPP_A + STRIDE_A - 1) / STRIDE_A * STRIDE_A; \ |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1850 benchmark_width_, _Invert, -, 0, FMT_C, BPP_C, 0) \ | 1850 benchmark_width_, _Invert, -, 0, FMT_C, BPP_C, 0) \ |
1851 TESTQPLANARTOEI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, SUB_B, BPP_B, \ | 1851 TESTQPLANARTOEI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, SUB_B, BPP_B, \ |
1852 benchmark_width_, _Opt, +, 0, FMT_C, BPP_C, 0) \ | 1852 benchmark_width_, _Opt, +, 0, FMT_C, BPP_C, 0) \ |
1853 TESTQPLANARTOEI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, SUB_B, BPP_B, \ | 1853 TESTQPLANARTOEI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, SUB_B, BPP_B, \ |
1854 benchmark_width_, _Premult, +, 0, FMT_C, BPP_C, 1) | 1854 benchmark_width_, _Premult, +, 0, FMT_C, BPP_C, 1) |
1855 | 1855 |
1856 TESTQPLANARTOE(I420Alpha, 2, 2, ARGB, 1, 4, ABGR, 4) | 1856 TESTQPLANARTOE(I420Alpha, 2, 2, ARGB, 1, 4, ABGR, 4) |
1857 TESTQPLANARTOE(I420Alpha, 2, 2, ABGR, 1, 4, ARGB, 4) | 1857 TESTQPLANARTOE(I420Alpha, 2, 2, ABGR, 1, 4, ARGB, 4) |
1858 | 1858 |
1859 } // namespace libyuv | 1859 } // namespace libyuv |
OLD | NEW |