OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 MaxAbsValueW16 WebRtcSpl_MaxAbsValueW16; | 21 MaxAbsValueW16 WebRtcSpl_MaxAbsValueW16; |
22 MaxAbsValueW32 WebRtcSpl_MaxAbsValueW32; | 22 MaxAbsValueW32 WebRtcSpl_MaxAbsValueW32; |
23 MaxValueW16 WebRtcSpl_MaxValueW16; | 23 MaxValueW16 WebRtcSpl_MaxValueW16; |
24 MaxValueW32 WebRtcSpl_MaxValueW32; | 24 MaxValueW32 WebRtcSpl_MaxValueW32; |
25 MinValueW16 WebRtcSpl_MinValueW16; | 25 MinValueW16 WebRtcSpl_MinValueW16; |
26 MinValueW32 WebRtcSpl_MinValueW32; | 26 MinValueW32 WebRtcSpl_MinValueW32; |
27 CrossCorrelation WebRtcSpl_CrossCorrelation; | 27 CrossCorrelation WebRtcSpl_CrossCorrelation; |
28 DownsampleFast WebRtcSpl_DownsampleFast; | 28 DownsampleFast WebRtcSpl_DownsampleFast; |
29 ScaleAndAddVectorsWithRound WebRtcSpl_ScaleAndAddVectorsWithRound; | 29 ScaleAndAddVectorsWithRound WebRtcSpl_ScaleAndAddVectorsWithRound; |
30 | 30 |
31 #if (defined(WEBRTC_DETECT_NEON) || !defined(WEBRTC_HAS_NEON)) && \ | 31 #if (!defined(WEBRTC_HAS_NEON)) && !defined(MIPS32_LE) |
32 !defined(MIPS32_LE) | |
33 /* Initialize function pointers to the generic C version. */ | 32 /* Initialize function pointers to the generic C version. */ |
34 static void InitPointersToC() { | 33 static void InitPointersToC() { |
35 WebRtcSpl_MaxAbsValueW16 = WebRtcSpl_MaxAbsValueW16C; | 34 WebRtcSpl_MaxAbsValueW16 = WebRtcSpl_MaxAbsValueW16C; |
36 WebRtcSpl_MaxAbsValueW32 = WebRtcSpl_MaxAbsValueW32C; | 35 WebRtcSpl_MaxAbsValueW32 = WebRtcSpl_MaxAbsValueW32C; |
37 WebRtcSpl_MaxValueW16 = WebRtcSpl_MaxValueW16C; | 36 WebRtcSpl_MaxValueW16 = WebRtcSpl_MaxValueW16C; |
38 WebRtcSpl_MaxValueW32 = WebRtcSpl_MaxValueW32C; | 37 WebRtcSpl_MaxValueW32 = WebRtcSpl_MaxValueW32C; |
39 WebRtcSpl_MinValueW16 = WebRtcSpl_MinValueW16C; | 38 WebRtcSpl_MinValueW16 = WebRtcSpl_MinValueW16C; |
40 WebRtcSpl_MinValueW32 = WebRtcSpl_MinValueW32C; | 39 WebRtcSpl_MinValueW32 = WebRtcSpl_MinValueW32C; |
41 WebRtcSpl_CrossCorrelation = WebRtcSpl_CrossCorrelationC; | 40 WebRtcSpl_CrossCorrelation = WebRtcSpl_CrossCorrelationC; |
42 WebRtcSpl_DownsampleFast = WebRtcSpl_DownsampleFastC; | 41 WebRtcSpl_DownsampleFast = WebRtcSpl_DownsampleFastC; |
43 WebRtcSpl_ScaleAndAddVectorsWithRound = | 42 WebRtcSpl_ScaleAndAddVectorsWithRound = |
44 WebRtcSpl_ScaleAndAddVectorsWithRoundC; | 43 WebRtcSpl_ScaleAndAddVectorsWithRoundC; |
45 } | 44 } |
46 #endif | 45 #endif |
47 | 46 |
48 #if defined(WEBRTC_DETECT_NEON) || defined(WEBRTC_HAS_NEON) | 47 #if defined(WEBRTC_HAS_NEON) |
49 /* Initialize function pointers to the Neon version. */ | 48 /* Initialize function pointers to the Neon version. */ |
50 static void InitPointersToNeon() { | 49 static void InitPointersToNeon() { |
51 WebRtcSpl_MaxAbsValueW16 = WebRtcSpl_MaxAbsValueW16Neon; | 50 WebRtcSpl_MaxAbsValueW16 = WebRtcSpl_MaxAbsValueW16Neon; |
52 WebRtcSpl_MaxAbsValueW32 = WebRtcSpl_MaxAbsValueW32Neon; | 51 WebRtcSpl_MaxAbsValueW32 = WebRtcSpl_MaxAbsValueW32Neon; |
53 WebRtcSpl_MaxValueW16 = WebRtcSpl_MaxValueW16Neon; | 52 WebRtcSpl_MaxValueW16 = WebRtcSpl_MaxValueW16Neon; |
54 WebRtcSpl_MaxValueW32 = WebRtcSpl_MaxValueW32Neon; | 53 WebRtcSpl_MaxValueW32 = WebRtcSpl_MaxValueW32Neon; |
55 WebRtcSpl_MinValueW16 = WebRtcSpl_MinValueW16Neon; | 54 WebRtcSpl_MinValueW16 = WebRtcSpl_MinValueW16Neon; |
56 WebRtcSpl_MinValueW32 = WebRtcSpl_MinValueW32Neon; | 55 WebRtcSpl_MinValueW32 = WebRtcSpl_MinValueW32Neon; |
57 WebRtcSpl_CrossCorrelation = WebRtcSpl_CrossCorrelationNeon; | 56 WebRtcSpl_CrossCorrelation = WebRtcSpl_CrossCorrelationNeon; |
58 WebRtcSpl_DownsampleFast = WebRtcSpl_DownsampleFastNeon; | 57 WebRtcSpl_DownsampleFast = WebRtcSpl_DownsampleFastNeon; |
(...skipping 18 matching lines...) Expand all Loading... |
77 WebRtcSpl_ScaleAndAddVectorsWithRound_mips; | 76 WebRtcSpl_ScaleAndAddVectorsWithRound_mips; |
78 #else | 77 #else |
79 WebRtcSpl_MaxAbsValueW32 = WebRtcSpl_MaxAbsValueW32C; | 78 WebRtcSpl_MaxAbsValueW32 = WebRtcSpl_MaxAbsValueW32C; |
80 WebRtcSpl_ScaleAndAddVectorsWithRound = | 79 WebRtcSpl_ScaleAndAddVectorsWithRound = |
81 WebRtcSpl_ScaleAndAddVectorsWithRoundC; | 80 WebRtcSpl_ScaleAndAddVectorsWithRoundC; |
82 #endif | 81 #endif |
83 } | 82 } |
84 #endif | 83 #endif |
85 | 84 |
86 static void InitFunctionPointers(void) { | 85 static void InitFunctionPointers(void) { |
87 #if defined(WEBRTC_DETECT_NEON) | 86 #if defined(WEBRTC_HAS_NEON) |
88 if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) { | |
89 InitPointersToNeon(); | |
90 } else { | |
91 InitPointersToC(); | |
92 } | |
93 #elif defined(WEBRTC_HAS_NEON) | |
94 InitPointersToNeon(); | 87 InitPointersToNeon(); |
95 #elif defined(MIPS32_LE) | 88 #elif defined(MIPS32_LE) |
96 InitPointersToMIPS(); | 89 InitPointersToMIPS(); |
97 #else | 90 #else |
98 InitPointersToC(); | 91 InitPointersToC(); |
99 #endif /* WEBRTC_DETECT_NEON */ | 92 #endif /* WEBRTC_HAS_NEON */ |
100 } | 93 } |
101 | 94 |
102 #if defined(WEBRTC_POSIX) | 95 #if defined(WEBRTC_POSIX) |
103 #include <pthread.h> | 96 #include <pthread.h> |
104 | 97 |
105 static void once(void (*func)(void)) { | 98 static void once(void (*func)(void)) { |
106 static pthread_once_t lock = PTHREAD_ONCE_INIT; | 99 static pthread_once_t lock = PTHREAD_ONCE_INIT; |
107 pthread_once(&lock, func); | 100 pthread_once(&lock, func); |
108 } | 101 } |
109 | 102 |
(...skipping 21 matching lines...) Expand all Loading... |
131 | 124 |
132 /* There's no fallback version as an #else block here to ensure thread safety. | 125 /* There's no fallback version as an #else block here to ensure thread safety. |
133 * In case of neither pthread for WEBRTC_POSIX nor _WIN32 is present, build | 126 * In case of neither pthread for WEBRTC_POSIX nor _WIN32 is present, build |
134 * system should pick it up. | 127 * system should pick it up. |
135 */ | 128 */ |
136 #endif /* WEBRTC_POSIX */ | 129 #endif /* WEBRTC_POSIX */ |
137 | 130 |
138 void WebRtcSpl_Init() { | 131 void WebRtcSpl_Init() { |
139 once(InitFunctionPointers); | 132 once(InitFunctionPointers); |
140 } | 133 } |
OLD | NEW |