[Speex-dev] Speex decode memory usage on an Arm processor
(wideband)
Jean-Marc Valin
Jean-Marc.Valin at USherbrooke.ca
Tue Jan 3 14:46:10 PST 2006
Le mardi 03 janvier 2006 à 09:43 -0500, tom abcd a écrit :
> > > I have tested lowering these values and then running the speexdec
> > > program and looking for errors. By trial and error it appears that I
> > > can lower MAX_CHARS_PER_FRAME = 750, SB_DEC_STACK =
> > > 750*sizeof(spx_sig_t) and NB_DEC_STACK = 250*sizeof(spx_sig_t)
> > > and not get any memory errors but have no idea if these are safe
> > > values or not. I could not tell how much stack spaced was used but
> > > would guess 4 kb would be enough. After making these changes it
> > > appears to Alloc less the 16kb.
> >
> > Best is to set these values by trial and error. I've used values I'm
> > confident with for fixed-point and float at the same time. Actually,
> > even better is to use a compiler that supports C99 variable-size arrays
> > (gcc does) or at least alloca. That way, the real stack is used instead
> > of that artificial stack, reducing overall memory.
>
> I am using GCC version 3.4.4 for the Arm so I assume it supports the
> C99 variable size arrays so what do I need to do to have it use the
> real stack? I assume even with this selected the code will still
> malloc space for other items?
The encoder and decoder memory still needs allocation, but the temporary
variables will be allocated right from the stack, so SB_DEC_STACK and
NB_DEC_STACK become irrelevant. Just make sure VAR_ARRAY is defined in
the config.h.
> Does the amount of space needed vary based on the quality and
> complexity used to compress the file or on the type of sound in the
> file? (so I know what combinations I need to test with)
The amount of memory allocated with malloc() is always constant. The
amount of temporary memory (stack) is constant in the decoder, but
variable in the encoder (depends on bit-rate and complexity setting, but
not the signal itself).
Jean-Marc
More information about the Speex-dev
mailing list