From 3ff31b2a5fd88d57fed619678da1708097c81504 Mon Sep 17 00:00:00 2001 From: Frank Barchard Date: Wed, 30 Jul 2025 19:00:10 -0700 Subject: [PATCH] Make LibYUVConvertTest.TestI400LargeSize skip test on low end arm cpu - detect lack of dot product instruction to infer the cpu is low end - only run the test on higher end arm Bug: 416842099 Change-Id: Idd2dd16a624bbba280cf531644440024b12f7ecf Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/6804632 Reviewed-by: Mirko Bonadei --- README.chromium | 2 +- include/libyuv/version.h | 2 +- unit_test/convert_argb_test.cc | 32 ++++++++++++++++++++++++++++++-- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/README.chromium b/README.chromium index 021887717..1f07107a2 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: https://chromium.googlesource.com/libyuv/libyuv/ -Version: 1913 +Version: 1914 License: BSD-3-Clause License File: LICENSE Shipped: yes diff --git a/include/libyuv/version.h b/include/libyuv/version.h index fca53bd93..5d06b3bf2 100644 --- a/include/libyuv/version.h +++ b/include/libyuv/version.h @@ -11,6 +11,6 @@ #ifndef INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_ -#define LIBYUV_VERSION 1913 +#define LIBYUV_VERSION 1914 #endif // INCLUDE_LIBYUV_VERSION_H_ diff --git a/unit_test/convert_argb_test.cc b/unit_test/convert_argb_test.cc index dee8cb4c3..c36f37c35 100644 --- a/unit_test/convert_argb_test.cc +++ b/unit_test/convert_argb_test.cc @@ -2808,13 +2808,41 @@ TEST_F(LibYUVConvertTest, TestI400LargeSize) { // variant of the conversion function. const int kWidth = 1073741823; const int kHeight = 2; + +#if defined(__aarch64__) + // Infer malloc can accept a large size for cpu with dot product (a76/a55) + int has_large_malloc = TestCpuFlag(kCpuHasNeonDotProd); +#else + int has_large_malloc = 1; +#endif + if (!has_large_malloc) { + printf("WARNING: Skipped. Large allocation may assert for %ld\n", (size_t)kWidth * kHeight); + return; + } + // Allocate one extra column so that the coalesce optimizations do not trigger // in convert_argb.cc (they are triggered only when stride is equal to width). const size_t kStride = kWidth + 1; + + printf("WARNING: attempting to allocate I400 image of %zd bytes\n", (size_t)kWidth * kHeight); + fflush(stdout); align_buffer_page_end(orig_i400, (size_t)kWidth * kHeight); - ASSERT_NE(orig_i400, nullptr); + if (!orig_i400) { + printf("WARNING: unable to allocate I400 image of %zd bytes\n", (size_t)kWidth * kHeight); + fflush(stdout); + return; + } + printf("INFO: allocate I400 image returned %p\n", orig_i400); + fflush(stdout); align_buffer_page_end(dest_argb, (size_t)kWidth * kHeight * 4); - ASSERT_NE(dest_argb, nullptr); + if (!dest_argb) { + printf("WARNING: unable to allocate ARGB image of %zd bytes\n", (size_t)kWidth * kHeight * 4); + fflush(stdout); + free_aligned_buffer_page_end(orig_i400); + return; + } + printf("INFO: allocate ARGB image returned %p\n", dest_argb); + fflush(stdout); for (int i = 0; i < kWidth * kHeight; ++i) { orig_i400[i] = i % 256; }