forked from len0rd/rockbox
Optimization for cook codec. Rework sample output to be able to use highly optimized dsp routines. Moved some functions to iram. Speeds up codec by 1.3 MHz on PP5022.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24815 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
a31624e76e
commit
3d6faa08bf
5 changed files with 34 additions and 56 deletions
|
|
@ -31,6 +31,7 @@ CODEC_HEADER
|
|||
RMContext rmctx;
|
||||
RMPacket pkt;
|
||||
COOKContext q IBSS_ATTR;
|
||||
int32_t rm_outbuf[2048];
|
||||
|
||||
static void init_rm(RMContext *rmctx)
|
||||
{
|
||||
|
|
@ -43,7 +44,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;
|
||||
|
|
@ -65,9 +65,11 @@ next_track:
|
|||
init_rm(&rmctx);
|
||||
|
||||
ci->configure(DSP_SET_FREQUENCY, ci->id3->frequency);
|
||||
ci->configure(DSP_SET_SAMPLE_DEPTH, 16);
|
||||
/* cook's sample representation is 21.11
|
||||
* DSP_SET_SAMPLE_DEPTH = 11 (FRACT) + 16 (NATIVE) - 1 (SIGN) = 26 */
|
||||
ci->configure(DSP_SET_SAMPLE_DEPTH, 26);
|
||||
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;
|
||||
|
|
@ -155,7 +157,7 @@ seek_start :
|
|||
ci->set_elapsed(rmctx.audiotimestamp+(1000*8*sps/rmctx.bit_rate)*i);
|
||||
ci->seek_complete();
|
||||
}
|
||||
res = cook_decode_frame(&rmctx,&q, outbuf, &datasize, pkt.frames[i], rmctx.block_align);
|
||||
res = cook_decode_frame(&rmctx,&q, rm_outbuf, &datasize, pkt.frames[i], rmctx.block_align);
|
||||
rmctx.frame_number++;
|
||||
|
||||
/* skip the first two frames; no valid audio */
|
||||
|
|
@ -166,7 +168,9 @@ seek_start :
|
|||
return CODEC_ERROR;
|
||||
}
|
||||
|
||||
ci->pcmbuf_insert(outbuf, NULL, q.samples_per_frame / rmctx.nb_channels);
|
||||
ci->pcmbuf_insert(rm_outbuf,
|
||||
rm_outbuf+q.samples_per_channel,
|
||||
q.samples_per_channel);
|
||||
ci->set_elapsed(rmctx.audiotimestamp+(1000*8*sps/rmctx.bit_rate)*i);
|
||||
}
|
||||
packet_count -= rmctx.audio_pkt_cnt;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue