[Speex-dev] Would be nice to conditionally compile out coding modesand code tables...

John Miles jmiles at pop.net
Wed Dec 13 14:33:11 PST 2006

I agree with this, by the way.  Dynamic memory allocation does NOT belong in
a realtime codec, apart from allocation of the initial stream state at open

This is something that the Ogg guys (Vorbis being a prime offender in
particular) have never quite understood.


-- john

> 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.
> 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.
> Would be nice for functionality like this to make it into the main line
> of code.
> I hope this is useful to someone,
> Stewart Miles

More information about the Speex-dev mailing list