[FFmpeg-cvslog] r24475 - trunk/libavcodec/aacdec.c

alexc subversion
Sat Jul 24 04:57:09 CEST 2010


Author: alexc
Date: Sat Jul 24 04:57:08 2010
New Revision: 24475

Log:
aacdec: Only load and write each predictor variable one.

This is slightly faster and opens the door for further optimization.

Modified:
   trunk/libavcodec/aacdec.c

Modified: trunk/libavcodec/aacdec.c
==============================================================================
--- trunk/libavcodec/aacdec.c	Sat Jul 24 04:41:47 2010	(r24474)
+++ trunk/libavcodec/aacdec.c	Sat Jul 24 04:57:08 2010	(r24475)
@@ -1240,23 +1240,26 @@ static av_always_inline void predict(Pre
     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);
 }
 



More information about the ffmpeg-cvslog mailing list