summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Giacomelli <giac2000@hotmail.com>2009-04-29 17:44:02 +0000
committerMichael Giacomelli <giac2000@hotmail.com>2009-04-29 17:44:02 +0000
commit0a1baa36b1d15fd392df531bc08b7445ef7d0371 (patch)
tree85e533c3facde03549a156b52562343f6b8d52d3
parent14731bc3e2760139d8086fa742fd5fca61924c6a (diff)
downloadrockbox-0a1baa36b1d15fd392df531bc08b7445ef7d0371.tar.gz
rockbox-0a1baa36b1d15fd392df531bc08b7445ef7d0371.zip
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
-rw-r--r--apps/codecs/libfaad/filtbank.c20
-rw-r--r--apps/codecs/libfaad/filtbank.h4
-rw-r--r--apps/codecs/libfaad/specrec.c9
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
198 198
199ALIGN real_t transf_buf[2*1024] IBSS_ATTR; 199ALIGN real_t transf_buf[2*1024] IBSS_ATTR;
200 200
201void ifilter_bank(uint8_t window_sequence, 201void ifilter_bank(uint8_t window_sequence, uint8_t window_shape,
202 real_t *freq_in, 202 uint8_t window_shape_prev, real_t *freq_in,
203 real_t *time_out, real_t *overlap, 203 real_t *time_out, real_t *overlap,
204 uint8_t object_type, uint16_t frame_len) 204 uint8_t object_type, uint16_t frame_len)
205{ 205{
@@ -232,10 +232,22 @@ void ifilter_bank(uint8_t window_sequence,
232 (void) object_type; 232 (void) object_type;
233#endif 233#endif
234 234
235 window_long = sine_long_1024; 235 /*AAC uses two different window shapes depending on spectal features*/
236 if(window_shape == 0){
237 window_long = sine_long_1024;
238 window_short = sine_short_128;
239 } else {
240 window_long = kbd_long_1024;
241 window_short = kbd_short_128;
242 }
243
244 if(window_shape_prev == 0){
245 window_long_prev = sine_long_1024;
246 window_short_prev = sine_short_128;
247 } else {
236 window_long_prev = kbd_long_1024; 248 window_long_prev = kbd_long_1024;
237 window_short = sine_short_128;
238 window_short_prev = kbd_short_128; 249 window_short_prev = kbd_short_128;
250 }
239 251
240#ifdef LD_DEC 252#ifdef LD_DEC
241 } 253 }
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,
43 uint16_t frame_len); 43 uint16_t frame_len);
44#endif 44#endif
45 45
46void ifilter_bank(uint8_t window_sequence, 46void ifilter_bank(uint8_t window_sequence, uint8_t window_shape,
47 real_t *freq_in, 47 uint8_t window_shape_prev, real_t *freq_in,
48 real_t *time_out, real_t *overlap, 48 real_t *time_out, real_t *overlap,
49 uint8_t object_type, uint16_t frame_len); 49 uint8_t object_type, uint16_t frame_len);
50 50
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,
960 if (hDecoder->object_type != SSR) 960 if (hDecoder->object_type != SSR)
961 { 961 {
962#endif 962#endif
963 ifilter_bank(ics->window_sequence,spec_coef, 963 ifilter_bank(ics->window_sequence,ics->window_shape,
964 hDecoder->window_shape_prev[sce->channel],spec_coef,
964 hDecoder->time_out[sce->channel], hDecoder->fb_intermed[sce->channel], 965 hDecoder->time_out[sce->channel], hDecoder->fb_intermed[sce->channel],
965 hDecoder->object_type, hDecoder->frameLength); 966 hDecoder->object_type, hDecoder->frameLength);
966#ifdef SSR_DEC 967#ifdef SSR_DEC
@@ -1198,10 +1199,12 @@ uint8_t reconstruct_channel_pair(NeAACDecHandle hDecoder, ic_stream *ics1, ic_st
1198 if (hDecoder->object_type != SSR) 1199 if (hDecoder->object_type != SSR)
1199 { 1200 {
1200#endif 1201#endif
1201 ifilter_bank(ics1->window_sequence, spec_coef1, 1202 ifilter_bank(ics1->window_sequence,ics1->window_shape,
1203 hDecoder->window_shape_prev[cpe->channel],spec_coef1,
1202 hDecoder->time_out[cpe->channel], hDecoder->fb_intermed[cpe->channel], 1204 hDecoder->time_out[cpe->channel], hDecoder->fb_intermed[cpe->channel],
1203 hDecoder->object_type, hDecoder->frameLength); 1205 hDecoder->object_type, hDecoder->frameLength);
1204 ifilter_bank(ics2->window_sequence,spec_coef2, 1206 ifilter_bank(ics2->window_sequence,ics2->window_shape,
1207 hDecoder->window_shape_prev[cpe->paired_channel], spec_coef2,
1205 hDecoder->time_out[cpe->paired_channel], hDecoder->fb_intermed[cpe->paired_channel], 1208 hDecoder->time_out[cpe->paired_channel], hDecoder->fb_intermed[cpe->paired_channel],
1206 hDecoder->object_type, hDecoder->frameLength); 1209 hDecoder->object_type, hDecoder->frameLength);
1207#ifdef SSR_DEC 1210#ifdef SSR_DEC