From 0a1baa36b1d15fd392df531bc08b7445ef7d0371 Mon Sep 17 00:00:00 2001 From: Michael Giacomelli Date: Wed, 29 Apr 2009 17:44:02 +0000 Subject: Fix FS#10174 by correcting an oversimplification of the AAC window switching code I introduced with the unified IMDCT library. Should significantly improve accuracy for all AAC files. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20821 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/libfaad/filtbank.c | 20 ++++++++++++++++---- apps/codecs/libfaad/filtbank.h | 4 ++-- apps/codecs/libfaad/specrec.c | 9 ++++++--- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/apps/codecs/libfaad/filtbank.c b/apps/codecs/libfaad/filtbank.c index e5c1bd3870..90175d953c 100644 --- a/apps/codecs/libfaad/filtbank.c +++ b/apps/codecs/libfaad/filtbank.c @@ -198,8 +198,8 @@ static INLINE void mdct(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t ALIGN real_t transf_buf[2*1024] IBSS_ATTR; -void ifilter_bank(uint8_t window_sequence, - real_t *freq_in, +void ifilter_bank(uint8_t window_sequence, uint8_t window_shape, + uint8_t window_shape_prev, real_t *freq_in, real_t *time_out, real_t *overlap, uint8_t object_type, uint16_t frame_len) { @@ -232,10 +232,22 @@ void ifilter_bank(uint8_t window_sequence, (void) object_type; #endif - window_long = sine_long_1024; + /*AAC uses two different window shapes depending on spectal features*/ + if(window_shape == 0){ + window_long = sine_long_1024; + window_short = sine_short_128; + } else { + window_long = kbd_long_1024; + window_short = kbd_short_128; + } + + if(window_shape_prev == 0){ + window_long_prev = sine_long_1024; + window_short_prev = sine_short_128; + } else { window_long_prev = kbd_long_1024; - window_short = sine_short_128; window_short_prev = kbd_short_128; + } #ifdef LD_DEC } diff --git a/apps/codecs/libfaad/filtbank.h b/apps/codecs/libfaad/filtbank.h index 24c6017a35..8c9f1e3490 100644 --- a/apps/codecs/libfaad/filtbank.h +++ b/apps/codecs/libfaad/filtbank.h @@ -43,8 +43,8 @@ void filter_bank_ltp(fb_info *fb, uint16_t frame_len); #endif -void ifilter_bank(uint8_t window_sequence, - real_t *freq_in, +void ifilter_bank(uint8_t window_sequence, uint8_t window_shape, + uint8_t window_shape_prev, real_t *freq_in, real_t *time_out, real_t *overlap, uint8_t object_type, uint16_t frame_len); diff --git a/apps/codecs/libfaad/specrec.c b/apps/codecs/libfaad/specrec.c index de57c4b7ce..4998828eff 100644 --- a/apps/codecs/libfaad/specrec.c +++ b/apps/codecs/libfaad/specrec.c @@ -960,7 +960,8 @@ uint8_t reconstruct_single_channel(NeAACDecHandle hDecoder, ic_stream *ics, if (hDecoder->object_type != SSR) { #endif - ifilter_bank(ics->window_sequence,spec_coef, + ifilter_bank(ics->window_sequence,ics->window_shape, + hDecoder->window_shape_prev[sce->channel],spec_coef, hDecoder->time_out[sce->channel], hDecoder->fb_intermed[sce->channel], hDecoder->object_type, hDecoder->frameLength); #ifdef SSR_DEC @@ -1198,10 +1199,12 @@ uint8_t reconstruct_channel_pair(NeAACDecHandle hDecoder, ic_stream *ics1, ic_st if (hDecoder->object_type != SSR) { #endif - ifilter_bank(ics1->window_sequence, spec_coef1, + ifilter_bank(ics1->window_sequence,ics1->window_shape, + hDecoder->window_shape_prev[cpe->channel],spec_coef1, hDecoder->time_out[cpe->channel], hDecoder->fb_intermed[cpe->channel], hDecoder->object_type, hDecoder->frameLength); - ifilter_bank(ics2->window_sequence,spec_coef2, + ifilter_bank(ics2->window_sequence,ics2->window_shape, + hDecoder->window_shape_prev[cpe->paired_channel], spec_coef2, hDecoder->time_out[cpe->paired_channel], hDecoder->fb_intermed[cpe->paired_channel], hDecoder->object_type, hDecoder->frameLength); #ifdef SSR_DEC -- cgit v1.2.3