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

Daniel Collin emoon at home.se
Sat Apr 30 15:20:38 PDT 2005


Ralph Giles wrote:

>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
>
>  
>
Yeah, Dave suggested a low priority thread also, which may be a good 
thing also.

>>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?
>
>
>  
>
The code is based on libvorbis, I wasnt really sure which one to pick, 
You know if there is
any prons/cons between those tho?

Thanks

Daniel


More information about the Vorbis mailing list