[sdlsound] ogg decoding performance

Eric Wing ewing2121 at yahoo.com
Fri Jan 10 12:32:02 EST 2003

I'm not sure how performance differs between the
SDL_sound versions. However, I submitted an Ogg patch
not too long ago that forces Decode() to fill the
buffer to the buffer_size you requested. (By default,
Ogg only fills up one tiny packet which is usually far
less than your buffer size). For me, this lowered the
overhead in streaming more data and may improve
performance. This is currently only in the CVS.

Second, have you tried changing your buffer size in
your call to NewSample() to something really large
(e.g. 5megabytes)? The larger this buffer is, the less
time is spent reading chunks and reallocating memory
to hold everything with DecodeAll (with the tradeoff
that you may have more wasted much more memory). You
might try this to see how the speed compares, then
tweak the buffer size accordingly to your tastes.

You should also note though that I believe the current
CVS version of SDL_mixer has Ogg support on the
channels. I don't think it streams it though. If this
is all you need, you might try using it directly. (But
if you need other features, then you may still have to
fuse SDL_sound and SDL_mixer together). 


--- Thomas Eder <Thomas.Eder at nmi.at> wrote:
> I am just trying to evaluate if it makes sense to
> use ogg instead of wav
> for loading external sound files.
> But to decompress/decode an ogg using SDL_sound
> seems 
> to need very much time.
> Example (PC W2K, 1Ghz).
> source wav: 5660KB, 22kHz, 16bit, Mono
> created ogg from this wav (Quality 5): 856KB
> Time to decompress/decode this ogg: about 30
> seconds!!
> (e.g. using Sound_DecodeAll() or playsound.exe
> --predecode).
> I cant use streaming, because I need multiple sound
> channels and
> therefore I am using SDL_sound+SDL_mixer.
> And this combination doesnt allow streaming up to
> now, right?
> So its even a lot faster to load the uncompressed
> wav from the CD than
> loading the ogg+decompressing it!
> I also noticed that the oggdec utility
> (www.vorbis.com) needs about
> 1.5 seconds to decode the same ogg above. I have
> used the latest
> ogg-dlls with playsound, so it seems the bottleneck
> is the decoder 
> in SDL_sound, right?
> Any solution?
> I am using SDL_sound 0.1.4, is SDL-1.0.0 decoding
> faster?
> Or has someone better experiences with MP3?
> Please send me some feedback,
> thx,
> Thomas

Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.

More information about the sdlsound mailing list