[vorbis-dev] Vorbis packet sizes
Beni Cherniavsky
cben at techunix.technion.ac.il
Wed Jun 4 12:01:39 PDT 2003
John Ripley wrote on 2003-06-04:
> As an optimisation to reading Ogg encapsulated files, I've been thinking
> about a strategy of reading entire packets out of the stream, and sending
> them to the decoder. This has the advantages that:
>
> * The packet is just a linear array of bits in memory, with length known in
> advance.
> * The routine which gets bits out of the packet is then trivial and possibly
> inlined.
> * There is no possibility of blocking reads in the middle of a packet.
>
> However, I'm not sure what the upper bound of packet size is.
There is no bound whatsoever on packets. There is a limit on the size
of a page - just below 64KB. Packets can span multiple pages, which
is the only limitation to reading entire packets. I/O should be much
slower than moving around memory anyway.
> I see there's a "4KB rule of thumb" mentioned in the spec, but does
> this apply to every packet?
This applies to pages, not packets. Which of them do you want to talk
about?
> Even so, 4KB is still rather large, and I haven't seen packet sizes
> that large in any file generated by oggenc 1.0.
>
Most packets are much smaller but that's the typical page size.
However the initial setup packets can be larger. I don't know the
codebook sizes but the comment packet can be up to 2^32 bytes. But
that much has never seen in the wild ;-).
> Is there even a maximum?
>
Multiplying max page size by page sequence number limit, you can get a
theoretical limit of packet size but that would be ridiculously big.
Ogg intentionally supports arbitrarily big packets.
--
Beni Cherniavsky <cben at users.sf.net>
The Three Laws of Copy-Protechnics:
http://www.technion.ac.il/~cben/threelaws.html
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the Vorbis-dev
mailing list