Bug 231458

Summary: Vectorize EqualPowerPanner::pan()
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: Web AudioAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, crzwdjk, eric.carlson, ews-watchlist, ggaren, glenn, jer.noble, philipj, sergio, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=233529
Attachments:
Description Flags
Patch none

Description Chris Dumez 2021-10-08 15:19:20 PDT
Vectorize EqualPowerPanner::pan() for performance. This is used by PannerNode.
Comment 1 Chris Dumez 2021-10-08 15:20:23 PDT
Created attachment 440682 [details]
Patch
Comment 2 EWS 2021-10-08 17:41:34 PDT
Committed r283855 (242733@main): <https://commits.webkit.org/242733@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 440682 [details].
Comment 3 Radar WebKit Bug Importer 2021-10-08 17:42:18 PDT
<rdar://problem/84050699>
Comment 4 Arcady Goldmints-Orlov 2021-11-19 14:01:00 PST
This caused a regression in the imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-equalpower.html test on GTK and WPE, with the following diff:

--- /home/buildbot/worker/gtk-linux-64-release-tests/build/layout-test-results/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-equalpower-expected.txt
+++ /home/buildbot/worker/gtk-linux-64-release-tests/build/layout-test-results/imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-interface/panner-equalpower-actual.txt
@@ -14,7 +14,13 @@
 PASS   Mono: Left and right channels is identical to the array [expected array].
 PASS < [mono source=listener] All assertions passed. (total 1 assertions)
 PASS > [stereo source=listener] Source and listener at the same position
-PASS   Stereo: Left and right channels is identical to the array [expected array].
-PASS < [stereo source=listener] All assertions passed. (total 1 assertions)
-PASS # AUDIT TASK RUNNER FINISHED: 3 tasks ran successfully.
+FAIL X Stereo: Left and right channels expected to be equal to the array [expected array] but differs in 8017 places:
+	Index	Actual			Expected
+	[129]	-9.094678e-1	-9.937367e-1
+	[130]	-8.316806e-1	-9.996188e-1
+	[131]	-7.479767e-1	-9.983897e-1
+	[132]	-6.589519e-1	-9.900582e-1
+	...and 8013 more errors. assert_true: expected true got false
+FAIL < [stereo source=listener] 1 out of 1 assertions were failed. assert_true: expected true got false
+FAIL # AUDIT TASK RUNNER FINISHED: 1 out of 3 tasks were failed. assert_true: expected true got false
Comment 5 Chris Dumez 2021-11-19 14:32:17 PST
(In reply to Arcady Goldmints-Orlov from comment #4)
> This caused a regression in the
> imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-
> interface/panner-equalpower.html test on GTK and WPE, with the following
> diff:
> 
> ---
> /home/buildbot/worker/gtk-linux-64-release-tests/build/layout-test-results/
> imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-
> interface/panner-equalpower-expected.txt
> +++
> /home/buildbot/worker/gtk-linux-64-release-tests/build/layout-test-results/
> imported/w3c/web-platform-tests/webaudio/the-audio-api/the-pannernode-
> interface/panner-equalpower-actual.txt
> @@ -14,7 +14,13 @@
>  PASS   Mono: Left and right channels is identical to the array [expected
> array].
>  PASS < [mono source=listener] All assertions passed. (total 1 assertions)
>  PASS > [stereo source=listener] Source and listener at the same position
> -PASS   Stereo: Left and right channels is identical to the array [expected
> array].
> -PASS < [stereo source=listener] All assertions passed. (total 1 assertions)
> -PASS # AUDIT TASK RUNNER FINISHED: 3 tasks ran successfully.
> +FAIL X Stereo: Left and right channels expected to be equal to the array
> [expected array] but differs in 8017 places:
> +	Index	Actual			Expected
> +	[129]	-9.094678e-1	-9.937367e-1
> +	[130]	-8.316806e-1	-9.996188e-1
> +	[131]	-7.479767e-1	-9.983897e-1
> +	[132]	-6.589519e-1	-9.900582e-1
> +	...and 8013 more errors. assert_true: expected true got false
> +FAIL < [stereo source=listener] 1 out of 1 assertions were failed.
> assert_true: expected true got false
> +FAIL # AUDIT TASK RUNNER FINISHED: 1 out of 3 tasks were failed.
> assert_true: expected true got false

My bet is that the implementation of VectorMath::multiplyByScalarThenAddToVector() or VectorMath::multiplyByScalar() used by Glib ports is wrong somehow. The Apple ports are using a different implementation for these.