summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Giacomelli <giac2000@hotmail.com>2007-09-02 03:28:49 +0000
committerMichael Giacomelli <giac2000@hotmail.com>2007-09-02 03:28:49 +0000
commita514c60fd0952c0682aa544ee1e16445e6b7df84 (patch)
treee60e6a0269e31994536567e7e6dfe972d79e3823
parentf2ed1e40088fb2fcb9d715fa321c4c69e79243d4 (diff)
downloadrockbox-a514c60fd0952c0682aa544ee1e16445e6b7df84.tar.gz
rockbox-a514c60fd0952c0682aa544ee1e16445e6b7df84.tar.bz2
rockbox-a514c60fd0952c0682aa544ee1e16445e6b7df84.zip
Apparently, negative exponents are possible when decoding exponential VLC. Should fix occasional glitches that happened in files of all bitrates.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14571 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/codecs/libwma/wmadata.h5
-rw-r--r--apps/codecs/libwma/wmadeci.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/apps/codecs/libwma/wmadata.h b/apps/codecs/libwma/wmadata.h
index cef945914a..63f922b6d6 100644
--- a/apps/codecs/libwma/wmadata.h
+++ b/apps/codecs/libwma/wmadata.h
@@ -1456,8 +1456,13 @@ const fixed64 pow_table[] =
0x14f2e7a000000LL,0x1781474000000LL,0x1a5f7f4000000LL,0x1d974de000000LL,0x2133a18000000LL
};
+/*10^(index/16). We'll need to accomidate negative indicies too*/
const fixed32 pow_10_to_yover16[] ICONST_ATTR=
{
+ /*16 negative indicies (-16 to -1)*/
+0x199a,0x1d90,0x2223,0x276c,0x2d86,0x3492,0x3cb5,0x461b,0x50f4,0x5d7c,0x6bf4,0x7caa,0x8ff6,0xa63e,
+0xbff9, 0xddb0,
+ /*non-negative indicies*/
0x10000,0x127a0,0x15562,0x18a39,0x1c73d,0x20db4,0x25f12,0x2bd09,0x3298b,0x3a6d9,0x4378b,0x4dea3,
0x59f98,0x67e6b,0x77fbb,0x8a8de,0xa0000,0xb8c3e,0xd55d1,0xf6636,0x11c865,0x148906,0x17b6b8,0x1b625b,
0x1f9f6e,0x248475,0x2a2b6e,0x30b25f,0x383bf0,0x40f02c,0x4afd4b,0x5698b0,0x640000,0x737a6b,0x855a26,
diff --git a/apps/codecs/libwma/wmadeci.c b/apps/codecs/libwma/wmadeci.c
index 3b81669d8f..8aa3620960 100644
--- a/apps/codecs/libwma/wmadeci.c
+++ b/apps/codecs/libwma/wmadeci.c
@@ -1110,6 +1110,9 @@ static int decode_exp_vlc(WMADecodeContext *s, int ch)
fixed32 v, max_scale;
fixed32 *q,*q_end;
+ /*accommodate the 16 negative indices */
+ fixed32 *pow_10_to_yover16_ptr = &pow_10_to_yover16[16];
+
band_ptr = s->exponent_bands[s->frame_len_bits - s->block_len_bits];
ptr = band_ptr;
q = s->exponents[ch];
@@ -1142,7 +1145,7 @@ static int decode_exp_vlc(WMADecodeContext *s, int ch)
/* NOTE: this offset is the same as MPEG4 AAC ! */
last_exp += code - 60;
/* XXX: use a table */
- v = pow_10_to_yover16[last_exp];
+ v = pow_10_to_yover16_ptr[last_exp];
if (v > max_scale)
{
max_scale = v;