[Ffmpeg-cvslog] r6083 - trunk/libavcodec/mpegaudiodec.c
michael
subversion
Fri Aug 25 13:55:20 CEST 2006
Author: michael
Date: Fri Aug 25 13:55:20 2006
New Revision: 6083
Modified:
trunk/libavcodec/mpegaudiodec.c
Log:
try to avoid l3_unscale() by using a table
Modified: trunk/libavcodec/mpegaudiodec.c
==============================================================================
--- trunk/libavcodec/mpegaudiodec.c (original)
+++ trunk/libavcodec/mpegaudiodec.c Fri Aug 25 13:55:20 2006
@@ -174,6 +174,7 @@
static int8_t *table_4_3_exp;
static uint32_t *table_4_3_value;
static uint32_t exp_table[512];
+static uint32_t expval_table[512][16];
/* intensity stereo coef table */
static int32_t is_table[2][16];
static int32_t is_table_lsf[2][2][16];
@@ -429,10 +430,12 @@
// 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<512*16; i++){
+ int exponent= (i>>4)-400;
+ double f= pow(i&15, 4.0 / 3.0) * pow(2, exponent*0.25 + FRAC_BITS + 5);
+ expval_table[exponent+400][i&15]= lrintf(f);
+ if((i&15)==1)
+ exp_table[exponent+400]= lrintf(f);
}
for(i=0;i<7;i++) {
@@ -1717,9 +1720,18 @@
dprintf("region=%d n=%d x=%d y=%d exp=%d\n",
i, g->region_size[i] - j, x, y, exponents[s_index]);
if (x) {
+#if 0
if (x == 15)
x += get_bitsz(&s->gb, linbits);
v = l3_unscale(x, exponents[s_index]);
+#else
+ if (x < 15){
+ v = expval_table[ exponents[s_index] + 400 ][ x ];
+ }else{
+ x += get_bitsz(&s->gb, linbits);
+ v = l3_unscale(x, exponents[s_index]);
+ }
+#endif
if (get_bits1(&s->gb))
v = -v;
} else {
@@ -1727,9 +1739,18 @@
}
g->sb_hybrid[s_index++] = v;
if (y) {
+#if 0
if (y == 15)
y += get_bitsz(&s->gb, linbits);
v = l3_unscale(y, exponents[s_index]);
+#else
+ if (y < 15){
+ v = expval_table[ exponents[s_index] + 400 ][ y ];
+ }else{
+ y += get_bitsz(&s->gb, linbits);
+ v = l3_unscale(y, exponents[s_index]);
+ }
+#endif
if (get_bits1(&s->gb))
v = -v;
} else {
More information about the ffmpeg-cvslog
mailing list