Go to the documentation of this file.
23 #define CORE_FLAG(f) \
24 (AV_CPU_FLAG_ ## f * (HAVE_ ## f ## _EXTERNAL || HAVE_ ## f ## _INLINE))
26 #define CORE_CPU_FLAGS \
27 (CORE_FLAG(ARMV5TE) | \
29 CORE_FLAG(ARMV6T2) | \
34 #if defined __linux__ || defined __ANDROID__
48 #define HWCAP_VFP (1 << 6)
49 #define HWCAP_EDSP (1 << 7)
50 #define HWCAP_THUMBEE (1 << 11)
51 #define HWCAP_NEON (1 << 12)
52 #define HWCAP_VFPv3 (1 << 13)
53 #define HWCAP_TLS (1 << 15)
55 static int get_auxval(uint32_t *hwcap)
58 unsigned long ret = getauxval(AT_HWCAP);
68 static int get_hwcap(uint32_t *hwcap)
70 struct { uint32_t a_type; uint32_t a_val; } auxv;
71 FILE *
f = fopen(
"/proc/self/auxv",
"r");
77 while (fread(&auxv,
sizeof(auxv), 1,
f) > 0) {
78 if (auxv.a_type == AT_HWCAP) {
89 static int get_cpuinfo(uint32_t *hwcap)
91 FILE *
f = fopen(
"/proc/cpuinfo",
"r");
98 while (fgets(buf,
sizeof(buf),
f)) {
100 if (strstr(buf,
" edsp "))
101 *hwcap |= HWCAP_EDSP;
102 if (strstr(buf,
" tls "))
104 if (strstr(buf,
" thumbee "))
105 *hwcap |= HWCAP_THUMBEE;
106 if (strstr(buf,
" vfp "))
108 if (strstr(buf,
" vfpv3 "))
109 *hwcap |= HWCAP_VFPv3;
110 if (strstr(buf,
" neon ") || strstr(buf,
" asimd "))
111 *hwcap |= HWCAP_NEON;
112 if (strstr(buf,
" fp "))
113 *hwcap |= HWCAP_VFP | HWCAP_VFPv3;
126 if (get_auxval(&hwcap) < 0)
127 if (get_hwcap(&hwcap) < 0)
128 if (get_cpuinfo(&hwcap) < 0)
131 #define check_cap(cap, flag) do { \
132 if (hwcap & HWCAP_ ## cap) \
133 flags |= AV_CPU_FLAG_ ## flag; \
138 check_cap(EDSP, ARMV5TE);
139 check_cap(TLS, ARMV6);
140 check_cap(THUMBEE, ARMV6T2);
142 check_cap(VFPv3, VFPV3);
143 check_cap(NEON, NEON);
int ff_get_cpu_flags_arm(void)
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
#define AV_CPU_FLAG_ARMV6
#define AV_CPU_FLAG_SETEND
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
#define AV_CPU_FLAG_VFPV3
size_t ff_get_cpu_max_align_arm(void)
#define AV_CPU_FLAG_ARMV5TE
#define AV_CPU_FLAG_VFP_VM
VFPv2 vector mode, deprecated in ARMv7-A and unavailable in various CPUs implementations.
#define flags(name, subs,...)
#define AV_CPU_FLAG_ARMV6T2