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 2340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2351 } | 2351 } |
2352 | 2352 |
2353 TEST_F(LibYUVPlanarTest, SetPlane_Opt) { | 2353 TEST_F(LibYUVPlanarTest, SetPlane_Opt) { |
2354 int max_diff = TestARGBRect(benchmark_width_, benchmark_height_, | 2354 int max_diff = TestARGBRect(benchmark_width_, benchmark_height_, |
2355 benchmark_iterations_, | 2355 benchmark_iterations_, |
2356 disable_cpu_flags_, benchmark_cpu_info_, | 2356 disable_cpu_flags_, benchmark_cpu_info_, |
2357 +1, 0, 1); | 2357 +1, 0, 1); |
2358 EXPECT_EQ(0, max_diff); | 2358 EXPECT_EQ(0, max_diff); |
2359 } | 2359 } |
2360 | 2360 |
| 2361 TEST_F(LibYUVPlanarTest, MergeUVPlane_Opt) { |
| 2362 const int kPixels = benchmark_width_ * benchmark_height_; |
| 2363 align_buffer_page_end(src_pixels, kPixels * 2); |
| 2364 align_buffer_page_end(tmp_pixels_u, kPixels); |
| 2365 align_buffer_page_end(tmp_pixels_v, kPixels); |
| 2366 align_buffer_page_end(dst_pixels_opt, kPixels * 2); |
| 2367 align_buffer_page_end(dst_pixels_c, kPixels * 2); |
| 2368 |
| 2369 MemRandomize(src_pixels, kPixels * 2); |
| 2370 MemRandomize(tmp_pixels_u, kPixels); |
| 2371 MemRandomize(tmp_pixels_v, kPixels); |
| 2372 MemRandomize(dst_pixels_opt, kPixels * 2); |
| 2373 MemRandomize(dst_pixels_c, kPixels * 2); |
| 2374 |
| 2375 MaskCpuFlags(disable_cpu_flags_); |
| 2376 SplitUVPlane(src_pixels, benchmark_width_ * 2, |
| 2377 tmp_pixels_u, benchmark_width_, |
| 2378 tmp_pixels_v, benchmark_width_, |
| 2379 benchmark_width_, benchmark_height_); |
| 2380 MergeUVPlane(tmp_pixels_u, benchmark_width_, |
| 2381 tmp_pixels_v, benchmark_width_, |
| 2382 dst_pixels_c, benchmark_width_ * 2, |
| 2383 benchmark_width_, benchmark_height_); |
| 2384 MaskCpuFlags(benchmark_cpu_info_); |
| 2385 |
| 2386 SplitUVPlane(src_pixels, benchmark_width_ * 2, |
| 2387 tmp_pixels_u, benchmark_width_, |
| 2388 tmp_pixels_v, benchmark_width_, |
| 2389 benchmark_width_, benchmark_height_); |
| 2390 |
| 2391 for (int i = 0; i < benchmark_iterations_; ++i) { |
| 2392 MergeUVPlane(tmp_pixels_u, benchmark_width_, |
| 2393 tmp_pixels_v, benchmark_width_, |
| 2394 dst_pixels_opt, benchmark_width_ * 2, |
| 2395 benchmark_width_, benchmark_height_); |
| 2396 } |
| 2397 |
| 2398 for (int i = 0; i < kPixels * 2; ++i) { |
| 2399 EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); |
| 2400 } |
| 2401 |
| 2402 free_aligned_buffer_page_end(src_pixels); |
| 2403 free_aligned_buffer_page_end(tmp_pixels_u); |
| 2404 free_aligned_buffer_page_end(tmp_pixels_v); |
| 2405 free_aligned_buffer_page_end(dst_pixels_opt); |
| 2406 free_aligned_buffer_page_end(dst_pixels_c); |
| 2407 } |
| 2408 |
| 2409 TEST_F(LibYUVPlanarTest, SplitUVPlane_Opt) { |
| 2410 const int kPixels = benchmark_width_ * benchmark_height_; |
| 2411 align_buffer_page_end(src_pixels, kPixels * 2); |
| 2412 align_buffer_page_end(tmp_pixels_u, kPixels); |
| 2413 align_buffer_page_end(tmp_pixels_v, kPixels); |
| 2414 align_buffer_page_end(dst_pixels_opt, kPixels * 2); |
| 2415 align_buffer_page_end(dst_pixels_c, kPixels * 2); |
| 2416 |
| 2417 MemRandomize(src_pixels, kPixels * 2); |
| 2418 MemRandomize(tmp_pixels_u, kPixels); |
| 2419 MemRandomize(tmp_pixels_v, kPixels); |
| 2420 MemRandomize(dst_pixels_opt, kPixels * 2); |
| 2421 MemRandomize(dst_pixels_c, kPixels * 2); |
| 2422 |
| 2423 MaskCpuFlags(disable_cpu_flags_); |
| 2424 SplitUVPlane(src_pixels, benchmark_width_ * 2, |
| 2425 tmp_pixels_u, benchmark_width_, |
| 2426 tmp_pixels_v, benchmark_width_, |
| 2427 benchmark_width_, benchmark_height_); |
| 2428 MergeUVPlane(tmp_pixels_u, benchmark_width_, |
| 2429 tmp_pixels_v, benchmark_width_, |
| 2430 dst_pixels_c, benchmark_width_ * 2, |
| 2431 benchmark_width_, benchmark_height_); |
| 2432 MaskCpuFlags(benchmark_cpu_info_); |
| 2433 |
| 2434 for (int i = 0; i < benchmark_iterations_; ++i) { |
| 2435 SplitUVPlane(src_pixels, benchmark_width_ * 2, |
| 2436 tmp_pixels_u, benchmark_width_, |
| 2437 tmp_pixels_v, benchmark_width_, |
| 2438 benchmark_width_, benchmark_height_); |
| 2439 } |
| 2440 MergeUVPlane(tmp_pixels_u, benchmark_width_, |
| 2441 tmp_pixels_v, benchmark_width_, |
| 2442 dst_pixels_opt, benchmark_width_ * 2, |
| 2443 benchmark_width_, benchmark_height_); |
| 2444 |
| 2445 for (int i = 0; i < kPixels * 2; ++i) { |
| 2446 EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); |
| 2447 } |
| 2448 |
| 2449 free_aligned_buffer_page_end(src_pixels); |
| 2450 free_aligned_buffer_page_end(tmp_pixels_u); |
| 2451 free_aligned_buffer_page_end(tmp_pixels_v); |
| 2452 free_aligned_buffer_page_end(dst_pixels_opt); |
| 2453 free_aligned_buffer_page_end(dst_pixels_c); |
| 2454 } |
| 2455 |
2361 } // namespace libyuv | 2456 } // namespace libyuv |
OLD | NEW |