⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 267383 in webkit


Ignore:
Timestamp:
Sep 21, 2020, 4:27:50 PM (6 years ago)
Author:
Chris Dumez
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:

  • 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
Location:
trunk
Files:
2 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r267381 r267383  
     12020-09-21  Chris Dumez  <cdumez@apple.com>
     2
     3        Values returned by FFTFrame::doFFT() are twice as large as they should be
     4        https://bugs.webkit.org/show_bug.cgi?id=216781
     5
     6        Reviewed by Darin Adler.
     7
     8        * webaudio/Analyser/realtimeanalyser-downmix-expected.txt:
     9        * webaudio/Analyser/realtimeanalyser-freq-data-expected.txt:
     10        * webaudio/Analyser/realtimeanalyser-freq-data-smoothing-expected.txt:
     11        * webaudio/Analyser/realtimeanalyser-multiple-calls-expected.txt:
     12        Rebaseline tests that are passing now that the bug has been fixed.
     13
     14        * webaudio/realtimeanalyser-fft-scaling-expected.txt: Removed.
     15        * webaudio/realtimeanalyser-fft-scaling.html: Removed.
     16        Drop outdated test. This test was imported into WPT and now resides at:
     17        - imported/w3c/web-platform-tests/webaudio/the-audio-api/the-analysernode-interface/realtimeanalyser-fft-scaling.html
     18
    1192020-09-21  Chris Dumez  <cdumez@apple.com>
    220
  • trunk/LayoutTests/TestExpectations

    r267357 r267383  
    331331imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiobuffersourcenode-interface/sub-sample-buffer-stitching.html [ Pass Failure ]
    332332webaudio/Analyser/handle-silent-inputs.html [ Pass Failure ]
    333 webaudio/Analyser/realtimeanalyser-fftsize-reset.html [ Pass Failure ]
    334 webaudio/Analyser/realtimeanalyser-freq-data-smoothing.html [ Pass Failure ]
    335 webaudio/Analyser/realtimeanalyser-freq-data.html [ Pass Failure ]
    336 webaudio/Analyser/realtimeanalyser-multiple-calls.html [ Pass Failure ]
    337333webaudio/AudioBufferSource/audiobuffersource-detune-modulation.html [ Pass Failure ]
    338334webaudio/AudioBufferSource/audiobuffersource-playbackrate-modulation.html [ Pass Failure ]
  • trunk/LayoutTests/platform/mac/TestExpectations

    r267314 r267383  
    16171617# <rdar://problem/47088939>
    16181618imported/w3c/web-platform-tests/webaudio/the-audio-api/the-mediaelementaudiosourcenode-interface/mediaElementAudioSourceToScriptProcessorTest.html  [ Failure ]
    1619 webaudio/realtimeanalyser-fft-scaling.html [ Pass Failure ]
    16201619webaudio/oscillator-sine.html [ Skip ]
    16211620
  • trunk/LayoutTests/webaudio/Analyser/realtimeanalyser-downmix-expected.txt

    r267346 r267383  
    99PASS > [mono] 
    1010PASS   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...].
    11 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}.
    12         Index   Actual                  Expected                AbsError                RelError                Test threshold
    13         [0]     -1.5144139528274536e+0  -7.5350136756896973e+0  6.0205997228622437e+0   7.9901642943085494e-1   4.7683827043867111e-7
    14         [1]     -6.0206003189086914e+0  -1.2041200637817383e+1  6.0206003189086914e+0   5.0000000000000000e-1   7.6200329996299745e-7
    15         [2]     -2.1938199996948242e+1  -2.7958801269531250e+1  6.0206012725830078e+0   2.1533831921270877e-1   1.7693168207397460e-6
    16         Max AbsError of 6.0206012725830078e+0 at index of 2.
    17         Max RelError of 7.9901642943085494e-1 at index of 0.
    18  assert_true: expected true got false
    19 FAIL < [mono] 1 out of 2 assertions were failed. assert_true: expected true got false
     11PASS   Analyser downmix mono to mono freq data equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":6.3283e-8}.
     12PASS < [mono] All assertions passed. (total 2 assertions)
    2013PASS > [stereo] 
    2114PASS   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...].
    22 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}.
    23         Index   Actual                  Expected                AbsError                RelError                Test threshold
    24         [0]     6.4443855285644531e+0   4.2378559708595276e-1   6.0205999314785004e+0   1.4206712009274337e+1   4.9502395595610142e-8
    25         [1]     1.9382002353668213e+0   -4.0823998451232910e+0  6.0206000804901123e+0   1.4747698189539507e+0   4.7686512590885159e-7
    26         [2]     -1.3979400634765625e+1  -2.0000000000000000e+1  6.0205993652343750e+0   3.0102996826171874e-1   2.3361999999999998e-6
    27         Max AbsError of 6.0206000804901123e+0 at index of 1.
    28         Max RelError of 1.4206712009274337e+1 at index of 0.
    29  assert_true: expected true got false
    30 FAIL < [stereo] 1 out of 2 assertions were failed. assert_true: expected true got false
     15PASS   Analyser downmix stereo to mono freq data equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":1.1681e-7}.
     16PASS < [stereo] All assertions passed. (total 2 assertions)
    3117PASS > [quad] 
    3218PASS   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...].
    33 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}.
    34         Index   Actual                  Expected                AbsError                RelError                Test threshold
    35         [0]     1.5986810684204102e+1   9.9662113189697266e+0   6.0205993652343750e+0   6.0410111451025950e-1   4.9624756020545961e-6
    36         [1]     1.1480626106262207e+1   5.4600248336791992e+0   6.0206012725830078e+0   1.1026692104852696e+0   2.7187101654338836e-6
    37         [2]     -4.4369745254516602e+0  -1.0457574844360352e+1  6.0206003189086914e+0   5.7571668465328085e-1   5.2071402422523503e-6
    38         Max AbsError of 6.0206012725830078e+0 at index of 1.
    39         Max RelError of 1.1026692104852696e+0 at index of 1.
    40  assert_true: expected true got false
    41 FAIL < [quad] 1 out of 2 assertions were failed. assert_true: expected true got false
     19PASS   Analyser downmix quad to mono freq data equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":4.9793e-7}.
     20PASS < [quad] All assertions passed. (total 2 assertions)
    4221PASS > [5.1] 
    4322PASS   Analyser downmix 5.1 to mono time data is identical to the array [expected array].
    44 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}.
    45         Index   Actual                  Expected                AbsError                RelError                Test threshold
    46         [0]     3.1162130355834961e+1   2.5141529083251953e+1   6.0206012725830078e+0   2.3946838128447945e-1   5.0823601041793820e-6
    47         [1]     2.6655942916870117e+1   2.0635343551635742e+1   6.0205993652343750e+0   2.9176152799051064e-1   4.1714346989631653e-6
    48         [2]     1.0738344192504883e+1   4.7177438735961914e+0   6.0206003189086914e+0   1.2761609108549110e+0   9.5369192404747006e-7
    49         Max AbsError of 6.0206012725830078e+0 at index of 0.
    50         Max RelError of 1.2761609108549110e+0 at index of 2.
    51  assert_true: expected true got false
    52 FAIL < [5.1] 1 out of 2 assertions were failed. assert_true: expected true got false
     23PASS   Analyser downmix 5.1 to mono freq data equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":2.0215e-7}.
     24PASS < [5.1] All assertions passed. (total 2 assertions)
    5325PASS > [3-channel] 
    5426PASS   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...].
    55 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}.
    56         Index   Actual                  Expected                AbsError                RelError                Test threshold
    57         [0]     -1.5144139528274536e+0  -7.5350136756896973e+0  6.0205997228622437e+0   7.9901642943085494e-1   4.7683827043867111e-7
    58         [1]     -6.0206003189086914e+0  -1.2041200637817383e+1  6.0206003189086914e+0   5.0000000000000000e-1   7.6200329996299745e-7
    59         [2]     -2.1938199996948242e+1  -2.7958801269531250e+1  6.0206012725830078e+0   2.1533831921270877e-1   1.7693168207397460e-6
    60         Max AbsError of 6.0206012725830078e+0 at index of 2.
    61         Max RelError of 7.9901642943085494e-1 at index of 0.
    62  assert_true: expected true got false
    63 FAIL < [3-channel] 1 out of 2 assertions were failed. assert_true: expected true got false
    64 FAIL # AUDIT TASK RUNNER FINISHED: 5 out of 5 tasks were failed. assert_true: expected true got false
     27PASS   Analyser downmix 3-channel to mono freq data equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":6.3283e-8}.
     28PASS < [3-channel] All assertions passed. (total 2 assertions)
     29PASS # AUDIT TASK RUNNER FINISHED: 5 tasks ran successfully.
    6530
  • trunk/LayoutTests/webaudio/Analyser/realtimeanalyser-freq-data-expected.txt

    r267245 r267383  
    1515PASS Audit report
    1616PASS > [5-order FFT] 
    17 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}.
    18         Index   Actual                  Expected                AbsError                RelError                Test threshold
    19         [0]     -3.1946636199951172e+1  -3.7967235565185547e+1  6.0205993652343750e+0   1.5857355100024786e-1   3.6656986265830997e-5
    20         [1]     -8.8057880401611328e+0  -1.4826388359069824e+1  6.0206003189086914e+0   4.0607329128982905e-1   1.4314729696798325e-5
    21         [2]     -9.5396375656127930e+0  -1.5560236930847168e+1  6.0205993652343750e+0   3.8692208813986145e-1   1.5023253154363634e-5
    22         [3]     -1.3862863540649414e+1  -1.9883462905883789e+1  6.0205993652343750e+0   3.0279430669256296e-1   1.9197284601001741e-5
    23         [4]     -1.6865795135498047e+1  -2.2886396408081055e+1  6.0206012725830078e+0   2.6306462429608046e-1   2.2096586868038178e-5
    24         ...and 11 more errors.
    25         Max AbsError of 6.0206184387207031e+0 at index of 15.
    26         [15]    -4.9294147491455078e+1  -5.5314765930175781e+1  6.0206184387207031e+0   1.0884288015103548e-1   5.3405853357925415e-5
    27         Max RelError of 4.0607329128982905e-1 at index of 1.
    28  assert_true: expected true got false
     17PASS   32-point float FFT equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":9.6549e-7}.
    2918PASS   Order: 5: Min FFT value is less than or equal to -50.
    3019PASS   Order: 5: Max FFT value is greater than or equal to -30.
    31 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}.
    32         Index   Actual                  Expected                AbsError                RelError                Test threshold
    33         [0]     2.3000000000000000e+2   1.5300000000000000e+2   7.7000000000000000e+1   5.0326797385620914e-1   0.0000000000000000e+0
    34         [9]     2.5500000000000000e+2   2.4900000000000000e+2   6.0000000000000000e+0   2.4096385542168676e-2   0.0000000000000000e+0
    35         [10]    2.5500000000000000e+2   2.3300000000000000e+2   2.2000000000000000e+1   9.4420600858369105e-2   0.0000000000000000e+0
    36         [11]    2.5500000000000000e+2   2.0700000000000000e+2   4.8000000000000000e+1   2.3188405797101450e-1   0.0000000000000000e+0
    37         [12]    2.5500000000000000e+2   1.7800000000000000e+2   7.7000000000000000e+1   4.3258426966292135e-1   0.0000000000000000e+0
    38         ...and 3 more errors.
    39         Max AbsError of 7.7000000000000000e+1 at index of 0.
    40         Max RelError of Infinity at index of 15.
    41         [15]    8.0000000000000000e+0   0.0000000000000000e+0   8.0000000000000000e+0   Infinity        0.0000000000000000e+0
    42  assert_true: expected true got false
    43 FAIL < [5-order FFT] 2 out of 4 assertions were failed. assert_true: expected true got false
     20PASS   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}.
     21PASS < [5-order FFT] All assertions passed. (total 4 assertions)
    4422PASS > [6-order FFT] 
    45 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}.
    46         Index   Actual                  Expected                AbsError                RelError                Test threshold
    47         [0]     -9.8853721618652344e+0  -1.5905972480773926e+1  6.0206003189086914e+0   3.7851192853413962e-1   1.6039582649612428e-4
    48         [1]     -1.1134060859680176e+1  -1.7154661178588867e+1  6.0206003189086914e+0   3.5096002516348984e-1   1.7298760332489014e-4
    49         [2]     -1.6990945816040039e+1  -2.3011545181274414e+1  6.0205993652343750e+0   2.6163385890894553e-1   2.3204842160797119e-4
    50         [3]     -2.4007926940917969e+1  -3.0028526306152344e+1  6.0205993652343750e+0   2.0049599849996150e-1   3.0280765927124024e-4
    51         [4]     -2.6344022750854492e+1  -3.2364620208740234e+1  6.0205974578857422e+0   1.8602404165582789e-1   3.2636483018493652e-4
    52         ...and 26 more errors.
    53         Max AbsError of 6.0214920043945313e+0 at index of 30.
    54         [30]    -8.3255996704101563e+1  -8.9277488708496094e+1  6.0214920043945313e+0   6.7446924095900293e-2   9.0027419613647464e-4
    55         Max RelError of 3.7851192853413962e-1 at index of 0.
    56  assert_true: expected true got false
     23PASS   64-point float FFT equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0.000010084}.
    5724PASS   Order: 6: Min FFT value is less than or equal to -100.
    5825PASS   Order: 6: Max FFT value is greater than or equal to -30.
    59 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}.
    60         Index   Actual                  Expected                AbsError                RelError                Test threshold
    61         [3]     2.5500000000000000e+2   2.5400000000000000e+2   1.0000000000000000e+0   3.9370078740157480e-3   0.0000000000000000e+0
    62         [4]     2.5500000000000000e+2   2.4600000000000000e+2   9.0000000000000000e+0   3.6585365853658534e-2   0.0000000000000000e+0
    63         [5]     2.5500000000000000e+2   2.3900000000000000e+2   1.6000000000000000e+1   6.6945606694560664e-2   0.0000000000000000e+0
    64         [6]     2.5500000000000000e+2   2.3300000000000000e+2   2.2000000000000000e+1   9.4420600858369105e-2   0.0000000000000000e+0
    65         [7]     2.5000000000000000e+2   2.2800000000000000e+2   2.2000000000000000e+1   9.6491228070175433e-2   0.0000000000000000e+0
    66         ...and 23 more errors.
    67         Max AbsError of 2.2000000000000000e+1 at index of 6.
    68         Max RelError of 5.3846153846153844e-1 at index of 30.
    69         [30]    6.0000000000000000e+1   3.9000000000000000e+1   2.1000000000000000e+1   5.3846153846153844e-1   0.0000000000000000e+0
    70  assert_true: expected true got false
    71 FAIL < [6-order FFT] 2 out of 4 assertions were failed. assert_true: expected true got false
     26PASS   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}.
     27PASS < [6-order FFT] All assertions passed. (total 4 assertions)
    7228PASS > [7-order FFT] 
    73 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}.
    74         Index   Actual                  Expected                AbsError                RelError                Test threshold
    75         [0]     -2.3485050201416016e+1  -2.9505649566650391e+1  6.0205993652343750e+0   2.0404903649500841e-1   3.3851831747817991e-5
    76         [1]     -1.5231506347656250e+1  -2.1252105712890625e+1  6.0205993652343750e+0   2.8329425077076176e-1   2.4382540884399415e-5
    77         [2]     -1.4133201599121094e+1  -2.0153800964355469e+1  6.0205993652343750e+0   2.9873269939911395e-1   2.3122455846405029e-5
    78         [3]     -2.1864795684814453e+1  -2.7885395050048828e+1  6.0205993652343750e+0   2.1590511285311101e-1   3.1992913740921022e-5
    79         [4]     -2.2982843399047852e+1  -2.9003442764282227e+1  6.0205993652343750e+0   2.0758223132905967e-1   3.3275649883461000e-5
    80         ...and 53 more errors.
    81         Max AbsError of 6.0206222534179688e+0 at index of 47.
    82         [47]    -4.9437217712402344e+1  -5.5457839965820313e+1  6.0206222534179688e+0   1.0856214841992745e-1   6.3626779792785645e-5
    83         Max RelError of 2.9873269939911395e-1 at index of 2.
    84  assert_true: expected true got false
     29PASS   128-point float FFT equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0.0000011473}.
    8530PASS   Order: 7: Min FFT value is less than or equal to -100.
    8631PASS   Order: 7: Max FFT value is greater than or equal to -30.
    87 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}.
    88         Index   Actual                  Expected                AbsError                RelError                Test threshold
    89         [5]     2.5500000000000000e+2   2.4900000000000000e+2   6.0000000000000000e+0   2.4096385542168676e-2   0.0000000000000000e+0
    90         [6]     2.5500000000000000e+2   2.3900000000000000e+2   1.6000000000000000e+1   6.6945606694560664e-2   0.0000000000000000e+0
    91         [7]     2.5500000000000000e+2   2.4200000000000000e+2   1.3000000000000000e+1   5.3719008264462811e-2   0.0000000000000000e+0
    92         [8]     2.5100000000000000e+2   2.2900000000000000e+2   2.2000000000000000e+1   9.6069868995633190e-2   0.0000000000000000e+0
    93         [9]     2.5400000000000000e+2   2.3200000000000000e+2   2.2000000000000000e+1   9.4827586206896547e-2   0.0000000000000000e+0
    94         ...and 48 more errors.
    95         Max AbsError of 2.2000000000000000e+1 at index of 8.
    96         Max RelError of 2.2680412371134021e-1 at index of 57.
    97         [57]    1.1900000000000000e+2   9.7000000000000000e+1   2.2000000000000000e+1   2.2680412371134021e-1   0.0000000000000000e+0
    98  assert_true: expected true got false
    99 FAIL < [7-order FFT] 2 out of 4 assertions were failed. assert_true: expected true got false
     32PASS   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}.
     33PASS < [7-order FFT] All assertions passed. (total 4 assertions)
    10034PASS > [8-order FFT] 
    101 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}.
    102         Index   Actual                  Expected                AbsError                RelError                Test threshold
    103         [0]     -6.5931510925292969e+1  -7.1952117919921875e+1  6.0206069946289063e+0   8.3675188009468437e-2   7.5132401531982426e-5
    104         [1]     -4.7572326660156250e+1  -5.3592926025390625e+1  6.0205993652343750e+0   1.1233944126099789e-1   5.5961733355712896e-5
    105         [2]     -2.2549179077148438e+1  -2.8569780349731445e+1  6.0206012725830078e+0   2.1073320126661740e-1   2.9832564641189577e-5
    106         [3]     -1.3727722167968750e+1  -1.9748321533203125e+1  6.0205993652343750e+0   3.0486638346007577e-1   2.0621197344970705e-5
    107         [4]     -1.4273233413696289e+1  -2.0293832778930664e+1  6.0205993652343750e+0   2.9667137946879329e-1   2.1190820187759400e-5
    108         ...and 108 more errors.
    109         Max AbsError of 6.0206260681152344e+0 at index of 101.
    110         [101]   -5.3410911560058594e+1  -5.9431537628173828e+1  6.0206260681152344e+0   1.0130355545876245e-1   6.2058411591339117e-5
    111         Max RelError of 3.0486638346007577e-1 at index of 3.
    112  assert_true: expected true got false
     35PASS   256-point float FFT equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0.0000010442}.
    11336PASS   Order: 8: Min FFT value is less than or equal to -100.
    11437PASS   Order: 8: Max FFT value is greater than or equal to -30.
    115 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}.
    116         Index   Actual                  Expected                AbsError                RelError                Test threshold
    117         [0]     1.2400000000000000e+2   1.0200000000000000e+2   2.2000000000000000e+1   2.1568627450980393e-1   0.0000000000000000e+0
    118         [1]     1.9000000000000000e+2   1.6900000000000000e+2   2.1000000000000000e+1   1.2426035502958580e-1   0.0000000000000000e+0
    119         [8]     2.5500000000000000e+2   2.5200000000000000e+2   3.0000000000000000e+0   1.1904761904761904e-2   0.0000000000000000e+0
    120         [9]     2.5500000000000000e+2   2.3300000000000000e+2   2.2000000000000000e+1   9.4420600858369105e-2   0.0000000000000000e+0
    121         [11]    2.5500000000000000e+2   2.5300000000000000e+2   2.0000000000000000e+0   7.9051383399209481e-3   0.0000000000000000e+0
    122         ...and 101 more errors.
    123         Max AbsError of 2.2000000000000000e+1 at index of 0.
    124         Max RelError of 2.2448979591836735e-1 at index of 112.
    125         [112]   1.2000000000000000e+2   9.8000000000000000e+1   2.2000000000000000e+1   2.2448979591836735e-1   0.0000000000000000e+0
    126  assert_true: expected true got false
    127 FAIL < [8-order FFT] 2 out of 4 assertions were failed. assert_true: expected true got false
     38PASS   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}.
     39PASS < [8-order FFT] All assertions passed. (total 4 assertions)
    12840PASS > [9-order FFT] 
    129 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}.
    130         Index   Actual                  Expected                AbsError                RelError                Test threshold
    131         [0]     -9.3714294433593750e+1  -9.9734115600585938e+1  6.0198211669921875e+0   6.0358696026345686e-2   2.6356734729766846e-3
    132         [1]     -8.9554412841796875e+1  -9.5575897216796875e+1  6.0214843750000000e+0   6.3002122400602073e-2   2.5257842357482908e-3
    133         [2]     -8.4020469665527344e+1  -9.0041526794433594e+1  6.0210571289062500e+0   6.6869780458659156e-2   2.3795274285964966e-3
    134         [3]     -8.0145050048828125e+1  -8.6165939331054688e+1  6.0208892822265625e+0   6.9875513793146798e-2   2.2771072787017821e-3
    135         [4]     -7.6101112365722656e+1  -8.2121688842773438e+1  6.0205764770507813e+0   7.3312867305706672e-2   2.1702298710479734e-3
    136         ...and 204 more errors.
    137         Max AbsError of 6.0220336914062500e+0 at index of 141.
    138         [141]   -9.2915489196777344e+1  -9.8937522888183594e+1  6.0220336914062500e+0   6.0867035232044196e-2   2.6146219173660279e-3
    139         Max RelError of 3.1731020640109486e-1 at index of 7.
    140         [7]     -1.2953260421752930e+1  -1.8973859786987305e+1  6.0205993652343750e+0   3.1731020640109486e-1   5.0142219259071352e-4
    141  assert_true: expected true got false
     41PASS   512-point float FFT equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0.000026427}.
    14242PASS   Order: 9: Min FFT value is less than or equal to -100.
    14343PASS   Order: 9: Max FFT value is greater than or equal to -30.
    144 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}.
    145         Index   Actual                  Expected                AbsError                RelError                Test threshold
    146         [0]     2.2000000000000000e+1   0.0000000000000000e+0   2.2000000000000000e+1   Infinity        0.0000000000000000e+0
    147         [1]     3.8000000000000000e+1   1.6000000000000000e+1   2.2000000000000000e+1   1.3750000000000000e+0   0.0000000000000000e+0
    148         [2]     5.8000000000000000e+1   3.6000000000000000e+1   2.2000000000000000e+1   6.1111111111111116e-1   0.0000000000000000e+0
    149         [3]     7.2000000000000000e+1   5.0000000000000000e+1   2.2000000000000000e+1   4.4000000000000000e-1   0.0000000000000000e+0
    150         [4]     8.7000000000000000e+1   6.5000000000000000e+1   2.2000000000000000e+1   3.3846153846153848e-1   0.0000000000000000e+0
    151         ...and 198 more errors.
    152         Max AbsError of 2.2000000000000000e+1 at index of 0.
    153         Max RelError of Infinity at index of 0.
    154  assert_true: expected true got false
    155 FAIL < [9-order FFT] 2 out of 4 assertions were failed. assert_true: expected true got false
     44PASS   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}.
     45PASS < [9-order FFT] All assertions passed. (total 4 assertions)
    15646PASS > [10-order FFT] 
    157 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}.
    158         Index   Actual                  Expected                AbsError                RelError                Test threshold
    159         [0]     -9.9746253967285156e+1  -1.0000000000000000e+2  2.5374603271484375e-1   2.5374603271484373e-3   2.9770999999999999e-3
    160         [1]     -9.9217491149902344e+1  -1.0000000000000000e+2  7.8250885009765625e-1   7.8250885009765632e-3   2.9770999999999999e-3
    161         [2]     -9.7794502258300781e+1  -1.0000000000000000e+2  2.2054977416992188e+0   2.2054977416992187e-2   2.9770999999999999e-3
    162         [3]     -9.5761108398437500e+1  -1.0000000000000000e+2  4.2388916015625000e+0   4.2388916015625000e-2   2.9770999999999999e-3
    163         [4]     -9.3331230163574219e+1  -9.9351524353027344e+1  6.0202941894531250e+0   6.0595891493935398e-2   2.9577942315139770e-3
    164         ...and 285 more errors.
    165         Max AbsError of 6.0214080810546875e+0 at index of 46.
    166         [46]    -8.6186645507812500e+1  -9.2208053588867188e+1  6.0214080810546875e+0   6.5302409569370709e-2   2.7451259633941650e-3
    167         Max RelError of 3.1393576554320829e-1 at index of 14.
    168         [14]    -1.3157211303710938e+1  -1.9177812576293945e+1  6.0206012725830078e+0   3.1393576554320829e-1   5.7094265820884708e-4
    169  assert_true: expected true got false
     47PASS   1024-point float FFT equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0.000029771}.
    17048PASS   Order: 10: Min FFT value is less than or equal to -100.
    17149PASS   Order: 10: Max FFT value is greater than or equal to -30.
    172 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}.
    173         Index   Actual                  Expected                AbsError                RelError                Test threshold
    174         [1]     2.0000000000000000e+0   0.0000000000000000e+0   2.0000000000000000e+0   Infinity        1.0000000000000000e+0
    175         [2]     8.0000000000000000e+0   0.0000000000000000e+0   8.0000000000000000e+0   Infinity        1.0000000000000000e+0
    176         [3]     1.5000000000000000e+1   0.0000000000000000e+0   1.5000000000000000e+1   Infinity        1.0000000000000000e+0
    177         [4]     2.4000000000000000e+1   2.0000000000000000e+0   2.2000000000000000e+1   1.1000000000000000e+1   1.0000000000000000e+0
    178         [5]     3.4000000000000000e+1   1.2000000000000000e+1   2.2000000000000000e+1   1.8333333333333333e+0   1.0000000000000000e+0
    179         ...and 273 more errors.
    180         Max AbsError of 2.2000000000000000e+1 at index of 4.
    181         Max RelError of Infinity at index of 1.
    182  assert_true: expected true got false
    183 FAIL < [10-order FFT] 2 out of 4 assertions were failed. assert_true: expected true got false
     50PASS   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}.
     51PASS < [10-order FFT] All assertions passed. (total 4 assertions)
    18452PASS > [11-order FFT] 
    185 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}.
    186         Index   Actual                  Expected                AbsError                RelError                Test threshold
    187         [13]    -9.9615356445312500e+1  -1.0000000000000000e+2  3.8464355468750000e-1   3.8464355468750002e-3   1.3456000000000000e-3
    188         [14]    -9.7888046264648438e+1  -1.0000000000000000e+2  2.1119537353515625e+0   2.1119537353515624e-2   1.3456000000000000e-3
    189         [15]    -9.6002113342285156e+1  -1.0000000000000000e+2  3.9978866577148438e+0   3.9978866577148435e-2   1.3456000000000000e-3
    190         [16]    -9.3944313049316406e+1  -9.9964843750000000e+1  6.0205307006835938e+0   6.0226480378844122e-2   1.3451269375000000e-3
    191         [17]    -9.1689773559570313e+1  -9.7709945678710938e+1  6.0201721191406250e+0   6.1612685150149470e-2   1.3147850290527343e-3
    192         ...and 270 more errors.
    193         Max AbsError of 6.0212173461914063e+0 at index of 251.
    194         [251]   -9.0205146789550781e+1  -9.6226364135742188e+1  6.0212173461914063e+0   6.2573468303318072e-2   1.2948219558105468e-3
    195         Max RelError of 3.0097867499425746e-1 at index of 28.
    196         [28]    -1.3982809066772461e+1  -2.0003408432006836e+1  6.0205993652343750e+0   3.0097867499425746e-1   2.6916586386108399e-4
    197  assert_true: expected true got false
     53PASS   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}.
    19854PASS   Order: 11: Min FFT value is less than or equal to -100.
    19955PASS   Order: 11: Max FFT value is greater than or equal to -30.
    200 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}.
    201         Index   Actual                  Expected                AbsError                RelError                Test threshold
    202         [13]    1.0000000000000000e+0   0.0000000000000000e+0   1.0000000000000000e+0   Infinity        0.0000000000000000e+0
    203         [14]    7.0000000000000000e+0   0.0000000000000000e+0   7.0000000000000000e+0   Infinity        0.0000000000000000e+0
    204         [15]    1.4000000000000000e+1   0.0000000000000000e+0   1.4000000000000000e+1   Infinity        0.0000000000000000e+0
    205         [16]    2.2000000000000000e+1   0.0000000000000000e+0   2.2000000000000000e+1   Infinity        0.0000000000000000e+0
    206         [17]    3.0000000000000000e+1   8.0000000000000000e+0   2.2000000000000000e+1   2.7500000000000000e+0   0.0000000000000000e+0
    207         ...and 259 more errors.
    208         Max AbsError of 2.2000000000000000e+1 at index of 16.
    209         Max RelError of Infinity at index of 13.
    210  assert_true: expected true got false
    211 FAIL < [11-order FFT] 2 out of 4 assertions were failed. assert_true: expected true got false
     56PASS   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}.
     57PASS < [11-order FFT] All assertions passed. (total 4 assertions)
    21258PASS > [12-order FFT] 
    213 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}.
    214         Index   Actual                  Expected                AbsError                RelError                Test threshold
    215         [53]    -3.3307727813720703e+1  -3.9328327178955078e+1  6.0205993652343750e+0   1.5308556953970950e-1   1.8136651361846923e-5
    216         [54]    -1.7390127182006836e+1  -2.3410726547241211e+1  6.0205993652343750e+0   2.5717268334603910e-1   1.0796090654525756e-5
    217         [55]    -1.2883941650390625e+1  -1.8904541015625000e+1  6.0205993652343750e+0   3.1847371275812636e-1   8.7180181347656248e-6
    218         [56]    -1.7390127182006836e+1  -2.3410726547241211e+1  6.0205993652343750e+0   2.5717268334603910e-1   1.0796090654525756e-5
    219         [57]    -3.3307727813720703e+1  -3.9328327178955078e+1  6.0205993652343750e+0   1.5308556953970950e-1   1.8136651361846923e-5
    220         ...and 155 more errors.
    221         Max AbsError of 6.0206222534179688e+0 at index of 1483.
    222         [1483]  -6.5597976684570313e+1  -7.1618598937988281e+1  6.0206222534179688e+0   8.4065066095903210e-2   3.3027633086242678e-5
    223         Max RelError of 3.1847371275812636e-1 at index of 55.
    224  assert_true: expected true got false
     59PASS   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}.
    22560PASS   Order: 12: Min FFT value is less than or equal to -100.
    22661PASS   Order: 12: Max FFT value is greater than or equal to -30.
    227 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}.
    228         Index   Actual                  Expected                AbsError                RelError                Test threshold
    229         [53]    2.4200000000000000e+2   2.2100000000000000e+2   2.1000000000000000e+1   9.5022624434389136e-2   0.0000000000000000e+0
    230         [57]    2.4200000000000000e+2   2.2100000000000000e+2   2.1000000000000000e+1   9.5022624434389136e-2   0.0000000000000000e+0
    231         [108]   2.2100000000000000e+2   1.9900000000000000e+2   2.2000000000000000e+1   1.1055276381909548e-1   0.0000000000000000e+0
    232         [112]   2.2100000000000000e+2   1.9900000000000000e+2   2.2000000000000000e+1   1.1055276381909548e-1   0.0000000000000000e+0
    233         [163]   2.0800000000000000e+2   1.8600000000000000e+2   2.2000000000000000e+1   1.1827956989247312e-1   0.0000000000000000e+0
    234         ...and 148 more errors.
    235         Max AbsError of 2.2000000000000000e+1 at index of 108.
    236         Max RelError of 2.1782178217821782e-1 at index of 1593.
    237         [1593]  1.2300000000000000e+2   1.0100000000000000e+2   2.2000000000000000e+1   2.1782178217821782e-1   0.0000000000000000e+0
    238  assert_true: expected true got false
    239 FAIL < [12-order FFT] 2 out of 4 assertions were failed. assert_true: expected true got false
     62PASS   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}.
     63PASS < [12-order FFT] All assertions passed. (total 4 assertions)
    24064PASS > [13-order FFT] 
    241 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}.
    242         Index   Actual                  Expected                AbsError                RelError                Test threshold
    243         [108]   -3.3307727813720703e+1  -3.9328327178955078e+1  6.0205993652343750e+0   1.5308556953970950e-1   1.2626752724075316e-5
    244         [109]   -1.7390127182006836e+1  -2.3410726547241211e+1  6.0205993652343750e+0   2.5717268334603910e-1   7.5162478652572630e-6
    245         [110]   -1.2883941650390625e+1  -1.8904542922973633e+1  6.0206012725830078e+0   3.1847378151981171e-1   6.0694925508499141e-6
    246         [111]   -1.7390127182006836e+1  -2.3410726547241211e+1  6.0205993652343750e+0   2.5717268334603910e-1   7.5162478652572630e-6
    247         [112]   -3.3307727813720703e+1  -3.9328327178955078e+1  6.0205993652343750e+0   1.5308556953970950e-1   1.2626752724075316e-5
    248         ...and 155 more errors.
    249         Max AbsError of 6.0206146240234375e+0 at index of 2418.
    250         [2418]  -6.0156181335449219e+1  -6.6176795959472656e+1  6.0206146240234375e+0   9.0977729228694043e-2   2.1246722110748292e-5
    251         Max RelError of 3.1847378151981171e-1 at index of 110.
    252  assert_true: expected true got false
     65PASS   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}.
    25366PASS   Order: 13: Min FFT value is less than or equal to -100.
    25467PASS   Order: 13: Max FFT value is greater than or equal to -30.
    255 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}.
    256         Index   Actual                  Expected                AbsError                RelError                Test threshold
    257         [108]   2.4200000000000000e+2   2.2100000000000000e+2   2.1000000000000000e+1   9.5022624434389136e-2   0.0000000000000000e+0
    258         [112]   2.4200000000000000e+2   2.2100000000000000e+2   2.1000000000000000e+1   9.5022624434389136e-2   0.0000000000000000e+0
    259         [218]   2.2100000000000000e+2   1.9900000000000000e+2   2.2000000000000000e+1   1.1055276381909548e-1   0.0000000000000000e+0
    260         [222]   2.2100000000000000e+2   1.9900000000000000e+2   2.2000000000000000e+1   1.1055276381909548e-1   0.0000000000000000e+0
    261         [328]   2.0800000000000000e+2   1.8600000000000000e+2   2.2000000000000000e+1   1.1827956989247312e-1   0.0000000000000000e+0
    262         ...and 148 more errors.
    263         Max AbsError of 2.2000000000000000e+1 at index of 218.
    264         Max RelError of 2.1782178217821782e-1 at index of 3188.
    265         [3188]  1.2300000000000000e+2   1.0100000000000000e+2   2.2000000000000000e+1   2.1782178217821782e-1   0.0000000000000000e+0
    266  assert_true: expected true got false
    267 FAIL < [13-order FFT] 2 out of 4 assertions were failed. assert_true: expected true got false
     68PASS   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}.
     69PASS < [13-order FFT] All assertions passed. (total 4 assertions)
    26870PASS > [14-order FFT] 
    269 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}.
    270         Index   Actual                  Expected                AbsError                RelError                Test threshold
    271         [218]   -3.3307727813720703e+1  -3.9328327178955078e+1  6.0205993652343750e+0   1.5308556953970950e-1   4.6234381431579594e-6
    272         [219]   -1.7390127182006836e+1  -2.3410726547241211e+1  6.0205993652343750e+0   2.5717268334603910e-1   2.7521650128936767e-6
    273         [220]   -1.2883941650390625e+1  -1.8904542922973633e+1  6.0206012725830078e+0   3.1847378151981171e-1   2.2224180660247802e-6
    274         [221]   -1.7390127182006836e+1  -2.3410726547241211e+1  6.0205993652343750e+0   2.5717268334603910e-1   2.7521650128936767e-6
    275         [222]   -3.3307727813720703e+1  -3.9328327178955078e+1  6.0205993652343750e+0   1.5308556953970950e-1   4.6234381431579594e-6
    276         ...and 155 more errors.
    277         Max AbsError of 6.0206069946289063e+0 at index of 5282.
    278         [5282]  -6.0911949157714844e+1  -6.6932556152343750e+1  6.0206069946289063e+0   8.9950352126482849e-2   7.8685913012695310e-6
    279         Max RelError of 3.1847378151981171e-1 at index of 220.
    280  assert_true: expected true got false
     71PASS   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}.
    28172PASS   Order: 14: Min FFT value is less than or equal to -100.
    28273PASS   Order: 14: Max FFT value is greater than or equal to -30.
    283 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}.
    284         Index   Actual                  Expected                AbsError                RelError                Test threshold
    285         [218]   2.4200000000000000e+2   2.2100000000000000e+2   2.1000000000000000e+1   9.5022624434389136e-2   0.0000000000000000e+0
    286         [222]   2.4200000000000000e+2   2.2100000000000000e+2   2.1000000000000000e+1   9.5022624434389136e-2   0.0000000000000000e+0
    287         [438]   2.2100000000000000e+2   1.9900000000000000e+2   2.2000000000000000e+1   1.1055276381909548e-1   0.0000000000000000e+0
    288         [442]   2.2100000000000000e+2   1.9900000000000000e+2   2.2000000000000000e+1   1.1055276381909548e-1   0.0000000000000000e+0
    289         [658]   2.0800000000000000e+2   1.8600000000000000e+2   2.2000000000000000e+1   1.1827956989247312e-1   0.0000000000000000e+0
    290         ...and 148 more errors.
    291         Max AbsError of 2.2000000000000000e+1 at index of 438.
    292         Max RelError of 2.1782178217821782e-1 at index of 6378.
    293         [6378]  1.2300000000000000e+2   1.0100000000000000e+2   2.2000000000000000e+1   2.1782178217821782e-1   0.0000000000000000e+0
    294  assert_true: expected true got false
    295 FAIL < [14-order FFT] 2 out of 4 assertions were failed. assert_true: expected true got false
     74PASS   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}.
     75PASS < [14-order FFT] All assertions passed. (total 4 assertions)
    29676PASS > [15-order FFT] 
    297 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}.
    298         Index   Actual                  Expected                AbsError                RelError                Test threshold
    299         [438]   -3.3307727813720703e+1  -3.9328327178955078e+1  6.0205993652343750e+0   1.5308556953970950e-1   4.6234381431579594e-6
    300         [439]   -1.7390127182006836e+1  -2.3410726547241211e+1  6.0205993652343750e+0   2.5717268334603910e-1   2.7521650128936767e-6
    301         [440]   -1.2883941650390625e+1  -1.8904542922973633e+1  6.0206012725830078e+0   3.1847378151981171e-1   2.2224180660247802e-6
    302         [441]   -1.7390127182006836e+1  -2.3410726547241211e+1  6.0205993652343750e+0   2.5717268334603910e-1   2.7521650128936767e-6
    303         [442]   -3.3307727813720703e+1  -3.9328327178955078e+1  6.0205993652343750e+0   1.5308556953970950e-1   4.6234381431579594e-6
    304         ...and 155 more errors.
    305         Max AbsError of 6.0206069946289063e+0 at index of 11442.
    306         [11442] -6.5270172119140625e+1  -7.1290779113769531e+1  6.0206069946289063e+0   8.4451412503444637e-2   8.3809439926147469e-6
    307         Max RelError of 3.1847378151981171e-1 at index of 440.
    308  assert_true: expected true got false
     77PASS   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}.
    30978PASS   Order: 15: Min FFT value is less than or equal to -100.
    31079PASS   Order: 15: Max FFT value is greater than or equal to -30.
    311 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}.
    312         Index   Actual                  Expected                AbsError                RelError                Test threshold
    313         [438]   2.4200000000000000e+2   2.2100000000000000e+2   2.1000000000000000e+1   9.5022624434389136e-2   0.0000000000000000e+0
    314         [442]   2.4200000000000000e+2   2.2100000000000000e+2   2.1000000000000000e+1   9.5022624434389136e-2   0.0000000000000000e+0
    315         [878]   2.2100000000000000e+2   1.9900000000000000e+2   2.2000000000000000e+1   1.1055276381909548e-1   0.0000000000000000e+0
    316         [882]   2.2100000000000000e+2   1.9900000000000000e+2   2.2000000000000000e+1   1.1055276381909548e-1   0.0000000000000000e+0
    317         [1318]  2.0800000000000000e+2   1.8600000000000000e+2   2.2000000000000000e+1   1.1827956989247312e-1   0.0000000000000000e+0
    318         ...and 148 more errors.
    319         Max AbsError of 2.2000000000000000e+1 at index of 878.
    320         Max RelError of 2.1782178217821782e-1 at index of 12758.
    321         [12758] 1.2300000000000000e+2   1.0100000000000000e+2   2.2000000000000000e+1   2.1782178217821782e-1   0.0000000000000000e+0
    322  assert_true: expected true got false
    323 FAIL < [15-order FFT] 2 out of 4 assertions were failed. assert_true: expected true got false
     80PASS   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}.
     81PASS < [15-order FFT] All assertions passed. (total 4 assertions)
    32482PASS > [no smoothing] 
    325 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}.
    326         Index   Actual                  Expected                AbsError                RelError                Test threshold
    327         [0]     -2.7701099395751953e+1  -3.3721698760986328e+1  6.0205993652343750e+0   1.7853784318243754e-1   5.2889112336730963e-5
    328         [1]     -1.5099936485290527e+1  -2.1120536804199219e+1  6.0206003189086914e+0   2.8505905767090473e-1   3.3125449923706058e-5
    329         [2]     -1.1994299888610840e+1  -1.8014900207519531e+1  6.0206003189086914e+0   3.3420114735887657e-1   2.8254569485473634e-5
    330         [3]     -1.4181670188903809e+1  -2.0202268600463867e+1  6.0205984115600586e+0   2.9801595705057693e-1   3.1685238072967528e-5
    331         [4]     -1.7206560134887695e+1  -2.3227161407470703e+1  6.0206012725830078e+0   2.5920521095817428e-1   3.6429479951477053e-5
    332         ...and 53 more errors.
    333         Max AbsError of 6.0206909179687500e+0 at index of 57.
    334         [57]    -6.6946838378906250e+1  -7.2967529296875000e+1  6.0206909179687500e+0   8.2511919698870770e-2   1.1444227294921876e-4
    335         Max RelError of 3.3420114735887657e-1 at index of 2.
    336  assert_true: expected true got false
    337 FAIL < [no smoothing] 1 out of 1 assertions were failed. assert_true: expected true got false
    338 FAIL # AUDIT TASK RUNNER FINISHED: 12 out of 12 tasks were failed. assert_true: expected true got false
     83PASS   128-point float FFT equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0.0000015684}.
     84PASS < [no smoothing] All assertions passed. (total 1 assertions)
     85PASS # AUDIT TASK RUNNER FINISHED: 12 tasks ran successfully.
    33986
  • trunk/LayoutTests/webaudio/Analyser/realtimeanalyser-freq-data-smoothing-expected.txt

    r267349 r267383  
    44PASS Audit report
    55PASS > [smoothing test] 
    6 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}.
    7         Index   Actual                  Expected                AbsError                RelError                Test threshold
    8         [0]     -9.9734893798828125e+1  -1.0000000000000000e+2  2.6510620117187500e-1   2.6510620117187501e-3   5.9206999999999999e-4
    9         [1]     -9.5575012207031250e+1  -1.0000000000000000e+2  4.4249877929687500e+0   4.4249877929687501e-2   5.9206999999999999e-4
    10         [2]     -9.0041076660156250e+1  -9.6062126159667969e+1  6.0210494995117188e+0   6.2678703254016449e-2   5.6875503035354617e-4
    11         [3]     -8.6165649414062500e+1  -9.2186546325683594e+1  6.0208969116210938e+0   6.5312099775926238e-2   5.4580888483047490e-4
    12         [4]     -8.2121719360351563e+1  -8.8142288208007813e+1  6.0205688476562500e+0   6.8305111769372873e-2   5.2186404579315185e-4
    13         ...and 192 more errors.
    14         Max AbsError of 6.0210494995117188e+0 at index of 2.
    15         Max RelError of 2.4087736120104133e-1 at index of 7.
    16         [7]     -1.8973859786987305e+1  -2.4994459152221680e+1  6.0205993652343750e+0   2.4087736120104133e-1   1.4798469430255890e-4
    17  assert_true: expected true got false
    18 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}.
    19         Index   Actual                  Expected                AbsError                RelError                Test threshold
    20         [1]     1.6000000000000000e+1   0.0000000000000000e+0   1.6000000000000000e+1   Infinity        0.0000000000000000e+0
    21         [2]     3.6000000000000000e+1   1.4000000000000000e+1   2.2000000000000000e+1   1.5714285714285714e+0   0.0000000000000000e+0
    22         [3]     5.0000000000000000e+1   2.8000000000000000e+1   2.2000000000000000e+1   7.8571428571428570e-1   0.0000000000000000e+0
    23         [4]     6.5000000000000000e+1   4.3000000000000000e+1   2.2000000000000000e+1   5.1162790697674421e-1   0.0000000000000000e+0
    24         [5]     2.3100000000000000e+2   2.0900000000000000e+2   2.2000000000000000e+1   1.0526315789473684e-1   0.0000000000000000e+0
    25         ...and 189 more errors.
    26         Max AbsError of 2.2000000000000000e+1 at index of 2.
    27         Max RelError of Infinity at index of 1.
    28  assert_true: expected true got false
    29 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}.
    30         Index   Actual                  Expected                AbsError                RelError                Test threshold
    31         [0]     -8.8532302856445313e+1  -9.4552787780761719e+1  6.0204849243164063e+0   6.3673267236456568e-2   2.3952112200622561e-3
    32         [1]     -8.7115928649902344e+1  -9.3136291503906250e+1  6.0203628540039063e+0   6.4640354010137985e-2   2.3593285363769532e-3
    33         [2]     -8.4055267333984375e+1  -9.0076103210449219e+1  6.0208358764648438e+0   6.6841655687503151e-2   2.2818078465270996e-3
    34         [3]     -8.1192565917968750e+1  -8.7213409423828125e+1  6.0208435058593750e+0   6.9035754313881717e-2   2.2092900875244140e-3
    35         [4]     -7.9531051635742188e+1  -8.5551620483398438e+1  6.0205688476562500e+0   7.0373522016740298e-2   2.1671936500854494e-3
    36         ...and 199 more errors.
    37         Max AbsError of 6.0210571289062500e+0 at index of 183.
    38         [183]   -9.0905830383300781e+1  -9.6926887512207031e+1  6.0210571289062500e+0   6.2119575728127596e-2   2.4553519144592285e-3
    39         Max RelError of 2.8039901674224449e-1 at index of 7.
    40         [7]     -1.5450942993164063e+1  -2.1471542358398438e+1  6.0205993652343750e+0   2.8039901674224449e-1   5.4391711102294929e-4
    41  assert_true: expected true got false
    42 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}.
    43         Index   Actual                  Expected                AbsError                RelError                Test threshold
    44         [0]     4.1000000000000000e+1   1.9000000000000000e+1   2.2000000000000000e+1   1.1578947368421053e+0   0.0000000000000000e+0
    45         [1]     4.6000000000000000e+1   2.5000000000000000e+1   2.1000000000000000e+1   8.3999999999999997e-1   0.0000000000000000e+0
    46         [2]     5.8000000000000000e+1   3.6000000000000000e+1   2.2000000000000000e+1   6.1111111111111116e-1   0.0000000000000000e+0
    47         [3]     6.8000000000000000e+1   4.6000000000000000e+1   2.2000000000000000e+1   4.7826086956521741e-1   0.0000000000000000e+0
    48         [4]     7.4000000000000000e+1   5.2000000000000000e+1   2.2000000000000000e+1   4.2307692307692307e-1   0.0000000000000000e+0
    49         ...and 193 more errors.
    50         Max AbsError of 2.2000000000000000e+1 at index of 0.
    51         Max RelError of Infinity at index of 51.
    52         [51]    1.5000000000000000e+1   0.0000000000000000e+0   1.5000000000000000e+1   Infinity        0.0000000000000000e+0
    53  assert_true: expected true got false
    54 FAIL < [smoothing test] 4 out of 4 assertions were failed. assert_true: expected true got false
    55 FAIL # AUDIT TASK RUNNER FINISHED: 1 out of 1 tasks were failed. assert_true: expected true got false
     6PASS   First 512-point FFT at frame 512 equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0.0000059207}.
     7PASS   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}.
     8PASS   Smoothed 512-point FFT at frame 1536 equals [expected array] with an element-wise tolerance of {"absoluteThreshold":0,"relativeThreshold":0.000025332}.
     9PASS   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}.
     10PASS < [smoothing test] All assertions passed. (total 4 assertions)
     11PASS # AUDIT TASK RUNNER FINISHED: 1 tasks ran successfully.
    5612
  • trunk/LayoutTests/webaudio/Analyser/realtimeanalyser-multiple-calls-expected.txt

    r267349 r267383  
    55PASS > [test] 
    66PASS   Second call to getFloatFrequencyData is identical to the array [expected array].
    7 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...].
    8 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...].
    9 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...].
     7PASS   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...].
     8PASS   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...].
     9PASS   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...].
    1010PASS < [test] All assertions passed. (total 4 assertions)
    1111PASS # AUDIT TASK RUNNER FINISHED: 1 tasks ran successfully.
  • trunk/LayoutTests/webrtc/routines.js

    r265822 r267383  
    115115           var hasFrequency = expectedFrequency => {
    116116                var bin = Math.floor(expectedFrequency * analyser.fftSize / context.sampleRate);
    117                 return bin < freqDomain.length && freqDomain[bin] >= 150;
     117                return bin < freqDomain.length && freqDomain[bin] >= 100;
    118118           };
    119119
  • trunk/Source/WebCore/ChangeLog

    r267382 r267383  
     12020-09-21  Chris Dumez  <cdumez@apple.com>
     2
     3        Values returned by FFTFrame::doFFT() are twice as large as they should be
     4        https://bugs.webkit.org/show_bug.cgi?id=216781
     5
     6        Reviewed by Darin Adler.
     7
     8        To provide the best possible execution speeds, the vDSP library's functions don't always adhere strictly
     9        to textbook formulas for Fourier transforms, and must be scaled accordingly [1].
     10
     11        In the case of a Real forward Transform like in FFTFrame::doFFT(): RFimp = RFmath * 2 so we need to
     12        divide the output by 2 to get the correct value. We were failing to do this scaling and this was causing
     13        AnalyserNode tests to fail.
     14
     15        [1] See https://developer.apple.com/library/archive/documentation/Performance/Conceptual/vDSP_Programming_Guide/UsingFourierTransforms/UsingFourierTransforms.html#//apple_ref/doc/uid/TP40005147-CH3-SW5
     16
     17        No new tests, rebaselined existing tests.
     18
     19        * Modules/webaudio/PeriodicWave.cpp:
     20        (WebCore::PeriodicWave::createBandLimitedTables):
     21        Update normalization factor now that FFTFrame::doInverseFFT() has been fixed. The new normalization factor
     22        matches the value used by blink at:
     23        - https://github.com/chromium/chromium/blob/master/third_party/blink/renderer/modules/webaudio/periodic_wave.cc
     24
     25        * platform/audio/FFTFrame.cpp:
     26        (WebCore::FFTFrame::multiply):
     27        We were applying a 0.5 scaling factor to the output of vDSP_zvmul(). However, the documentation for vDSP_zvmul()
     28        does not indicate that its output is twice as large as expected. Odds are that this was done because we used
     29        to have a bug in FFTFrame::doFFT() that was returning values twice as large as expected. SInce this function
     30        relies on VectorMath, there is no need for its implementation to be platform-specific.
     31
     32        * platform/audio/FFTFrameStub.cpp:
     33        * platform/audio/gstreamer/FFTFrameGStreamer.cpp:
     34        (WebCore::FFTFrame::doFFT):
     35        (WebCore::FFTFrame::doInverseFFT):
     36        Drop 2 factor in the GStreamer implementation that was added to try and be consistent with the incorrect Mac
     37        implementation.
     38
     39        * platform/audio/mac/FFTFrameMac.cpp:
     40        (WebCore::FFTFrame::doFFT):
     41        Fix issue where the values returned by doFFT() were twice as large as expected due to the odd behavior of
     42        vDSP_fft_zrip().
     43
     44        (WebCore::FFTFrame::doInverseFFT):
     45        Drop 2 factor in doInverseFFT that was added because the output of doFFT() was twice as large as expected
     46        and we wanted x == InverseFFT(FFT(x)).
     47
    1482020-09-21  Wenson Hsieh  <wenson_hsieh@apple.com>
    249
  • trunk/Source/WebCore/Modules/webaudio/PeriodicWave.cpp

    r267153 r267383  
    193193void PeriodicWave::createBandLimitedTables(const float* realData, const float* imagData, unsigned numberOfComponents, ShouldDisableNormalization disableNormalization)
    194194{
    195     float normalizationScale = 1;
     195    float normalizationScale = 0.5;
    196196
    197197    unsigned fftSize = periodicWaveSize();
  • trunk/Source/WebCore/platform/audio/FFTFrame.cpp

    r267143 r267383  
    180180}
    181181
     182void FFTFrame::multiply(const FFTFrame& frame)
     183{
     184    FFTFrame& frame1 = *this;
     185    const FFTFrame& frame2 = frame;
     186
     187    float* realP1 = frame1.realData();
     188    float* imagP1 = frame1.imagData();
     189    const float* realP2 = frame2.realData();
     190    const float* imagP2 = frame2.imagData();
     191
     192    unsigned halfSize = m_FFTSize / 2;
     193    float real0 = realP1[0];
     194    float imag0 = imagP1[0];
     195
     196    // Complex multiply
     197    VectorMath::zvmul(realP1, imagP1, realP2, imagP2, realP1, imagP1, halfSize);
     198
     199    // Multiply the packed DC/nyquist component
     200    realP1[0] = real0 * realP2[0];
     201    imagP1[0] = imag0 * imagP2[0];
     202}
     203
    182204double FFTFrame::extractAverageGroupDelay()
    183205{
  • trunk/Source/WebCore/platform/audio/FFTFrameStub.cpp

    r172431 r267383  
    6565}
    6666
    67 void FFTFrame::multiply(const FFTFrame& frame)
    68 {
    69     ASSERT_NOT_REACHED();
    70 }
    71 
    7267void FFTFrame::doFFT(const float* data)
    7368{
  • trunk/Source/WebCore/platform/audio/gstreamer/FFTFrameGStreamer.cpp

    r265403 r267383  
    104104}
    105105
    106 void FFTFrame::multiply(const FFTFrame& frame)
    107 {
    108     FFTFrame& frame1 = *this;
    109     FFTFrame& frame2 = const_cast<FFTFrame&>(frame);
    110 
    111     float* realP1 = frame1.realData();
    112     float* imagP1 = frame1.imagData();
    113     const float* realP2 = frame2.realData();
    114     const float* imagP2 = frame2.imagData();
    115 
    116     size_t size = unpackedFFTDataSize(m_FFTSize);
    117     VectorMath::zvmul(realP1, imagP1, realP2, imagP2, realP1, imagP1, size);
    118 
    119     // Scale accounts the peculiar scaling of vecLib on the Mac.
    120     // This ensures the right scaling all the way back to inverse FFT.
    121     // FIXME: if we change the scaling on the Mac then this scale
    122     // factor will need to change too.
    123     float scale = 0.5f;
    124 
    125     VectorMath::vsmul(realP1, 1, &scale, realP1, 1, size);
    126     VectorMath::vsmul(imagP1, 1, &scale, imagP1, 1, size);
    127 }
    128 
    129106void FFTFrame::doFFT(const float* data)
    130107{
    131108    gst_fft_f32_fft(m_fft, data, m_complexData.get());
    132 
    133     // Scale the frequency domain data to match vecLib's scale factor
    134     // on the Mac. FIXME: if we change the definition of FFTFrame to
    135     // eliminate this scale factor then this code will need to change.
    136     // Also, if this loop turns out to be hot then we should use SSE
    137     // or other intrinsics to accelerate it.
    138     float scaleFactor = 2;
    139 
    140     float* imagData = m_imagData.data();
    141     float* realData = m_realData.data();
    142     for (unsigned i = 0; i < unpackedFFTDataSize(m_FFTSize); ++i) {
    143         imagData[i] = m_complexData[i].i * scaleFactor;
    144         realData[i] = m_complexData[i].r * scaleFactor;
    145     }
    146109}
    147110
     
    160123
    161124    // Scale so that a forward then inverse FFT yields exactly the original data.
    162     const float scaleFactor = 1.0 / (2 * m_FFTSize);
     125    const float scaleFactor = 1.0 / m_FFTSize;
    163126    VectorMath::vsmul(data, 1, &scaleFactor, data, 1, m_FFTSize);
    164127}
  • trunk/Source/WebCore/platform/audio/mac/FFTFrameMac.cpp

    r265403 r267383  
    9898FFTFrame::~FFTFrame() = default;
    9999
    100 void FFTFrame::multiply(const FFTFrame& frame)
     100void FFTFrame::doFFT(const float* data)
    101101{
    102     FFTFrame& frame1 = *this;
    103     const FFTFrame& frame2 = frame;
     102    unsigned halfSize = m_FFTSize / 2;
     103    vDSP_ctoz(reinterpret_cast<const DSPComplex*>(data), 2, &m_frame, 1, halfSize);
     104    vDSP_fft_zrip(m_FFTSetup, &m_frame, 1, m_log2FFTSize, FFT_FORWARD);
    104105
    105     float* realP1 = frame1.realData();
    106     float* imagP1 = frame1.imagData();
    107     const float* realP2 = frame2.realData();
    108     const float* imagP2 = frame2.imagData();
    109 
    110     unsigned halfSize = m_FFTSize / 2;
    111     float real0 = realP1[0];
    112     float imag0 = imagP1[0];
    113 
    114     // Complex multiply
    115     VectorMath::zvmul(realP1, imagP1, realP2, imagP2, realP1, imagP1, halfSize);
    116 
    117     // Multiply the packed DC/nyquist component
    118     realP1[0] = real0 * realP2[0];
    119     imagP1[0] = imag0 * imagP2[0];
    120 
    121     // Scale accounts for vecLib's peculiar scaling
    122     // This ensures the right scaling all the way back to inverse FFT
     106    // To provide the best possible execution speeds, the vDSP library's functions don't always adhere strictly
     107    // to textbook formulas for Fourier transforms, and must be scaled accordingly.
     108    // (See https://developer.apple.com/library/archive/documentation/Performance/Conceptual/vDSP_Programming_Guide/UsingFourierTransforms/UsingFourierTransforms.html#//apple_ref/doc/uid/TP40005147-CH3-SW5)
     109    // In the case of a Real forward Transform like above: RFimp = RFmath * 2 so we need to divide the output
     110    // by 2 to get the correct value.
    123111    float scale = 0.5f;
    124112
    125     VectorMath::vsmul(realP1, 1, &scale, realP1, 1, halfSize);
    126     VectorMath::vsmul(imagP1, 1, &scale, imagP1, 1, halfSize);
    127 }
    128 
    129 void FFTFrame::doFFT(const float* data)
    130 {
    131     vDSP_ctoz(reinterpret_cast<const DSPComplex*>(data), 2, &m_frame, 1, m_FFTSize / 2);
    132     vDSP_fft_zrip(m_FFTSetup, &m_frame, 1, m_log2FFTSize, FFT_FORWARD);
     113    VectorMath::vsmul(realData(), 1, &scale, realData(), 1, halfSize);
     114    VectorMath::vsmul(imagData(), 1, &scale, imagData(), 1, halfSize);
    133115}
    134116
     
    139121
    140122    // Do final scaling so that x == IFFT(FFT(x))
    141     float scale = 0.5f / m_FFTSize;
    142     vDSP_vsmul(data, 1, &scale, data, 1, m_FFTSize);
     123    float scale = 1.0f / m_FFTSize;
     124    VectorMath::vsmul(data, 1, &scale, data, 1, m_FFTSize);
    143125}
    144126
Note: See TracChangeset for help on using the changeset viewer.