changeset 3599:9a069376b7e3 libavcodec

replace a few MULL by MULH
author michael
date Mon, 21 Aug 2006 12:12:43 +0000
parents 181b0e8f6d81
children 949219039897
files mpegaudiodec.c
diffstat 1 files changed, 24 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/mpegaudiodec.c	Sun Aug 20 22:18:26 2006 +0000
+++ b/mpegaudiodec.c	Mon Aug 21 12:12:43 2006 +0000
@@ -943,6 +943,19 @@
     FIXR(5.73685662283492756461),
 };
 
+/* 0.5 / cos(pi*(2*i+1)/36) */
+static const int icos36h[9] = {
+    FIXHR(0.50190991877167369479/2),
+    FIXHR(0.51763809020504152469/2), //0
+    FIXHR(0.55168895948124587824/2),
+    FIXHR(0.61038729438072803416/2),
+    FIXHR(0.70710678118654752439/2), //1
+    FIXHR(0.87172339781054900991/2),
+    FIXHR(1.18310079157624925896/4),
+    FIXHR(1.93185165257813657349/4), //2
+//    FIXHR(5.73685662283492756461),
+};
+
 /* 12 points IMDCT. We compute it "by hand" by factorizing obvious
    cases. */
 static void imdct12(int *out, int *in)
@@ -959,10 +972,10 @@
     in3 += in1;
 
     in2= MULH(2*in2, C3);
-    in3= MULH(2*in3, C3);
+    in3= MULH(4*in3, C3);
 
     t1 = in0 - in4;
-    t2 = MULL(in1 - in5, icos36[4]);
+    t2 = MULH(2*(in1 - in5), icos36h[4]);
 
     out[ 7]=
     out[10]= t1 + t2;
@@ -971,19 +984,19 @@
 
     in0 += in4>>1;
     in4 = in0 + in2;
-    in1 += in5>>1;
-    in5 = MULL(in1 + in3, icos36[1]);
+    in5 += 2*in1;
+    in1 = MULH(in5 + in3, icos36h[1]);
     out[ 8]=
-    out[ 9]= in4 + in5;
+    out[ 9]= in4 + in1;
     out[ 2]=
-    out[ 3]= in4 - in5;
+    out[ 3]= in4 - in1;
 
     in0 -= in2;
-    in1 = MULL(in1 - in3, icos36[7]);
+    in5 = MULH(2*(in5 - in3), icos36h[7]);
     out[ 0]=
-    out[ 5]= in0 - in1;
+    out[ 5]= in0 - in5;
     out[ 6]=
-    out[11]= in0 + in1;
+    out[11]= in0 + in5;
 }
 
 /* cos(pi*i/18) */
@@ -1077,7 +1090,7 @@
 
         t2 = tmp[i + 1];
         t3 = tmp[i + 3];
-        s1 = MULL(t3 + t2, icos36[j]);
+        s1 = MULH(2*(t3 + t2), icos36h[j]);
         s3 = MULL(t3 - t2, icos36[8 - j]);
 
         t0 = s0 + s1;
@@ -1097,7 +1110,7 @@
     }
 
     s0 = tmp[16];
-    s1 = MULL(tmp[17], icos36[4]);
+    s1 = MULH(2*tmp[17], icos36h[4]);
     t0 = s0 + s1;
     t1 = s0 - s1;
     out[(9 + 4)*SBLIMIT] =  MULH(t1, win[9 + 4]) + buf[9 + 4];