[Vorbis] Block sizes

Michael Smith msmith at xiph.org
Sat Sep 3 08:35:11 PDT 2005


On 9/3/05, Tony O'Bryan <stormreaver at direcway.com> wrote:
> For the Vorbis file I'm using to develop my decoder, I've read the Ogg header
> at the start of the file, and now I'm reading the Vorbis identification
> header.
> 
> Everything checks out fine until I get to the block size byte (offset 28
> starting at the packet type field).  The byte value here is 184, which is a
> bit pattern of: 1011 1000.
> 
> The low order 4 bits are 8.  Squaring it gives 64.  This is valid according to
> the specs (as I understand them).  The upper 4 bits are 11.  Squaring it
> gives 121.  This is not valid according the the specs:

I'm not quite sure where you got the idea that you should square this
value (if something in the spec is unclear, let us know where, so we
can fix it).

The correct way to calculate blocksize is:
  blocksize = 1 << block_bits;

For the cases you give here, that gives 1<< 8 = 256, and 1 << 11 =
2048, which are the standard values used by the reference encoder for
44.1kHz audio at most bitrates.

Mike


More information about the Vorbis mailing list