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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 // Get the frequency-domain version of padded response | 47 // Get the frequency-domain version of padded response |
48 doFFT(paddedResponse.data()); | 48 doFFT(paddedResponse.data()); |
49 } | 49 } |
50 | 50 |
51 std::unique_ptr<FFTFrame> FFTFrame::createInterpolatedFrame( | 51 std::unique_ptr<FFTFrame> FFTFrame::createInterpolatedFrame( |
52 const FFTFrame& frame1, | 52 const FFTFrame& frame1, |
53 const FFTFrame& frame2, | 53 const FFTFrame& frame2, |
54 double x) { | 54 double x) { |
55 std::unique_ptr<FFTFrame> newFrame = | 55 std::unique_ptr<FFTFrame> newFrame = |
56 wrapUnique(new FFTFrame(frame1.fftSize())); | 56 WTF::wrapUnique(new FFTFrame(frame1.fftSize())); |
57 | 57 |
58 newFrame->interpolateFrequencyComponents(frame1, frame2, x); | 58 newFrame->interpolateFrequencyComponents(frame1, frame2, x); |
59 | 59 |
60 // In the time-domain, the 2nd half of the response must be zero, to avoid | 60 // In the time-domain, the 2nd half of the response must be zero, to avoid |
61 // circular convolution aliasing... | 61 // circular convolution aliasing... |
62 int fftSize = newFrame->fftSize(); | 62 int fftSize = newFrame->fftSize(); |
63 AudioFloatArray buffer(fftSize); | 63 AudioFloatArray buffer(fftSize); |
64 newFrame->doInverseFFT(buffer.data()); | 64 newFrame->doInverseFFT(buffer.data()); |
65 buffer.zeroRange(fftSize / 2, fftSize); | 65 buffer.zeroRange(fftSize / 2, fftSize); |
66 | 66 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 float imag0 = imagP1[0]; | 263 float imag0 = imagP1[0]; |
264 | 264 |
265 VectorMath::zvmul(realP1, imagP1, realP2, imagP2, realP1, imagP1, halfSize); | 265 VectorMath::zvmul(realP1, imagP1, realP2, imagP2, realP1, imagP1, halfSize); |
266 | 266 |
267 // Multiply the packed DC/nyquist component | 267 // Multiply the packed DC/nyquist component |
268 realP1[0] = real0 * realP2[0]; | 268 realP1[0] = real0 * realP2[0]; |
269 imagP1[0] = imag0 * imagP2[0]; | 269 imagP1[0] = imag0 * imagP2[0]; |
270 } | 270 } |
271 | 271 |
272 } // namespace blink | 272 } // namespace blink |
OLD | NEW |