summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/libwebp/src/dsp/cpu.c
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-01-26 09:59:43 +0100
committerLiang Qi <liang.qi@qt.io>2017-01-26 09:59:43 +0100
commit8f045f413e935ef9e7fdcef55c52343686a0f1aa (patch)
tree273230a3c167830828106002137e33a981c5a04d /src/3rdparty/libwebp/src/dsp/cpu.c
parent0870e670665a702665948723bb7b1eb61a9572a8 (diff)
parentcd2de115c6216ad747cf4803e65a4ce4af220795 (diff)
Merge remote-tracking branch 'origin/5.8.0' into 5.8
Diffstat (limited to 'src/3rdparty/libwebp/src/dsp/cpu.c')
-rw-r--r--src/3rdparty/libwebp/src/dsp/cpu.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/3rdparty/libwebp/src/dsp/cpu.c b/src/3rdparty/libwebp/src/dsp/cpu.c
index 8844cb4..cbb08db 100644
--- a/src/3rdparty/libwebp/src/dsp/cpu.c
+++ b/src/3rdparty/libwebp/src/dsp/cpu.c
@@ -13,6 +13,11 @@
#include "./dsp.h"
+#if defined(WEBP_HAVE_NEON_RTCD)
+#include <stdio.h>
+#include <string.h>
+#endif
+
#if defined(WEBP_ANDROID_NEON)
#include <cpu-features.h>
#endif
@@ -142,13 +147,33 @@ VP8CPUInfo VP8GetCPUInfo = AndroidCPUInfo;
// define a dummy function to enable turning off NEON at runtime by setting
// VP8DecGetCPUInfo = NULL
static int armCPUInfo(CPUFeature feature) {
- (void)feature;
+ if (feature != kNEON) return 0;
+#if defined(__linux__) && defined(WEBP_HAVE_NEON_RTCD)
+ {
+ int has_neon = 0;
+ char line[200];
+ FILE* const cpuinfo = fopen("/proc/cpuinfo", "r");
+ if (cpuinfo == NULL) return 0;
+ while (fgets(line, sizeof(line), cpuinfo)) {
+ if (!strncmp(line, "Features", 8)) {
+ if (strstr(line, " neon ") != NULL) {
+ has_neon = 1;
+ break;
+ }
+ }
+ }
+ fclose(cpuinfo);
+ return has_neon;
+ }
+#else
return 1;
+#endif
}
VP8CPUInfo VP8GetCPUInfo = armCPUInfo;
-#elif defined(WEBP_USE_MIPS32) || defined(WEBP_USE_MIPS_DSP_R2)
+#elif defined(WEBP_USE_MIPS32) || defined(WEBP_USE_MIPS_DSP_R2) || \
+ defined(WEBP_USE_MSA)
static int mipsCPUInfo(CPUFeature feature) {
- if ((feature == kMIPS32) || (feature == kMIPSdspR2)) {
+ if ((feature == kMIPS32) || (feature == kMIPSdspR2) || (feature == kMSA)) {
return 1;
} else {
return 0;