Wiki » History » Version 13

Chris Cannam, 2013-10-22 09:19 AM

1 1 Chris Cannam
h1. Summary of results
2 6 Chris Cannam
3 6 Chris Cannam
{{>toc}}
4 1 Chris Cannam
5 9 Chris Cannam
h2. What we're looking at
6 9 Chris Cannam
7 9 Chris Cannam
Here we're only looking at causal methods, so no forward/backward filtering. The question in my head is really whether faster IIR filters are still so much faster as to be worth using in preference to linear-phase methods with better (?) theoretical quality. Of course that would always depend on the application, but it's interesting to compare. 
8 9 Chris Cannam
9 1 Chris Cannam
We compared
10 1 Chris Cannam
11 12 Chris Cannam
 * @decimate@: the "Decimator":http://code.soundsoftware.ac.uk/projects/qm-dsp/embedded/classDecimator.html implementation in the "qm-dsp":/projects/qm-dsp library, which uses an IIR lowpass filter (perhaps an elliptical filter?) with 8 coefficient pairs;
12 1 Chris Cannam
13 12 Chris Cannam
 * @decimate_b@: the "DecimatorB":http://code.soundsoftware.ac.uk/projects/qm-dsp/embedded/classDecimatorB.html class in the "qm-dsp":/projects/qm-dsp library, which uses a Butterworth IIR lowpass filter of order 6;
14 12 Chris Cannam
15 2 Chris Cannam
 * @resample_hq@, @resample_mq@, @resample_lq@: the "Resampler":http://code.soundsoftware.ac.uk/projects/qm-dsp/embedded/classResampler.html implementation in the "qm-dsp":/projects/qm-dsp library, which uses a lengthy Kaiser-windowed sinc filter, at three different quality settings;
16 1 Chris Cannam
   
17 1 Chris Cannam
 * @src@: the sndfile-resample program which uses "libsamplerate":http://mega-nerd.com/SRC/, a well trusted resampler also using a Kaiser-windowed sinc implementation, at its default quality setting;
18 1 Chris Cannam
19 1 Chris Cannam
 * @zoh@: the sndfile-resample zero-order hold resampler, which just takes every Nth sample without any filtering, serving as a baseline.
