| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 // In the time-domain, the 2nd half of the response must be zero, to avoid c
ircular convolution aliasing... | 58 // In the time-domain, the 2nd half of the response must be zero, to avoid c
ircular convolution aliasing... |
| 59 int fftSize = newFrame->fftSize(); | 59 int fftSize = newFrame->fftSize(); |
| 60 AudioFloatArray buffer(fftSize); | 60 AudioFloatArray buffer(fftSize); |
| 61 newFrame->doInverseFFT(buffer.data()); | 61 newFrame->doInverseFFT(buffer.data()); |
| 62 buffer.zeroRange(fftSize / 2, fftSize); | 62 buffer.zeroRange(fftSize / 2, fftSize); |
| 63 | 63 |
| 64 // Put back into frequency domain. | 64 // Put back into frequency domain. |
| 65 newFrame->doFFT(buffer.data()); | 65 newFrame->doFFT(buffer.data()); |
| 66 | 66 |
| 67 return newFrame.release(); | 67 return newFrame; |
| 68 } | 68 } |
| 69 | 69 |
| 70 void FFTFrame::interpolateFrequencyComponents(const FFTFrame& frame1, const FFTF
rame& frame2, double interp) | 70 void FFTFrame::interpolateFrequencyComponents(const FFTFrame& frame1, const FFTF
rame& frame2, double interp) |
| 71 { | 71 { |
| 72 // FIXME : with some work, this method could be optimized | 72 // FIXME : with some work, this method could be optimized |
| 73 | 73 |
| 74 float* realP = realData(); | 74 float* realP = realData(); |
| 75 float* imagP = imagData(); | 75 float* imagP = imagData(); |
| 76 | 76 |
| 77 const float* realP1 = frame1.realData(); | 77 const float* realP1 = frame1.realData(); |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 | 260 |
| 261 VectorMath::zvmul(realP1, imagP1, realP2, imagP2, realP1, imagP1, halfSize); | 261 VectorMath::zvmul(realP1, imagP1, realP2, imagP2, realP1, imagP1, halfSize); |
| 262 | 262 |
| 263 // Multiply the packed DC/nyquist component | 263 // Multiply the packed DC/nyquist component |
| 264 realP1[0] = real0 * realP2[0]; | 264 realP1[0] = real0 * realP2[0]; |
| 265 imagP1[0] = imag0 * imagP2[0]; | 265 imagP1[0] = imag0 * imagP2[0]; |
| 266 } | 266 } |
| 267 | 267 |
| 268 } // namespace blink | 268 } // namespace blink |
| 269 | 269 |
| OLD | NEW |