[Speex-dev] Speex granulepos definition
Jean-Marc Valin
Jean-Marc.Valin at USherbrooke.ca
Sun Jun 19 17:07:50 PDT 2005
Hi Ralph,
What speexenc does (Speex itself does not know about Ogg) is that it gives
packet N the granulepos "N*frame_size - lookahead". In the case of narrowband,
the first frame would have granulepos "1*160 - 80", so 80. I can't say about
your example because Speex cannot encode a frame of one sample, which is a good
thing becuse otherwise, the granulepos would be -79. BTW, the reason for the "-
lookahead" is that it allows gapless playback (because the first samples in the
first frame are zeros). Hope that clarifies things (and doesn't break too much
stuff).
Jean-Marc
Selon Ralph Giles <giles at xiph.org>:
> Jean-Marc,
>
> What exactly does the speex code do to calculate the granulepos? With
> vorbis it's the 'count of decodable samples including this packet'. So
> if you had a packet that allowed you to decode 1024 samples since the
> beginning of playback, the granulepos is 1024, not for example 1023
> which would be the *index* of the last sample assuming C-style array
> indicies starting at 0.
>
> Put another way, if you had a speex stream that encoded only one sample
> in one packet in one page, what would be the granulepos of that page?
>
> I'm trying to figure out (with Thomas and Conrad) what all the codec
> implementations actually do so we can nail down the spec and/or best
> practices a little better.
>
> -r
> _______________________________________________
> Speex-dev mailing list
> Speex-dev at xiph.org
> http://lists.xiph.org/mailman/listinfo/speex-dev
>
>
More information about the Speex-dev
mailing list