Title: [267383] trunk
Revision
267383
Author
[email protected]
Date
2020-09-21 16:27:50 -0700 (Mon, 21 Sep 2020)

Log Message

Values returned by FFTFrame::doFFT() are twice as large as they should be
https://bugs.webkit.org/show_bug.cgi?id=216781

Reviewed by Darin Adler.

Source/WebCore:

To provide the best possible execution speeds, the vDSP library's functions don't always adhere strictly
to textbook formulas for Fourier transforms, and must be scaled accordingly [1].

In the case of a Real forward Transform like in FFTFrame::doFFT(): RFimp = RFmath * 2 so we need to
divide the output by 2 to get the correct value. We were failing to do this scaling and this was causing
AnalyserNode tests to fail.

[1] See https://developer.apple.com/library/archive/documentation/Performance/Conceptual/vDSP_Programming_Guide/UsingFourierTransforms/UsingFourierTransforms.html#//apple_ref/doc/uid/TP40005147-CH3-SW5

No new tests, rebaselined existing tests.

* Modules/webaudio/PeriodicWave.cpp:
(WebCore::PeriodicWave::createBandLimitedTables):
Update normalization factor now that FFTFrame::doInverseFFT() has been fixed. The new normalization factor
matches the value used by blink at:
- https://github.com/chromium/chromium/blob/master/third_party/blink/renderer/modules/webaudio/periodic_wave.cc

* platform/audio/FFTFrame.cpp:
(WebCore::FFTFrame::multiply):
We were applying a 0.5 scaling factor to the output of vDSP_zvmul(). However, the documentation for vDSP_zvmul()
does not indicate that its output is twice as large as expected. Odds are that this was done because we used
to have a bug in FFTFrame::doFFT() that was returning values twice as large as expected. SInce this function
relies on VectorMath, there is no need for its implementation to be platform-specific.

* platform/audio/FFTFrameStub.cpp:
* platform/audio/gstreamer/FFTFrameGStreamer.cpp:
(WebCore::FFTFrame::doFFT):
(WebCore::FFTFrame::doInverseFFT):
Drop 2 factor in the GStreamer implementation that was added to try and be consistent with the incorrect Mac
implementation.

* platform/audio/mac/FFTFrameMac.cpp:
(WebCore::FFTFrame::doFFT):
Fix issue where the values returned by doFFT() were twice as large as expected due to the odd behavior of
vDSP_fft_zrip().

(WebCore::FFTFrame::doInverseFFT):
Drop 2 factor in doInverseFFT that was added because the output of doFFT() was twice as large as expected
and we wanted x == InverseFFT(FFT(x)).

LayoutTests:

* webaudio/Analyser/realtimeanalyser-downmix-expected.txt:
* webaudio/Analyser/realtimeanalyser-freq-data-expected.txt:
* webaudio/Analyser/realtimeanalyser-freq-data-smoothing-expected.txt:
* webaudio/Analyser/realtimeanalyser-multiple-calls-expected.txt:
Rebaseline tests that are passing now that the bug has been fixed.

* webaudio/realtimeanalyser-fft-scaling-expected.txt: Removed.
* webaudio/realtimeanalyser-fft-scaling.html: Removed.
Drop outdated test. This test was imported into WPT and now resides at:
- imported/w3c/web-platform-tests/webaudio/the-audio-api/the-analysernode-interface/realtimeanalyser-fft-scaling.html

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (267382 => 267383)


--- trunk/LayoutTests/ChangeLog	2020-09-21 23:25:25 UTC (rev 267382)
+++ trunk/LayoutTests/ChangeLog	2020-09-21 23:27:50 UTC (rev 267383)
@@ -1,5 +1,23 @@
 2020-09-21  Chris Dumez  <[email protected]>
 
+        Values returned by FFTFrame::doFFT() are twice as large as they should be
+        https://bugs.webkit.org/show_bug.cgi?id=216781
+
+        Reviewed by Darin Adler.
+
+        * webaudio/Analyser/realtimeanalyser-downmix-expected.txt:
+        * webaudio/Analyser/realtimeanalyser-freq-data-expected.txt:
+        * webaudio/Analyser/realtimeanalyser-freq-data-smoothing-expected.txt:
+        * webaudio/Analyser/realtimeanalyser-multiple-calls-expected.txt:
+        Rebaseline tests that are passing now that the bug has been fixed.
+
+        * webaudio/realtimeanalyser-fft-scaling-expected.txt: Removed.
+        * webaudio/realtimeanalyser-fft-scaling.html: Removed.
+        Drop outdated test. This test was imported into WPT and now resides at:
+        - imported/w3c/web-platform-tests/webaudio/the-audio-api/the-analysernode-interface/realtimeanalyser-fft-scaling.html
+
+2020-09-21  Chris Dumez  <[email protected]>
+
         Properly handle AudioParam.setTargetAtTime() followed by a ramp
         https://bugs.webkit.org/show_bug.cgi?id=216804
 

Modified: trunk/LayoutTests/TestExpectations (267382 => 267383)


--- trunk/LayoutTests/TestExpectations	2020-09-21 23:25:25 UTC (rev 267382)
+++ trunk/LayoutTests/TestExpectations	2020-09-21 23:27:50 UTC (rev 267383)
@@ -330,10 +330,6 @@
 imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/buffer-resampling.html [ Pass Failure ]
 imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sub-sample-buffer-stitching.html [ Pass Failure ]
 webaudio/Analyser/handle-silent-inputs.html [ Pass Failure ]
-webaudio/Analyser/realtimeanalyser-fftsize-reset.html [ Pass Failure ]
-webaudio/Analyser/realtimeanalyser-freq-data-smoothing.html [ Pass Failure ]
-webaudio/Analyser/realtimeanalyser-freq-data.html [ Pass Failure ]
-webaudio/Analyser/realtimeanalyser-multiple-calls.html [ Pass Failure ]
 webaudio/AudioBufferSource/audiobuffersource-detune-modulation.html [ Pass Failure ]
 webaudio/AudioBufferSource/audiobuffersource-playbackrate-modulation.html [ Pass Failure ]
 

Modified: trunk/LayoutTests/platform/mac/TestExpectations (267382 => 267383)


--- trunk/LayoutTests/platform/mac/TestExpectations	2020-09-21 23:25:25 UTC (rev 267382)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2020-09-21 23:27:50 UTC (rev 267383)
@@ -1616,7 +1616,6 @@
 
 # <rdar://problem/47088939>
 imported/w3c/web-platform-tests/webaudio/the-audio-api/the-mediaelementaudiosourcenode-interface/mediaElementAudioSourceToScriptProcessorTest.html  [ Failure ]
-webaudio/realtimeanalyser-fft-scaling.html [ Pass Failure ]
 webaudio/oscillator-sine.html [ Skip ]
 
 webkit.org/b/199013 [ Debug ] imported/w3c/web-platform-tests/websockets/Create-Secure-verify-url-set-non-default-port.any.html [ Pass Failure ]

Modified: trunk/LayoutTests/webaudio/Analyser/realtimeanalyser-downmix-expected.txt (267382 => 267383)


--- trunk/LayoutTests/webaudio/Analyser/realtimeanalyser-downmix-expected.txt	2020-09-21 23:25:25 UTC (rev 267382)
+++ trunk/LayoutTests/webaudio/Analyser/realtimeanalyser-downmix-expected.txt	2020-09-21 23:27:50 UTC (rev 267383)
@@ -8,58 +8,23 @@
 PASS Audit report 
 PASS > [mono]  
 PASS   Analyser downmix mono to mono time data is identical to the array [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1...]. 
