Changeset 94002 in webkit
- Timestamp:
- Aug 29, 2011, 12:23:00 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/webaudio/realtimeanalyser-fft-sizing-expected.txt (added)
-
LayoutTests/webaudio/realtimeanalyser-fft-sizing.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/webaudio/RealtimeAnalyser.cpp (modified) (5 diffs)
-
Source/WebCore/webaudio/RealtimeAnalyser.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r94001 r94002 1 2011-08-29 Chris Palmer <palmer@google.com> 2 3 Fix failures when FFT array size is changed. 4 https://bugs.webkit.org/show_bug.cgi?id=66916 5 6 Reviewed by Kenneth Russell. 7 8 * webaudio/realtimeanalyser-fft-sizing-expected.txt: Added. 9 * webaudio/realtimeanalyser-fft-sizing.html: Added. 10 1 11 2011-08-29 Abhishek Arya <inferno@chromium.org> 2 12 -
trunk/Source/WebCore/ChangeLog
r94001 r94002 1 2011-08-29 Chris Palmer <palmer@google.com> 2 3 Fix failures when FFT size is changed. 4 https://bugs.webkit.org/show_bug.cgi?id=66916 5 6 Reviewed by Kenneth Russell. 7 8 Test: webaudio/fft-sizing.html 9 10 * webaudio/RealtimeAnalyser.cpp: 11 (WebCore::RealtimeAnalyser::setFftSize): Assert size sanity. 12 (WebCore::RealtimeAnalyser::doFFTAnalysis): Iterate the correct number of times over magnitudeBuffer. 13 * webaudio/RealtimeAnalyser.h: Put member fields in the correct order (Min before Max). 14 1 15 2011-08-29 Abhishek Arya <inferno@chromium.org> 2 16 -
trunk/Source/WebCore/webaudio/RealtimeAnalyser.cpp
r92408 r94002 50 50 51 51 const unsigned RealtimeAnalyser::DefaultFFTSize = 2048; 52 // All FFT implementations are expected to handle power-of-two sizes MinFFTSize <= size <= MaxFFTSize. 53 const unsigned RealtimeAnalyser::MinFFTSize = 128; 52 54 const unsigned RealtimeAnalyser::MaxFFTSize = 2048; 53 55 const unsigned RealtimeAnalyser::InputBufferSize = RealtimeAnalyser::MaxFFTSize * 2; … … 83 85 unsigned log2size = static_cast<unsigned>(log2(size)); 84 86 bool isPOT(1UL << log2size == size); 85 86 if (!isPOT || size > MaxFFTSize ) {87 88 if (!isPOT || size > MaxFFTSize || size < MinFFTSize) { 87 89 // FIXME: It would be good to also set an exception. 88 90 return; … … 90 92 91 93 if (m_fftSize != size) { 92 m_analysisFrame = adoptPtr(new FFTFrame(m_fftSize)); 93 m_magnitudeBuffer.allocate(size); 94 m_analysisFrame = adoptPtr(new FFTFrame(size)); 95 // m_magnitudeBuffer has size = fftSize / 2 because it contains floats reduced from complex values in m_analysisFrame. 96 m_magnitudeBuffer.allocate(size / 2); 94 97 m_fftSize = size; 95 98 } … … 166 169 m_analysisFrame->doFFT(tempP); 167 170 168 size_t n = DefaultFFTSize / 2;169 170 171 float* realP = m_analysisFrame->realData(); 171 172 float* imagP = m_analysisFrame->imagData(); … … 184 185 // Convert the analysis data from complex to magnitude and average with the previous result. 185 186 float* destination = magnitudeBuffer().data(); 186 for (unsigned i = 0; i < n; ++i) { 187 size_t n = magnitudeBuffer().size(); 188 for (size_t i = 0; i < n; ++i) { 187 189 Complex c(realP[i], imagP[i]); 188 190 double scalarMagnitude = abs(c) * MagnitudeScale; -
trunk/Source/WebCore/webaudio/RealtimeAnalyser.h
r87173 r94002 71 71 72 72 static const unsigned DefaultFFTSize; 73 static const unsigned MinFFTSize; 73 74 static const unsigned MaxFFTSize; 74 75 static const unsigned InputBufferSize;
Note:
See TracChangeset
for help on using the changeset viewer.