Skip to content

Commit bfa567e

Browse files
committed
Merge branch 'oversampling' into devel
* Implemented high-precision lanczos 2x, 3x, 4x, 6x and 8x oversampling functions.
2 parents 81f9fe4 + ba46b27 commit bfa567e

File tree

8 files changed

+3654
-16
lines changed

8 files changed

+3654
-16
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
=== 1.0.13 ===
66
* Implemented AVX2-optimized hsla_to_rgba and rgba_to_hsla functions.
7+
* Implemented high-precision lanczos 2x, 3x, 4x, 6x and 8x oversampling functions.
78
* Updated build scripts.
89

910
=== 1.0.12 ===

include/lsp-plug.in/dsp/common/resampling.h

Lines changed: 155 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ namespace lsp
5050
/**
5151
* The number of additionally reserved samples at the tail of the buffer
5252
*/
53-
#define LSP_DSP_RESAMPLING_RSV_SAMPLES 64
53+
#define LSP_DSP_RESAMPLING_RSV_SAMPLES 1024
5454

55-
/** Perform lanczos resampling, destination buffer must be cleared and contain only
55+
/** Perform 2x lanczos oversampling (2 lobes), destination buffer must be cleared and contain only
5656
* resampling tail from previous resampling
5757
*
5858
* @param dst destination buffer of count*2 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
@@ -61,7 +61,7 @@ namespace lsp
6161
*/
6262
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_2x2, float *dst, const float *src, size_t count);
6363

64-
/** Perform lanczos resampling, destination buffer must be cleared and contain only
64+
/** Perform 2x lanczos oversampling (3 lobes), destination buffer must be cleared and contain only
6565
* resampling tail from previous resampling
6666
*
6767
* @param dst destination buffer of count*2 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
@@ -70,7 +70,7 @@ LSP_DSP_LIB_SYMBOL(void, lanczos_resample_2x2, float *dst, const float *src, siz
7070
*/
7171
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_2x3, float *dst, const float *src, size_t count);
7272

73-
/** Perform lanczos resampling, destination buffer must be cleared and contain only
73+
/** Perform 2x lanczos oversampling (4 lobes), destination buffer must be cleared and contain only
7474
* resampling tail from previous resampling
7575
*
7676
* @param dst destination buffer of count*2 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
@@ -79,7 +79,35 @@ LSP_DSP_LIB_SYMBOL(void, lanczos_resample_2x3, float *dst, const float *src, siz
7979
*/
8080
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_2x4, float *dst, const float *src, size_t count);
8181

82-
/** Perform lanczos resampling, destination buffer must be cleared and contain only
82+
/** Perform 2x lanczos oversampling (4 lobes for 12-bit sample precision), destination buffer must be cleared and contain only
83+
* resampling tail from previous resampling
84+
*
85+
* @param dst destination buffer of count*2 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
86+
* @param src source buffer of count samples
87+
* @param count number of samples
88+
*/
89+
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_2x12bit, float *dst, const float *src, size_t count);
90+
91+
/** Perform 2x lanczos oversampling (10 lobes for 16-bit sample precision), destination buffer must be cleared and contain only
92+
* resampling tail from previous resampling
93+
*
94+
* @param dst destination buffer of count*2 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
95+
* @param src source buffer of count samples
96+
* @param count number of samples
97+
*/
98+
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_2x16bit, float *dst, const float *src, size_t count);
99+
100+
/** Perform 2x lanczos oversampling (62 lobes for 24-bit sample precision), destination buffer must be cleared and contain only
101+
* resampling tail from previous resampling
102+
*
103+
* @param dst destination buffer of count*2 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
104+
* @param src source buffer of count samples
105+
* @param count number of samples
106+
*/
107+
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_2x24bit, float *dst, const float *src, size_t count);
108+
109+
110+
/** Perform 3x lanczos oversampling (2 lobes), destination buffer must be cleared and contain only
83111
* resampling tail from previous resampling
84112
*
85113
* @param dst destination buffer of count*3 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
@@ -88,7 +116,7 @@ LSP_DSP_LIB_SYMBOL(void, lanczos_resample_2x4, float *dst, const float *src, siz
88116
*/
89117
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_3x2, float *dst, const float *src, size_t count);
90118

91-
/** Perform lanczos resampling, destination buffer must be cleared and contain only
119+
/** Perform 3x lanczos oversampling (3 lobes), destination buffer must be cleared and contain only
92120
* resampling tail from previous resampling
93121
*
94122
* @param dst destination buffer of count*3 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
@@ -97,7 +125,7 @@ LSP_DSP_LIB_SYMBOL(void, lanczos_resample_3x2, float *dst, const float *src, siz
97125
*/
98126
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_3x3, float *dst, const float *src, size_t count);
99127

