diff options
author | Marcoen Hirschberg <marcoen@gmail.com> | 2007-08-06 23:34:28 +0000 |
---|---|---|
committer | Marcoen Hirschberg <marcoen@gmail.com> | 2007-08-06 23:34:28 +0000 |
commit | c43629f08bc03cc1b169731236d96c11a6a81ac1 (patch) | |
tree | 046592ddcb6c6200eecd172940d7bda67172133a /apps/codecs | |
parent | 0ee44031f0b5ab7539886b43685b67b3a14159a1 (diff) | |
download | rockbox-c43629f08bc03cc1b169731236d96c11a6a81ac1.tar.gz rockbox-c43629f08bc03cc1b169731236d96c11a6a81ac1.zip |
use the full resolution we get from the WMA decoder and let the DSP code do the rest
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14224 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs')
-rw-r--r-- | apps/codecs/libwma/wmadec.h | 2 | ||||
-rw-r--r-- | apps/codecs/libwma/wmadeci.c | 22 | ||||
-rw-r--r-- | apps/codecs/wma.c | 4 |
3 files changed, 9 insertions, 19 deletions
diff --git a/apps/codecs/libwma/wmadec.h b/apps/codecs/libwma/wmadec.h index 8ae49eed0c..95eb31956a 100644 --- a/apps/codecs/libwma/wmadec.h +++ b/apps/codecs/libwma/wmadec.h | |||
@@ -172,6 +172,6 @@ int wma_decode_init(WMADecodeContext* s, asf_waveformatex_t *wfx); | |||
172 | int wma_decode_superframe_init(WMADecodeContext* s, | 172 | int wma_decode_superframe_init(WMADecodeContext* s, |
173 | uint8_t *buf, int buf_size); | 173 | uint8_t *buf, int buf_size); |
174 | int wma_decode_superframe_frame(WMADecodeContext* s, | 174 | int wma_decode_superframe_frame(WMADecodeContext* s, |
175 | int16_t *samples, | 175 | int32_t *samples, |
176 | uint8_t *buf, int buf_size); | 176 | uint8_t *buf, int buf_size); |
177 | #endif | 177 | #endif |
diff --git a/apps/codecs/libwma/wmadeci.c b/apps/codecs/libwma/wmadeci.c index b867e5c6f1..dfce09aa01 100644 --- a/apps/codecs/libwma/wmadeci.c +++ b/apps/codecs/libwma/wmadeci.c | |||
@@ -1619,10 +1619,10 @@ next: | |||
1619 | } | 1619 | } |
1620 | 1620 | ||
1621 | /* decode a frame of frame_len samples */ | 1621 | /* decode a frame of frame_len samples */ |
1622 | static int wma_decode_frame(WMADecodeContext *s, int16_t *samples) | 1622 | static int wma_decode_frame(WMADecodeContext *s, int32_t *samples) |
1623 | { | 1623 | { |
1624 | int ret, i, n, a, ch, incr; | 1624 | int ret, i, n, ch, incr; |
1625 | int16_t *ptr; | 1625 | int32_t *ptr; |
1626 | fixed32 *iptr; | 1626 | fixed32 *iptr; |
1627 | // rb->splash(HZ, "in wma_decode_frame"); | 1627 | // rb->splash(HZ, "in wma_decode_frame"); |
1628 | 1628 | ||
@@ -1646,7 +1646,7 @@ static int wma_decode_frame(WMADecodeContext *s, int16_t *samples) | |||
1646 | } | 1646 | } |
1647 | } | 1647 | } |
1648 | 1648 | ||
1649 | /* convert frame to integer */ | 1649 | /* return frame with full 30-bit precision */ |
1650 | n = s->frame_len; | 1650 | n = s->frame_len; |
1651 | incr = s->nb_channels; | 1651 | incr = s->nb_channels; |
1652 | for(ch = 0; ch < s->nb_channels; ++ch) | 1652 | for(ch = 0; ch < s->nb_channels; ++ch) |
@@ -1656,17 +1656,7 @@ static int wma_decode_frame(WMADecodeContext *s, int16_t *samples) | |||
1656 | 1656 | ||
1657 | for (i=0;i<n;++i) | 1657 | for (i=0;i<n;++i) |
1658 | { | 1658 | { |
1659 | a = fixtoi32(*iptr++)<<1; //ugly but good enough for now | 1659 | *ptr = (*iptr++); |
1660 | |||
1661 | if (a > 32767) | ||
1662 | { | ||
1663 | a = 32767; | ||
1664 | } | ||
1665 | else if (a < -32768) | ||
1666 | { | ||
1667 | a = -32768; | ||
1668 | } | ||
1669 | *ptr = a; | ||
1670 | ptr += incr; | 1660 | ptr += incr; |
1671 | } | 1661 | } |
1672 | /* prepare for next block */ | 1662 | /* prepare for next block */ |
@@ -1719,7 +1709,7 @@ int wma_decode_superframe_init(WMADecodeContext* s, | |||
1719 | */ | 1709 | */ |
1720 | 1710 | ||
1721 | int wma_decode_superframe_frame(WMADecodeContext* s, | 1711 | int wma_decode_superframe_frame(WMADecodeContext* s, |
1722 | int16_t* samples, /*output*/ | 1712 | int32_t* samples, /*output*/ |
1723 | uint8_t *buf, /*input*/ | 1713 | uint8_t *buf, /*input*/ |
1724 | int buf_size) | 1714 | int buf_size) |
1725 | { | 1715 | { |
diff --git a/apps/codecs/wma.c b/apps/codecs/wma.c index 7d9f3c81c6..bf11841451 100644 --- a/apps/codecs/wma.c +++ b/apps/codecs/wma.c | |||
@@ -27,7 +27,7 @@ CODEC_HEADER | |||
27 | BLOCK_MAX_SIZE is 2048 (samples) and MAX_CHANNELS is 2. | 27 | BLOCK_MAX_SIZE is 2048 (samples) and MAX_CHANNELS is 2. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | static uint16_t decoded[BLOCK_MAX_SIZE * MAX_CHANNELS]; | 30 | static uint32_t decoded[BLOCK_MAX_SIZE * MAX_CHANNELS]; |
31 | 31 | ||
32 | /* NOTE: WMADecodeContext is 120152 bytes (on x86) */ | 32 | /* NOTE: WMADecodeContext is 120152 bytes (on x86) */ |
33 | static WMADecodeContext wmadec; | 33 | static WMADecodeContext wmadec; |
@@ -319,7 +319,7 @@ enum codec_status codec_main(void) | |||
319 | ci->configure(CODEC_SET_FILEBUF_WATERMARK, 1024*512); | 319 | ci->configure(CODEC_SET_FILEBUF_WATERMARK, 1024*512); |
320 | ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*128); | 320 | ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*128); |
321 | 321 | ||
322 | ci->configure(DSP_SET_SAMPLE_DEPTH, 15); | 322 | ci->configure(DSP_SET_SAMPLE_DEPTH, 30); |
323 | 323 | ||
324 | next_track: | 324 | next_track: |
325 | 325 | ||