[theora] Skipping Frames
giles at xiph.org
Fri Dec 8 11:29:52 PST 2006
On Fri, Dec 08, 2006 at 08:44:24AM -0300, Serge wrote:
> I'm currently trying to use the theora decoder on PPC.
> Everything is working perfect now, but I have a problem: I need to skip the
> decoding of some frames (drop frames) when the device is not powerful enough
> to decode them all in real time (which in PPC is a frequent issue).
> Right now, I'm skipping the call to theora_decode_YUVout and the yuv to
> rgb procedure. That gives me some extra time, but not enough. Is there a way
> to avoid decoding a frame?
Well, the problem is that most frames are dependent on the previous
frame, so completely skipping decode means either artefacts, for
freezing video playback until the next keyframe.
So turning off postprocessing (it's off by default in libtheora) and not
displaying the frame are the only two "easy" things you can do to
moderate playback load. (Porting some altivec optimizations would also
help, of course).
To do good scaling of decode time, you can look ahead to where the
next keyframe is (call theora_packet_iskeyframe() on successive packets
before submitting) and then drop some number right before the keyframe.
That will minimize the jerkiness in playback from decoding dropouts.
You might also try libtheoradec (from http://svn.xiph.org/trunk/theora-exp)
it has some C-level optimizations and should be a bit faster even
without asm, and the above scaling ideas apply equally well there.
More information about the theora