changeset 10639:4e0b0c0cb915 libavcodec

1-13% faster apply_filter, 1-3% faster ape decoding on core2
author lorenm
date Fri, 04 Dec 2009 15:12:09 +0000
parents 40ff9c7958da
children e3e0c834590e
files apedec.c
diffstat 1 files changed, 3 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/apedec.c	Fri Dec 04 08:18:13 2009 +0000
+++ b/apedec.c	Fri Dec 04 15:12:09 2009 +0000
@@ -678,14 +678,9 @@
             /* 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;