Changeset 70742 in webkit
- Timestamp:
- Oct 27, 2010 8:21:56 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r70741 r70742 1 2010-10-27 Chris Rogers <crogers@google.com> 2 3 Reviewed by Kenneth Russell. 4 5 Fixup files affected by VectorMath and related API changes 6 https://bugs.webkit.org/show_bug.cgi?id=48481 7 8 No new tests since audio API is not yet implemented. 9 10 * platform/audio/AudioBus.cpp: 11 * platform/audio/AudioChannel.cpp: 12 * platform/audio/Biquad.cpp: 13 * platform/audio/FFTConvolver.cpp: 14 * platform/audio/FFTConvolver.h: 15 * platform/audio/Panner.cpp: 16 (WebCore::Panner::create): 17 * platform/audio/Reverb.cpp: 18 (WebCore::calculateNormalizationScale): 19 (WebCore::Reverb::initialize): 20 (WebCore::Reverb::process): 21 * platform/audio/ReverbAccumulationBuffer.cpp: 22 * platform/audio/ReverbAccumulationBuffer.h: 23 * platform/audio/ReverbConvolver.cpp: 24 (WebCore::ReverbConvolver::ReverbConvolver): 25 (WebCore::ReverbConvolver::process): 26 * platform/audio/ReverbConvolver.h: 27 * platform/audio/ReverbConvolverStage.cpp: 28 (WebCore::ReverbConvolverStage::ReverbConvolverStage): 29 * platform/audio/ReverbConvolverStage.h: 30 * platform/audio/ReverbInputBuffer.h: 31 1 32 2010-10-27 Kinuko Yasuda <kinuko@chromium.org> 2 33 -
trunk/WebCore/platform/audio/AudioBus.cpp
r66755 r70742 33 33 #include "AudioBus.h" 34 34 35 #include " Accelerate.h"35 #include "VectorMath.h" 36 36 #include <algorithm> 37 37 #include <assert.h> … … 42 42 namespace WebCore { 43 43 44 using namespace VectorMath; 45 44 46 AudioBus::AudioBus(unsigned numberOfChannels, size_t length, bool allocate) 45 47 : m_length(length) -
trunk/WebCore/platform/audio/AudioChannel.cpp
r66758 r70742 33 33 #include "AudioChannel.h" 34 34 35 #include " Accelerate.h"35 #include "VectorMath.h" 36 36 #include <algorithm> 37 37 #include <math.h> … … 39 39 40 40 namespace WebCore { 41 42 using namespace VectorMath; 41 43 42 44 void AudioChannel::scale(double scale) -
trunk/WebCore/platform/audio/Biquad.cpp
r67132 r70742 33 33 #include "Biquad.h" 34 34 35 #include "Accelerate.h"36 35 #include <algorithm> 37 36 #include <float.h> 38 37 #include <math.h> 39 38 #include <stdio.h> 39 40 #if OS(DARWIN) 41 #include <Accelerate/Accelerate.h> 42 #endif 40 43 41 44 namespace WebCore { -
trunk/WebCore/platform/audio/FFTConvolver.cpp
r66529 r70742 33 33 #include "FFTConvolver.h" 34 34 35 #include " Accelerate.h"35 #include "VectorMath.h" 36 36 37 37 namespace WebCore { 38 38 39 using namespace VectorMath; 40 39 41 FFTConvolver::FFTConvolver(size_t fftSize) 40 42 : m_frame(fftSize) -
trunk/WebCore/platform/audio/FFTConvolver.h
r66529 r70742 30 30 #define FFTConvolver_h 31 31 32 #include "Audio FloatArray.h"32 #include "AudioArray.h" 33 33 #include "FFTFrame.h" 34 34 -
trunk/WebCore/platform/audio/Panner.cpp
r66753 r70742 46 46 switch (model) { 47 47 case PanningModelEqualPower: 48 panner = adoptPtr(new EqualPowerPanner( ));48 panner = adoptPtr(new EqualPowerPanner(sampleRate)); 49 49 break; 50 50 -
trunk/WebCore/platform/audio/Reverb.cpp
r66413 r70742 57 57 // Normalize by RMS power 58 58 size_t numberOfChannels = response->numberOfChannels(); 59 size_t frameSize = response->frameSize();59 size_t length = response->length(); 60 60 61 61 double power = 0.0; 62 62 63 63 for (size_t i = 0; i < numberOfChannels; ++i) { 64 int n = frameSize;64 int n = length; 65 65 float* p = response->channel(i)->data(); 66 66 … … 71 71 } 72 72 73 power = sqrt(power / (numberOfChannels * frameSize));73 power = sqrt(power / (numberOfChannels * length)); 74 74 75 75 // Protect against accidental overload … … 103 103 void Reverb::initialize(AudioBus* impulseResponseBuffer, size_t renderSliceSize, size_t maxFFTSize, size_t numberOfChannels, bool useBackgroundThreads) 104 104 { 105 m_impulseResponseLength = impulseResponseBuffer-> frameSize();105 m_impulseResponseLength = impulseResponseBuffer->length(); 106 106 107 107 // The reverb can handle a mono impulse response and still do stereo processing … … 113 113 AudioChannel* channel = impulseResponseBuffer->channel(i); 114 114 115 ReverbConvolver* convolver = new ReverbConvolver(channel, renderSliceSize, maxFFTSize, convolverRenderPhase, useBackgroundThreads);116 m_convolvers.append(convolver );115 OwnPtr<ReverbConvolver> convolver = adoptPtr(new ReverbConvolver(channel, renderSliceSize, maxFFTSize, convolverRenderPhase, useBackgroundThreads)); 116 m_convolvers.append(convolver.release()); 117 117 118 118 convolverRenderPhase += renderSliceSize; … … 130 130 // If these conditions are satisfied, all of the source and destination pointers will be valid for the various matrixing cases. 131 131 bool isSafeToProcess = sourceBus && destinationBus && sourceBus->numberOfChannels() > 0 && destinationBus->numberOfChannels() > 0 132 && framesToProcess <= MaxFrameSize && framesToProcess <= sourceBus-> frameSize() && framesToProcess <= destinationBus->frameSize();132 && framesToProcess <= MaxFrameSize && framesToProcess <= sourceBus->length() && framesToProcess <= destinationBus->length(); 133 133 134 134 ASSERT(isSafeToProcess); … … 168 168 // simply copy L -> R 169 169 AudioChannel* destinationChannelR = destinationBus->channel(1); 170 bool isCopySafe = destinationChannelL->data() && destinationChannelR->data() && destinationChannelL-> frameSize() >= framesToProcess && destinationChannelR->frameSize() >= framesToProcess;170 bool isCopySafe = destinationChannelL->data() && destinationChannelR->data() && destinationChannelL->length() >= framesToProcess && destinationChannelR->length() >= framesToProcess; 171 171 ASSERT(isCopySafe); 172 172 if (!isCopySafe) -
trunk/WebCore/platform/audio/ReverbAccumulationBuffer.cpp
r66419 r70742 33 33 #include "ReverbAccumulationBuffer.h" 34 34 35 #include " Accelerate.h"35 #include "VectorMath.h" 36 36 37 37 namespace WebCore { 38 39 using namespace VectorMath; 38 40 39 41 ReverbAccumulationBuffer::ReverbAccumulationBuffer(size_t length) -
trunk/WebCore/platform/audio/ReverbAccumulationBuffer.h
r66419 r70742 30 30 #define ReverbAccumulationBuffer_h 31 31 32 #include "Audio FloatArray.h"32 #include "AudioArray.h" 33 33 34 34 namespace WebCore { -
trunk/WebCore/platform/audio/ReverbConvolver.cpp
r66419 r70742 33 33 #include "ReverbConvolver.h" 34 34 35 #include " Accelerate.h"35 #include "VectorMath.h" 36 36 #include "AudioBus.h" 37 37 38 38 namespace WebCore { 39 40 using namespace VectorMath; 39 41 40 42 const int InputBufferSize = 8 * 16384; … … 60 62 61 63 ReverbConvolver::ReverbConvolver(AudioChannel* impulseResponse, size_t renderSliceSize, size_t maxFFTSize, size_t convolverRenderPhase, bool useBackgroundThreads) 62 : m_impulseResponseLength(impulseResponse-> frameSize())63 , m_accumulationBuffer(impulseResponse-> frameSize() + renderSliceSize)64 : m_impulseResponseLength(impulseResponse->length()) 65 , m_accumulationBuffer(impulseResponse->length() + renderSliceSize) 64 66 , m_inputBuffer(InputBufferSize) 65 67 , m_renderSliceSize(renderSliceSize) … … 82 84 83 85 float* response = impulseResponse->data(); 84 size_t totalResponseLength = impulseResponse-> frameSize();86 size_t totalResponseLength = impulseResponse->length(); 85 87 86 88 // Because we're not using direct-convolution in the leading portion, the reverb has an overall latency of half the first-stage FFT size … … 176 178 void ReverbConvolver::process(AudioChannel* sourceChannel, AudioChannel* destinationChannel, size_t framesToProcess) 177 179 { 178 bool isSafe = sourceChannel && destinationChannel && sourceChannel-> frameSize() >= framesToProcess && destinationChannel->frameSize() >= framesToProcess;180 bool isSafe = sourceChannel && destinationChannel && sourceChannel->length() >= framesToProcess && destinationChannel->length() >= framesToProcess; 179 181 ASSERT(isSafe); 180 182 if (!isSafe) -
trunk/WebCore/platform/audio/ReverbConvolver.h
r66419 r70742 30 30 #define ReverbConvolver_h 31 31 32 #include "Audio FloatArray.h"32 #include "AudioArray.h" 33 33 #include "FFTConvolver.h" 34 34 #include "ReverbAccumulationBuffer.h" -
trunk/WebCore/platform/audio/ReverbConvolverStage.cpp
r66419 r70742 33 33 #include "ReverbConvolverStage.h" 34 34 35 #include " Accelerate.h"35 #include "VectorMath.h" 36 36 #include "ReverbAccumulationBuffer.h" 37 37 #include "ReverbConvolver.h" … … 41 41 42 42 namespace WebCore { 43 44 using namespace VectorMath; 43 45 44 46 ReverbConvolverStage::ReverbConvolverStage(float* impulseResponse, size_t responseLength, size_t reverbTotalLatency, size_t stageOffset, size_t stageLength, … … 54 56 55 57 m_fftKernel.doPaddedFFT(impulseResponse + stageOffset, stageLength); 56 m_convolver = new FFTConvolver(fftSize);57 m_temporaryBuffer. allocate(renderSliceSize);58 m_convolver = adoptPtr(new FFTConvolver(fftSize)); 59 m_temporaryBuffer.resize(renderSliceSize); 58 60 59 61 // The convolution stage at offset stageOffset needs to have a corresponding delay to cancel out the offset. … … 77 79 m_framesProcessed = 0; // total frames processed so far 78 80 79 m_preDelayBuffer. allocate(m_preDelayLength < fftSize ? fftSize : m_preDelayLength);81 m_preDelayBuffer.resize(m_preDelayLength < fftSize ? fftSize : m_preDelayLength); 80 82 } 81 83 -
trunk/WebCore/platform/audio/ReverbConvolverStage.h
r66419 r70742 30 30 #define ReverbConvolverStage_h 31 31 32 #include "Audio FloatArray.h"32 #include "AudioArray.h" 33 33 #include "FFTFrame.h" 34 34 #include <wtf/OwnPtr.h> -
trunk/WebCore/platform/audio/ReverbInputBuffer.h
r66419 r70742 30 30 #define ReverbInputBuffer_h 31 31 32 #include "Audio FloatArray.h"32 #include "AudioArray.h" 33 33 34 34 namespace WebCore {
Note: See TracChangeset
for help on using the changeset viewer.