annotate fft/test.html @ 7:47f08ebded06

Fix Cross implementation and add to test matrix
author Chris Cannam
date Mon, 05 Oct 2015 12:54:49 +0100
parents fcb64e4b8393
children c6577c4b3780
rev   line source
Chris@3 1 <html>
Chris@7 2 <head>
Chris@7 3
Chris@3 4 <meta charset="UTF-8">
Chris@1 5
Chris@3 6 <style type="text/css">
Chris@3 7 body { margin: 5%; }
Chris@3 8 table, td, th { border: 0.1em solid #e0e0e0; border-collapse: collapse }
Chris@3 9 td, th { padding: 0.5em }
Chris@3 10 </style>
Chris@3 11
Chris@3 12 <script src="nayuki/fft.js"></script>
Chris@3 13 <script src="fft.js/lib/complex.js"></script>
Chris@3 14 <script src="jsfft/lib/complex_array.js"></script>
Chris@3 15 <script src="jsfft/lib/fft.js"></script>
Chris@7 16 <script src="cross/Cross.js"></script>
Chris@7 17 <script src="cross/FFT.js"></script>
Chris@3 18 <script src="test.js"></script>
Chris@1 19
Chris@7 20 </head>
Chris@3 21 <body>
Chris@2 22
Chris@3 23 <h3>Results</h3>
Chris@1 24
Chris@3 25 <p id="test-description"></p>
Chris@3 26
Chris@3 27 <table>
Chris@3 28 <tr>
Chris@3 29 <th>Implementation</th><th>Result</th><th>Time (first half)</th><th>Time (second half)</th><th>Rate (second half)</th>
Chris@3 30 </tr>
Chris@3 31 <tr>
Chris@3 32 <td>Nayuki</td><td id="nayuki-result"></td><td id="nayuki-1"></td><td id="nayuki-2"></td><td id="nayuki-itr"></td>
Chris@3 33 </tr><tr>
Chris@3 34 <td>Nockert</td><td id="nockert-result"></td><td id="nockert-1"></td><td id="nockert-2"></td><td id="nockert-itr"></td>
Chris@3 35 </tr><tr>
Chris@3 36 <td>Dntj</td><td id="dntj-result"></td><td id="dntj-1"></td><td id="dntj-2"></td><td id="dntj-itr"></td>
Chris@7 37 </tr><tr>
Chris@7 38 <td>Cross</td><td id="cross-result"></td><td id="cross-1"></td><td id="cross-2"></td><td id="cross-itr"></td>
Chris@3 39 </tr>
Chris@3 40 </table>
Chris@1 41
Chris@3 42 <h3>Notes</h3>
Chris@1 43
Chris@3 44 <ul>
Chris@3 45 <li><b>Nayuki</b>: in-place single-precision complex-complex</li>
Chris@3 46 <li><b>Nockert</b>: double-precision real-complex</li>
Chris@4 47 <li><b>Nayuki</b>: double-precision complex-complex. Forward transform is scaled and I've scaled it back again here, which may introduce rounding error.</li>
Chris@7 48 <li><b>Cross</b>: double-precision real-complex in C, compiled with Emscripten. This is considered a slow implementation amongst native code ones.</li>
Chris@3 49 </ul>
Chris@3 50
Chris@3 51 <h3>Rationale</h3>
Chris@1 52
Chris@3 53 <p>If 2150 iterations of real-to-complex FFT of size 2048 takes less
Chris@3 54 than 10 seconds, then we may be able to make a high quality
Chris@3 55 real-time phase vocoder (just).</p>
Chris@1 56
Chris@3 57 <p>A phase-vocoder of course must use overlapped windowed FFT
Chris@3 58 (although you can choose the size, within limits), IFFT, and
Chris@3 59 cartesian-polar conversion to calculate the phase for the
Chris@3 60 instantaneous frequency.</p>
Chris@1 61
Chris@3 62 <p>A reasonable estimate of CPU cost for the whole thing is
Chris@3 63 somewhere around 10x the cost of simple non-overlapping short-time
Chris@3 64 forward Fourier transforms across the signal. </p>
Chris@1 65
Chris@3 66 <p>2150 iterations corresponds to 100 seconds of audio
Chris@3 67 non-overlapped at 44.1kHz, so if that takes less than 10 seconds,
Chris@3 68 then in theory we might be OK.</p>
Chris@1 69
Chris@3 70 </body>
Chris@1 71