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

Side by Side Diff: unit_test/planar_test.cc

Issue 1533643005: Add rounding to InterpolateRow for improved quality and consistency. (Closed) Base URL: https://chromium.googlesource.com/libyuv/libyuv@master
Patch Set: lint fix in unittest Created 5 years 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 | « source/scale_common.cc ('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 891 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 902
903 ARGBInterpolate(&orig_pixels_0[0][0], 0, &orig_pixels_1[0][0], 0, 903 ARGBInterpolate(&orig_pixels_0[0][0], 0, &orig_pixels_1[0][0], 0,
904 &interpolate_pixels[0][0], 0, 4, 1, 128); 904 &interpolate_pixels[0][0], 0, 4, 1, 128);
905 EXPECT_EQ(8u, interpolate_pixels[0][0]); 905 EXPECT_EQ(8u, interpolate_pixels[0][0]);
906 EXPECT_EQ(16u, interpolate_pixels[0][1]); 906 EXPECT_EQ(16u, interpolate_pixels[0][1]);
907 EXPECT_EQ(32u, interpolate_pixels[0][2]); 907 EXPECT_EQ(32u, interpolate_pixels[0][2]);
908 EXPECT_EQ(64u, interpolate_pixels[0][3]); 908 EXPECT_EQ(64u, interpolate_pixels[0][3]);
909 EXPECT_EQ(0u, interpolate_pixels[1][0]); 909 EXPECT_EQ(0u, interpolate_pixels[1][0]);
910 EXPECT_EQ(0u, interpolate_pixels[1][1]); 910 EXPECT_EQ(0u, interpolate_pixels[1][1]);
911 EXPECT_EQ(0u, interpolate_pixels[1][2]); 911 EXPECT_EQ(0u, interpolate_pixels[1][2]);
912 EXPECT_NEAR(128u, interpolate_pixels[1][3], 1); // C = 127, SSE = 128. 912 EXPECT_EQ(128u, interpolate_pixels[1][3]);
913 EXPECT_EQ(0u, interpolate_pixels[2][0]); 913 EXPECT_EQ(0u, interpolate_pixels[2][0]);
914 EXPECT_EQ(0u, interpolate_pixels[2][1]); 914 EXPECT_EQ(0u, interpolate_pixels[2][1]);
915 EXPECT_EQ(0u, interpolate_pixels[2][2]); 915 EXPECT_EQ(0u, interpolate_pixels[2][2]);
916 EXPECT_EQ(0u, interpolate_pixels[2][3]); 916 EXPECT_EQ(0u, interpolate_pixels[2][3]);
917 EXPECT_NEAR(128u, interpolate_pixels[3][0], 1); 917 EXPECT_EQ(128u, interpolate_pixels[3][0]);
918 EXPECT_NEAR(128u, interpolate_pixels[3][1], 1); 918 EXPECT_EQ(128u, interpolate_pixels[3][1]);
919 EXPECT_NEAR(128u, interpolate_pixels[3][2], 1); 919 EXPECT_EQ(128u, interpolate_pixels[3][2]);
920 EXPECT_NEAR(128u, interpolate_pixels[3][3], 1); 920 EXPECT_EQ(128u, interpolate_pixels[3][3]);
921 921
922 ARGBInterpolate(&orig_pixels_0[0][0], 0, &orig_pixels_1[0][0], 0, 922 ARGBInterpolate(&orig_pixels_0[0][0], 0, &orig_pixels_1[0][0], 0,
923 &interpolate_pixels[0][0], 0, 4, 1, 0); 923 &interpolate_pixels[0][0], 0, 4, 1, 0);
924 EXPECT_EQ(16u, interpolate_pixels[0][0]); 924 EXPECT_EQ(16u, interpolate_pixels[0][0]);
925 EXPECT_EQ(32u, interpolate_pixels[0][1]); 925 EXPECT_EQ(32u, interpolate_pixels[0][1]);
926 EXPECT_EQ(64u, interpolate_pixels[0][2]); 926 EXPECT_EQ(64u, interpolate_pixels[0][2]);
927 EXPECT_EQ(128u, interpolate_pixels[0][3]); 927 EXPECT_EQ(128u, interpolate_pixels[0][3]);
928 928
929 ARGBInterpolate(&orig_pixels_0[0][0], 0, &orig_pixels_1[0][0], 0, 929 ARGBInterpolate(&orig_pixels_0[0][0], 0, &orig_pixels_1[0][0], 0,
930 &interpolate_pixels[0][0], 0, 4, 1, 192); 930 &interpolate_pixels[0][0], 0, 4, 1, 192);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 984
985 InterpolatePlane(&orig_pixels_0[0], 0, &orig_pixels_1[0], 0, 985 InterpolatePlane(&orig_pixels_0[0], 0, &orig_pixels_1[0], 0,
986 &interpolate_pixels[0], 0, 16, 1, 128); 986 &interpolate_pixels[0], 0, 16, 1, 128);
987 EXPECT_EQ(8u, interpolate_pixels[0]); 987 EXPECT_EQ(8u, interpolate_pixels[0]);
988 EXPECT_EQ(16u, interpolate_pixels[1]); 988 EXPECT_EQ(16u, interpolate_pixels[1]);
989 EXPECT_EQ(32u, interpolate_pixels[2]); 989 EXPECT_EQ(32u, interpolate_pixels[2]);
990 EXPECT_EQ(64u, interpolate_pixels[3]); 990 EXPECT_EQ(64u, interpolate_pixels[3]);
991 EXPECT_EQ(0u, interpolate_pixels[4]); 991 EXPECT_EQ(0u, interpolate_pixels[4]);
992 EXPECT_EQ(0u, interpolate_pixels[5]); 992 EXPECT_EQ(0u, interpolate_pixels[5]);
993 EXPECT_EQ(0u, interpolate_pixels[6]); 993 EXPECT_EQ(0u, interpolate_pixels[6]);
994 EXPECT_NEAR(128u, interpolate_pixels[7], 1); // C = 127, SSE = 128. 994 EXPECT_EQ(128u, interpolate_pixels[7]);
995 EXPECT_EQ(0u, interpolate_pixels[8]); 995 EXPECT_EQ(0u, interpolate_pixels[8]);
996 EXPECT_EQ(0u, interpolate_pixels[9]); 996 EXPECT_EQ(0u, interpolate_pixels[9]);
997 EXPECT_EQ(0u, interpolate_pixels[10]); 997 EXPECT_EQ(0u, interpolate_pixels[10]);
998 EXPECT_EQ(0u, interpolate_pixels[11]); 998 EXPECT_EQ(0u, interpolate_pixels[11]);
999 EXPECT_NEAR(128u, interpolate_pixels[12], 1); 999 EXPECT_EQ(128u, interpolate_pixels[12]);
1000 EXPECT_NEAR(128u, interpolate_pixels[13], 1); 1000 EXPECT_EQ(128u, interpolate_pixels[13]);
1001 EXPECT_NEAR(128u, interpolate_pixels[14], 1); 1001 EXPECT_EQ(128u, interpolate_pixels[14]);
1002 EXPECT_NEAR(128u, interpolate_pixels[15], 1); 1002 EXPECT_EQ(128u, interpolate_pixels[15]);
1003 1003
1004 InterpolatePlane(&orig_pixels_0[0], 0, &orig_pixels_1[0], 0, 1004 InterpolatePlane(&orig_pixels_0[0], 0, &orig_pixels_1[0], 0,
1005 &interpolate_pixels[0], 0, 16, 1, 0); 1005 &interpolate_pixels[0], 0, 16, 1, 0);
1006 EXPECT_EQ(16u, interpolate_pixels[0]); 1006 EXPECT_EQ(16u, interpolate_pixels[0]);
1007 EXPECT_EQ(32u, interpolate_pixels[1]); 1007 EXPECT_EQ(32u, interpolate_pixels[1]);
1008 EXPECT_EQ(64u, interpolate_pixels[2]); 1008 EXPECT_EQ(64u, interpolate_pixels[2]);
1009 EXPECT_EQ(128u, interpolate_pixels[3]); 1009 EXPECT_EQ(128u, interpolate_pixels[3]);
1010 1010
1011 InterpolatePlane(&orig_pixels_0[0], 0, &orig_pixels_1[0], 0, 1011 InterpolatePlane(&orig_pixels_0[0], 0, &orig_pixels_1[0], 0,
1012 &interpolate_pixels[0], 0, 16, 1, 192); 1012 &interpolate_pixels[0], 0, 16, 1, 192);
1013 1013
1014 EXPECT_EQ(4u, interpolate_pixels[0]); 1014 EXPECT_EQ(4u, interpolate_pixels[0]);
1015 EXPECT_EQ(8u, interpolate_pixels[1]); 1015 EXPECT_EQ(8u, interpolate_pixels[1]);
1016 EXPECT_EQ(16u,interpolate_pixels[2]); 1016 EXPECT_EQ(16u, interpolate_pixels[2]);
1017 EXPECT_EQ(32u, interpolate_pixels[3]); 1017 EXPECT_EQ(32u, interpolate_pixels[3]);
1018 1018
1019 for (int i = 0; i < benchmark_pixels_div1280_; ++i) { 1019 for (int i = 0; i < benchmark_pixels_div1280_; ++i) {
1020 InterpolatePlane(&orig_pixels_0[0], 0, &orig_pixels_1[0], 0, 1020 InterpolatePlane(&orig_pixels_0[0], 0, &orig_pixels_1[0], 0,
1021 &interpolate_pixels[0], 0, 1280, 1, 128); 1021 &interpolate_pixels[0], 0, 1280, 1, 123);
1022 } 1022 }
1023 } 1023 }
1024 1024
1025 #define TESTTERP(FMT_A, BPP_A, STRIDE_A, \ 1025 #define TESTTERP(FMT_A, BPP_A, STRIDE_A, \
1026 FMT_B, BPP_B, STRIDE_B, \ 1026 FMT_B, BPP_B, STRIDE_B, \
1027 W1280, TERP, DIFF, N, NEG, OFF) \ 1027 W1280, TERP, DIFF, N, NEG, OFF) \
1028 TEST_F(LibYUVPlanarTest, ARGBInterpolate##TERP##N) { \ 1028 TEST_F(LibYUVPlanarTest, ARGBInterpolate##TERP##N) { \
1029 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \ 1029 const int kWidth = ((W1280) > 0) ? (W1280) : 1; \
1030 const int kHeight = benchmark_height_; \ 1030 const int kHeight = benchmark_height_; \
1031 const int kStrideA = (kWidth * BPP_A + STRIDE_A - 1) / STRIDE_A * STRIDE_A; \ 1031 const int kStrideA = (kWidth * BPP_A + STRIDE_A - 1) / STRIDE_A * STRIDE_A; \
(...skipping 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after
2640 2640
2641 TEST_F(LibYUVPlanarTest, SetPlane_Opt) { 2641 TEST_F(LibYUVPlanarTest, SetPlane_Opt) {
2642 int max_diff = TestARGBRect(benchmark_width_, benchmark_height_, 2642 int max_diff = TestARGBRect(benchmark_width_, benchmark_height_,
2643 benchmark_iterations_, 2643 benchmark_iterations_,
2644 disable_cpu_flags_, benchmark_cpu_info_, 2644 disable_cpu_flags_, benchmark_cpu_info_,
2645 +1, 0, 1); 2645 +1, 0, 1);
2646 EXPECT_EQ(0, max_diff); 2646 EXPECT_EQ(0, max_diff);
2647 } 2647 }
2648 2648
2649 } // namespace libyuv 2649 } // namespace libyuv
OLDNEW
« no previous file with comments | « source/scale_common.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698