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

Side by Side Diff: unit_test/planar_test.cc

Issue 1995293002: Add ARGBExtractAlpha function (Closed) Base URL: https://chromium.googlesource.com/libyuv/libyuv@master
Patch Set: Use packuswb xmm0, xmm0 instead Created 4 years, 6 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 | « source/row_win.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 2372 matching lines...) Expand 10 before | Expand all | Expand 10 after
2383 } 2383 }
2384 for (int i = 0; i < kSize; ++i) { 2384 for (int i = 0; i < kSize; ++i) {
2385 EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); 2385 EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]);
2386 } 2386 }
2387 2387
2388 free_aligned_buffer_64(dst_pixels_c); 2388 free_aligned_buffer_64(dst_pixels_c);
2389 free_aligned_buffer_64(dst_pixels_opt); 2389 free_aligned_buffer_64(dst_pixels_opt);
2390 free_aligned_buffer_64(orig_pixels); 2390 free_aligned_buffer_64(orig_pixels);
2391 } 2391 }
2392 2392
2393 TEST_F(LibYUVPlanarTest, TestARGBExtractAlpha) {
2394 const int kPixels = benchmark_width_ * benchmark_height_;
2395 align_buffer_64(src_pixels, kPixels * 4);
2396 align_buffer_64(dst_pixels_opt, kPixels);
2397 align_buffer_64(dst_pixels_c, kPixels);
2398
2399 MemRandomize(src_pixels, kPixels * 4);
2400 MemRandomize(dst_pixels_opt, kPixels);
2401 memcpy(dst_pixels_c, dst_pixels_opt, kPixels);
2402
2403 MaskCpuFlags(disable_cpu_flags_);
2404 ARGBExtractAlpha(src_pixels, benchmark_width_ * 4,
2405 dst_pixels_c, benchmark_width_,
2406 benchmark_width_, benchmark_height_);
2407 MaskCpuFlags(benchmark_cpu_info_);
2408
2409 for (int i = 0; i < benchmark_iterations_; ++i) {
2410 ARGBExtractAlpha(src_pixels, benchmark_width_ * 4,
2411 dst_pixels_opt, benchmark_width_,
2412 benchmark_width_, benchmark_height_);
2413 }
2414 for (int i = 0; i < kPixels; ++i) {
2415 EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]);
2416 }
2417
2418 free_aligned_buffer_64(dst_pixels_c);
2419 free_aligned_buffer_64(dst_pixels_opt);
2420 free_aligned_buffer_64(src_pixels);
2421 }
2422
2393 TEST_F(LibYUVPlanarTest, TestARGBCopyYToAlpha) { 2423 TEST_F(LibYUVPlanarTest, TestARGBCopyYToAlpha) {
2394 const int kPixels = benchmark_width_ * benchmark_height_; 2424 const int kPixels = benchmark_width_ * benchmark_height_;
2395 align_buffer_64(orig_pixels, kPixels); 2425 align_buffer_64(orig_pixels, kPixels);
2396 align_buffer_64(dst_pixels_opt, kPixels * 4); 2426 align_buffer_64(dst_pixels_opt, kPixels * 4);
2397 align_buffer_64(dst_pixels_c, kPixels * 4); 2427 align_buffer_64(dst_pixels_c, kPixels * 4);
2398 2428
2399 MemRandomize(orig_pixels, kPixels); 2429 MemRandomize(orig_pixels, kPixels);
2400 MemRandomize(dst_pixels_opt, kPixels * 4); 2430 MemRandomize(dst_pixels_opt, kPixels * 4);
2401 memcpy(dst_pixels_c, dst_pixels_opt, kPixels * 4); 2431 memcpy(dst_pixels_c, dst_pixels_opt, kPixels * 4);
2402 2432
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
2523 2553
2524 TEST_F(LibYUVPlanarTest, SetPlane_Opt) { 2554 TEST_F(LibYUVPlanarTest, SetPlane_Opt) {
2525 int max_diff = TestARGBRect(benchmark_width_, benchmark_height_, 2555 int max_diff = TestARGBRect(benchmark_width_, benchmark_height_,
2526 benchmark_iterations_, 2556 benchmark_iterations_,
2527 disable_cpu_flags_, benchmark_cpu_info_, 2557 disable_cpu_flags_, benchmark_cpu_info_,
2528 +1, 0, 1); 2558 +1, 0, 1);
2529 EXPECT_EQ(0, max_diff); 2559 EXPECT_EQ(0, max_diff);
2530 } 2560 }
2531 2561
2532 } // namespace libyuv 2562 } // namespace libyuv
OLDNEW
« no previous file with comments | « source/row_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698