summaryrefslogtreecommitdiff
path: root/apps/codecs/atrac3_rm.c
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2009-08-30 14:14:22 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2009-08-30 14:14:22 +0000
commit2dbb424eb934bfb5516aef96d541098348c058a0 (patch)
tree68b9ad1858ab2ae0c67c64b86e9bf9e70ee6434f /apps/codecs/atrac3_rm.c
parent2a49ff672edaaff5978ca9ef0f75edb5bca49a1a (diff)
downloadrockbox-2dbb424eb934bfb5516aef96d541098348c058a0.tar.gz
rockbox-2dbb424eb934bfb5516aef96d541098348c058a0.zip
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
Diffstat (limited to 'apps/codecs/atrac3_rm.c')
-rw-r--r--apps/codecs/atrac3_rm.c9
1 files changed, 4 insertions, 5 deletions
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)
41 static size_t buff_size; 41 static size_t buff_size;
42 int datasize, res, consumed, i, time_offset; 42 int datasize, res, consumed, i, time_offset;
43 uint8_t *bit_buffer; 43 uint8_t *bit_buffer;
44 int16_t outbuf[2048] __attribute__((aligned(32)));
45 uint16_t fs,sps,h; 44 uint16_t fs,sps,h;
46 uint32_t packet_count; 45 uint32_t packet_count;
47 int scrambling_unit_size, num_units, elapsed = 0; 46 int scrambling_unit_size, num_units, elapsed = 0;
@@ -62,9 +61,9 @@ next_track:
62 init_rm(&rmctx); 61 init_rm(&rmctx);
63 62
64 ci->configure(DSP_SET_FREQUENCY, ci->id3->frequency); 63 ci->configure(DSP_SET_FREQUENCY, ci->id3->frequency);
65 ci->configure(DSP_SET_SAMPLE_DEPTH, 16); 64 ci->configure(DSP_SET_SAMPLE_DEPTH, 17); /* Remark: atrac3 uses s15.0 by default, s15.2 was hacked. */
66 ci->configure(DSP_SET_STEREO_MODE, rmctx.nb_channels == 1 ? 65 ci->configure(DSP_SET_STEREO_MODE, rmctx.nb_channels == 1 ?
67 STEREO_MONO : STEREO_INTERLEAVED); 66 STEREO_MONO : STEREO_NONINTERLEAVED);
68 67
69 packet_count = rmctx.nb_packets; 68 packet_count = rmctx.nb_packets;
70 rmctx.audio_framesize = rmctx.block_align; 69 rmctx.audio_framesize = rmctx.block_align;
@@ -145,7 +144,7 @@ seek_start :
145 ci->seek_complete(); 144 ci->seek_complete();
146 } 145 }
147 if(pkt.length) 146 if(pkt.length)
148 res = atrac3_decode_frame(&rmctx,&q, outbuf, &datasize, pkt.frames[i], rmctx.block_align); 147 res = atrac3_decode_frame(&rmctx, &q, &datasize, pkt.frames[i], rmctx.block_align);
149 else /* indicates that there are no remaining frames */ 148 else /* indicates that there are no remaining frames */
150 goto done; 149 goto done;
151 150
@@ -155,7 +154,7 @@ seek_start :
155 } 154 }
156 155
157 if(datasize) 156 if(datasize)
158 ci->pcmbuf_insert(outbuf, NULL, q.samples_per_frame / rmctx.nb_channels); 157 ci->pcmbuf_insert(q.outSamples, q.outSamples + 1024, q.samples_per_frame / rmctx.nb_channels);
159 elapsed = rmctx.audiotimestamp+(1000*8*sps/rmctx.bit_rate)*i; 158 elapsed = rmctx.audiotimestamp+(1000*8*sps/rmctx.bit_rate)*i;
160 ci->set_elapsed(elapsed); 159 ci->set_elapsed(elapsed);
161 rmctx.frame_number++; 160 rmctx.frame_number++;