[Vorbis] Problem with CPU usage on Playstation 2 when using Ogg Vorbis.

Ralph Giles giles at xiph.org
Sat Apr 30 10:05:24 PDT 2005


On Sat, Apr 30, 2005 at 11:34:11AM +0200, Daniel Collin wrote:

> This indicates that the Ogg Vorbis code processes a bit a head and on 
> frame 0 decodes
> data for frame 1-3 also and just "gives" that data back for the 
> following frames.

>From the timing, I'd guess what happens is that the vorbis decoder is 
decoding a full packet at a time, which is enough audio to span several 
frames. As you say, requests for successive frames' audio just copy from 
the already decoded buffer.

If you can't just spawn a thread for the decode loop, I think you'll 
have to hack the decoder to be interruptible, and perform only some 
number of decoding steps each frame. Since dropping audio is worse than 
dropping video, you'll probably want to make this adaptive, so the 
vorbis decode always gets done, but the steps are distributed over some 
number of calls. The joys of cooperative multitasking. :/

You could also experiment with feeding it smaller amounts of data in 
case it's decoding multiple packets at once, but IIRC (and from the 
timing) it just does a packet each time.

Hope that helps,
 -r

> So i wonder if its possible to get a more even cpu usage across each 
> update? lets say
> it will take 25% each time instead of the pattern above?

Could also try to optimize the decoder so it just takes less time, of 
course. :) I can't remember, is your code based on tremor, or libvorbis?


More information about the Vorbis mailing list