Title: [104265] trunk/Source/WebCore
- Revision
- 104265
- Author
- [email protected]
- Date
- 2012-01-05 20:01:23 -0800 (Thu, 05 Jan 2012)
Log Message
Optimize with memcpy instead of copying frame by frame in Realtimeanalyser::doFFTAnalysis
https://bugs.webkit.org/show_bug.cgi?id=74693
Patch by Wei James <[email protected]> on 2012-01-05
Reviewed by Kenneth Russell.
* webaudio/RealtimeAnalyser.cpp:
(WebCore::RealtimeAnalyser::doFFTAnalysis):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (104264 => 104265)
--- trunk/Source/WebCore/ChangeLog 2012-01-06 03:20:50 UTC (rev 104264)
+++ trunk/Source/WebCore/ChangeLog 2012-01-06 04:01:23 UTC (rev 104265)
@@ -1,3 +1,13 @@
+2012-01-05 Wei James <[email protected]>
+
+ Optimize with memcpy instead of copying frame by frame in Realtimeanalyser::doFFTAnalysis
+ https://bugs.webkit.org/show_bug.cgi?id=74693
+
+ Reviewed by Kenneth Russell.
+
+ * webaudio/RealtimeAnalyser.cpp:
+ (WebCore::RealtimeAnalyser::doFFTAnalysis):
+
2012-01-05 Ryosuke Niwa <[email protected]>
REGRESSION(r104210): Dromaeo DOM test score is lower
Modified: trunk/Source/WebCore/webaudio/RealtimeAnalyser.cpp (104264 => 104265)
--- trunk/Source/WebCore/webaudio/RealtimeAnalyser.cpp 2012-01-06 03:20:50 UTC (rev 104264)
+++ trunk/Source/WebCore/webaudio/RealtimeAnalyser.cpp 2012-01-06 04:01:23 UTC (rev 104265)
@@ -157,10 +157,13 @@
float* tempP = temporaryBuffer.data();
// Take the previous fftSize values from the input buffer and copy into the temporary buffer.
- // FIXME : optimize with memcpy().
unsigned writeIndex = m_writeIndex;
- for (unsigned i = 0; i < fftSize; ++i)
- tempP[i] = inputBuffer[(i + writeIndex - fftSize + InputBufferSize) % InputBufferSize];
+ if (writeIndex < fftSize) {
+ memcpy(tempP, inputBuffer + writeIndex - fftSize + InputBufferSize, sizeof(*tempP) * (fftSize - writeIndex));
+ memcpy(tempP + fftSize - writeIndex, inputBuffer, sizeof(*tempP) * writeIndex);
+ } else
+ memcpy(tempP, inputBuffer + writeIndex - fftSize, sizeof(*tempP) * fftSize);
+
// Window the input samples.
applyWindow(tempP, fftSize);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes