summaryrefslogtreecommitdiffstats
path: root/apps/codecs/libspeex/nb_celp.c
diff options
context:
space:
mode:
authorThom Johansen <thomj@rockbox.org>2007-10-21 23:24:06 +0000
committerThom Johansen <thomj@rockbox.org>2007-10-21 23:24:06 +0000
commit86a999c478cde265d9507c1a7865cd2c25d1dc7e (patch)
tree7fecb41ef40bb1bc9ce6d2ed29d00b3316519457 /apps/codecs/libspeex/nb_celp.c
parent4f41af374000a00a3e86727ca896c1ff6ac62424 (diff)
downloadrockbox-86a999c478cde265d9507c1a7865cd2c25d1dc7e.tar.gz
rockbox-86a999c478cde265d9507c1a7865cd2c25d1dc7e.zip
Change decoder struct dynamic array members to static arrays sized based on current maximums. Move decoder state structs into IRAM for big speedups This means only one decoder can be instantiated at a time, but that should not be a problem. Tweak Makefile to use -O2 for Coldfire. Update SVN revision info to sync-time revision.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15256 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libspeex/nb_celp.c')
-rw-r--r--apps/codecs/libspeex/nb_celp.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/apps/codecs/libspeex/nb_celp.c b/apps/codecs/libspeex/nb_celp.c
index 64ecb58689..6047bd42aa 100644
--- a/apps/codecs/libspeex/nb_celp.c
+++ b/apps/codecs/libspeex/nb_celp.c
@@ -1024,14 +1024,16 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
return 1;
}
+static DecState global_decstate IBSS_ATTR;
+
void *nb_decoder_init(const SpeexMode *m)
{
- DecState *st;
+ DecState *st = &global_decstate;
const SpeexNBMode *mode;
int i;
mode=(const SpeexNBMode*)m->mode;
- st = (DecState *)speex_alloc(sizeof(DecState));
+ /* st = (DecState *)speex_alloc(sizeof(DecState)); */
if (!st)
return NULL;
#if defined(VAR_ARRAYS) || defined (USE_ALLOCA)
@@ -1062,15 +1064,15 @@ void *nb_decoder_init(const SpeexMode *m)
st->lpc_enh_enabled=1;
- st->excBuf = (spx_word16_t*)speex_alloc((st->frameSize + 2*st->max_pitch + st->subframeSize + 12)*sizeof(spx_word16_t));
+ /* st->excBuf = (spx_word16_t*)speex_alloc((st->frameSize + 2*st->max_pitch + st->subframeSize + 12)*sizeof(spx_word16_t)); */
st->exc = st->excBuf + 2*st->max_pitch + st->subframeSize + 6;
for (i=0;i<st->frameSize + st->max_pitch + 1;i++)
st->excBuf[i]=0;
- st->interp_qlpc = (spx_coef_t*)speex_alloc(st->lpcSize*sizeof(spx_coef_t));
- st->old_qlsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t));
- st->mem_sp = (spx_mem_t*)speex_alloc(st->lpcSize*sizeof(spx_mem_t));
- st->pi_gain = (spx_word32_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word32_t));
+ /* st->interp_qlpc = (spx_coef_t*)speex_alloc(st->lpcSize*sizeof(spx_coef_t)); */
+ /* st->old_qlsp = (spx_lsp_t*)speex_alloc(st->lpcSize*sizeof(spx_lsp_t)); */
+ /* st->mem_sp = (spx_mem_t*)speex_alloc(st->lpcSize*sizeof(spx_mem_t)); */
+ /* st->pi_gain = (spx_word32_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word32_t)); */
st->last_pitch = 40;
st->count_lost=0;
st->pitch_gain_buf[0] = st->pitch_gain_buf[1] = st->pitch_gain_buf[2] = 0;
@@ -1105,7 +1107,7 @@ void nb_decoder_destroy(void *state)
#if !(defined(VAR_ARRAYS) || defined (USE_ALLOCA))
speex_free_scratch(st->stack);
#endif
-
+/*
speex_free (st->excBuf);
speex_free (st->interp_qlpc);
speex_free (st->old_qlsp);
@@ -1113,6 +1115,7 @@ void nb_decoder_destroy(void *state)
speex_free (st->pi_gain);
speex_free(state);
+*/
}
#define median3(a, b, c) ((a) < (b) ? ((b) < (c) ? (b) : ((a) < (c) ? (c) : (a))) : ((c) < (b) ? (b) : ((c) < (a) ? (c) : (a))))