forked from len0rd/rockbox
Vorbis optimizations: allocation of PCM buffers in IRAM, avoiding copying.
Slight code improvements to the MDCT functions. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6590 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
127f14210f
commit
0f10e898f0
11 changed files with 110 additions and 132 deletions
|
@ -24,6 +24,17 @@
|
|||
#include "misc.h"
|
||||
#include "os.h"
|
||||
|
||||
|
||||
/* IRAM buffer keep the block pcm data; only for windows size upto 2048
|
||||
for space restrictions. No real compromise, larger window sizes
|
||||
are only used for very low quality settings (q<0?) */
|
||||
/* max 2 channels on the ihp-1xx (stereo), 2048 samples (2*2048*4=16Kb) */
|
||||
#define IRAM_PCM_END 2048
|
||||
#define CHANNELS 2
|
||||
|
||||
static ogg_int32_t *ipcm_vect[CHANNELS] IDATA_ATTR;
|
||||
static ogg_int32_t ipcm_buff[CHANNELS*IRAM_PCM_END] IDATA_ATTR;
|
||||
|
||||
int vorbis_synthesis(vorbis_block *vb,ogg_packet *op,int decodep){
|
||||
vorbis_dsp_state *vd=vb->vd;
|
||||
private_state *b=(private_state *)vd->backend_state;
|
||||
|
@ -65,10 +76,18 @@ int vorbis_synthesis(vorbis_block *vb,ogg_packet *op,int decodep){
|
|||
if(decodep){
|
||||
/* alloc pcm passback storage */
|
||||
vb->pcmend=ci->blocksizes[vb->W];
|
||||
vb->pcm=(ogg_int32_t **)_vorbis_block_alloc(vb,sizeof(*vb->pcm)*vi->channels);
|
||||
for(i=0;i<vi->channels;i++)
|
||||
vb->pcm[i]=(ogg_int32_t *)_vorbis_block_alloc(vb,vb->pcmend*sizeof(*vb->pcm[i]));
|
||||
|
||||
if (vi->channels <= CHANNELS && vb->pcmend<=IRAM_PCM_END) {
|
||||
/* use statically allocated iram buffer */
|
||||
vb->pcm = ipcm_vect;
|
||||
for(i=0; i<CHANNELS; i++)
|
||||
vb->pcm[i] = &ipcm_buff[i*IRAM_PCM_END];
|
||||
} else {
|
||||
/* dynamic allocation (slower) */
|
||||
vb->pcm=(ogg_int32_t **)_vorbis_block_alloc(vb,sizeof(*vb->pcm)*vi->channels);
|
||||
for(i=0;i<vi->channels;i++)
|
||||
vb->pcm[i]=(ogg_int32_t *)_vorbis_block_alloc(vb,vb->pcmend*sizeof(*vb->pcm[i]));
|
||||
}
|
||||
|
||||
/* unpack_header enforces range checking */
|
||||
type=ci->map_type[ci->mode_param[mode]->mapping];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue