Re: further debugging of my ogg/theora decoder

salsaman <[email protected]>
Newsgroups gmane.comp.multimedia.ogg.theora.devel
Message-ID <[email protected]>
On Thu, Nov 13, 2008 at 7:37 AM, Conrad Parker <[email protected]> wrote:

> 2008/11/13 salsaman <[email protected]>:
> >
> > Actually I have now realised it`s not that complicated, as you say, just
> > counting frames and not caring about keyframes at all is the way to go.
> >
> > My search runs in 2 passes:
> >
> > pass 1, find largest gpos <= target - this gives us keyframe for target
> > (note that a granulepos with k<= target, f>=target is also acceptable)
> >
> > pass 2, calculate gpos from kframe, search for largest gpos < this
> >
> > then starting from that page:
> >  - ignore any packets on that page
> >  - count frames starting from the following page
>
> To clarify what you mean by "ignore" and "frames starting from the
> following page":
>

Yes, sorry, I meant ignore any *complete* packets on that page.



>
> If you are always feeding these pages into ogg_stream_pagein(), and
> always running ogg_stream_packetout() on them, then this should be
> correct. In this case, "ignoring any packets on that page" means that
> you retrieve all of the completed packets from that page with
> ogg_stream_packetout(), but discard them. You then load the next page
> with ogg_stream_pagein(). "Count frames starting from the following
> page" means that you start counting from the next packet that is
> returned by ogg_stream_packetout().
>

Right.



>
> >  - when we reach a page which produces (target -1), we know that is where
> > kframe starts, so store that page offset (this is useful for playing
> > backwards...)
>
> probably, but not guaranteed.


My error here, I meant to say, "when we reach a page which produces kframe
-1". Then we know that kframe`s packet begins on this page (or possibly the
following page, if it is not a continuation).




> As you're pulling packets out of the
> stream anyway then you might as well just call
> theora_packet_iskeyframe() which is cheap and will definitely give you
> the correct info.
>

Shouldn`t be needed, since we are counting frames and we know which frame is
the target`s keyframe already. Could be useful as a double check though.



>
> > - decode the next packet : this is our target frame
> >
> >
> > Does that look correct ?
>
> Yes, as long as you are pushing all those pages into ogg_stream_pagein().
>

Right. ogg_stream_pagein() and ogg_stream_packetout().

Gabriel.

_______________________________________________
theora-dev mailing list
[email protected]
http://lists.xiph.org/mailman/listinfo/theora-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.