[FFmpeg-cvslog] af_biquad: unroll loop, remove variable copies
Michael Niedermayer
git at videolan.org
Thu Feb 7 19:47:56 CET 2013
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Feb 7 19:03:22 2013 +0100| [9f956611e33f73f6ad8d926e8a361e75aa42a491] | committer: Michael Niedermayer
af_biquad: unroll loop, remove variable copies
This makes the code about 7% faster
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9f956611e33f73f6ad8d926e8a361e75aa42a491
---
libavfilter/af_biquads.c | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/libavfilter/af_biquads.c b/libavfilter/af_biquads.c
index 123d7a2..1f4d635 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]; \
More information about the ffmpeg-cvslog
mailing list