| 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 #ifndef FFTFrame_h | 29 #ifndef FFTFrame_h |
| 30 #define FFTFrame_h | 30 #define FFTFrame_h |
| 31 | 31 |
| 32 #include "platform/PlatformExport.h" | 32 #include "platform/PlatformExport.h" |
| 33 #include "platform/audio/AudioArray.h" | 33 #include "platform/audio/AudioArray.h" |
| 34 | 34 |
| 35 #if OS(MACOSX) && !USE(WEBAUDIO_FFMPEG) | 35 #if OS(MACOSX) |
| 36 #define USE_ACCELERATE_FFT 1 | |
| 37 #else | |
| 38 #define USE_ACCELERATE_FFT 0 | |
| 39 #endif | |
| 40 | |
| 41 #if USE_ACCELERATE_FFT | |
| 42 #include <Accelerate/Accelerate.h> | 36 #include <Accelerate/Accelerate.h> |
| 43 #endif | 37 #elif USE(WEBAUDIO_OPENMAX_DL_FFT) |
| 44 | |
| 45 #if !USE_ACCELERATE_FFT | |
| 46 | |
| 47 #if USE(WEBAUDIO_OPENMAX_DL_FFT) | |
| 48 #include <dl/sp/api/omxSP.h> | 38 #include <dl/sp/api/omxSP.h> |
| 49 #elif USE(WEBAUDIO_FFMPEG) | 39 #elif USE(WEBAUDIO_FFMPEG) |
| 50 struct RDFTContext; | 40 struct RDFTContext; |
| 51 #endif | 41 #endif |
| 52 | 42 |
| 53 #endif // !USE_ACCELERATE_FFT | |
| 54 | |
| 55 #if USE(WEBAUDIO_IPP) | 43 #if USE(WEBAUDIO_IPP) |
| 56 #include <ipps.h> | 44 #include <ipps.h> |
| 57 #endif // USE(WEBAUDIO_IPP) | 45 #endif // USE(WEBAUDIO_IPP) |
| 58 | 46 |
| 59 #include "wtf/Forward.h" | 47 #include "wtf/Forward.h" |
| 60 #include "wtf/PassOwnPtr.h" | 48 #include "wtf/PassOwnPtr.h" |
| 61 #include "wtf/Threading.h" | 49 #include "wtf/Threading.h" |
| 62 | 50 |
| 63 namespace WebCore { | 51 namespace WebCore { |
| 64 | 52 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 85 |
| 98 unsigned fftSize() const { return m_FFTSize; } | 86 unsigned fftSize() const { return m_FFTSize; } |
| 99 unsigned log2FFTSize() const { return m_log2FFTSize; } | 87 unsigned log2FFTSize() const { return m_log2FFTSize; } |
| 100 | 88 |
| 101 private: | 89 private: |
| 102 unsigned m_FFTSize; | 90 unsigned m_FFTSize; |
| 103 unsigned m_log2FFTSize; | 91 unsigned m_log2FFTSize; |
| 104 | 92 |
| 105 void interpolateFrequencyComponents(const FFTFrame& frame1, const FFTFrame&
frame2, double x); | 93 void interpolateFrequencyComponents(const FFTFrame& frame1, const FFTFrame&
frame2, double x); |
| 106 | 94 |
| 107 #if USE_ACCELERATE_FFT | 95 #if OS(MACOSX) |
| 108 DSPSplitComplex& dspSplitComplex() { return m_frame; } | 96 DSPSplitComplex& dspSplitComplex() { return m_frame; } |
| 109 DSPSplitComplex dspSplitComplex() const { return m_frame; } | 97 DSPSplitComplex dspSplitComplex() const { return m_frame; } |
| 110 | 98 |
| 111 static FFTSetup fftSetupForSize(unsigned fftSize); | 99 static FFTSetup fftSetupForSize(unsigned fftSize); |
| 112 | 100 |
| 113 static FFTSetup* fftSetups; | 101 static FFTSetup* fftSetups; |
| 114 | 102 |
| 115 FFTSetup m_FFTSetup; | 103 FFTSetup m_FFTSetup; |
| 116 | 104 |
| 117 DSPSplitComplex m_frame; | 105 DSPSplitComplex m_frame; |
| 118 AudioFloatArray m_realData; | 106 AudioFloatArray m_realData; |
| 119 AudioFloatArray m_imagData; | 107 AudioFloatArray m_imagData; |
| 120 #else // !USE_ACCELERATE_FFT | 108 #else // !OS(MACOSX) |
| 121 | 109 |
| 122 #if USE(WEBAUDIO_FFMPEG) | 110 #if USE(WEBAUDIO_FFMPEG) |
| 123 static RDFTContext* contextForSize(unsigned fftSize, int trans); | 111 static RDFTContext* contextForSize(unsigned fftSize, int trans); |
| 124 | 112 |
| 125 RDFTContext* m_forwardContext; | 113 RDFTContext* m_forwardContext; |
| 126 RDFTContext* m_inverseContext; | 114 RDFTContext* m_inverseContext; |
| 127 | 115 |
| 128 float* getUpToDateComplexData(); | 116 float* getUpToDateComplexData(); |
| 129 AudioFloatArray m_complexData; | 117 AudioFloatArray m_complexData; |
| 130 AudioFloatArray m_realData; | 118 AudioFloatArray m_realData; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 145 static OMXFFTSpec_R_F32* contextForSize(unsigned log2FFTSize); | 133 static OMXFFTSpec_R_F32* contextForSize(unsigned log2FFTSize); |
| 146 | 134 |
| 147 OMXFFTSpec_R_F32* m_forwardContext; | 135 OMXFFTSpec_R_F32* m_forwardContext; |
| 148 OMXFFTSpec_R_F32* m_inverseContext; | 136 OMXFFTSpec_R_F32* m_inverseContext; |
| 149 | 137 |
| 150 AudioFloatArray m_complexData; | 138 AudioFloatArray m_complexData; |
| 151 AudioFloatArray m_realData; | 139 AudioFloatArray m_realData; |
| 152 AudioFloatArray m_imagData; | 140 AudioFloatArray m_imagData; |
| 153 #endif | 141 #endif |
| 154 | 142 |
| 155 #endif // !USE_ACCELERATE_FFT | 143 #endif // !OS(MACOSX) |
| 156 }; | 144 }; |
| 157 | 145 |
| 158 } // namespace WebCore | 146 } // namespace WebCore |
| 159 | 147 |
| 160 #endif // FFTFrame_h | 148 #endif // FFTFrame_h |
| OLD | NEW |