diff options
Diffstat (limited to 'apps/codecs/Tremor/synthesis.c')
-rw-r--r-- | apps/codecs/Tremor/synthesis.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/apps/codecs/Tremor/synthesis.c b/apps/codecs/Tremor/synthesis.c index 0b93fee0ac..35c09f8ddb 100644 --- a/apps/codecs/Tremor/synthesis.c +++ b/apps/codecs/Tremor/synthesis.c | |||
@@ -24,6 +24,17 @@ | |||
24 | #include "misc.h" | 24 | #include "misc.h" |
25 | #include "os.h" | 25 | #include "os.h" |
26 | 26 | ||
27 | |||
28 | /* IRAM buffer keep the block pcm data; only for windows size upto 2048 | ||
29 | for space restrictions. No real compromise, larger window sizes | ||
30 | are only used for very low quality settings (q<0?) */ | ||
31 | /* max 2 channels on the ihp-1xx (stereo), 2048 samples (2*2048*4=16Kb) */ | ||
32 | #define IRAM_PCM_END 2048 | ||
33 | #define CHANNELS 2 | ||
34 | |||
35 | static ogg_int32_t *ipcm_vect[CHANNELS] IDATA_ATTR; | ||
36 | static ogg_int32_t ipcm_buff[CHANNELS*IRAM_PCM_END] IDATA_ATTR; | ||
37 | |||
27 | int vorbis_synthesis(vorbis_block *vb,ogg_packet *op,int decodep){ | 38 | int vorbis_synthesis(vorbis_block *vb,ogg_packet *op,int decodep){ |
28 | vorbis_dsp_state *vd=vb->vd; | 39 | vorbis_dsp_state *vd=vb->vd; |
29 | private_state *b=(private_state *)vd->backend_state; | 40 | private_state *b=(private_state *)vd->backend_state; |
@@ -65,10 +76,18 @@ int vorbis_synthesis(vorbis_block *vb,ogg_packet *op,int decodep){ | |||
65 | if(decodep){ | 76 | if(decodep){ |
66 | /* alloc pcm passback storage */ | 77 | /* alloc pcm passback storage */ |
67 | vb->pcmend=ci->blocksizes[vb->W]; | 78 | vb->pcmend=ci->blocksizes[vb->W]; |
68 | vb->pcm=(ogg_int32_t **)_vorbis_block_alloc(vb,sizeof(*vb->pcm)*vi->channels); | 79 | if (vi->channels <= CHANNELS && vb->pcmend<=IRAM_PCM_END) { |
69 | for(i=0;i<vi->channels;i++) | 80 | /* use statically allocated iram buffer */ |
70 | vb->pcm[i]=(ogg_int32_t *)_vorbis_block_alloc(vb,vb->pcmend*sizeof(*vb->pcm[i])); | 81 | vb->pcm = ipcm_vect; |
71 | 82 | for(i=0; i<CHANNELS; i++) | |
83 | vb->pcm[i] = &ipcm_buff[i*IRAM_PCM_END]; | ||
84 | } else { | ||
85 | /* dynamic allocation (slower) */ | ||
86 | vb->pcm=(ogg_int32_t **)_vorbis_block_alloc(vb,sizeof(*vb->pcm)*vi->channels); | ||
87 | for(i=0;i<vi->channels;i++) | ||
88 | vb->pcm[i]=(ogg_int32_t *)_vorbis_block_alloc(vb,vb->pcmend*sizeof(*vb->pcm[i])); | ||
89 | } | ||
90 | |||
72 | /* unpack_header enforces range checking */ | 91 | /* unpack_header enforces range checking */ |
73 | type=ci->map_type[ci->mode_param[mode]->mapping]; | 92 | type=ci->map_type[ci->mode_param[mode]->mapping]; |
74 | 93 | ||