TestI400LargeSize fix for warning message build error

- change %ld to %zd for size_t printf warnings
- disable TestI400LargeSize when disabling SLOW_TESTS
- disable cpuid tests that read proc/cpuinfo test data files
- add ifdef around timers to allow hexagon build
- remove faulty hybrid detect
- remove old mips LIBYUV_DISABLE_DSPR2 reference in gyp build
- apply clang-format

Bug: 434382656
Change-Id: Id74812e6ef29d4a8d0ff967a9189d249b80816d4
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/6812825
Reviewed-by: Jeremy Leconte <jleconte@google.com>
Reviewed-by: richard winterton <rrwinterton@gmail.com>
This commit is contained in:
Frank Barchard 2025-08-01 09:53:51 -07:00
parent 3ff31b2a5f
commit cdd3bae848
7 changed files with 22 additions and 24 deletions

View File

@ -1,6 +1,6 @@
Name: libyuv Name: libyuv
URL: https://chromium.googlesource.com/libyuv/libyuv/ URL: https://chromium.googlesource.com/libyuv/libyuv/
Version: 1914 Version: 1915
License: BSD-3-Clause License: BSD-3-Clause
License File: LICENSE License File: LICENSE
Shipped: yes Shipped: yes

View File

@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ #ifndef INCLUDE_LIBYUV_VERSION_H_
#define INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 1914 #define LIBYUV_VERSION 1915
#endif // INCLUDE_LIBYUV_VERSION_H_ #endif // INCLUDE_LIBYUV_VERSION_H_

View File

@ -146,7 +146,6 @@
# Enable the following 3 macros to turn off assembly for specified CPU. # Enable the following 3 macros to turn off assembly for specified CPU.
# 'LIBYUV_DISABLE_X86', # 'LIBYUV_DISABLE_X86',
# 'LIBYUV_DISABLE_NEON', # 'LIBYUV_DISABLE_NEON',
# 'LIBYUV_DISABLE_DSPR2',
# Enable the following macro to build libyuv as a shared library (dll). # Enable the following macro to build libyuv as a shared library (dll).
# 'LIBYUV_USING_SHARED_LIBRARY', # 'LIBYUV_USING_SHARED_LIBRARY',
# TODO(fbarchard): Make these into gyp defines. # TODO(fbarchard): Make these into gyp defines.

View File

