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 18 matching lines...) Expand all Loading... |
29 #include "platform/audio/FFTConvolver.h" | 29 #include "platform/audio/FFTConvolver.h" |
30 #include "platform/audio/VectorMath.h" | 30 #include "platform/audio/VectorMath.h" |
31 | 31 |
32 namespace blink { | 32 namespace blink { |
33 | 33 |
34 using namespace VectorMath; | 34 using namespace VectorMath; |
35 | 35 |
36 FFTConvolver::FFTConvolver(size_t fftSize) | 36 FFTConvolver::FFTConvolver(size_t fftSize) |
37 : m_frame(fftSize), | 37 : m_frame(fftSize), |
38 m_readWriteIndex(0), | 38 m_readWriteIndex(0), |
39 m_inputBuffer(fftSize) // 2nd half of buffer is always zeroed | 39 m_inputBuffer(fftSize), // 2nd half of buffer is always zeroed |
40 , | |
41 m_outputBuffer(fftSize), | 40 m_outputBuffer(fftSize), |
42 m_lastOverlapBuffer(fftSize / 2) {} | 41 m_lastOverlapBuffer(fftSize / 2) {} |
43 | 42 |
44 void FFTConvolver::process(FFTFrame* fftKernel, | 43 void FFTConvolver::process(FFTFrame* fftKernel, |
45 const float* sourceP, | 44 const float* sourceP, |
46 float* destP, | 45 float* destP, |
47 size_t framesToProcess) { | 46 size_t framesToProcess) { |
48 size_t halfSize = fftSize() / 2; | 47 size_t halfSize = fftSize() / 2; |
49 | 48 |
50 // framesToProcess must be an exact multiple of halfSize, | 49 // framesToProcess must be an exact multiple of halfSize, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } | 111 } |
113 } | 112 } |
114 } | 113 } |
115 | 114 |
116 void FFTConvolver::reset() { | 115 void FFTConvolver::reset() { |
117 m_lastOverlapBuffer.zero(); | 116 m_lastOverlapBuffer.zero(); |
118 m_readWriteIndex = 0; | 117 m_readWriteIndex = 0; |
119 } | 118 } |
120 | 119 |
121 } // namespace blink | 120 } // namespace blink |
OLD | NEW |