diff mp3lib/layer3.c @ 1245:03b7e2955a20

Added newest MMX-optimized decore which speedups decoding at least on 13% for any cpu.
author nick
date Fri, 29 Jun 2001 17:55:35 +0000
parents 946170f9ed39
children 140fcbd20c18
line wrap: on
line diff
--- a/mp3lib/layer3.c	Fri Jun 29 10:54:41 2001 +0000
+++ b/mp3lib/layer3.c	Fri Jun 29 17:55:35 2001 +0000
@@ -22,9 +22,9 @@
 #define GP2MAX (256+118+4)
 static real gainpow2[GP2MAX];
 
-static real nCOS9[9];
+real COS9[9];
 static real COS6_1,COS6_2;
-static real tfcos36[9];
+real tfcos36[9];
 static real tfcos12[3];
 #ifdef NEW_DCT9
 static real cos9[3],cos18[3];
@@ -111,8 +111,12 @@
   int i,j,k,l;
 
   for(i=-256;i<118+4;i++)
-    gainpow2[i+256] = pow((double)2.0,-0.25 * (double) (i+210) );
-
+  {
+    if(_has_mmx)
+      gainpow2[i+256] = 16384.0 * pow((double)2.0,-0.25 * (double) (i+210) );
+    else
+      gainpow2[i+256] = pow((double)2.0,-0.25 * (double) (i+210) );
+  }
   for(i=0;i<8207;i++)
     ispow[i] = pow((double)i,(double)4.0/3.0);
 
@@ -139,7 +143,7 @@
   }
 
   for(i=0;i<9;i++)
-    nCOS9[i] = cos( M_PI / 18.0 * (double) i);
+    COS9[i] = cos( M_PI / 18.0 * (double) i);
 
   for(i=0;i<9;i++)
     tfcos36[i] = 0.5 / cos ( M_PI * (double) (i*2+1) / 36.0 );
@@ -1533,6 +1537,9 @@
 /*
  * III_hybrid
  */
+ 
+dct36_func_t dct36_func;
+  
 static void III_hybrid(real fsIn[SBLIMIT][SSLIMIT],real tsOut[SSLIMIT][SBLIMIT],
    int ch,struct gr_info_s *gr_info)
 {
@@ -1553,8 +1560,8 @@
 
    if(gr_info->mixed_block_flag) {
      sb = 2;
-     dct36(fsIn[0],rawout1,rawout2,win[0],tspnt);
-     dct36(fsIn[1],rawout1+18,rawout2+18,win1[0],tspnt+1);
+     (*dct36_func)(fsIn[0],rawout1,rawout2,win[0],tspnt);
+     (*dct36_func)(fsIn[1],rawout1+18,rawout2+18,win1[0],tspnt+1);
      rawout1 += 36; rawout2 += 36; tspnt += 2;
    }
  
@@ -1567,8 +1574,8 @@
    }
    else {
      for (; sb<gr_info->maxb; sb+=2,tspnt+=2,rawout1+=36,rawout2+=36) {
-       dct36(fsIn[sb],rawout1,rawout2,win[bt],tspnt);
-       dct36(fsIn[sb+1],rawout1+18,rawout2+18,win1[bt],tspnt+1);
+       (*dct36_func)(fsIn[sb],rawout1,rawout2,win[bt],tspnt);
+       (*dct36_func)(fsIn[sb+1],rawout1+18,rawout2+18,win1[bt],tspnt+1);
      }
    }