Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3813)

Unified Diff: Source/platform/audio/VectorMath.cpp

Issue 604373003: [WIP] Supporting arm_neon_optional flag for blink platform. Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/audio/VectorMath.h ('k') | Source/platform/audio/cpu/arm/VectorMathNEON.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/audio/VectorMath.cpp
diff --git a/Source/platform/audio/VectorMath.cpp b/Source/platform/audio/VectorMath.cpp
index 219ed5463977ac5cc172f1117fd0cca3f9008a9a..9bef4f41c6c66003e2a73cecc1e58739a3046a10 100644
--- a/Source/platform/audio/VectorMath.cpp
+++ b/Source/platform/audio/VectorMath.cpp
@@ -27,11 +27,17 @@
#if ENABLE(WEB_AUDIO)
#include "platform/audio/VectorMath.h"
+
#include "wtf/Assertions.h"
#include "wtf/CPU.h"
+#include <algorithm>
+#include <math.h>
#include <stdint.h>
#if OS(MACOSX)
+// On the Mac we use the highly optimized versions in Accelerate.framework
+// In 32-bit mode (__ppc__ or __i386__) <Accelerate/Accelerate.h> includes <vecLib/vDSP_translate.h> which defines macros of the same name as
+// our namespaced function names, so we must handle this case differently. Other architectures (64bit, ARM, etc.) do not include this header file.
#include <Accelerate/Accelerate.h>
#endif
@@ -39,46 +45,43 @@
#include <emmintrin.h>
#endif
-#if HAVE(ARM_NEON_INTRINSICS)
-#include <arm_neon.h>
-#endif
-
-#include <math.h>
-#include <algorithm>
namespace blink {
namespace VectorMath {
#if OS(MACOSX)
-// On the Mac we use the highly optimized versions in Accelerate.framework
-// In 32-bit mode (__ppc__ or __i386__) <Accelerate/Accelerate.h> includes <vecLib/vDSP_translate.h> which defines macros of the same name as
-// our namespaced function names, so we must handle this case differently. Other architectures (64bit, ARM, etc.) do not include this header file.
void vsmul(const float* sourceP, int sourceStride, const float* scale, float* destP, int destStride, size_t framesToProcess)
{
-#if CPU(X86)
- ::vsmul(sourceP, sourceStride, scale, destP, destStride, framesToProcess);
-#else
+#if OS(MACOSX) && !CPU(X86)
vDSP_vsmul(sourceP, sourceStride, scale, destP, destStride, framesToProcess);
+#elif HAVE(ARM_NEON_INTRINSICS)
+ WTF_CPU_ARM_NEON_WRAP(vsmul)(sourceP, sourceStride, scale, destP, destStride, framesToProcess);
+#else
+ ::vsmul(sourceP, sourceStride, scale, destP, destStride, framesToProcess);
#endif
}
void vadd(const float* source1P, int sourceStride1, const float* source2P, int sourceStride2, float* destP, int destStride, size_t framesToProcess)
{
-#if CPU(X86)
- ::vadd(source1P, sourceStride1, source2P, sourceStride2, destP, destStride, framesToProcess);
-#else
+#if OS(MACOSX) && !CPU(X86)
vDSP_vadd(source1P, sourceStride1, source2P, sourceStride2, destP, destStride, framesToProcess);
+#elif HAVE(ARM_NEON_INTRINSICS)
+ WTF_CPU_ARM_NEON_WRAP(vadd)(source1P, sourceStride1, source2P, sourceStride2, destP, destStride, framesToProcess);
+#else
+ ::vadd(source1P, sourceStride1, source2P, sourceStride2, destP, destStride, framesToProcess);
#endif
}
void vmul(const float* source1P, int sourceStride1, const float* source2P, int sourceStride2, float* destP, int destStride, size_t framesToProcess)
{
-#if CPU(X86)
- ::vmul(source1P, sourceStride1, source2P, sourceStride2, destP, destStride, framesToProcess);
-#else
+#if OS(MACOSX) && !CPU(X86)
vDSP_vmul(source1P, sourceStride1, source2P, sourceStride2, destP, destStride, framesToProcess);
+#elif HAVE(ARM_NEON_INTRINSICS)
+ WTF_CPU_ARM_NEON_WRAP(vmul)(source1P, sourceStride1, source2P, sourceStride2, destP, destStride, framesToProcess);
+#else
+ ::vmul(source1P, sourceStride1, source2P, sourceStride2, destP, destStride, framesToProcess);
#endif
}
« no previous file with comments | « Source/platform/audio/VectorMath.h ('k') | Source/platform/audio/cpu/arm/VectorMathNEON.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698