[xiph-commits] r9316 - trunk/speex/libspeex
jm at motherfish-iii.xiph.org
jm at motherfish-iii.xiph.org
Wed May 25 22:10:45 PDT 2005
Author: jm
Date: 2005-05-25 22:10:44 -0700 (Wed, 25 May 2005)
New Revision: 9316
Modified:
trunk/speex/libspeex/nb_celp.c
trunk/speex/libspeex/sb_celp.c
Log:
Allow setting the encoder and decoder stacks at compile time
Modified: trunk/speex/libspeex/nb_celp.c
===================================================================
--- trunk/speex/libspeex/nb_celp.c 2005-05-26 04:09:21 UTC (rev 9315)
+++ trunk/speex/libspeex/nb_celp.c 2005-05-26 05:10:44 UTC (rev 9316)
@@ -58,7 +58,17 @@
#define SUBMODE(x) st->submodes[st->submodeID]->x
+/* Default size for the encoder and decoder stack (can be changed at compile time).
+ This does not apply when using variable-size arrays or alloca. */
+#ifndef NB_ENC_STACK
+#define NB_ENC_STACK (8000*sizeof(spx_sig_t))
+#endif
+#ifndef NB_DEC_STACK
+#define NB_DEC_STACK (4000*sizeof(spx_sig_t))
+#endif
+
+
#ifdef FIXED_POINT
const spx_word32_t ol_gain_table[32]={18900, 25150, 33468, 44536, 59265, 78865, 104946, 139653, 185838, 247297, 329081, 437913, 582736, 775454, 1031906, 1373169, 1827293, 2431601, 3235761, 4305867, 5729870, 7624808, 10146425, 13501971, 17967238, 23909222, 31816294, 42338330, 56340132, 74972501, 99766822, 132760927};
const spx_word16_t exc_gain_quant_scal3_bound[7]={1841, 3883, 6051, 8062, 10444, 13580, 18560};
@@ -101,7 +111,7 @@
return NULL;
st->stack = NULL;
#else
- st = (EncState*)speex_alloc(sizeof(EncState)+8000*sizeof(spx_sig_t));
+ st = (EncState*)speex_alloc(sizeof(EncState)+NB_ENC_STACK);
if (!st)
return NULL;
st->stack = ((char*)st) + sizeof(EncState);
@@ -943,7 +953,7 @@
return NULL;
st->stack = NULL;
#else
- st = (DecState *)speex_alloc(sizeof(DecState)+4000*sizeof(spx_sig_t));
+ st = (DecState *)speex_alloc(sizeof(DecState)+NB_DEC_STACK);
if (!st)
return NULL;
st->stack = ((char*)st) + sizeof(DecState);
Modified: trunk/speex/libspeex/sb_celp.c
===================================================================
--- trunk/speex/libspeex/sb_celp.c 2005-05-26 04:09:21 UTC (rev 9315)
+++ trunk/speex/libspeex/sb_celp.c 2005-05-26 05:10:44 UTC (rev 9316)
@@ -46,6 +46,17 @@
#include "ltp.h"
#include "misc.h"
+/* Default size for the encoder and decoder stack (can be changed at compile time).
+ This does not apply when using variable-size arrays or alloca. */
+#ifndef SB_ENC_STACK
+#define SB_ENC_STACK (1000*sizeof(spx_sig_t))
+#endif
+
+#ifndef SB_DEC_STACK
+#define SB_DEC_STACK (6000*sizeof(spx_sig_t))
+#endif
+
+
#ifdef DISABLE_WIDEBAND
void *sb_encoder_init(const SpeexMode *m)
{
@@ -222,7 +233,7 @@
return NULL;
st->stack = NULL;
#else
- st = (SBEncState*)speex_alloc(sizeof(SBEncState)+10000*sizeof(spx_sig_t));
+ st = (SBEncState*)speex_alloc(sizeof(SBEncState)+SB_ENC_STACK);
if (!st)
return NULL;
st->stack = ((char*)st) + sizeof(SBEncState);
@@ -791,7 +802,7 @@
return NULL;
st->stack = NULL;
#else
- st = (SBDecState*)speex_alloc(sizeof(SBDecState)+6000*sizeof(spx_sig_t));
+ st = (SBDecState*)speex_alloc(sizeof(SBDecState)+SB_DEC_STACK);
if (!st)
return NULL;
st->stack = ((char*)st) + sizeof(SBDecState);
More information about the commits
mailing list