changeset 12260:65619c2230e7 libavcodec

aacdec: Only load and write each predictor variable one. This is slightly faster and opens the door for further optimization.
author alexc
date Sat, 24 Jul 2010 02:57:08 +0000
parents 97db3c60fb9c
children 940736055764
files aacdec.c
diffstat 1 files changed, 12 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/aacdec.c	Sat Jul 24 02:41:47 2010 +0000
+++ b/aacdec.c	Sat Jul 24 02:57:08 2010 +0000
@@ -1240,23 +1240,26 @@
     float e0, e1;
     float pv;
     float k1, k2;
+    float   r0 = ps->r0,     r1 = ps->r1;
+    float cor0 = ps->cor0, cor1 = ps->cor1;
+    float var0 = ps->var0, var1 = ps->var1;
 
-    k1 = ps->var0 > 1 ? ps->cor0 * flt16_even(a / ps->var0) : 0;
-    k2 = ps->var1 > 1 ? ps->cor1 * flt16_even(a / ps->var1) : 0;
+    k1 = var0 > 1 ? cor0 * flt16_even(a / var0) : 0;
+    k2 = var1 > 1 ? cor1 * flt16_even(a / var1) : 0;
 
-    pv = flt16_round(k1 * ps->r0 + k2 * ps->r1);
+    pv = flt16_round(k1 * r0 + k2 * r1);
     if (output_enable)
         *coef += pv * sf_scale;
 
     e0 = *coef * inv_sf_scale;
-    e1 = e0 - k1 * ps->r0;
+    e1 = e0 - k1 * r0;
 
-    ps->cor1 = flt16_trunc(alpha * ps->cor1 + ps->r1 * e1);
-    ps->var1 = flt16_trunc(alpha * ps->var1 + 0.5f * (ps->r1 * ps->r1 + e1 * e1));
-    ps->cor0 = flt16_trunc(alpha * ps->cor0 + ps->r0 * e0);
-    ps->var0 = flt16_trunc(alpha * ps->var0 + 0.5f * (ps->r0 * ps->r0 + e0 * e0));
+    ps->cor1 = flt16_trunc(alpha * cor1 + r1 * e1);
+    ps->var1 = flt16_trunc(alpha * var1 + 0.5f * (r1 * r1 + e1 * e1));
+    ps->cor0 = flt16_trunc(alpha * cor0 + r0 * e0);
+    ps->var0 = flt16_trunc(alpha * var0 + 0.5f * (r0 * r0 + e0 * e0));
 
-    ps->r1 = flt16_trunc(a * (ps->r0 - k1 * e0));
+    ps->r1 = flt16_trunc(a * (r0 - k1 * e0));
     ps->r0 = flt16_trunc(a * e0);
 }