diff --git a/README.chromium b/README.chromium index a5e4c7638..798f0d105 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 272 +Version: 273 License: BSD License File: LICENSE diff --git a/include/libyuv/version.h b/include/libyuv/version.h index a07cbb901..eaab28dcd 100644 --- a/include/libyuv/version.h +++ b/include/libyuv/version.h @@ -11,7 +11,7 @@ #ifndef INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_ -#define LIBYUV_VERSION 272 +#define LIBYUV_VERSION 273 #endif // INCLUDE_LIBYUV_VERSION_H_ diff --git a/source/cpu_id.cc b/source/cpu_id.cc index c451fa18b..f7843e6af 100644 --- a/source/cpu_id.cc +++ b/source/cpu_id.cc @@ -57,14 +57,15 @@ void CpuId(int cpu_info[4], int info_type) { } // based on libvpx arm_cpudetect.c -// For Arm, but testable on any CPU -int ArmCpuCaps(const char* cpuinfoname) { +// For Arm, but public to allow testing on any CPU +int ArmCpuCaps(const char* cpuinfo_name) { int flags = 0; - FILE* fin = fopen(cpuinfoname, "r"); + FILE* fin = fopen(cpuinfo_name, "r"); if (fin) { char buf[512]; while (fgets(buf, 511, fin)) { if (memcmp(buf, "Features", 8) == 0) { + flags |= kCpuInitialized; char* p = strstr(buf, " neon"); if (p && (p[5] == ' ' || p[5] == '\n')) { flags |= kCpuHasNEON; @@ -81,7 +82,7 @@ int ArmCpuCaps(const char* cpuinfoname) { int cpu_info_ = 0; int InitCpuFlags() { -#ifdef CPU_X86 +#if defined(CPU_X86) int cpu_info[4]; __cpuid(cpu_info, 1); cpu_info_ = ((cpu_info[3] & 0x04000000) ? kCpuHasSSE2 : 0) | @@ -113,15 +114,17 @@ int InitCpuFlags() { if (getenv("LIBYUV_DISABLE_ASM")) { cpu_info_ = kCpuInitialized; } -#elif defined(__linux__) && defined(__ARM_NEON__) - cpu_info_ = ArmCpuCaps("/proc/cpuinfo") | kCpuInitialized; +#elif defined(__arm__) +#if defined(__linux__) && defined(__ARM_NEON__) + // linux arm parse text file for neon detect. + cpu_info_ = ArmCpuCaps("/proc/cpuinfo"); #elif defined(__ARM_NEON__) // gcc -mfpu=neon defines __ARM_NEON__ // Enable Neon if you want support for Neon and Arm, and use MaskCpuFlags // to disable Neon on devices that do not have it. - cpu_info_ = kCpuHasNEON | kCpuInitialized | kCpuHasARM; -#else - cpu_info_ = kCpuInitialized | kCpuHasARM; + cpu_info_ = kCpuHasNEON; +#endif + cpu_info_ |= kCpuInitialized | kCpuHasARM; #endif return cpu_info_; } diff --git a/unit_test/cpu_test.cc b/unit_test/cpu_test.cc index 835544ce2..036169438 100644 --- a/unit_test/cpu_test.cc +++ b/unit_test/cpu_test.cc @@ -89,8 +89,18 @@ TEST_F(libyuvTest, TestCpuId) { extern "C" int ArmCpuCaps(const char* cpuinfoname); TEST_F(libyuvTest, TestLinuxNeon) { - EXPECT_EQ(0, ArmCpuCaps("unit_test/testdata/arm_v7.txt")); - EXPECT_EQ(kCpuHasNEON, ArmCpuCaps("unit_test/testdata/tegra3.txt")); + int testdata = ArmCpuCaps("unit_test/testdata/arm_v7.txt"); + if (testdata) { + EXPECT_EQ(kCpuInitialized, + ArmCpuCaps("unit_test/testdata/arm_v7.txt")); + EXPECT_EQ((kCpuInitialized | kCpuHasNEON), + ArmCpuCaps("unit_test/testdata/tegra3.txt")); + } else { + printf("WARNING: unable to load \"unit_test/testdata/arm_v7.txt\"\n"); + } +#if defined(__linux__) && defined(__ARM_NEON__) + EXPECT_NE(0, ArmCpuCaps("/proc/cpuinfo")); +#endif } } // namespace libyuv