aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-02-14 13:50:03 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-02-14 13:50:08 +0100
commit7d3e2176231716e6ebddb3ae406245d500979ea8 (patch)
treebf155cae9debeda16a9c4d8b3b3c6cb1dd80f907 /libavutil
parent2ac6b573a4083e5b840f3577a063237ae0088401 (diff)
parent5310da7e83ec9f149dac4c2c5a64e1a24951259e (diff)
downloadffmpeg-7d3e2176231716e6ebddb3ae406245d500979ea8.tar.gz
Merge remote-tracking branch 'qatar/release/9' into release/1.1
* qatar/release/9: arm: Fall back to runtime cpu feature detection via /proc/cpuinfo doc/platform: Fix 10l typo xxan: properly handle odd heights. Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/arm/cpu.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/libavutil/arm/cpu.c b/libavutil/arm/cpu.c
index 041afc985a..b4aabc375e 100644
--- a/libavutil/arm/cpu.c
+++ b/libavutil/arm/cpu.c
@@ -34,6 +34,8 @@
#include <stdint.h>
#include <stdio.h>
+#include <string.h>
+#include "libavutil/avstring.h"
#define AT_HWCAP 16
@@ -66,13 +68,44 @@ static int get_hwcap(uint32_t *hwcap)
return err;
}
+static int get_cpuinfo(uint32_t *hwcap)
+{
+ FILE *f = fopen("/proc/cpuinfo", "r");
+ char buf[200];
+
+ if (!f)
+ return -1;
+
+ *hwcap = 0;
+ while (fgets(buf, sizeof(buf), f)) {
+ if (av_strstart(buf, "Features", NULL)) {
+ if (strstr(buf, " edsp "))
+ *hwcap |= HWCAP_EDSP;
+ if (strstr(buf, " tls "))
+ *hwcap |= HWCAP_TLS;
+ if (strstr(buf, " thumbee "))
+ *hwcap |= HWCAP_THUMBEE;
+ if (strstr(buf, " vfp "))
+ *hwcap |= HWCAP_VFP;
+ if (strstr(buf, " vfpv3 "))
+ *hwcap |= HWCAP_VFPv3;
+ if (strstr(buf, " neon "))
+ *hwcap |= HWCAP_NEON;
+ break;
+ }
+ }
+ fclose(f);
+ return 0;
+}
+
int ff_get_cpu_flags_arm(void)
{
int flags = CORE_CPU_FLAGS;
uint32_t hwcap;
if (get_hwcap(&hwcap) < 0)
- return flags;
+ if (get_cpuinfo(&hwcap) < 0)
+ return flags;
#define check_cap(cap, flag) do { \
if (hwcap & HWCAP_ ## cap) \