Miles, Stewart
2006-Dec-13 14:31 UTC
[Speex-dev] Would be nice to conditionally compile out coding modes and code tables...
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 ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ -------------- next part -------------- A non-text attachment was scrubbed... Name: modes.c Type: application/octet-stream Size: 17769 bytes Desc: modes.c Url : http://lists.xiph.org/pipermail/speex-dev/attachments/20061213/3d4eb8ee/modes-0001.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: statesize.h Type: application/octet-stream Size: 1703 bytes Desc: statesize.h Url : http://lists.xiph.org/pipermail/speex-dev/attachments/20061213/3d4eb8ee/statesize-0001.obj
John Miles
2006-Dec-13 14:50 UTC
[Speex-dev] Would be nice to conditionally compile out coding modesand code tables...
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 time. This is something that the Ogg guys (Vorbis being a prime offender in particular) have never quite understood. </pet_peeve> -- 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
Jean-Marc Valin
2006-Dec-14 02:54 UTC
[Speex-dev] Would be nice to conditionally compile out coding modes and code tables...
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
Reasonably Related Threads
- Would be nice to conditionally compile out coding modes and code tables...
- Speex on TI C6x, Problem with TI C5x Patch
- Speex on TI C6x, Problem with TI C5x Patch
- Blackfin inline assembler and VisualDSP++ toolchain
- It would be nice if OpenSSH would have features to circumvent network filters, like SSL tunneling