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

Side by Side Diff: Source/core/platform/audio/VectorMath.cpp

Issue 23936006: Use wtf macros for audio (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 7 years, 3 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 unified diff | Download patch
« no previous file with comments | « Source/core/platform/audio/DirectConvolver.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 10 matching lines...) Expand all
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */ 23 */
24 24
25 #include "config.h" 25 #include "config.h"
26 26
27 #if ENABLE(WEB_AUDIO) 27 #if ENABLE(WEB_AUDIO)
28 28
29 #include "core/platform/audio/VectorMath.h" 29 #include "core/platform/audio/VectorMath.h"
30 #include "wtf/Assertions.h" 30 #include "wtf/Assertions.h"
31 #include "wtf/CPU.h"
31 #include <stdint.h> 32 #include <stdint.h>
32 33
33 #if OS(MACOSX) 34 #if OS(MACOSX)
34 #include <Accelerate/Accelerate.h> 35 #include <Accelerate/Accelerate.h>
35 #endif 36 #endif
36 37
37 #ifdef __SSE2__ 38 #ifdef __SSE2__
38 #include <emmintrin.h> 39 #include <emmintrin.h>
39 #endif 40 #endif
40 41
41 #if HAVE(ARM_NEON_INTRINSICS) 42 #if HAVE(ARM_NEON_INTRINSICS)
42 #include <arm_neon.h> 43 #include <arm_neon.h>
43 #endif 44 #endif
44 45
45 #include <math.h> 46 #include <math.h>
46 #include <algorithm> 47 #include <algorithm>
47 48
48 namespace WebCore { 49 namespace WebCore {
49 50
50 namespace VectorMath { 51 namespace VectorMath {
51 52
52 #if OS(MACOSX) 53 #if OS(MACOSX)
53 // On the Mac we use the highly optimized versions in Accelerate.framework 54 // On the Mac we use the highly optimized versions in Accelerate.framework
54 // In 32-bit mode (__ppc__ or __i386__) <Accelerate/Accelerate.h> includes <vecL ib/vDSP_translate.h> which defines macros of the same name as 55 // In 32-bit mode (__ppc__ or __i386__) <Accelerate/Accelerate.h> includes <vecL ib/vDSP_translate.h> which defines macros of the same name as
55 // our namespaced function names, so we must handle this case differently. Other architectures (64bit, ARM, etc.) do not include this header file. 56 // our namespaced function names, so we must handle this case differently. Other architectures (64bit, ARM, etc.) do not include this header file.
56 57
57 void vsmul(const float* sourceP, int sourceStride, const float* scale, float* de stP, int destStride, size_t framesToProcess) 58 void vsmul(const float* sourceP, int sourceStride, const float* scale, float* de stP, int destStride, size_t framesToProcess)
58 { 59 {
59 #if defined(__i386__) 60 #if CPU(X86)
60 ::vsmul(sourceP, sourceStride, scale, destP, destStride, framesToProcess); 61 ::vsmul(sourceP, sourceStride, scale, destP, destStride, framesToProcess);
61 #else 62 #else
62 vDSP_vsmul(sourceP, sourceStride, scale, destP, destStride, framesToProcess) ; 63 vDSP_vsmul(sourceP, sourceStride, scale, destP, destStride, framesToProcess) ;
63 #endif 64 #endif
64 } 65 }
65 66
66 void vadd(const float* source1P, int sourceStride1, const float* source2P, int s ourceStride2, float* destP, int destStride, size_t framesToProcess) 67 void vadd(const float* source1P, int sourceStride1, const float* source2P, int s ourceStride2, float* destP, int destStride, size_t framesToProcess)
67 { 68 {
68 #if defined(__i386__) 69 #if CPU(X86)
69 ::vadd(source1P, sourceStride1, source2P, sourceStride2, destP, destStride, framesToProcess); 70 ::vadd(source1P, sourceStride1, source2P, sourceStride2, destP, destStride, framesToProcess);
70 #else 71 #else
71 vDSP_vadd(source1P, sourceStride1, source2P, sourceStride2, destP, destStrid e, framesToProcess); 72 vDSP_vadd(source1P, sourceStride1, source2P, sourceStride2, destP, destStrid e, framesToProcess);
72 #endif 73 #endif
73 } 74 }
74 75
75 void vmul(const float* source1P, int sourceStride1, const float* source2P, int s ourceStride2, float* destP, int destStride, size_t framesToProcess) 76 void vmul(const float* source1P, int sourceStride1, const float* source2P, int s ourceStride2, float* destP, int destStride, size_t framesToProcess)
76 { 77 {
77 #if defined(__i386__) 78 #if CPU(X86)
78 ::vmul(source1P, sourceStride1, source2P, sourceStride2, destP, destStride, framesToProcess); 79 ::vmul(source1P, sourceStride1, source2P, sourceStride2, destP, destStride, framesToProcess);
79 #else 80 #else
80 vDSP_vmul(source1P, sourceStride1, source2P, sourceStride2, destP, destStrid e, framesToProcess); 81 vDSP_vmul(source1P, sourceStride1, source2P, sourceStride2, destP, destStrid e, framesToProcess);
81 #endif 82 #endif
82 } 83 }
83 84
84 void zvmul(const float* real1P, const float* imag1P, const float* real2P, const float* imag2P, float* realDestP, float* imagDestP, size_t framesToProcess) 85 void zvmul(const float* real1P, const float* imag1P, const float* real2P, const float* imag2P, float* realDestP, float* imagDestP, size_t framesToProcess)
85 { 86 {
86 DSPSplitComplex sc1; 87 DSPSplitComplex sc1;
87 DSPSplitComplex sc2; 88 DSPSplitComplex sc2;
88 DSPSplitComplex dest; 89 DSPSplitComplex dest;
89 sc1.realp = const_cast<float*>(real1P); 90 sc1.realp = const_cast<float*>(real1P);
90 sc1.imagp = const_cast<float*>(imag1P); 91 sc1.imagp = const_cast<float*>(imag1P);
91 sc2.realp = const_cast<float*>(real2P); 92 sc2.realp = const_cast<float*>(real2P);
92 sc2.imagp = const_cast<float*>(imag2P); 93 sc2.imagp = const_cast<float*>(imag2P);
93 dest.realp = realDestP; 94 dest.realp = realDestP;
94 dest.imagp = imagDestP; 95 dest.imagp = imagDestP;
95 #if defined(__i386__) 96 #if CPU(X86)
96 ::zvmul(&sc1, 1, &sc2, 1, &dest, 1, framesToProcess, 1); 97 ::zvmul(&sc1, 1, &sc2, 1, &dest, 1, framesToProcess, 1);
97 #else 98 #else
98 vDSP_zvmul(&sc1, 1, &sc2, 1, &dest, 1, framesToProcess, 1); 99 vDSP_zvmul(&sc1, 1, &sc2, 1, &dest, 1, framesToProcess, 1);
99 #endif 100 #endif
100 } 101 }
101 102
102 void vsma(const float* sourceP, int sourceStride, const float* scale, float* des tP, int destStride, size_t framesToProcess) 103 void vsma(const float* sourceP, int sourceStride, const float* scale, float* des tP, int destStride, size_t framesToProcess)
103 { 104 {
104 vDSP_vsma(sourceP, sourceStride, scale, destP, destStride, destP, destStride , framesToProcess); 105 vDSP_vsma(sourceP, sourceStride, scale, destP, destStride, destP, destStride , framesToProcess);
105 } 106 }
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 } 681 }
681 } 682 }
682 683
683 #endif // OS(MACOSX) 684 #endif // OS(MACOSX)
684 685
685 } // namespace VectorMath 686 } // namespace VectorMath
686 687
687 } // namespace WebCore 688 } // namespace WebCore
688 689
689 #endif // ENABLE(WEB_AUDIO) 690 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/core/platform/audio/DirectConvolver.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698