diff options
Diffstat (limited to 'apps/codecs/libwma')
-rw-r--r-- | apps/codecs/libwma/wmadec.h | 14 | ||||
-rw-r--r-- | apps/codecs/libwma/wmadeci.c | 17 |
2 files changed, 21 insertions, 10 deletions
diff --git a/apps/codecs/libwma/wmadec.h b/apps/codecs/libwma/wmadec.h index f7434ed759..30ba35b533 100644 --- a/apps/codecs/libwma/wmadec.h +++ b/apps/codecs/libwma/wmadec.h | |||
@@ -54,6 +54,17 @@ | |||
54 | 54 | ||
55 | #define LSP_POW_BITS 7 | 55 | #define LSP_POW_BITS 7 |
56 | 56 | ||
57 | /*define IRAM for targets with 48k/80k IRAM split*/ | ||
58 | #ifndef IBSS_ATTR_WMA_LARGE_IRAM | ||
59 | #if (CONFIG_CPU == PP5022) || (CONFIG_CPU == PP5024) || (CONFIG_CPU == MCF5250) | ||
60 | /* PP5022/24 and MCF5250 have 128KB of IRAM, with 80KB allocated for codecs */ | ||
61 | #define IBSS_ATTR_WMA_LARGE_IRAM IBSS_ATTR | ||
62 | #else | ||
63 | /* other PP's and MCF5249 have 96KB of IRAM */ | ||
64 | #define IBSS_ATTR_WMA_LARGE_IRAM | ||
65 | #endif | ||
66 | #endif | ||
67 | |||
57 | typedef struct WMADecodeContext | 68 | typedef struct WMADecodeContext |
58 | { | 69 | { |
59 | GetBitContext gb; | 70 | GetBitContext gb; |
@@ -110,7 +121,8 @@ typedef struct WMADecodeContext | |||
110 | MDCTContext mdct_ctx[BLOCK_NB_SIZES]; | 121 | MDCTContext mdct_ctx[BLOCK_NB_SIZES]; |
111 | fixed32 *windows[BLOCK_NB_SIZES]; | 122 | fixed32 *windows[BLOCK_NB_SIZES]; |
112 | /* output buffer for one frame and the last for IMDCT windowing */ | 123 | /* output buffer for one frame and the last for IMDCT windowing */ |
113 | fixed32 frame_out[MAX_CHANNELS][BLOCK_MAX_SIZE * 2]; | 124 | fixed32 (*frame_out)[MAX_CHANNELS][BLOCK_MAX_SIZE*2]; |
125 | |||
114 | /* last frame info */ | 126 | /* last frame info */ |
115 | uint8_t last_superframe[MAX_CODED_SUPERFRAME_SIZE + 4]; /* padding added */ | 127 | uint8_t last_superframe[MAX_CODED_SUPERFRAME_SIZE + 4]; /* padding added */ |
116 | int last_bitoffset; | 128 | int last_bitoffset; |
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; | |||
52 | static void wma_lsp_to_curve_init(WMADecodeContext *s, int frame_len); | 52 | static void wma_lsp_to_curve_init(WMADecodeContext *s, int frame_len); |
53 | 53 | ||
54 | fixed32 coefsarray[MAX_CHANNELS][BLOCK_MAX_SIZE] IBSS_ATTR; | 54 | fixed32 coefsarray[MAX_CHANNELS][BLOCK_MAX_SIZE] IBSS_ATTR; |
55 | /*decode and window into IRAM on targets with at least 80KB of codec IRAM*/ | ||
56 | fixed32 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 |
57 | fixed32 stat0[2048], stat1[1024], stat2[512], stat3[256], stat4[128]; //these are the MDCT reconstruction windows | 59 | fixed32 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; |