[ogg-dev] OggPCM2 : chunked vs interleaved data

John Koleszar
Tue, 15 Nov 2005 06:51:57 -0000

Rene Herman wrote:

> Why store N-bit in the most significant bits and not least? Doesn't
> that mean an application would likely need to shift everything down
> again?

One advantage of storing in the MSB's is that the relative value remains
correct when processed as the larger word size. For instance, a signed
12 bit integer would use 0x400 to represent +50% amplitude. By packing
this value into the MSB's of a 16 bit word, you get 0x4000, which still
represents a +50% amplitude. This way any software that can work on 16
bit samples will "do the right thing" on samples with lower
resolution.

One thing that should probably be added to the wiki is that the extra
bits should be set in a round-towards-zero fashion - eg, 0 for positive
numbers, 1 for negative numbers. This is probably worth discussing.
Should we do it as I propose here, or is truncation a better way to go?

> Pedantic: the sentence "Format IDs below 0x80000000 are reserved for
> use by Xiph and all the ones above are allowed for
> application-specific formats" leaves the use of 0x80000000 itself
> unspecified.
>
Agreed. Perhaps "Format IDs with the most significant bit cleared are
reserved for use by Xiph. Other formats are considered to be application
specific, and MUST have this bit set." Objections?

John