Index: block.c =================================================================== --- block.c (revision 22608) +++ block.c (working copy) @@ -164,9 +164,11 @@ /* allocate IRAM buffer for the PCM data generated by synthesis */ iram_malloc_init(); - v->iram_pcm=(ogg_int32_t *)iram_malloc(vi->channels*ci->blocksizes[1]*sizeof(ogg_int32_t)); - if(v->iram_pcm != NULL) v->iram_pcm_storage=ci->blocksizes[1]; - else v->iram_pcm_storage=0; + v->first_pcm=(ogg_int32_t *)iram_malloc(vi->channels*ci->blocksizes[1]*sizeof(ogg_int32_t)); + /* when can't allocate IRAM buffer, allocate normal RAM buffer */ + if(v->first_pcm == NULL){ + v->first_pcm=(ogg_int32_t *)_ogg_malloc(vi->channels*ci->blocksizes[1]*sizeof(ogg_int32_t)); + } v->centerW=0; Index: ivorbiscodec.h =================================================================== --- ivorbiscodec.h (revision 22608) +++ ivorbiscodec.h (working copy) @@ -77,9 +77,8 @@ void *backend_state; - ogg_int32_t *iram_pcm; /* IRAM PCM buffer */ - ogg_int32_t *iram_double_pcm; /* IRAM PCM 2nd buffer */ - int iram_pcm_storage; /* size of IRAM PCM buffer */ + ogg_int32_t *first_pcm; /* PCM buffer (for normal RAM or IRAM)*/ + ogg_int32_t *iram_double_pcm; /* PCM 2nd buffer for IRAM */ bool reset_pcmb; } vorbis_dsp_state; Index: synthesis.c =================================================================== --- synthesis.c (revision 22608) +++ synthesis.c (working copy) @@ -70,26 +70,17 @@ if(decodep && vi->channels<=CHANNELS){ vb->pcm = ipcm_vect; - /* alloc pcm passback storage */ + /* set pcm end point */ vb->pcmend=ci->blocksizes[vb->W]; - if (vd->iram_pcm_storage >= vb->pcmend) { - /* use statically allocated iram buffer */ - if(vd->reset_pcmb || vb->pcm[0]==NULL) - { - /* one-time initialisation at codec start - NOT for every block synthesis start - allows us to flip between buffers once initialised - by simply flipping pointers */ - for(i=0; ichannels; i++) - vb->pcm[i] = &vd->iram_pcm[i*vd->iram_pcm_storage]; - } - } else { - if(vd->reset_pcmb || vb->pcm[0]==NULL) - { - /* dynamic allocation (slower) */ - for(i=0;ichannels;i++) - vb->pcm[i]=(ogg_int32_t *)_vorbis_block_alloc(vb,vb->pcmend*sizeof(*vb->pcm[i])); - } + /* use statically allocated buffer */ + if(vd->reset_pcmb || vb->pcm[0]==NULL) + { + /* one-time initialisation at codec start + NOT for every block synthesis start + allows us to flip between buffers once initialised + by simply flipping pointers */ + for(i=0; ichannels; i++) + vb->pcm[i] = &vd->first_pcm[i*ci->blocksizes[1]]; } vd->reset_pcmb = false;