changeset 3621:d4896ea0305b libavcodec

replace l3_unscale(1, exponents[pos]) by LUT
author michael
date Fri, 25 Aug 2006 10:00:30 +0000
parents 5f738d186815
children e88a3910f855
files mpegaudiodec.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mpegaudiodec.c	Fri Aug 25 02:40:52 2006 +0000
+++ b/mpegaudiodec.c	Fri Aug 25 10:00:30 2006 +0000
@@ -173,6 +173,7 @@
 #define TABLE_4_3_SIZE (8191 + 16)*4
 static int8_t  *table_4_3_exp;
 static uint32_t *table_4_3_value;
+static uint32_t exp_table[512];
 /* intensity stereo coef table */
 static int32_t is_table[2][16];
 static int32_t is_table_lsf[2][2][16];
@@ -428,6 +429,11 @@
 //            av_log(NULL, AV_LOG_DEBUG, "%d %d %f\n", i, m, pow((double)i, 4.0 / 3.0));
             table_4_3_exp[i] = -e;
         }
+        for(i=0; i<512; i++){
+            int exponent= i-400;
+            double f=  pow(1, 4.0 / 3.0) * pow(2, exponent*0.25 + FRAC_BITS + 5);
+            exp_table[i]= lrintf(f);
+        }
 
         for(i=0;i<7;i++) {
             float f;
@@ -1760,7 +1766,7 @@
             const static int idxtab[16]={3,3,2,2,1,1,1,1,0,0,0,0,0,0,0,0};
             int pos= s_index+idxtab[code];
             code ^= 8>>idxtab[code];
-            v = l3_unscale(1, exponents[pos]);
+            v = exp_table[ exponents[pos] + 400];
             if(get_bits1(&s->gb))
                 v = -v;
             g->sb_hybrid[pos] = v;