I'm looking to trim down the size of the buffers i'm using... and at the moment, i've set each "media sample" (ie packet) to the size of the maximum reasonably possible for any codec (ie video)... about half a meg each... and there's quite a few of them... now i'd like to set the buffer size based on the codec, as obviously the audio codecs need much less space than the video ones. So i'm looking to find out the largest possible size a vorbis packet could be... so basically the highest sample rate, highest quality, most channels that is likely to occur. At some point i'll figure out a better rough calculation based on those 3 factors, but for now even the highest possible will be better than what i'm currently doing. If anyone does know a rough calculation based on those three it'd be appreciated. Zen.
----- Original Message ----- From: "Sebastian Gesemann" <sgeseman@upb.de> To: "illiminable" <ogg@illiminable.com> Cc: <vorbis-dev@xiph.org> Sent: Tuesday, October 19, 2004 10:05 PM Subject: Re: [Vorbis-dev] Maximum possible size of vorbis packet...> On Tue, 19 Oct 2004, illiminable wrote: > >> I'm looking to trim down the size of the buffers i'm using... and at >> the moment, i've set each "media sample" (ie packet) to the size of >> the maximum reasonably possible for any codec (ie video)... about >> half a meg each... and there's quite a few of them... now i'd like >> to set the buffer size based on the codec, as obviously the audio >> codecs need much less space than the video ones. >> So i'm looking to find out the largest possible size a vorbis packet >> could > > Why do you need to know that ? >Because in directshow you need to allocated a fixed number of fixed size buffers before you start streaming.> The Ogg layer could make a "packet-stream" available for the decoders > which loads new data from a new page on demand. (The packet does not have > to be _completely_ in the memory at once). >In directshow it does... it needs to be passed in a MediaSample object. Zen.
Paul Bryson
2004-Oct-21 11:00 UTC
[Vorbis-dev] Re: Maximum possible size of vorbis packet...
"illiminable" <ogg@illiminable.com> wrote...> So i'm looking to find out the largest possible size a vorbis packet could > be... so basically the highest sample rate, highest quality, most channels > that is likely to occur.If you want the largest possible size, then you could assume that any packet encoded in Vorbis is going to be less than the size of the audio in uncompressed PCM. So, figure out how much space that would take and you have the ceiling for the packet size in Vorbis. (I assume it would be possible to make a packet larger with Vorbis than uncompressed, but there is no need to cater to that as it is pointless.) To figure out the max size, you need: Maximum number of samples in a Vorbis packet Maximum bit depth Maximum number of channels Vorbis decode has a size of 2^(4 bit UINT) samples. That gives 2^15, or 32768 samples as the maximum decodable output of a Vorbis packet. I am guess that is the same for what is encoded in the packet, but someone else would have to say for sure. Now the maximum practical audio stats you are likely to see in the near future are DVD-Audio. It allows 24bit/192kHz at 2 channel or 24bit/96kHz at 6 channel. I am pretty sure I saw a DVD once that was 6.1 (7 channel) and supposedly they will have 7.1 (8 channel) DVDs at some point. So, we could say 24 bit at 8 channels is the maximum bit depth you will see in the consumer world any time soon. I think only 6 channel has been done in Vorbis so far, but lets take it to the extreme. 32768 * 24 * 8 = 6291456 6291456 bits is the maximum possible output from a vorbis packet. This gives 786,432 bytes as the maximum. Granted you are probably never going to see that. And if the decoder would only do 6 channels now, then half a meg is about the max. Atamido
On Tue, Oct 19, 2004 at 10:37:13PM +0800, illiminable wrote:> >Why do you need to know that ? > > > > Because in directshow you need to allocated a fixed number of fixed size > buffers before you start streaming.Understood. This is on the encoding side or also for accepting a stream? Monty