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 30 matching lines...) Expand all Loading... |
41 m_outputBuffer(fftSize), | 41 m_outputBuffer(fftSize), |
42 m_lastOverlapBuffer(fftSize / 2) {} | 42 m_lastOverlapBuffer(fftSize / 2) {} |
43 | 43 |
44 void FFTConvolver::process(FFTFrame* fftKernel, | 44 void FFTConvolver::process(FFTFrame* fftKernel, |
45 const float* sourceP, | 45 const float* sourceP, |
46 float* destP, | 46 float* destP, |
47 size_t framesToProcess) { | 47 size_t framesToProcess) { |
48 size_t halfSize = fftSize() / 2; | 48 size_t halfSize = fftSize() / 2; |
49 | 49 |
50 // framesToProcess must be an exact multiple of halfSize, | 50 // framesToProcess must be an exact multiple of halfSize, |
51 // or halfSize is a multiple of framesToProcess when halfSize > framesToProces
s. | 51 // or halfSize is a multiple of framesToProcess when halfSize > |
| 52 // framesToProcess. |
52 bool isGood = !(halfSize % framesToProcess && framesToProcess % halfSize); | 53 bool isGood = !(halfSize % framesToProcess && framesToProcess % halfSize); |
53 ASSERT(isGood); | 54 ASSERT(isGood); |
54 if (!isGood) | 55 if (!isGood) |
55 return; | 56 return; |
56 | 57 |
57 size_t numberOfDivisions = | 58 size_t numberOfDivisions = |
58 halfSize <= framesToProcess ? (framesToProcess / halfSize) : 1; | 59 halfSize <= framesToProcess ? (framesToProcess / halfSize) : 1; |
59 size_t divisionSize = numberOfDivisions == 1 ? framesToProcess : halfSize; | 60 size_t divisionSize = numberOfDivisions == 1 ? framesToProcess : halfSize; |
60 | 61 |
61 for (size_t i = 0; i < numberOfDivisions; | 62 for (size_t i = 0; i < numberOfDivisions; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 112 } |
112 } | 113 } |
113 } | 114 } |
114 | 115 |
115 void FFTConvolver::reset() { | 116 void FFTConvolver::reset() { |
116 m_lastOverlapBuffer.zero(); | 117 m_lastOverlapBuffer.zero(); |
117 m_readWriteIndex = 0; | 118 m_readWriteIndex = 0; |
118 } | 119 } |
119 | 120 |
120 } // namespace blink | 121 } // namespace blink |
OLD | NEW |