aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter/af_biquads.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-02-07 19:03:22 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-02-07 19:03:22 +0100
commit9f956611e33f73f6ad8d926e8a361e75aa42a491 (patch)
treea31cce9623de2b76ebec03f010b65edcd320894b /libavfilter/af_biquads.c
parent4e2c63685e031e28d2296cff76473b963ee62ba1 (diff)
downloadffmpeg-9f956611e33f73f6ad8d926e8a361e75aa42a491.tar.gz
af_biquad: unroll loop, remove variable copies
This makes the code about 7% faster Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/af_biquads.c')
-rw-r--r--libavfilter/af_biquads.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/libavfilter/af_biquads.c b/libavfilter/af_biquads.c
index 123d7a2eee..1f4d635585 100644
--- a/libavfilter/af_biquads.c
+++ b/libavfilter/af_biquads.c
@@ -182,7 +182,32 @@ static void biquad_## name (const void *input, void *output, int len, \
double o2 = *out2; \
int i; \
\
- for (i = 0; i < len; i++) { \
+ for (i = 0; i+1 < len; i++) { \
+ o2 = i2 * b2 + i1 * b1 + ibuf[i] * b0 - o2 * a2 - o1 * a1; \
+ i2 = ibuf[i]; \
+ if (o2 < min) { \
+ av_log(NULL, AV_LOG_WARNING, "clipping\n"); \
+ obuf[i] = min; \
+ } else if (o2 > max) { \
+ av_log(NULL, AV_LOG_WARNING, "clipping\n"); \
+ obuf[i] = max; \
+ } else { \
+ obuf[i] = o2; \
+ } \
+ i++; \
+ o1 = i1 * b2 + i2 * b1 + ibuf[i] * b0 - o1 * a2 - o2 * a1; \
+ i1 = ibuf[i]; \
+ if (o1 < min) { \
+ av_log(NULL, AV_LOG_WARNING, "clipping\n"); \
+ obuf[i] = min; \
+ } else if (o1 > max) { \
+ av_log(NULL, AV_LOG_WARNING, "clipping\n"); \
+ obuf[i] = max; \
+ } else { \
+ obuf[i] = o1; \
+ } \
+ } \
+ if (i < len) { \
double o0 = ibuf[i] * b0 + i1 * b1 + i2 * b2 - o1 * a1 - o2 * a2; \
i2 = i1; \
i1 = ibuf[i]; \