diff --git a/README.chromium b/README.chromium index b507acaa5..a5e4c7638 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 271 +Version: 272 License: BSD License File: LICENSE diff --git a/include/libyuv/cpu_id.h b/include/libyuv/cpu_id.h index 354919bdb..5638b29f8 100644 --- a/include/libyuv/cpu_id.h +++ b/include/libyuv/cpu_id.h @@ -17,19 +17,21 @@ extern "C" { #endif // Internal flag to indicate cpuid is initialized. -static const int kCpuInitialized = 1; +static const int kCpuInitialized = 0x1; -// These flags are only valid on ARM processors -static const int kCpuHasARM = 2; -static const int kCpuHasNEON = 4; +// These flags are only valid on ARM processors. +static const int kCpuHasARM = 0x2; +static const int kCpuHasNEON = 0x4; +// 0x8 reserved for future ARM flag. -// These flags are only valid on x86 processors -static const int kCpuHasX86 = 8; -static const int kCpuHasSSE2 = 16; -static const int kCpuHasSSSE3 = 32; -static const int kCpuHasSSE41 = 64; -static const int kCpuHasSSE42 = 128; -static const int kCpuHasAVX = 256; +// These flags are only valid on x86 processors. +static const int kCpuHasX86 = 0x10; +static const int kCpuHasSSE2 = 0x20; +static const int kCpuHasSSSE3 = 0x40; +static const int kCpuHasSSE41 = 0x80; +static const int kCpuHasSSE42 = 0x100; +static const int kCpuHasAVX = 0x200; +// 0x400 reserved for AVX2. // Detect CPU has SSE2 etc. // Test_flag parameter should be one of kCpuHas constants above. diff --git a/include/libyuv/version.h b/include/libyuv/version.h index d398bc2b8..a07cbb901 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 271 +#define LIBYUV_VERSION 272 #endif // INCLUDE_LIBYUV_VERSION_H_ diff --git a/source/cpu_id.cc b/source/cpu_id.cc index 54bce3cc6..c451fa18b 100644 --- a/source/cpu_id.cc +++ b/source/cpu_id.cc @@ -104,6 +104,12 @@ int InitCpuFlags() { if (getenv("LIBYUV_DISABLE_SSE41")) { cpu_info_ &= ~kCpuHasSSE41; } + if (getenv("LIBYUV_DISABLE_SSE42")) { + cpu_info_ &= ~kCpuHasSSE42; + } + if (getenv("LIBYUV_DISABLE_AVX")) { + cpu_info_ &= ~kCpuHasAVX; + } if (getenv("LIBYUV_DISABLE_ASM")) { cpu_info_ = kCpuInitialized; } diff --git a/unit_test/cpu_test.cc b/unit_test/cpu_test.cc index 393c72b6a..835544ce2 100644 --- a/unit_test/cpu_test.cc +++ b/unit_test/cpu_test.cc @@ -26,21 +26,21 @@ TEST_F(libyuvTest, TestCpuHas) { int cpu_flags = TestCpuFlag(~kCpuInitialized); printf("Cpu Flags %x\n", cpu_flags); int has_arm = TestCpuFlag(kCpuHasARM); - printf("Has ARM %d\n", has_arm); + printf("Has ARM %x\n", has_arm); int has_neon = TestCpuFlag(kCpuHasNEON); - printf("Has NEON %d\n", has_neon); + printf("Has NEON %x\n", has_neon); int has_x86 = TestCpuFlag(kCpuHasX86); - printf("Has X86 %d\n", has_x86); + printf("Has X86 %x\n", has_x86); int has_sse2 = TestCpuFlag(kCpuHasSSE2); - printf("Has SSE2 %d\n", has_sse2); + printf("Has SSE2 %x\n", has_sse2); int has_ssse3 = TestCpuFlag(kCpuHasSSSE3); - printf("Has SSSE3 %d\n", has_ssse3); + printf("Has SSSE3 %x\n", has_ssse3); int has_sse41 = TestCpuFlag(kCpuHasSSE41); - printf("Has SSE4.1 %d\n", has_sse41); + printf("Has SSE4.1 %x\n", has_sse41); int has_sse42 = TestCpuFlag(kCpuHasSSE42); - printf("Has SSE4.2 %d\n", has_sse42); + printf("Has SSE4.2 %x\n", has_sse42); int has_avx = TestCpuFlag(kCpuHasAVX); - printf("Has AVX %d\n", has_avx); + printf("Has AVX %x\n", has_avx); } #if defined(__i386__) || defined(__x86_64__) || \ @@ -79,7 +79,8 @@ TEST_F(libyuvTest, TestCpuId) { CpuId(cpu_info, 1); int family = ((cpu_info[0] >> 8) & 0x0f) | ((cpu_info[0] >> 16) & 0xff0); int model = ((cpu_info[0] >> 4) & 0x0f) | ((cpu_info[0] >> 12) & 0xf0); - printf("Cpu Family %d, Model %d\n", family, model); + printf("Cpu Family %d (0x%x), Model %d (0x%x)\n", family, family, + model, model); } } #endif