| OLD | NEW |
| 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 12 matching lines...) Expand all Loading... |
| 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 <stdint.h> | 31 #include <stdint.h> |
| 32 | 32 |
| 33 #if OS(DARWIN) | 33 #if OS(MACOSX) |
| 34 #include <Accelerate/Accelerate.h> | 34 #include <Accelerate/Accelerate.h> |
| 35 #endif | 35 #endif |
| 36 | 36 |
| 37 #ifdef __SSE2__ | 37 #ifdef __SSE2__ |
| 38 #include <emmintrin.h> | 38 #include <emmintrin.h> |
| 39 #endif | 39 #endif |
| 40 | 40 |
| 41 #if HAVE(ARM_NEON_INTRINSICS) | 41 #if HAVE(ARM_NEON_INTRINSICS) |
| 42 #include <arm_neon.h> | 42 #include <arm_neon.h> |
| 43 #endif | 43 #endif |
| 44 | 44 |
| 45 #include <math.h> | 45 #include <math.h> |
| 46 #include <algorithm> | 46 #include <algorithm> |
| 47 | 47 |
| 48 namespace WebCore { | 48 namespace WebCore { |
| 49 | 49 |
| 50 namespace VectorMath { | 50 namespace VectorMath { |
| 51 | 51 |
| 52 #if OS(DARWIN) | 52 #if OS(MACOSX) |
| 53 // On the Mac we use the highly optimized versions in Accelerate.framework | 53 // 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 | 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 // our namespaced function names, so we must handle this case differently. Other
architectures (64bit, ARM, etc.) do not include this header file. | 55 // our namespaced function names, so we must handle this case differently. Other
architectures (64bit, ARM, etc.) do not include this header file. |
| 56 | 56 |
| 57 void vsmul(const float* sourceP, int sourceStride, const float* scale, float* de
stP, int destStride, size_t framesToProcess) | 57 void vsmul(const float* sourceP, int sourceStride, const float* scale, float* de
stP, int destStride, size_t framesToProcess) |
| 58 { | 58 { |
| 59 #if defined(__ppc__) || defined(__i386__) | 59 #if defined(__ppc__) || defined(__i386__) |
| 60 ::vsmul(sourceP, sourceStride, scale, destP, destStride, framesToProcess); | 60 ::vsmul(sourceP, sourceStride, scale, destP, destStride, framesToProcess); |
| 61 #else | 61 #else |
| 62 vDSP_vsmul(sourceP, sourceStride, scale, destP, destStride, framesToProcess)
; | 62 vDSP_vsmul(sourceP, sourceStride, scale, destP, destStride, framesToProcess)
; |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 n = tailFrames; | 673 n = tailFrames; |
| 674 } | 674 } |
| 675 #endif | 675 #endif |
| 676 while (n--) { | 676 while (n--) { |
| 677 *destP = std::max(std::min(*sourceP, highThreshold), lowThreshold); | 677 *destP = std::max(std::min(*sourceP, highThreshold), lowThreshold); |
| 678 sourceP += sourceStride; | 678 sourceP += sourceStride; |
| 679 destP += destStride; | 679 destP += destStride; |
| 680 } | 680 } |
| 681 } | 681 } |
| 682 | 682 |
| 683 #endif // OS(DARWIN) | 683 #endif // OS(MACOSX) |
| 684 | 684 |
| 685 } // namespace VectorMath | 685 } // namespace VectorMath |
| 686 | 686 |
| 687 } // namespace WebCore | 687 } // namespace WebCore |
| 688 | 688 |
| 689 #endif // ENABLE(WEB_AUDIO) | 689 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |