[theora-dev] further debugging of my ogg/theora decoder

salsaman salsaman at gmail.com
Wed Nov 12 19:59:05 PST 2008


On Wed, Nov 12, 2008 at 6:36 PM, Ralph Giles <giles at xiph.org> wrote:

> On Wed, Nov 12, 2008 at 1:13 PM, salsaman <salsaman at gmail.com> wrote:
>
> > suppose I start decoding from a page with granulepos (kframe=x, frame =y)
> > and I continue decoding in sequence until I reach the next page with a
> > non-negative granulepos (kframe=a, frame=b). Is it possible that there
> could
> > be another keyframe between x and a ? In other words, do "hidden"
> keyframes
> > exist in the ogg stream, or is it safe to assume that every keyframe has
> at
> > least one (non-negative) granulepos ?
>
> It's possible, though unlikely.
>
> > Let me give an example. Suppose I am seeking for frame 20. I find a
> > granulepos of (18,22). Good, so I know that the keyframe is 18 + an
> offset
> > of 2. So now I seek again to find the largest granulepos before 18. I
> find
> > (10,12). Great.
> > So I start decoding from (10,12) and I reach a keyframe. Can I assume
> this
> > keyframe is 18, and then just decode two more frames ?
>
> In this case, you know the answer, because if you know by counting
> whether the keyframe you just found is frame 18, no? Or are you
> worried about having the backpropagate the (10,12) to earlier packets
> in that (10,12) page? You do have to do that, you can't assume there
> isn't a 9,9 in there too.
>

No, I am not worried about that. But the first keyframe I find could be 14
instead of 18, for example. Then I count two frames, I would end up at 16
instead of 20.

The only way I can see to be sure is to decode right up to the (18,22) page
and make sure there are no more keyframes until then.

This would occur for example, if there were continuation packets up to frame
13, then on the same page 14 (keyframe in this example) begins and the
packet continues until we get to 18, then 18 continues until 18,22.

So what I really need to know, if a frame/packet completes on a page, and
then another frame/packet begins on the same page, but continues, would the
granulepos be for the completed frame, or would it be a continuation ? If
it's the former then I think I am OK because in case of a keyframe before
18, there should always be a completed frame (e.g. 17 with a granulepos of
14,17) before 18 starts, right ?

The other example I can think of is if 17 is a keyframe, and it completes on
the same page as 18, also a keyframe, completes. I guess this might be
possible for very small, rapidly changing frames, right ? In this case I
would only need to decode to the end of the page where a keyframe first
appears, and make sure I got the last keyframe on that page.

I hope this makes some sense.

Regards,
Gabriel.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/theora-dev/attachments/20081113/7c897c98/attachment.htm 


More information about the theora-dev mailing list