OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 | 292 |
293 // Clear packed-nyquist and any DC-offset. | 293 // Clear packed-nyquist and any DC-offset. |
294 realP[0] = 0; | 294 realP[0] = 0; |
295 imagP[0] = 0; | 295 imagP[0] = 0; |
296 | 296 |
297 // Create the band-limited table. | 297 // Create the band-limited table. |
298 unsigned waveSize = periodicWaveSize(); | 298 unsigned waveSize = periodicWaveSize(); |
299 std::unique_ptr<AudioFloatArray> table = | 299 std::unique_ptr<AudioFloatArray> table = |
300 WTF::makeUnique<AudioFloatArray>(waveSize); | 300 WTF::makeUnique<AudioFloatArray>(waveSize); |
301 adjustV8ExternalMemory(waveSize * sizeof(float)); | 301 adjustV8ExternalMemory(waveSize * sizeof(float)); |
302 m_bandLimitedTables.append(std::move(table)); | 302 m_bandLimitedTables.push_back(std::move(table)); |
303 | 303 |
304 // Apply an inverse FFT to generate the time-domain table data. | 304 // Apply an inverse FFT to generate the time-domain table data. |
305 float* data = m_bandLimitedTables[rangeIndex]->data(); | 305 float* data = m_bandLimitedTables[rangeIndex]->data(); |
306 frame.doInverseFFT(data); | 306 frame.doInverseFFT(data); |
307 | 307 |
308 // For the first range (which has the highest power), calculate its peak | 308 // For the first range (which has the highest power), calculate its peak |
309 // value then compute normalization scale. | 309 // value then compute normalization scale. |
310 if (!disableNormalization) { | 310 if (!disableNormalization) { |
311 if (!rangeIndex) { | 311 if (!rangeIndex) { |
312 float maxValue; | 312 float maxValue; |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 } | 397 } |
398 | 398 |
399 realP[n] = 0; | 399 realP[n] = 0; |
400 imagP[n] = b; | 400 imagP[n] = b; |
401 } | 401 } |
402 | 402 |
403 createBandLimitedTables(realP, imagP, halfSize, false); | 403 createBandLimitedTables(realP, imagP, halfSize, false); |
404 } | 404 } |
405 | 405 |
406 } // namespace blink | 406 } // namespace blink |
OLD | NEW |