1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

af_biquad: unroll loop, remove variable copies

This makes the code about 7% faster

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-02-07 19:03:22 +01:00
parent 4e2c63685e
commit 9f956611e3

View File

@ -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]; \