diff options
Diffstat (limited to 'apps/codecs/libtremor/synthesis.c')
-rw-r--r-- | apps/codecs/libtremor/synthesis.c | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/apps/codecs/libtremor/synthesis.c b/apps/codecs/libtremor/synthesis.c index b1c5eeccef..a882a6d07a 100644 --- a/apps/codecs/libtremor/synthesis.c +++ b/apps/codecs/libtremor/synthesis.c | |||
@@ -70,26 +70,17 @@ int vorbis_synthesis(vorbis_block *vb,ogg_packet *op,int decodep){ | |||
70 | if(decodep && vi->channels<=CHANNELS){ | 70 | if(decodep && vi->channels<=CHANNELS){ |
71 | vb->pcm = ipcm_vect; | 71 | vb->pcm = ipcm_vect; |
72 | 72 | ||
73 | /* alloc pcm passback storage */ | 73 | /* set pcm end point */ |
74 | vb->pcmend=ci->blocksizes[vb->W]; | 74 | vb->pcmend=ci->blocksizes[vb->W]; |
75 | if (vd->iram_pcm_storage >= vb->pcmend) { | 75 | /* use statically allocated buffer */ |
76 | /* use statically allocated iram buffer */ | 76 | if(vd->reset_pcmb || vb->pcm[0]==NULL) |
77 | if(vd->reset_pcmb || vb->pcm[0]==NULL) | 77 | { |
78 | { | 78 | /* one-time initialisation at codec start |
79 | /* one-time initialisation at codec start | 79 | NOT for every block synthesis start |
80 | NOT for every block synthesis start | 80 | allows us to flip between buffers once initialised |
81 | allows us to flip between buffers once initialised | 81 | by simply flipping pointers */ |
82 | by simply flipping pointers */ | 82 | for(i=0; i<vi->channels; i++) |
83 | for(i=0; i<vi->channels; i++) | 83 | vb->pcm[i] = &vd->first_pcm[i*ci->blocksizes[1]]; |
84 | vb->pcm[i] = &vd->iram_pcm[i*vd->iram_pcm_storage]; | ||
85 | } | ||
86 | } else { | ||
87 | if(vd->reset_pcmb || vb->pcm[0]==NULL) | ||
88 | { | ||
89 | /* dynamic allocation (slower) */ | ||
90 | for(i=0;i<vi->channels;i++) | ||
91 | vb->pcm[i]=(ogg_int32_t *)_vorbis_block_alloc(vb,vb->pcmend*sizeof(*vb->pcm[i])); | ||
92 | } | ||
93 | } | 84 | } |
94 | vd->reset_pcmb = false; | 85 | vd->reset_pcmb = false; |
95 | 86 | ||