comparison mpegaudiodec.c @ 10469:23ca6d60184d libavcodec

Add support for hardcoding the mpegaudiodec tables. Reduces .bss size by about 194 kB.
author reimar
date Wed, 28 Oct 2009 18:42:52 +0000
parents 899237b1961f
children ead8d96926c4
comparison
equal deleted inserted replaced
10468:fedf07e14bee 10469:23ca6d60184d
90 static const int huff_quad_vlc_tables_sizes[2] = { 90 static const int huff_quad_vlc_tables_sizes[2] = {
91 128, 16 91 128, 16
92 }; 92 };
93 /* computed from band_size_long */ 93 /* computed from band_size_long */
94 static uint16_t band_index_long[9][23]; 94 static uint16_t band_index_long[9][23];
95 /* XXX: free when all decoders are closed */ 95 #include "mpegaudio_tablegen.h"
96 #define TABLE_4_3_SIZE (8191 + 16)*4
97 static int8_t table_4_3_exp[TABLE_4_3_SIZE];
98 static uint32_t table_4_3_value[TABLE_4_3_SIZE];
99 static uint32_t exp_table[512];
100 static uint32_t expval_table[512][16];
101 /* intensity stereo coef table */ 96 /* intensity stereo coef table */
102 static int32_t is_table[2][16]; 97 static int32_t is_table[2][16];
103 static int32_t is_table_lsf[2][2][16]; 98 static int32_t is_table_lsf[2][2][16];
104 static int32_t csa_table[8][4]; 99 static int32_t csa_table[8][4];
105 static float csa_table_float[8][4]; 100 static float csa_table_float[8][4];
405 } 400 }
406 401
407 /* compute n ^ (4/3) and store it in mantissa/exp format */ 402 /* compute n ^ (4/3) and store it in mantissa/exp format */
408 403
409 int_pow_init(); 404 int_pow_init();
410 for(i=1;i<TABLE_4_3_SIZE;i++) { 405 mpegaudio_tableinit();
411 double value = i/4;
412 double f, fm;
413 int e, m;
414 f = value * cbrtf(value) * pow(2, (i&3)*0.25);
415 fm = frexp(f, &e);
416 m = (uint32_t)(fm*(1LL<<31) + 0.5);
417 e+= FRAC_BITS - 31 + 5 - 100;
418
419 /* normalized to FRAC_BITS */
420 table_4_3_value[i] = m;
421 table_4_3_exp[i] = -e;
422 }
423 for(i=0; i<512*16; i++){
424 double value = i & 15;
425 int exponent= (i>>4);
426 double f= value * cbrtf(value) * pow(2, (exponent-400)*0.25 + FRAC_BITS + 5);
427 expval_table[exponent][i&15]= llrint(f);
428 if((i&15)==1)
429 exp_table[exponent]= llrint(f);
430 }
431 406
432 for(i=0;i<7;i++) { 407 for(i=0;i<7;i++) {
433 float f; 408 float f;
434 int v; 409 int v;
435 if (i != 6) { 410 if (i != 6) {