diff options
| author | Michael Giacomelli <giac2000@hotmail.com> | 2007-08-06 01:43:09 +0000 |
|---|---|---|
| committer | Michael Giacomelli <giac2000@hotmail.com> | 2007-08-06 01:43:09 +0000 |
| commit | 98f0d7787906e91d50c3f1d435df9fd8fcaccc31 (patch) | |
| tree | 0b351b1100bb8e1bde8d665f44385a2bb93ebb41 /apps/codecs/libwma | |
| parent | b1fa2f44a2c05997268bdac8d6d85d723e4e85a3 (diff) | |
| download | rockbox-98f0d7787906e91d50c3f1d435df9fd8fcaccc31.zip rockbox-98f0d7787906e91d50c3f1d435df9fd8fcaccc31.tar.gz rockbox-98f0d7787906e91d50c3f1d435df9fd8fcaccc31.tar.bz2 rockbox-98f0d7787906e91d50c3f1d435df9fd8fcaccc31.tar.xz | |
Clean up VLC functions.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14206 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libwma')
| -rw-r--r-- | apps/codecs/libwma/bitstream.c | 19 | ||||
| -rw-r--r-- | apps/codecs/libwma/wmadeci.c | 21 |
2 files changed, 16 insertions, 24 deletions
diff --git a/apps/codecs/libwma/bitstream.c b/apps/codecs/libwma/bitstream.c index bce7ee2..78b078a 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<<n); #ifdef DEBUG_VLC - av_log(NULL, AV_LOG_DEBUG, "%4x: code=%d n=%d\n", + av_log(NULL, 0, "%4x: code=%d n=%d\n", j, i, n); #endif if (table[j][1] /*bits*/ != 0) { - // av_log(NULL, AV_LOG_ERROR, "incorrect codes\n"); return -1; } table[j][1] = n; //bits @@ -180,7 +178,7 @@ static int build_table(VLC *vlc, int table_nb_bits, n -= table_nb_bits; j = (code >> ((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 f14fbc8..b867e5c 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); } |