mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-07 01:06:46 +08:00
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 <fbarchard@google.com>
This commit is contained in:
parent
1e16cb5c38
commit
1200ef4a37
@ -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);
|
extern "C" void GaussRow_C(const uint32* src, uint16* dst, int width);
|
||||||
|
|
||||||
TEST_F(LibYUVPlanarTest, TestGaussRow_Opt) {
|
TEST_F(LibYUVPlanarTest, TestGaussRow_Opt) {
|
||||||
SIMD_ALIGNED(uint32 orig_pixels[1280 + 4]);
|
SIMD_ALIGNED(uint32 orig_pixels[640 + 4]);
|
||||||
SIMD_ALIGNED(uint16 dst_pixels_c[1280]);
|
SIMD_ALIGNED(uint16 dst_pixels_c[640]);
|
||||||
SIMD_ALIGNED(uint16 dst_pixels_opt[1280]);
|
SIMD_ALIGNED(uint16 dst_pixels_opt[640]);
|
||||||
|
|
||||||
memset(orig_pixels, 0, sizeof(orig_pixels));
|
memset(orig_pixels, 0, sizeof(orig_pixels));
|
||||||
memset(dst_pixels_c, 1, sizeof(dst_pixels_c));
|
memset(dst_pixels_c, 1, sizeof(dst_pixels_c));
|
||||||
memset(dst_pixels_opt, 2, sizeof(dst_pixels_opt));
|
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;
|
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_);
|
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__)
|
#if !defined(LIBYUV_DISABLE_NEON) && defined(__aarch64__)
|
||||||
int has_neon = TestCpuFlag(kCpuHasNEON);
|
int has_neon = TestCpuFlag(kCpuHasNEON);
|
||||||
if (has_neon) {
|
if (has_neon) {
|
||||||
GaussRow_NEON(&orig_pixels[0], &dst_pixels_opt[0], 1280);
|
GaussRow_NEON(&orig_pixels[0], &dst_pixels_opt[0], 640);
|
||||||
} else {
|
} else {
|
||||||
GaussRow_C(&orig_pixels[0], &dst_pixels_opt[0], 1280);
|
GaussRow_C(&orig_pixels[0], &dst_pixels_opt[0], 640);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
GaussRow_C(&orig_pixels[0], &dst_pixels_opt[0], 1280);
|
GaussRow_C(&orig_pixels[0], &dst_pixels_opt[0], 640);
|
||||||
#endif
|
#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[i], dst_pixels_opt[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPECT_EQ(dst_pixels_c[0],
|
EXPECT_EQ(dst_pixels_c[0],
|
||||||
static_cast<uint16>(0 * 1 + 1 * 4 + 2 * 6 + 3 * 4 + 4 * 1));
|
static_cast<uint16>(0 * 1 + 1 * 4 + 2 * 6 + 3 * 4 + 4 * 1));
|
||||||
EXPECT_EQ(dst_pixels_c[1279], static_cast<uint16>(20496));
|
EXPECT_EQ(dst_pixels_c[639], static_cast<uint16>(10256));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void GaussCol_NEON(const uint16* src0,
|
extern "C" void GaussCol_NEON(const uint16* src0,
|
||||||
@ -2876,48 +2876,47 @@ extern "C" void GaussCol_C(const uint16* src0,
|
|||||||
int width);
|
int width);
|
||||||
|
|
||||||
TEST_F(LibYUVPlanarTest, TestGaussCol_Opt) {
|
TEST_F(LibYUVPlanarTest, TestGaussCol_Opt) {
|
||||||
SIMD_ALIGNED(uint16 orig_pixels[1280 * 5]);
|
SIMD_ALIGNED(uint16 orig_pixels[640 * 5]);
|
||||||
SIMD_ALIGNED(uint32 dst_pixels_c[1280]);
|
SIMD_ALIGNED(uint32 dst_pixels_c[640]);
|
||||||
SIMD_ALIGNED(uint32 dst_pixels_opt[1280]);
|
SIMD_ALIGNED(uint32 dst_pixels_opt[640]);
|
||||||
|
|
||||||
memset(orig_pixels, 0, sizeof(orig_pixels));
|
memset(orig_pixels, 0, sizeof(orig_pixels));
|
||||||
memset(dst_pixels_c, 1, sizeof(dst_pixels_c));
|
memset(dst_pixels_c, 1, sizeof(dst_pixels_c));
|
||||||
memset(dst_pixels_opt, 2, sizeof(dst_pixels_opt));
|
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;
|
orig_pixels[i] = i;
|
||||||
}
|
}
|
||||||
GaussCol_C(&orig_pixels[0], &orig_pixels[1280], &orig_pixels[1280 * 2],
|
GaussCol_C(&orig_pixels[0], &orig_pixels[640], &orig_pixels[640 * 2],
|
||||||
&orig_pixels[1280 * 3], &orig_pixels[1280 * 4], &dst_pixels_c[0],
|
&orig_pixels[640 * 3], &orig_pixels[640 * 4], &dst_pixels_c[0],
|
||||||
1280);
|
640);
|
||||||
MaskCpuFlags(benchmark_cpu_info_);
|
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__)
|
#if !defined(LIBYUV_DISABLE_NEON) && defined(__aarch64__)
|
||||||
int has_neon = TestCpuFlag(kCpuHasNEON);
|
int has_neon = TestCpuFlag(kCpuHasNEON);
|
||||||
if (has_neon) {
|
if (has_neon) {
|
||||||
GaussCol_NEON(&orig_pixels[0], &orig_pixels[1280], &orig_pixels[1280 * 2],
|
GaussCol_NEON(&orig_pixels[0], &orig_pixels[640], &orig_pixels[640 * 2],
|
||||||
&orig_pixels[1280 * 3], &orig_pixels[1280 * 4],
|
&orig_pixels[640 * 3], &orig_pixels[640 * 4],
|
||||||
&dst_pixels_opt[0], 1280);
|
&dst_pixels_opt[0], 640);
|
||||||
} else {
|
} else {
|
||||||
GaussCol_C(&orig_pixels[0], &orig_pixels[1280], &orig_pixels[1280 * 2],
|
GaussCol_C(&orig_pixels[0], &orig_pixels[640], &orig_pixels[640 * 2],
|
||||||
&orig_pixels[1280 * 3], &orig_pixels[1280 * 4],
|
&orig_pixels[640 * 3], &orig_pixels[640 * 4],
|
||||||
&dst_pixels_opt[0], 1280);
|
&dst_pixels_opt[0], 640);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
GaussCol_C(&orig_pixels[0], &orig_pixels[1280], &orig_pixels[1280 * 2],
|
GaussCol_C(&orig_pixels[0], &orig_pixels[640], &orig_pixels[640 * 2],
|
||||||
&orig_pixels[1280 * 3], &orig_pixels[1280 * 4],
|
&orig_pixels[640 * 3], &orig_pixels[640 * 4], &dst_pixels_opt[0],
|
||||||
&dst_pixels_opt[0], 1280);
|
640);
|
||||||
#endif
|
#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[i], dst_pixels_opt[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPECT_EQ(dst_pixels_c[0],
|
EXPECT_EQ(dst_pixels_c[0], static_cast<uint32>(0 * 1 + 640 * 4 + 640 * 2 * 6 +
|
||||||
static_cast<uint32>(0 * 1 + 1280 * 4 + 1280 * 2 * 6 + 1280 * 3 * 4 +
|
640 * 3 * 4 + 640 * 4 * 1));
|
||||||
1280 * 4 * 1));
|
EXPECT_EQ(dst_pixels_c[639], static_cast<uint32>(30704));
|
||||||
EXPECT_EQ(dst_pixels_c[1279], static_cast<uint32>(61424));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace libyuv
|
} // namespace libyuv
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user