[xiph-rtp] Chaining Theora codebook changes

Ralph Giles giles at xiph.org
Sun May 22 21:57:13 PDT 2005


On Sun, May 22, 2005 at 03:35:40PM -0700, David Barrett wrote:

> I'm sorry, let me clarify.  It's my assumption that the codebook is
> used to initialize the internal state of the decoder, and then each
> frame modifies that internal state.  So, if I switch from codebook 0
> to codebook 1, and then back to codebook 0, I have two options:
> 
> 1) Destroy and recreate a decoder using codebook 0, thereby resetting
> its internal state.
> 
> 2) Reuse the original decoder, thereby continuing on with the internal
> state that has already been accumulated.

Aha. So there are two things. The codebook does indeed initialize 
internal state, but that state is orthogonal to the state changes
induced by decoding data packets.

The state related to frame decode consists soley of the previous
decoded frame, and the previous keyframe (if different). So you
will get incorrect results if you begin decoding anywhere but
a keyframe, but decoding frames (key or otherwise) does not affect
the state associated with decoding the header packets (codebook).

So your options (1) and (2) behave identically, except with respect
to the specific variety of bad output you'd get if you didn't
restart decoding under codebook 0 with a keyframe. If you do
start with a keyframe, as you should, there's no difference,
and it's just a question of convenience and memory footprint.

 -r


More information about the xiph-rtp mailing list