@ -2801,7 +2801,10 @@ TEST_F(LibYUVConvertTest, TestARGBToUVRow) {
} }
#endif #endif
#if defined(__x86_64__) || defined(_M_X64) || defined(__aarch64__) #if !defined(DISABLE_SLOW_TESTS) && \
(defined(__x86_64__) || defined(_M_X64) || defined(__aarch64__))
// TODO(fbarchard): Consider _set_new_mode(0) to make malloc return NULL
TEST_F(LibYUVConvertTest, TestI400LargeSize) { TEST_F(LibYUVConvertTest, TestI400LargeSize) {
// The width and height are chosen as follows: // The width and height are chosen as follows:
// - kWidth * kHeight is not a multiple of 8: This lets us to use the Any // - kWidth * kHeight is not a multiple of 8: This lets us to use the Any
@ -2816,7 +2819,8 @@ TEST_F(LibYUVConvertTest, TestI400LargeSize) {
int has_large_malloc = 1; int has_large_malloc = 1;
#endif #endif
if (!has_large_malloc) { if (!has_large_malloc) {
printf("WARNING: Skipped. Large allocation may assert for %ld\n", (size_t)kWidth * kHeight); printf("WARNING: Skipped. Large allocation may assert for %zd\n",
(size_t)kWidth * kHeight);
return; return;
} }
@ -2824,11 +2828,13 @@ TEST_F(LibYUVConvertTest, TestI400LargeSize) {
// in convert_argb.cc (they are triggered only when stride is equal to width). // in convert_argb.cc (they are triggered only when stride is equal to width).
const size_t kStride = kWidth + 1; const size_t kStride = kWidth + 1;
printf("WARNING: attempting to allocate I400 image of %zd bytes\n", (size_t)kWidth * kHeight); printf("WARNING: attempting to allocate I400 image of %zd bytes\n",
(size_t)kWidth * kHeight);
fflush(stdout); fflush(stdout);
align_buffer_page_end(orig_i400, (size_t)kWidth * kHeight); align_buffer_page_end(orig_i400, (size_t)kWidth * kHeight);
if (!orig_i400) { if (!orig_i400) {
printf("WARNING: unable to allocate I400 image of %zd bytes\n", (size_t)kWidth * kHeight); printf("WARNING: unable to allocate I400 image of %zd bytes\n",
(size_t)kWidth * kHeight);
fflush(stdout); fflush(stdout);
return; return;
} }
@ -2836,7 +2842,8 @@ TEST_F(LibYUVConvertTest, TestI400LargeSize) {
fflush(stdout); fflush(stdout);
align_buffer_page_end(dest_argb, (size_t)kWidth * kHeight * 4); align_buffer_page_end(dest_argb, (size_t)kWidth * kHeight * 4);
if (!dest_argb) { if (!dest_argb) {
printf("WARNING: unable to allocate ARGB image of %zd bytes\n", (size_t)kWidth * kHeight * 4); printf("WARNING: unable to allocate ARGB image of %zd bytes\n",
(size_t)kWidth * kHeight * 4);
fflush(stdout); fflush(stdout);
free_aligned_buffer_page_end(orig_i400); free_aligned_buffer_page_end(orig_i400);
return; return;

View File

@ -342,7 +342,7 @@ static int FileExists(const char* file_name) {
return 1; return 1;
} }
TEST_F(LibYUVBaseTest, TestLinuxArm) { TEST_F(LibYUVBaseTest, DISABLED_TestLinuxArm) {
if (FileExists("../../unit_test/testdata/arm_v7.txt")) { if (FileExists("../../unit_test/testdata/arm_v7.txt")) {
printf("Note: testing to load \"../../unit_test/testdata/arm_v7.txt\"\n"); printf("Note: testing to load \"../../unit_test/testdata/arm_v7.txt\"\n");
@ -388,7 +388,7 @@ TEST_F(LibYUVBaseTest, TestLinuxAArch64) {
} }
#endif #endif
TEST_F(LibYUVBaseTest, TestLinuxMipsMsa) { TEST_F(LibYUVBaseTest, DISABLED_TestLinuxMipsMsa) {
if (FileExists("../../unit_test/testdata/mips.txt")) { if (FileExists("../../unit_test/testdata/mips.txt")) {
printf("Note: testing to load \"../../unit_test/testdata/mips.txt\"\n"); printf("Note: testing to load \"../../unit_test/testdata/mips.txt\"\n");
@ -401,7 +401,7 @@ TEST_F(LibYUVBaseTest, TestLinuxMipsMsa) {
} }
} }
TEST_F(LibYUVBaseTest, TestLinuxRVV) { TEST_F(LibYUVBaseTest, DISABLED_TestLinuxRVV) {
if (FileExists("../../unit_test/testdata/riscv64.txt")) { if (FileExists("../../unit_test/testdata/riscv64.txt")) {
printf("Note: testing to load \"../../unit_test/testdata/riscv64.txt\"\n"); printf("Note: testing to load \"../../unit_test/testdata/riscv64.txt\"\n");
@ -427,12 +427,7 @@ TEST_F(LibYUVBaseTest, TestLinuxRVV) {
#endif #endif
} }
// TODO(fbarchard): Fix clangcl test of cpuflags.
#ifdef _MSC_VER
TEST_F(LibYUVBaseTest, DISABLED_TestSetCpuFlags) {
#else
TEST_F(LibYUVBaseTest, TestSetCpuFlags) { TEST_F(LibYUVBaseTest, TestSetCpuFlags) {
#endif
// Reset any masked flags that may have been set so auto init is enabled. // Reset any masked flags that may have been set so auto init is enabled.
MaskCpuFlags(0); MaskCpuFlags(0);

View File

@ -14,7 +14,7 @@
#include <stddef.h> // For NULL #include <stddef.h> // For NULL
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#else #elif !defined(__hexagon__)
#include <sys/time.h> #include <sys/time.h>
#endif #endif
@ -102,6 +102,10 @@ static inline double get_time() {
QueryPerformanceFrequency(&f); QueryPerformanceFrequency(&f);
return static_cast<double>(t.QuadPart) / static_cast<double>(f.QuadPart); return static_cast<double>(t.QuadPart) / static_cast<double>(f.QuadPart);
} }
#elif defined(__hexagon__)
static inline double get_time() {
return 0.;
}
#else #else
static inline double get_time() { static inline double get_time() {
struct timeval t; struct timeval t;

View File

@ -179,13 +179,6 @@ int main(int argc, const char* argv[]) {
cpu_info[3] = 0; cpu_info[3] = 0;
printf("Cpu Vendor: %s\n", (char*)(&cpu_info[0])); printf("Cpu Vendor: %s\n", (char*)(&cpu_info[0]));
for (int n = 0; n < num_cpus; ++n) {
// Check EDX bit 15 for hybrid design indication
CpuId(7, n, &cpu_info[0]);
int hybrid = (cpu_info[3] >> 15) & 1;
printf(" Cpu %d Hybrid %d\n", n, hybrid);
}
// CPU Family and Model // CPU Family and Model
// 3:0 - Stepping // 3:0 - Stepping
// 7:4 - Model // 7:4 - Model