Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Side by Side Diff: unit_test/convert_test.cc

Issue 2403223003: Side by side 420 test (Closed)
Patch Set: bump version # Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/libyuv/version.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 877 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 } \ 888 } \
889 free_aligned_buffer_page_end(dst_y_c); \ 889 free_aligned_buffer_page_end(dst_y_c); \
890 free_aligned_buffer_page_end(dst_u_c); \ 890 free_aligned_buffer_page_end(dst_u_c); \
891 free_aligned_buffer_page_end(dst_v_c); \ 891 free_aligned_buffer_page_end(dst_v_c); \
892 free_aligned_buffer_page_end(dst_y_opt); \ 892 free_aligned_buffer_page_end(dst_y_opt); \
893 free_aligned_buffer_page_end(dst_u_opt); \ 893 free_aligned_buffer_page_end(dst_u_opt); \
894 free_aligned_buffer_page_end(dst_v_opt); \ 894 free_aligned_buffer_page_end(dst_v_opt); \
895 free_aligned_buffer_page_end(src_argb); \ 895 free_aligned_buffer_page_end(src_argb); \
896 } 896 }
897 897
898
899 #define TESTATOPLANARI2(FMT_A, BPP_A, YALIGN, FMT_PLANAR, \
900 SUBSAMP_X, SUBSAMP_Y, W1280, DIFF, N, NEG, OFF) \
901 TEST_F(LibYUVConvertTest, FMT_A##To##FMT_PLANAR##N) { \
902 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \
903 const int kHeight = ALIGNINT(benchmark_height_, YALIGN); \
904 const int kStrideUV = SUBSAMPLE(kWidth, SUBSAMP_X); \
905 const int kStride = \
906 (kStrideUV * SUBSAMP_X * 8 * BPP_A + 7) / 8; \
907 align_buffer_page_end(src_argb, kStride * kHeight + OFF); \
908 align_buffer_page_end(dst_y_c, kWidth * kHeight); \
909 align_buffer_page_end(dst_uv_c, \
910 kStrideUV * 2 * SUBSAMPLE(kHeight, SUBSAMP_Y)); \
911 align_buffer_page_end(dst_y_opt, kWidth * kHeight); \
912 align_buffer_page_end(dst_uv_opt, \
913 kStrideUV * 2 * SUBSAMPLE(kHeight, SUBSAMP_Y)); \
914 memset(dst_y_c, 1, kWidth * kHeight); \
915 memset(dst_uv_c, 2, \
916 kStrideUV * 2 * SUBSAMPLE(kHeight, SUBSAMP_Y)); \
917 memset(dst_y_opt, 101, kWidth * kHeight); \
918 memset(dst_uv_opt, 102, \
919 kStrideUV * 2 * SUBSAMPLE(kHeight, SUBSAMP_Y)); \
920 for (int i = 0; i < kHeight; ++i) \
921 for (int j = 0; j < kStride; ++j) \
922 src_argb[(i * kStride) + j + OFF] = (fastrand() & 0xff); \
923 MaskCpuFlags(disable_cpu_flags_); \
924 FMT_A##To##FMT_PLANAR(src_argb + OFF, kStride, \
925 dst_y_c, kWidth, \
926 dst_uv_c, kStrideUV * 2, \
927 dst_uv_c + kStrideUV, kStrideUV * 2, \
928 kWidth, NEG kHeight); \
929 MaskCpuFlags(benchmark_cpu_info_); \
930 for (int i = 0; i < benchmark_iterations_; ++i) { \
931 FMT_A##To##FMT_PLANAR(src_argb + OFF, kStride, \
932 dst_y_opt, kWidth, \
933 dst_uv_opt, kStrideUV * 2, \
934 dst_uv_opt + kStrideUV, kStrideUV * 2, \
935 kWidth, NEG kHeight); \
936 } \
937 for (int i = 0; i < kHeight; ++i) { \
938 for (int j = 0; j < kWidth; ++j) { \
939 EXPECT_NEAR(static_cast<int>(dst_y_c[i * kWidth + j]), \
940 static_cast<int>(dst_y_opt[i * kWidth + j]), DIFF); \
941 } \
942 } \
943 for (int i = 0; i < SUBSAMPLE(kHeight, SUBSAMP_Y) * 2; ++i) { \
944 for (int j = 0; j < kStrideUV; ++j) { \
945 EXPECT_NEAR(static_cast<int>(dst_uv_c[i * kStrideUV + j]), \
946 static_cast<int>(dst_uv_opt[i * kStrideUV + j]), DIFF); \
947 } \
948 } \
949 free_aligned_buffer_page_end(dst_y_c); \
950 free_aligned_buffer_page_end(dst_uv_c); \
951 free_aligned_buffer_page_end(dst_y_opt); \
952 free_aligned_buffer_page_end(dst_uv_opt); \
953 free_aligned_buffer_page_end(src_argb); \
954 }
955
898 #define TESTATOPLANAR(FMT_A, BPP_A, YALIGN, FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ 956 #define TESTATOPLANAR(FMT_A, BPP_A, YALIGN, FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \
899 DIFF) \ 957 DIFF) \
900 TESTATOPLANARI(FMT_A, BPP_A, YALIGN, FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ 958 TESTATOPLANARI(FMT_A, BPP_A, YALIGN, FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \
901 benchmark_width_ - 4, DIFF, _Any, +, 0) \ 959 benchmark_width_ - 4, DIFF, _Any, +, 0) \
902 TESTATOPLANARI(FMT_A, BPP_A, YALIGN, FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ 960 TESTATOPLANARI(FMT_A, BPP_A, YALIGN, FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \
903 benchmark_width_, DIFF, _Unaligned, +, 1) \ 961 benchmark_width_, DIFF, _Unaligned, +, 1) \
904 TESTATOPLANARI(FMT_A, BPP_A, YALIGN, FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ 962 TESTATOPLANARI(FMT_A, BPP_A, YALIGN, FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \
905 benchmark_width_, DIFF, _Invert, -, 0) \ 963 benchmark_width_, DIFF, _Invert, -, 0) \
906 TESTATOPLANARI(FMT_A, BPP_A, YALIGN, FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \ 964 TESTATOPLANARI(FMT_A, BPP_A, YALIGN, FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \
907 benchmark_width_, DIFF, _Opt, +, 0) 965 benchmark_width_, DIFF, _Opt, +, 0) \
966 TESTATOPLANARI2(FMT_A, BPP_A, YALIGN, FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, \
967 benchmark_width_, DIFF, _SxS, +, 0)
908 968
909 TESTATOPLANAR(ARGB, 4, 1, I420, 2, 2, 4) 969 TESTATOPLANAR(ARGB, 4, 1, I420, 2, 2, 4)
910 #if defined(__arm__) || defined (__aarch64__) 970 #if defined(__arm__) || defined (__aarch64__)
911 // arm version subsamples by summing 4 pixels then multiplying by matrix with 971 // arm version subsamples by summing 4 pixels then multiplying by matrix with
912 // 4x smaller coefficients which are rounded to nearest integer. 972 // 4x smaller coefficients which are rounded to nearest integer.
913 TESTATOPLANAR(ARGB, 4, 1, J420, 2, 2, 4) 973 TESTATOPLANAR(ARGB, 4, 1, J420, 2, 2, 4)
914 TESTATOPLANAR(ARGB, 4, 1, J422, 2, 1, 4) 974 TESTATOPLANAR(ARGB, 4, 1, J422, 2, 1, 4)
915 #else 975 #else
916 TESTATOPLANAR(ARGB, 4, 1, J420, 2, 2, 0) 976 TESTATOPLANAR(ARGB, 4, 1, J420, 2, 2, 0)
917 TESTATOPLANAR(ARGB, 4, 1, J422, 2, 1, 0) 977 TESTATOPLANAR(ARGB, 4, 1, J422, 2, 1, 0)
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after
2001 benchmark_width_, _Invert, -, 0, FMT_C, BPP_C, 0) \ 2061 benchmark_width_, _Invert, -, 0, FMT_C, BPP_C, 0) \
2002 TESTQPLANARTOEI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, SUB_B, BPP_B, \ 2062 TESTQPLANARTOEI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, SUB_B, BPP_B, \
2003 benchmark_width_, _Opt, +, 0, FMT_C, BPP_C, 0) \ 2063 benchmark_width_, _Opt, +, 0, FMT_C, BPP_C, 0) \
2004 TESTQPLANARTOEI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, SUB_B, BPP_B, \ 2064 TESTQPLANARTOEI(FMT_PLANAR, SUBSAMP_X, SUBSAMP_Y, FMT_B, SUB_B, BPP_B, \
2005 benchmark_width_, _Premult, +, 0, FMT_C, BPP_C, 1) 2065 benchmark_width_, _Premult, +, 0, FMT_C, BPP_C, 1)
2006 2066
2007 TESTQPLANARTOE(I420Alpha, 2, 2, ARGB, 1, 4, ABGR, 4) 2067 TESTQPLANARTOE(I420Alpha, 2, 2, ARGB, 1, 4, ABGR, 4)
2008 TESTQPLANARTOE(I420Alpha, 2, 2, ABGR, 1, 4, ARGB, 4) 2068 TESTQPLANARTOE(I420Alpha, 2, 2, ABGR, 1, 4, ARGB, 4)
2009 2069
2010 } // namespace libyuv 2070 } // namespace libyuv
OLDNEW
« no previous file with comments | « include/libyuv/version.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698