[Vorbis] ov_open_callbacks() performance & memory requirements

Ralph Giles giles at xiph.org
Thu Sep 14 21:38:52 PDT 2006


On Thu, Sep 14, 2006 at 03:55:05PM +0100, Dave Brown wrote:

> My sample engine needs to load a large number of small audio files. This
> gives me two problems - first, it's taking too long to initialise all
> those files with ov_open_callbacks(), and secondly I'm running out of
> memory! For example, 100 x 10k files needs a thumping 29MB of memory.

Two other things you can try, in addition to Mike's suggestions: It's 
legal to concatenate ogg files, and libvorbisfile will handle that, so 
you can try concatenating the encoded data and only having one decoder 
context. This should reduce your memory footprint significantly, but 
will add the cpu/latency cost of seeking when you switch clips within a 
decoder context.

Another thing you can try to do is concatentate the *input* files and 
compress them as a single stream (perhaps with some padding at the 
joins). Then you have a single logical ogg stream. Use a custom cue 
table to seek in that for clip selection. This is save the overhead of 
the chain mapping as well as reducing the number of decoder contexts.

These both assume seeking, of course, but are both also applicable to 
using the Tremor decoder Mike mentioned.

HTH,
 -r


More information about the Vorbis mailing list