Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2020-11-30 16:20:45 +0300
committerPaul B Mahol <onemda@gmail.com>2020-11-30 16:53:14 +0300
commitca0900bc6ef1db42881769528f2a3bb69e0bc492 (patch)
tree6a10318957e30f333e797a6c90470e3077fe8619 /libavfilter/af_acrossover.c
parent6100a01a7ad939d8069b011a29eb8db90aa68aba (diff)
avfilter/af_acrossover: unroll biquad_process loop
Makes code significantly faster for higher orders.
Diffstat (limited to 'libavfilter/af_acrossover.c')
-rw-r--r--libavfilter/af_acrossover.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/libavfilter/af_acrossover.c b/libavfilter/af_acrossover.c
index 7788251d3a..6150af7933 100644
--- a/libavfilter/af_acrossover.c
+++ b/libavfilter/af_acrossover.c
@@ -288,7 +288,25 @@ static void biquad_process_## name(const BiquadCoeffs *const c,\
type z1 = b->z1; \
type z2 = b->z2; \
\
- for (int n = 0; n < nb_samples; n++) { \
+ for (int n = 0; n + 1 < nb_samples; n++) { \
+ type in = src[n]; \
+ type out; \
+ \
+ out = in * b0 + z1; \
+ z1 = b1 * in + z2 + a1 * out; \
+ z2 = b2 * in + a2 * out; \
+ dst[n] = out; \
+ \
+ n++; \
+ in = src[n]; \
+ out = in * b0 + z1; \
+ z1 = b1 * in + z2 + a1 * out; \
+ z2 = b2 * in + a2 * out; \
+ dst[n] = out; \
+ } \
+ \
+ if (nb_samples & 1) { \
+ const int n = nb_samples - 1; \
const type in = src[n]; \
type out; \
\