aboutsummaryrefslogtreecommitdiff
path: root/src/dsp/cpu.c
diff options
context:
space:
mode:
authorJames Zern <jzern@google.com>2016-07-12 15:08:45 -0700
committerJames Zern <jzern@google.com>2016-07-13 12:57:19 -0700
commit0912efc2528d03c59d45dd9bdc9ff9ec800a3fc1 (patch)
tree5a9e0e91d57813bf5b7f6bd5f6aef14f6c8d096e /src/dsp/cpu.c
parent381529dfa17d5156a9a3aed7955413844722d658 (diff)
downloadwebp-0912efc2528d03c59d45dd9bdc9ff9ec800a3fc1.tar.gz
libwebp: update to 0.5.1
- 6/14/2016: version 0.5.1 This is a binary compatible release. * miscellaneous bug fixes (issues #280, #289) * reverted alpha plane encoding with color cache for compatibility with libwebp 0.4.0->0.4.3 (issues #291, #298) * lossless encoding performance improvements * memory reduction in both lossless encoding and decoding * force mux output to be in the extended format (VP8X) when undefined chunks are present (issue #294) * gradle, cmake build support * workaround for compiler bug causing 64-bit decode failures on android devices using clang-3.8 in the r11c NDK * various WebPAnimEncoder improvements Change-Id: Icc64a8e83f8fcb5a0ce996afdbf902fd7e6d8c3a
Diffstat (limited to 'src/dsp/cpu.c')
-rw-r--r--src/dsp/cpu.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/dsp/cpu.c b/src/dsp/cpu.c
index a4e5eeaa..b8cd0030 100644
--- a/src/dsp/cpu.c
+++ b/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(__ANDROID__)
#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;