IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
ov_open_callbacks Performance
Rockin' Pete
post Jun 21 2008, 18:51
Post #1





Group: Members
Posts: 7
Joined: 21-June 08
Member No.: 54656



We're having some performance problems ov_open_callbacks in our audio system designed for video games. The system is aimed at downloadable games, so we were hoping that we could store all of our sounds in ogg vorbis format.

The files are all concatenated into one big resource file, which is why we use ov_open_callbacks.

The performance problems seem to come from the fact that the ov_open_callbacks keeps seeking and reading a byte at a time. I have made various optimizations in order to avoid seeking more than is necessary. But the performance is still very slow. It can easily take 50 ms to open an ogg file on a current Windows machine. As a result, we open all of our ogg files at init time. This solves the audio glitches, but is obviously not ideal, by any stretch.

On an Intel-based mobile platform (which I can't name because of NDA) the results are simply disasterous. It takes over a second to open a stereo ogg/vorbis file!!!

Part of the problem is that ov_open_callbacks does a lot off seeking and reading a byte at a time. I have tried to optimize my callback functions by seeking only when necessary. But I still don't understand why it can take a second to open a file.

Is there anything I can do in order to speed it up?

I tried to look at the way I was encoding the files, but the only thing I could come up with was to take out the comments. No difference. Would using a fixed bit-rate or lower compression ratio help things?

Thanks in advance for any help here.
Go to the top of the page
+Quote Post
Yirkha
post Jun 21 2008, 19:07
Post #2





Group: FB2K Moderator
Posts: 2359
Joined: 30-November 07
Member No.: 49158



Ogg Vorbis streams can also be read in one-pass for use in streaming, for example. If you don't need to seek to arbitrary offsets in one Vorbis file, you might try disabling seeking completely. As libvorbisfile says,
QUOTE
If the data source is not seekable (or the application wants the data source to be treated as unseekable at all times), the provided seek callback should always return -1 (failure) or the seek_func and tell_func fields should be set to NULL.


--------------------
Full-quoting makes you scroll past the same junk over and over.
Go to the top of the page
+Quote Post
Rockin' Pete
post Jun 24 2008, 01:40
Post #3





Group: Members
Posts: 7
Joined: 21-June 08
Member No.: 54656



What a difference!

Thanks very much for this!
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 3rd September 2014 - 00:20