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 11 matching lines...) Expand all Loading... |
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 "platform/audio/VectorMath.h" | 29 #include "platform/audio/VectorMath.h" |
30 #include "wtf/Assertions.h" | 30 #include "wtf/Assertions.h" |
31 #include "wtf/CPU.h" | 31 #include "wtf/CPU.h" |
| 32 #include "wtf/MathExtras.h" |
32 #include <stdint.h> | 33 #include <stdint.h> |
33 | 34 |
34 #if OS(MACOSX) | 35 #if OS(MACOSX) |
35 #include <Accelerate/Accelerate.h> | 36 #include <Accelerate/Accelerate.h> |
36 #endif | 37 #endif |
37 | 38 |
38 #if CPU(X86) || CPU(X86_64) | 39 #if CPU(X86) || CPU(X86_64) |
39 #include <emmintrin.h> | 40 #include <emmintrin.h> |
40 #endif | 41 #endif |
41 | 42 |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 while (destP < endP) { | 669 while (destP < endP) { |
669 float32x4_t source = vld1q_f32(sourceP); | 670 float32x4_t source = vld1q_f32(sourceP); |
670 vst1q_f32(destP, vmaxq_f32(vminq_f32(source, high), low)); | 671 vst1q_f32(destP, vmaxq_f32(vminq_f32(source, high), low)); |
671 sourceP += 4; | 672 sourceP += 4; |
672 destP += 4; | 673 destP += 4; |
673 } | 674 } |
674 n = tailFrames; | 675 n = tailFrames; |
675 } | 676 } |
676 #endif | 677 #endif |
677 while (n--) { | 678 while (n--) { |
678 *destP = std::max(std::min(*sourceP, highThreshold), lowThreshold); | 679 *destP = clampTo(*sourceP, lowThreshold, highThreshold); |
679 sourceP += sourceStride; | 680 sourceP += sourceStride; |
680 destP += destStride; | 681 destP += destStride; |
681 } | 682 } |
682 } | 683 } |
683 | 684 |
684 #endif // OS(MACOSX) | 685 #endif // OS(MACOSX) |
685 | 686 |
686 } // namespace VectorMath | 687 } // namespace VectorMath |
687 | 688 |
688 } // namespace blink | 689 } // namespace blink |
689 | 690 |
690 #endif // ENABLE(WEB_AUDIO) | 691 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |