From 1200ef4a3794fa6589c9bef8ec587f0609af7e09 Mon Sep 17 00:00:00 2001 From: Frank Barchard Date: Mon, 11 Sep 2017 14:59:22 -0700 Subject: [PATCH] Gauss unittest reduce buffer sizes on stack Reduce buffers for test to 640 from 1280 to avoid bit stack warning. TBR=kjellander@chromium.org BUG=libyuv:730 TEST=LibYUVPlanarTest.TestGaussRow_Opt and LibYUVPlanarTest.TestGaussCol_Opt Change-Id: I710af3e952f9a4d1c0c0c8f73922c1d98ad9aa29 Reviewed-on: https://chromium-review.googlesource.com/660662 Reviewed-by: Frank Barchard --- unit_test/planar_test.cc | 65 ++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/unit_test/planar_test.cc b/unit_test/planar_test.cc index f5b5174c6..3decca8b2 100644 --- a/unit_test/planar_test.cc +++ b/unit_test/planar_test.cc @@ -2824,39 +2824,39 @@ extern "C" void GaussRow_NEON(const uint32* src, uint16* dst, int width); extern "C" void GaussRow_C(const uint32* src, uint16* dst, int width); TEST_F(LibYUVPlanarTest, TestGaussRow_Opt) { - SIMD_ALIGNED(uint32 orig_pixels[1280 + 4]); - SIMD_ALIGNED(uint16 dst_pixels_c[1280]); - SIMD_ALIGNED(uint16 dst_pixels_opt[1280]); + SIMD_ALIGNED(uint32 orig_pixels[640 + 4]); + SIMD_ALIGNED(uint16 dst_pixels_c[640]); + SIMD_ALIGNED(uint16 dst_pixels_opt[640]); memset(orig_pixels, 0, sizeof(orig_pixels)); memset(dst_pixels_c, 1, sizeof(dst_pixels_c)); memset(dst_pixels_opt, 2, sizeof(dst_pixels_opt)); - for (int i = 0; i < 1280 + 4; ++i) { + for (int i = 0; i < 640 + 4; ++i) { orig_pixels[i] = i * 256; } - GaussRow_C(&orig_pixels[0], &dst_pixels_c[0], 1280); + GaussRow_C(&orig_pixels[0], &dst_pixels_c[0], 640); MaskCpuFlags(benchmark_cpu_info_); - for (int i = 0; i < benchmark_pixels_div1280_; ++i) { + for (int i = 0; i < benchmark_pixels_div1280_ * 2; ++i) { #if !defined(LIBYUV_DISABLE_NEON) && defined(__aarch64__) int has_neon = TestCpuFlag(kCpuHasNEON); if (has_neon) { - GaussRow_NEON(&orig_pixels[0], &dst_pixels_opt[0], 1280); + GaussRow_NEON(&orig_pixels[0], &dst_pixels_opt[0], 640); } else { - GaussRow_C(&orig_pixels[0], &dst_pixels_opt[0], 1280); + GaussRow_C(&orig_pixels[0], &dst_pixels_opt[0], 640); } #else - GaussRow_C(&orig_pixels[0], &dst_pixels_opt[0], 1280); + GaussRow_C(&orig_pixels[0], &dst_pixels_opt[0], 640); #endif } - for (int i = 0; i < 1280; ++i) { + for (int i = 0; i < 640; ++i) { EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); } EXPECT_EQ(dst_pixels_c[0], static_cast(0 * 1 + 1 * 4 + 2 * 6 + 3 * 4 + 4 * 1)); - EXPECT_EQ(dst_pixels_c[1279], static_cast(20496)); + EXPECT_EQ(dst_pixels_c[639], static_cast(10256)); } extern "C" void GaussCol_NEON(const uint16* src0, @@ -2876,48 +2876,47 @@ extern "C" void GaussCol_C(const uint16* src0, int width); TEST_F(LibYUVPlanarTest, TestGaussCol_Opt) { - SIMD_ALIGNED(uint16 orig_pixels[1280 * 5]); - SIMD_ALIGNED(uint32 dst_pixels_c[1280]); - SIMD_ALIGNED(uint32 dst_pixels_opt[1280]); + SIMD_ALIGNED(uint16 orig_pixels[640 * 5]); + SIMD_ALIGNED(uint32 dst_pixels_c[640]); + SIMD_ALIGNED(uint32 dst_pixels_opt[640]); memset(orig_pixels, 0, sizeof(orig_pixels)); memset(dst_pixels_c, 1, sizeof(dst_pixels_c)); memset(dst_pixels_opt, 2, sizeof(dst_pixels_opt)); - for (int i = 0; i < 1280 * 5; ++i) { + for (int i = 0; i < 640 * 5; ++i) { orig_pixels[i] = i; } - GaussCol_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_C(&orig_pixels[0], &orig_pixels[640], &orig_pixels[640 * 2], + &orig_pixels[640 * 3], &orig_pixels[640 * 4], &dst_pixels_c[0], + 640); MaskCpuFlags(benchmark_cpu_info_); - for (int i = 0; i < benchmark_pixels_div1280_; ++i) { + for (int i = 0; i < benchmark_pixels_div1280_ * 2; ++i) { #if !defined(LIBYUV_DISABLE_NEON) && defined(__aarch64__) int has_neon = TestCpuFlag(kCpuHasNEON); if (has_neon) { - GaussCol_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_NEON(&orig_pixels[0], &orig_pixels[640], &orig_pixels[640 * 2], + &orig_pixels[640 * 3], &orig_pixels[640 * 4], + &dst_pixels_opt[0], 640); } 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); + GaussCol_C(&orig_pixels[0], &orig_pixels[640], &orig_pixels[640 * 2], + &orig_pixels[640 * 3], &orig_pixels[640 * 4], + &dst_pixels_opt[0], 640); } #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); + GaussCol_C(&orig_pixels[0], &orig_pixels[640], &orig_pixels[640 * 2], + &orig_pixels[640 * 3], &orig_pixels[640 * 4], &dst_pixels_opt[0], + 640); #endif } - for (int i = 0; i < 1280; ++i) { + for (int i = 0; i < 640; ++i) { EXPECT_EQ(dst_pixels_c[i], dst_pixels_opt[i]); } - EXPECT_EQ(dst_pixels_c[0], - static_cast(0 * 1 + 1280 * 4 + 1280 * 2 * 6 + 1280 * 3 * 4 + - 1280 * 4 * 1)); - EXPECT_EQ(dst_pixels_c[1279], static_cast(61424)); + EXPECT_EQ(dst_pixels_c[0], static_cast(0 * 1 + 640 * 4 + 640 * 2 * 6 + + 640 * 3 * 4 + 640 * 4 * 1)); + EXPECT_EQ(dst_pixels_c[639], static_cast(30704)); } } // namespace libyuv