summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMarcoen Hirschberg <marcoen@gmail.com>2007-08-06 23:34:28 +0000
committerMarcoen Hirschberg <marcoen@gmail.com>2007-08-06 23:34:28 +0000
commitc43629f08bc03cc1b169731236d96c11a6a81ac1 (patch)
tree046592ddcb6c6200eecd172940d7bda67172133a /apps
parent0ee44031f0b5ab7539886b43685b67b3a14159a1 (diff)
downloadrockbox-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')
-rw-r--r--apps/codecs/libwma/wmadec.h2
-rw-r--r--apps/codecs/libwma/wmadeci.c22
-rw-r--r--apps/codecs/wma.c4
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);
int wma_decode_superframe_init(WMADecodeContext* s,
uint8_t *buf, int buf_size);
int wma_decode_superframe_frame(WMADecodeContext* s,
- int16_t *samples,
+ int32_t *samples,
uint8_t *buf, int buf_size);
#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:
}
/* decode a frame of frame_len samples */
-static int wma_decode_frame(WMADecodeContext *s, int16_t *samples)
+static int wma_decode_frame(WMADecodeContext *s, int32_t *samples)
{
- int ret, i, n, a, ch, incr;
- int16_t *ptr;
+ int ret, i, n, ch, incr;
+ int32_t *ptr;
fixed32 *iptr;
// rb->splash(HZ, "in wma_decode_frame");
@@ -1646,7 +1646,7 @@ static int wma_decode_frame(WMADecodeContext *s, int16_t *samples)
}
}
- /* convert frame to integer */
+ /* return frame with full 30-bit precision */
n = s->frame_len;
incr = s->nb_channels;
for(ch = 0; ch < s->nb_channels; ++ch)
@@ -1656,17 +1656,7 @@ static int wma_decode_frame(WMADecodeContext *s, int16_t *samples)
for (i=0;i<n;++i)
{
- a = fixtoi32(*iptr++)<<1; //ugly but good enough for now
-
- if (a > 32767)
- {
- a = 32767;
- }
- else if (a < -32768)
- {
- a = -32768;
- }
- *ptr = a;
+ *ptr = (*iptr++);
ptr += incr;
}
/* prepare for next block */
@@ -1719,7 +1709,7 @@ int wma_decode_superframe_init(WMADecodeContext* s,
*/
int wma_decode_superframe_frame(WMADecodeContext* s,
- int16_t* samples, /*output*/
+ int32_t* samples, /*output*/
uint8_t *buf, /*input*/
int buf_size)
{
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
BLOCK_MAX_SIZE is 2048 (samples) and MAX_CHANNELS is 2.
*/
-static uint16_t decoded[BLOCK_MAX_SIZE * MAX_CHANNELS];
+static uint32_t decoded[BLOCK_MAX_SIZE * MAX_CHANNELS];
/* NOTE: WMADecodeContext is 120152 bytes (on x86) */
static WMADecodeContext wmadec;
@@ -319,7 +319,7 @@ enum codec_status codec_main(void)
ci->configure(CODEC_SET_FILEBUF_WATERMARK, 1024*512);
ci->configure(CODEC_SET_FILEBUF_CHUNKSIZE, 1024*128);
- ci->configure(DSP_SET_SAMPLE_DEPTH, 15);
+ ci->configure(DSP_SET_SAMPLE_DEPTH, 30);
next_track: