diff options
author | Frank Barchard <fbarchard@google.com> | 2020-03-20 15:22:53 -0700 |
---|---|---|
committer | Frank Barchard <fbarchard@chromium.org> | 2020-03-21 20:19:44 +0000 |
commit | b5e223ac4c8ccfbc6bef874fb5e0781809570170 (patch) | |
tree | b1f184963e659d9b836d21253244d3d15ef94c5c /unit_test | |
parent | 45f1f2b201672b699b35da20267a5f2c41318264 (diff) | |
download | libyuv-b5e223ac4c8ccfbc6bef874fb5e0781809570170.tar.gz |
Upstream all libyuv changes to version 1746 Prefetch for all arm functions - helps performance at higher resolutions Make MirrorPlane function public.
Bug: libyuv:855
Change-Id: I4020face6b52767ee78d81870314285d63e98b95
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/2113650
Reviewed-by: Hsiu Wang <hsiu@google.com>
Diffstat (limited to 'unit_test')
-rw-r--r-- | unit_test/planar_test.cc | 69 | ||||
-rw-r--r-- | unit_test/rotate_argb_test.cc | 42 |
2 files changed, 79 insertions, 32 deletions
diff --git a/unit_test/planar_test.cc b/unit_test/planar_test.cc index c75f715a..f97ad9a7 100644 --- a/unit_test/planar_test.cc +++ b/unit_test/planar_test.cc @@ -804,6 +804,23 @@ TEST_F(LibYUVPlanarTest, TestARGBMirror) { } } +TEST_F(LibYUVPlanarTest, TestMirrorPlane) { + SIMD_ALIGNED(uint8_t orig_pixels[1280]); + SIMD_ALIGNED(uint8_t dst_pixels[1280]); + + for (int i = 0; i < 1280; ++i) { + orig_pixels[i] = i; + } + MirrorPlane(&orig_pixels[0], 0, &dst_pixels[0], 0, 1280, 1); + + for (int i = 0; i < 1280; ++i) { + EXPECT_EQ(i & 255, dst_pixels[1280 - 1 - i]); + } + for (int i = 0; i < benchmark_pixels_div1280_; ++i) { + MirrorPlane(&orig_pixels[0], 0, &dst_pixels[0], 0, 1280, 1); + } +} + TEST_F(LibYUVPlanarTest, TestShade) { SIMD_ALIGNED(uint8_t orig_pixels[1280][4]); SIMD_ALIGNED(uint8_t shade_pixels[1280][4]); @@ -3315,8 +3332,8 @@ TEST_F(LibYUVPlanarTest, TestGaussCol_Opt) { } #else GaussCol_C(&orig_pixels[0], &orig_pixels[1280], &orig_pixels[1280 * 2], - &orig_pixels[1280 * 3], &orig_pixels[1280 * 4], &dst_pixels_opt[0], - 1280); + &orig_pixels[1280 * 3], &orig_pixels[1280 * 4], + &dst_pixels_opt[0], 1280); #endif } @@ -3369,36 +3386,24 @@ TEST_F(LibYUVPlanarTest, TestGaussCol_F32_Opt) { for (int i = 0; i < 1280 * 5; ++i) { orig_pixels[i] = static_cast<float>(i); } - GaussCol_F32_C(&orig_pixels[0], - &orig_pixels[1280], - &orig_pixels[1280 * 2], - &orig_pixels[1280 * 3], - &orig_pixels[1280 * 4], - &dst_pixels_c[0], 1280); + GaussCol_F32_C(&orig_pixels[0], &orig_pixels[1280], &orig_pixels[1280 * 2], + &orig_pixels[1280 * 3], &orig_pixels[1280 * 4], + &dst_pixels_c[0], 1280); for (int i = 0; i < benchmark_pixels_div1280_; ++i) { #if !defined(LIBYUV_DISABLE_NEON) && defined(__aarch64__) int has_neon = TestCpuFlag(kCpuHasNEON); if (has_neon) { - GaussCol_F32_NEON(&orig_pixels[0], - &orig_pixels[1280], - &orig_pixels[1280 * 2], - &orig_pixels[1280 * 3], - &orig_pixels[1280 * 4], - &dst_pixels_opt[0], 1280); + GaussCol_F32_NEON(&orig_pixels[0], &orig_pixels[1280], + &orig_pixels[1280 * 2], &orig_pixels[1280 * 3], + &orig_pixels[1280 * 4], &dst_pixels_opt[0], 1280); } else { - GaussCol_F32_C(&orig_pixels[0], - &orig_pixels[1280], - &orig_pixels[1280 * 2], - &orig_pixels[1280 * 3], - &orig_pixels[1280 * 4], - &dst_pixels_opt[0], 1280); + GaussCol_F32_C(&orig_pixels[0], &orig_pixels[1280], + &orig_pixels[1280 * 2], &orig_pixels[1280 * 3], + &orig_pixels[1280 * 4], &dst_pixels_opt[0], 1280); } #else - GaussCol_F32_C(&orig_pixels[0], - &orig_pixels[1280], - &orig_pixels[1280 * 2], - &orig_pixels[1280 * 3], - &orig_pixels[1280 * 4], + GaussCol_F32_C(&orig_pixels[0], &orig_pixels[1280], &orig_pixels[1280 * 2], + &orig_pixels[1280 * 3], &orig_pixels[1280 * 4], &dst_pixels_opt[0], 1280); #endif } @@ -3455,18 +3460,18 @@ TEST_F(LibYUVPlanarTest, TestGaussPlane_F32) { MaskCpuFlags(disable_cpu_flags_); GaussPlane_F32((const float*)(orig_pixels), benchmark_width_, - (float*)(dst_pixels_c), benchmark_width_, - benchmark_width_, benchmark_height_); + (float*)(dst_pixels_c), benchmark_width_, benchmark_width_, + benchmark_height_); MaskCpuFlags(benchmark_cpu_info_); for (int i = 0; i < benchmark_iterations_; ++i) { GaussPlane_F32((const float*)(orig_pixels), benchmark_width_, - (float*)(dst_pixels_opt), benchmark_width_, - benchmark_width_, benchmark_height_); + (float*)(dst_pixels_opt), benchmark_width_, benchmark_width_, + benchmark_height_); } - for (int i = 0; i < benchmark_width_ * benchmark_height_ ; ++i) { - EXPECT_NEAR(((float*)(dst_pixels_c)) [i], - ((float*)(dst_pixels_opt))[i], 1.f) << i; + for (int i = 0; i < benchmark_width_ * benchmark_height_; ++i) { + EXPECT_NEAR(((float*)(dst_pixels_c))[i], ((float*)(dst_pixels_opt))[i], 1.f) + << i; } free_aligned_buffer_page_end(dst_pixels_c); diff --git a/unit_test/rotate_argb_test.cc b/unit_test/rotate_argb_test.cc index d2003895..3208b66a 100644 --- a/unit_test/rotate_argb_test.cc +++ b/unit_test/rotate_argb_test.cc @@ -183,4 +183,46 @@ TEST_F(LibYUVRotateTest, DISABLED_RotatePlane270_Odd) { benchmark_cpu_info_); } +TEST_F(LibYUVRotateTest, RotatePlane90_TestStride) { + int argb_plane_size = benchmark_width_ * 4 * abs(benchmark_height_); + + align_buffer_page_end(src_argb, argb_plane_size); + align_buffer_page_end(dst_argb, argb_plane_size); + + EXPECT_EQ(0, ARGBRotate(src_argb, benchmark_width_ * 4, dst_argb, + benchmark_width_ * 4, benchmark_width_, + benchmark_height_, kRotate0)); + + EXPECT_EQ(0, ARGBRotate(src_argb, benchmark_width_ * 4 - 1, dst_argb, + benchmark_width_ * 4 - 1, benchmark_width_ - 1, + benchmark_height_, kRotate0)); + + EXPECT_EQ(0, ARGBRotate(src_argb, benchmark_width_ * 4, dst_argb, + benchmark_width_ * 4, benchmark_width_, + benchmark_height_, kRotate180)); + + EXPECT_EQ(0, ARGBRotate(src_argb, benchmark_width_ * 4 - 1, dst_argb, + benchmark_width_ * 4 - 1, benchmark_width_ - 1, + benchmark_height_, kRotate180)); + + EXPECT_EQ(0, ARGBRotate(src_argb, benchmark_width_ * 4, dst_argb, + abs(benchmark_height_) * 4, benchmark_width_, + benchmark_height_, kRotate90)); + + EXPECT_EQ(-1, ARGBRotate(src_argb, benchmark_width_ * 4 - 1, dst_argb, + abs(benchmark_height_) * 4, benchmark_width_ - 1, + benchmark_height_, kRotate90)); + + EXPECT_EQ(0, ARGBRotate(src_argb, benchmark_width_ * 4, dst_argb, + abs(benchmark_height_) * 4, benchmark_width_, + benchmark_height_, kRotate270)); + + EXPECT_EQ(-1, ARGBRotate(src_argb, benchmark_width_ * 4 - 1, dst_argb, + abs(benchmark_height_) * 4, benchmark_width_ - 1, + benchmark_height_, kRotate270)); + + free_aligned_buffer_page_end(dst_argb); + free_aligned_buffer_page_end(src_argb); +} + } // namespace libyuv |