Silvia Pfeiffer
2008-Feb-12 18:13 UTC
[ogg-dev] Seeking to granules in discontinuous streams
Ups! Maybe it's time somebody corrected that statement then - the wiki seems the right place to put the correct algorithm, IMHO. Cheers, Silvia. On Feb 13, 2008 10:06 AM, Ralph Giles <ralph.giles@artifex.com> wrote:> > On 12-Feb-08, at 2:57 PM, Ralph Giles wrote: > > > http://wiki.xiph.org/index.php/GranulePosAndSeeking > > I'm not sure it's helpful to keep linking to this. It's important > historically, but Monty's whole thesis about "start decoding here and you're > good" is WRONG because of the continued packet issues. > > > To clarify, the seeking algorithm he describes is inaccurate. This message > is an accurate description of the rationale behind the split/granulepos hack > for encoding both the timestamp and the back pointer in the granulepos, as > is now used by theora, dirac and cmml. > > -r >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/ogg-dev/attachments/20080213/35269440/attachment.html
ogg.k.ogg.k@googlemail.com
2008-Feb-14 03:16 UTC
[ogg-dev] Seeking to granules in discontinuous streams
Some more thinking about this whole granulepos splitting. Sorry for the badgering :) The CMML way was presented as a similar way as the Theora way, which I didn't see (I actually use such a system to allow multiple events to start at the same time, and this feels like the Theora way). Theora can find any frame's previous keyframe granulepos by clearing the low bits of the frame's granulepos. In CMML, this is the other way round: you have to shift left by 32 to get the previous frame. This is what puzzled me I think. Now, if one were to swap the 2 32 bit granulepos bits in CMML granules, then you would still get a strictly increasing granulepos (since the previous pointer can never get backwards in time), and this would be more similar to Theora (eg, clear off the low bits). The high bits are now the backlink, and the low bits are the granulepos are the actual granule of the current packet (not an offset from the frame as Theora does, but closer to what it does). You still lose 32 bits of granulespace, of course, which really bothers me. At millisecond precision, 32 bits (signed) just give 24 days. Yeah, I know I've said it before :) Anyway, this makes a generic seeking algorithm handle Theora and CMML the same way, clear off the low bits below the granule shift and start off from there.
Conrad Parker
2008-Feb-14 04:03 UTC
[ogg-dev] Seeking to granules in discontinuous streams
Hi, sorry, there is a bug in the CMML spec and wiki page ... I discussed this with Silvia earlier this week but haven't gotten around to correcting it yet. CMML granulepos is much like theora's; the previous granule is stored in the higher bits, and the delta since then is stored in the lower bits. The current timestamp is the sum of the two. This is the behavior of the implementations (and has been for many years), and what is supposed to be in the spec ... Conrad. On 14/02/2008, ogg.k.ogg.k@googlemail.com <ogg.k.ogg.k@googlemail.com> wrote:> Some more thinking about this whole granulepos splitting. Sorry for > the badgering :) > > The CMML way was presented as a similar way as the Theora way, which I didn't > see (I actually use such a system to allow multiple events to start at > the same time, > and this feels like the Theora way). > Theora can find any frame's previous keyframe granulepos by clearing > the low bits > of the frame's granulepos. In CMML, this is the other way round: you > have to shift > left by 32 to get the previous frame. This is what puzzled me I think. > > Now, if one were to swap the 2 32 bit granulepos bits in CMML granules, then you > would still get a strictly increasing granulepos (since the previous > pointer can never > get backwards in time), and this would be more similar to Theora (eg, > clear off the low > bits). The high bits are now the backlink, and the low bits are the > granulepos are the > actual granule of the current packet (not an offset from the frame as > Theora does, > but closer to what it does). > > You still lose 32 bits of granulespace, of course, which really > bothers me. At millisecond > precision, 32 bits (signed) just give 24 days. Yeah, I know I've said > it before :) > > Anyway, this makes a generic seeking algorithm handle Theora and CMML the same > way, clear off the low bits below the granule shift and start off from there. > > _______________________________________________ > ogg-dev mailing list > ogg-dev@xiph.org > http://lists.xiph.org/mailman/listinfo/ogg-dev > >