From 2a75a9045c478fc55dad013d74de8c2f144d3046 Mon Sep 17 00:00:00 2001 From: Michael Giacomelli Date: Sat, 5 Jul 2008 00:44:01 +0000 Subject: More WMAv1 fixes by Rafael Carre. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17943 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/libwma/wmadeci.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/apps/codecs/libwma/wmadeci.c b/apps/codecs/libwma/wmadeci.c index 23916f6dc8..bc89229c87 100644 --- a/apps/codecs/libwma/wmadeci.c +++ b/apps/codecs/libwma/wmadeci.c @@ -876,8 +876,9 @@ static int decode_exp_vlc(WMADecodeContext *s, int ch) *q++ = v; } while (--n); + } else { + last_exp = 36; } - last_exp = 36; while (q < q_end) { @@ -1171,15 +1172,14 @@ static int wma_decode_block(WMADecodeContext *s) { int n4 = s->block_len >> 1; - //mdct_norm = 0x10000; - //mdct_norm = fixdiv32(mdct_norm,itofix32(n4)); - mdct_norm = 0x10000>>(s->block_len_bits-1); //theres no reason to do a divide by two in fixed precision ... + + mdct_norm = 0x10000>>(s->block_len_bits-1); if (s->version == 1) { fixed32 tmp = fixtoi32(fixsqrt32(itofix32(n4))); - mdct_norm *= tmp; // PJJ : exercise this path + mdct_norm *= fixtoi32(fixsqrt32(itofix32(n4))); } } @@ -1322,10 +1322,13 @@ static int wma_decode_block(WMADecodeContext *s) { /*Noise coding not used, simply convert from exp to fixed representation*/ - fixed32 mult3 = (fixed32)(fixdiv64(pow_table[total_gain+20],Fixed32To64(s->max_exponent[ch]))); mult3 = fixmul32(mult3, mdct_norm); + /*zero the first 3 coefficients for WMA V1, does nothing otherwise*/ + for(i=0; icoefs_start; i++) + *coefs++=0; + n = nb_coefs[ch]; /* XXX: optimize more, unrolling this loop in asm might be a good idea */ -- cgit v1.2.3