OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/base/vector_math.h" | 5 #include "media/base/vector_math.h" |
6 #include "media/base/vector_math_testing.h" | 6 #include "media/base/vector_math_testing.h" |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 | 12 |
13 // NaCl does not allow intrinsics. | 13 // NaCl does not allow intrinsics. |
14 #if defined(ARCH_CPU_X86_FAMILY) && !defined(OS_NACL) | 14 #if defined(ARCH_CPU_X86_FAMILY) && !defined(OS_NACL) |
15 #include <xmmintrin.h> | 15 #include <xmmintrin.h> |
| 16 // Don't use custom SSE versions where the auto-vectorized C version performs |
| 17 // better, which is anywhere clang is used. |
| 18 #if !defined(__clang__) |
16 #define FMAC_FUNC FMAC_SSE | 19 #define FMAC_FUNC FMAC_SSE |
17 #define FMUL_FUNC FMUL_SSE | 20 #define FMUL_FUNC FMUL_SSE |
| 21 #else |
| 22 #define FMAC_FUNC FMAC_C |
| 23 #define FMUL_FUNC FMUL_C |
| 24 #endif |
18 #define EWMAAndMaxPower_FUNC EWMAAndMaxPower_SSE | 25 #define EWMAAndMaxPower_FUNC EWMAAndMaxPower_SSE |
19 #elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON) | 26 #elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON) |
20 #include <arm_neon.h> | 27 #include <arm_neon.h> |
21 #define FMAC_FUNC FMAC_NEON | 28 #define FMAC_FUNC FMAC_NEON |
22 #define FMUL_FUNC FMUL_NEON | 29 #define FMUL_FUNC FMUL_NEON |
23 #define EWMAAndMaxPower_FUNC EWMAAndMaxPower_NEON | 30 #define EWMAAndMaxPower_FUNC EWMAAndMaxPower_NEON |
24 #else | 31 #else |
25 #define FMAC_FUNC FMAC_C | 32 #define FMAC_FUNC FMAC_C |
26 #define FMUL_FUNC FMUL_C | 33 #define FMUL_FUNC FMUL_C |
27 #define EWMAAndMaxPower_FUNC EWMAAndMaxPower_C | 34 #define EWMAAndMaxPower_FUNC EWMAAndMaxPower_C |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 result.first += sample_squared * smoothing_factor; | 282 result.first += sample_squared * smoothing_factor; |
276 result.second = std::max(result.second, sample_squared); | 283 result.second = std::max(result.second, sample_squared); |
277 } | 284 } |
278 | 285 |
279 return result; | 286 return result; |
280 } | 287 } |
281 #endif | 288 #endif |
282 | 289 |
283 } // namespace vector_math | 290 } // namespace vector_math |
284 } // namespace media | 291 } // namespace media |
OLD | NEW |