From 2dbb424eb934bfb5516aef96d541098348c058a0 Mon Sep 17 00:00:00 2001 From: Andree Buschmann Date: Sun, 30 Aug 2009 14:14:22 +0000 Subject: Further performance optimization of the atrac3 decoder. Rework the internal sample representation and usage of dsp routines. For now a quick and dirty solution is used to add a fract part of 2 bits. Through this several buffers and functions as well as copy loops could be removed. Furthermore add some ASM for coldfire and place some additional data in IRAM on PP5022/24 and X5/M5. Speedup on ARM: +3%, speedup on Coldfire: +639%. Both ARM and Coldfire can decode in realtime now. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22561 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/atrac3_rm.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'apps/codecs/atrac3_rm.c') diff --git a/apps/codecs/atrac3_rm.c b/apps/codecs/atrac3_rm.c index a8610f5764..f3bfa2f801 100644 --- a/apps/codecs/atrac3_rm.c +++ b/apps/codecs/atrac3_rm.c @@ -41,7 +41,6 @@ enum codec_status codec_main(void) static size_t buff_size; int datasize, res, consumed, i, time_offset; uint8_t *bit_buffer; - int16_t outbuf[2048] __attribute__((aligned(32))); uint16_t fs,sps,h; uint32_t packet_count; int scrambling_unit_size, num_units, elapsed = 0; @@ -62,9 +61,9 @@ next_track: init_rm(&rmctx); ci->configure(DSP_SET_FREQUENCY, ci->id3->frequency); - ci->configure(DSP_SET_SAMPLE_DEPTH, 16); + ci->configure(DSP_SET_SAMPLE_DEPTH, 17); /* Remark: atrac3 uses s15.0 by default, s15.2 was hacked. */ ci->configure(DSP_SET_STEREO_MODE, rmctx.nb_channels == 1 ? - STEREO_MONO : STEREO_INTERLEAVED); + STEREO_MONO : STEREO_NONINTERLEAVED); packet_count = rmctx.nb_packets; rmctx.audio_framesize = rmctx.block_align; @@ -145,7 +144,7 @@ seek_start : ci->seek_complete(); } if(pkt.length) - res = atrac3_decode_frame(&rmctx,&q, outbuf, &datasize, pkt.frames[i], rmctx.block_align); + res = atrac3_decode_frame(&rmctx, &q, &datasize, pkt.frames[i], rmctx.block_align); else /* indicates that there are no remaining frames */ goto done; @@ -155,7 +154,7 @@ seek_start : } if(datasize) - ci->pcmbuf_insert(outbuf, NULL, q.samples_per_frame / rmctx.nb_channels); + ci->pcmbuf_insert(q.outSamples, q.outSamples + 1024, q.samples_per_frame / rmctx.nb_channels); elapsed = rmctx.audiotimestamp+(1000*8*sps/rmctx.bit_rate)*i; ci->set_elapsed(elapsed); rmctx.frame_number++; -- cgit v1.2.3