aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/apedec.c
diff options
context:
space:
mode:
authorLoren Merritt <lorenm@u.washington.edu>2009-12-04 15:12:09 +0000
committerLoren Merritt <lorenm@u.washington.edu>2009-12-04 15:12:09 +0000
commitd09f65c7ec0339bcf3b1a3c579e42a8133740bbd (patch)
tree2f64de25e63aae58bd8e6bcda9c0f616d8c028a1 /libavcodec/apedec.c
parent84a29dc10a9b51a20ea628480df61b43c2b655f8 (diff)
downloadffmpeg-d09f65c7ec0339bcf3b1a3c579e42a8133740bbd.tar.gz
1-13% faster apply_filter, 1-3% faster ape decoding on core2
Originally committed as revision 20729 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/apedec.c')
-rw-r--r--libavcodec/apedec.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 3a0d172c9e..b8d1e9e254 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -678,14 +678,9 @@ static inline void do_apply_filter(APEContext * ctx, int version, APEFilter *f,
/* Version 3.98 and later files */
/* Update the adaption coefficients */
- absres = (res < 0 ? -res : res);
-
- if (absres > (f->avg * 3))
- *f->adaptcoeffs = ((res >> 25) & 64) - 32;
- else if (absres > (f->avg * 4) / 3)
- *f->adaptcoeffs = ((res >> 26) & 32) - 16;
- else if (absres > 0)
- *f->adaptcoeffs = ((res >> 27) & 16) - 8;
+ absres = FFABS(res);
+ if (absres)
+ *f->adaptcoeffs = ((res & (1<<31)) - (1<<30)) >> (25 + (absres <= f->avg*3) + (absres <= f->avg*4/3));
else
*f->adaptcoeffs = 0;