Wiki » History » Version 12

Chris Cannam, 2013-10-22 09:17 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 4 Chris Cannam
h3. Implementations by decimation factor
32 4 Chris Cannam
33 3 Chris Cannam
h4. Factor 2
34 3 Chris Cannam
35 3 Chris Cannam
|Frames per second|Clock time|Implementation|
36 1 Chris Cannam
|  14225806|0.372|decimate|
37 12 Chris Cannam
|  14187667|0.373|decimate_b|
38 3 Chris Cannam
|   8939189|0.592|zoh|
39 3 Chris Cannam
|   3732016|1.418|resample_lq|
40 3 Chris Cannam
|   1856842|2.850|resample_mq|
41 1 Chris Cannam
|    989158|5.350|resample_hq|
42 3 Chris Cannam
|    516141|10.253|src|
43 4 Chris Cannam
44 1 Chris Cannam
h4. Factor 4
45 4 Chris Cannam
46 4 Chris Cannam
|Frames per second|Clock time|Implementation|
47 4 Chris Cannam
|17070967|0.310|zoh|
48 1 Chris Cannam
|14659279|0.361|decimate|
49 12 Chris Cannam
|13465648|0.393|decimate_b|
50 4 Chris Cannam
| 4285020|1.235|resample_lq|
51 4 Chris Cannam
| 2186776|2.420|resample_mq|
52 4 Chris Cannam
| 1056287|5.010|resample_hq|
53 4 Chris Cannam
|  610099|8.674|src|
54 4 Chris Cannam
55 1 Chris Cannam
h4. Factor 8
56 4 Chris Cannam
57 4 Chris Cannam
|Frames per second|Clock time|Implementation|
58 4 Chris Cannam
|26328358|0.201|zoh|
59 1 Chris Cannam
|13926315|0.380|decimate|
60 12 Chris Cannam
|12027272|0.440|decimate_b|
61 4 Chris Cannam
| 4895467|1.081|resample_lq|
62 4 Chris Cannam
| 2470588|2.142|resample_mq|
63 4 Chris Cannam
| 1166409|4.537|resample_hq|
64 4 Chris Cannam
|  614919|8.606|src|
65 4 Chris Cannam
66 1 Chris Cannam
h4. Factor 16
67 4 Chris Cannam
68 4 Chris Cannam
|Frames per second|Clock time|Implementation|
69 4 Chris Cannam
|33493670|0.158|zoh|
70 1 Chris Cannam
|12721153|0.416|decimate|
71 12 Chris Cannam
|11141052|0.475|decimate_b|
72 4 Chris Cannam
| 5093358|1.039|resample_lq|
73 4 Chris Cannam
| 2515209|2.104|resample_mq|
74 4 Chris Cannam
| 1182041|4.477|resample_hq|
75 4 Chris Cannam
|  668857|7.912|src|
76 4 Chris Cannam
77 1 Chris Cannam
h4. Factor 32
78 4 Chris Cannam
79 4 Chris Cannam
|Frames per second|Clock time|Implementation|
80 4 Chris Cannam
|41669291|0.127|zoh|
81 1 Chris Cannam
|14498630|0.365|decimate|
82 12 Chris Cannam
|12540284|0.422|decimate_b|
83 4 Chris Cannam
| 5318592|0.995|resample_lq|
84 4 Chris Cannam
| 2312937|2.288|resample_mq|
85 4 Chris Cannam
| 1148936|4.606|resample_hq|
86 4 Chris Cannam
|  670467|7.893|src|
87 4 Chris Cannam
88 1 Chris Cannam
h4. Factor 64
89 4 Chris Cannam
90 4 Chris Cannam
|Frames per second|Clock time|Implementation|
91 4 Chris Cannam
|42000000|0.126|zoh|
92 1 Chris Cannam
|13397468|0.395|decimate|
93 12 Chris Cannam
|11972850|0.442|decimate_b|
94 4 Chris Cannam
| 5040000|1.050|resample_lq|
95 4 Chris Cannam
| 2365668|2.237|resample_mq|
96 4 Chris Cannam
| 1232704|4.293|resample_hq|
97 1 Chris Cannam
|  636057|8.320|src|
98 5 Chris Cannam
99 5 Chris Cannam
h3. Decimation factors by implementation
100 4 Chris Cannam
101 4 Chris Cannam
h4. Implementation zoh
102 4 Chris Cannam
103 4 Chris Cannam
|Frames per second|Clock time|Factor|
104 4 Chris Cannam
|42000000|0.126|factor 64|
105 4 Chris Cannam
|41669291|0.127|factor 32|
106 4 Chris Cannam
|33493670|0.158|factor 16|
107 4 Chris Cannam
|26328358|0.201|factor 8|
108 4 Chris Cannam
|17070967|0.310|factor 4|
109 4 Chris Cannam
| 8939189|0.592|factor 2|
110 4 Chris Cannam
111 4 Chris Cannam
h4. Implementation decimate
112 4 Chris Cannam
113 4 Chris Cannam
|Frames per second|Clock time|Factor|
114 4 Chris Cannam
|14659279|0.361|factor 4|
115 4 Chris Cannam
|14498630|0.365|factor 32|
116 4 Chris Cannam
|14225806|0.372|factor 2|
117 4 Chris Cannam
|13926315|0.380|factor 8|
118 4 Chris Cannam
|13397468|0.395|factor 64|
119 1 Chris Cannam
|12721153|0.416|factor 16|
120 12 Chris Cannam
121 12 Chris Cannam
h4. Implementation decimate_b
122 12 Chris Cannam
123 12 Chris Cannam
|Frames per second|Clock time|Factor|
124 12 Chris Cannam
|14187667|0.373|factor 2|
125 12 Chris Cannam
|13465648|0.393|factor 4|
126 12 Chris Cannam
|12540284|0.422|factor 32|
127 12 Chris Cannam
|12027272|0.440|factor 8|
128 12 Chris Cannam
|11972850|0.442|factor 64|
129 12 Chris Cannam
|11141052|0.475|factor 16|
130 4 Chris Cannam
131 4 Chris Cannam
h4. Implementation resample_hq
132 4 Chris Cannam
133 4 Chris Cannam
|Frames per second|Clock time|Factor|
134 4 Chris Cannam
| 1232704|4.293|factor 64|
135 4 Chris Cannam
| 1182041|4.477|factor 16|
136 4 Chris Cannam
| 1166409|4.537|factor 8|
137 4 Chris Cannam
| 1148936|4.606|factor 32|
138 4 Chris Cannam
| 1056287|5.010|factor 4|
139 4 Chris Cannam
|  989158|5.350|factor 2|
140 4 Chris Cannam
141 4 Chris Cannam
h4. Implementation resample_mq
142 4 Chris Cannam
143 4 Chris Cannam
|Frames per second|Clock time|Factor|
144 4 Chris Cannam
| 2515209|2.104|factor 16|
145 4 Chris Cannam
| 2470588|2.142|factor 8|
146 4 Chris Cannam
| 2365668|2.237|factor 64|
147 4 Chris Cannam
| 2312937|2.288|factor 32|
148 4 Chris Cannam
| 2186776|2.420|factor 4|
149 4 Chris Cannam
| 1856842|2.850|factor 2|
150 4 Chris Cannam
151 4 Chris Cannam
h4. Implementation resample_lq
152 4 Chris Cannam
153 4 Chris Cannam
|Frames per second|Clock time|Factor|
154 4 Chris Cannam
| 5318592|0.995|factor 32|
155 4 Chris Cannam
| 5093358|1.039|factor 16|
156 4 Chris Cannam
| 5040000|1.050|factor 64|
157 4 Chris Cannam
| 4895467|1.081|factor 8|
158 4 Chris Cannam
| 4285020|1.235|factor 4|
159 4 Chris Cannam
| 3732016|1.418|factor 2|
160 4 Chris Cannam
161 4 Chris Cannam
h4. Implementation src
162 4 Chris Cannam
163 4 Chris Cannam
|Frames per second|Clock time|Factor|
164 4 Chris Cannam
|  670467|7.893|factor 32|
165 4 Chris Cannam
|  668857|7.912|factor 16|
166 4 Chris Cannam
|  636057|8.320|factor 64|
167 4 Chris Cannam
|  614919|8.606|factor 8|
168 4 Chris Cannam
|  610099|8.674|factor 4|
169 4 Chris Cannam
|  516141|10.253|factor 2|
170 11 Chris Cannam
171 11 Chris Cannam
h3. Resampler filter lengths
172 11 Chris Cannam
173 11 Chris Cannam
Filter lengths the qm-dsp Resamplers decided to use:
174 11 Chris Cannam
175 11 Chris Cannam
|Factor|Length (hq)|Length (mq)|Length (lq)|
176 11 Chris Cannam
|2|643|291|119|
177 11 Chris Cannam
|4|1285|579|237|
178 11 Chris Cannam
|8|2567|1155|471|
179 11 Chris Cannam
|16|5131|2307|939|
180 11 Chris Cannam
|32|10261|4613|1877|
181 11 Chris Cannam
|64|20519|9223|3751|