summaryrefslogtreecommitdiff
path: root/apps/codecs/libwma/wmadeci.c
diff options
context:
space:
mode:
authorMichael Giacomelli <giac2000@hotmail.com>2008-06-28 18:56:19 +0000
committerMichael Giacomelli <giac2000@hotmail.com>2008-06-28 18:56:19 +0000
commita06f651c3e5f52820e5c7233fa06ef21f793c812 (patch)
tree9f62f8c8308512ad1093bdcac2e90dd04a02ed28 /apps/codecs/libwma/wmadeci.c
parent54635b74a57e31877ac3c9dd9a7b9bf2b012e0e9 (diff)
downloadrockbox-a06f651c3e5f52820e5c7233fa06ef21f793c812.tar.gz
rockbox-a06f651c3e5f52820e5c7233fa06ef21f793c812.zip
Put the WMA windowing and output buffer into IRAM on targets with > 96KB of it. Improves 192k WMA decoding speed by about 2MHz on PP5024, and maybe saves some more when applying DSP.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17853 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libwma/wmadeci.c')
-rw-r--r--apps/codecs/libwma/wmadeci.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/apps/codecs/libwma/wmadeci.c b/apps/codecs/libwma/wmadeci.c
index 20c22187b2..23916f6dc8 100644
--- a/apps/codecs/libwma/wmadeci.c
+++ b/apps/codecs/libwma/wmadeci.c
@@ -52,6 +52,8 @@ CoefVLCTable;
52static void wma_lsp_to_curve_init(WMADecodeContext *s, int frame_len); 52static void wma_lsp_to_curve_init(WMADecodeContext *s, int frame_len);
53 53
54fixed32 coefsarray[MAX_CHANNELS][BLOCK_MAX_SIZE] IBSS_ATTR; 54fixed32 coefsarray[MAX_CHANNELS][BLOCK_MAX_SIZE] IBSS_ATTR;
55/*decode and window into IRAM on targets with at least 80KB of codec IRAM*/
56fixed32 frame_out_buf[MAX_CHANNELS][BLOCK_MAX_SIZE * 2] IBSS_ATTR_WMA_LARGE_IRAM;
55 57
56//static variables that replace malloced stuff 58//static variables that replace malloced stuff
57fixed32 stat0[2048], stat1[1024], stat2[512], stat3[256], stat4[128]; //these are the MDCT reconstruction windows 59fixed32 stat0[2048], stat1[1024], stat2[512], stat3[256], stat4[128]; //these are the MDCT reconstruction windows
@@ -329,6 +331,7 @@ int wma_decode_init(WMADecodeContext* s, asf_waveformatex_t *wfx)
329 s->block_align = wfx->blockalign; 331 s->block_align = wfx->blockalign;
330 332
331 s->coefs = &coefsarray; 333 s->coefs = &coefsarray;
334 s->frame_out = &frame_out_buf;
332 335
333 if (wfx->codec_id == ASF_CODEC_ID_WMAV1) { 336 if (wfx->codec_id == ASF_CODEC_ID_WMAV1) {
334 s->version = 1; 337 s->version = 1;
@@ -1369,7 +1372,6 @@ static int wma_decode_block(WMADecodeContext *s)
1369 if (s->channel_coded[ch]) 1372 if (s->channel_coded[ch])
1370 { 1373 {
1371 static fixed32 output[BLOCK_MAX_SIZE * 2] IBSS_ATTR; 1374 static fixed32 output[BLOCK_MAX_SIZE * 2] IBSS_ATTR;
1372
1373 int n4, index, n; 1375 int n4, index, n;
1374 1376
1375 n = s->block_len; 1377 n = s->block_len;
@@ -1382,8 +1384,7 @@ static int wma_decode_block(WMADecodeContext *s)
1382 1384
1383 /* add in the frame */ 1385 /* add in the frame */
1384 index = (s->frame_len / 2) + s->block_pos - n4; 1386 index = (s->frame_len / 2) + s->block_pos - n4;
1385 1387 wma_window(s, output, &((*s->frame_out)[ch][index]));
1386 wma_window(s, output, &s->frame_out[ch][index]);
1387 1388
1388 1389
1389 1390
@@ -1391,7 +1392,7 @@ static int wma_decode_block(WMADecodeContext *s)
1391 channel if it is not coded */ 1392 channel if it is not coded */
1392 if (s->ms_stereo && !s->channel_coded[1]) 1393 if (s->ms_stereo && !s->channel_coded[1])
1393 { 1394 {
1394 wma_window(s, output, &s->frame_out[1][index]); 1395 wma_window(s, output, &((*s->frame_out)[1][index]));
1395 } 1396 }
1396 } 1397 }
1397 } 1398 }
@@ -1415,7 +1416,6 @@ static int wma_decode_frame(WMADecodeContext *s, int32_t *samples)
1415 int ret, i, n, ch, incr; 1416 int ret, i, n, ch, incr;
1416 int32_t *ptr; 1417 int32_t *ptr;
1417 fixed32 *iptr; 1418 fixed32 *iptr;
1418 // rb->splash(HZ, "in wma_decode_frame");
1419 1419
1420 /* read each block */ 1420 /* read each block */
1421 s->block_num = 0; 1421 s->block_num = 0;
@@ -1443,17 +1443,16 @@ static int wma_decode_frame(WMADecodeContext *s, int32_t *samples)
1443 for(ch = 0; ch < s->nb_channels; ++ch) 1443 for(ch = 0; ch < s->nb_channels; ++ch)
1444 { 1444 {
1445 ptr = samples + ch; 1445 ptr = samples + ch;
1446 iptr = s->frame_out[ch]; 1446 iptr = &((*s->frame_out)[ch][0]);
1447 1447
1448 for (i=0;i<n;++i) 1448 for (i=0;i<n;++i)
1449 { 1449 {
1450 *ptr = (*iptr++); 1450 *ptr = (*iptr++);
1451 ptr += incr; 1451 ptr += incr;
1452 } 1452 }
1453 /* prepare for next block */
1454 memmove(&s->frame_out[ch][0], &s->frame_out[ch][s->frame_len],
1455 s->frame_len * sizeof(fixed32));
1456 1453
1454 memmove(&((*s->frame_out)[ch][0]), &((*s->frame_out)[ch][s->frame_len]),
1455 s->frame_len * sizeof(fixed32));
1457 } 1456 }
1458 1457
1459 return 0; 1458 return 0;