diff options
author | Thomas Martitz <kugel@rockbox.org> | 2014-04-15 23:49:07 +0200 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2014-04-15 23:49:07 +0200 |
commit | 466441dc14f2463dbd48aa6ab268317269100e4a (patch) | |
tree | e45c579fdf1554f9f56aa8ea23d902b098c21235 | |
parent | bd10245e8940c05e9c4bfe13744571daf43a164a (diff) | |
download | rockbox-466441dc14f2463dbd48aa6ab268317269100e4a.tar.gz rockbox-466441dc14f2463dbd48aa6ab268317269100e4a.zip |
libmad: Use 32bit unsigned for requantize table.
Implicit promotion of integer literals to unsigned long introduced a subtle bug
on 64-bit systems due to weird sign extensions (leads to audible glitches in a
few files). The table is originally designed for unsigned 32bit integers, and
it works with those so use them. As a consequence the lookup table size is
halved as well.
Change-Id: I35d878d6df03300387f0e403e0f3c3bdc73eea00
-rw-r--r-- | lib/rbcodec/codecs/libmad/layer3.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/rbcodec/codecs/libmad/layer3.c b/lib/rbcodec/codecs/libmad/layer3.c index ffb0fb20ff..48bb643b93 100644 --- a/lib/rbcodec/codecs/libmad/layer3.c +++ b/lib/rbcodec/codecs/libmad/layer3.c | |||
@@ -339,7 +339,7 @@ unsigned char const pretab[22] = { | |||
339 | * format rq_table: bit31-27=exponent bit26-0=mantissa | 339 | * format rq_table: bit31-27=exponent bit26-0=mantissa |
340 | */ | 340 | */ |
341 | static | 341 | static |
342 | unsigned long const rq_table[8207] = { | 342 | uint32_t const rq_table[8207] = { |
343 | # include "rq_table.dat" | 343 | # include "rq_table.dat" |
344 | }; | 344 | }; |
345 | 345 | ||
@@ -885,7 +885,7 @@ mad_fixed_t III_requantize(unsigned int value, signed int exp) | |||
885 | { | 885 | { |
886 | mad_fixed_t requantized; | 886 | mad_fixed_t requantized; |
887 | signed int frac; | 887 | signed int frac; |
888 | unsigned long power; | 888 | uint32_t power; |
889 | 889 | ||
890 | frac = exp % 4; /* assumes sign(frac) == sign(exp) */ | 890 | frac = exp % 4; /* assumes sign(frac) == sign(exp) */ |
891 | exp /= 4; | 891 | exp /= 4; |