diff options
Diffstat (limited to 'apps/codecs/libspeex')
-rw-r--r-- | apps/codecs/libspeex/Makefile | 10 | ||||
-rw-r--r-- | apps/codecs/libspeex/README.rockbox | 2 | ||||
-rw-r--r-- | apps/codecs/libspeex/config-speex.h | 2 | ||||
-rw-r--r-- | apps/codecs/libspeex/nb_celp.c | 19 | ||||
-rw-r--r-- | apps/codecs/libspeex/nb_celp.h | 12 | ||||
-rw-r--r-- | apps/codecs/libspeex/sb_celp.c | 24 | ||||
-rw-r--r-- | apps/codecs/libspeex/sb_celp.h | 14 | ||||
-rw-r--r-- | apps/codecs/libspeex/stack_alloc.h | 2 |
8 files changed, 51 insertions, 34 deletions
diff --git a/apps/codecs/libspeex/Makefile b/apps/codecs/libspeex/Makefile index ef119f9c15..651d589e65 100644 --- a/apps/codecs/libspeex/Makefile +++ b/apps/codecs/libspeex/Makefile @@ -14,7 +14,15 @@ ifdef APPEXTRA INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA))) endif -SPEEXOPTS = -O -DHAVE_CONFIG_H +SPEEXOPTS = -DHAVE_CONFIG_H + +# We're faster on ARM-targets with -O1 instead of -O2 +ifeq ($(CPU),arm) + SPEEXOPTS += -O +else + SPEEXOPTS += -O2 +endif + CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET_INC) $(SPEEXOPTS) $(TARGET) \ $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} ${PROFILE_OPTS} -Wno-unused-parameter diff --git a/apps/codecs/libspeex/README.rockbox b/apps/codecs/libspeex/README.rockbox index a526420b91..00915918dd 100644 --- a/apps/codecs/libspeex/README.rockbox +++ b/apps/codecs/libspeex/README.rockbox @@ -1,4 +1,4 @@ -Library: libspeex-1.2beta2 (SVN version 12966) +Library: libspeex-1.2beta2 (SVN version 14014) Imported: 2007-03-12 by Dan Everton diff --git a/apps/codecs/libspeex/config-speex.h b/apps/codecs/libspeex/config-speex.h index 52c71e9e82..b7385eee02 100644 --- a/apps/codecs/libspeex/config-speex.h +++ b/apps/codecs/libspeex/config-speex.h @@ -6,7 +6,7 @@ /* Make use of ARM4 assembly optimizations */ /* #undef ARM4_ASM */ -/* Make use of ARM5E assembly optimizations */ +/* Make use of ARM4E assembly optimizations */ #if defined(CPU_ARM) #define ARM4_ASM #endif 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)))) diff --git a/apps/codecs/libspeex/nb_celp.h b/apps/codecs/libspeex/nb_celp.h index fe30d38669..5442976cd2 100644 --- a/apps/codecs/libspeex/nb_celp.h +++ b/apps/codecs/libspeex/nb_celp.h @@ -141,13 +141,15 @@ typedef struct DecState { spx_word16_t last_ol_gain; /**< Open-loop gain for previous frame */ char *stack; /**< Pseudo-stack allocation for temporary memory */ - spx_word16_t *excBuf; /**< Excitation buffer */ + /* Size calculated from maximum values of frameSize, max_pitch and + * subframeSize, being respectively 320, 144 and 80 (for uwb) */ + spx_word16_t excBuf[556]; /**< Excitation buffer */ spx_word16_t *exc; /**< Start of excitation frame */ - spx_lsp_t *old_qlsp; /**< Quantized LSPs for previous frame */ - spx_coef_t *interp_qlpc; /**< Interpolated quantized LPCs */ - spx_mem_t *mem_sp; /**< Filter memory for synthesis signal */ + spx_lsp_t old_qlsp[10]; /**< Quantized LSPs for previous frame */ + spx_coef_t interp_qlpc[10]; /**< Interpolated quantized LPCs */ + spx_mem_t mem_sp[10]; /**< Filter memory for synthesis signal */ spx_mem_t mem_hp[2]; /**< High-pass filter memory */ - spx_word32_t *pi_gain; /**< Gain of LPC filter at theta=pi (fe/2) */ + spx_word32_t pi_gain[5]; /**< Gain of LPC filter at theta=pi (fe/2) */ spx_word16_t *innov_save; /** If non-NULL, innovation is copied here */ spx_word16_t level; diff --git a/apps/codecs/libspeex/sb_celp.c b/apps/codecs/libspeex/sb_celp.c index c44cfffb58..dc88ca4947 100644 --- a/apps/codecs/libspeex/sb_celp.c +++ b/apps/codecs/libspeex/sb_celp.c @@ -754,13 +754,14 @@ int sb_encode(void *state, void *vin, SpeexBits *bits) +static SBDecState global_decstate IBSS_ATTR; void *sb_decoder_init(const SpeexMode *m) { spx_int32_t tmp; - SBDecState *st; + SBDecState *st = &global_decstate; const SpeexSBMode *mode; - st = (SBDecState*)speex_alloc(sizeof(SBDecState)); + /* st = (SBDecState*)speex_alloc(sizeof(SBDecState)); */ if (!st) return NULL; st->mode = m; @@ -790,17 +791,17 @@ void *sb_decoder_init(const SpeexMode *m) st->first=1; - st->g0_mem = (spx_word32_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word32_t)); - st->g1_mem = (spx_word32_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word32_t)); + /* st->g0_mem = (spx_word32_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word32_t)); */ + /* st->g1_mem = (spx_word32_t*)speex_alloc((QMF_ORDER)*sizeof(spx_word32_t)); */ - st->excBuf = (spx_word16_t*)speex_alloc((st->subframeSize)*sizeof(spx_word16_t)); + /* st->excBuf = (spx_word16_t*)speex_alloc((st->subframeSize)*sizeof(spx_word16_t)); */ - st->old_qlsp = (spx_lsp_t*)speex_alloc((st->lpcSize)*sizeof(spx_lsp_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->interp_qlpc = (spx_coef_t*)speex_alloc(st->lpcSize*sizeof(spx_coef_t)); */ - st->pi_gain = (spx_word32_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word32_t)); - st->exc_rms = (spx_word16_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word16_t)); - st->mem_sp = (spx_mem_t*)speex_alloc((2*st->lpcSize)*sizeof(spx_mem_t)); + /* st->pi_gain = (spx_word32_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word32_t)); */ + /*st->exc_rms = (spx_word16_t*)speex_alloc((st->nbSubframes)*sizeof(spx_word16_t)); */ + /* st->mem_sp = (spx_mem_t*)speex_alloc((2*st->lpcSize)*sizeof(spx_mem_t)); */ st->innov_save = NULL; @@ -822,7 +823,7 @@ void sb_decoder_destroy(void *state) #if !(defined(VAR_ARRAYS) || defined (USE_ALLOCA)) /*speex_free_scratch(st->stack);*/ #endif - +/* speex_free(st->g0_mem); speex_free(st->g1_mem); speex_free(st->excBuf); @@ -833,6 +834,7 @@ void sb_decoder_destroy(void *state) speex_free(st->mem_sp); speex_free(state); +*/ } static void sb_decode_lost(SBDecState *st, spx_word16_t *out, int dtx, char *stack) diff --git a/apps/codecs/libspeex/sb_celp.h b/apps/codecs/libspeex/sb_celp.h index a0dc3afe02..9fb2241a83 100644 --- a/apps/codecs/libspeex/sb_celp.h +++ b/apps/codecs/libspeex/sb_celp.h @@ -109,15 +109,15 @@ typedef struct SBDecState { int lpc_enh_enabled; char *stack; - spx_word32_t *g0_mem, *g1_mem; + spx_word32_t g0_mem[64], g1_mem[64]; - spx_word16_t *excBuf; - spx_lsp_t *old_qlsp; - spx_coef_t *interp_qlpc; + spx_word16_t excBuf[80]; + spx_lsp_t old_qlsp[10]; + spx_coef_t interp_qlpc[10]; - spx_mem_t *mem_sp; - spx_word32_t *pi_gain; - spx_word16_t *exc_rms; + spx_mem_t mem_sp[20]; + spx_word32_t pi_gain[5]; + spx_word16_t exc_rms[5]; spx_word16_t *innov_save; /** If non-NULL, innovation is copied here */ spx_word16_t last_ener; diff --git a/apps/codecs/libspeex/stack_alloc.h b/apps/codecs/libspeex/stack_alloc.h index f9056b472d..f06f2f6f7f 100644 --- a/apps/codecs/libspeex/stack_alloc.h +++ b/apps/codecs/libspeex/stack_alloc.h @@ -35,6 +35,8 @@ #ifndef STACK_ALLOC_H #define STACK_ALLOC_H +#include "config-speex.h" + #ifdef USE_ALLOCA # ifdef WIN32 # include <malloc.h> |