summaryrefslogtreecommitdiffstats
path: root/media/libwebp/moz/cpu.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-02-03 14:02:24 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-02-03 14:02:24 +0100
commit1e1fb5ea2504e548bc17521bdb273c9e59b9cf01 (patch)
tree6bdc1701a04e4eefb2d0b985ca78f6c53cb845b5 /media/libwebp/moz/cpu.cpp
parentfcfa07318b5b25d0bb650aa820d99a8c5c14e61b (diff)
parent4662aad03a28a6fa049f2c34ab58069718a229fe (diff)
downloadUXP-1e1fb5ea2504e548bc17521bdb273c9e59b9cf01.tar
UXP-1e1fb5ea2504e548bc17521bdb273c9e59b9cf01.tar.gz
UXP-1e1fb5ea2504e548bc17521bdb273c9e59b9cf01.tar.lz
UXP-1e1fb5ea2504e548bc17521bdb273c9e59b9cf01.tar.xz
UXP-1e1fb5ea2504e548bc17521bdb273c9e59b9cf01.zip
Merge branch 'goanna-gfx'
Diffstat (limited to 'media/libwebp/moz/cpu.cpp')
-rw-r--r--media/libwebp/moz/cpu.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/media/libwebp/moz/cpu.cpp b/media/libwebp/moz/cpu.cpp
new file mode 100644
index 000000000..39b9f3500
--- /dev/null
+++ b/media/libwebp/moz/cpu.cpp
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/* This file replaces the CPU info methods originally implemented in
+ * src/dsp/cpu.c, due to missing dependencies for Andriod builds. It
+ * controls if NEON/SSE/etc is used. */
+
+#include "../dsp/dsp.h"
+#include "mozilla/arm.h"
+#include "mozilla/SSE.h"
+
+static int MozCPUInfo(CPUFeature feature)
+{
+ switch (feature) {
+#if defined(__i386__) || defined(__x86_64__) || defined(WEBP_MSC_SSE2)
+ case kSSE2:
+ return mozilla::supports_sse2();
+ case kSSE3:
+ return mozilla::supports_sse3();
+ case kSSE4_1:
+ return mozilla::supports_sse4_1();
+ case kAVX:
+ return mozilla::supports_avx();
+ case kAVX2:
+ return mozilla::supports_avx2();
+#endif
+#if defined(WEBP_USE_NEON) || defined(WEBP_ANDROID_NEON)
+ case kNEON:
+ return mozilla::supports_neon();
+#endif
+#if defined(WEBP_USE_MIPS32) || defined(WEBP_USE_MIPS_DSP_R2) || defined(WEBP_USE_MSA)
+ case kMIPS32:
+ case kMIPSdspR2:
+ case kMSA:
+ return 1;
+#endif
+ default:
+ return 0;
+ }
+}
+
+VP8CPUInfo VP8GetCPUInfo = MozCPUInfo;