100-
/** Perform lanczos resampling, destination buffer must be cleared and contain only
128+
/** Perform 3x lanczos oversampling (4 lobes), destination buffer must be cleared and contain only
101129
* resampling tail from previous resampling
102130
*
103131
* @param dst destination buffer of count*3 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
@@ -106,7 +134,35 @@ LSP_DSP_LIB_SYMBOL(void, lanczos_resample_3x3, float *dst, const float *src, siz
106134
*/
107135
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_3x4, float *dst, const float *src, size_t count);
108136

109-
/** Perform lanczos resampling, destination buffer must be cleared and contain only
137+
/** Perform 3x lanczos oversampling (4 lobes for 12-bit sample precision), destination buffer must be cleared and contain only
138+
* resampling tail from previous resampling
139+
*
140+
* @param dst destination buffer of count*3 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
141+
* @param src source buffer of count samples
142+
* @param count number of samples
143+
*/
144+
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_3x12bit, float *dst, const float *src, size_t count);
145+
146+
/** Perform 3x lanczos oversampling (10 lobes for 16-bit sample precision), destination buffer must be cleared and contain only
147+
* resampling tail from previous resampling
148+
*
149+
* @param dst destination buffer of count*3 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
150+
* @param src source buffer of count samples
151+
* @param count number of samples
152+
*/
153+
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_3x16bit, float *dst, const float *src, size_t count);
154+
155+
/** Perform 3x lanczos oversampling (62 lobes for 24-bit sample precision), destination buffer must be cleared and contain only
156+
* resampling tail from previous resampling
157+
*
158+
* @param dst destination buffer of count*3 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
159+
* @param src source buffer of count samples
160+
* @param count number of samples
161+
*/
162+
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_3x24bit, float *dst, const float *src, size_t count);
163+
164+
165+
/** Perform 4x lanczos oversampling (2 lobes), destination buffer must be cleared and contain only
110166
* resampling tail from previous resampling
111167
*
112168
* @param dst destination buffer of count*4 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
@@ -115,7 +171,7 @@ LSP_DSP_LIB_SYMBOL(void, lanczos_resample_3x4, float *dst, const float *src, siz
115171
*/
116172
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_4x2, float *dst, const float *src, size_t count);
117173

118-
/** Perform lanczos resampling, destination buffer must be cleared and contain only
174+
/** Perform 4x lanczos oversampling (3 lobes), destination buffer must be cleared and contain only
119175
* resampling tail from previous resampling
120176
*
121177
* @param dst destination buffer of count*4 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
@@ -124,7 +180,7 @@ LSP_DSP_LIB_SYMBOL(void, lanczos_resample_4x2, float *dst, const float *src, siz
124180
*/
125181
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_4x3, float *dst, const float *src, size_t count);
126182

127-
/** Perform lanczos resampling, destination buffer must be cleared and contain only
183+
/** Perform 4x lanczos oversampling (4 lobes), destination buffer must be cleared and contain only
128184
* resampling tail from previous resampling
129185
*
130186
* @param dst destination buffer of count*4 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
@@ -133,7 +189,35 @@ LSP_DSP_LIB_SYMBOL(void, lanczos_resample_4x3, float *dst, const float *src, siz
133189
*/
134190
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_4x4, float *dst, const float *src, size_t count);
135191

136-
/** Perform lanczos resampling, destination buffer must be cleared and contain only
192+
/** Perform 4x lanczos oversampling (4 lobes for 12-bit sample precision), destination buffer must be cleared and contain only
193+
* resampling tail from previous resampling
194+
*
195+
* @param dst destination buffer of count*4 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
196+
* @param src source buffer of count samples
197+
* @param count number of samples
198+
*/
199+
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_4x12bit, float *dst, const float *src, size_t count);
200+
201+
/** Perform 4x lanczos oversampling (4 lobes for 16-bit sample precision), destination buffer must be cleared and contain only
202+
* resampling tail from previous resampling
203+
*
204+
* @param dst destination buffer of count*4 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
205+
* @param src source buffer of count samples
206+
* @param count number of samples
207+
*/
208+
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_4x16bit, float *dst, const float *src, size_t count);
209+
210+
/** Perform 4x lanczos oversampling (4 lobes for 24-bit sample precision), destination buffer must be cleared and contain only
211+
* resampling tail from previous resampling
212+
*
213+
* @param dst destination buffer of count*4 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
214+
* @param src source buffer of count samples
215+
* @param count number of samples
216+
*/
217+
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_4x24bit, float *dst, const float *src, size_t count);
218+
219+
220+
/** Perform 6x lanczos oversampling (2 lobes), destination buffer must be cleared and contain only
137221
* resampling tail from previous resampling
138222
*
139223
* @param dst destination buffer of count*6 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
@@ -142,7 +226,7 @@ LSP_DSP_LIB_SYMBOL(void, lanczos_resample_4x4, float *dst, const float *src, siz
142226
*/
143227
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_6x2, float *dst, const float *src, size_t count);
144228

145-
/** Perform lanczos resampling, destination buffer must be cleared and contain only
229+
/** Perform 6x lanczos oversampling (3 lobes), destination buffer must be cleared and contain only
146230
* resampling tail from previous resampling
147231
*
148232
* @param dst destination buffer of count*6 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
@@ -151,7 +235,7 @@ LSP_DSP_LIB_SYMBOL(void, lanczos_resample_6x2, float *dst, const float *src, siz
151235
*/
152236
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_6x3, float *dst, const float *src, size_t count);
153237