-FAIL X Analyser downmix mono to mono freq data does not equal [-7.535013675689697,-12.041200637817383,-27.95880126953125,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":6.3283e-8}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[0]	-1.5144139528274536e+0	-7.5350136756896973e+0	6.0205997228622437e+0	7.9901642943085494e-1	4.7683827043867111e-7
-	[1]	-6.0206003189086914e+0	-1.2041200637817383e+1	6.0206003189086914e+0	5.0000000000000000e-1	7.6200329996299745e-7
-	[2]	-2.1938199996948242e+1	-2.7958801269531250e+1	6.0206012725830078e+0	2.1533831921270877e-1	1.7693168207397460e-6
-	Max AbsError of 6.0206012725830078e+0 at index of 2.
-	Max RelError of 7.9901642943085494e-1 at index of 0.
- assert_true: expected true got false
-FAIL < [mono] 1 out of 2 assertions were failed. assert_true: expected true got false
+PASS   Analyser downmix mono to mono freq data equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":6.3283e-8}. 
+PASS < [mono] All assertions passed. (total 2 assertions) 
 PASS > [stereo]  
 PASS   Analyser downmix stereo to mono time data is identical to the array [2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5,2.5...]. 
-FAIL X Analyser downmix stereo to mono freq data does not equal [0.42378559708595276,-4.082399845123291,-20,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":1.1681e-7}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[0]	6.4443855285644531e+0	4.2378559708595276e-1	6.0205999314785004e+0	1.4206712009274337e+1	4.9502395595610142e-8
-	[1]	1.9382002353668213e+0	-4.0823998451232910e+0	6.0206000804901123e+0	1.4747698189539507e+0	4.7686512590885159e-7
-	[2]	-1.3979400634765625e+1	-2.0000000000000000e+1	6.0205993652343750e+0	3.0102996826171874e-1	2.3361999999999998e-6
-	Max AbsError of 6.0206000804901123e+0 at index of 1.
-	Max RelError of 1.4206712009274337e+1 at index of 0.
- assert_true: expected true got false
-FAIL < [stereo] 1 out of 2 assertions were failed. assert_true: expected true got false
+PASS   Analyser downmix stereo to mono freq data equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":1.1681e-7}. 
+PASS < [stereo] All assertions passed. (total 2 assertions) 
 PASS > [quad]  
 PASS   Analyser downmix quad to mono time data is identical to the array [7.5,7.5,7.5,7.5,7.5,7.5,7.5,7.5,7.5,7.5,7.5,7.5,7.5,7.5,7.5,7.5...]. 
-FAIL X Analyser downmix quad to mono freq data does not equal [9.966211318969727,5.460024833679199,-10.457574844360352,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":4.9793e-7}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[0]	1.5986810684204102e+1	9.9662113189697266e+0	6.0205993652343750e+0	6.0410111451025950e-1	4.9624756020545961e-6
-	[1]	1.1480626106262207e+1	5.4600248336791992e+0	6.0206012725830078e+0	1.1026692104852696e+0	2.7187101654338836e-6
-	[2]	-4.4369745254516602e+0	-1.0457574844360352e+1	6.0206003189086914e+0	5.7571668465328085e-1	5.2071402422523503e-6
-	Max AbsError of 6.0206012725830078e+0 at index of 1.
-	Max RelError of 1.1026692104852696e+0 at index of 1.
- assert_true: expected true got false
-FAIL < [quad] 1 out of 2 assertions were failed. assert_true: expected true got false
+PASS   Analyser downmix quad to mono freq data equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":4.9793e-7}. 
+PASS < [quad] All assertions passed. (total 2 assertions) 
 PASS > [5.1]  
 PASS   Analyser downmix 5.1 to mono time data is identical to the array [expected array]. 
-FAIL X Analyser downmix 5.1 to mono freq data does not equal [25.141529083251953,20.635343551635742,4.717743873596191,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":2.0215e-7}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[0]	3.1162130355834961e+1	2.5141529083251953e+1	6.0206012725830078e+0	2.3946838128447945e-1	5.0823601041793820e-6
-	[1]	2.6655942916870117e+1	2.0635343551635742e+1	6.0205993652343750e+0	2.9176152799051064e-1	4.1714346989631653e-6
-	[2]	1.0738344192504883e+1	4.7177438735961914e+0	6.0206003189086914e+0	1.2761609108549110e+0	9.5369192404747006e-7
-	Max AbsError of 6.0206012725830078e+0 at index of 0.
-	Max RelError of 1.2761609108549110e+0 at index of 2.
- assert_true: expected true got false
-FAIL < [5.1] 1 out of 2 assertions were failed. assert_true: expected true got false
+PASS   Analyser downmix 5.1 to mono freq data equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":2.0215e-7}. 
+PASS < [5.1] All assertions passed. (total 2 assertions) 
 PASS > [3-channel]  
 PASS   Analyser downmix 3-channel to mono time data is identical to the array [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1...]. 
-FAIL X Analyser downmix 3-channel to mono freq data does not equal [-7.535013675689697,-12.041200637817383,-27.95880126953125,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":6.3283e-8}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[0]	-1.5144139528274536e+0	-7.5350136756896973e+0	6.0205997228622437e+0	7.9901642943085494e-1	4.7683827043867111e-7
-	[1]	-6.0206003189086914e+0	-1.2041200637817383e+1	6.0206003189086914e+0	5.0000000000000000e-1	7.6200329996299745e-7
-	[2]	-2.1938199996948242e+1	-2.7958801269531250e+1	6.0206012725830078e+0	2.1533831921270877e-1	1.7693168207397460e-6
-	Max AbsError of 6.0206012725830078e+0 at index of 2.
-	Max RelError of 7.9901642943085494e-1 at index of 0.
- assert_true: expected true got false
-FAIL < [3-channel] 1 out of 2 assertions were failed. assert_true: expected true got false
-FAIL # AUDIT TASK RUNNER FINISHED: 5 out of 5 tasks were failed. assert_true: expected true got false
+PASS   Analyser downmix 3-channel to mono freq data equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":6.3283e-8}. 
+PASS < [3-channel] All assertions passed. (total 2 assertions) 
+PASS # AUDIT TASK RUNNER FINISHED: 5 tasks ran successfully. 
 

Modified: trunk/LayoutTests/webaudio/Analyser/realtimeanalyser-freq-data-expected.txt (267382 => 267383)


--- trunk/LayoutTests/webaudio/Analyser/realtimeanalyser-freq-data-expected.txt	2020-09-21 23:25:25 UTC (rev 267382)
+++ trunk/LayoutTests/webaudio/Analyser/realtimeanalyser-freq-data-expected.txt	2020-09-21 23:27:50 UTC (rev 267383)
@@ -14,326 +14,73 @@
 PASS Executing "no smoothing" 
 PASS Audit report 
 PASS > [5-order FFT]  
-FAIL X 32-point float FFT does not equal [-37.96723556518555,-14.826388359069824,-15.560236930847168,-19.88346290588379,-22.886396408081055,-25.07866668701172,-26.716655731201172,-28.146732330322266,-29.317476272583008,-30.41255760192871,-31.700773239135742,-33.73856735229492,-36.00569534301758,-38.472503662109375,-43.73529815673828,-55.31476593017578...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":9.6549e-7}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[0]	-3.1946636199951172e+1	-3.7967235565185547e+1	6.0205993652343750e+0	1.5857355100024786e-1	3.6656986265830997e-5
-	[1]	-8.8057880401611328e+0	-1.4826388359069824e+1	6.0206003189086914e+0	4.0607329128982905e-1	1.4314729696798325e-5
-	[2]	-9.5396375656127930e+0	-1.5560236930847168e+1	6.0205993652343750e+0	3.8692208813986145e-1	1.5023253154363634e-5
-	[3]	-1.3862863540649414e+1	-1.9883462905883789e+1	6.0205993652343750e+0	3.0279430669256296e-1	1.9197284601001741e-5
-	[4]	-1.6865795135498047e+1	-2.2886396408081055e+1	6.0206012725830078e+0	2.6306462429608046e-1	2.2096586868038178e-5
-	...and 11 more errors.
-	Max AbsError of 6.0206184387207031e+0 at index of 15.
-	[15]	-4.9294147491455078e+1	-5.5314765930175781e+1	6.0206184387207031e+0	1.0884288015103548e-1	5.3405853357925415e-5
-	Max RelError of 4.0607329128982905e-1 at index of 1.
- assert_true: expected true got false
+PASS   32-point float FFT equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":9.6549e-7}. 
 PASS   Order: 5: Min FFT value is less than or equal to -50. 
 PASS   Order: 5: Max FFT value is greater than or equal to -30. 
-FAIL X 32-point byte FFT does not equal [153,255,255,255,255,255,255,255,255,249,233,207,178,146,79,0...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[0]	2.3000000000000000e+2	1.5300000000000000e+2	7.7000000000000000e+1	5.0326797385620914e-1	0.0000000000000000e+0
-	[9]	2.5500000000000000e+2	2.4900000000000000e+2	6.0000000000000000e+0	2.4096385542168676e-2	0.0000000000000000e+0
-	[10]	2.5500000000000000e+2	2.3300000000000000e+2	2.2000000000000000e+1	9.4420600858369105e-2	0.0000000000000000e+0
-	[11]	2.5500000000000000e+2	2.0700000000000000e+2	4.8000000000000000e+1	2.3188405797101450e-1	0.0000000000000000e+0
-	[12]	2.5500000000000000e+2	1.7800000000000000e+2	7.7000000000000000e+1	4.3258426966292135e-1	0.0000000000000000e+0
-	...and 3 more errors.
-	Max AbsError of 7.7000000000000000e+1 at index of 0.
-	Max RelError of Infinity at index of 15.
-	[15]	8.0000000000000000e+0	0.0000000000000000e+0	8.0000000000000000e+0	Infinity	0.0000000000000000e+0
- assert_true: expected true got false
-FAIL < [5-order FFT] 2 out of 4 assertions were failed. assert_true: expected true got false
+PASS   32-point byte FFT equals [153,255,255,255,255,255,255,255,255,249,233,207,178,146,79,0...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}. 
+PASS < [5-order FFT] All assertions passed. (total 4 assertions) 
 PASS > [6-order FFT]  
-FAIL X 64-point float FFT does not equal [-15.905972480773926,-17.154661178588867,-23.011545181274414,-30.028526306152344,-32.364620208740234,-34.327484130859375,-35.92346954345703,-37.251136779785156,-38.412498474121094,-39.45051956176758,-40.370975494384766,-41.193641662597656,-41.94968032836914,-42.65155792236328,-43.29716873168945,-43.89356994628906...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0.000010084}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[0]	-9.8853721618652344e+0	-1.5905972480773926e+1	6.0206003189086914e+0	3.7851192853413962e-1	1.6039582649612428e-4
-	[1]	-1.1134060859680176e+1	-1.7154661178588867e+1	6.0206003189086914e+0	3.5096002516348984e-1	1.7298760332489014e-4
-	[2]	-1.6990945816040039e+1	-2.3011545181274414e+1	6.0205993652343750e+0	2.6163385890894553e-1	2.3204842160797119e-4
-	[3]	-2.4007926940917969e+1	-3.0028526306152344e+1	6.0205993652343750e+0	2.0049599849996150e-1	3.0280765927124024e-4
-	[4]	-2.6344022750854492e+1	-3.2364620208740234e+1	6.0205974578857422e+0	1.8602404165582789e-1	3.2636483018493652e-4
-	...and 26 more errors.
-	Max AbsError of 6.0214920043945313e+0 at index of 30.
-	[30]	-8.3255996704101563e+1	-8.9277488708496094e+1	6.0214920043945313e+0	6.7446924095900293e-2	9.0027419613647464e-4
-	Max RelError of 3.7851192853413962e-1 at index of 0.
- assert_true: expected true got false
+PASS   64-point float FFT equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0.000010084}. 
 PASS   Order: 6: Min FFT value is less than or equal to -100. 
 PASS   Order: 6: Max FFT value is greater than or equal to -30. 
-FAIL X 64-point byte FFT does not equal [255,255,255,254,246,239,233,228,224,220,217,214,211,208,206,204...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[3]	2.5500000000000000e+2	2.5400000000000000e+2	1.0000000000000000e+0	3.9370078740157480e-3	0.0000000000000000e+0
-	[4]	2.5500000000000000e+2	2.4600000000000000e+2	9.0000000000000000e+0	3.6585365853658534e-2	0.0000000000000000e+0
-	[5]	2.5500000000000000e+2	2.3900000000000000e+2	1.6000000000000000e+1	6.6945606694560664e-2	0.0000000000000000e+0
-	[6]	2.5500000000000000e+2	2.3300000000000000e+2	2.2000000000000000e+1	9.4420600858369105e-2	0.0000000000000000e+0
-	[7]	2.5000000000000000e+2	2.2800000000000000e+2	2.2000000000000000e+1	9.6491228070175433e-2	0.0000000000000000e+0
-	...and 23 more errors.
-	Max AbsError of 2.2000000000000000e+1 at index of 6.
-	Max RelError of 5.3846153846153844e-1 at index of 30.
-	[30]	6.0000000000000000e+1	3.9000000000000000e+1	2.1000000000000000e+1	5.3846153846153844e-1	0.0000000000000000e+0
- assert_true: expected true got false
-FAIL < [6-order FFT] 2 out of 4 assertions were failed. assert_true: expected true got false
+PASS   64-point byte FFT equals [255,255,255,254,246,239,233,228,224,220,217,214,211,208,206,204...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}. 
+PASS < [6-order FFT] All assertions passed. (total 4 assertions) 
 PASS > [7-order FFT]  
-FAIL X 128-point float FFT does not equal [-29.50564956665039,-21.252105712890625,-20.15380096435547,-27.885395050048828,-29.003442764282227,-31.41588592529297,-34.1386833190918,-33.479984283447266,-36.96889877319336,-36.17066192626953,-37.63994598388672,-39.218421936035156,-38.28988265991211,-41.39090347290039,-39.7088623046875,-41.735008239746094...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0.0000011473}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[0]	-2.3485050201416016e+1	-2.9505649566650391e+1	6.0205993652343750e+0	2.0404903649500841e-1	3.3851831747817991e-5
-	[1]	-1.5231506347656250e+1	-2.1252105712890625e+1	6.0205993652343750e+0	2.8329425077076176e-1	2.4382540884399415e-5
-	[2]	-1.4133201599121094e+1	-2.0153800964355469e+1	6.0205993652343750e+0	2.9873269939911395e-1	2.3122455846405029e-5
-	[3]	-2.1864795684814453e+1	-2.7885395050048828e+1	6.0205993652343750e+0	2.1590511285311101e-1	3.1992913740921022e-5
-	[4]	-2.2982843399047852e+1	-2.9003442764282227e+1	6.0205993652343750e+0	2.0758223132905967e-1	3.3275649883461000e-5
-	...and 53 more errors.
-	Max AbsError of 6.0206222534179688e+0 at index of 47.
-	[47]	-4.9437217712402344e+1	-5.5457839965820313e+1	6.0206222534179688e+0	1.0856214841992745e-1	6.3626779792785645e-5
-	Max RelError of 2.9873269939911395e-1 at index of 2.
- assert_true: expected true got false
+PASS   128-point float FFT equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0.0000011473}. 
 PASS   Order: 7: Min FFT value is less than or equal to -100. 
 PASS   Order: 7: Max FFT value is greater than or equal to -30. 
-FAIL X 128-point byte FFT does not equal [255,255,255,255,255,249,239,242,229,232,227,221,224,213,219,212...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[5]	2.5500000000000000e+2	2.4900000000000000e+2	6.0000000000000000e+0	2.4096385542168676e-2	0.0000000000000000e+0
-	[6]	2.5500000000000000e+2	2.3900000000000000e+2	1.6000000000000000e+1	6.6945606694560664e-2	0.0000000000000000e+0
-	[7]	2.5500000000000000e+2	2.4200000000000000e+2	1.3000000000000000e+1	5.3719008264462811e-2	0.0000000000000000e+0
-	[8]	2.5100000000000000e+2	2.2900000000000000e+2	2.2000000000000000e+1	9.6069868995633190e-2	0.0000000000000000e+0
-	[9]	2.5400000000000000e+2	2.3200000000000000e+2	2.2000000000000000e+1	9.4827586206896547e-2	0.0000000000000000e+0
-	...and 48 more errors.
-	Max AbsError of 2.2000000000000000e+1 at index of 8.
-	Max RelError of 2.2680412371134021e-1 at index of 57.
-	[57]	1.1900000000000000e+2	9.7000000000000000e+1	2.2000000000000000e+1	2.2680412371134021e-1	0.0000000000000000e+0
- assert_true: expected true got false
-FAIL < [7-order FFT] 2 out of 4 assertions were failed. assert_true: expected true got false
+PASS   128-point byte FFT equals [255,255,255,255,255,249,239,242,229,232,227,221,224,213,219,212...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}. 
+PASS < [7-order FFT] All assertions passed. (total 4 assertions) 
 PASS > [8-order FFT]  
-FAIL X 256-point float FFT does not equal [-71.95211791992188,-53.592926025390625,-28.569780349731445,-19.748321533203125,-20.293832778930664,-29.871274948120117,-28.293466567993164,-24.988117218017578,-30.608078002929688,-35.813697814941406,-28.863449096679688,-30.543323516845703,-39.949012756347656,-33.431251525878906,-31.214340209960938,-37.93589401245117...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0.0000010442}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[0]	-6.5931510925292969e+1	-7.1952117919921875e+1	6.0206069946289063e+0	8.3675188009468437e-2	7.5132401531982426e-5
-	[1]	-4.7572326660156250e+1	-5.3592926025390625e+1	6.0205993652343750e+0	1.1233944126099789e-1	5.5961733355712896e-5
-	[2]	-2.2549179077148438e+1	-2.8569780349731445e+1	6.0206012725830078e+0	2.1073320126661740e-1	2.9832564641189577e-5
-	[3]	-1.3727722167968750e+1	-1.9748321533203125e+1	6.0205993652343750e+0	3.0486638346007577e-1	2.0621197344970705e-5
-	[4]	-1.4273233413696289e+1	-2.0293832778930664e+1	6.0205993652343750e+0	2.9667137946879329e-1	2.1190820187759400e-5
-	...and 108 more errors.
-	Max AbsError of 6.0206260681152344e+0 at index of 101.
-	[101]	-5.3410911560058594e+1	-5.9431537628173828e+1	6.0206260681152344e+0	1.0130355545876245e-1	6.2058411591339117e-5
-	Max RelError of 3.0486638346007577e-1 at index of 3.
- assert_true: expected true got false
+PASS   256-point float FFT equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0.0000010442}. 
 PASS   Order: 8: Min FFT value is less than or equal to -100. 
 PASS   Order: 8: Max FFT value is greater than or equal to -30. 
-FAIL X 256-point byte FFT does not equal [102,169,255,255,255,255,255,255,252,233,255,253,218,242,250,226...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[0]	1.2400000000000000e+2	1.0200000000000000e+2	2.2000000000000000e+1	2.1568627450980393e-1	0.0000000000000000e+0
-	[1]	1.9000000000000000e+2	1.6900000000000000e+2	2.1000000000000000e+1	1.2426035502958580e-1	0.0000000000000000e+0
-	[8]	2.5500000000000000e+2	2.5200000000000000e+2	3.0000000000000000e+0	1.1904761904761904e-2	0.0000000000000000e+0
-	[9]	2.5500000000000000e+2	2.3300000000000000e+2	2.2000000000000000e+1	9.4420600858369105e-2	0.0000000000000000e+0
-	[11]	2.5500000000000000e+2	2.5300000000000000e+2	2.0000000000000000e+0	7.9051383399209481e-3	0.0000000000000000e+0
-	...and 101 more errors.
-	Max AbsError of 2.2000000000000000e+1 at index of 0.
-	Max RelError of 2.2448979591836735e-1 at index of 112.
-	[112]	1.2000000000000000e+2	9.8000000000000000e+1	2.2000000000000000e+1	2.2448979591836735e-1	0.0000000000000000e+0
- assert_true: expected true got false
-FAIL < [8-order FFT] 2 out of 4 assertions were failed. assert_true: expected true got false
+PASS   256-point byte FFT equals [102,169,255,255,255,255,255,255,252,233,255,253,218,242,250,226...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}. 
+PASS < [8-order FFT] All assertions passed. (total 4 assertions) 
 PASS > [9-order FFT]  
-FAIL X 512-point float FFT does not equal [-99.73411560058594,-95.57589721679688,-90.0415267944336,-86.16593933105469,-82.12168884277344,-36.43669891357422,-22.325963973999023,-18.973859786987305,-24.65760040283203,-42.647552490234375,-83.69915008544922,-79.3326416015625,-39.85673141479492,-27.42534828186035,-25.198009490966797,-32.10475540161133...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0.000026427}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[0]	-9.3714294433593750e+1	-9.9734115600585938e+1	6.0198211669921875e+0	6.0358696026345686e-2	2.6356734729766846e-3
-	[1]	-8.9554412841796875e+1	-9.5575897216796875e+1	6.0214843750000000e+0	6.3002122400602073e-2	2.5257842357482908e-3
-	[2]	-8.4020469665527344e+1	-9.0041526794433594e+1	6.0210571289062500e+0	6.6869780458659156e-2	2.3795274285964966e-3
-	[3]	-8.0145050048828125e+1	-8.6165939331054688e+1	6.0208892822265625e+0	6.9875513793146798e-2	2.2771072787017821e-3
-	[4]	-7.6101112365722656e+1	-8.2121688842773438e+1	6.0205764770507813e+0	7.3312867305706672e-2	2.1702298710479734e-3
-	...and 204 more errors.
-	Max AbsError of 6.0220336914062500e+0 at index of 141.
-	[141]	-9.2915489196777344e+1	-9.8937522888183594e+1	6.0220336914062500e+0	6.0867035232044196e-2	2.6146219173660279e-3
-	Max RelError of 3.1731020640109486e-1 at index of 7.
-	[7]	-1.2953260421752930e+1	-1.8973859786987305e+1	6.0205993652343750e+0	3.1731020640109486e-1	5.0142219259071352e-4
- assert_true: expected true got false
+PASS   512-point float FFT equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0.000026427}. 
 PASS   Order: 9: Min FFT value is less than or equal to -100. 
 PASS   Order: 9: Max FFT value is greater than or equal to -30. 
-FAIL X 512-point byte FFT does not equal [0,16,36,50,65,231,255,255,255,208,59,75,219,255,255,247...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[0]	2.2000000000000000e+1	0.0000000000000000e+0	2.2000000000000000e+1	Infinity	0.0000000000000000e+0
-	[1]	3.8000000000000000e+1	1.6000000000000000e+1	2.2000000000000000e+1	1.3750000000000000e+0	0.0000000000000000e+0
-	[2]	5.8000000000000000e+1	3.6000000000000000e+1	2.2000000000000000e+1	6.1111111111111116e-1	0.0000000000000000e+0
-	[3]	7.2000000000000000e+1	5.0000000000000000e+1	2.2000000000000000e+1	4.4000000000000000e-1	0.0000000000000000e+0
-	[4]	8.7000000000000000e+1	6.5000000000000000e+1	2.2000000000000000e+1	3.3846153846153848e-1	0.0000000000000000e+0
-	...and 198 more errors.
-	Max AbsError of 2.2000000000000000e+1 at index of 0.
-	Max RelError of Infinity at index of 0.
- assert_true: expected true got false
-FAIL < [9-order FFT] 2 out of 4 assertions were failed. assert_true: expected true got false
+PASS   512-point byte FFT equals [0,16,36,50,65,231,255,255,255,208,59,75,219,255,255,247...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}. 
+PASS < [9-order FFT] All assertions passed. (total 4 assertions) 
 PASS > [10-order FFT]  
-FAIL X 1024-point float FFT does not equal [-100,-100,-100,-100,-99.35152435302734,-96.60633087158203,-93.55770111083984,-90.17508697509766,-86.43912506103516,-82.47418975830078,-79.6666030883789,-70.38064575195312,-33.85957717895508,-21.402013778686523,-19.177812576293945,-26.087081909179688...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0.000029771}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[0]	-9.9746253967285156e+1	-1.0000000000000000e+2	2.5374603271484375e-1	2.5374603271484373e-3	2.9770999999999999e-3
-	[1]	-9.9217491149902344e+1	-1.0000000000000000e+2	7.8250885009765625e-1	7.8250885009765632e-3	2.9770999999999999e-3
-	[2]	-9.7794502258300781e+1	-1.0000000000000000e+2	2.2054977416992188e+0	2.2054977416992187e-2	2.9770999999999999e-3
-	[3]	-9.5761108398437500e+1	-1.0000000000000000e+2	4.2388916015625000e+0	4.2388916015625000e-2	2.9770999999999999e-3
-	[4]	-9.3331230163574219e+1	-9.9351524353027344e+1	6.0202941894531250e+0	6.0595891493935398e-2	2.9577942315139770e-3
-	...and 285 more errors.
-	Max AbsError of 6.0214080810546875e+0 at index of 46.
-	[46]	-8.6186645507812500e+1	-9.2208053588867188e+1	6.0214080810546875e+0	6.5302409569370709e-2	2.7451259633941650e-3
-	Max RelError of 3.1393576554320829e-1 at index of 14.
-	[14]	-1.3157211303710938e+1	-1.9177812576293945e+1	6.0206012725830078e+0	3.1393576554320829e-1	5.7094265820884708e-4
- assert_true: expected true got false
+PASS   1024-point float FFT equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0.000029771}. 
 PASS   Order: 10: Min FFT value is less than or equal to -100. 
 PASS   Order: 10: Max FFT value is greater than or equal to -30. 
-FAIL X 1024-point byte FFT does not equal [0,0,0,0,2,12,23,35,49,63,74,107,240,255,255,255...] with an element-wise tolerance of {"absoluteThreshold":1,"relativeThreshold":0}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[1]	2.0000000000000000e+0	0.0000000000000000e+0	2.0000000000000000e+0	Infinity	1.0000000000000000e+0
-	[2]	8.0000000000000000e+0	0.0000000000000000e+0	8.0000000000000000e+0	Infinity	1.0000000000000000e+0
-	[3]	1.5000000000000000e+1	0.0000000000000000e+0	1.5000000000000000e+1	Infinity	1.0000000000000000e+0
-	[4]	2.4000000000000000e+1	2.0000000000000000e+0	2.2000000000000000e+1	1.1000000000000000e+1	1.0000000000000000e+0
-	[5]	3.4000000000000000e+1	1.2000000000000000e+1	2.2000000000000000e+1	1.8333333333333333e+0	1.0000000000000000e+0
-	...and 273 more errors.
-	Max AbsError of 2.2000000000000000e+1 at index of 4.
-	Max RelError of Infinity at index of 1.
- assert_true: expected true got false
-FAIL < [10-order FFT] 2 out of 4 assertions were failed. assert_true: expected true got false
+PASS   1024-point byte FFT equals [0,0,0,0,2,12,23,35,49,63,74,107,240,255,255,255...] with an element-wise tolerance of {"absoluteThreshold":1,"relativeThreshold":0}. 
+PASS < [10-order FFT] All assertions passed. (total 4 assertions) 
 PASS > [11-order FFT]  
-FAIL X 2048-point float FFT does not equal [-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0.000013456}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[13]	-9.9615356445312500e+1	-1.0000000000000000e+2	3.8464355468750000e-1	3.8464355468750002e-3	1.3456000000000000e-3
-	[14]	-9.7888046264648438e+1	-1.0000000000000000e+2	2.1119537353515625e+0	2.1119537353515624e-2	1.3456000000000000e-3
-	[15]	-9.6002113342285156e+1	-1.0000000000000000e+2	3.9978866577148438e+0	3.9978866577148435e-2	1.3456000000000000e-3
-	[16]	-9.3944313049316406e+1	-9.9964843750000000e+1	6.0205307006835938e+0	6.0226480378844122e-2	1.3451269375000000e-3
-	[17]	-9.1689773559570313e+1	-9.7709945678710938e+1	6.0201721191406250e+0	6.1612685150149470e-2	1.3147850290527343e-3
-	...and 270 more errors.
-	Max AbsError of 6.0212173461914063e+0 at index of 251.
-	[251]	-9.0205146789550781e+1	-9.6226364135742188e+1	6.0212173461914063e+0	6.2573468303318072e-2	1.2948219558105468e-3
-	Max RelError of 3.0097867499425746e-1 at index of 28.
-	[28]	-1.3982809066772461e+1	-2.0003408432006836e+1	6.0205993652343750e+0	3.0097867499425746e-1	2.6916586386108399e-4
- assert_true: expected true got false
+PASS   2048-point float FFT equals [-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0.000013456}. 
 PASS   Order: 11: Min FFT value is less than or equal to -100. 
 PASS   Order: 11: Max FFT value is greater than or equal to -30. 
-FAIL X 2048-point byte FFT does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[13]	1.0000000000000000e+0	0.0000000000000000e+0	1.0000000000000000e+0	Infinity	0.0000000000000000e+0
-	[14]	7.0000000000000000e+0	0.0000000000000000e+0	7.0000000000000000e+0	Infinity	0.0000000000000000e+0
-	[15]	1.4000000000000000e+1	0.0000000000000000e+0	1.4000000000000000e+1	Infinity	0.0000000000000000e+0
-	[16]	2.2000000000000000e+1	0.0000000000000000e+0	2.2000000000000000e+1	Infinity	0.0000000000000000e+0
-	[17]	3.0000000000000000e+1	8.0000000000000000e+0	2.2000000000000000e+1	2.7500000000000000e+0	0.0000000000000000e+0
-	...and 259 more errors.
-	Max AbsError of 2.2000000000000000e+1 at index of 16.
-	Max RelError of Infinity at index of 13.
- assert_true: expected true got false
-FAIL < [11-order FFT] 2 out of 4 assertions were failed. assert_true: expected true got false
+PASS   2048-point byte FFT equals [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}. 
+PASS < [11-order FFT] All assertions passed. (total 4 assertions) 
 PASS > [12-order FFT]  
-FAIL X 4096-point float FFT does not equal [-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":4.6116e-7}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[53]	-3.3307727813720703e+1	-3.9328327178955078e+1	6.0205993652343750e+0	1.5308556953970950e-1	1.8136651361846923e-5
-	[54]	-1.7390127182006836e+1	-2.3410726547241211e+1	6.0205993652343750e+0	2.5717268334603910e-1	1.0796090654525756e-5
-	[55]	-1.2883941650390625e+1	-1.8904541015625000e+1	6.0205993652343750e+0	3.1847371275812636e-1	8.7180181347656248e-6
-	[56]	-1.7390127182006836e+1	-2.3410726547241211e+1	6.0205993652343750e+0	2.5717268334603910e-1	1.0796090654525756e-5
-	[57]	-3.3307727813720703e+1	-3.9328327178955078e+1	6.0205993652343750e+0	1.5308556953970950e-1	1.8136651361846923e-5
-	...and 155 more errors.
-	Max AbsError of 6.0206222534179688e+0 at index of 1483.
-	[1483]	-6.5597976684570313e+1	-7.1618598937988281e+1	6.0206222534179688e+0	8.4065066095903210e-2	3.3027633086242678e-5
-	Max RelError of 3.1847371275812636e-1 at index of 55.
- assert_true: expected true got false
+PASS   4096-point float FFT equals [-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":4.6116e-7}. 
 PASS   Order: 12: Min FFT value is less than or equal to -100. 
 PASS   Order: 12: Max FFT value is greater than or equal to -30. 
-FAIL X 4096-point byte FFT does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[53]	2.4200000000000000e+2	2.2100000000000000e+2	2.1000000000000000e+1	9.5022624434389136e-2	0.0000000000000000e+0
-	[57]	2.4200000000000000e+2	2.2100000000000000e+2	2.1000000000000000e+1	9.5022624434389136e-2	0.0000000000000000e+0
-	[108]	2.2100000000000000e+2	1.9900000000000000e+2	2.2000000000000000e+1	1.1055276381909548e-1	0.0000000000000000e+0
-	[112]	2.2100000000000000e+2	1.9900000000000000e+2	2.2000000000000000e+1	1.1055276381909548e-1	0.0000000000000000e+0
-	[163]	2.0800000000000000e+2	1.8600000000000000e+2	2.2000000000000000e+1	1.1827956989247312e-1	0.0000000000000000e+0
-	...and 148 more errors.
-	Max AbsError of 2.2000000000000000e+1 at index of 108.
-	Max RelError of 2.1782178217821782e-1 at index of 1593.
-	[1593]	1.2300000000000000e+2	1.0100000000000000e+2	2.2000000000000000e+1	2.1782178217821782e-1	0.0000000000000000e+0
- assert_true: expected true got false
-FAIL < [12-order FFT] 2 out of 4 assertions were failed. assert_true: expected true got false
+PASS   4096-point byte FFT equals [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}. 
+PASS < [12-order FFT] All assertions passed. (total 4 assertions) 
 PASS > [13-order FFT]  
-FAIL X 8192-point float FFT does not equal [-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":3.2106e-7}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[108]	-3.3307727813720703e+1	-3.9328327178955078e+1	6.0205993652343750e+0	1.5308556953970950e-1	1.2626752724075316e-5
-	[109]	-1.7390127182006836e+1	-2.3410726547241211e+1	6.0205993652343750e+0	2.5717268334603910e-1	7.5162478652572630e-6
-	[110]	-1.2883941650390625e+1	-1.8904542922973633e+1	6.0206012725830078e+0	3.1847378151981171e-1	6.0694925508499141e-6
-	[111]	-1.7390127182006836e+1	-2.3410726547241211e+1	6.0205993652343750e+0	2.5717268334603910e-1	7.5162478652572630e-6
-	[112]	-3.3307727813720703e+1	-3.9328327178955078e+1	6.0205993652343750e+0	1.5308556953970950e-1	1.2626752724075316e-5
-	...and 155 more errors.
-	Max AbsError of 6.0206146240234375e+0 at index of 2418.
-	[2418]	-6.0156181335449219e+1	-6.6176795959472656e+1	6.0206146240234375e+0	9.0977729228694043e-2	2.1246722110748292e-5
-	Max RelError of 3.1847378151981171e-1 at index of 110.
- assert_true: expected true got false
+PASS   8192-point float FFT equals [-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":3.2106e-7}. 
 PASS   Order: 13: Min FFT value is less than or equal to -100. 
 PASS   Order: 13: Max FFT value is greater than or equal to -30. 
-FAIL X 8192-point byte FFT does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[108]	2.4200000000000000e+2	2.2100000000000000e+2	2.1000000000000000e+1	9.5022624434389136e-2	0.0000000000000000e+0
-	[112]	2.4200000000000000e+2	2.2100000000000000e+2	2.1000000000000000e+1	9.5022624434389136e-2	0.0000000000000000e+0
-	[218]	2.2100000000000000e+2	1.9900000000000000e+2	2.2000000000000000e+1	1.1055276381909548e-1	0.0000000000000000e+0
-	[222]	2.2100000000000000e+2	1.9900000000000000e+2	2.2000000000000000e+1	1.1055276381909548e-1	0.0000000000000000e+0
-	[328]	2.0800000000000000e+2	1.8600000000000000e+2	2.2000000000000000e+1	1.1827956989247312e-1	0.0000000000000000e+0
-	...and 148 more errors.
-	Max AbsError of 2.2000000000000000e+1 at index of 218.
-	Max RelError of 2.1782178217821782e-1 at index of 3188.
-	[3188]	1.2300000000000000e+2	1.0100000000000000e+2	2.2000000000000000e+1	2.1782178217821782e-1	0.0000000000000000e+0
- assert_true: expected true got false
-FAIL < [13-order FFT] 2 out of 4 assertions were failed. assert_true: expected true got false
+PASS   8192-point byte FFT equals [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}. 
+PASS < [13-order FFT] All assertions passed. (total 4 assertions) 
 PASS > [14-order FFT]  
-FAIL X 16384-point float FFT does not equal [-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":1.1756e-7}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[218]	-3.3307727813720703e+1	-3.9328327178955078e+1	6.0205993652343750e+0	1.5308556953970950e-1	4.6234381431579594e-6
-	[219]	-1.7390127182006836e+1	-2.3410726547241211e+1	6.0205993652343750e+0	2.5717268334603910e-1	2.7521650128936767e-6
-	[220]	-1.2883941650390625e+1	-1.8904542922973633e+1	6.0206012725830078e+0	3.1847378151981171e-1	2.2224180660247802e-6
-	[221]	-1.7390127182006836e+1	-2.3410726547241211e+1	6.0205993652343750e+0	2.5717268334603910e-1	2.7521650128936767e-6
-	[222]	-3.3307727813720703e+1	-3.9328327178955078e+1	6.0205993652343750e+0	1.5308556953970950e-1	4.6234381431579594e-6
-	...and 155 more errors.
-	Max AbsError of 6.0206069946289063e+0 at index of 5282.
-	[5282]	-6.0911949157714844e+1	-6.6932556152343750e+1	6.0206069946289063e+0	8.9950352126482849e-2	7.8685913012695310e-6
-	Max RelError of 3.1847378151981171e-1 at index of 220.
- assert_true: expected true got false
+PASS   16384-point float FFT equals [-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":1.1756e-7}. 
 PASS   Order: 14: Min FFT value is less than or equal to -100. 
 PASS   Order: 14: Max FFT value is greater than or equal to -30. 
-FAIL X 16384-point byte FFT does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[218]	2.4200000000000000e+2	2.2100000000000000e+2	2.1000000000000000e+1	9.5022624434389136e-2	0.0000000000000000e+0
-	[222]	2.4200000000000000e+2	2.2100000000000000e+2	2.1000000000000000e+1	9.5022624434389136e-2	0.0000000000000000e+0
-	[438]	2.2100000000000000e+2	1.9900000000000000e+2	2.2000000000000000e+1	1.1055276381909548e-1	0.0000000000000000e+0
-	[442]	2.2100000000000000e+2	1.9900000000000000e+2	2.2000000000000000e+1	1.1055276381909548e-1	0.0000000000000000e+0
-	[658]	2.0800000000000000e+2	1.8600000000000000e+2	2.2000000000000000e+1	1.1827956989247312e-1	0.0000000000000000e+0
-	...and 148 more errors.
-	Max AbsError of 2.2000000000000000e+1 at index of 438.
-	Max RelError of 2.1782178217821782e-1 at index of 6378.
-	[6378]	1.2300000000000000e+2	1.0100000000000000e+2	2.2000000000000000e+1	2.1782178217821782e-1	0.0000000000000000e+0
- assert_true: expected true got false
-FAIL < [14-order FFT] 2 out of 4 assertions were failed. assert_true: expected true got false
+PASS   16384-point byte FFT equals [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}. 
+PASS < [14-order FFT] All assertions passed. (total 4 assertions) 
 PASS > [15-order FFT]  
-FAIL X 32768-point float FFT does not equal [-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":1.1756e-7}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[438]	-3.3307727813720703e+1	-3.9328327178955078e+1	6.0205993652343750e+0	1.5308556953970950e-1	4.6234381431579594e-6
-	[439]	-1.7390127182006836e+1	-2.3410726547241211e+1	6.0205993652343750e+0	2.5717268334603910e-1	2.7521650128936767e-6
-	[440]	-1.2883941650390625e+1	-1.8904542922973633e+1	6.0206012725830078e+0	3.1847378151981171e-1	2.2224180660247802e-6
-	[441]	-1.7390127182006836e+1	-2.3410726547241211e+1	6.0205993652343750e+0	2.5717268334603910e-1	2.7521650128936767e-6
-	[442]	-3.3307727813720703e+1	-3.9328327178955078e+1	6.0205993652343750e+0	1.5308556953970950e-1	4.6234381431579594e-6
-	...and 155 more errors.
-	Max AbsError of 6.0206069946289063e+0 at index of 11442.
-	[11442]	-6.5270172119140625e+1	-7.1290779113769531e+1	6.0206069946289063e+0	8.4451412503444637e-2	8.3809439926147469e-6
-	Max RelError of 3.1847378151981171e-1 at index of 440.
- assert_true: expected true got false
+PASS   32768-point float FFT equals [-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100,-100...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":1.1756e-7}. 
 PASS   Order: 15: Min FFT value is less than or equal to -100. 
 PASS   Order: 15: Max FFT value is greater than or equal to -30. 
-FAIL X 32768-point byte FFT does not equal [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[438]	2.4200000000000000e+2	2.2100000000000000e+2	2.1000000000000000e+1	9.5022624434389136e-2	0.0000000000000000e+0
-	[442]	2.4200000000000000e+2	2.2100000000000000e+2	2.1000000000000000e+1	9.5022624434389136e-2	0.0000000000000000e+0
-	[878]	2.2100000000000000e+2	1.9900000000000000e+2	2.2000000000000000e+1	1.1055276381909548e-1	0.0000000000000000e+0
-	[882]	2.2100000000000000e+2	1.9900000000000000e+2	2.2000000000000000e+1	1.1055276381909548e-1	0.0000000000000000e+0
-	[1318]	2.0800000000000000e+2	1.8600000000000000e+2	2.2000000000000000e+1	1.1827956989247312e-1	0.0000000000000000e+0
-	...and 148 more errors.
-	Max AbsError of 2.2000000000000000e+1 at index of 878.
-	Max RelError of 2.1782178217821782e-1 at index of 12758.
-	[12758]	1.2300000000000000e+2	1.0100000000000000e+2	2.2000000000000000e+1	2.1782178217821782e-1	0.0000000000000000e+0
- assert_true: expected true got false
-FAIL < [15-order FFT] 2 out of 4 assertions were failed. assert_true: expected true got false
+PASS   32768-point byte FFT equals [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}. 
+PASS < [15-order FFT] All assertions passed. (total 4 assertions) 
 PASS > [no smoothing]  
-FAIL X 128-point float FFT does not equal [-33.72169876098633,-21.12053680419922,-18.01490020751953,-20.202268600463867,-23.227161407470703,-25.33261489868164,-27.01714515686035,-28.42304801940918,-29.599950790405273,-30.668575286865234,-31.57920265197754,-32.43918991088867,-33.18773651123047,-33.9034538269043,-34.543426513671875,-35.153358459472656...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0.0000015684}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[0]	-2.7701099395751953e+1	-3.3721698760986328e+1	6.0205993652343750e+0	1.7853784318243754e-1	5.2889112336730963e-5
-	[1]	-1.5099936485290527e+1	-2.1120536804199219e+1	6.0206003189086914e+0	2.8505905767090473e-1	3.3125449923706058e-5
-	[2]	-1.1994299888610840e+1	-1.8014900207519531e+1	6.0206003189086914e+0	3.3420114735887657e-1	2.8254569485473634e-5
-	[3]	-1.4181670188903809e+1	-2.0202268600463867e+1	6.0205984115600586e+0	2.9801595705057693e-1	3.1685238072967528e-5
-	[4]	-1.7206560134887695e+1	-2.3227161407470703e+1	6.0206012725830078e+0	2.5920521095817428e-1	3.6429479951477053e-5
-	...and 53 more errors.
-	Max AbsError of 6.0206909179687500e+0 at index of 57.
-	[57]	-6.6946838378906250e+1	-7.2967529296875000e+1	6.0206909179687500e+0	8.2511919698870770e-2	1.1444227294921876e-4
-	Max RelError of 3.3420114735887657e-1 at index of 2.
- assert_true: expected true got false
-FAIL < [no smoothing] 1 out of 1 assertions were failed. assert_true: expected true got false
-FAIL # AUDIT TASK RUNNER FINISHED: 12 out of 12 tasks were failed. assert_true: expected true got false
+PASS   128-point float FFT equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0.0000015684}. 
+PASS < [no smoothing] All assertions passed. (total 1 assertions) 
+PASS # AUDIT TASK RUNNER FINISHED: 12 tasks ran successfully. 
 

Modified: trunk/LayoutTests/webaudio/Analyser/realtimeanalyser-freq-data-smoothing-expected.txt (267382 => 267383)


--- trunk/LayoutTests/webaudio/Analyser/realtimeanalyser-freq-data-smoothing-expected.txt	2020-09-21 23:25:25 UTC (rev 267382)
+++ trunk/LayoutTests/webaudio/Analyser/realtimeanalyser-freq-data-smoothing-expected.txt	2020-09-21 23:27:50 UTC (rev 267383)
@@ -3,54 +3,10 @@
 PASS Executing "smoothing test" 
 PASS Audit report 
 PASS > [smoothing test]  
-FAIL X First 512-point FFT at frame 512 does not equal [-100,-100,-96.06212615966797,-92.1865463256836,-88.14228820800781,-42.457298278808594,-28.3465633392334,-24.99445915222168,-30.678199768066406,-48.66815185546875,-89.7197494506836,-85.35324096679688,-45.8773307800293,-33.44594955444336,-31.218608856201172,-38.1253547668457...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0.0000059207}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[0]	-9.9734893798828125e+1	-1.0000000000000000e+2	2.6510620117187500e-1	2.6510620117187501e-3	5.9206999999999999e-4
-	[1]	-9.5575012207031250e+1	-1.0000000000000000e+2	4.4249877929687500e+0	4.4249877929687501e-2	5.9206999999999999e-4
-	[2]	-9.0041076660156250e+1	-9.6062126159667969e+1	6.0210494995117188e+0	6.2678703254016449e-2	5.6875503035354617e-4
-	[3]	-8.6165649414062500e+1	-9.2186546325683594e+1	6.0208969116210938e+0	6.5312099775926238e-2	5.4580888483047490e-4
-	[4]	-8.2121719360351563e+1	-8.8142288208007813e+1	6.0205688476562500e+0	6.8305111769372873e-2	5.2186404579315185e-4
-	...and 192 more errors.
-	Max AbsError of 6.0210494995117188e+0 at index of 2.
-	Max RelError of 2.4087736120104133e-1 at index of 7.
-	[7]	-1.8973859786987305e+1	-2.4994459152221680e+1	6.0205993652343750e+0	2.4087736120104133e-1	1.4798469430255890e-4
- assert_true: expected true got false
-FAIL X 512-point byte FFT does not equal [0,0,14,28,43,209,255,255,252,186,37,53,197,242,250,225...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[1]	1.6000000000000000e+1	0.0000000000000000e+0	1.6000000000000000e+1	Infinity	0.0000000000000000e+0
-	[2]	3.6000000000000000e+1	1.4000000000000000e+1	2.2000000000000000e+1	1.5714285714285714e+0	0.0000000000000000e+0
-	[3]	5.0000000000000000e+1	2.8000000000000000e+1	2.2000000000000000e+1	7.8571428571428570e-1	0.0000000000000000e+0
-	[4]	6.5000000000000000e+1	4.3000000000000000e+1	2.2000000000000000e+1	5.1162790697674421e-1	0.0000000000000000e+0
-	[5]	2.3100000000000000e+2	2.0900000000000000e+2	2.2000000000000000e+1	1.0526315789473684e-1	0.0000000000000000e+0
-	...and 189 more errors.
-	Max AbsError of 2.2000000000000000e+1 at index of 2.
-	Max RelError of Infinity at index of 1.
- assert_true: expected true got false
-FAIL X Smoothed 512-point FFT at frame 1536 does not equal [-94.55278778076172,-93.13629150390625,-90.07610321044922,-87.21340942382812,-85.55162048339844,-38.930355072021484,-24.825944900512695,-21.471542358398438,-27.15943145751953,-45.10898971557617,-87.53993225097656,-78.7408447265625,-42.376895904541016,-29.92169761657715,-27.697038650512695,-34.60657501220703...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0.000025332}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[0]	-8.8532302856445313e+1	-9.4552787780761719e+1	6.0204849243164063e+0	6.3673267236456568e-2	2.3952112200622561e-3
-	[1]	-8.7115928649902344e+1	-9.3136291503906250e+1	6.0203628540039063e+0	6.4640354010137985e-2	2.3593285363769532e-3
-	[2]	-8.4055267333984375e+1	-9.0076103210449219e+1	6.0208358764648438e+0	6.6841655687503151e-2	2.2818078465270996e-3
-	[3]	-8.1192565917968750e+1	-8.7213409423828125e+1	6.0208435058593750e+0	6.9035754313881717e-2	2.2092900875244140e-3
-	[4]	-7.9531051635742188e+1	-8.5551620483398438e+1	6.0205688476562500e+0	7.0373522016740298e-2	2.1671936500854494e-3
-	...and 199 more errors.
-	Max AbsError of 6.0210571289062500e+0 at index of 183.
-	[183]	-9.0905830383300781e+1	-9.6926887512207031e+1	6.0210571289062500e+0	6.2119575728127596e-2	2.4553519144592285e-3
-	Max RelError of 2.8039901674224449e-1 at index of 7.
-	[7]	-1.5450942993164063e+1	-2.1471542358398438e+1	6.0205993652343750e+0	2.8039901674224449e-1	5.4391711102294929e-4
- assert_true: expected true got false
-FAIL X 512-point byte FFT does not equal [19,25,36,46,52,222,255,255,255,199,45,77,209,255,255,238...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}.
-	Index	Actual			Expected		AbsError		RelError		Test threshold
-	[0]	4.1000000000000000e+1	1.9000000000000000e+1	2.2000000000000000e+1	1.1578947368421053e+0	0.0000000000000000e+0
-	[1]	4.6000000000000000e+1	2.5000000000000000e+1	2.1000000000000000e+1	8.3999999999999997e-1	0.0000000000000000e+0
-	[2]	5.8000000000000000e+1	3.6000000000000000e+1	2.2000000000000000e+1	6.1111111111111116e-1	0.0000000000000000e+0
-	[3]	6.8000000000000000e+1	4.6000000000000000e+1	2.2000000000000000e+1	4.7826086956521741e-1	0.0000000000000000e+0
-	[4]	7.4000000000000000e+1	5.2000000000000000e+1	2.2000000000000000e+1	4.2307692307692307e-1	0.0000000000000000e+0
-	...and 193 more errors.
-	Max AbsError of 2.2000000000000000e+1 at index of 0.
-	Max RelError of Infinity at index of 51.
-	[51]	1.5000000000000000e+1	0.0000000000000000e+0	1.5000000000000000e+1	Infinity	0.0000000000000000e+0
- assert_true: expected true got false
-FAIL < [smoothing test] 4 out of 4 assertions were failed. assert_true: expected true got false
-FAIL # AUDIT TASK RUNNER FINISHED: 1 out of 1 tasks were failed. assert_true: expected true got false
+PASS   First 512-point FFT at frame 512 equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0.0000059207}. 
+PASS   512-point byte FFT equals [0,0,14,28,43,209,255,255,252,186,37,53,197,242,250,225...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}. 
+PASS   Smoothed 512-point FFT at frame 1536 equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0.000025332}. 
+PASS   512-point byte FFT equals [19,25,36,46,52,222,255,255,255,199,45,77,209,255,255,238...] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0}. 
+PASS < [smoothing test] All assertions passed. (total 4 assertions) 
+PASS # AUDIT TASK RUNNER FINISHED: 1 tasks ran successfully. 
 

Modified: trunk/LayoutTests/webaudio/Analyser/realtimeanalyser-multiple-calls-expected.txt (267382 => 267383)


--- trunk/LayoutTests/webaudio/Analyser/realtimeanalyser-multiple-calls-expected.txt	2020-09-21 23:25:25 UTC (rev 267382)
+++ trunk/LayoutTests/webaudio/Analyser/realtimeanalyser-multiple-calls-expected.txt	2020-09-21 23:27:50 UTC (rev 267383)
@@ -4,9 +4,9 @@
 PASS Audit report 
 PASS > [test]  
 PASS   Second call to getFloatFrequencyData is identical to the array [expected array]. 
-PASS   Second call to getByteFrequencyData is identical to the array [189,254,255,255,255,255,245,250,238,239,236,228,233,219,228,218...]. 
-PASS   Output of getByteFrequencyData after getFloatFrequencyData is identical to the array [185,255,255,255,255,255,255,255,251,250,247,241,243,234,238,231...]. 
-PASS   Output of getFloatFrequenycData (converted to byte) after getByteFrequencyData is identical to the array [198,255,255,255,255,255,255,255,255,255,253,247,249,239,244,237...]. 
+PASS   Second call to getByteFrequencyData is identical to the array [167,232,255,255,238,239,223,228,216,217,214,206,211,197,206,196...]. 
+PASS   Output of getByteFrequencyData after getFloatFrequencyData is identical to the array [163,242,255,255,252,250,237,238,229,228,225,219,221,212,216,209...]. 
+PASS   Output of getFloatFrequenycData (converted to byte) after getByteFrequencyData is identical to the array [176,248,255,255,255,255,243,244,235,234,231,225,227,217,222,215...]. 
 PASS < [test] All assertions passed. (total 4 assertions) 
 PASS # AUDIT TASK RUNNER FINISHED: 1 tasks ran successfully. 
 

Deleted: trunk/LayoutTests/webaudio/realtimeanalyser-fft-scaling-expected.txt (267382 => 267383)


--- trunk/LayoutTests/webaudio/realtimeanalyser-fft-scaling-expected.txt	2020-09-21 23:25:25 UTC (rev 267382)
+++ trunk/LayoutTests/webaudio/realtimeanalyser-fft-scaling-expected.txt	2020-09-21 23:27:50 UTC (rev 267383)
@@ -1,30 +0,0 @@
-Test scaling of FFT data for AnalyserNode
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-PASS Actual FFT peak in the expected position (1)
-PASS Peak value is near 0 dBFS as expected
-PASS Analyser correctly scaled FFT data of size 32
-PASS Actual FFT peak in the expected position (2)
-PASS Peak value is near 0 dBFS as expected
-PASS Analyser correctly scaled FFT data of size 64
-PASS Actual FFT peak in the expected position (4)
-PASS Peak value is near 0 dBFS as expected
-PASS Analyser correctly scaled FFT data of size 128
-PASS Actual FFT peak in the expected position (8)
-PASS Peak value is near 0 dBFS as expected
-PASS Analyser correctly scaled FFT data of size 256
-PASS Actual FFT peak in the expected position (16)
-PASS Peak value is near 0 dBFS as expected
-PASS Analyser correctly scaled FFT data of size 512
-PASS Actual FFT peak in the expected position (32)
-PASS Peak value is near 0 dBFS as expected
-PASS Analyser correctly scaled FFT data of size 1024
-PASS Actual FFT peak in the expected position (64)
-PASS Peak value is near 0 dBFS as expected
-PASS Analyser correctly scaled FFT data of size 2048
-PASS All Analyser tests passed.
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/webaudio/realtimeanalyser-fft-scaling.html (267382 => 267383)


--- trunk/LayoutTests/webaudio/realtimeanalyser-fft-scaling.html	2020-09-21 23:25:25 UTC (rev 267382)
+++ trunk/LayoutTests/webaudio/realtimeanalyser-fft-scaling.html	2020-09-21 23:27:50 UTC (rev 267383)
@@ -1,118 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-  <head>
-    <script src=""
-    <script src=""
-  </head>
-
-  <body>
-    <div id="description"></div>
-    <div id="console"></div>
-
-    <script>
-description("Test scaling of FFT data for AnalyserNode");
-
-// The number of analysers. We have analysers from size for each of the possible sizes of 32,
-// 64, 128, 256, 512, 1024 and 2048.
-var numberOfAnalysers = 7;
-var sampleRate = 44100;
-var context;
-var osc;
-var oscFrequency = sampleRate/32;
-var analysers = new Array(7);
-var peakValue = new Array(7);
-
-// For a 0dBFS sine wave, we would expect the FFT magnitude to be 0dB as well, but the
-// analyzer node applies a Blackman window (to smooth the estimate).  This reduces the energy
-// of the signal so the FFT peak is less than 0dB.  The threshold value given here was
-// determined experimentally.
-//
-// See https://code.google.com/p/chromium/issues/detail?id=341596.
-var peakThreshold = [-8.41, -7.54, -7.54, -7.54, -7.54, -7.54, -7.54];
-
-function checkResult() {
-    var allTestsPassed = true;
-
-    for (var n = 0; n < analysers.length; ++n) {
-        // Grab the FFT data from each analyser.
-        var fftSize = analysers[n].fftSize;
-        var fftData = new Float32Array(fftSize);
-        analysers[n].getFloatFrequencyData(fftData);
-
-        // Compute the frequency bin that should contain the peak.
-        var expectedBin = fftSize * (oscFrequency / sampleRate);
-
-        // Find the actual bin by finding the bin containing the peak.
-        var actualBin = 0;
-        peakValue[n] = -1000;
-        for (k = 0; k < analysers[n].frequencyBinCount; ++k) {
-            if (fftData[k] > peakValue[n]) {
-                actualBin = k;
-                peakValue[n] = fftData[k];
-            }
-        }
-
-        var success = true;
-
-        if (actualBin == expectedBin) {
-            testPassed("Actual FFT peak in the expected position (" + expectedBin + ")");
-        } else {
-            success = false;
-            testFailed("Actual FFT peak (" + actualBin + ") differs from expected (" + expectedBin + ")");
-        }
-
-        if (peakValue[n] >= peakThreshold[n]) {
-            testPassed("Peak value is near 0 dBFS as expected");
-        } else {
-            success = false;
-            testFailed("Peak value of " + peakValue[n]
-            + " is incorrect.  (Expected approximately "
-            + peakThreshold[n] + ")");
-        }
-
-        if (success) {
-            testPassed("Analyser correctly scaled FFT data of size " + fftSize);
-        } else {
-            testFailed("Analyser incorrectly scaled FFT data of size " + fftSize);
-        }
-        allTestsPassed = allTestsPassed && success;
-    }
-
-    if (allTestsPassed) {
-        testPassed("All Analyser tests passed.");
-    } else {
-        testFailed("At least one Analyser test failed.");
-    }
-
-    finishJSTest();
-}
-
-function runTests() {
-    window.jsTestIsAsync = true;
-
-    context = new webkitOfflineAudioContext(1, 2048, sampleRate);
-
-    // Use a sine wave oscillator as the reference source signal.
-    osc = context.createOscillator();
-    osc.type = "sine";
-    osc.frequency.value = oscFrequency;
-    osc.connect(context.destination);
-
-    // Create an analyser node for each of the possible valid sizes.
-    for (var order = 5; order < 12; ++order) {
-        analysers[order - 5] = context.createAnalyser();
-        // No smoothing so between frames to simplify testing.
-        analysers[order - 5].smoothingTimeConstant = 0;
-        analysers[order - 5].fftSize = 1 << order;
-        osc.connect(analysers[order - 5]);
-    }
-
-    osc.start(0);
-    context._oncomplete_ = checkResult;
-    context.startRendering();
-}
-
-runTests();
-    </script>
-  </body>
-</html>

Modified: trunk/LayoutTests/webrtc/routines.js (267382 => 267383)


--- trunk/LayoutTests/webrtc/routines.js	2020-09-21 23:25:25 UTC (rev 267382)
+++ trunk/LayoutTests/webrtc/routines.js	2020-09-21 23:27:50 UTC (rev 267383)
@@ -114,7 +114,7 @@
 
            var hasFrequency = expectedFrequency => {
                 var bin = Math.floor(expectedFrequency * analyser.fftSize / context.sampleRate);
-                return bin < freqDomain.length && freqDomain[bin] >= 150;
+                return bin < freqDomain.length && freqDomain[bin] >= 100;
            };
 
            if (!results.heardHum)

Modified: trunk/Source/WebCore/ChangeLog (267382 => 267383)


--- trunk/Source/WebCore/ChangeLog	2020-09-21 23:25:25 UTC (rev 267382)
+++ trunk/Source/WebCore/ChangeLog	2020-09-21 23:27:50 UTC (rev 267383)
@@ -1,3 +1,50 @@
+2020-09-21  Chris Dumez  <[email protected]>
+
+        Values returned by FFTFrame::doFFT() are twice as large as they should be
+        https://bugs.webkit.org/show_bug.cgi?id=216781
+
+        Reviewed by Darin Adler.
+
+        To provide the best possible execution speeds, the vDSP library's functions don't always adhere strictly
+        to textbook formulas for Fourier transforms, and must be scaled accordingly [1].
+
+        In the case of a Real forward Transform like in FFTFrame::doFFT(): RFimp = RFmath * 2 so we need to
+        divide the output by 2 to get the correct value. We were failing to do this scaling and this was causing
+        AnalyserNode tests to fail.
+
+        [1] See https://developer.apple.com/library/archive/documentation/Performance/Conceptual/vDSP_Programming_Guide/UsingFourierTransforms/UsingFourierTransforms.html#//apple_ref/doc/uid/TP40005147-CH3-SW5
+
+        No new tests, rebaselined existing tests.
+
+        * Modules/webaudio/PeriodicWave.cpp:
+        (WebCore::PeriodicWave::createBandLimitedTables):
+        Update normalization factor now that FFTFrame::doInverseFFT() has been fixed. The new normalization factor
+        matches the value used by blink at:
+        - https://github.com/chromium/chromium/blob/master/third_party/blink/renderer/modules/webaudio/periodic_wave.cc
+
+        * platform/audio/FFTFrame.cpp:
+        (WebCore::FFTFrame::multiply):
+        We were applying a 0.5 scaling factor to the output of vDSP_zvmul(). However, the documentation for vDSP_zvmul()
+        does not indicate that its output is twice as large as expected. Odds are that this was done because we used
+        to have a bug in FFTFrame::doFFT() that was returning values twice as large as expected. SInce this function
+        relies on VectorMath, there is no need for its implementation to be platform-specific.
+
+        * platform/audio/FFTFrameStub.cpp:
+        * platform/audio/gstreamer/FFTFrameGStreamer.cpp:
+        (WebCore::FFTFrame::doFFT):
+        (WebCore::FFTFrame::doInverseFFT):
+        Drop 2 factor in the GStreamer implementation that was added to try and be consistent with the incorrect Mac
+        implementation.
+
+        * platform/audio/mac/FFTFrameMac.cpp:
+        (WebCore::FFTFrame::doFFT):
+        Fix issue where the values returned by doFFT() were twice as large as expected due to the odd behavior of
+        vDSP_fft_zrip().
+
+        (WebCore::FFTFrame::doInverseFFT):
+        Drop 2 factor in doInverseFFT that was added because the output of doFFT() was twice as large as expected
+        and we wanted x == InverseFFT(FFT(x)).
+
 2020-09-21  Wenson Hsieh  <[email protected]>
 
         [GPU Process] Several tests in canvas/philip/tests are failing with text diffs

Modified: trunk/Source/WebCore/Modules/webaudio/PeriodicWave.cpp (267382 => 267383)


--- trunk/Source/WebCore/Modules/webaudio/PeriodicWave.cpp	2020-09-21 23:25:25 UTC (rev 267382)
+++ trunk/Source/WebCore/Modules/webaudio/PeriodicWave.cpp	2020-09-21 23:27:50 UTC (rev 267383)
@@ -192,7 +192,7 @@
 // Thus, higher ranges have more high-frequency partials culled out.
 void PeriodicWave::createBandLimitedTables(const float* realData, const float* imagData, unsigned numberOfComponents, ShouldDisableNormalization disableNormalization)
 {
-    float normalizationScale = 1;
+    float normalizationScale = 0.5;
 
     unsigned fftSize = periodicWaveSize();
     unsigned halfSize = fftSize / 2;

Modified: trunk/Source/WebCore/platform/audio/FFTFrame.cpp (267382 => 267383)


--- trunk/Source/WebCore/platform/audio/FFTFrame.cpp	2020-09-21 23:25:25 UTC (rev 267382)
+++ trunk/Source/WebCore/platform/audio/FFTFrame.cpp	2020-09-21 23:27:50 UTC (rev 267383)
@@ -179,6 +179,28 @@
     VectorMath::vsmul(imagData(), 1, &factor, imagData(), 1, fftSize());
 }
 
+void FFTFrame::multiply(const FFTFrame& frame)
+{
+    FFTFrame& frame1 = *this;
+    const FFTFrame& frame2 = frame;
+
+    float* realP1 = frame1.realData();
+    float* imagP1 = frame1.imagData();
+    const float* realP2 = frame2.realData();
+    const float* imagP2 = frame2.imagData();
+
+    unsigned halfSize = m_FFTSize / 2;
+    float real0 = realP1[0];
+    float imag0 = imagP1[0];
+
+    // Complex multiply
+    VectorMath::zvmul(realP1, imagP1, realP2, imagP2, realP1, imagP1, halfSize);
+
+    // Multiply the packed DC/nyquist component
+    realP1[0] = real0 * realP2[0];
+    imagP1[0] = imag0 * imagP2[0];
+}
+
 double FFTFrame::extractAverageGroupDelay()
 {
     float* realP = realData();

Modified: trunk/Source/WebCore/platform/audio/FFTFrameStub.cpp (267382 => 267383)


--- trunk/Source/WebCore/platform/audio/FFTFrameStub.cpp	2020-09-21 23:25:25 UTC (rev 267382)
+++ trunk/Source/WebCore/platform/audio/FFTFrameStub.cpp	2020-09-21 23:27:50 UTC (rev 267383)
@@ -64,11 +64,6 @@
     ASSERT_NOT_REACHED();
 }
 
-void FFTFrame::multiply(const FFTFrame& frame)
-{
-    ASSERT_NOT_REACHED();
-}
-
 void FFTFrame::doFFT(const float* data)
 {
     ASSERT_NOT_REACHED();

Modified: trunk/Source/WebCore/platform/audio/gstreamer/FFTFrameGStreamer.cpp (267382 => 267383)


--- trunk/Source/WebCore/platform/audio/gstreamer/FFTFrameGStreamer.cpp	2020-09-21 23:25:25 UTC (rev 267382)
+++ trunk/Source/WebCore/platform/audio/gstreamer/FFTFrameGStreamer.cpp	2020-09-21 23:27:50 UTC (rev 267383)
@@ -103,46 +103,9 @@
     m_inverseFft = 0;
 }
 
-void FFTFrame::multiply(const FFTFrame& frame)
-{
-    FFTFrame& frame1 = *this;
-    FFTFrame& frame2 = const_cast<FFTFrame&>(frame);
-
-    float* realP1 = frame1.realData();
-    float* imagP1 = frame1.imagData();
-    const float* realP2 = frame2.realData();
-    const float* imagP2 = frame2.imagData();
-
-    size_t size = unpackedFFTDataSize(m_FFTSize);
-    VectorMath::zvmul(realP1, imagP1, realP2, imagP2, realP1, imagP1, size);
-
-    // Scale accounts the peculiar scaling of vecLib on the Mac.
-    // This ensures the right scaling all the way back to inverse FFT.
-    // FIXME: if we change the scaling on the Mac then this scale
-    // factor will need to change too.
-    float scale = 0.5f;
-
-    VectorMath::vsmul(realP1, 1, &scale, realP1, 1, size);
-    VectorMath::vsmul(imagP1, 1, &scale, imagP1, 1, size);
-}
-
 void FFTFrame::doFFT(const float* data)
 {
     gst_fft_f32_fft(m_fft, data, m_complexData.get());
-
-    // Scale the frequency domain data to match vecLib's scale factor
-    // on the Mac. FIXME: if we change the definition of FFTFrame to
-    // eliminate this scale factor then this code will need to change.
-    // Also, if this loop turns out to be hot then we should use SSE
-    // or other intrinsics to accelerate it.
-    float scaleFactor = 2;
-
-    float* imagData = m_imagData.data();
-    float* realData = m_realData.data();
-    for (unsigned i = 0; i < unpackedFFTDataSize(m_FFTSize); ++i) {
-        imagData[i] = m_complexData[i].i * scaleFactor;
-        realData[i] = m_complexData[i].r * scaleFactor;
-    }
 }
 
 void FFTFrame::doInverseFFT(float* data)
@@ -159,7 +122,7 @@
     gst_fft_f32_inverse_fft(m_inverseFft, m_complexData.get(), data);
 
     // Scale so that a forward then inverse FFT yields exactly the original data.
-    const float scaleFactor = 1.0 / (2 * m_FFTSize);
+    const float scaleFactor = 1.0 / m_FFTSize;
     VectorMath::vsmul(data, 1, &scaleFactor, data, 1, m_FFTSize);
 }
 

Modified: trunk/Source/WebCore/platform/audio/mac/FFTFrameMac.cpp (267382 => 267383)


--- trunk/Source/WebCore/platform/audio/mac/FFTFrameMac.cpp	2020-09-21 23:25:25 UTC (rev 267382)
+++ trunk/Source/WebCore/platform/audio/mac/FFTFrameMac.cpp	2020-09-21 23:27:50 UTC (rev 267383)
@@ -97,41 +97,23 @@
 
 FFTFrame::~FFTFrame() = default;
 
-void FFTFrame::multiply(const FFTFrame& frame)
+void FFTFrame::doFFT(const float* data)
 {
-    FFTFrame& frame1 = *this;
-    const FFTFrame& frame2 = frame;
-
-    float* realP1 = frame1.realData();
-    float* imagP1 = frame1.imagData();
-    const float* realP2 = frame2.realData();
-    const float* imagP2 = frame2.imagData();
-
     unsigned halfSize = m_FFTSize / 2;
-    float real0 = realP1[0];
-    float imag0 = imagP1[0];
+    vDSP_ctoz(reinterpret_cast<const DSPComplex*>(data), 2, &m_frame, 1, halfSize);
+    vDSP_fft_zrip(m_FFTSetup, &m_frame, 1, m_log2FFTSize, FFT_FORWARD);
 
-    // Complex multiply
-    VectorMath::zvmul(realP1, imagP1, realP2, imagP2, realP1, imagP1, halfSize); 
-
-    // Multiply the packed DC/nyquist component
-    realP1[0] = real0 * realP2[0];
-    imagP1[0] = imag0 * imagP2[0];
-
-    // Scale accounts for vecLib's peculiar scaling
-    // This ensures the right scaling all the way back to inverse FFT
+    // To provide the best possible execution speeds, the vDSP library's functions don't always adhere strictly
+    // to textbook formulas for Fourier transforms, and must be scaled accordingly.
+    // (See https://developer.apple.com/library/archive/documentation/Performance/Conceptual/vDSP_Programming_Guide/UsingFourierTransforms/UsingFourierTransforms.html#//apple_ref/doc/uid/TP40005147-CH3-SW5)
+    // In the case of a Real forward Transform like above: RFimp = RFmath * 2 so we need to divide the output
+    // by 2 to get the correct value.
     float scale = 0.5f;
 
-    VectorMath::vsmul(realP1, 1, &scale, realP1, 1, halfSize);
-    VectorMath::vsmul(imagP1, 1, &scale, imagP1, 1, halfSize);
+    VectorMath::vsmul(realData(), 1, &scale, realData(), 1, halfSize);
+    VectorMath::vsmul(imagData(), 1, &scale, imagData(), 1, halfSize);
 }
 
-void FFTFrame::doFFT(const float* data)
-{
-    vDSP_ctoz(reinterpret_cast<const DSPComplex*>(data), 2, &m_frame, 1, m_FFTSize / 2);
-    vDSP_fft_zrip(m_FFTSetup, &m_frame, 1, m_log2FFTSize, FFT_FORWARD);
-}
-
 void FFTFrame::doInverseFFT(float* data)
 {
     vDSP_fft_zrip(m_FFTSetup, &m_frame, 1, m_log2FFTSize, FFT_INVERSE);
@@ -138,8 +120,8 @@
     vDSP_ztoc(&m_frame, 1, (DSPComplex*)data, 2, m_FFTSize / 2);
 
     // Do final scaling so that x == IFFT(FFT(x))
-    float scale = 0.5f / m_FFTSize;
-    vDSP_vsmul(data, 1, &scale, data, 1, m_FFTSize);
+    float scale = 1.0f / m_FFTSize;
+    VectorMath::vsmul(data, 1, &scale, data, 1, m_FFTSize);
 }
 
 FFTSetup FFTFrame::fftSetupForSize(unsigned fftSize)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to