20 3 Chris Cannam
21 3 Chris Cannam
h2. Speed
22 3 Chris Cannam
23 4 Chris Cannam
For 5292000 input frames on a Core i3-3229Y low-voltage CPU. (Frames-per-second values are for input frames.)
24 3 Chris Cannam
25 8 Chris Cannam
All code is 64-bit. The qm-dsp implementations (resample_* and decimate) were compiled with -O3 -ffast-math while the libsamplerate implementations (src and zoh) were standard Ubuntu packages, so probably -O2. This is likely to make a very significant difference, so these results are more useful for comparison among the qm-dsp implementations than between qm-dsp and libsamplerate.
26 1 Chris Cannam
27 5 Chris Cannam
The decimate implementation supports factors up to 8 only, so 16x, 32x and 64x are handled in two passes.
28 5 Chris Cannam
29 4 Chris Cannam
All implementations use libsndfile for audio file I/O, so that should not be a factor in overall speed.
30 4 Chris Cannam
31 13 Chris Cannam
These frames-per-second figures look terribly precise, but I imagine there's a good 10% margin of error (run to run or whatever).
32 13 Chris Cannam
33 4 Chris Cannam
h3. Implementations by decimation factor
34 4 Chris Cannam
35 3 Chris Cannam
h4. Factor 2
36 3 Chris Cannam
37 3 Chris Cannam
|Frames per second|Clock time|Implementation|
38 1 Chris Cannam
|  14225806|0.372|decimate|
39 12 Chris Cannam
|  14187667|0.373|decimate_b|
40 3 Chris Cannam
|   8939189|0.592|zoh|
41 3 Chris Cannam
|   3732016|1.418|resample_lq|
42 3 Chris Cannam
|   1856842|2.850|resample_mq|
43 1 Chris Cannam
|    989158|5.350|resample_hq|
44 3 Chris Cannam
|    516141|10.253|src|
45 4 Chris Cannam
46 1 Chris Cannam
h4. Factor 4
47 4 Chris Cannam
48 4 Chris Cannam
|Frames per second|Clock time|Implementation|
49 4 Chris Cannam
|17070967|0.310|zoh|
50 1 Chris Cannam
|14659279|0.361|decimate|
51 12 Chris Cannam
|13465648|0.393|decimate_b|
52 4 Chris Cannam
| 4285020|1.235|resample_lq|
53 4 Chris Cannam
| 2186776|2.420|resample_mq|
54 4 Chris Cannam
| 1056287|5.010|resample_hq|
55 4 Chris Cannam
|  610099|8.674|src|
56 4 Chris Cannam
57 1 Chris Cannam
h4. Factor 8
58 4 Chris Cannam
59 4 Chris Cannam
|Frames per second|Clock time|Implementation|
60 4 Chris Cannam
|26328358|0.201|zoh|
61 1 Chris Cannam
|13926315|0.380|decimate|
62 12 Chris Cannam
|12027272|0.440|decimate_b|
63 4 Chris Cannam
| 4895467|1.081|resample_lq|
64 4 Chris Cannam
| 2470588|2.142|resample_mq|
65 4 Chris Cannam
| 1166409|4.537|resample_hq|
66 4 Chris Cannam
|  614919|8.606|src|
67 4 Chris Cannam
68 1 Chris Cannam
h4. Factor 16
69 4 Chris Cannam
70 4 Chris Cannam
|Frames per second|Clock time|Implementation|
71 4 Chris Cannam
|33493670|0.158|zoh|
72 1 Chris Cannam
|12721153|0.416|decimate|
73 12 Chris Cannam
|11141052|0.475|decimate_b|
74 4 Chris Cannam
| 5093358|1.039|resample_lq|
75 4 Chris Cannam
| 2515209|2.104|resample_mq|
76 4 Chris Cannam
| 1182041|4.477|resample_hq|
77 4 Chris Cannam
|  668857|7.912|src|
78 4 Chris Cannam
79 1 Chris Cannam
h4. Factor 32
80 4 Chris Cannam
81 4 Chris Cannam
|Frames per second|Clock time|Implementation|
82 4 Chris Cannam
|41669291|0.127|zoh|
83 1 Chris Cannam
|14498630|0.365|decimate|
84 12 Chris Cannam
|12540284|0.422|decimate_b|
85 4 Chris Cannam
| 5318592|0.995|resample_lq|
86 4 Chris Cannam
| 2312937|2.288|resample_mq|
87 4 Chris Cannam
| 1148936|4.606|resample_hq|
88 4 Chris Cannam
|  670467|7.893|src|
89 4 Chris Cannam
90 1 Chris Cannam
h4. Factor 64
91 4 Chris Cannam
92 4 Chris Cannam
|Frames per second|Clock time|Implementation|
93 4 Chris Cannam
|42000000|0.126|zoh|
94 1 Chris Cannam
|13397468|0.395|decimate|
95 12 Chris Cannam
|11972850|0.442|decimate_b|
96 4 Chris Cannam
| 5040000|1.050|resample_lq|
97 4 Chris Cannam
| 2365668|2.237|resample_mq|
98 4 Chris Cannam
| 1232704|4.293|resample_hq|
99 1 Chris Cannam
|  636057|8.320|src|
100 5 Chris Cannam
101 5 Chris Cannam
h3. Decimation factors by implementation
102 4 Chris Cannam
103 4 Chris Cannam
h4. Implementation zoh
104 4 Chris Cannam
105 4 Chris Cannam
|Frames per second|Clock time|Factor|
106 4 Chris Cannam
|42000000|0.126|factor 64|
107 4 Chris Cannam
|41669291|0.127|factor 32|
108 4 Chris Cannam
|33493670|0.158|factor 16|
109 4 Chris Cannam
|26328358|0.201|factor 8|
110 4 Chris Cannam
|17070967|0.310|factor 4|
111 4 Chris Cannam
| 8939189|0.592|factor 2|
112 4 Chris Cannam
113 4 Chris Cannam
h4. Implementation decimate
114 4 Chris Cannam
115 4 Chris Cannam
|Frames per second|Clock time|Factor|
116 4 Chris Cannam
|14659279|0.361|factor 4|
117 4 Chris Cannam
|14498630|0.365|factor 32|
118 4 Chris Cannam
|14225806|0.372|factor 2|
119 4 Chris Cannam
|13926315|0.380|factor 8|
120 4 Chris Cannam
|13397468|0.395|factor 64|
121 1 Chris Cannam
|12721153|0.416|factor 16|
122 12 Chris Cannam
123 12 Chris Cannam
h4. Implementation decimate_b
124 12 Chris Cannam
125 12 Chris Cannam
|Frames per second|Clock time|Factor|
126 12 Chris Cannam
|14187667|0.373|factor 2|
127 12 Chris Cannam
|13465648|0.393|factor 4|
128 12 Chris Cannam
|12540284|0.422|factor 32|
129 12 Chris Cannam
|12027272|0.440|factor 8|
130 12 Chris Cannam
|11972850|0.442|factor 64|
131 12 Chris Cannam
|11141052|0.475|factor 16|
132 4 Chris Cannam
133 4 Chris Cannam
h4. Implementation resample_hq
134 4 Chris Cannam
135 4 Chris Cannam
|Frames per second|Clock time|Factor|
136 4 Chris Cannam
| 1232704|4.293|factor 64|
137 4 Chris Cannam
| 1182041|4.477|factor 16|
138 4 Chris Cannam
| 1166409|4.537|factor 8|
139 4 Chris Cannam
| 1148936|4.606|factor 32|
140 4 Chris Cannam
| 1056287|5.010|factor 4|
141 4 Chris Cannam
|  989158|5.350|factor 2|
142 4 Chris Cannam
143 4 Chris Cannam
h4. Implementation resample_mq
144 4 Chris Cannam
145 4 Chris Cannam
|Frames per second|Clock time|Factor|
146 4 Chris Cannam
| 2515209|2.104|factor 16|
147 4 Chris Cannam
| 2470588|2.142|factor 8|
148 4 Chris Cannam
| 2365668|2.237|factor 64|
149 4 Chris Cannam
| 2312937|2.288|factor 32|
150 4 Chris Cannam
| 2186776|2.420|factor 4|
151 4 Chris Cannam
| 1856842|2.850|factor 2|
152 4 Chris Cannam
153 4 Chris Cannam
h4. Implementation resample_lq
154 4 Chris Cannam
155 4 Chris Cannam
|Frames per second|Clock time|Factor|
156 4 Chris Cannam
| 5318592|0.995|factor 32|
157 4 Chris Cannam
| 5093358|1.039|factor 16|
158 4 Chris Cannam
| 5040000|1.050|factor 64|
159 4 Chris Cannam
| 4895467|1.081|factor 8|
160 4 Chris Cannam
| 4285020|1.235|factor 4|
161 4 Chris Cannam
| 3732016|1.418|factor 2|
162 4 Chris Cannam
163 4 Chris Cannam
h4. Implementation src
164 4 Chris Cannam
165 4 Chris Cannam
|Frames per second|Clock time|Factor|
166 4 Chris Cannam
|  670467|7.893|factor 32|
167 4 Chris Cannam
|  668857|7.912|factor 16|
168 4 Chris Cannam
|  636057|8.320|factor 64|
169 4 Chris Cannam
|  614919|8.606|factor 8|
170 4 Chris Cannam
|  610099|8.674|factor 4|
171 4 Chris Cannam
|  516141|10.253|factor 2|
172 11 Chris Cannam
173 11 Chris Cannam
h3. Resampler filter lengths
174 11 Chris Cannam
175 11 Chris Cannam
Filter lengths the qm-dsp Resamplers decided to use:
176 11 Chris Cannam
177 11 Chris Cannam
|Factor|Length (hq)|Length (mq)|Length (lq)|
178 11 Chris Cannam
|2|643|291|119|
179 11 Chris Cannam
|4|1285|579|237|
180 11 Chris Cannam
|8|2567|1155|471|
181 11 Chris Cannam
|16|5131|2307|939|
182 11 Chris Cannam
|32|10261|4613|1877|
183 11 Chris Cannam
|64|20519|9223|3751|