154-
/** Perform lanczos resampling, destination buffer must be cleared and contain only
238+
/** Perform 6x lanczos oversampling (4 lobes), destination buffer must be cleared and contain only
155239
* resampling tail from previous resampling
156240
*
157241
* @param dst destination buffer of count*6 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
@@ -160,7 +244,35 @@ LSP_DSP_LIB_SYMBOL(void, lanczos_resample_6x3, float *dst, const float *src, siz
160244
*/
161245
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_6x4, float *dst, const float *src, size_t count);
162246

163-
/** Perform lanczos resampling, destination buffer must be cleared and contain only
247+
/** Perform 6x lanczos oversampling (4 lobes for 12-bit sample precision), destination buffer must be cleared and contain only
248+
* resampling tail from previous resampling
249+
*
250+
* @param dst destination buffer of count*6 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
251+
* @param src source buffer of count samples
252+
* @param count number of samples
253+
*/
254+
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_6x12bit, float *dst, const float *src, size_t count);
255+
256+
/** Perform 6x lanczos oversampling (10 lobes for 16-bit sample precision), destination buffer must be cleared and contain only
257+
* resampling tail from previous resampling
258+
*
259+
* @param dst destination buffer of count*6 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
260+
* @param src source buffer of count samples
261+
* @param count number of samples
262+
*/
263+
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_6x16bit, float *dst, const float *src, size_t count);
264+
265+
/** Perform 6x lanczos oversampling (62 lobes for 24-bit sample precision), destination buffer must be cleared and contain only
266+
* resampling tail from previous resampling
267+
*
268+
* @param dst destination buffer of count*6 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
269+
* @param src source buffer of count samples
270+
* @param count number of samples
271+
*/
272+
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_6x24bit, float *dst, const float *src, size_t count);
273+
274+
275+
/** Perform 8x lanczos oversampling (2 lobes), destination buffer must be cleared and contain only
164276
* resampling tail from previous resampling
165277
*
166278
* @param dst destination buffer of count*8 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
@@ -169,7 +281,7 @@ LSP_DSP_LIB_SYMBOL(void, lanczos_resample_6x4, float *dst, const float *src, siz
169281
*/
170282
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_8x2, float *dst, const float *src, size_t count);
171283

172-
/** Perform lanczos resampling, destination buffer must be cleared and contain only
284+
/** Perform 8x lanczos oversampling (3 lobes), destination buffer must be cleared and contain only
173285
* resampling tail from previous resampling
174286
*
175287
* @param dst destination buffer of count*8 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
@@ -178,7 +290,7 @@ LSP_DSP_LIB_SYMBOL(void, lanczos_resample_8x2, float *dst, const float *src, siz
178290
*/
179291
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_8x3, float *dst, const float *src, size_t count);
180292

181-
/** Perform lanczos resampling, destination buffer must be cleared and contain only
293+
/** Perform 8x lanczos oversampling (4 lobes), destination buffer must be cleared and contain only
182294
* resampling tail from previous resampling
183295
*
184296
* @param dst destination buffer of count*8 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
@@ -187,6 +299,33 @@ LSP_DSP_LIB_SYMBOL(void, lanczos_resample_8x3, float *dst, const float *src, siz
187299
*/
188300
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_8x4, float *dst, const float *src, size_t count);
189301

302+
/** Perform 8x lanczos oversampling (4 lobes for 12-bit sample precision), destination buffer must be cleared and contain only
303+
* resampling tail from previous resampling
304+
*
305+
* @param dst destination buffer of count*8 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
306+
* @param src source buffer of count samples
307+
* @param count number of samples
308+
*/
309+
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_8x12bit, float *dst, const float *src, size_t count);
310+
311+
/** Perform 8x lanczos oversampling (10 lobes for 16-bit sample precision), destination buffer must be cleared and contain only
312+
* resampling tail from previous resampling
313+
*
314+
* @param dst destination buffer of count*8 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
315+
* @param src source buffer of count samples
316+
* @param count number of samples
317+
*/
318+
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_8x16bit, float *dst, const float *src, size_t count);
319+
320+
/** Perform 8x lanczos oversampling (62 lobes for 24-bit sample precision), destination buffer must be cleared and contain only
321+
* resampling tail from previous resampling
322+
*
323+
* @param dst destination buffer of count*8 samples + LSP_DSP_RESAMPLING_RSV_SAMPLES samples for convolution tail
324+
* @param src source buffer of count samples
325+
* @param count number of samples
326+
*/
327+
LSP_DSP_LIB_SYMBOL(void, lanczos_resample_8x24bit, float *dst, const float *src, size_t count);
328+
190329
/** Copy each even sample to output buffer
191330
*
192331
* @param dst destination buffer

0 commit comments

Comments
 (0)