diff options
| author | Mohamed Tarek <mt@rockbox.org> | 2010-07-26 22:03:20 +0000 |
|---|---|---|
| committer | Mohamed Tarek <mt@rockbox.org> | 2010-07-26 22:03:20 +0000 |
| commit | 5dd8c53b960d0b6680a0555a99e3232a5f890d07 (patch) | |
| tree | e69f972fa214d6ef2587a885120b190b5577b788 /apps/codecs/wmapro.c | |
| parent | 87d59ab56c30eadc4691a41ba7540cca868c9b50 (diff) | |
| download | rockbox-5dd8c53b960d0b6680a0555a99e3232a5f890d07.zip rockbox-5dd8c53b960d0b6680a0555a99e3232a5f890d07.tar.gz rockbox-5dd8c53b960d0b6680a0555a99e3232a5f890d07.tar.bz2 rockbox-5dd8c53b960d0b6680a0555a99e3232a5f890d07.tar.xz | |
Modify the wma pro decoder to produce non-interleaved samples, and work directly on the buffers in WMAProDecCtx instead to avoid the redundant copying of the output data. ~10% speedup (-2MHz) on pp502x and ~1.5% speedup (-3.8Mhz)
on mcf2049.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27583 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/wmapro.c')
| -rw-r--r-- | apps/codecs/wmapro.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/apps/codecs/wmapro.c b/apps/codecs/wmapro.c index 62759d0..c069e52 100644 --- a/apps/codecs/wmapro.c +++ b/apps/codecs/wmapro.c @@ -25,10 +25,7 @@ CODEC_HEADER -#define MAXSAMPLES (1L << 12) /* Max number of samples in a wma pro subframe */ -#define MAXCHANNELS 8 -#define BUFSIZE MAXCHANNELS * MAXSAMPLES -static int32_t decoded[BUFSIZE]; +int32_t *dec[2]; /* pointers to the output buffers in WMAProDecodeCtx in wmaprodec.c */ /* this is the codec entry point */ enum codec_status codec_main(void) @@ -73,7 +70,7 @@ next_track: ci->configure(DSP_SWITCH_FREQUENCY, wfx.rate); ci->configure(DSP_SET_STEREO_MODE, wfx.channels == 1 ? - STEREO_MONO : STEREO_INTERLEAVED); + STEREO_MONO : STEREO_NONINTERLEAVED); codec_set_replaygain(ci->id3); if (decode_init(&wfx) < 0) { @@ -130,8 +127,7 @@ next_track: * audio frames, see libwmapro/wmaprodec.c */ while(size > 0) { - outlen = BUFSIZE; /* decode_packet needs to know the size of the output buffer */ - res = decode_packet(&wfx, decoded, &outlen, data, size); + res = decode_packet(&wfx, dec, &outlen, data, size); if(res < 0) { LOGF("(WMA PRO) Error: decode_packet returned %d", res); goto done; @@ -140,10 +136,8 @@ next_track: size -= res; if(outlen) { ci->yield (); - /* outlen now holds the size of the data in bytes - we want the - * number of samples. */ - outlen /= (sizeof(int32_t) * wfx.channels); - ci->pcmbuf_insert(decoded, NULL, outlen); + outlen /= (2*wfx.channels); + ci->pcmbuf_insert(dec[0], dec[1], outlen ); elapsedtime += outlen*10/(wfx.rate/100); ci->set_elapsed(elapsedtime); ci->yield (); |