Commit 9f956611 authored by Michael Niedermayer's avatar Michael Niedermayer

af_biquad: unroll loop, remove variable copies

This makes the code about 7% faster
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 4e2c6368
......@@ -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]; \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment