| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license | |
| 5 * that can be found in the LICENSE file in the root of the source | |
| 6 * tree. An additional intellectual property rights grant can be found | |
| 7 * in the file PATENTS. All contributing project authors may | |
| 8 * be found in the AUTHORS file in the root of the source tree. | |
| 9 */ | |
| 10 | |
| 11 #ifndef WEBRTC_MEDIA_BASE_CPUID_H_ | |
| 12 #define WEBRTC_MEDIA_BASE_CPUID_H_ | |
| 13 | |
| 14 #include "webrtc/base/constructormagic.h" | |
| 15 | |
| 16 namespace cricket { | |
| 17 | |
| 18 class CpuInfo { | |
| 19 public: | |
| 20 // The following flags must match libyuv/cpu_id.h values. | |
| 21 // Internal flag to indicate cpuid requires initialization. | |
| 22 static const int kCpuInit = 0x1; | |
| 23 | |
| 24 // These flags are only valid on ARM processors. | |
| 25 static const int kCpuHasARM = 0x2; | |
| 26 static const int kCpuHasNEON = 0x4; | |
| 27 // 0x8 reserved for future ARM flag. | |
| 28 | |
| 29 // These flags are only valid on x86 processors. | |
| 30 static const int kCpuHasX86 = 0x10; | |
| 31 static const int kCpuHasSSE2 = 0x20; | |
| 32 static const int kCpuHasSSSE3 = 0x40; | |
| 33 static const int kCpuHasSSE41 = 0x80; | |
| 34 static const int kCpuHasSSE42 = 0x100; | |
| 35 static const int kCpuHasAVX = 0x200; | |
| 36 static const int kCpuHasAVX2 = 0x400; | |
| 37 static const int kCpuHasERMS = 0x800; | |
| 38 | |
| 39 // These flags are only valid on MIPS processors. | |
| 40 static const int kCpuHasMIPS = 0x1000; | |
| 41 static const int kCpuHasMIPS_DSP = 0x2000; | |
| 42 static const int kCpuHasMIPS_DSPR2 = 0x4000; | |
| 43 | |
| 44 // Detect CPU has SSE2 etc. | |
| 45 static bool TestCpuFlag(int flag); | |
| 46 | |
| 47 // For testing, allow CPU flags to be disabled. | |
| 48 static void MaskCpuFlagsForTest(int enable_flags); | |
| 49 | |
| 50 private: | |
| 51 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(CpuInfo); | |
| 52 }; | |
| 53 | |
| 54 // Detect an Intel Core I5 or better such as 4th generation Macbook Air. | |
| 55 bool IsCoreIOrBetter(); | |
| 56 | |
| 57 } // namespace cricket | |
| 58 | |
| 59 #endif // WEBRTC_MEDIA_BASE_CPUID_H_ | |
| OLD | NEW |