diff options
| author | Mohamed Tarek <mt@rockbox.org> | 2010-08-04 22:29:50 +0000 |
|---|---|---|
| committer | Mohamed Tarek <mt@rockbox.org> | 2010-08-04 22:29:50 +0000 |
| commit | 3bbbb9639587fa17df470e605cda6ebd1a3af021 (patch) | |
| tree | 5fe4e540263b986521403d462db4d02f28b2b84d /apps/codecs/libwmapro/wma.c | |
| parent | 83be40f7d355e7af8db12f5854ada831a8c68e8e (diff) | |
| download | rockbox-3bbbb9639587fa17df470e605cda6ebd1a3af021.zip rockbox-3bbbb9639587fa17df470e605cda6ebd1a3af021.tar.gz rockbox-3bbbb9639587fa17df470e605cda6ebd1a3af021.tar.bz2 rockbox-3bbbb9639587fa17df470e605cda6ebd1a3af021.tar.xz | |
Use codeclib's mdct in wmapro. Input coeffs to the transform needed to be scaled down first by (log2(frame_size) - 3). Increases decoding speed by 1.3MHz on PP5022 and saves ~32KB that were previously needed by the mdct tables. (FS#11511 by Buschel and myself)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27701 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libwmapro/wma.c')
| -rw-r--r-- | apps/codecs/libwmapro/wma.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/apps/codecs/libwmapro/wma.c b/apps/codecs/libwmapro/wma.c index 64ec240..83cec89 100644 --- a/apps/codecs/libwmapro/wma.c +++ b/apps/codecs/libwmapro/wma.c @@ -20,6 +20,7 @@ */ #include "wma.h" +#include "codeclib.h" /* needed for av_log2() */ /** *@brief Get the samples per frame for this stream. @@ -109,14 +110,20 @@ int ff_wma_run_level_decode(GetBitContext* gb, { int32_t code, level, sign; const unsigned int coef_mask = block_len - 1; + /* Rockbox: To be able to use rockbox' optimized mdct we need to pre-shift + * the values by >>(nbits-3). */ + const int nbits = av_log2(block_len)+1; + const int shift = WMAPRO_FRACT-(nbits-3); for (; offset < num_coefs; offset++) { code = get_vlc2(gb, vlc->table, VLCBITS, VLCMAX); if (code > 1) { /** normal code */ offset += run_table[code]; sign = !get_bits1(gb); - ptr[offset & coef_mask] = sign ? -level_table[code] : level_table[code]; - ptr[offset & coef_mask] <<= WMAPRO_FRACT; + /* Rockbox: To be able to use rockbox' optimized mdct we need + * invert the sign. */ + ptr[offset & coef_mask] = sign ? level_table[code] : -level_table[code]; + ptr[offset & coef_mask] <<= shift; } else if (code == 1) { /** EOB */ break; @@ -143,8 +150,8 @@ int ff_wma_run_level_decode(GetBitContext* gb, } } sign = !get_bits1(gb); - ptr[offset & coef_mask] = sign ? -level : level; - ptr[offset & coef_mask] <<= WMAPRO_FRACT; + ptr[offset & coef_mask] = sign ? level : -level; + ptr[offset & coef_mask] <<= shift; } } /** NOTE: EOB can be omitted */ |