From 98f0d7787906e91d50c3f1d435df9fd8fcaccc31 Mon Sep 17 00:00:00 2001 From: Michael Giacomelli Date: Mon, 6 Aug 2007 01:43:09 +0000 Subject: Clean up VLC functions. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14206 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/libwma/bitstream.c | 19 ++++++------------- apps/codecs/libwma/wmadeci.c | 21 ++++++++++----------- 2 files changed, 16 insertions(+), 24 deletions(-) (limited to 'apps') diff --git a/apps/codecs/libwma/bitstream.c b/apps/codecs/libwma/bitstream.c index bce7ee2ae6..78b078adc7 100644 --- a/apps/codecs/libwma/bitstream.c +++ b/apps/codecs/libwma/bitstream.c @@ -119,8 +119,7 @@ static int build_table(VLC *vlc, int table_nb_bits, const void *codes, int codes_wrap, int codes_size, uint32_t code_prefix, int n_prefix) { - int i, j, k, n, table_size, table_index, nb, n1, index; - uint32_t code_prefix2; + int i, j, k, n, table_size, table_index, nb, n1, index, code_prefix2; uint32_t code; int flags = 0; VLC_TYPE (*table)[2]; @@ -153,10 +152,10 @@ static int build_table(VLC *vlc, int table_nb_bits, /* if code matches the prefix, it is in the table */ n -= n_prefix; if(flags & INIT_VLC_LE) - code_prefix2= code & (n_prefix>=32 ? 0xffffffff : (uint32_t)( (1 << n_prefix)-1)); + code_prefix2= code & (n_prefix>=32 ? 0xffffffff : (uint32_t)(1 << n_prefix)-1); else code_prefix2= code >> n; - if (n > 0 && code_prefix2 == code_prefix) { + if (n > 0 && (int)code_prefix2 == code_prefix) { if (n <= table_nb_bits) { /* no need to add another table */ j = (code << (table_nb_bits - n)) & (table_size - 1); @@ -165,11 +164,10 @@ static int build_table(VLC *vlc, int table_nb_bits, if(flags & INIT_VLC_LE) j = (code >> n_prefix) + (k<> ((flags & INIT_VLC_LE) ? n_prefix : n)) & ((1 << table_nb_bits) - 1); #ifdef DEBUG_VLC - printf("%4x: n=%d (subtable)\n", + av_log(NULL, 0,"%4x: n=%d (subtable)\n", j, n); #endif /* compute table size */ @@ -267,9 +265,4 @@ int init_vlc(VLC *vlc, int nb_bits, int nb_codes, return flags; } -/* -void free_vlc(VLC *vlc) -{ - av_free(vlc->table); -} -*/ + diff --git a/apps/codecs/libwma/wmadeci.c b/apps/codecs/libwma/wmadeci.c index f14fbc8197..b867e5c6f1 100644 --- a/apps/codecs/libwma/wmadeci.c +++ b/apps/codecs/libwma/wmadeci.c @@ -30,10 +30,10 @@ #include "bitstream.h" -#define VLCBITS 9 +#define VLCBITS 7 /*7 is the lowest without glitching*/ #define VLCMAX ((22+VLCBITS-1)/VLCBITS) -#define EXPVLCBITS 9 +#define EXPVLCBITS 7 #define EXPMAX ((19+EXPVLCBITS-1)/EXPVLCBITS) #define HGAINVLCBITS 9 @@ -140,11 +140,12 @@ uint16_t runtab0[1336], runtab1[1336], levtab0[1336], levtab1[1336]; FFTComplex mdct_tmp[1] ; /* dummy var */ -//may also be too large by ~ 1KB each? -static VLC_TYPE vlcbuf1[6144][2]; -static VLC_TYPE vlcbuf2[3584][2]; -static VLC_TYPE vlcbuf3[1536][2] IBSS_ATTR; //small so lets try iram -static VLC_TYPE vlcbuf4[540][2]; + +/*putting these in IRAM actually makes PP slower*/ +VLC_TYPE vlcbuf1[2550][2]; +VLC_TYPE vlcbuf2[2550][2]; +VLC_TYPE vlcbuf3[360][2]; +VLC_TYPE vlcbuf4[540][2]; @@ -877,8 +878,7 @@ int wma_decode_init(WMADecodeContext* s, asf_waveformatex_t *wfx) #endif s->hgain_vlc.table = vlcbuf4; - s->hgain_vlc.table_allocated = 540; - init_vlc(&s->hgain_vlc, 9, sizeof(hgain_huffbits), + init_vlc(&s->hgain_vlc, HGAINVLCBITS, sizeof(hgain_huffbits), hgain_huffbits, 1, 1, hgain_huffcodes, 2, 2, 0); } @@ -887,9 +887,8 @@ int wma_decode_init(WMADecodeContext* s, asf_waveformatex_t *wfx) { s->exp_vlc.table = vlcbuf3; - s->exp_vlc.table_allocated = 1536; - init_vlc(&s->exp_vlc, 9, sizeof(scale_huffbits), + init_vlc(&s->exp_vlc, EXPVLCBITS, sizeof(scale_huffbits), scale_huffbits, 1, 1, scale_huffcodes, 4, 4, 0); } -- cgit v1.2.3