Changeset 5633 for pjproject/trunk/third_party/yuv/include/libyuv/cpu_id.h
- Timestamp:
- Jul 28, 2017 2:51:44 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/third_party/yuv/include/libyuv/cpu_id.h
r5358 r5633 9 9 */ 10 10 11 #ifndef INCLUDE_LIBYUV_CPU_ID_H_ // NOLINT11 #ifndef INCLUDE_LIBYUV_CPU_ID_H_ 12 12 #define INCLUDE_LIBYUV_CPU_ID_H_ 13 13 … … 32 32 static const int kCpuHasSSSE3 = 0x40; 33 33 static const int kCpuHasSSE41 = 0x80; 34 static const int kCpuHasSSE42 = 0x100; 34 static const int kCpuHasSSE42 = 0x100; // unused at this time. 35 35 static const int kCpuHasAVX = 0x200; 36 36 static const int kCpuHasAVX2 = 0x400; … … 38 38 static const int kCpuHasFMA3 = 0x1000; 39 39 static const int kCpuHasAVX3 = 0x2000; 40 // 0x2000, 0x4000, 0x8000 reserved for future X86 flags. 40 static const int kCpuHasF16C = 0x4000; 41 42 // 0x8000 reserved for future X86 flags. 41 43 42 44 // These flags are only valid on MIPS processors. 43 45 static const int kCpuHasMIPS = 0x10000; 44 46 static const int kCpuHasDSPR2 = 0x20000; 47 static const int kCpuHasMSA = 0x40000; 45 48 46 // Internal function used to auto-init. 49 // Optional init function. TestCpuFlag does an auto-init. 50 // Returns cpu_info flags. 47 51 LIBYUV_API 48 52 int InitCpuFlags(void); 53 54 // Detect CPU has SSE2 etc. 55 // Test_flag parameter should be one of kCpuHas constants above. 56 // Returns non-zero if instruction set is detected 57 static __inline int TestCpuFlag(int test_flag) { 58 LIBYUV_API extern int cpu_info_; 59 #ifdef __ATOMIC_RELAXED 60 int cpu_info = __atomic_load_n(&cpu_info_, __ATOMIC_RELAXED); 61 #else 62 int cpu_info = cpu_info_; 63 #endif 64 return (!cpu_info ? InitCpuFlags() : cpu_info) & test_flag; 65 } 49 66 50 67 // Internal function for parsing /proc/cpuinfo. … … 52 69 int ArmCpuCaps(const char* cpuinfo_name); 53 70 54 // Detect CPU has SSE2 etc.55 // Test_flag parameter should be one of kCpuHas constants above.56 // returns non-zero if instruction set is detected57 static __inline int TestCpuFlag(int test_flag) {58 LIBYUV_API extern int cpu_info_;59 return (!cpu_info_ ? InitCpuFlags() : cpu_info_) & test_flag;60 }61 62 71 // For testing, allow CPU flags to be disabled. 63 72 // ie MaskCpuFlags(~kCpuHasSSSE3) to disable SSSE3. 64 73 // MaskCpuFlags(-1) to enable all cpu specific optimizations. 65 74 // MaskCpuFlags(1) to disable all cpu specific optimizations. 75 // MaskCpuFlags(0) to reset state so next call will auto init. 76 // Returns cpu_info flags. 66 77 LIBYUV_API 67 voidMaskCpuFlags(int enable_flags);78 int MaskCpuFlags(int enable_flags); 68 79 69 80 // Low level cpuid for X86. Returns zeros on other CPUs. … … 71 82 // ecx is typically the cpu number, and should normally be zero. 72 83 LIBYUV_API 73 void CpuId( uint32 eax, uint32 ecx, uint32* cpu_info);84 void CpuId(int eax, int ecx, int* cpu_info); 74 85 75 86 #ifdef __cplusplus … … 78 89 #endif 79 90 80 #endif // INCLUDE_LIBYUV_CPU_ID_H_ NOLINT91 #endif // INCLUDE_LIBYUV_CPU_ID_H_
Note: See TracChangeset
for help on using the changeset viewer.