Title: [283855] trunk/Source/WebCore
- Revision
- 283855
- Author
- cdu...@apple.com
- Date
- 2021-10-08 17:41:24 -0700 (Fri, 08 Oct 2021)
Log Message
Vectorize EqualPowerPanner::pan()
https://bugs.webkit.org/show_bug.cgi?id=231458
Reviewed by Eric Carlson.
Vectorize EqualPowerPanner::pan() for performance. This is used by PannerNode.
* platform/audio/EqualPowerPanner.cpp:
(WebCore::EqualPowerPanner::pan):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (283854 => 283855)
--- trunk/Source/WebCore/ChangeLog 2021-10-09 00:14:06 UTC (rev 283854)
+++ trunk/Source/WebCore/ChangeLog 2021-10-09 00:41:24 UTC (rev 283855)
@@ -1,3 +1,15 @@
+2021-10-08 Chris Dumez <cdu...@apple.com>
+
+ Vectorize EqualPowerPanner::pan()
+ https://bugs.webkit.org/show_bug.cgi?id=231458
+
+ Reviewed by Eric Carlson.
+
+ Vectorize EqualPowerPanner::pan() for performance. This is used by PannerNode.
+
+ * platform/audio/EqualPowerPanner.cpp:
+ (WebCore::EqualPowerPanner::pan):
+
2021-10-08 Jer Noble <jer.no...@apple.com>
[Build-time perf] Forward-declare more things in Element.h
Modified: trunk/Source/WebCore/platform/audio/EqualPowerPanner.cpp (283854 => 283855)
--- trunk/Source/WebCore/platform/audio/EqualPowerPanner.cpp 2021-10-09 00:14:06 UTC (rev 283854)
+++ trunk/Source/WebCore/platform/audio/EqualPowerPanner.cpp 2021-10-09 00:41:24 UTC (rev 283855)
@@ -30,6 +30,7 @@
#include "AudioBus.h"
#include "AudioUtilities.h"
+#include "VectorMath.h"
#include <algorithm>
#include <wtf/MathExtras.h>
@@ -126,33 +127,18 @@
}
}
- double desiredGainL = cos(piOverTwoDouble * desiredPanPosition);
- double desiredGainR = sin(piOverTwoDouble * desiredPanPosition);
-
- int n = framesToProcess;
-
- // FIXME: We should vectorize this.
+ double desiredGainL = std::cos(piOverTwoDouble * desiredPanPosition);
+ double desiredGainR = std::sin(piOverTwoDouble * desiredPanPosition);
if (numberOfInputChannels == 1) { // For mono source case.
- while (n--) {
- float inputL = *sourceL++;
- *destinationL++ = static_cast<float>(inputL * desiredGainL);
- *destinationR++ = static_cast<float>(inputL * desiredGainR);
- }
+ VectorMath::multiplyByScalar(sourceL, desiredGainL, destinationL, framesToProcess);
+ VectorMath::multiplyByScalar(sourceL, desiredGainR, destinationR, framesToProcess);
} else { // For stereo source case.
if (azimuth <= 0) { // from -90 -> 0
- while (n--) {
- float inputL = *sourceL++;
- float inputR = *sourceR++;
- *destinationL++ = static_cast<float>(inputL + inputR * desiredGainL);
- *destinationR++ = static_cast<float>(inputR * desiredGainR);
- }
+ VectorMath::multiplyByScalarThenAddToVector(sourceR, desiredGainL, sourceL, destinationL, framesToProcess);
+ VectorMath::multiplyByScalar(sourceR, desiredGainR, destinationR, framesToProcess);
} else { // from 0 -> +90
- while (n--) {
- float inputL = *sourceL++;
- float inputR = *sourceR++;
- *destinationL++ = static_cast<float>(inputL * desiredGainL);
- *destinationR++ = static_cast<float>(inputR + inputL * desiredGainR);
- }
+ VectorMath::multiplyByScalar(sourceL, desiredGainL, destinationL, framesToProcess);
+ VectorMath::multiplyByScalarThenAddToVector(sourceL, desiredGainR, sourceR, destinationR, framesToProcess);
}
}
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes