Commit 8c9de166 authored by fbarchard@google.com's avatar fbarchard@google.com

ERMS

BUG=none
TEST=none
Review URL: https://webrtc-codereview.appspot.com/1265004

git-svn-id: http://libyuv.googlecode.com/svn/trunk@625 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent 4e0d7cc2
Name: libyuv Name: libyuv
URL: http://code.google.com/p/libyuv/ URL: http://code.google.com/p/libyuv/
Version: 623 Version: 624
License: BSD License: BSD
License File: LICENSE License File: LICENSE
......
...@@ -34,6 +34,7 @@ static const int kCpuHasSSE41 = 0x80; ...@@ -34,6 +34,7 @@ static const int kCpuHasSSE41 = 0x80;
static const int kCpuHasSSE42 = 0x100; static const int kCpuHasSSE42 = 0x100;
static const int kCpuHasAVX = 0x200; static const int kCpuHasAVX = 0x200;
static const int kCpuHasAVX2 = 0x400; static const int kCpuHasAVX2 = 0x400;
static const int kCpuHasERMS = 0x800;
// These flags are only valid on MIPS processors. // These flags are only valid on MIPS processors.
static const int kCpuHasMIPS = 0x1000; static const int kCpuHasMIPS = 0x1000;
......
...@@ -11,6 +11,6 @@ ...@@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT #ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
#define INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 623 #define LIBYUV_VERSION 624
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
#include "libyuv/basic_types.h" // For CPU_X86 #include "libyuv/basic_types.h" // For CPU_X86
// TODO(fbarchard): Consider cpu functionality for breakpoints, timer and cache.
// arm - bkpt vs intel int 3
// TODO(fbarchard): Use cpuid.h when gcc 4.4 is used on OSX and Linux. // TODO(fbarchard): Use cpuid.h when gcc 4.4 is used on OSX and Linux.
#if (defined(__pic__) || defined(__APPLE__)) && defined(__i386__) #if (defined(__pic__) || defined(__APPLE__)) && defined(__i386__)
static __inline void __cpuid(int cpu_info[4], int info_type) { static __inline void __cpuid(int cpu_info[4], int info_type) {
...@@ -171,6 +174,9 @@ int InitCpuFlags(void) { ...@@ -171,6 +174,9 @@ int InitCpuFlags(void) {
((XGetBV(kXCR_XFEATURE_ENABLED_MASK) & 0x06) == 0x06)) { ((XGetBV(kXCR_XFEATURE_ENABLED_MASK) & 0x06) == 0x06)) {
cpu_info_ |= kCpuHasAVX2; cpu_info_ |= kCpuHasAVX2;
} }
if (cpu_info[1] & 0x00000200) {
cpu_info_ |= kCpuHasERMS;
}
} }
#endif #endif
// Environment variable overrides for testing. // Environment variable overrides for testing.
...@@ -195,6 +201,9 @@ int InitCpuFlags(void) { ...@@ -195,6 +201,9 @@ int InitCpuFlags(void) {
if (TestEnv("LIBYUV_DISABLE_AVX2")) { if (TestEnv("LIBYUV_DISABLE_AVX2")) {
cpu_info_ &= ~kCpuHasAVX2; cpu_info_ &= ~kCpuHasAVX2;
} }
if (TestEnv("LIBYUV_DISABLE_ERMS")) {
cpu_info_ &= ~kCpuHasERMS;
}
#elif defined(__mips__) && defined(__linux__) #elif defined(__mips__) && defined(__linux__)
// Linux mips parse text file for dsp detect. // Linux mips parse text file for dsp detect.
cpu_info_ = MipsCpuCaps("dsp"); // set kCpuHasMIPS_DSP. cpu_info_ = MipsCpuCaps("dsp"); // set kCpuHasMIPS_DSP.
......
...@@ -696,7 +696,7 @@ void ARGBToYJRow_SSSE3(const uint8* src_argb, uint8* dst_y, int pix) { ...@@ -696,7 +696,7 @@ void ARGBToYJRow_SSSE3(const uint8* src_argb, uint8* dst_y, int pix) {
lea eax, [eax + 64] lea eax, [eax + 64]
phaddw xmm0, xmm1 phaddw xmm0, xmm1
phaddw xmm2, xmm3 phaddw xmm2, xmm3
paddw xmm0, xmm5 paddw xmm0, xmm5 // Add .5 for rounding.
paddw xmm2, xmm5 paddw xmm2, xmm5
psrlw xmm0, 7 psrlw xmm0, 7
psrlw xmm2, 7 psrlw xmm2, 7
......
...@@ -39,6 +39,8 @@ TEST_F(libyuvTest, TestCpuHas) { ...@@ -39,6 +39,8 @@ TEST_F(libyuvTest, TestCpuHas) {
printf("Has AVX %x\n", has_avx); printf("Has AVX %x\n", has_avx);
int has_avx2 = TestCpuFlag(kCpuHasAVX2); int has_avx2 = TestCpuFlag(kCpuHasAVX2);
printf("Has AVX2 %x\n", has_avx2); printf("Has AVX2 %x\n", has_avx2);
int has_erms = TestCpuFlag(kCpuHasERMS);
printf("Has ERMS %x\n", has_erms);
int has_mips = TestCpuFlag(kCpuHasMIPS); int has_mips = TestCpuFlag(kCpuHasMIPS);
printf("Has MIPS %x\n", has_mips); printf("Has MIPS %x\n", has_mips);
int has_mips_dsp = TestCpuFlag(kCpuHasMIPS_DSP); int has_mips_dsp = TestCpuFlag(kCpuHasMIPS_DSP);
......
...@@ -22,6 +22,7 @@ int main(int argc, const char* argv[]) { ...@@ -22,6 +22,7 @@ int main(int argc, const char* argv[]) {
int has_arm = TestCpuFlag(kCpuHasARM); int has_arm = TestCpuFlag(kCpuHasARM);
int has_avx = TestCpuFlag(kCpuHasAVX); int has_avx = TestCpuFlag(kCpuHasAVX);
int has_avx2 = TestCpuFlag(kCpuHasAVX2); int has_avx2 = TestCpuFlag(kCpuHasAVX2);
int has_erms = TestCpuFlag(kCpuHasERMS);
int has_mips = TestCpuFlag(kCpuHasMIPS); int has_mips = TestCpuFlag(kCpuHasMIPS);
int has_mips_dsp = TestCpuFlag(kCpuHasMIPS_DSP); int has_mips_dsp = TestCpuFlag(kCpuHasMIPS_DSP);
int has_mips_dspr2 = TestCpuFlag(kCpuHasMIPS_DSPR2); int has_mips_dspr2 = TestCpuFlag(kCpuHasMIPS_DSPR2);
...@@ -70,6 +71,7 @@ int main(int argc, const char* argv[]) { ...@@ -70,6 +71,7 @@ int main(int argc, const char* argv[]) {
printf("Has ARM %x\n", has_arm); printf("Has ARM %x\n", has_arm);
printf("Has AVX %x\n", has_avx); printf("Has AVX %x\n", has_avx);
printf("Has AVX2 %x\n", has_avx2); printf("Has AVX2 %x\n", has_avx2);
printf("Has ERMS %x\n", has_erms);
printf("Has MIPS %x\n", has_mips); printf("Has MIPS %x\n", has_mips);
printf("Has MIPS DSP %x\n", has_mips_dsp); printf("Has MIPS DSP %x\n", has_mips_dsp);
printf("Has MIPS DSPR2 %x\n", has_mips_dspr2); printf("Has MIPS DSPR2 %x\n", has_mips_dspr2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment