diff options
author | Magnus Holmgren <magnushol@gmail.com> | 2009-09-07 19:39:51 +0000 |
---|---|---|
committer | Magnus Holmgren <magnushol@gmail.com> | 2009-09-07 19:39:51 +0000 |
commit | f733ec194fae40d518c1b6ff5775c65223e655b6 (patch) | |
tree | 10692c023e15b6702db77c90923b961eb5f9526d | |
parent | 649b50cba192e633876907c41d0e03aa75eef512 (diff) |
Fix for FS#10492, by Aoyumi: Data abort errors when playing some Vorbis files.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22653 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/codecs/libtremor/block.c | 8 | ||||
-rw-r--r-- | apps/codecs/libtremor/ivorbiscodec.h | 5 | ||||
-rw-r--r-- | apps/codecs/libtremor/synthesis.c | 29 |
3 files changed, 17 insertions, 25 deletions
diff --git a/apps/codecs/libtremor/block.c b/apps/codecs/libtremor/block.c index 8a461e325f..fe736c8def 100644 --- a/apps/codecs/libtremor/block.c +++ b/apps/codecs/libtremor/block.c @@ -164,9 +164,11 @@ static int _vds_init(vorbis_dsp_state *v,vorbis_info *vi){ /* 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; diff --git a/apps/codecs/libtremor/ivorbiscodec.h b/apps/codecs/libtremor/ivorbiscodec.h index f59d79194e..c2836ad8a9 100644 --- a/apps/codecs/libtremor/ivorbiscodec.h +++ b/apps/codecs/libtremor/ivorbiscodec.h @@ -77,9 +77,8 @@ typedef struct vorbis_dsp_state{ 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; 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){ 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; i<vi->channels; 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;i<vi->channels;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; i<vi->channels; i++) + vb->pcm[i] = &vd->first_pcm[i*ci->blocksizes[1]]; } vd->reset_pcmb = false; |