[Speex-dev] Would be nice to conditionally compile out coding
modes and code tables...
Jean-Marc Valin
jean-marc.valin at usherbrooke.ca
Thu Dec 14 02:50:32 PST 2006
Miles, Stewart a écrit :
> I'm only using the narrow-band encoder on my embedded system and have
> removed all references to the wide-band and ultra-wide band encoder
> functions and tables. They will be pulled in by the linker due to the
> references made by the structures in modes.c. Attached is a replacement
> modes.c for compiling out modes that are not in use for anyone who's
> interested.
There's already a --disable-wideband (and corresponding
DISABLE_WIDEBAND) option in the code, so I'm not sure what your patch is
supposed to add. Also, disabling narrowband doesn't make sense because
it's used by the wideband code.
> Also, I've removed the dynamic memory allocation of the encoder and
> decoder. To do this I had to determine the required size of the encoder
> and decoder states since i'm working on a fixed memory platform I simply
> handle the worst case, see the attached statesize.h. Now I can do this
> sort of thing...
>
> MyDecoderClass decoders[5];
>
> .. will means all of my decoder states are contiguous and quick to DMA.
> It also improves cache consistency when the input buffers are placed in
> MyDecoderClass.
There's actually a much simpler way of making everything contiguous. All
you need to do is allocate (or reserve or whatever) a big block yourself
and override speex_alloc() and speex_free() (and speex_alloc_scratch if
you don't have a C99 compiler) to distribute that memory explicitly.
> Would be nice for functionality like this to make it into the main line
> of code.
Anything that you need that isn't covered by the explanations above?
Jean-Marc
More information about the Speex-dev
mailing list