| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 for (unsigned i = truncatedResponseLength - numberOfFadeOutFrames; | 88 for (unsigned i = truncatedResponseLength - numberOfFadeOutFrames; |
| 89 i < truncatedResponseLength; ++i) { | 89 i < truncatedResponseLength; ++i) { |
| 90 float x = 1.0f - | 90 float x = 1.0f - |
| 91 static_cast<float>( | 91 static_cast<float>( |
| 92 i - (truncatedResponseLength - numberOfFadeOutFrames)) / | 92 i - (truncatedResponseLength - numberOfFadeOutFrames)) / |
| 93 numberOfFadeOutFrames; | 93 numberOfFadeOutFrames; |
| 94 impulseResponse[i] *= x; | 94 impulseResponse[i] *= x; |
| 95 } | 95 } |
| 96 } | 96 } |
| 97 | 97 |
| 98 m_fftFrame = makeUnique<FFTFrame>(fftSize); | 98 m_fftFrame = WTF::makeUnique<FFTFrame>(fftSize); |
| 99 m_fftFrame->doPaddedFFT(impulseResponse, truncatedResponseLength); | 99 m_fftFrame->doPaddedFFT(impulseResponse, truncatedResponseLength); |
| 100 } | 100 } |
| 101 | 101 |
| 102 std::unique_ptr<AudioChannel> HRTFKernel::createImpulseResponse() { | 102 std::unique_ptr<AudioChannel> HRTFKernel::createImpulseResponse() { |
| 103 std::unique_ptr<AudioChannel> channel = | 103 std::unique_ptr<AudioChannel> channel = |
| 104 wrapUnique(new AudioChannel(fftSize())); | 104 WTF::wrapUnique(new AudioChannel(fftSize())); |
| 105 FFTFrame fftFrame(*m_fftFrame); | 105 FFTFrame fftFrame(*m_fftFrame); |
| 106 | 106 |
| 107 // Add leading delay back in. | 107 // Add leading delay back in. |
| 108 fftFrame.addConstantGroupDelay(m_frameDelay); | 108 fftFrame.addConstantGroupDelay(m_frameDelay); |
| 109 fftFrame.doInverseFFT(channel->mutableData()); | 109 fftFrame.doInverseFFT(channel->mutableData()); |
| 110 | 110 |
| 111 return channel; | 111 return channel; |
| 112 } | 112 } |
| 113 | 113 |
| 114 // Interpolates two kernels with x: 0 -> 1 and returns the result. | 114 // Interpolates two kernels with x: 0 -> 1 and returns the result. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 133 (1 - x) * kernel1->frameDelay() + x * kernel2->frameDelay(); | 133 (1 - x) * kernel1->frameDelay() + x * kernel2->frameDelay(); |
| 134 | 134 |
| 135 std::unique_ptr<FFTFrame> interpolatedFrame = | 135 std::unique_ptr<FFTFrame> interpolatedFrame = |
| 136 FFTFrame::createInterpolatedFrame(*kernel1->fftFrame(), | 136 FFTFrame::createInterpolatedFrame(*kernel1->fftFrame(), |
| 137 *kernel2->fftFrame(), x); | 137 *kernel2->fftFrame(), x); |
| 138 return HRTFKernel::create(std::move(interpolatedFrame), frameDelay, | 138 return HRTFKernel::create(std::move(interpolatedFrame), frameDelay, |
| 139 sampleRate1); | 139 sampleRate1); |
| 140 } | 140 } |
| 141 | 141 |
| 142 } // namespace blink | 142 } // namespace blink |
| OLD | NEW |