diff options
author | Frank Barchard <fbarchard@google.com> | 2022-11-16 18:02:34 -0800 |
---|---|---|
committer | libyuv LUCI CQ <libyuv-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-11-17 02:47:57 +0000 |
commit | 2d2cee418a18b9f1bfa6b8037d4f8da095720695 (patch) | |
tree | 049f9ca258653794581a45af7a11a764e7e1ad44 /unit_test/planar_test.cc | |
parent | 6f21862f1b741088b0c2c3ff894af6b82634015c (diff) | |
download | libyuv-2d2cee418a18b9f1bfa6b8037d4f8da095720695.tar.gz |
Add Detile_16 planar function for 10 bit MT2T format
- Neon and SSE2
- Any for odd widths
Pixel 2 little core AArch32 build
C
TestDetilePlane_16 (1275 ms)
TestDetilePlane (1203 ms)
Neon
TestDetilePlane_16 (693 ms)
TestDetilePlane (660 ms)
Bug: b/258474032
Change-Id: Idbd09c5e9324e4deef5f1d54090d4b63cc7db812
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/4031848
Reviewed-by: Wan-Teh Chang <wtc@google.com>
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
Diffstat (limited to 'unit_test/planar_test.cc')
-rw-r--r-- | unit_test/planar_test.cc | 93 |
1 files changed, 66 insertions, 27 deletions
diff --git a/unit_test/planar_test.cc b/unit_test/planar_test.cc index 3a8c470b..4f462d0a 100644 --- a/unit_test/planar_test.cc +++ b/unit_test/planar_test.cc @@ -1638,29 +1638,29 @@ TEST_F(LibYUVPlanarTest, TestDetilePlane) { int i, j; // orig is tiled. Allocate enough memory for tiles. - int orig_width = (benchmark_width_ + 15) & ~15; - int orig_height = (benchmark_height_ + 15) & ~15; - int orig_plane_size = orig_width * orig_height; + int tile_width = (benchmark_width_ + 15) & ~15; + int tile_height = (benchmark_height_ + 15) & ~15; + int tile_plane_size = tile_width * tile_height; int y_plane_size = benchmark_width_ * benchmark_height_; - align_buffer_page_end(orig_y, orig_plane_size); + align_buffer_page_end(tile_y, tile_plane_size); align_buffer_page_end(dst_c, y_plane_size); align_buffer_page_end(dst_opt, y_plane_size); - MemRandomize(orig_y, orig_plane_size); + MemRandomize(tile_y, tile_plane_size); memset(dst_c, 0, y_plane_size); memset(dst_opt, 0, y_plane_size); // Disable all optimizations. MaskCpuFlags(disable_cpu_flags_); for (j = 0; j < benchmark_iterations_; j++) { - DetilePlane(orig_y, orig_width, dst_c, benchmark_width_, benchmark_width_, + DetilePlane(tile_y, tile_width, dst_c, benchmark_width_, benchmark_width_, benchmark_height_, 16); } // Enable optimizations. MaskCpuFlags(benchmark_cpu_info_); for (j = 0; j < benchmark_iterations_; j++) { - DetilePlane(orig_y, orig_width, dst_opt, benchmark_width_, benchmark_width_, + DetilePlane(tile_y, tile_width, dst_opt, benchmark_width_, benchmark_width_, benchmark_height_, 16); } @@ -1668,7 +1668,46 @@ TEST_F(LibYUVPlanarTest, TestDetilePlane) { EXPECT_EQ(dst_c[i], dst_opt[i]); } - free_aligned_buffer_page_end(orig_y); + free_aligned_buffer_page_end(tile_y); + free_aligned_buffer_page_end(dst_c); + free_aligned_buffer_page_end(dst_opt); +} + +TEST_F(LibYUVPlanarTest, TestDetilePlane_16) { + int i, j; + + // orig is tiled. Allocate enough memory for tiles. + int tile_width = (benchmark_width_ + 15) & ~15; + int tile_height = (benchmark_height_ + 15) & ~15; + int tile_plane_size = tile_width * tile_height * 2; + int y_plane_size = benchmark_width_ * benchmark_height_ * 2; + align_buffer_page_end(tile_y, tile_plane_size); + align_buffer_page_end(dst_c, y_plane_size); + align_buffer_page_end(dst_opt, y_plane_size); + + MemRandomize(tile_y, tile_plane_size); + memset(dst_c, 0, y_plane_size); + memset(dst_opt, 0, y_plane_size); + + // Disable all optimizations. + MaskCpuFlags(disable_cpu_flags_); + for (j = 0; j < benchmark_iterations_; j++) { + DetilePlane_16((const uint16_t*)tile_y, tile_width, (uint16_t*)dst_c, + benchmark_width_, benchmark_width_, benchmark_height_, 16); + } + + // Enable optimizations. + MaskCpuFlags(benchmark_cpu_info_); + for (j = 0; j < benchmark_iterations_; j++) { + DetilePlane_16((const uint16_t*)tile_y, tile_width, (uint16_t*)dst_opt, + benchmark_width_, benchmark_width_, benchmark_height_, 16); + } + + for (i = 0; i < y_plane_size; ++i) { + EXPECT_EQ(dst_c[i], dst_opt[i]); + } + + free_aligned_buffer_page_end(tile_y); free_aligned_buffer_page_end(dst_c); free_aligned_buffer_page_end(dst_opt); } @@ -1678,33 +1717,33 @@ TEST_F(LibYUVPlanarTest, TestDetileSplitUVPlane_Correctness) { int i, j; // orig is tiled. Allocate enough memory for tiles. - int orig_width = (benchmark_width_ + 15) & ~15; - int orig_height = (benchmark_height_ + 15) & ~15; - int orig_plane_size = orig_width * orig_height; + int tile_width = (benchmark_width_ + 15) & ~15; + int tile_height = (benchmark_height_ + 15) & ~15; + int tile_plane_size = tile_width * tile_height; int uv_plane_size = ((benchmark_width_ + 1) / 2) * benchmark_height_; - align_buffer_page_end(orig_uv, orig_plane_size); - align_buffer_page_end(detiled_uv, orig_plane_size); + align_buffer_page_end(tile_uv, tile_plane_size); + align_buffer_page_end(detiled_uv, tile_plane_size); align_buffer_page_end(dst_u_two_stage, uv_plane_size); align_buffer_page_end(dst_u_opt, uv_plane_size); align_buffer_page_end(dst_v_two_stage, uv_plane_size); align_buffer_page_end(dst_v_opt, uv_plane_size); - MemRandomize(orig_uv, orig_plane_size); - memset(detiled_uv, 0, orig_plane_size); + MemRandomize(tile_uv, tile_plane_size); + memset(detiled_uv, 0, tile_plane_size); memset(dst_u_two_stage, 0, uv_plane_size); memset(dst_u_opt, 0, uv_plane_size); memset(dst_v_two_stage, 0, uv_plane_size); memset(dst_v_opt, 0, uv_plane_size); - DetileSplitUVPlane(orig_uv, orig_width, dst_u_opt, (benchmark_width_ + 1) / 2, + DetileSplitUVPlane(tile_uv, tile_width, dst_u_opt, (benchmark_width_ + 1) / 2, dst_v_opt, (benchmark_width_ + 1) / 2, benchmark_width_, benchmark_height_, 16); // Benchmark 2 step conversion for comparison. for (j = 0; j < benchmark_iterations_; j++) { - DetilePlane(orig_uv, orig_width, detiled_uv, benchmark_width_, + DetilePlane(tile_uv, tile_width, detiled_uv, benchmark_width_, benchmark_width_, benchmark_height_, 16); - SplitUVPlane(detiled_uv, orig_width, dst_u_two_stage, + SplitUVPlane(detiled_uv, tile_width, dst_u_two_stage, (benchmark_width_ + 1) / 2, dst_v_two_stage, (benchmark_width_ + 1) / 2, (benchmark_width_ + 1) / 2, benchmark_height_); @@ -1715,7 +1754,7 @@ TEST_F(LibYUVPlanarTest, TestDetileSplitUVPlane_Correctness) { EXPECT_EQ(dst_v_two_stage[i], dst_v_opt[i]); } - free_aligned_buffer_page_end(orig_uv); + free_aligned_buffer_page_end(tile_uv); free_aligned_buffer_page_end(detiled_uv); free_aligned_buffer_page_end(dst_u_two_stage); free_aligned_buffer_page_end(dst_u_opt); @@ -1727,17 +1766,17 @@ TEST_F(LibYUVPlanarTest, TestDetileSplitUVPlane_Benchmark) { int i, j; // orig is tiled. Allocate enough memory for tiles. - int orig_width = (benchmark_width_ + 15) & ~15; - int orig_height = (benchmark_height_ + 15) & ~15; - int orig_plane_size = orig_width * orig_height; + int tile_width = (benchmark_width_ + 15) & ~15; + int tile_height = (benchmark_height_ + 15) & ~15; + int tile_plane_size = tile_width * tile_height; int uv_plane_size = ((benchmark_width_ + 1) / 2) * benchmark_height_; - align_buffer_page_end(orig_uv, orig_plane_size); + align_buffer_page_end(tile_uv, tile_plane_size); align_buffer_page_end(dst_u_c, uv_plane_size); align_buffer_page_end(dst_u_opt, uv_plane_size); align_buffer_page_end(dst_v_c, uv_plane_size); align_buffer_page_end(dst_v_opt, uv_plane_size); - MemRandomize(orig_uv, orig_plane_size); + MemRandomize(tile_uv, tile_plane_size); memset(dst_u_c, 0, uv_plane_size); memset(dst_u_opt, 0, uv_plane_size); memset(dst_v_c, 0, uv_plane_size); @@ -1746,7 +1785,7 @@ TEST_F(LibYUVPlanarTest, TestDetileSplitUVPlane_Benchmark) { // Disable all optimizations. MaskCpuFlags(disable_cpu_flags_); - DetileSplitUVPlane(orig_uv, orig_width, dst_u_c, (benchmark_width_ + 1) / 2, + DetileSplitUVPlane(tile_uv, tile_width, dst_u_c, (benchmark_width_ + 1) / 2, dst_v_c, (benchmark_width_ + 1) / 2, benchmark_width_, benchmark_height_, 16); @@ -1755,7 +1794,7 @@ TEST_F(LibYUVPlanarTest, TestDetileSplitUVPlane_Benchmark) { for (j = 0; j < benchmark_iterations_; j++) { DetileSplitUVPlane( - orig_uv, orig_width, dst_u_opt, (benchmark_width_ + 1) / 2, dst_v_opt, + tile_uv, tile_width, dst_u_opt, (benchmark_width_ + 1) / 2, dst_v_opt, (benchmark_width_ + 1) / 2, benchmark_width_, benchmark_height_, 16); } @@ -1764,7 +1803,7 @@ TEST_F(LibYUVPlanarTest, TestDetileSplitUVPlane_Benchmark) { EXPECT_EQ(dst_v_c[i], dst_v_opt[i]); } - free_aligned_buffer_page_end(orig_uv); + free_aligned_buffer_page_end(tile_uv); free_aligned_buffer_page_end(dst_u_c); free_aligned_buffer_page_end(dst_u_opt); free_aligned_buffer_page_end(dst_v_c); |