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

Side by Side Diff: unit_test/planar_test.cc

Issue 1507683003: Add support for odd height YUVA alpha blending. (Closed) Base URL: https://chromium.googlesource.com/libyuv/libyuv@master
Patch Set: add any and invert blend tests 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/planar_functions.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 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 } 1157 }
1158 1158
1159 TEST_F(LibYUVPlanarTest, ARGBBlend_Opt) { 1159 TEST_F(LibYUVPlanarTest, ARGBBlend_Opt) {
1160 int max_diff = TestBlend(benchmark_width_, benchmark_height_, 1160 int max_diff = TestBlend(benchmark_width_, benchmark_height_,
1161 benchmark_iterations_, 1161 benchmark_iterations_,
1162 disable_cpu_flags_, benchmark_cpu_info_, +1, 0); 1162 disable_cpu_flags_, benchmark_cpu_info_, +1, 0);
1163 EXPECT_LE(max_diff, 1); 1163 EXPECT_LE(max_diff, 1);
1164 } 1164 }
1165 1165
1166 #ifdef HAS_BLENDPLANEROW_AVX2 1166 #ifdef HAS_BLENDPLANEROW_AVX2
1167 // TODO(fbarchard): Switch to I420Blend.
1168 static void TestBlendPlaneRow(int width, int height, int benchmark_iterations, 1167 static void TestBlendPlaneRow(int width, int height, int benchmark_iterations,
1169 int invert, int off) { 1168 int invert, int off) {
1170 int has_ssse3 = TestCpuFlag(kCpuHasSSSE3); 1169 int has_ssse3 = TestCpuFlag(kCpuHasSSSE3);
1171 int has_avx2 = TestCpuFlag(kCpuHasAVX2); 1170 int has_avx2 = TestCpuFlag(kCpuHasAVX2);
1172 width = width * height; 1171 width = width * height;
1173 height = 1; 1172 height = 1;
1174 if (width < 256) { 1173 if (width < 256) {
1175 width = 256; 1174 width = 256;
1176 } 1175 }
1177 const int kBpp = 1; 1176 const int kBpp = 1;
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1341 } 1340 }
1342 1341
1343 TEST_F(LibYUVPlanarTest, BlendPlane_Opt) { 1342 TEST_F(LibYUVPlanarTest, BlendPlane_Opt) {
1344 TestBlendPlane(benchmark_width_, benchmark_height_, benchmark_iterations_, 1343 TestBlendPlane(benchmark_width_, benchmark_height_, benchmark_iterations_,
1345 disable_cpu_flags_, benchmark_cpu_info_, +1, 0); 1344 disable_cpu_flags_, benchmark_cpu_info_, +1, 0);
1346 } 1345 }
1347 TEST_F(LibYUVPlanarTest, BlendPlane_Unaligned) { 1346 TEST_F(LibYUVPlanarTest, BlendPlane_Unaligned) {
1348 TestBlendPlane(benchmark_width_, benchmark_height_, benchmark_iterations_, 1347 TestBlendPlane(benchmark_width_, benchmark_height_, benchmark_iterations_,
1349 disable_cpu_flags_, benchmark_cpu_info_, +1, 1); 1348 disable_cpu_flags_, benchmark_cpu_info_, +1, 1);
1350 } 1349 }
1350 TEST_F(LibYUVPlanarTest, BlendPlane_Any) {
1351 TestBlendPlane(benchmark_width_ - 4, benchmark_height_, benchmark_iterations_,
1352 disable_cpu_flags_, benchmark_cpu_info_, +1, 1);
1353 }
1354 TEST_F(LibYUVPlanarTest, BlendPlane_Invert) {
1355 TestBlendPlane(benchmark_width_, benchmark_height_, benchmark_iterations_,
1356 disable_cpu_flags_, benchmark_cpu_info_, -1, 1);
1357 }
1351 1358
1352 #define SUBSAMPLE(v, a) ((((v) + (a) - 1)) / (a)) 1359 #define SUBSAMPLE(v, a) ((((v) + (a) - 1)) / (a))
1353 1360
1354 static void TestI420Blend(int width, int height, int benchmark_iterations, 1361 static void TestI420Blend(int width, int height, int benchmark_iterations,
1355 int disable_cpu_flags, int benchmark_cpu_info, 1362 int disable_cpu_flags, int benchmark_cpu_info,
1356 int invert, int off) { 1363 int invert, int off) {
1357 width = ((width) > 0) ? (width) : 1; 1364 width = ((width) > 0) ? (width) : 1;
1358 const int kStrideUV = SUBSAMPLE(width, 2); 1365 const int kStrideUV = SUBSAMPLE(width, 2);
1359 const int kSizeUV = kStrideUV * SUBSAMPLE(height, 2); 1366 const int kSizeUV = kStrideUV * SUBSAMPLE(height, 2);
1360 align_buffer_64(src_y0, width * height + off); 1367 align_buffer_64(src_y0, width * height + off);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1435 } 1442 }
1436 1443
1437 TEST_F(LibYUVPlanarTest, I420Blend_Opt) { 1444 TEST_F(LibYUVPlanarTest, I420Blend_Opt) {
1438 TestI420Blend(benchmark_width_, benchmark_height_, benchmark_iterations_, 1445 TestI420Blend(benchmark_width_, benchmark_height_, benchmark_iterations_,
1439 disable_cpu_flags_, benchmark_cpu_info_, +1, 0); 1446 disable_cpu_flags_, benchmark_cpu_info_, +1, 0);
1440 } 1447 }
1441 TEST_F(LibYUVPlanarTest, I420Blend_Unaligned) { 1448 TEST_F(LibYUVPlanarTest, I420Blend_Unaligned) {
1442 TestI420Blend(benchmark_width_, benchmark_height_, benchmark_iterations_, 1449 TestI420Blend(benchmark_width_, benchmark_height_, benchmark_iterations_,
1443 disable_cpu_flags_, benchmark_cpu_info_, +1, 1); 1450 disable_cpu_flags_, benchmark_cpu_info_, +1, 1);
1444 } 1451 }
1452 TEST_F(LibYUVPlanarTest, I420Blend_Any) {
1453 TestI420Blend(benchmark_width_ - 4, benchmark_height_, benchmark_iterations_,
1454 disable_cpu_flags_, benchmark_cpu_info_, +1, 0);
1455 }
1456 TEST_F(LibYUVPlanarTest, I420Blend_Invert) {
1457 TestI420Blend(benchmark_width_, benchmark_height_, benchmark_iterations_,
1458 disable_cpu_flags_, benchmark_cpu_info_, -1, 0);
1459 }
1445 1460
1446 TEST_F(LibYUVPlanarTest, TestAffine) { 1461 TEST_F(LibYUVPlanarTest, TestAffine) {
1447 SIMD_ALIGNED(uint8 orig_pixels_0[1280][4]); 1462 SIMD_ALIGNED(uint8 orig_pixels_0[1280][4]);
1448 SIMD_ALIGNED(uint8 interpolate_pixels_C[1280][4]); 1463 SIMD_ALIGNED(uint8 interpolate_pixels_C[1280][4]);
1449 1464
1450 for (int i = 0; i < 1280; ++i) { 1465 for (int i = 0; i < 1280; ++i) {
1451 for (int j = 0; j < 4; ++j) { 1466 for (int j = 0; j < 4; ++j) {
1452 orig_pixels_0[i][j] = i; 1467 orig_pixels_0[i][j] = i;
1453 } 1468 }
1454 } 1469 }
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after
2625 2640
2626 TEST_F(LibYUVPlanarTest, SetPlane_Opt) { 2641 TEST_F(LibYUVPlanarTest, SetPlane_Opt) {
2627 int max_diff = TestARGBRect(benchmark_width_, benchmark_height_, 2642 int max_diff = TestARGBRect(benchmark_width_, benchmark_height_,
2628 benchmark_iterations_, 2643 benchmark_iterations_,
2629 disable_cpu_flags_, benchmark_cpu_info_, 2644 disable_cpu_flags_, benchmark_cpu_info_,
2630 +1, 0, 1); 2645 +1, 0, 1);
2631 EXPECT_EQ(0, max_diff); 2646 EXPECT_EQ(0, max_diff);
2632 } 2647 }
2633 2648
2634 } // namespace libyuv 2649 } // namespace libyuv
OLDNEW
« no previous file with comments | « source/planar_functions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698