History

avfilter/af_acrossover: unroll biquad_process loop

Makes code significantly faster for higher orders.

Paul B Mahol committed 5 years ago

Commit ca0900b1 parent 6100a011 file · +19 −1Browse files

Unified · Split

libavfilter/af_acrossover.c+19−1
@@ -288,7 +288,25 @@ static void biquad_process_## name(const BiquadCoeffs *const c,\ · 287 unmodified lines
288288 type z1 = b->z1; \
289289 type z2 = b->z2; \
290290 \
291− for (int n = 0; n < nb_samples; n++) { \
291+ for (int n = 0; n + 1 < nb_samples; n++) { \
292+ type in = src[n]; \
293+ type out; \
294+ \
295+ out = in * b0 + z1; \
296+ z1 = b1 * in + z2 + a1 * out; \
297+ z2 = b2 * in + a2 * out; \
298+ dst[n] = out; \
299+ \
300+ n++; \
301+ in = src[n]; \
302+ out = in * b0 + z1; \
303+ z1 = b1 * in + z2 + a1 * out; \
304+ z2 = b2 * in + a2 * out; \
305+ dst[n] = out; \
306+ } \
307+ \
308+ if (nb_samples & 1) { \
309+ const int n = nb_samples - 1; \
292310 const type in = src[n]; \
293311 type out; \
294312 \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t