diff options
author | Michael Giacomelli <giac2000@hotmail.com> | 2007-09-02 03:28:49 +0000 |
---|---|---|
committer | Michael Giacomelli <giac2000@hotmail.com> | 2007-09-02 03:28:49 +0000 |
commit | a514c60fd0952c0682aa544ee1e16445e6b7df84 (patch) | |
tree | e60e6a0269e31994536567e7e6dfe972d79e3823 /apps | |
parent | f2ed1e40088fb2fcb9d715fa321c4c69e79243d4 (diff) | |
download | rockbox-a514c60fd0952c0682aa544ee1e16445e6b7df84.tar.gz 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
Diffstat (limited to 'apps')
-rw-r--r-- | apps/codecs/libwma/wmadata.h | 5 | ||||
-rw-r--r-- | apps/codecs/libwma/wmadeci.c | 5 |
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[] = | |||
1456 | 0x14f2e7a000000LL,0x1781474000000LL,0x1a5f7f4000000LL,0x1d974de000000LL,0x2133a18000000LL | 1456 | 0x14f2e7a000000LL,0x1781474000000LL,0x1a5f7f4000000LL,0x1d974de000000LL,0x2133a18000000LL |
1457 | }; | 1457 | }; |
1458 | 1458 | ||
1459 | /*10^(index/16). We'll need to accomidate negative indicies too*/ | ||
1459 | const fixed32 pow_10_to_yover16[] ICONST_ATTR= | 1460 | const fixed32 pow_10_to_yover16[] ICONST_ATTR= |
1460 | { | 1461 | { |
1462 | /*16 negative indicies (-16 to -1)*/ | ||
1463 | 0x199a,0x1d90,0x2223,0x276c,0x2d86,0x3492,0x3cb5,0x461b,0x50f4,0x5d7c,0x6bf4,0x7caa,0x8ff6,0xa63e, | ||
1464 | 0xbff9, 0xddb0, | ||
1465 | /*non-negative indicies*/ | ||
1461 | 0x10000,0x127a0,0x15562,0x18a39,0x1c73d,0x20db4,0x25f12,0x2bd09,0x3298b,0x3a6d9,0x4378b,0x4dea3, | 1466 | 0x10000,0x127a0,0x15562,0x18a39,0x1c73d,0x20db4,0x25f12,0x2bd09,0x3298b,0x3a6d9,0x4378b,0x4dea3, |
1462 | 0x59f98,0x67e6b,0x77fbb,0x8a8de,0xa0000,0xb8c3e,0xd55d1,0xf6636,0x11c865,0x148906,0x17b6b8,0x1b625b, | 1467 | 0x59f98,0x67e6b,0x77fbb,0x8a8de,0xa0000,0xb8c3e,0xd55d1,0xf6636,0x11c865,0x148906,0x17b6b8,0x1b625b, |
1463 | 0x1f9f6e,0x248475,0x2a2b6e,0x30b25f,0x383bf0,0x40f02c,0x4afd4b,0x5698b0,0x640000,0x737a6b,0x855a26, | 1468 | 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) | |||
1110 | fixed32 v, max_scale; | 1110 | fixed32 v, max_scale; |
1111 | fixed32 *q,*q_end; | 1111 | fixed32 *q,*q_end; |
1112 | 1112 | ||
1113 | /*accommodate the 16 negative indices */ | ||
1114 | fixed32 *pow_10_to_yover16_ptr = &pow_10_to_yover16[16]; | ||
1115 | |||
1113 | band_ptr = s->exponent_bands[s->frame_len_bits - s->block_len_bits]; | 1116 | band_ptr = s->exponent_bands[s->frame_len_bits - s->block_len_bits]; |
1114 | ptr = band_ptr; | 1117 | ptr = band_ptr; |
1115 | q = s->exponents[ch]; | 1118 | q = s->exponents[ch]; |
@@ -1142,7 +1145,7 @@ static int decode_exp_vlc(WMADecodeContext *s, int ch) | |||
1142 | /* NOTE: this offset is the same as MPEG4 AAC ! */ | 1145 | /* NOTE: this offset is the same as MPEG4 AAC ! */ |
1143 | last_exp += code - 60; | 1146 | last_exp += code - 60; |
1144 | /* XXX: use a table */ | 1147 | /* XXX: use a table */ |
1145 | v = pow_10_to_yover16[last_exp]; | 1148 | v = pow_10_to_yover16_ptr[last_exp]; |
1146 | if (v > max_scale) | 1149 | if (v > max_scale) |
1147 | { | 1150 | { |
1148 | max_scale = v; | 1151 | max_scale = v; |