From 3bbbb9639587fa17df470e605cda6ebd1a3af021 Mon Sep 17 00:00:00 2001 From: Mohamed Tarek Date: Wed, 4 Aug 2010 22:29:50 +0000 Subject: 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 --- apps/codecs/libwmapro/wmaprodec.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'apps/codecs/libwmapro/wmaprodec.c') diff --git a/apps/codecs/libwmapro/wmaprodec.c b/apps/codecs/libwmapro/wmaprodec.c index a7a0f4d..e5a5fd9 100644 --- a/apps/codecs/libwmapro/wmaprodec.c +++ b/apps/codecs/libwmapro/wmaprodec.c @@ -91,7 +91,7 @@ #include "wmaprodata.h" #include "wma.h" #include "wmaprodec.h" -#include "wmapro_mdct.h" +//#include "wmapro_mdct.h" #include "mdct_tables.h" #include "quant.h" #include "wmapro_math.h" @@ -878,11 +878,18 @@ static int decode_coeffs(WMAProDecodeCtx *s, int c) vals[3] = (symbol_to_vec4[idx] ) & 0xF; } + /* Rockbox: To be able to use rockbox' optimized mdct we need to + * pre-shift the values by >>(nbits-3). */ + const int nbits = av_log2(s->subframe_len)+1; + const int shift = WMAPRO_FRACT-(nbits-3); + /** decode sign */ for (i = 0; i < 4; i++) { if (vals[i]) { int sign = get_bits1(&s->gb) - 1; - ci->coeffs[cur_coeff] = (sign == -1)? -vals[i]<coeffs[cur_coeff] = (sign == -1)? vals[i]<coeffs[cur_coeff] = 0; @@ -1266,6 +1273,7 @@ static int decode_subframe(WMAProDecodeCtx *s) get_bits_count(&s->gb) - s->subframe_offset); if (transmit_coeffs) { + int nbits = av_log2(subframe_len)+1; /** reconstruct the per channel data */ inverse_channel_transform(s); for (i = 0; i < s->channels_for_cur_subframe; i++) { @@ -1276,7 +1284,7 @@ static int decode_subframe(WMAProDecodeCtx *s) if (c == s->lfe_channel) memset(&s->tmp[cur_subwoofer_cutoff], 0, sizeof(*s->tmp) * (subframe_len - cur_subwoofer_cutoff)); - + /** inverse quantization and rescaling */ for (b = 0; b < s->num_bands; b++) { const int end = FFMIN(s->cur_sfb_offsets[b+1], s->subframe_len); @@ -1299,8 +1307,7 @@ static int decode_subframe(WMAProDecodeCtx *s) } /** apply imdct (ff_imdct_half == DCTIV with reverse) */ - imdct_half(av_log2(subframe_len)+1, - s->channel[c].coeffs, s->tmp); + ff_imdct_half(nbits,s->channel[c].coeffs, s->tmp); } } -- cgit v1.1