<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.xiph.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jkoleszar</id>
	<title>XiphWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.xiph.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jkoleszar"/>
	<link rel="alternate" type="text/html" href="https://wiki.xiph.org/Special:Contributions/Jkoleszar"/>
	<updated>2026-04-24T04:05:06Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=OggUVS&amp;diff=3219</id>
		<title>OggUVS</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=OggUVS&amp;diff=3219"/>
		<updated>2005-11-18T20:28:56Z</updated>

		<summary type="html">&lt;p&gt;Jkoleszar: /* Encapsulation in Ogg */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is it ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;OggUVS&#039;&#039;&#039; is an uncompressed video codec for Ogg.  It&#039;s a simple way to store and transfer uncompressed video within an Ogg container. It is similar to [[OggYUV]] and [[OggRGB]], but is intended to support both formats.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;This is a work in progress and not a final proposal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Why is it ==&lt;br /&gt;
&lt;br /&gt;
This format is intended to be used as an interchange format. It is also useful for storing time-synced decoded audio/video, as opposed to using RIFF/WAV (.wav) and YUV4MPEG (.yuv) in separate files. It is intended to be less complex to use than RIFF/AVI.&lt;br /&gt;
&lt;br /&gt;
== Stream Description ==&lt;br /&gt;
&lt;br /&gt;
A stream is composed of a main header packet, one comment packets, zero or more additional header packets, and one or more data packets. At this time, one additional header packet is specified to describe the data packet layout. This packet SHOULD be present in all streams. Data packets are of fixed length as specified in the main header. A special zero length data packet with the EOS flag set is permitted. Data packets must contain exactly one image. This stream format is field based, rather than frame based. It supports only two fields per frame, and one field per data packet. Packets (fields) must appear in temporal order.&lt;br /&gt;
&lt;br /&gt;
== Packet Layout ==&lt;br /&gt;
&lt;br /&gt;
Note that unless otherwise noted, all multi-byte fields use the network byte order (big endian). The first packed in a stream MUST be the main header packet. The second packet MUST be the comment packet. Some extra header packets MAY be included after the comment header, provided this is identified in the main header. The packets that follow MUST all be data packets. &lt;br /&gt;
&lt;br /&gt;
=== Main Header Packet ===&lt;br /&gt;
The main header packet MUST be the first packet in the stream.&lt;br /&gt;
&lt;br /&gt;
 32  &amp;quot;UVS &amp;quot; Codec Identifier Word 0&lt;br /&gt;
 32  &amp;quot;    &amp;quot;  Codec Identifier Word 1&lt;br /&gt;
 16  [uint]  Version Major (breaks backwards compatability to increment)&lt;br /&gt;
 16  [uint]  Version Minor (backwards compatable, ie, more supported format id&#039;s)&lt;br /&gt;
 16  [uint]  Display Width&lt;br /&gt;
 16  [uint]  Display Height&lt;br /&gt;
 16  [uint]  Pixel Aspect Ratio Numerator&lt;br /&gt;
 16  [uint]  Pixel Aspect Ratio Denominator&lt;br /&gt;
 16  [uint]  Field Rate Numerator&lt;br /&gt;
 16  [uint]  Field Rate Denominator&lt;br /&gt;
 32  [uint]  Timebase (hz)&lt;br /&gt;
 32  [uint]  Field Image Size (in bytes)&lt;br /&gt;
 32  [uint]  Number of extra headers&lt;br /&gt;
 32  [enum]  Colorspace&lt;br /&gt;
 31  [uint]  Reserved&lt;br /&gt;
  1  [flg]   Interlaced&lt;br /&gt;
 32  [enum]  Layout ID&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Discussion:&#039;&#039;&#039;&lt;br /&gt;
* The number of extra headers field counts the number of headers following the comment packet and preceding the data.&lt;br /&gt;
&lt;br /&gt;
* Field Rate and Timebase: The Timebase field is used to change the time base of the granule position. The special value 0 indicates the the value (1/Field Rate). If the Field Rate values are set to zero, the content uses a variable field rate. In all cases the absolute field time is determined by (granulepos/Timebase). At least one of these two values must be declared. Examples of valid descriptions of 29.98fps video:&lt;br /&gt;
** Field Rate = 2998/100, Timebase = 90000, granulepos of first frame = 3002&lt;br /&gt;
** Field Rate = 0/0, Timebase = 90000, granulepos of first frame = 3002&lt;br /&gt;
** Field Rate = 2998/100, Timebase = 0, granulepos of first frame = 1&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Layout ID ====&lt;br /&gt;
* The Layout ID field is used to describe the layout of the image buffer in memory. This provides an easy means of selecting amongst common storage methods. If this field is set to zero, a Data Layout Packet MUST be included in the stream, and the contents of that packet should be parsed to determine the image buffer layout. The valid values for this field are:&lt;br /&gt;
   Value      Short Name           Description&lt;br /&gt;
 0x32315659   OGGUVS_FMT_YV12      8-bpp Y plane, followed by 8-bpp 2×2 V and U planes.&lt;br /&gt;
 0x56555949   OGGUVS_FMT_IYUV      8-bpp Y plane, followed by 8-bpp 2×2 U and V planes.&lt;br /&gt;
 0x32595559   OGGUVS_FMT_YUY2      UV downsampled 2:1 horizontally, ordered Y0 U0 Y1 V0&lt;br /&gt;
 0x59565955   OGGUVS_FMT_UYVY      UV downsampled 2:1 horizontally, ordered U0 Y0 V0 Y1&lt;br /&gt;
 0x55595659   OGGUVS_FMT_YVYU      UV downsampled 2:1 horizontally, ordered Y0 V0 Y1 U0&lt;br /&gt;
 0x80808081   OGGUVS_FMT_RGB24DIB  8 bits per component, stored BGR, rows aligned to a&lt;br /&gt;
                                   32 bit boundary, rows stored bottom first.&lt;br /&gt;
 0x80808082   OGGUVS_FMT_RGB32DIB  8 bits per component, stored BGRx (x is don&#039;t care)&lt;br /&gt;
                                   rows stored bottom first.&lt;br /&gt;
 0x80808083   OGGUVS_FMT_ARGBDIB   8 bits per component, stored BGRA, rows stored bottom&lt;br /&gt;
                                   first.&lt;br /&gt;
&lt;br /&gt;
By convention, layouts with a registered fourcc should use that fourcc for this value. Other formats should set the MSB of each byte and use a OggUVS specific value. Layout ID&#039;s with 0xFF as the most significant byte will be considered to be application specific.&lt;br /&gt;
&lt;br /&gt;
==== Colorspace ====&lt;br /&gt;
&lt;br /&gt;
* The Colorspace field is used to identify all colorspaces supported by this format and is defined as follows:&lt;br /&gt;
   Value      Short Name                Description&lt;br /&gt;
 0x00000001   OGGUVS_CSP_UNSPEC_RGB     Unspecified R&#039;G&#039;B&#039;&lt;br /&gt;
 0x00000002   OGGUVS_CSP_UNSPEC_YCBCR   Unspecified Y&#039;CbCr&lt;br /&gt;
 other useful colorspaces could go here.&lt;br /&gt;
&lt;br /&gt;
The unspecified colorspaces are intended to be used only when the actual colorspace used is not known. This situation arises when getting decompressed frames from proprietary codecs, for instance. Applications should make every effort to properly identify the colorspace and use the proper value in this field.&lt;br /&gt;
&lt;br /&gt;
=== Comment Packet ===&lt;br /&gt;
The comment packet MUST be present and MUST be the second packet in the stream.&lt;br /&gt;
&lt;br /&gt;
  Undefined at this time, probably will be whatever Theora uses.&lt;br /&gt;
&lt;br /&gt;
=== Data Layout Packet ===&lt;br /&gt;
The data layout packet MUST be included if the &#039;Layout ID&#039; field in the main header packet is set to zero. The data layout packet SHOULD be included in all streams. If a &#039;Layout ID&#039; field is specified, the data layout packet MUST NOT be modified from it&#039;s standard definition. Application that have a native understanding of the storage format as specified by the &#039;Layout ID&#039; MAY parse the data layout packet, but are not required to.&lt;br /&gt;
&lt;br /&gt;
 32     0x1  Data Layout Header Packet ID&lt;br /&gt;
 16  [uint]  Version Major (breaks backwards compatability to increment)&lt;br /&gt;
 16  [uint]  Version Minor (backwards compatable, ie, more supported format id&#039;s)&lt;br /&gt;
 16  [uint]  Luma Height&lt;br /&gt;
 16  [uint]  Luma Width&lt;br /&gt;
 16  [uint]  Chroma Height&lt;br /&gt;
 16  [uint]  Chroma Width&lt;br /&gt;
 -- Repeat all fields below this point for interlaced storage.&lt;br /&gt;
 32  [uint]  Alpha channel offset&lt;br /&gt;
 32  [uint]  Y/R channel offset&lt;br /&gt;
 32  [uint]  U/G channel offset&lt;br /&gt;
 32  [uint]  V/B channel offset&lt;br /&gt;
 32  [sint]  Alpha Y Stride&lt;br /&gt;
 32  [sint]  Y/R Y Stride&lt;br /&gt;
 32  [sint]  U/G Y Stride&lt;br /&gt;
 32  [sint]  V/B Y Stride&lt;br /&gt;
 32  [sint]  Y/R X Stride&lt;br /&gt;
 32  [sint]  U/G X Stride&lt;br /&gt;
 32  [sint]  V/B X Stride&lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Discussion:&#039;&#039;&#039; &lt;br /&gt;
* This layout packet is for 8 bit per channel formats only.&lt;br /&gt;
* The width and height fields reflect the storage size, not the displayed size, of the field.&lt;br /&gt;
* The offset fields specify the offset, in bytes, from the start of the data packet to the top leftmost sample for the specified channel. &lt;br /&gt;
* The Y stride field indicates the number of bytes to add to the current position to get the corresponding sample one row down. For the alpha channel, this value should be set to zero if the channel is not present. &lt;br /&gt;
* The X stride field indicates the number of bytes to add to the current position to get the corresponding sample one pixel to the right. For the alpha channel, this value should be set to zero if the channel is not present. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation Notes:&#039;&#039;&#039;&lt;br /&gt;
Great care must be exercised when using the layout packet directly. The following are a few checks that should be made to validate the data:&lt;br /&gt;
 For all channels:&lt;br /&gt;
 Width &amp;lt;= abs(Y_Stride)&lt;br /&gt;
 &lt;br /&gt;
 For alpha and luma channels:&lt;br /&gt;
 offset + y_stride*luma_h &amp;gt;= 0&lt;br /&gt;
 offset + y_stride*luma_h &amp;lt;= image size (from main header)&lt;br /&gt;
 &lt;br /&gt;
 For chroma channels:&lt;br /&gt;
 offset + y_stride*chroma_h &amp;gt;= 0&lt;br /&gt;
 offset + y_stride*chroma_h &amp;lt;= image size (from main header)&lt;br /&gt;
&lt;br /&gt;
 More to be added later.&lt;br /&gt;
&lt;br /&gt;
=== Data Packets ===&lt;br /&gt;
 32  &#039;FLD0&#039;     Field 0 (Top) header&lt;br /&gt;
 ..  [data]     Data for whole field&lt;br /&gt;
&lt;br /&gt;
 32  &#039;FLD1&#039;     Field 1 (Bottom) header&lt;br /&gt;
 ..  [data]     Data for whole field&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Discussion:&#039;&#039;&#039;&lt;br /&gt;
The length of the data packet must be exactly equal to the image size specified in the main header plus four bytes for the field header.&lt;br /&gt;
&lt;br /&gt;
== Encapsulation in Ogg ==&lt;br /&gt;
&lt;br /&gt;
The time base of the granule position is defined in the main header packet, and may vary from stream to stream.&lt;br /&gt;
&lt;br /&gt;
== Predefined Layout Packets ==&lt;br /&gt;
&lt;br /&gt;
The following packets are defined as the standard layout packets for the various defined formats. For those formats that declare a fourcc, it is illegal to modify the values of the layout packet. The following abbreviations are used in the formulae below:&lt;br /&gt;
&lt;br /&gt;
* disp_h: Display Height, from main header packet&lt;br /&gt;
* disp_w: Display Width, from main header packet&lt;br /&gt;
* l_h: Luma height, from data layout packet&lt;br /&gt;
* l_w: Luma width, from data layout packet&lt;br /&gt;
* c_h: Chroma height, from data layout packet&lt;br /&gt;
* c_w: Chroma width, from data layout packet&lt;br /&gt;
&lt;br /&gt;
=== OGGUVS_FMT_YV12 ===&lt;br /&gt;
* Layout ID: 0x32315659&lt;br /&gt;
 l_h         = (disp_h + 1) &amp;amp; ~1&lt;br /&gt;
 l_w         = (disp_w + 1) &amp;amp; ~1&lt;br /&gt;
 c_h         = l_h / 2&lt;br /&gt;
 c_w         = l_w / 2&lt;br /&gt;
 a_offset    = 0&lt;br /&gt;
 yr_offset   = 0&lt;br /&gt;
 ug_offset   = l_h * l_w + c_h * c_w&lt;br /&gt;
 vb_offset   = l_h * l_w&lt;br /&gt;
 a_y_stride  = 0&lt;br /&gt;
 yr_y_stride = l_w&lt;br /&gt;
 ug_y_stride = c_w&lt;br /&gt;
 vb_y_stride = c_w&lt;br /&gt;
 a_x_stride  = 0&lt;br /&gt;
 yr_x_stride = 1&lt;br /&gt;
 ug_x_stride = 1&lt;br /&gt;
 vb_x_stride = 1&lt;br /&gt;
&lt;br /&gt;
=== OGGUVS_FMT_IYUV ===&lt;br /&gt;
 TODO&lt;br /&gt;
 &lt;br /&gt;
=== OGGUVS_FMT_YUY2 ===&lt;br /&gt;
* Layout ID: 0x32595559&lt;br /&gt;
 l_h         = disp_h&lt;br /&gt;
 l_w         = (disp_w + 1) &amp;amp; ~1&lt;br /&gt;
 c_h         = l_h&lt;br /&gt;
 c_w         = l_w / 2&lt;br /&gt;
 a_offset    = 0&lt;br /&gt;
 yr_offset   = 0&lt;br /&gt;
 ug_offset   = 1&lt;br /&gt;
 vb_offset   = 3&lt;br /&gt;
 a_y_stride  = 0&lt;br /&gt;
 yr_y_stride = l_w * 2&lt;br /&gt;
 ug_y_stride = l_w * 2&lt;br /&gt;
 vb_y_stride = l_w * 2&lt;br /&gt;
 a_x_stride  = 0&lt;br /&gt;
 yr_x_stride = 2&lt;br /&gt;
 ug_x_stride = 4&lt;br /&gt;
 vb_x_stride = 4&lt;br /&gt;
&lt;br /&gt;
=== OGGUVS_FMT_UYVY ===&lt;br /&gt;
 TODO&lt;br /&gt;
 &lt;br /&gt;
=== OGGUVS_FMT_YVYU ===&lt;br /&gt;
 TODO&lt;br /&gt;
 &lt;br /&gt;
=== OGGUVS_FMT_RGB24DIB ===&lt;br /&gt;
* Layout ID: 0x80808081&lt;br /&gt;
 l_h         = disp_h&lt;br /&gt;
 l_w         = disp_w&lt;br /&gt;
 c_h         = disp_h&lt;br /&gt;
 c_w         = disp_w&lt;br /&gt;
 a_offset    = 0&lt;br /&gt;
 yr_offset   = 2 + (disp_h-1) * -yr_y_stride &lt;br /&gt;
 ug_offset   = 1 + (disp_h-1) * -yr_y_stride &lt;br /&gt;
 vb_offset   = 0 + (disp_h-1) * -yr_y_stride &lt;br /&gt;
 a_y_stride  = 0&lt;br /&gt;
 yr_y_stride = -1 * (((disp_w*3)+3) &amp;amp; ~1)&lt;br /&gt;
 ug_y_stride = -1 * (((disp_w*3)+3) &amp;amp; ~1)&lt;br /&gt;
 vb_y_stride = -1 * (((disp_w*3)+3) &amp;amp; ~1)&lt;br /&gt;
 a_x_stride  = 0&lt;br /&gt;
 yr_x_stride = 3&lt;br /&gt;
 ug_x_stride = 3&lt;br /&gt;
 vb_x_stride = 3&lt;br /&gt;
&lt;br /&gt;
=== OGGUVS_FMT_RGB32DIB ===&lt;br /&gt;
 TODO&lt;br /&gt;
 &lt;br /&gt;
=== OGGUVS_FMT_ARGBDIB ===&lt;br /&gt;
 TODO&lt;/div&gt;</summary>
		<author><name>Jkoleszar</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=OggUVS&amp;diff=2140</id>
		<title>OggUVS</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=OggUVS&amp;diff=2140"/>
		<updated>2005-11-18T20:00:46Z</updated>

		<summary type="html">&lt;p&gt;Jkoleszar: should have previewed&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is it ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;OggUVS&#039;&#039;&#039; is an uncompressed video codec for Ogg.  It&#039;s a simple way to store and transfer uncompressed video within an Ogg container. It is similar to [[OggYUV]] and [[OggRGB]], but is intended to support both formats.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;This is a work in progress and not a final proposal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Why is it ==&lt;br /&gt;
&lt;br /&gt;
This format is intended to be used as an interchange format. It is also useful for storing time-synced decoded audio/video, as opposed to using RIFF/WAV (.wav) and YUV4MPEG (.yuv) in separate files. It is intended to be less complex to use than RIFF/AVI.&lt;br /&gt;
&lt;br /&gt;
== Stream Description ==&lt;br /&gt;
&lt;br /&gt;
A stream is composed of a main header packet, one comment packets, zero or more additional header packets, and one or more data packets. At this time, one additional header packet is specified to describe the data packet layout. This packet SHOULD be present in all streams. Data packets are of fixed length as specified in the main header. A special zero length data packet with the EOS flag set is permitted. Data packets must contain exactly one image. This stream format is field based, rather than frame based. It supports only two fields per frame, and one field per data packet. Packets (fields) must appear in temporal order.&lt;br /&gt;
&lt;br /&gt;
== Packet Layout ==&lt;br /&gt;
&lt;br /&gt;
Note that unless otherwise noted, all multi-byte fields use the network byte order (big endian). The first packed in a stream MUST be the main header packet. The second packet MUST be the comment packet. Some extra header packets MAY be included after the comment header, provided this is identified in the main header. The packets that follow MUST all be data packets. &lt;br /&gt;
&lt;br /&gt;
=== Main Header Packet ===&lt;br /&gt;
The main header packet MUST be the first packet in the stream.&lt;br /&gt;
&lt;br /&gt;
 32  &amp;quot;UVS &amp;quot; Codec Identifier Word 0&lt;br /&gt;
 32  &amp;quot;    &amp;quot;  Codec Identifier Word 1&lt;br /&gt;
 16  [uint]  Version Major (breaks backwards compatability to increment)&lt;br /&gt;
 16  [uint]  Version Minor (backwards compatable, ie, more supported format id&#039;s)&lt;br /&gt;
 16  [uint]  Display Width&lt;br /&gt;
 16  [uint]  Display Height&lt;br /&gt;
 16  [uint]  Pixel Aspect Ratio Numerator&lt;br /&gt;
 16  [uint]  Pixel Aspect Ratio Denominator&lt;br /&gt;
 16  [uint]  Field Rate Numerator&lt;br /&gt;
 16  [uint]  Field Rate Denominator&lt;br /&gt;
 32  [uint]  Timebase (hz)&lt;br /&gt;
 32  [uint]  Field Image Size (in bytes)&lt;br /&gt;
 32  [uint]  Number of extra headers&lt;br /&gt;
 32  [enum]  Colorspace&lt;br /&gt;
 31  [uint]  Reserved&lt;br /&gt;
  1  [flg]   Interlaced&lt;br /&gt;
 32  [enum]  Layout ID&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Discussion:&#039;&#039;&#039;&lt;br /&gt;
* The number of extra headers field counts the number of headers following the comment packet and preceding the data.&lt;br /&gt;
&lt;br /&gt;
* Field Rate and Timebase: The Timebase field is used to change the time base of the granule position. The special value 0 indicates the the value (1/Field Rate). If the Field Rate values are set to zero, the content uses a variable field rate. In all cases the absolute field time is determined by (granulepos/Timebase). At least one of these two values must be declared. Examples of valid descriptions of 29.98fps video:&lt;br /&gt;
** Field Rate = 2998/100, Timebase = 90000, granulepos of first frame = 3002&lt;br /&gt;
** Field Rate = 0/0, Timebase = 90000, granulepos of first frame = 3002&lt;br /&gt;
** Field Rate = 2998/100, Timebase = 0, granulepos of first frame = 1&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
==== Layout ID ====&lt;br /&gt;
* The Layout ID field is used to describe the layout of the image buffer in memory. This provides an easy means of selecting amongst common storage methods. If this field is set to zero, a Data Layout Packet MUST be included in the stream, and the contents of that packet should be parsed to determine the image buffer layout. The valid values for this field are:&lt;br /&gt;
   Value      Short Name           Description&lt;br /&gt;
 0x32315659   OGGUVS_FMT_YV12      8-bpp Y plane, followed by 8-bpp 2×2 V and U planes.&lt;br /&gt;
 0x56555949   OGGUVS_FMT_IYUV      8-bpp Y plane, followed by 8-bpp 2×2 U and V planes.&lt;br /&gt;
 0x32595559   OGGUVS_FMT_YUY2      UV downsampled 2:1 horizontally, ordered Y0 U0 Y1 V0&lt;br /&gt;
 0x59565955   OGGUVS_FMT_UYVY      UV downsampled 2:1 horizontally, ordered U0 Y0 V0 Y1&lt;br /&gt;
 0x55595659   OGGUVS_FMT_YVYU      UV downsampled 2:1 horizontally, ordered Y0 V0 Y1 U0&lt;br /&gt;
 0x80808081   OGGUVS_FMT_RGB24DIB  8 bits per component, stored BGR, rows aligned to a&lt;br /&gt;
                                   32 bit boundary, rows stored bottom first.&lt;br /&gt;
 0x80808082   OGGUVS_FMT_RGB32DIB  8 bits per component, stored BGRx (x is don&#039;t care)&lt;br /&gt;
                                   rows stored bottom first.&lt;br /&gt;
 0x80808083   OGGUVS_FMT_ARGBDIB   8 bits per component, stored BGRA, rows stored bottom&lt;br /&gt;
                                   first.&lt;br /&gt;
&lt;br /&gt;
By convention, layouts with a registered fourcc should use that fourcc for this value. Other formats should set the MSB of each byte and use a OggUVS specific value. Layout ID&#039;s with 0xFF as the most significant byte will be considered to be application specific.&lt;br /&gt;
&lt;br /&gt;
==== Colorspace ====&lt;br /&gt;
&lt;br /&gt;
* The Colorspace field is used to identify all colorspaces supported by this format and is defined as follows:&lt;br /&gt;
   Value      Short Name                Description&lt;br /&gt;
 0x00000001   OGGUVS_CSP_UNSPEC_RGB     Unspecified R&#039;G&#039;B&#039;&lt;br /&gt;
 0x00000002   OGGUVS_CSP_UNSPEC_YCBCR   Unspecified Y&#039;CbCr&lt;br /&gt;
 other useful colorspaces could go here.&lt;br /&gt;
&lt;br /&gt;
The unspecified colorspaces are intended to be used only when the actual colorspace used is not known. This situation arises when getting decompressed frames from proprietary codecs, for instance. Applications should make every effort to properly identify the colorspace and use the proper value in this field.&lt;br /&gt;
&lt;br /&gt;
=== Comment Packet ===&lt;br /&gt;
The comment packet MUST be present and MUST be the second packet in the stream.&lt;br /&gt;
&lt;br /&gt;
  Undefined at this time, probably will be whatever Theora uses.&lt;br /&gt;
&lt;br /&gt;
=== Data Layout Packet ===&lt;br /&gt;
The data layout packet MUST be included if the &#039;Layout ID&#039; field in the main header packet is set to zero. The data layout packet SHOULD be included in all streams. If a &#039;Layout ID&#039; field is specified, the data layout packet MUST NOT be modified from it&#039;s standard definition. Application that have a native understanding of the storage format as specified by the &#039;Layout ID&#039; MAY parse the data layout packet, but are not required to.&lt;br /&gt;
&lt;br /&gt;
 32     0x1  Data Layout Header Packet ID&lt;br /&gt;
 16  [uint]  Version Major (breaks backwards compatability to increment)&lt;br /&gt;
 16  [uint]  Version Minor (backwards compatable, ie, more supported format id&#039;s)&lt;br /&gt;
 16  [uint]  Luma Height&lt;br /&gt;
 16  [uint]  Luma Width&lt;br /&gt;
 16  [uint]  Chroma Height&lt;br /&gt;
 16  [uint]  Chroma Width&lt;br /&gt;
 -- Repeat all fields below this point for interlaced storage.&lt;br /&gt;
 32  [uint]  Alpha channel offset&lt;br /&gt;
 32  [uint]  Y/R channel offset&lt;br /&gt;
 32  [uint]  U/G channel offset&lt;br /&gt;
 32  [uint]  V/B channel offset&lt;br /&gt;
 32  [sint]  Alpha Y Stride&lt;br /&gt;
 32  [sint]  Y/R Y Stride&lt;br /&gt;
 32  [sint]  U/G Y Stride&lt;br /&gt;
 32  [sint]  V/B Y Stride&lt;br /&gt;
 32  [sint]  Y/R X Stride&lt;br /&gt;
 32  [sint]  U/G X Stride&lt;br /&gt;
 32  [sint]  V/B X Stride&lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Discussion:&#039;&#039;&#039; &lt;br /&gt;
* This layout packet is for 8 bit per channel formats only.&lt;br /&gt;
* The width and height fields reflect the storage size, not the displayed size, of the field.&lt;br /&gt;
* The offset fields specify the offset, in bytes, from the start of the data packet to the top leftmost sample for the specified channel. &lt;br /&gt;
* The Y stride field indicates the number of bytes to add to the current position to get the corresponding sample one row down. For the alpha channel, this value should be set to zero if the channel is not present. &lt;br /&gt;
* The X stride field indicates the number of bytes to add to the current position to get the corresponding sample one pixel to the right. For the alpha channel, this value should be set to zero if the channel is not present. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation Notes:&#039;&#039;&#039;&lt;br /&gt;
Great care must be exercised when using the layout packet directly. The following are a few checks that should be made to validate the data:&lt;br /&gt;
 For all channels:&lt;br /&gt;
 Width &amp;lt;= abs(Y_Stride)&lt;br /&gt;
 &lt;br /&gt;
 For alpha and luma channels:&lt;br /&gt;
 offset + y_stride*luma_h &amp;gt;= 0&lt;br /&gt;
 offset + y_stride*luma_h &amp;lt;= image size (from main header)&lt;br /&gt;
 &lt;br /&gt;
 For chroma channels:&lt;br /&gt;
 offset + y_stride*chroma_h &amp;gt;= 0&lt;br /&gt;
 offset + y_stride*chroma_h &amp;lt;= image size (from main header)&lt;br /&gt;
&lt;br /&gt;
 More to be added later.&lt;br /&gt;
&lt;br /&gt;
=== Data Packets ===&lt;br /&gt;
 32  &#039;FLD0&#039;     Field 0 (Top) header&lt;br /&gt;
 ..  [data]     Data for whole field&lt;br /&gt;
&lt;br /&gt;
 32  &#039;FLD1&#039;     Field 1 (Bottom) header&lt;br /&gt;
 ..  [data]     Data for whole field&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Discussion:&#039;&#039;&#039;&lt;br /&gt;
The length of the data packet must be exactly equal to the image size specified in the main header plus four bytes for the field header.&lt;br /&gt;
&lt;br /&gt;
== Encapsulation in Ogg ==&lt;br /&gt;
&lt;br /&gt;
A granule is defined as one field.&lt;br /&gt;
&lt;br /&gt;
== Predefined Layout Packets ==&lt;br /&gt;
&lt;br /&gt;
The following packets are defined as the standard layout packets for the various defined formats. For those formats that declare a fourcc, it is illegal to modify the values of the layout packet. The following abbreviations are used in the formulae below:&lt;br /&gt;
&lt;br /&gt;
* disp_h: Display Height, from main header packet&lt;br /&gt;
* disp_w: Display Width, from main header packet&lt;br /&gt;
* l_h: Luma height, from data layout packet&lt;br /&gt;
* l_w: Luma width, from data layout packet&lt;br /&gt;
* c_h: Chroma height, from data layout packet&lt;br /&gt;
* c_w: Chroma width, from data layout packet&lt;br /&gt;
&lt;br /&gt;
=== OGGUVS_FMT_YV12 ===&lt;br /&gt;
* Layout ID: 0x32315659&lt;br /&gt;
 l_h         = (disp_h + 1) &amp;amp; ~1&lt;br /&gt;
 l_w         = (disp_w + 1) &amp;amp; ~1&lt;br /&gt;
 c_h         = l_h / 2&lt;br /&gt;
 c_w         = l_w / 2&lt;br /&gt;
 a_offset    = 0&lt;br /&gt;
 yr_offset   = 0&lt;br /&gt;
 ug_offset   = l_h * l_w + c_h * c_w&lt;br /&gt;
 vb_offset   = l_h * l_w&lt;br /&gt;
 a_y_stride  = 0&lt;br /&gt;
 yr_y_stride = l_w&lt;br /&gt;
 ug_y_stride = c_w&lt;br /&gt;
 vb_y_stride = c_w&lt;br /&gt;
 a_x_stride  = 0&lt;br /&gt;
 yr_x_stride = 1&lt;br /&gt;
 ug_x_stride = 1&lt;br /&gt;
 vb_x_stride = 1&lt;br /&gt;
&lt;br /&gt;
=== OGGUVS_FMT_IYUV ===&lt;br /&gt;
 TODO&lt;br /&gt;
 &lt;br /&gt;
=== OGGUVS_FMT_YUY2 ===&lt;br /&gt;
* Layout ID: 0x32595559&lt;br /&gt;
 l_h         = disp_h&lt;br /&gt;
 l_w         = (disp_w + 1) &amp;amp; ~1&lt;br /&gt;
 c_h         = l_h&lt;br /&gt;
 c_w         = l_w / 2&lt;br /&gt;
 a_offset    = 0&lt;br /&gt;
 yr_offset   = 0&lt;br /&gt;
 ug_offset   = 1&lt;br /&gt;
 vb_offset   = 3&lt;br /&gt;
 a_y_stride  = 0&lt;br /&gt;
 yr_y_stride = l_w * 2&lt;br /&gt;
 ug_y_stride = l_w * 2&lt;br /&gt;
 vb_y_stride = l_w * 2&lt;br /&gt;
 a_x_stride  = 0&lt;br /&gt;
 yr_x_stride = 2&lt;br /&gt;
 ug_x_stride = 4&lt;br /&gt;
 vb_x_stride = 4&lt;br /&gt;
&lt;br /&gt;
=== OGGUVS_FMT_UYVY ===&lt;br /&gt;
 TODO&lt;br /&gt;
 &lt;br /&gt;
=== OGGUVS_FMT_YVYU ===&lt;br /&gt;
 TODO&lt;br /&gt;
 &lt;br /&gt;
=== OGGUVS_FMT_RGB24DIB ===&lt;br /&gt;
* Layout ID: 0x80808081&lt;br /&gt;
 l_h         = disp_h&lt;br /&gt;
 l_w         = disp_w&lt;br /&gt;
 c_h         = disp_h&lt;br /&gt;
 c_w         = disp_w&lt;br /&gt;
 a_offset    = 0&lt;br /&gt;
 yr_offset   = 2 + (disp_h-1) * -yr_y_stride &lt;br /&gt;
 ug_offset   = 1 + (disp_h-1) * -yr_y_stride &lt;br /&gt;
 vb_offset   = 0 + (disp_h-1) * -yr_y_stride &lt;br /&gt;
 a_y_stride  = 0&lt;br /&gt;
 yr_y_stride = -1 * (((disp_w*3)+3) &amp;amp; ~1)&lt;br /&gt;
 ug_y_stride = -1 * (((disp_w*3)+3) &amp;amp; ~1)&lt;br /&gt;
 vb_y_stride = -1 * (((disp_w*3)+3) &amp;amp; ~1)&lt;br /&gt;
 a_x_stride  = 0&lt;br /&gt;
 yr_x_stride = 3&lt;br /&gt;
 ug_x_stride = 3&lt;br /&gt;
 vb_x_stride = 3&lt;br /&gt;
&lt;br /&gt;
=== OGGUVS_FMT_RGB32DIB ===&lt;br /&gt;
 TODO&lt;br /&gt;
 &lt;br /&gt;
=== OGGUVS_FMT_ARGBDIB ===&lt;br /&gt;
 TODO&lt;/div&gt;</summary>
		<author><name>Jkoleszar</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=OggUVS&amp;diff=2139</id>
		<title>OggUVS</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=OggUVS&amp;diff=2139"/>
		<updated>2005-11-18T19:59:25Z</updated>

		<summary type="html">&lt;p&gt;Jkoleszar: Add timebase field to support VFR&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is it ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;OggUVS&#039;&#039;&#039; is an uncompressed video codec for Ogg.  It&#039;s a simple way to store and transfer uncompressed video within an Ogg container. It is similar to [[OggYUV]] and [[OggRGB]], but is intended to support both formats.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;This is a work in progress and not a final proposal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Why is it ==&lt;br /&gt;
&lt;br /&gt;
This format is intended to be used as an interchange format. It is also useful for storing time-synced decoded audio/video, as opposed to using RIFF/WAV (.wav) and YUV4MPEG (.yuv) in separate files. It is intended to be less complex to use than RIFF/AVI.&lt;br /&gt;
&lt;br /&gt;
== Stream Description ==&lt;br /&gt;
&lt;br /&gt;
A stream is composed of a main header packet, one comment packets, zero or more additional header packets, and one or more data packets. At this time, one additional header packet is specified to describe the data packet layout. This packet SHOULD be present in all streams. Data packets are of fixed length as specified in the main header. A special zero length data packet with the EOS flag set is permitted. Data packets must contain exactly one image. This stream format is field based, rather than frame based. It supports only two fields per frame, and one field per data packet. Packets (fields) must appear in temporal order.&lt;br /&gt;
&lt;br /&gt;
== Packet Layout ==&lt;br /&gt;
&lt;br /&gt;
Note that unless otherwise noted, all multi-byte fields use the network byte order (big endian). The first packed in a stream MUST be the main header packet. The second packet MUST be the comment packet. Some extra header packets MAY be included after the comment header, provided this is identified in the main header. The packets that follow MUST all be data packets. &lt;br /&gt;
&lt;br /&gt;
=== Main Header Packet ===&lt;br /&gt;
The main header packet MUST be the first packet in the stream.&lt;br /&gt;
&lt;br /&gt;
 32  &amp;quot;UVS &amp;quot; Codec Identifier Word 0&lt;br /&gt;
 32  &amp;quot;    &amp;quot;  Codec Identifier Word 1&lt;br /&gt;
 16  [uint]  Version Major (breaks backwards compatability to increment)&lt;br /&gt;
 16  [uint]  Version Minor (backwards compatable, ie, more supported format id&#039;s)&lt;br /&gt;
 16  [uint]  Display Width&lt;br /&gt;
 16  [uint]  Display Height&lt;br /&gt;
 16  [uint]  Pixel Aspect Ratio Numerator&lt;br /&gt;
 16  [uint]  Pixel Aspect Ratio Denominator&lt;br /&gt;
 16  [uint]  Field Rate Numerator&lt;br /&gt;
 16  [uint]  Field Rate Denominator&lt;br /&gt;
 32  [uint]  Timebase (hz)&lt;br /&gt;
 32  [uint]  Field Image Size (in bytes)&lt;br /&gt;
 32  [uint]  Number of extra headers&lt;br /&gt;
 32  [enum]  Colorspace&lt;br /&gt;
 31  [uint]  Reserved&lt;br /&gt;
  1  [flg]   Interlaced&lt;br /&gt;
 32  [enum]  Layout ID&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Discussion:&#039;&#039;&#039;&lt;br /&gt;
* The number of extra headers field counts the number of headers following the comment packet and preceding the data.&lt;br /&gt;
&lt;br /&gt;
* Field Rate and Timebase: The Timebase field is used to change the time base of the granule position. The special value 0 indicates the the value (1/Field Rate). If the Field Rate values are set to zero, the content uses a variable field rate. In all cases the absolute field time is determined by (granulepos/Timebase). At least one of these two values must be declared. &lt;br /&gt;
&lt;br /&gt;
Examples of valid descriptions of 29.98fps video:&lt;br /&gt;
Field Rate = 2998/100, Timebase = 90000, granulepos of first frame = 3002&lt;br /&gt;
Field Rate = 0/0, Timebase = 90000, granulepos of first frame = 3002&lt;br /&gt;
Field Rate = 2998/100, Timebase = 0, granulepos of first frame = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Layout ID ====&lt;br /&gt;
* The Layout ID field is used to describe the layout of the image buffer in memory. This provides an easy means of selecting amongst common storage methods. If this field is set to zero, a Data Layout Packet MUST be included in the stream, and the contents of that packet should be parsed to determine the image buffer layout. The valid values for this field are:&lt;br /&gt;
   Value      Short Name           Description&lt;br /&gt;
 0x32315659   OGGUVS_FMT_YV12      8-bpp Y plane, followed by 8-bpp 2×2 V and U planes.&lt;br /&gt;
 0x56555949   OGGUVS_FMT_IYUV      8-bpp Y plane, followed by 8-bpp 2×2 U and V planes.&lt;br /&gt;
 0x32595559   OGGUVS_FMT_YUY2      UV downsampled 2:1 horizontally, ordered Y0 U0 Y1 V0&lt;br /&gt;
 0x59565955   OGGUVS_FMT_UYVY      UV downsampled 2:1 horizontally, ordered U0 Y0 V0 Y1&lt;br /&gt;
 0x55595659   OGGUVS_FMT_YVYU      UV downsampled 2:1 horizontally, ordered Y0 V0 Y1 U0&lt;br /&gt;
 0x80808081   OGGUVS_FMT_RGB24DIB  8 bits per component, stored BGR, rows aligned to a&lt;br /&gt;
                                   32 bit boundary, rows stored bottom first.&lt;br /&gt;
 0x80808082   OGGUVS_FMT_RGB32DIB  8 bits per component, stored BGRx (x is don&#039;t care)&lt;br /&gt;
                                   rows stored bottom first.&lt;br /&gt;
 0x80808083   OGGUVS_FMT_ARGBDIB   8 bits per component, stored BGRA, rows stored bottom&lt;br /&gt;
                                   first.&lt;br /&gt;
&lt;br /&gt;
By convention, layouts with a registered fourcc should use that fourcc for this value. Other formats should set the MSB of each byte and use a OggUVS specific value. Layout ID&#039;s with 0xFF as the most significant byte will be considered to be application specific.&lt;br /&gt;
&lt;br /&gt;
==== Colorspace ====&lt;br /&gt;
&lt;br /&gt;
* The Colorspace field is used to identify all colorspaces supported by this format and is defined as follows:&lt;br /&gt;
   Value      Short Name                Description&lt;br /&gt;
 0x00000001   OGGUVS_CSP_UNSPEC_RGB     Unspecified R&#039;G&#039;B&#039;&lt;br /&gt;
 0x00000002   OGGUVS_CSP_UNSPEC_YCBCR   Unspecified Y&#039;CbCr&lt;br /&gt;
 other useful colorspaces could go here.&lt;br /&gt;
&lt;br /&gt;
The unspecified colorspaces are intended to be used only when the actual colorspace used is not known. This situation arises when getting decompressed frames from proprietary codecs, for instance. Applications should make every effort to properly identify the colorspace and use the proper value in this field.&lt;br /&gt;
&lt;br /&gt;
=== Comment Packet ===&lt;br /&gt;
The comment packet MUST be present and MUST be the second packet in the stream.&lt;br /&gt;
&lt;br /&gt;
  Undefined at this time, probably will be whatever Theora uses.&lt;br /&gt;
&lt;br /&gt;
=== Data Layout Packet ===&lt;br /&gt;
The data layout packet MUST be included if the &#039;Layout ID&#039; field in the main header packet is set to zero. The data layout packet SHOULD be included in all streams. If a &#039;Layout ID&#039; field is specified, the data layout packet MUST NOT be modified from it&#039;s standard definition. Application that have a native understanding of the storage format as specified by the &#039;Layout ID&#039; MAY parse the data layout packet, but are not required to.&lt;br /&gt;
&lt;br /&gt;
 32     0x1  Data Layout Header Packet ID&lt;br /&gt;
 16  [uint]  Version Major (breaks backwards compatability to increment)&lt;br /&gt;
 16  [uint]  Version Minor (backwards compatable, ie, more supported format id&#039;s)&lt;br /&gt;
 16  [uint]  Luma Height&lt;br /&gt;
 16  [uint]  Luma Width&lt;br /&gt;
 16  [uint]  Chroma Height&lt;br /&gt;
 16  [uint]  Chroma Width&lt;br /&gt;
 -- Repeat all fields below this point for interlaced storage.&lt;br /&gt;
 32  [uint]  Alpha channel offset&lt;br /&gt;
 32  [uint]  Y/R channel offset&lt;br /&gt;
 32  [uint]  U/G channel offset&lt;br /&gt;
 32  [uint]  V/B channel offset&lt;br /&gt;
 32  [sint]  Alpha Y Stride&lt;br /&gt;
 32  [sint]  Y/R Y Stride&lt;br /&gt;
 32  [sint]  U/G Y Stride&lt;br /&gt;
 32  [sint]  V/B Y Stride&lt;br /&gt;
 32  [sint]  Y/R X Stride&lt;br /&gt;
 32  [sint]  U/G X Stride&lt;br /&gt;
 32  [sint]  V/B X Stride&lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Discussion:&#039;&#039;&#039; &lt;br /&gt;
* This layout packet is for 8 bit per channel formats only.&lt;br /&gt;
* The width and height fields reflect the storage size, not the displayed size, of the field.&lt;br /&gt;
* The offset fields specify the offset, in bytes, from the start of the data packet to the top leftmost sample for the specified channel. &lt;br /&gt;
* The Y stride field indicates the number of bytes to add to the current position to get the corresponding sample one row down. For the alpha channel, this value should be set to zero if the channel is not present. &lt;br /&gt;
* The X stride field indicates the number of bytes to add to the current position to get the corresponding sample one pixel to the right. For the alpha channel, this value should be set to zero if the channel is not present. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation Notes:&#039;&#039;&#039;&lt;br /&gt;
Great care must be exercised when using the layout packet directly. The following are a few checks that should be made to validate the data:&lt;br /&gt;
 For all channels:&lt;br /&gt;
 Width &amp;lt;= abs(Y_Stride)&lt;br /&gt;
 &lt;br /&gt;
 For alpha and luma channels:&lt;br /&gt;
 offset + y_stride*luma_h &amp;gt;= 0&lt;br /&gt;
 offset + y_stride*luma_h &amp;lt;= image size (from main header)&lt;br /&gt;
 &lt;br /&gt;
 For chroma channels:&lt;br /&gt;
 offset + y_stride*chroma_h &amp;gt;= 0&lt;br /&gt;
 offset + y_stride*chroma_h &amp;lt;= image size (from main header)&lt;br /&gt;
&lt;br /&gt;
 More to be added later.&lt;br /&gt;
&lt;br /&gt;
=== Data Packets ===&lt;br /&gt;
 32  &#039;FLD0&#039;     Field 0 (Top) header&lt;br /&gt;
 ..  [data]     Data for whole field&lt;br /&gt;
&lt;br /&gt;
 32  &#039;FLD1&#039;     Field 1 (Bottom) header&lt;br /&gt;
 ..  [data]     Data for whole field&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Discussion:&#039;&#039;&#039;&lt;br /&gt;
The length of the data packet must be exactly equal to the image size specified in the main header plus four bytes for the field header.&lt;br /&gt;
&lt;br /&gt;
== Encapsulation in Ogg ==&lt;br /&gt;
&lt;br /&gt;
A granule is defined as one field.&lt;br /&gt;
&lt;br /&gt;
== Predefined Layout Packets ==&lt;br /&gt;
&lt;br /&gt;
The following packets are defined as the standard layout packets for the various defined formats. For those formats that declare a fourcc, it is illegal to modify the values of the layout packet. The following abbreviations are used in the formulae below:&lt;br /&gt;
&lt;br /&gt;
* disp_h: Display Height, from main header packet&lt;br /&gt;
* disp_w: Display Width, from main header packet&lt;br /&gt;
* l_h: Luma height, from data layout packet&lt;br /&gt;
* l_w: Luma width, from data layout packet&lt;br /&gt;
* c_h: Chroma height, from data layout packet&lt;br /&gt;
* c_w: Chroma width, from data layout packet&lt;br /&gt;
&lt;br /&gt;
=== OGGUVS_FMT_YV12 ===&lt;br /&gt;
* Layout ID: 0x32315659&lt;br /&gt;
 l_h         = (disp_h + 1) &amp;amp; ~1&lt;br /&gt;
 l_w         = (disp_w + 1) &amp;amp; ~1&lt;br /&gt;
 c_h         = l_h / 2&lt;br /&gt;
 c_w         = l_w / 2&lt;br /&gt;
 a_offset    = 0&lt;br /&gt;
 yr_offset   = 0&lt;br /&gt;
 ug_offset   = l_h * l_w + c_h * c_w&lt;br /&gt;
 vb_offset   = l_h * l_w&lt;br /&gt;
 a_y_stride  = 0&lt;br /&gt;
 yr_y_stride = l_w&lt;br /&gt;
 ug_y_stride = c_w&lt;br /&gt;
 vb_y_stride = c_w&lt;br /&gt;
 a_x_stride  = 0&lt;br /&gt;
 yr_x_stride = 1&lt;br /&gt;
 ug_x_stride = 1&lt;br /&gt;
 vb_x_stride = 1&lt;br /&gt;
&lt;br /&gt;
=== OGGUVS_FMT_IYUV ===&lt;br /&gt;
 TODO&lt;br /&gt;
 &lt;br /&gt;
=== OGGUVS_FMT_YUY2 ===&lt;br /&gt;
* Layout ID: 0x32595559&lt;br /&gt;
 l_h         = disp_h&lt;br /&gt;
 l_w         = (disp_w + 1) &amp;amp; ~1&lt;br /&gt;
 c_h         = l_h&lt;br /&gt;
 c_w         = l_w / 2&lt;br /&gt;
 a_offset    = 0&lt;br /&gt;
 yr_offset   = 0&lt;br /&gt;
 ug_offset   = 1&lt;br /&gt;
 vb_offset   = 3&lt;br /&gt;
 a_y_stride  = 0&lt;br /&gt;
 yr_y_stride = l_w * 2&lt;br /&gt;
 ug_y_stride = l_w * 2&lt;br /&gt;
 vb_y_stride = l_w * 2&lt;br /&gt;
 a_x_stride  = 0&lt;br /&gt;
 yr_x_stride = 2&lt;br /&gt;
 ug_x_stride = 4&lt;br /&gt;
 vb_x_stride = 4&lt;br /&gt;
&lt;br /&gt;
=== OGGUVS_FMT_UYVY ===&lt;br /&gt;
 TODO&lt;br /&gt;
 &lt;br /&gt;
=== OGGUVS_FMT_YVYU ===&lt;br /&gt;
 TODO&lt;br /&gt;
 &lt;br /&gt;
=== OGGUVS_FMT_RGB24DIB ===&lt;br /&gt;
* Layout ID: 0x80808081&lt;br /&gt;
 l_h         = disp_h&lt;br /&gt;
 l_w         = disp_w&lt;br /&gt;
 c_h         = disp_h&lt;br /&gt;
 c_w         = disp_w&lt;br /&gt;
 a_offset    = 0&lt;br /&gt;
 yr_offset   = 2 + (disp_h-1) * -yr_y_stride &lt;br /&gt;
 ug_offset   = 1 + (disp_h-1) * -yr_y_stride &lt;br /&gt;
 vb_offset   = 0 + (disp_h-1) * -yr_y_stride &lt;br /&gt;
 a_y_stride  = 0&lt;br /&gt;
 yr_y_stride = -1 * (((disp_w*3)+3) &amp;amp; ~1)&lt;br /&gt;
 ug_y_stride = -1 * (((disp_w*3)+3) &amp;amp; ~1)&lt;br /&gt;
 vb_y_stride = -1 * (((disp_w*3)+3) &amp;amp; ~1)&lt;br /&gt;
 a_x_stride  = 0&lt;br /&gt;
 yr_x_stride = 3&lt;br /&gt;
 ug_x_stride = 3&lt;br /&gt;
 vb_x_stride = 3&lt;br /&gt;
&lt;br /&gt;
=== OGGUVS_FMT_RGB32DIB ===&lt;br /&gt;
 TODO&lt;br /&gt;
 &lt;br /&gt;
=== OGGUVS_FMT_ARGBDIB ===&lt;br /&gt;
 TODO&lt;/div&gt;</summary>
		<author><name>Jkoleszar</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=OggUVS&amp;diff=2138</id>
		<title>OggUVS</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=OggUVS&amp;diff=2138"/>
		<updated>2005-11-15T21:13:51Z</updated>

		<summary type="html">&lt;p&gt;Jkoleszar: Correct id for yv12&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is it ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;OggUVS&#039;&#039;&#039; is an uncompressed video codec for Ogg.  It&#039;s a simple way to store and transfer uncompressed video within an Ogg container. It is similar to [[OggYUV]] and [[OggRGB]], but is intended to support both formats.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;This is a work in progress and not a final proposal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Why is it ==&lt;br /&gt;
&lt;br /&gt;
This format is intended to be used as an interchange format. It is also useful for storing time-synced decoded audio/video, as opposed to using RIFF/WAV (.wav) and YUV4MPEG (.yuv) in separate files. It is intended to be less complex to use than RIFF/AVI.&lt;br /&gt;
&lt;br /&gt;
== Stream Description ==&lt;br /&gt;
&lt;br /&gt;
A stream is composed of a main header packet, one comment packets, zero or more additional header packets, and one or more data packets. At this time, one additional header packet is specified to describe the data packet layout. This packet SHOULD be present in all streams. Data packets are of fixed length as specified in the main header. A special zero length data packet with the EOS flag set is permitted. Data packets must contain exactly one image. This stream format is field based, rather than frame based. It supports only two fields per frame, and one field per data packet. Packets (fields) must appear in temporal order.&lt;br /&gt;
&lt;br /&gt;
== Packet Layout ==&lt;br /&gt;
&lt;br /&gt;
Note that unless otherwise noted, all multi-byte fields use the network byte order (big endian). The first packed in a stream MUST be the main header packet. The second packet MUST be the comment packet. Some extra header packets MAY be included after the comment header, provided this is identified in the main header. The packets that follow MUST all be data packets. &lt;br /&gt;
&lt;br /&gt;
=== Main Header Packet ===&lt;br /&gt;
The main header packet MUST be the first packet in the stream.&lt;br /&gt;
&lt;br /&gt;
 32  &amp;quot;UVS\0&amp;quot; Codec Identifier Word 0&lt;br /&gt;
 32     0x0  Codec Identifier Word 1&lt;br /&gt;
 16  [uint]  Version Major (breaks backwards compatability to increment)&lt;br /&gt;
 16  [uint]  Version Minor (backwards compatable, ie, more supported format id&#039;s)&lt;br /&gt;
 16  [uint]  Display Width&lt;br /&gt;
 16  [uint]  Display Height&lt;br /&gt;
 16  [uint]  Pixel Aspect Ratio Numerator&lt;br /&gt;
 16  [uint]  Pixel Aspect Ratio Denominator&lt;br /&gt;
 16  [uint]  Field Rate Numerator&lt;br /&gt;
 16  [uint]  Field Rate Denominator&lt;br /&gt;
 32  [uint]  Field Image Size (in bytes)&lt;br /&gt;
 32  [uint]  Number of extra headers&lt;br /&gt;
 32  [enum]  Colorspace&lt;br /&gt;
 31  [uint]  Reserved&lt;br /&gt;
  1  [flg]   Interlaced&lt;br /&gt;
 32  [enum]  Layout ID&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Discussion:&#039;&#039;&#039;&lt;br /&gt;
* The number of extra headers field counts the number of headers following the comment packet and preceding the data.&lt;br /&gt;
&lt;br /&gt;
==== Layout ID ====&lt;br /&gt;
* The Layout ID field is used to describe the layout of the image buffer in memory. This provides an easy means of selecting amongst common storage methods. If this field is set to zero, a Data Layout Packet MUST be included in the stream, and the contents of that packet should be parsed to determine the image buffer layout. The valid values for this field are:&lt;br /&gt;
   Value      Short Name           Description&lt;br /&gt;
 0x32315659   OGGUVS_FMT_YV12      8-bpp Y plane, followed by 8-bpp 2×2 V and U planes.&lt;br /&gt;
 0x56555949   OGGUVS_FMT_IYUV      8-bpp Y plane, followed by 8-bpp 2×2 U and V planes.&lt;br /&gt;
 0x32595559   OGGUVS_FMT_YUY2      UV downsampled 2:1 horizontally, ordered Y0 U0 Y1 V0&lt;br /&gt;
 0x59565955   OGGUVS_FMT_UYVY      UV downsampled 2:1 horizontally, ordered U0 Y0 V0 Y1&lt;br /&gt;
 0x55595659   OGGUVS_FMT_YVYU      UV downsampled 2:1 horizontally, ordered Y0 V0 Y1 U0&lt;br /&gt;
 0x80808081   OGGUVS_FMT_RGB24DIB  8 bits per component, stored BGR, rows aligned to a&lt;br /&gt;
                                   32 bit boundary, rows stored bottom first.&lt;br /&gt;
 0x80808082   OGGUVS_FMT_RGB32DIB  8 bits per component, stored BGRx (x is don&#039;t care)&lt;br /&gt;
                                   rows stored bottom first.&lt;br /&gt;
 0x80808083   OGGUVS_FMT_ARGBDIB   8 bits per component, stored BGRA, rows stored bottom&lt;br /&gt;
                                   first.&lt;br /&gt;
&lt;br /&gt;
By convention, layouts with a registered fourcc should use that fourcc for this value. Other formats should set the MSB of each byte and use a OggUVS specific value. Layout ID&#039;s with 0xFF as the most significant byte will be considered to be application specific.&lt;br /&gt;
&lt;br /&gt;
==== Colorspace ====&lt;br /&gt;
&lt;br /&gt;
* The Colorspace field is used to identify all colorspaces supported by this format and is defined as follows:&lt;br /&gt;
   Value      Short Name                Description&lt;br /&gt;
 0x00000001   OGGUVS_CSP_UNSPEC_RGB     Unspecified R&#039;G&#039;B&#039;&lt;br /&gt;
 0x00000002   OGGUVS_CSP_UNSPEC_YCBCR   Unspecified Y&#039;CbCr&lt;br /&gt;
 other useful colorspaces could go here.&lt;br /&gt;
&lt;br /&gt;
The unspecified colorspaces are intended to be used only when the actual colorspace used is not known. This situation arises when getting decompressed frames from proprietary codecs, for instance. Applications should make every effort to properly identify the colorspace and use the proper value in this field.&lt;br /&gt;
&lt;br /&gt;
=== Comment Packet ===&lt;br /&gt;
The comment packet MUST be present and MUST be the second packet in the stream.&lt;br /&gt;
&lt;br /&gt;
  Undefined at this time, probably will be whatever Theora uses.&lt;br /&gt;
&lt;br /&gt;
=== Data Layout Packet ===&lt;br /&gt;
The data layout packet MUST be included if the &#039;Layout ID&#039; field in the main header packet is set to zero. The data layout packet SHOULD be included in all streams. If a &#039;Layout ID&#039; field is specified, the data layout packet MUST NOT be modified from it&#039;s standard definition. Application that have a native understanding of the storage format as specified by the &#039;Layout ID&#039; MAY parse the data layout packet, but are not required to.&lt;br /&gt;
&lt;br /&gt;
 32     0x1  Data Layout Header Packet ID&lt;br /&gt;
 16  [uint]  Version Major (breaks backwards compatability to increment)&lt;br /&gt;
 16  [uint]  Version Minor (backwards compatable, ie, more supported format id&#039;s)&lt;br /&gt;
 16  [uint]  Luma Height&lt;br /&gt;
 16  [uint]  Luma Width&lt;br /&gt;
 16  [uint]  Chroma Height&lt;br /&gt;
 16  [uint]  Chroma Width&lt;br /&gt;
 -- Repeat all fields below this point for interlaced storage.&lt;br /&gt;
 32  [uint]  Alpha channel offset&lt;br /&gt;
 32  [uint]  Y/R channel offset&lt;br /&gt;
 32  [uint]  U/G channel offset&lt;br /&gt;
 32  [uint]  V/B channel offset&lt;br /&gt;
 32  [sint]  Alpha Y Stride&lt;br /&gt;
 32  [sint]  Y/R Y Stride&lt;br /&gt;
 32  [sint]  U/G Y Stride&lt;br /&gt;
 32  [sint]  V/B Y Stride&lt;br /&gt;
 32  [sint]  Y/R X Stride&lt;br /&gt;
 32  [sint]  U/G X Stride&lt;br /&gt;
 32  [sint]  V/B X Stride&lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Discussion:&#039;&#039;&#039; &lt;br /&gt;
* This layout packet is for 8 bit per channel formats only.&lt;br /&gt;
* The width and height fields reflect the storage size, not the displayed size, of the field.&lt;br /&gt;
* The offset fields specify the offset, in bytes, from the start of the data packet to the top leftmost sample for the specified channel. &lt;br /&gt;
* The Y stride field indicates the number of bytes to add to the current position to get the corresponding sample one row down. For the alpha channel, this value should be set to zero if the channel is not present. &lt;br /&gt;
* The X stride field indicates the number of bytes to add to the current position to get the corresponding sample one pixel to the right. For the alpha channel, this value should be set to zero if the channel is not present. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation Notes:&#039;&#039;&#039;&lt;br /&gt;
Great care must be exercised when using the layout packet directly. The following are a few checks that should be made to validate the data:&lt;br /&gt;
 For all channels:&lt;br /&gt;
 Width &amp;lt;= abs(Y_Stride)&lt;br /&gt;
 &lt;br /&gt;
 For alpha and luma channels:&lt;br /&gt;
 offset + y_stride*luma_h &amp;gt;= 0&lt;br /&gt;
 offset + y_stride*luma_h &amp;lt;= image size (from main header)&lt;br /&gt;
 &lt;br /&gt;
 For chroma channels:&lt;br /&gt;
 offset + y_stride*chroma_h &amp;gt;= 0&lt;br /&gt;
 offset + y_stride*chroma_h &amp;lt;= image size (from main header)&lt;br /&gt;
&lt;br /&gt;
 More to be added later.&lt;br /&gt;
&lt;br /&gt;
=== Data Packets ===&lt;br /&gt;
 32  &#039;FLD0&#039;     Field 0 (Top) header&lt;br /&gt;
 ..  [data]     Data for whole field&lt;br /&gt;
&lt;br /&gt;
 32  &#039;FLD1&#039;     Field 1 (Bottom) header&lt;br /&gt;
 ..  [data]     Data for whole field&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Discussion:&#039;&#039;&#039;&lt;br /&gt;
The length of the data packet must be exactly equal to the image size specified in the main header plus four bytes for the field header.&lt;br /&gt;
&lt;br /&gt;
== Encapsulation in Ogg ==&lt;br /&gt;
&lt;br /&gt;
A granule is defined as one field.&lt;br /&gt;
&lt;br /&gt;
== Predefined Layout Packets ==&lt;br /&gt;
&lt;br /&gt;
The following packets are defined as the standard layout packets for the various defined formats. For those formats that declare a fourcc, it is illegal to modify the values of the layout packet. The following abbreviations are used in the formulae below:&lt;br /&gt;
&lt;br /&gt;
* disp_h: Display Height, from main header packet&lt;br /&gt;
* disp_w: Display Width, from main header packet&lt;br /&gt;
* l_h: Luma height, from data layout packet&lt;br /&gt;
* l_w: Luma width, from data layout packet&lt;br /&gt;
* c_h: Chroma height, from data layout packet&lt;br /&gt;
* c_w: Chroma width, from data layout packet&lt;br /&gt;
&lt;br /&gt;
=== OGGUVS_FMT_YV12 ===&lt;br /&gt;
* Layout ID: 0x32315659&lt;br /&gt;
 l_h         = (disp_h + 1) &amp;amp; ~1&lt;br /&gt;
 l_w         = (disp_w + 1) &amp;amp; ~1&lt;br /&gt;
 c_h         = l_h / 2&lt;br /&gt;
 c_w         = l_w / 2&lt;br /&gt;
 a_offset    = 0&lt;br /&gt;
 yr_offset   = 0&lt;br /&gt;
 ug_offset   = l_h * l_w + c_h * c_w&lt;br /&gt;
 vb_offset   = l_h * l_w&lt;br /&gt;
 a_y_stride  = 0&lt;br /&gt;
 yr_y_stride = l_w&lt;br /&gt;
 ug_y_stride = c_w&lt;br /&gt;
 vb_y_stride = c_w&lt;br /&gt;
 a_x_stride  = 0&lt;br /&gt;
 yr_x_stride = 1&lt;br /&gt;
 ug_x_stride = 1&lt;br /&gt;
 vb_x_stride = 1&lt;br /&gt;
&lt;br /&gt;
=== OGGUVS_FMT_IYUV ===&lt;br /&gt;
 TODO&lt;br /&gt;
 &lt;br /&gt;
=== OGGUVS_FMT_YUY2 ===&lt;br /&gt;
* Layout ID: 0x32595559&lt;br /&gt;
 l_h         = disp_h&lt;br /&gt;
 l_w         = (disp_w + 1) &amp;amp; ~1&lt;br /&gt;
 c_h         = l_h&lt;br /&gt;
 c_w         = l_w / 2&lt;br /&gt;
 a_offset    = 0&lt;br /&gt;
 yr_offset   = 0&lt;br /&gt;
 ug_offset   = 1&lt;br /&gt;
 vb_offset   = 3&lt;br /&gt;
 a_y_stride  = 0&lt;br /&gt;
 yr_y_stride = l_w * 2&lt;br /&gt;
 ug_y_stride = l_w * 2&lt;br /&gt;
 vb_y_stride = l_w * 2&lt;br /&gt;
 a_x_stride  = 0&lt;br /&gt;
 yr_x_stride = 2&lt;br /&gt;
 ug_x_stride = 4&lt;br /&gt;
 vb_x_stride = 4&lt;br /&gt;
&lt;br /&gt;
=== OGGUVS_FMT_UYVY ===&lt;br /&gt;
 TODO&lt;br /&gt;
 &lt;br /&gt;
=== OGGUVS_FMT_YVYU ===&lt;br /&gt;
 TODO&lt;br /&gt;
 &lt;br /&gt;
=== OGGUVS_FMT_RGB24DIB ===&lt;br /&gt;
* Layout ID: 0x80808081&lt;br /&gt;
 l_h         = disp_h&lt;br /&gt;
 l_w         = disp_w&lt;br /&gt;
 c_h         = disp_h&lt;br /&gt;
 c_w         = disp_w&lt;br /&gt;
 a_offset    = 0&lt;br /&gt;
 yr_offset   = 2 + (disp_h-1) * -yr_y_stride &lt;br /&gt;
 ug_offset   = 1 + (disp_h-1) * -yr_y_stride &lt;br /&gt;
 vb_offset   = 0 + (disp_h-1) * -yr_y_stride &lt;br /&gt;
 a_y_stride  = 0&lt;br /&gt;
 yr_y_stride = -1 * (((disp_w*3)+3) &amp;amp; ~1)&lt;br /&gt;
 ug_y_stride = -1 * (((disp_w*3)+3) &amp;amp; ~1)&lt;br /&gt;
 vb_y_stride = -1 * (((disp_w*3)+3) &amp;amp; ~1)&lt;br /&gt;
 a_x_stride  = 0&lt;br /&gt;
 yr_x_stride = 3&lt;br /&gt;
 ug_x_stride = 3&lt;br /&gt;
 vb_x_stride = 3&lt;br /&gt;
&lt;br /&gt;
=== OGGUVS_FMT_RGB32DIB ===&lt;br /&gt;
 TODO&lt;br /&gt;
 &lt;br /&gt;
=== OGGUVS_FMT_ARGBDIB ===&lt;br /&gt;
 TODO&lt;/div&gt;</summary>
		<author><name>Jkoleszar</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=OggUVS&amp;diff=2084</id>
		<title>OggUVS</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=OggUVS&amp;diff=2084"/>
		<updated>2005-11-15T19:40:18Z</updated>

		<summary type="html">&lt;p&gt;Jkoleszar: Clean up to release for comment&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is it ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;OggUVS&#039;&#039;&#039; is an uncompressed video codec for Ogg.  It&#039;s a simple way to store and transfer uncompressed video within an Ogg container. It is similar to [[OggYUV]] and [[OggRGB]], but is intended to support both formats.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;This is a work in progress and not a final proposal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Why is it ==&lt;br /&gt;
&lt;br /&gt;
This format is intended to be used as an interchange format. It is also useful for storing time-synced decoded audio/video, as opposed to using RIFF/WAV (.wav) and YUV4MPEG (.yuv) in separate files. It is intended to be less complex to use than RIFF/AVI.&lt;br /&gt;
&lt;br /&gt;
== Stream Description ==&lt;br /&gt;
&lt;br /&gt;
A stream is composed of a main header packet, one comment packets, zero or more additional header packets, and one or more data packets. At this time, one additional header packet is specified to describe the data packet layout. This packet SHOULD be present in all streams. Data packets are of fixed length as specified in the main header. A special zero length data packet with the EOS flag set is permitted. Data packets must contain exactly one image. This stream format is field based, rather than frame based. It supports only two fields per frame, and one field per data packet. Packets (fields) must appear in temporal order.&lt;br /&gt;
&lt;br /&gt;
== Packet Layout ==&lt;br /&gt;
&lt;br /&gt;
Note that unless otherwise noted, all multi-byte fields use the network byte order (big endian). The first packed in a stream MUST be the main header packet. The second packet MUST be the comment packet. Some extra header packets MAY be included after the comment header, provided this is identified in the main header. The packets that follow MUST all be data packets. &lt;br /&gt;
&lt;br /&gt;
=== Main Header Packet ===&lt;br /&gt;
The main header packet MUST be the first packet in the stream.&lt;br /&gt;
&lt;br /&gt;
 32  &amp;quot;UVS\0&amp;quot; Codec Identifier Word 0&lt;br /&gt;
 32     0x0  Codec Identifier Word 1&lt;br /&gt;
 16  [uint]  Version Major (breaks backwards compatability to increment)&lt;br /&gt;
 16  [uint]  Version Minor (backwards compatable, ie, more supported format id&#039;s)&lt;br /&gt;
 16  [uint]  Display Width&lt;br /&gt;
 16  [uint]  Display Height&lt;br /&gt;
 16  [uint]  Pixel Aspect Ratio Numerator&lt;br /&gt;
 16  [uint]  Pixel Aspect Ratio Denominator&lt;br /&gt;
 16  [uint]  Field Rate Numerator&lt;br /&gt;
 16  [uint]  Field Rate Denominator&lt;br /&gt;
 32  [uint]  Field Image Size (in bytes)&lt;br /&gt;
 32  [uint]  Number of extra headers&lt;br /&gt;
 32  [enum]  Colorspace&lt;br /&gt;
 31  [uint]  Reserved&lt;br /&gt;
  1  [flg]   Interlaced&lt;br /&gt;
 32  [enum]  Layout ID&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Discussion:&#039;&#039;&#039;&lt;br /&gt;
* The number of extra headers field counts the number of headers following the comment packet and preceding the data.&lt;br /&gt;
&lt;br /&gt;
==== Layout ID ====&lt;br /&gt;
* The Layout ID field is used to describe the layout of the image buffer in memory. This provides an easy means of selecting amongst common storage methods. If this field is set to zero, a Data Layout Packet MUST be included in the stream, and the contents of that packet should be parsed to determine the image buffer layout. The valid values for this field are:&lt;br /&gt;
   Value      Short Name           Description&lt;br /&gt;
 0x31313259   OGGUVS_FMT_YV12      8-bpp Y plane, followed by 8-bpp 2×2 V and U planes.&lt;br /&gt;
 0x56555949   OGGUVS_FMT_IYUV      8-bpp Y plane, followed by 8-bpp 2×2 U and V planes.&lt;br /&gt;
 0x32595559   OGGUVS_FMT_YUY2      UV downsampled 2:1 horizontally, ordered Y0 U0 Y1 V0&lt;br /&gt;
 0x59565955   OGGUVS_FMT_UYVY      UV downsampled 2:1 horizontally, ordered U0 Y0 V0 Y1&lt;br /&gt;
 0x55595659   OGGUVS_FMT_YVYU      UV downsampled 2:1 horizontally, ordered Y0 V0 Y1 U0&lt;br /&gt;
 0x80808081   OGGUVS_FMT_RGB24DIB  8 bits per component, stored BGR, rows aligned to a&lt;br /&gt;
                                   32 bit boundary, rows stored bottom first.&lt;br /&gt;
 0x80808082   OGGUVS_FMT_RGB32DIB  8 bits per component, stored BGRx (x is don&#039;t care)&lt;br /&gt;
                                   rows stored bottom first.&lt;br /&gt;
 0x80808083   OGGUVS_FMT_ARGBDIB   8 bits per component, stored BGRA, rows stored bottom&lt;br /&gt;
                                   first.&lt;br /&gt;
&lt;br /&gt;
By convention, layouts with a registered fourcc should use that fourcc for this value. Other formats should set the MSB of each byte and use a OggUVS specific value. Layout ID&#039;s with 0xFF as the most significant byte will be considered to be application specific.&lt;br /&gt;
&lt;br /&gt;
==== Colorspace ====&lt;br /&gt;
&lt;br /&gt;
* The Colorspace field is used to identify all colorspaces supported by this format and is defined as follows:&lt;br /&gt;
   Value      Short Name                Description&lt;br /&gt;
 0x00000001   OGGUVS_CSP_UNSPEC_RGB     Unspecified R&#039;G&#039;B&#039;&lt;br /&gt;
 0x00000002   OGGUVS_CSP_UNSPEC_YCBCR   Unspecified Y&#039;CbCr&lt;br /&gt;
 other useful colorspaces could go here.&lt;br /&gt;
&lt;br /&gt;
The unspecified colorspaces are intended to be used only when the actual colorspace used is not known. This situation arises when getting decompressed frames from proprietary codecs, for instance. Applications should make every effort to properly identify the colorspace and use the proper value in this field.&lt;br /&gt;
&lt;br /&gt;
=== Comment Packet ===&lt;br /&gt;
The comment packet MUST be present and MUST be the second packet in the stream.&lt;br /&gt;
&lt;br /&gt;
  Undefined at this time, probably will be whatever Theora uses.&lt;br /&gt;
&lt;br /&gt;
=== Data Layout Packet ===&lt;br /&gt;
The data layout packet MUST be included if the &#039;Layout ID&#039; field in the main header packet is set to zero. The data layout packet SHOULD be included in all streams. If a &#039;Layout ID&#039; field is specified, the data layout packet MUST NOT be modified from it&#039;s standard definition. Application that have a native understanding of the storage format as specified by the &#039;Layout ID&#039; MAY parse the data layout packet, but are not required to.&lt;br /&gt;
&lt;br /&gt;
 32     0x1  Data Layout Header Packet ID&lt;br /&gt;
 16  [uint]  Version Major (breaks backwards compatability to increment)&lt;br /&gt;
 16  [uint]  Version Minor (backwards compatable, ie, more supported format id&#039;s)&lt;br /&gt;
 16  [uint]  Luma Height&lt;br /&gt;
 16  [uint]  Luma Width&lt;br /&gt;
 16  [uint]  Chroma Height&lt;br /&gt;
 16  [uint]  Chroma Width&lt;br /&gt;
 -- Repeat all fields below this point for interlaced storage.&lt;br /&gt;
 32  [uint]  Alpha channel offset&lt;br /&gt;
 32  [uint]  Y/R channel offset&lt;br /&gt;
 32  [uint]  U/G channel offset&lt;br /&gt;
 32  [uint]  V/B channel offset&lt;br /&gt;
 32  [sint]  Alpha Y Stride&lt;br /&gt;
 32  [sint]  Y/R Y Stride&lt;br /&gt;
 32  [sint]  U/G Y Stride&lt;br /&gt;
 32  [sint]  V/B Y Stride&lt;br /&gt;
 32  [sint]  Y/R X Stride&lt;br /&gt;
 32  [sint]  U/G X Stride&lt;br /&gt;
 32  [sint]  V/B X Stride&lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Discussion:&#039;&#039;&#039; &lt;br /&gt;
* This layout packet is for 8 bit per channel formats only.&lt;br /&gt;
* The width and height fields reflect the storage size, not the displayed size, of the field.&lt;br /&gt;
* The offset fields specify the offset, in bytes, from the start of the data packet to the top leftmost sample for the specified channel. &lt;br /&gt;
* The Y stride field indicates the number of bytes to add to the current position to get the corresponding sample one row down. For the alpha channel, this value should be set to zero if the channel is not present. &lt;br /&gt;
* The X stride field indicates the number of bytes to add to the current position to get the corresponding sample one pixel to the right. For the alpha channel, this value should be set to zero if the channel is not present. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Implementation Notes:&#039;&#039;&#039;&lt;br /&gt;
Great care must be exercised when using the layout packet directly. The following are a few checks that should be made to validate the data:&lt;br /&gt;
 For all channels:&lt;br /&gt;
 Width &amp;lt;= abs(Y_Stride)&lt;br /&gt;
 &lt;br /&gt;
 For alpha and luma channels:&lt;br /&gt;
 offset + y_stride*luma_h &amp;gt;= 0&lt;br /&gt;
 offset + y_stride*luma_h &amp;lt;= image size (from main header)&lt;br /&gt;
 &lt;br /&gt;
 For chroma channels:&lt;br /&gt;
 offset + y_stride*chroma_h &amp;gt;= 0&lt;br /&gt;
 offset + y_stride*chroma_h &amp;lt;= image size (from main header)&lt;br /&gt;
&lt;br /&gt;
 More to be added later.&lt;br /&gt;
&lt;br /&gt;
=== Data Packets ===&lt;br /&gt;
 32  &#039;FLD0&#039;     Field 0 (Top) header&lt;br /&gt;
 ..  [data]     Data for whole field&lt;br /&gt;
&lt;br /&gt;
 32  &#039;FLD1&#039;     Field 1 (Bottom) header&lt;br /&gt;
 ..  [data]     Data for whole field&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Discussion:&#039;&#039;&#039;&lt;br /&gt;
The length of the data packet must be exactly equal to the image size specified in the main header plus four bytes for the field header.&lt;br /&gt;
&lt;br /&gt;
== Encapsulation in Ogg ==&lt;br /&gt;
&lt;br /&gt;
A granule is defined as one field.&lt;br /&gt;
&lt;br /&gt;
== Predefined Layout Packets ==&lt;br /&gt;
&lt;br /&gt;
The following packets are defined as the standard layout packets for the various defined formats. For those formats that declare a fourcc, it is illegal to modify the values of the layout packet. The following abbreviations are used in the formulae below:&lt;br /&gt;
&lt;br /&gt;
* disp_h: Display Height, from main header packet&lt;br /&gt;
* disp_w: Display Width, from main header packet&lt;br /&gt;
* l_h: Luma height, from data layout packet&lt;br /&gt;
* l_w: Luma width, from data layout packet&lt;br /&gt;
* c_h: Chroma height, from data layout packet&lt;br /&gt;
* c_w: Chroma width, from data layout packet&lt;br /&gt;
&lt;br /&gt;
=== OGGUVS_FMT_YV12 ===&lt;br /&gt;
* Layout ID: 0x32315659&lt;br /&gt;
 l_h         = (disp_h + 1) &amp;amp; ~1&lt;br /&gt;
 l_w         = (disp_w + 1) &amp;amp; ~1&lt;br /&gt;
 c_h         = l_h / 2&lt;br /&gt;
 c_w         = l_w / 2&lt;br /&gt;
 a_offset    = 0&lt;br /&gt;
 yr_offset   = 0&lt;br /&gt;
 ug_offset   = l_h * l_w + c_h * c_w&lt;br /&gt;
 vb_offset   = l_h * l_w&lt;br /&gt;
 a_y_stride  = 0&lt;br /&gt;
 yr_y_stride = l_w&lt;br /&gt;
 ug_y_stride = c_w&lt;br /&gt;
 vb_y_stride = c_w&lt;br /&gt;
 a_x_stride  = 0&lt;br /&gt;
 yr_x_stride = 1&lt;br /&gt;
 ug_x_stride = 1&lt;br /&gt;
 vb_x_stride = 1&lt;br /&gt;
&lt;br /&gt;
=== OGGUVS_FMT_IYUV ===&lt;br /&gt;
 TODO&lt;br /&gt;
 &lt;br /&gt;
=== OGGUVS_FMT_YUY2 ===&lt;br /&gt;
* Layout ID: 0x32595559&lt;br /&gt;
 l_h         = disp_h&lt;br /&gt;
 l_w         = (disp_w + 1) &amp;amp; ~1&lt;br /&gt;
 c_h         = l_h&lt;br /&gt;
 c_w         = l_w / 2&lt;br /&gt;
 a_offset    = 0&lt;br /&gt;
 yr_offset   = 0&lt;br /&gt;
 ug_offset   = 1&lt;br /&gt;
 vb_offset   = 3&lt;br /&gt;
 a_y_stride  = 0&lt;br /&gt;
 yr_y_stride = l_w * 2&lt;br /&gt;
 ug_y_stride = l_w * 2&lt;br /&gt;
 vb_y_stride = l_w * 2&lt;br /&gt;
 a_x_stride  = 0&lt;br /&gt;
 yr_x_stride = 2&lt;br /&gt;
 ug_x_stride = 4&lt;br /&gt;
 vb_x_stride = 4&lt;br /&gt;
&lt;br /&gt;
=== OGGUVS_FMT_UYVY ===&lt;br /&gt;
 TODO&lt;br /&gt;
 &lt;br /&gt;
=== OGGUVS_FMT_YVYU ===&lt;br /&gt;
 TODO&lt;br /&gt;
 &lt;br /&gt;
=== OGGUVS_FMT_RGB24DIB ===&lt;br /&gt;
* Layout ID: 0x80808081&lt;br /&gt;
 l_h         = disp_h&lt;br /&gt;
 l_w         = disp_w&lt;br /&gt;
 c_h         = disp_h&lt;br /&gt;
 c_w         = disp_w&lt;br /&gt;
 a_offset    = 0&lt;br /&gt;
 yr_offset   = 2 + (disp_h-1) * -yr_y_stride &lt;br /&gt;
 ug_offset   = 1 + (disp_h-1) * -yr_y_stride &lt;br /&gt;
 vb_offset   = 0 + (disp_h-1) * -yr_y_stride &lt;br /&gt;
 a_y_stride  = 0&lt;br /&gt;
 yr_y_stride = -1 * (((disp_w*3)+3) &amp;amp; ~1)&lt;br /&gt;
 ug_y_stride = -1 * (((disp_w*3)+3) &amp;amp; ~1)&lt;br /&gt;
 vb_y_stride = -1 * (((disp_w*3)+3) &amp;amp; ~1)&lt;br /&gt;
 a_x_stride  = 0&lt;br /&gt;
 yr_x_stride = 3&lt;br /&gt;
 ug_x_stride = 3&lt;br /&gt;
 vb_x_stride = 3&lt;br /&gt;
&lt;br /&gt;
=== OGGUVS_FMT_RGB32DIB ===&lt;br /&gt;
 TODO&lt;br /&gt;
 &lt;br /&gt;
=== OGGUVS_FMT_ARGBDIB ===&lt;br /&gt;
 TODO&lt;/div&gt;</summary>
		<author><name>Jkoleszar</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=OggUVS&amp;diff=2082</id>
		<title>OggUVS</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=OggUVS&amp;diff=2082"/>
		<updated>2005-11-15T17:30:13Z</updated>

		<summary type="html">&lt;p&gt;Jkoleszar: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is it ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;OggUVS&#039;&#039;&#039; is an uncompressed video codec for Ogg.  It&#039;s a simple way to store and transfer uncompressed video within an Ogg container. It is similar to [[OggYUV]] and [[OggRGB]], but is intended to support both formats.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;This is a work in progress and not a final proposal.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Packet Layout ==&lt;br /&gt;
&lt;br /&gt;
Note that unless otherwise noted, all multi-byte fields use the network byte order (big endian). The first packed in a stream MUST be the main header packet. The second packet MUST be the comment packet. Some extra header packets MAY be included after the comment header, provided this is identified in the main header. The packets that follow MUST all be data packets. &lt;br /&gt;
&lt;br /&gt;
This stream format is field based, rather than frame based. It supports only two fields per frame, and one field per data packet. Fields are stored in temporal order, so granulepos maintains its temporal significance. &lt;br /&gt;
&lt;br /&gt;
=== Main Header Packet ===&lt;br /&gt;
 32  &amp;quot;UVS\0&amp;quot; Codec Identifier Word 0&lt;br /&gt;
 32     0x0  Codec Identifier Word 1&lt;br /&gt;
 16  [uint]  Version Major (breaks backwards compatability to increment)&lt;br /&gt;
 16  [uint]  Version Minor (backwards compatable, ie, more supported format id&#039;s)&lt;br /&gt;
 16  [uint]  Display Width&lt;br /&gt;
 16  [uint]  Display Height&lt;br /&gt;
 16  [uint]  Pixel Aspect Ratio Numerator&lt;br /&gt;
 16  [uint]  Pixel Aspect Ratio Denominator&lt;br /&gt;
 16  [uint]  Field Rate Numerator&lt;br /&gt;
 16  [uint]  Field Rate Denominator&lt;br /&gt;
 32  [uint]  Maximum Size Per Frame&lt;br /&gt;
 32  [uint]  Number of extra headers&lt;br /&gt;
 32  [enum]  Colorspace&lt;br /&gt;
 31  [uint]  Reserved&lt;br /&gt;
  1  [flg]   Interlaced&lt;br /&gt;
 32  [enum]  Layout ID&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Discussion:&#039;&#039;&#039;&lt;br /&gt;
* The Layout ID field is used to describe the layout of the image buffer in memory. This provides an easy means of selecting amongst common formats. If this field is set to zero, a Data Layout Packet MUST be included in the stream, and the contents of that packet should be parsed to determine the image buffer layout. The valid values for this field are:&lt;br /&gt;
   Value      Short Name          Description&lt;br /&gt;
 0x31313259   OGGUVS_FMT_YV12     8-bpp Y plane, followed by 8-bpp 2×2 V and U planes.&lt;br /&gt;
 fill in more later.&lt;br /&gt;
&lt;br /&gt;
* The Colorspace field is used to identify all colorspaces supported by this format and is defined as follows:&lt;br /&gt;
   Value      Short Name                Description&lt;br /&gt;
 0x00000001   OGGUVS_CSP_UNSPEC_RGB     Unspecified R&#039;G&#039;B&#039;&lt;br /&gt;
 0x00000002   OGGUVS_CSP_UNSPEC_YCBCR   Unspecified Y&#039;CbCr&lt;br /&gt;
&lt;br /&gt;
=== Comment Packet ===&lt;br /&gt;
Undefined at this time, probably will be whatever Theora uses.&lt;br /&gt;
&lt;br /&gt;
=== Data Layout Packet ===&lt;br /&gt;
 32     0x1  Data Layout Header Packet ID&lt;br /&gt;
 16  [uint]  Version Major (breaks backwards compatability to increment)&lt;br /&gt;
 16  [uint]  Version Minor (backwards compatable, ie, more supported format id&#039;s)&lt;br /&gt;
 16  [uint]  Luma Height&lt;br /&gt;
 16  [uint]  Luma Width&lt;br /&gt;
 16  [uint]  Chroma Height&lt;br /&gt;
 16  [uint]  Chroma Width&lt;br /&gt;
 -- Repeat all fields below this point for interlaced storage.&lt;br /&gt;
 32  [uint]  Alpha channel offset&lt;br /&gt;
 32  [uint]  Y/R channel offset&lt;br /&gt;
 32  [uint]  U/G channel offset&lt;br /&gt;
 32  [uint]  V/B channel offset&lt;br /&gt;
 32  [sint]  Alpha Y Stride&lt;br /&gt;
 32  [sint]  Y/R Y Stride&lt;br /&gt;
 32  [sint]  U/G Y Stride&lt;br /&gt;
 32  [sint]  V/B Y Stride&lt;br /&gt;
 32  [sint]  Y/R X Stride&lt;br /&gt;
 32  [sint]  U/G X Stride&lt;br /&gt;
 32  [sint]  V/B X Stride&lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Discussion:&#039;&#039;&#039; &lt;br /&gt;
* This layout packet is for 8 bit per channel formats only.&lt;br /&gt;
* The width and height fields reflect the storage size of the field.&lt;br /&gt;
* The offset fields specify the offset, in bytes, from the start of the data packet to the top leftmost sample for the specified channel. &lt;br /&gt;
* The Y stride field indicates the number of bytes to add to the current position to get the corresponding sample one row down. For the alpha channel, this value should be set to zero if the channel is not present. &lt;br /&gt;
* The X stride field indicates the number of bytes to add to the current position to get the corresponding sample one pixel to the right. For the alpha channel, this value should be set to zero if the channel is not present. &lt;br /&gt;
&lt;br /&gt;
=== Data Packets ===&lt;br /&gt;
 ..  [data]     Data for whole field&lt;br /&gt;
&lt;br /&gt;
== Supported Formats ==&lt;br /&gt;
&lt;br /&gt;
The following packets are defined as the standard layout packets for the various defined formats. For those formats that declare a fourcc, it is illegal to modify the values of the layout packet. The following abbreviations are used in the formulae below:&lt;br /&gt;
* disp_h: Display Height, from main header packet&lt;br /&gt;
* disp_w: Display Width, from main header packet&lt;br /&gt;
* l_h: Luma height, from data layout packet&lt;br /&gt;
* l_w: Luma width, from data layout packet&lt;br /&gt;
* c_h: Chroma height, from data layout packet&lt;br /&gt;
* c_w: Chroma width, from data layout packet&lt;br /&gt;
&lt;br /&gt;
=== YV12 ===&lt;br /&gt;
* FourCC: 0x32315659&lt;br /&gt;
* Interlaced: Not supported.&lt;br /&gt;
 l_h         = (disp_h + 1) &amp;amp; ~1&lt;br /&gt;
 l_w         = (disp_w + 1) &amp;amp; ~1&lt;br /&gt;
 c_h         = l_h / 2&lt;br /&gt;
 c_w         = l_w / 2&lt;br /&gt;
 a_offset    = 0&lt;br /&gt;
 yr_offset   = 0&lt;br /&gt;
 ug_offset   = l_h * l_w + c_h * c_w&lt;br /&gt;
 vb_offset   = l_h * l_w&lt;br /&gt;
 a_y_stride  = 0&lt;br /&gt;
 yr_y_stride = l_w&lt;br /&gt;
 ug_y_stride = c_w&lt;br /&gt;
 vb_y_stride = c_w&lt;br /&gt;
 a_x_stride  = 0&lt;br /&gt;
 yr_x_stride = 1&lt;br /&gt;
 ug_x_stride = 1&lt;br /&gt;
 vb_x_stride = 1&lt;br /&gt;
 &lt;br /&gt;
=== YUY2 ===&lt;br /&gt;
* FourCC: 0x32595559&lt;br /&gt;
* Interlaced: Not supported.&lt;br /&gt;
 l_h         = disp_h&lt;br /&gt;
 l_w         = (disp_w + 1) &amp;amp; ~1&lt;br /&gt;
 c_h         = l_h&lt;br /&gt;
 c_w         = l_w / 2&lt;br /&gt;
 a_offset    = 0&lt;br /&gt;
 yr_offset   = 0&lt;br /&gt;
 ug_offset   = 1&lt;br /&gt;
 vb_offset   = 3&lt;br /&gt;
 a_y_stride  = 0&lt;br /&gt;
 yr_y_stride = l_w * 2&lt;br /&gt;
 ug_y_stride = l_w * 2&lt;br /&gt;
 vb_y_stride = l_w * 2&lt;br /&gt;
 a_x_stride  = 0&lt;br /&gt;
 yr_x_stride = 2&lt;br /&gt;
 ug_x_stride = 4&lt;br /&gt;
 vb_x_stride = 4&lt;br /&gt;
&lt;br /&gt;
=== RGB24 DIB (bottom up, rows aligned to 32 bits) ===&lt;br /&gt;
* FourCC: 0x0000&lt;br /&gt;
* Interlaced: Not supported.&lt;br /&gt;
 l_h         = disp_h&lt;br /&gt;
 l_w         = disp_w&lt;br /&gt;
 c_h         = disp_h&lt;br /&gt;
 c_w         = disp_w&lt;br /&gt;
 a_offset    = 0&lt;br /&gt;
 yr_offset   = 2 + (disp_h-1) * -yr_y_stride &lt;br /&gt;
 ug_offset   = 1 + (disp_h-1) * -yr_y_stride &lt;br /&gt;
 vb_offset   = 0 + (disp_h-1) * -yr_y_stride &lt;br /&gt;
 a_y_stride  = 0&lt;br /&gt;
 yr_y_stride = -1 * (((disp_w*3)+3) &amp;amp; ~1)&lt;br /&gt;
 ug_y_stride = -1 * (((disp_w*3)+3) &amp;amp; ~1)&lt;br /&gt;
 vb_y_stride = -1 * (((disp_w*3)+3) &amp;amp; ~1)&lt;br /&gt;
 a_x_stride  = 0&lt;br /&gt;
 yr_x_stride = 3&lt;br /&gt;
 ug_x_stride = 3&lt;br /&gt;
 vb_x_stride = 3&lt;/div&gt;</summary>
		<author><name>Jkoleszar</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=OggUVS&amp;diff=2080</id>
		<title>OggUVS</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=OggUVS&amp;diff=2080"/>
		<updated>2005-11-14T21:17:06Z</updated>

		<summary type="html">&lt;p&gt;Jkoleszar: /* Main Header Packet */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is it ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;OggUVS&#039;&#039;&#039; is an uncompressed video codec for Ogg.  It&#039;s a simple way to store and transfer uncompressed video within an Ogg container. It is similar to [[OggYUV]] and [[OggRGB]], but is intended to support both formats.&lt;br /&gt;
&lt;br /&gt;
This is a work in progress and not a final proposal.&lt;br /&gt;
&lt;br /&gt;
== Packet Layout ==&lt;br /&gt;
&lt;br /&gt;
Note that unless otherwise noted, all multi-byte fields use the network byte order (big endian). The first packed in a stream MUST be the main header packet. The second packet MUST be the comment packet. Some extra header packets MAY be included after the comment header, provided this is identified in the main header. The packets that follow MUST all be data packets. &lt;br /&gt;
&lt;br /&gt;
This stream format is field based, rather than frame based. It supports only two fields per frame, and one field per data packet. Fields are stored in temporal order, so granulepos maintains its temporal significance. Fields are always encoded in alternating order, starting with the field containing the topmost line.&lt;br /&gt;
&lt;br /&gt;
=== Main Header Packet ===&lt;br /&gt;
 32  &amp;quot;UVS\0&amp;quot; Codec Identifier Word 0&lt;br /&gt;
 32     0x0  Codec Identifier Word 1&lt;br /&gt;
 16  [uint]  Version Major (breaks backwards compatability to increment)&lt;br /&gt;
 16  [uint]  Version Minor (backwards compatable, ie, more supported format id&#039;s)&lt;br /&gt;
 16  [uint]  Display Width&lt;br /&gt;
 16  [uint]  Display Height&lt;br /&gt;
 16  [uint]  Pixel Aspect Ratio Numerator&lt;br /&gt;
 16  [uint]  Pixel Aspect Ratio Denominator&lt;br /&gt;
 16  [uint]  Field Rate Numerator&lt;br /&gt;
 16  [uint]  Field Rate Denominator&lt;br /&gt;
 32  [uint]  Maximum Size Per Frame&lt;br /&gt;
 32  [uint]  Number of extra headers&lt;br /&gt;
 32  [enum]  Colorspace&lt;br /&gt;
 31  [uint]  Reserved&lt;br /&gt;
  1  [flg]   Interlaced&lt;br /&gt;
 32  [enum]  FourCC (set to zero if unknown or N/A)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Discussion:&#039;&#039;&#039;&lt;br /&gt;
* The FourCC field is used to specify a series of predefined packets describing the data layout. Applications should include the predefined packets in the stream as well, preferably by asking a helper library to fill them in. Applications should only use fourcc codes for formats that have corresponding layout packets defined.&lt;br /&gt;
* The Colorspace field is used to identify all colorspaces supported by this format and is defined as follows:&lt;br /&gt;
 Colorspace   Description&lt;br /&gt;
 0x00000001   R&#039;G&#039;B&#039;&lt;br /&gt;
 0x00000002   Y&#039;CbCr Rec 601&lt;br /&gt;
&lt;br /&gt;
=== Comment Packet ===&lt;br /&gt;
Undefined at this time, probably will be whatever Theora uses.&lt;br /&gt;
&lt;br /&gt;
=== Data Layout Packet ===&lt;br /&gt;
 32     0x1  Data Layout Header Packet ID&lt;br /&gt;
 16  [uint]  Version Major (breaks backwards compatability to increment)&lt;br /&gt;
 16  [uint]  Version Minor (backwards compatable, ie, more supported format id&#039;s)&lt;br /&gt;
 16  [uint]  Luma Height&lt;br /&gt;
 16  [uint]  Luma Width&lt;br /&gt;
 16  [uint]  Chroma Height&lt;br /&gt;
 16  [uint]  Chroma Width&lt;br /&gt;
 -- Repeat all fields below this point for interlaced storage.&lt;br /&gt;
 32  [uint]  Alpha channel offset&lt;br /&gt;
 32  [uint]  Y/R channel offset&lt;br /&gt;
 32  [uint]  U/G channel offset&lt;br /&gt;
 32  [uint]  V/B channel offset&lt;br /&gt;
 32  [sint]  Alpha Y Stride&lt;br /&gt;
 32  [sint]  Y/R Y Stride&lt;br /&gt;
 32  [sint]  U/G Y Stride&lt;br /&gt;
 32  [sint]  V/B Y Stride&lt;br /&gt;
 32  [sint]  Y/R X Stride&lt;br /&gt;
 32  [sint]  U/G X Stride&lt;br /&gt;
 32  [sint]  V/B X Stride&lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Discussion:&#039;&#039;&#039; &lt;br /&gt;
* This layout packet is for 8 bit per channel formats only.&lt;br /&gt;
* The width and height fields reflect the storage size of the field.&lt;br /&gt;
* The offset fields specify the offset, in bytes, from the start of the data packet to the top leftmost sample for the specified channel. &lt;br /&gt;
* The Y stride field indicates the number of bytes to add to the current position to get the corresponding sample one row down. For the alpha channel, this value should be set to zero if the channel is not present. &lt;br /&gt;
* The X stride field indicates the number of bytes to add to the current position to get the corresponding sample one pixel to the right. For the alpha channel, this value should be set to zero if the channel is not present. &lt;br /&gt;
&lt;br /&gt;
=== Data Packets ===&lt;br /&gt;
 ..  [data]     Data for whole field&lt;br /&gt;
&lt;br /&gt;
== Supported Formats ==&lt;br /&gt;
&lt;br /&gt;
The following packets are defined as the standard layout packets for the various defined formats. For those formats that declare a fourcc, it is illegal to modify the values of the layout packet. The following abbreviations are used in the formulae below:&lt;br /&gt;
* disp_h: Display Height, from main header packet&lt;br /&gt;
* disp_w: Display Width, from main header packet&lt;br /&gt;
* l_h: Luma height, from data layout packet&lt;br /&gt;
* l_w: Luma width, from data layout packet&lt;br /&gt;
* c_h: Chroma height, from data layout packet&lt;br /&gt;
* c_w: Chroma width, from data layout packet&lt;br /&gt;
&lt;br /&gt;
=== YV12 ===&lt;br /&gt;
* FourCC: 0x32315659&lt;br /&gt;
* Interlaced: Not supported.&lt;br /&gt;
 l_h         = (disp_h + 1) &amp;amp; ~1&lt;br /&gt;
 l_w         = (disp_w + 1) &amp;amp; ~1&lt;br /&gt;
 c_h         = l_h / 2&lt;br /&gt;
 c_w         = l_w / 2&lt;br /&gt;
 a_offset    = 0&lt;br /&gt;
 yr_offset   = 0&lt;br /&gt;
 ug_offset   = l_h * l_w + c_h * c_w&lt;br /&gt;
 vb_offset   = l_h * l_w&lt;br /&gt;
 a_y_stride  = 0&lt;br /&gt;
 yr_y_stride = l_w&lt;br /&gt;
 ug_y_stride = c_w&lt;br /&gt;
 vb_y_stride = c_w&lt;br /&gt;
 a_x_stride  = 0&lt;br /&gt;
 yr_x_stride = 1&lt;br /&gt;
 ug_x_stride = 1&lt;br /&gt;
 vb_x_stride = 1&lt;br /&gt;
 &lt;br /&gt;
=== YUY2 ===&lt;br /&gt;
* FourCC: 0x32595559&lt;br /&gt;
* Interlaced: Not supported.&lt;br /&gt;
 l_h         = disp_h&lt;br /&gt;
 l_w         = (disp_w + 1) &amp;amp; ~1&lt;br /&gt;
 c_h         = l_h&lt;br /&gt;
 c_w         = l_w / 2&lt;br /&gt;
 a_offset    = 0&lt;br /&gt;
 yr_offset   = 0&lt;br /&gt;
 ug_offset   = 1&lt;br /&gt;
 vb_offset   = 3&lt;br /&gt;
 a_y_stride  = 0&lt;br /&gt;
 yr_y_stride = l_w * 2&lt;br /&gt;
 ug_y_stride = l_w * 2&lt;br /&gt;
 vb_y_stride = l_w * 2&lt;br /&gt;
 a_x_stride  = 0&lt;br /&gt;
 yr_x_stride = 2&lt;br /&gt;
 ug_x_stride = 4&lt;br /&gt;
 vb_x_stride = 4&lt;br /&gt;
&lt;br /&gt;
=== RGB24 DIB (bottom up, rows aligned to 32 bits) ===&lt;br /&gt;
* FourCC: 0x0000&lt;br /&gt;
* Interlaced: Not supported.&lt;br /&gt;
 l_h         = disp_h&lt;br /&gt;
 l_w         = disp_w&lt;br /&gt;
 c_h         = disp_h&lt;br /&gt;
 c_w         = disp_w&lt;br /&gt;
 a_offset    = 0&lt;br /&gt;
 yr_offset   = 2 + (disp_h-1) * -yr_y_stride &lt;br /&gt;
 ug_offset   = 1 + (disp_h-1) * -yr_y_stride &lt;br /&gt;
 vb_offset   = 0 + (disp_h-1) * -yr_y_stride &lt;br /&gt;
 a_y_stride  = 0&lt;br /&gt;
 yr_y_stride = -1 * (((disp_w*3)+3) &amp;amp; ~1)&lt;br /&gt;
 ug_y_stride = -1 * (((disp_w*3)+3) &amp;amp; ~1)&lt;br /&gt;
 vb_y_stride = -1 * (((disp_w*3)+3) &amp;amp; ~1)&lt;br /&gt;
 a_x_stride  = 0&lt;br /&gt;
 yr_x_stride = 3&lt;br /&gt;
 ug_x_stride = 3&lt;br /&gt;
 vb_x_stride = 3&lt;/div&gt;</summary>
		<author><name>Jkoleszar</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=OggUVS&amp;diff=2066</id>
		<title>OggUVS</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=OggUVS&amp;diff=2066"/>
		<updated>2005-11-14T18:09:21Z</updated>

		<summary type="html">&lt;p&gt;Jkoleszar: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is it ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;OggUVS&#039;&#039;&#039; is an uncompressed video codec for Ogg.  It&#039;s a simple way to store and transfer uncompressed video within an Ogg container. It is similar to [[OggYUV]] and [[OggRGB]], but is intended to support both formats.&lt;br /&gt;
&lt;br /&gt;
This is a work in progress and not a final proposal.&lt;br /&gt;
&lt;br /&gt;
== Packet Layout ==&lt;br /&gt;
&lt;br /&gt;
Note that unless otherwise noted, all multi-byte fields use the network byte order (big endian). The first packed in a stream MUST be the main header packet. The second packet MUST be the comment packet. Some extra header packets MAY be included after the comment header, provided this is identified in the main header. The packets that follow MUST all be data packets. &lt;br /&gt;
&lt;br /&gt;
This stream format is field based, rather than frame based. It supports only two fields per frame, and one field per data packet. Fields are stored in temporal order, so granulepos maintains its temporal significance. Fields are always encoded in alternating order, starting with the field containing the topmost line.&lt;br /&gt;
&lt;br /&gt;
=== Main Header Packet ===&lt;br /&gt;
 32  &amp;quot;UVS\0&amp;quot; Codec Identifier Word 0&lt;br /&gt;
 32     0x0  Codec Identifier Word 1&lt;br /&gt;
 16  [uint]  Version Major (breaks backwards compatability to increment)&lt;br /&gt;
 16  [uint]  Version Minor (backwards compatable, ie, more supported format id&#039;s)&lt;br /&gt;
 16  [uint]  Display Width&lt;br /&gt;
 16  [uint]  Display Height&lt;br /&gt;
 16  [uint]  Pixel Aspect Ratio Numerator&lt;br /&gt;
 16  [uint]  Pixel Aspect Ratio Denominator&lt;br /&gt;
 16  [uint]  Field Rate Numerator&lt;br /&gt;
 16  [uint]  Field Rate Denominator&lt;br /&gt;
 32  [uint]  Maximum Size Per Frame&lt;br /&gt;
 32  [uint]  Number of extra headers&lt;br /&gt;
 32  [enum]  Colorspace&lt;br /&gt;
 31  [uint]  Reserved&lt;br /&gt;
  1  [flg]   Interlaced&lt;br /&gt;
 32  [enum]  FourCC (set to zero if unknown or N/A)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Discussion:&#039;&#039;&#039;&lt;br /&gt;
* The FourCC field is used to specify a series of predefined packets describing the data layout. Applications should include the predefined packets in the stream as well, preferably by asking a helper library to fill them in. Applications should only use fourcc codes for formats that have corresponding layout packets defined.&lt;br /&gt;
&lt;br /&gt;
=== Comment Packet ===&lt;br /&gt;
Undefined at this time, probably will be whatever Theora uses.&lt;br /&gt;
&lt;br /&gt;
=== Data Layout Packet ===&lt;br /&gt;
 32     0x1  Data Layout Header Packet ID&lt;br /&gt;
 16  [uint]  Version Major (breaks backwards compatability to increment)&lt;br /&gt;
 16  [uint]  Version Minor (backwards compatable, ie, more supported format id&#039;s)&lt;br /&gt;
 16  [uint]  Luma Height&lt;br /&gt;
 16  [uint]  Luma Width&lt;br /&gt;
 16  [uint]  Chroma Height&lt;br /&gt;
 16  [uint]  Chroma Width&lt;br /&gt;
 -- Repeat all fields below this point for interlaced storage.&lt;br /&gt;
 32  [uint]  Alpha channel offset&lt;br /&gt;
 32  [uint]  Y/R channel offset&lt;br /&gt;
 32  [uint]  U/G channel offset&lt;br /&gt;
 32  [uint]  V/B channel offset&lt;br /&gt;
 32  [sint]  Alpha Y Stride&lt;br /&gt;
 32  [sint]  Y/R Y Stride&lt;br /&gt;
 32  [sint]  U/G Y Stride&lt;br /&gt;
 32  [sint]  V/B Y Stride&lt;br /&gt;
 32  [sint]  Y/R X Stride&lt;br /&gt;
 32  [sint]  U/G X Stride&lt;br /&gt;
 32  [sint]  V/B X Stride&lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Discussion:&#039;&#039;&#039; &lt;br /&gt;
* This layout packet is for 8 bit per channel formats only.&lt;br /&gt;
* The width and height fields reflect the storage size of the field.&lt;br /&gt;
* The offset fields specify the offset, in bytes, from the start of the data packet to the top leftmost sample for the specified channel. &lt;br /&gt;
* The Y stride field indicates the number of bytes to add to the current position to get the corresponding sample one row down. For the alpha channel, this value should be set to zero if the channel is not present. &lt;br /&gt;
* The X stride field indicates the number of bytes to add to the current position to get the corresponding sample one pixel to the right. For the alpha channel, this value should be set to zero if the channel is not present. &lt;br /&gt;
&lt;br /&gt;
=== Data Packets ===&lt;br /&gt;
 ..  [data]     Data for whole field&lt;br /&gt;
&lt;br /&gt;
== Supported Formats ==&lt;br /&gt;
&lt;br /&gt;
The following packets are defined as the standard layout packets for the various defined formats. For those formats that declare a fourcc, it is illegal to modify the values of the layout packet. The following abbreviations are used in the formulae below:&lt;br /&gt;
* disp_h: Display Height, from main header packet&lt;br /&gt;
* disp_w: Display Width, from main header packet&lt;br /&gt;
* l_h: Luma height, from data layout packet&lt;br /&gt;
* l_w: Luma width, from data layout packet&lt;br /&gt;
* c_h: Chroma height, from data layout packet&lt;br /&gt;
* c_w: Chroma width, from data layout packet&lt;br /&gt;
&lt;br /&gt;
=== YV12 ===&lt;br /&gt;
* FourCC: 0x32315659&lt;br /&gt;
* Interlaced: Not supported.&lt;br /&gt;
 l_h         = (disp_h + 1) &amp;amp; ~1&lt;br /&gt;
 l_w         = (disp_w + 1) &amp;amp; ~1&lt;br /&gt;
 c_h         = l_h / 2&lt;br /&gt;
 c_w         = l_w / 2&lt;br /&gt;
 a_offset    = 0&lt;br /&gt;
 yr_offset   = 0&lt;br /&gt;
 ug_offset   = l_h * l_w + c_h * c_w&lt;br /&gt;
 vb_offset   = l_h * l_w&lt;br /&gt;
 a_y_stride  = 0&lt;br /&gt;
 yr_y_stride = l_w&lt;br /&gt;
 ug_y_stride = c_w&lt;br /&gt;
 vb_y_stride = c_w&lt;br /&gt;
 a_x_stride  = 0&lt;br /&gt;
 yr_x_stride = 1&lt;br /&gt;
 ug_x_stride = 1&lt;br /&gt;
 vb_x_stride = 1&lt;br /&gt;
 &lt;br /&gt;
=== YUY2 ===&lt;br /&gt;
* FourCC: 0x32595559&lt;br /&gt;
* Interlaced: Not supported.&lt;br /&gt;
 l_h         = disp_h&lt;br /&gt;
 l_w         = (disp_w + 1) &amp;amp; ~1&lt;br /&gt;
 c_h         = l_h&lt;br /&gt;
 c_w         = l_w / 2&lt;br /&gt;
 a_offset    = 0&lt;br /&gt;
 yr_offset   = 0&lt;br /&gt;
 ug_offset   = 1&lt;br /&gt;
 vb_offset   = 3&lt;br /&gt;
 a_y_stride  = 0&lt;br /&gt;
 yr_y_stride = l_w * 2&lt;br /&gt;
 ug_y_stride = l_w * 2&lt;br /&gt;
 vb_y_stride = l_w * 2&lt;br /&gt;
 a_x_stride  = 0&lt;br /&gt;
 yr_x_stride = 2&lt;br /&gt;
 ug_x_stride = 4&lt;br /&gt;
 vb_x_stride = 4&lt;br /&gt;
&lt;br /&gt;
=== RGB24 DIB (bottom up, rows aligned to 32 bits) ===&lt;br /&gt;
* FourCC: 0x0000&lt;br /&gt;
* Interlaced: Not supported.&lt;br /&gt;
 l_h         = disp_h&lt;br /&gt;
 l_w         = disp_w&lt;br /&gt;
 c_h         = disp_h&lt;br /&gt;
 c_w         = disp_w&lt;br /&gt;
 a_offset    = 0&lt;br /&gt;
 yr_offset   = 2 + (disp_h-1) * -yr_y_stride &lt;br /&gt;
 ug_offset   = 1 + (disp_h-1) * -yr_y_stride &lt;br /&gt;
 vb_offset   = 0 + (disp_h-1) * -yr_y_stride &lt;br /&gt;
 a_y_stride  = 0&lt;br /&gt;
 yr_y_stride = -1 * (((disp_w*3)+3) &amp;amp; ~1)&lt;br /&gt;
 ug_y_stride = -1 * (((disp_w*3)+3) &amp;amp; ~1)&lt;br /&gt;
 vb_y_stride = -1 * (((disp_w*3)+3) &amp;amp; ~1)&lt;br /&gt;
 a_x_stride  = 0&lt;br /&gt;
 yr_x_stride = 3&lt;br /&gt;
 ug_x_stride = 3&lt;br /&gt;
 vb_x_stride = 3&lt;/div&gt;</summary>
		<author><name>Jkoleszar</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=OggUVS&amp;diff=2061</id>
		<title>OggUVS</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=OggUVS&amp;diff=2061"/>
		<updated>2005-11-14T18:01:19Z</updated>

		<summary type="html">&lt;p&gt;Jkoleszar: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is it ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;OggUVS&#039;&#039;&#039; is an uncompressed video codec for Ogg.  It&#039;s a simple way to store and transfer uncompressed video within an Ogg container. It is similar to [[OggYUV]] and [[OggRGB]], but is intended to support both formats.&lt;br /&gt;
&lt;br /&gt;
This is a work in progress and not a final proposal.&lt;br /&gt;
&lt;br /&gt;
== Packet Layout ==&lt;br /&gt;
&lt;br /&gt;
Note that unless otherwise noted, all multi-byte fields use the network byte order (big endian). The first packed in a stream MUST be the main header packet. The second packet MUST be the comment packet. Some extra header packets MAY be included after the comment header, provided this is identified in the main header. The packets that follow MUST all be data packets. &lt;br /&gt;
&lt;br /&gt;
This stream format is field based, rather than frame based. It supports only two fields per frame, and one field per data packet. Fields are stored in temporal order, so granulepos maintains its temporal significance. Fields are always encoded in alternating order, starting with the field containing the topmost line.&lt;br /&gt;
&lt;br /&gt;
=== Main Header Packet ===&lt;br /&gt;
 32  &amp;quot;UVS\0&amp;quot; Codec Identifier Word 0&lt;br /&gt;
 32     0x0  Codec Identifier Word 1&lt;br /&gt;
 16  [uint]  Version Major (breaks backwards compatability to increment)&lt;br /&gt;
 16  [uint]  Version Minor (backwards compatable, ie, more supported format id&#039;s)&lt;br /&gt;
 16  [uint]  Display Width&lt;br /&gt;
 16  [uint]  Display Height&lt;br /&gt;
 16  [uint]  Pixel Aspect Ratio Numerator&lt;br /&gt;
 16  [uint]  Pixel Aspect Ratio Denominator&lt;br /&gt;
 16  [uint]  Field Rate Numerator&lt;br /&gt;
 16  [uint]  Field Rate Denominator&lt;br /&gt;
 32  [uint]  Maximum Size Per Frame&lt;br /&gt;
 32  [uint]  Number of extra headers&lt;br /&gt;
 32  [enum]  Colorspace&lt;br /&gt;
 31  [uint]  Reserved&lt;br /&gt;
  1  [flg]   Interlaced&lt;br /&gt;
 32  [enum]  FourCC (set to zero if unknown or N/A)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Discussion:&#039;&#039;&#039;&lt;br /&gt;
* The FourCC field is used to specify a series of predefined packets describing the data layout. Applications should include the predefined packets in the stream as well, preferably by asking a helper library to fill them in. Applications should only use fourcc codes for formats that have corresponding layout packets defined.&lt;br /&gt;
&lt;br /&gt;
=== Data Layout Packet ===&lt;br /&gt;
 32     0x1  Data Layout Header Packet ID&lt;br /&gt;
 16  [uint]  Version Major (breaks backwards compatability to increment)&lt;br /&gt;
 16  [uint]  Version Minor (backwards compatable, ie, more supported format id&#039;s)&lt;br /&gt;
 16  [uint]  Luma Height&lt;br /&gt;
 16  [uint]  Luma Width&lt;br /&gt;
 16  [uint]  Chroma Height&lt;br /&gt;
 16  [uint]  Chroma Width&lt;br /&gt;
 -- Repeat all fields below this point for interlaced storage.&lt;br /&gt;
 32  [uint]  Alpha channel offset&lt;br /&gt;
 32  [uint]  Y/R channel offset&lt;br /&gt;
 32  [uint]  U/G channel offset&lt;br /&gt;
 32  [uint]  V/B channel offset&lt;br /&gt;
 32  [sint]  Alpha Y Stride&lt;br /&gt;
 32  [sint]  Y/R Y Stride&lt;br /&gt;
 32  [sint]  U/G Y Stride&lt;br /&gt;
 32  [sint]  V/B Y Stride&lt;br /&gt;
 32  [sint]  Y/R X Stride&lt;br /&gt;
 32  [sint]  U/G X Stride&lt;br /&gt;
 32  [sint]  V/B X Stride&lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;Discussion:&#039;&#039;&#039; &lt;br /&gt;
* This layout packet is for 8 bit per channel formats only.&lt;br /&gt;
* The width and height fields reflect the storage size of the field.&lt;br /&gt;
* The offset fields specify the offset, in bytes, from the start of the data packet to the top leftmost sample for the specified channel. &lt;br /&gt;
* The Y stride field indicates the number of bytes to add to the current position to get the corresponding sample one row down. For the alpha channel, this value should be set to zero if the channel is not present. &lt;br /&gt;
* The X stride field indicates the number of bytes to add to the current position to get the corresponding sample one pixel to the right. For the alpha channel, this value should be set to zero if the channel is not present. &lt;br /&gt;
&lt;br /&gt;
=== Data Packets ===&lt;br /&gt;
 ..  [data]     Data for whole field&lt;br /&gt;
&lt;br /&gt;
== Supported Formats ==&lt;br /&gt;
&lt;br /&gt;
The following packets are defined as the standard layout packets for the various defined formats. For those formats that declare a fourcc, it is illegal to modify the values of the layout packet. The following abbreviations are used in the formulae below:&lt;br /&gt;
* disp_h: Display Height, from main header packet&lt;br /&gt;
* disp_w: Display Width, from main header packet&lt;br /&gt;
* l_h: Luma height, from data layout packet&lt;br /&gt;
* l_w: Luma width, from data layout packet&lt;br /&gt;
* c_h: Chroma height, from data layout packet&lt;br /&gt;
* c_w: Chroma width, from data layout packet&lt;br /&gt;
&lt;br /&gt;
=== YV12 ===&lt;br /&gt;
* FourCC: 0x32315659&lt;br /&gt;
* Interlaced: Not supported.&lt;br /&gt;
 l_h         = (disp_h + 1) &amp;amp; ~1&lt;br /&gt;
 l_w         = (disp_w + 1) &amp;amp; ~1&lt;br /&gt;
 c_h         = l_h / 2&lt;br /&gt;
 c_w         = l_w / 2&lt;br /&gt;
 a_offset    = 0&lt;br /&gt;
 yr_offset   = 0&lt;br /&gt;
 ug_offset   = l_h * l_w + c_h * c_w&lt;br /&gt;
 vb_offset   = l_h * l_w&lt;br /&gt;
 a_y_stride  = 0&lt;br /&gt;
 yr_y_stride = l_w&lt;br /&gt;
 ug_y_stride = c_w&lt;br /&gt;
 vb_y_stride = c_w&lt;br /&gt;
 a_x_stride  = 0&lt;br /&gt;
 yr_x_stride = 1&lt;br /&gt;
 ug_x_stride = 1&lt;br /&gt;
 vb_x_stride = 1&lt;br /&gt;
 &lt;br /&gt;
=== YUY2 ===&lt;br /&gt;
* FourCC: 0x32595559&lt;br /&gt;
* Interlaced: Not supported.&lt;br /&gt;
 l_h         = disp_h&lt;br /&gt;
 l_w         = (disp_w + 1) &amp;amp; ~1&lt;br /&gt;
 c_h         = l_h&lt;br /&gt;
 c_w         = l_w / 2&lt;br /&gt;
 a_offset    = 0&lt;br /&gt;
 yr_offset   = 0&lt;br /&gt;
 ug_offset   = 1&lt;br /&gt;
 vb_offset   = 3&lt;br /&gt;
 a_y_stride  = 0&lt;br /&gt;
 yr_y_stride = l_w * 2&lt;br /&gt;
 ug_y_stride = l_w * 2&lt;br /&gt;
 vb_y_stride = l_w * 2&lt;br /&gt;
 a_x_stride  = 0&lt;br /&gt;
 yr_x_stride = 2&lt;br /&gt;
 ug_x_stride = 4&lt;br /&gt;
 vb_x_stride = 4&lt;br /&gt;
&lt;br /&gt;
=== RGB24 DIB (bottom up, rows aligned to 32 bits) ===&lt;br /&gt;
* FourCC: 0x0000&lt;br /&gt;
* Interlaced: Not supported.&lt;br /&gt;
 l_h         = disp_h&lt;br /&gt;
 l_w         = disp_w&lt;br /&gt;
 c_h         = disp_h&lt;br /&gt;
 c_w         = disp_w&lt;br /&gt;
 a_offset    = 0&lt;br /&gt;
 yr_offset   = 2 + (disp_h-1) * -yr_y_stride &lt;br /&gt;
 ug_offset   = 1 + (disp_h-1) * -yr_y_stride &lt;br /&gt;
 vb_offset   = 0 + (disp_h-1) * -yr_y_stride &lt;br /&gt;
 a_y_stride  = 0&lt;br /&gt;
 yr_y_stride = -1 * (((disp_w*3)+3) &amp;amp; ~1)&lt;br /&gt;
 ug_y_stride = -1 * (((disp_w*3)+3) &amp;amp; ~1)&lt;br /&gt;
 vb_y_stride = -1 * (((disp_w*3)+3) &amp;amp; ~1)&lt;br /&gt;
 a_x_stride  = 0&lt;br /&gt;
 yr_x_stride = 3&lt;br /&gt;
 ug_x_stride = 3&lt;br /&gt;
 vb_x_stride = 3&lt;/div&gt;</summary>
		<author><name>Jkoleszar</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=OggPCM&amp;diff=2062</id>
		<title>OggPCM</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=OggPCM&amp;diff=2062"/>
		<updated>2005-11-14T16:38:40Z</updated>

		<summary type="html">&lt;p&gt;Jkoleszar: Add related links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Alternate format for OggPCM ==&lt;br /&gt;
&lt;br /&gt;
The following is an alternate format for OggPCM. This is a work in progress and not a final proposal.&lt;br /&gt;
&lt;br /&gt;
Note that unless otherwise noted, all multi-byte fields use the network byte order (big endian). The first packed in a stream MUST be the main header packet. The second packet MUST be the comment packet. Some extra header packets MAY be included after the comment header, provided this is identified in the main header. The packets that follow MUST all be data packets.&lt;br /&gt;
&lt;br /&gt;
=== Main Header Packet ===&lt;br /&gt;
Multibyte fields in the header packets are packed in big endian order, to be consistent with network byte order. A header packet contains the following fields: &lt;br /&gt;
&lt;br /&gt;
 32  &amp;quot;PCM &amp;quot; Codec identifier &lt;br /&gt;
 16  0x00   Version Major (breaks backwards compatability to increment)&lt;br /&gt;
 16  0x00   Version Minor (backwards compatable, ie, more supported format id&#039;s)&lt;br /&gt;
 32  [uint] PCM format&lt;br /&gt;
 32  [uint] Significant bits&lt;br /&gt;
 32  [uint] Sampling rate&lt;br /&gt;
 32  [uint] Number of Channels (&amp;lt; 256)&lt;br /&gt;
 16  [uint] Maximum number of frames per packet&lt;br /&gt;
 16  [uint] Number of extra headers&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Maximum number of frames per packet&amp;quot; field is meant to notify an application reading the file that no data packet will contain more than a certain number of frames. This not only makes implementation easier, but also provides information on how much needs to be buffered when streaming PCM files. A value of 0 means a maximum of 65536 frames. Implementations SHOULD make this field such that packets do not get split into multiple pages.&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;significant bits&amp;quot; field specifies how many bits are actually used. The other bits MUST be zero. This can be used to support audio with any resolution. For example, 12-bit PCM can be supported as &amp;quot;16 bit PCM&amp;quot; for the format and 12 for the number of significant bits.&lt;br /&gt;
&lt;br /&gt;
For streams where the number of significant bits is the same as the bit width specified by the format, the significant bits field may be set to zero.&lt;br /&gt;
&lt;br /&gt;
For streams where the number of significant bits is less than that specified by the bit width, the data shall be justified to fill the most significant bits. For 12 bit PCM in a 16 bit format, the 12 valid bits will occupy the 12 most significant bits of the 16 bit word and the least significant 4 bits shall be zero.&lt;br /&gt;
&lt;br /&gt;
=== Comment packet ===&lt;br /&gt;
&lt;br /&gt;
The codec header is followed by a &amp;quot;vorbis comment&amp;quot; packet and by optional extra headers, if any. The format used is the same as for Vorbis with the exception that there is no packet identifier (so the packet is exactly like it is for Speex).&lt;br /&gt;
&lt;br /&gt;
=== Extra Headers (optional) ===&lt;br /&gt;
&lt;br /&gt;
Extra headers contain additional information about the OggPCM stream. Each extra header is defined as:&lt;br /&gt;
&lt;br /&gt;
 32  [uint] Header ID&lt;br /&gt;
 ...        Header data&lt;br /&gt;
&lt;br /&gt;
==== Channel Mapping Header ====&lt;br /&gt;
&lt;br /&gt;
The channel mapping header is defined as:&lt;br /&gt;
&lt;br /&gt;
 32 0x00000000   Header ID&lt;br /&gt;
 16 [uint]   Major version&lt;br /&gt;
 16 [uint]   Minor version&lt;br /&gt;
 32 [uint]   Channel type&lt;br /&gt;
 32xN [uint] Channel map (one for each channel)&lt;br /&gt;
&lt;br /&gt;
As an example, stereo might be encoded as:&lt;br /&gt;
&lt;br /&gt;
 channel_type = OGG_CHANNEL_MAP_STEREO&lt;br /&gt;
 channel_map [0] = OGG_CHANNEL_STEREO_LEFT&lt;br /&gt;
 channel_map [1] = OGG_CHANNEL_STEREO_RIGHT&lt;br /&gt;
&lt;br /&gt;
or as:&lt;br /&gt;
&lt;br /&gt;
 channel_type = OGG_CHANNEL_MAP_STEREO&lt;br /&gt;
 channel_map [0] = OGG_CHANNEL_STEREO_RIGHT&lt;br /&gt;
 channel_map [1] = OGG_CHANNEL_STEREO_LEFT&lt;br /&gt;
&lt;br /&gt;
All channel_types less than 0x80000000 are reserved for use by Xiph and all the ones above are allowed for application specific extensions.&lt;br /&gt;
&lt;br /&gt;
==== Channel Conversion Header ====&lt;br /&gt;
&lt;br /&gt;
Any number of channel conversion headers can be specified. This header specifies how to down-mix the data to another format.&lt;br /&gt;
&lt;br /&gt;
 32 0x00000001 Remixing Header Id&lt;br /&gt;
 16 [uint]     Major version&lt;br /&gt;
 16 [uint]     Minor version&lt;br /&gt;
 32 [uint]     Target Channel type&lt;br /&gt;
 32xMxN [sint] Target Channel (M) x Src Channel (N) Gain array&lt;br /&gt;
&lt;br /&gt;
The ordering of the mixing matrix is such that source channel gains are consecutive. The gain (note: *signed* integer) has the 16 MSBs for the integer part (including sign) and 16 bits for the fracional part of the gain. Note: the gain can be negative.&lt;br /&gt;
&lt;br /&gt;
=== Data Packets ===&lt;br /&gt;
&lt;br /&gt;
Data packets contain the raw PCM audio in interleaved format (complete frames are encoded sequentially) with the following definitions/restrictions:&lt;br /&gt;
&lt;br /&gt;
* A PCM &amp;quot;frame&amp;quot; is composed of samples for all channels at a given time.&lt;br /&gt;
* Any OggPCM packet should only contain complete frames (ie samples for all channels at a given sampling instance). Partial frames are forbidden.&lt;br /&gt;
* There is no padding allowed in a frame except when some bits (&amp;lt;8) are needed to complete a byte. This means that packet size has a direct relationship to the number of frames in the packet (for purposes of seeking).&lt;br /&gt;
&lt;br /&gt;
=== Supported PCM Formats ===&lt;br /&gt;
&lt;br /&gt;
 Format ID  Short Name             Description&lt;br /&gt;
  -- Integer coding&lt;br /&gt;
  0x00000000    OGGPCM_FMT_S8          Signed integer 8 bit&lt;br /&gt;
  0x00000001    OGGPCM_FMT_U8          Unsigned integer 8 bit&lt;br /&gt;
  0x00000002    OGGPCM_FMT_S16_LE      Signed integer 16 bit little endian&lt;br /&gt;
  0x00000003    OGGPCM_FMT_S16_BE      Signed integer 16 bit big endian&lt;br /&gt;
  0x00000004    OGGPCM_FMT_S24_LE      Signed integer 24 bit little endian&lt;br /&gt;
  0x00000005    OGGPCM_FMT_S24_BE      Signed integer 24 bit big endian&lt;br /&gt;
  0x00000006    OGGPCM_FMT_S32_LE      Signed integer 32 bit little endian&lt;br /&gt;
  0x00000007    OGGPCM_FMT_S32_BE      Signed integer 32 bit big endian&lt;br /&gt;
  --&lt;br /&gt;
  -- Compressed PCM&lt;br /&gt;
  0x00000008    OGGPCM_FMT_ULAW        G.711 u-law encoding (8 bit)&lt;br /&gt;
  0x00000009    OGGPCM_FMT_ALAW        G.711 A-law encoding (8 bit)&lt;br /&gt;
  0x0000000A    OGGPCM_FMT_ULAW12      Wideband u-law encoding (12 bit)&lt;br /&gt;
  0x0000000B    OGGPCM_FMT_ALAW12      Wideband A-law encoding (12 bit)&lt;br /&gt;
  --&lt;br /&gt;
  -- IEEE Floating point coding&lt;br /&gt;
  0x00000010    OGGPCM_FMT_FLT32_LE    IEEE Float [-1,1] 32 bit little endian&lt;br /&gt;
  0x00000011    OGGPCM_FMT_FLT32_BE    IEEE Float [-1,1] 32 bit big endian&lt;br /&gt;
  0x00000012    OGGPCM_FMT_FLT64_LE    IEEE Float [-1,1] 64 bit little endian&lt;br /&gt;
  0x00000013    OGGPCM_FMT_FLT64_BE    IEEE Float [-1,1] 64 bit big endian&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Related Links ==&lt;br /&gt;
Short info about AC-3: http://www.mediatwins.com/en/support/kb_topic_11.html&lt;br /&gt;
&lt;br /&gt;
AC-3 spec: http://www.atsc.org/standards/a_52a.pdf &amp;lt;br&amp;gt;&lt;br /&gt;
Note: around p34/140 it appears to be how the channel mapping is encoded.&lt;br /&gt;
&lt;br /&gt;
.wav extended headers for multi channel: http://www.microsoft.com/whdc/device/audio/multichaud.mspx&lt;br /&gt;
&lt;br /&gt;
General surround info: http://www.surroundassociates.com/fqmain.html&lt;/div&gt;</summary>
		<author><name>Jkoleszar</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=OggPCM_Draft1&amp;diff=2054</id>
		<title>OggPCM Draft1</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=OggPCM_Draft1&amp;diff=2054"/>
		<updated>2005-11-13T22:54:39Z</updated>

		<summary type="html">&lt;p&gt;Jkoleszar: /* Header Packet */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Warning: OggPCM is currently a topic of [http://lists.xiph.org/pipermail/ogg-dev/2005-November/thread.html heated debate]. The following is *not* the final spec.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== What is it ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;OggPCM&#039;&#039;&#039; is a pulse-code modulation (PCM) audio codec for Ogg.  Similar to Microsoft&#039;s .wav or Apple&#039;s .aiff formats, it&#039;s a simple way to store and transfer uncompressed audio within an Ogg container. For the purposes of this document, the term PCM is used to describe a digital representation of an audio signal, where volume samples are taken at regular uniform intervals and then quantized into a digital (usually binary) code. A more complete definition of PCM and related terminology can be found at [[Wikipedia:Pulse-code_modulation|Wikipedia]].&lt;br /&gt;
&lt;br /&gt;
== Why is it ==&lt;br /&gt;
The intention for this format is as an interchange format, for example for use with [[OggStream]].  It is also useful for storing time-synced decoded audio/video, as opposed to using RIFF/WAV (.wav) and YUV4MPEG (.yuv) in separate files as was done during [[Theora]] development. It is intended to be less complex to use than either RIFF or AIFF.&lt;br /&gt;
&lt;br /&gt;
== Stream Description ==&lt;br /&gt;
A stream is composed of a header packet, zero or more comment packets, and one or more data packets. Data packets may be of variable length, including zero. The only valid use of a zero length data packet is to mark the end of stream. Data packets must contain samples for all channels. That is to say, the length of a data packet must be a multiple of the number of channels times the storage size of a single sample. For instance, for a stream containing 6 channels at 2 byte per channel, the length of the data packet must be a multiple of 12 bytes.&lt;br /&gt;
&lt;br /&gt;
The degenerate stream is a single header packet followed by the raw data packets. While this degenerate stream is not incredibly useful for long term storage or as a general purpose container, it is useful for applications where other data describing the stream is available out of band, for instance amongst cooperating applications in an inter-process communication scheme. Streams providing the extra defined comment packets are intended to be useful for long term storage and communication amongst diverse applications.&lt;br /&gt;
&lt;br /&gt;
== Packet Format ==&lt;br /&gt;
Header and comment packets are processed as per the value of their first byte.  Packets of unknown ID should be silently ignored, providing a convient way to add future expandability which does not break the data format. An example of how this can be useful is the proposed ReplayGain extension to .wav format: http://replaygain.hydrogenaudio.org/file_format_wav.html&lt;br /&gt;
&lt;br /&gt;
The header packet contains a field indicating the number of comment packets preceding the raw data. Applications must either parse or skip exactly this many packets, in addition to the header packet, before treating the stream as raw data.&lt;br /&gt;
&lt;br /&gt;
=== Header Packet ===&lt;br /&gt;
Multibyte fields in the header packets are packed in big endian order, to be consistent with network byte order. A header packet contains the following fields: &lt;br /&gt;
&lt;br /&gt;
 Packet 0, BOS, 16 bytes&lt;br /&gt;
  8  0x00   Stream Header Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;  Codec identifier &lt;br /&gt;
  -&lt;br /&gt;
  8  0x01   Version Major (breaks backwards compatability to increment)&lt;br /&gt;
  8  0x00   Version Minor (backwards compatable, ie, more supported format id&#039;s)&lt;br /&gt;
  8  [uint] Number of comment packets preceding data&lt;br /&gt;
  8  [uint] Number of Channels, 0 = 256&lt;br /&gt;
  -&lt;br /&gt;
 16  [flag] Flags&lt;br /&gt;
 16  [enum] PCM Format ID&lt;br /&gt;
  -&lt;br /&gt;
 32  [uint] Sample Rate&lt;br /&gt;
&lt;br /&gt;
The flags field is defined as follows:&lt;br /&gt;
   Bit       Description&lt;br /&gt;
   15 (MSB)  Interleaved/Chunked - If set, data in the packets is &amp;quot;chunked&amp;quot; by channel. In a data&lt;br /&gt;
             packet containing 3 channels and 2 samples/channel, the chunked storage order would be&lt;br /&gt;
             001122. For the interleaved storage format (default), the order would be 012012.&lt;br /&gt;
   others    Reserved&lt;br /&gt;
&lt;br /&gt;
Applications conforming to version 1.0 of this spec MUST:&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;set all reserved flags to false (zero) when creating these streams.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;preserve all values of all reserved flags when reading or modifying these streams, unless the application sets the minor version field to zero, in which case the reserved flags must be set to false as well.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Comment Packets ===&lt;br /&gt;
At this time, there is only one defined comment packet.&lt;br /&gt;
 Comment Header Packet&lt;br /&gt;
  8  0x03   Comment Header Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;  Codec Identifier&lt;br /&gt;
 -- Continues as [[http://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#vorbis-spec-comment|Vorbis&#039;s Comment Header]]&lt;br /&gt;
&lt;br /&gt;
=== Data Packets ===&lt;br /&gt;
Data packets have no header word. This is done to preserve the alignment of the data payload. The contents of the data packets are specified by a combination of the &#039;PCM Format ID&#039; field and the &#039;Flags&#039; field. The length of the data packet must be a multiple of the number of channels specified in the header, and the storage size of a single sample, as specified by the &#039;PCM Format ID&#039; field.&lt;br /&gt;
&lt;br /&gt;
=== Supported PCM Formats ===&lt;br /&gt;
Formats are identified within a header packet by a 16 bit &amp;quot;format type&amp;quot; field. While&lt;br /&gt;
most applications will treat this as an opaque type, it is possible to discern some&lt;br /&gt;
information about the format from the value of this field itself. Specifically, the&lt;br /&gt;
format&#039;s storage size, in bytes, and its byte ordering, can be discerned by parsing&lt;br /&gt;
the lower 6 bits of the value. These values are exposed so that it is possible to&lt;br /&gt;
extract individual samples without necessarily understanding the coding scheme involved.&lt;br /&gt;
While for pratical purposes, due to performance concerns, most applications will&lt;br /&gt;
choose to operate on a buffer directly, it is nonetheless possible to work a sample&lt;br /&gt;
at a time. &lt;br /&gt;
&lt;br /&gt;
 Binary Value    Meaning&lt;br /&gt;
 ..xxxx00        N/A, or data not accurately described by this scheme.&lt;br /&gt;
 ..xxxx01        Least significant byte first. Bytes are MS bit first.&lt;br /&gt;
 ..xxxx10        Most significant byte first. Bytes are MS bit first.&lt;br /&gt;
 ..xxxx11        Data is machine endian&lt;br /&gt;
 ..0000xx        Data can not be described by this bytepacking scheme.&lt;br /&gt;
 ..0001xx        Samples are stored using one byte per sample&lt;br /&gt;
 ..0010xx        Samples are stored using two bytes per sample&lt;br /&gt;
 ..0011xx        Samples are stored using three bytes per sample&lt;br /&gt;
 ..0100xx        Samples are stored using four bytes per sample&lt;br /&gt;
 ..1000xx        Samples are stored using eight bytes per sample&lt;br /&gt;
&lt;br /&gt;
The remaining 10 bits describe the coding scheme used to convert the digital value&lt;br /&gt;
to an audio signal. The following formats are defined for version 1.0 of this&lt;br /&gt;
format. For purposes of attribution, it should be noted that these formats are the&lt;br /&gt;
PCM formats supported by the Advanced Linux Sound Architecture (ALSA) project, and&lt;br /&gt;
should be fairly comprehensive.&lt;br /&gt;
&lt;br /&gt;
 Format ID  Short Name             Description&lt;br /&gt;
  -- Signed integer coding (0)&lt;br /&gt;
  0x0004    OGGPCM_FMT_S8          Signed integer 8 bit&lt;br /&gt;
  0x0009    OGGPCM_FMT_S16_LE      Signed integer 16 bit little endian&lt;br /&gt;
  0x000A    OGGPCM_FMT_S16_BE      Signed integer 16 bit big endian&lt;br /&gt;
  0x000B    OGGPCM_FMT_S16         Signed integer 16 bit machine endian&lt;br /&gt;
  0x000D    OGGPCM_FMT_S24_3LE     Signed integer 24 bit little endian&lt;br /&gt;
  0x000E    OGGPCM_FMT_S24_3BE     Signed integer 24 bit big endian&lt;br /&gt;
  0x0011    OGGPCM_FMT_S32_LE      Signed integer 32 bit little endian&lt;br /&gt;
  0x0012    OGGPCM_FMT_S32_BE      Signed integer 32 bit big endian&lt;br /&gt;
  0x0013    OGGPCM_FMT_S32         Signed integer 32 bit machine endian&lt;br /&gt;
  --&lt;br /&gt;
  -- Unsigned integer coding (1)&lt;br /&gt;
  0x0044    OGGPCM_FMT_U8          Unsigned integer 8 bit&lt;br /&gt;
  0x0049    OGGPCM_FMT_U16_LE      Unsigned integer 16 bit little endian&lt;br /&gt;
  0x004A    OGGPCM_FMT_U16_BE      Unsigned integer 16 bit big endian&lt;br /&gt;
  0x004B    OGGPCM_FMT_U16         Unsigned integer 16 bit machine endian&lt;br /&gt;
  0x004D    OGGPCM_FMT_U24_3LE     Unsigned integer 24 bit little endian&lt;br /&gt;
  0x004E    OGGPCM_FMT_U24_3BE     Unsigned integer 24 bit big endian&lt;br /&gt;
  0x0051    OGGPCM_FMT_U32_LE      Unsigned integer 32 bit little endian&lt;br /&gt;
  0x0052    OGGPCM_FMT_U32_BE      Unsigned integer 32 bit big endian&lt;br /&gt;
  0x0053    OGGPCM_FMT_U32         Unsigned integer 32 bit machine endian&lt;br /&gt;
  --&lt;br /&gt;
  -- IEEE Floating point coding (2)&lt;br /&gt;
  0x0091    OGGPCM_FMT_FLT_LE      IEEE Float (-1,1) 32 bit little endian&lt;br /&gt;
  0x0092    OGGPCM_FMT_FLT_BE      IEEE Float (-1,1) 32 bit big endian&lt;br /&gt;
  0x0093    OGGPCM_FMT_FLT         IEEE Float (-1,1) 32 bit machine endian&lt;br /&gt;
  0x00A1    OGGPCM_FMT_FLT64_LE    IEEE Float (-1,1) 64 bit little endian&lt;br /&gt;
  0x00A2    OGGPCM_FMT_FLT64_BE    IEEE Float (-1,1) 64 bit big endian&lt;br /&gt;
  0x00A3    OGGPCM_FMT_FLT64       IEEE Float (-1,1) 64 bit machine endian&lt;br /&gt;
  --&lt;br /&gt;
  -- IEC958 coding (?) (3)&lt;br /&gt;
  0x00CD    OGGPCM_FMT_IEC958_3LE  IEC958 Subframe, 24 bit little endian&lt;br /&gt;
  0x00CE    OGGPCM_FMT_IEC958_3BE  IEC958 Subframe, 24 bit big endian&lt;br /&gt;
  0x00D1    OGGPCM_FMT_IEC958_LE   IEC958 Subframe, 32 bit little endian&lt;br /&gt;
  0x00D2    OGGPCM_FMT_IEC958_BE   IEC958 Subframe, 32 bit big endian&lt;br /&gt;
  0x00D3    OGGPCM_FMT_IEC958      IEC965 Subframe, 32 bit machine endian&lt;br /&gt;
  --&lt;br /&gt;
  -- Mu-Law coding (4)&lt;br /&gt;
  0x0104    OGGPCM_FMT_MU_LAW      Mu-Law&lt;br /&gt;
  --&lt;br /&gt;
  -- A-Law coding (5)&lt;br /&gt;
  0x0144    OGGPCM_FMT_A_LAW       A-Law&lt;br /&gt;
  --&lt;br /&gt;
  -- ADPCM coding (6)&lt;br /&gt;
  0x0180    OGGPCM_FMT_ADPCM       Ima-ADPCM    &lt;br /&gt;
  --&lt;br /&gt;
  -- GSM coding (7)&lt;br /&gt;
  0x01C0    OGGPCM_FMT_GSM         GSM&lt;br /&gt;
  --&lt;br /&gt;
  -- 24 bit signed integer in 32 bit storage (8)&lt;br /&gt;
  0x0211    OGGPCM_FMT_S24_LE      Signed integer 24 bit little endian&lt;br /&gt;
  0x0212    OGGPCM_FMT_S24_BE      Signed integer 24 bit big endian&lt;br /&gt;
  0x0213    OGGPCM_FMT_S24         Signed integer 24 bit machine endian&lt;br /&gt;
  --&lt;br /&gt;
  -- 24 bit unsigned integer in 32 bit storage (9)&lt;br /&gt;
  0x0251    OGGPCM_FMT_U24_LE      Unsigned integer 24 bit little endian&lt;br /&gt;
  0x0252    OGGPCM_FMT_U24_BE      Unsigned integer 24 bit big endian&lt;br /&gt;
  0x0253    OGGPCM_FMT_U24         Unsigned integer 24 bit machine endian&lt;br /&gt;
  --&lt;br /&gt;
  -- 20 bit signed integer in 24 bit storage (10)&lt;br /&gt;
  0x028D    OGGPCM_FMT_S20_3LE     Signed integer 20 bit little endian&lt;br /&gt;
  0x028E    OGGPCM_FMT_S20_3BE     Signed integer 20 bit big endian&lt;br /&gt;
  --&lt;br /&gt;
  -- 20 bit unsigned integer in 24 bit storage (11)&lt;br /&gt;
  0x02CD    OGGPCM_FMT_U20_3LE     Unsigned integer 20 bit little endian&lt;br /&gt;
  0x02CE    OGGPCM_FMT_U20_3BE     Unsigned integer 20 bit big endian&lt;br /&gt;
  --&lt;br /&gt;
  -- 18 bit signed integer in 24 bit storage (12)&lt;br /&gt;
  0x030D    OGGPCM_FMT_S18_3LE     Signed integer 18 bit little endian&lt;br /&gt;
  0x030E    OGGPCM_FMT_S18_3BE     Signed integer 18 bit big endian&lt;br /&gt;
  --&lt;br /&gt;
  -- 18 bit unsigned integer in 24 bit storage (13)&lt;br /&gt;
  0x034D    OGGPCM_FMT_U18_3LE     Unsigned integer 18 bit little endian&lt;br /&gt;
  0x034E    OGGPCM_FMT_U18_3BE     Unsigned integer 18 bit big endian&lt;br /&gt;
  --&lt;br /&gt;
  Other coding schemes supported by ALSA but not specified here:&lt;br /&gt;
    MPEG&lt;br /&gt;
  --&lt;br /&gt;
  TODO: ADPCM and GSM need further specification (or elimination) since these aren&#039;t really&lt;br /&gt;
        byte packed like the other formats here are.&lt;br /&gt;
 &lt;br /&gt;
== Encapsulation in Ogg ==&lt;br /&gt;
Following standard terminology for uncompressed audio, an audio frame is the collection of samples for all channels for a single sampling period. For example, an audio frame for a stereo signal is a pair of sample values for the left and right channels.&lt;br /&gt;
&lt;br /&gt;
The granulepos of an Ogg page indicates the presentation time of the last presentable element in the last complete packet within that page; for &#039;&#039;&#039;OggPCM&#039;&#039;&#039;, a granule is an audio frame. The granule position specified is the total audio frames in the stream including the last complete packet in a page.  Audio frames must not be split across packets.  The rationale here is that the position specified in the frame header of the last page tells how long the data coded by the bitstream is in samples as well as provides the current stream position to seeking routines.  A truncated stream will still return the proper number of audio frames that can be decoded fully.&lt;/div&gt;</summary>
		<author><name>Jkoleszar</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=OggPCM_Draft1&amp;diff=2045</id>
		<title>OggPCM Draft1</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=OggPCM_Draft1&amp;diff=2045"/>
		<updated>2005-11-13T22:42:24Z</updated>

		<summary type="html">&lt;p&gt;Jkoleszar: Minor updates to just about everything&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Warning: OggPCM is currently a topic of [http://lists.xiph.org/pipermail/ogg-dev/2005-November/thread.html heated debate]. The following is *not* the final spec.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== What is it ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;OggPCM&#039;&#039;&#039; is a pulse-code modulation (PCM) audio codec for Ogg.  Similar to Microsoft&#039;s .wav or Apple&#039;s .aiff formats, it&#039;s a simple way to store and transfer uncompressed audio within an Ogg container. For the purposes of this document, the term PCM is used to describe a digital representation of an audio signal, where volume samples are taken at regular uniform intervals and then quantized into a digital (usually binary) code. A more complete definition of PCM and related terminology can be found at [[Wikipedia:Pulse-code_modulation|Wikipedia]].&lt;br /&gt;
&lt;br /&gt;
== Why is it ==&lt;br /&gt;
The intention for this format is as an interchange format, for example for use with [[OggStream]].  It is also useful for storing time-synced decoded audio/video, as opposed to using RIFF/WAV (.wav) and YUV4MPEG (.yuv) in separate files as was done during [[Theora]] development. It is intended to be less complex to use than either RIFF or AIFF.&lt;br /&gt;
&lt;br /&gt;
== Stream Description ==&lt;br /&gt;
A stream is composed of a header packet, zero or more comment packets, and one or more data packets. Data packets may be of variable length, including zero. The only valid use of a zero length data packet is to mark the end of stream. Data packets must contain samples for all channels. That is to say, the length of a data packet must be a multiple of the number of channels times the storage size of a single sample. For instance, for a stream containing 6 channels at 2 byte per channel, the length of the data packet must be a multiple of 12 bytes.&lt;br /&gt;
&lt;br /&gt;
The degenerate stream is a single header packet followed by the raw data packets. While this degenerate stream is not incredibly useful for long term storage or as a general purpose container, it is useful for applications where other data describing the stream is available out of band, for instance amongst cooperating applications in an inter-process communication scheme. Streams providing the extra defined comment packets are intended to be useful for long term storage and communication amongst diverse applications.&lt;br /&gt;
&lt;br /&gt;
== Packet Format ==&lt;br /&gt;
Header and comment packets are processed as per the value of their first byte.  Packets of unknown ID should be silently ignored, providing a convient way to add future expandability which does not break the data format. An example of how this can be useful is the proposed ReplayGain extension to .wav format: http://replaygain.hydrogenaudio.org/file_format_wav.html&lt;br /&gt;
&lt;br /&gt;
The header packet contains a field indicating the number of comment packets preceding the raw data. Applications must either parse or skip exactly this many packets, in addition to the header packet, before treating the stream as raw data.&lt;br /&gt;
&lt;br /&gt;
=== Header Packet ===&lt;br /&gt;
Multibyte fields in the header packets are packed in big endian order, to be consistent with network byte order. A header packet contains the following fields: &lt;br /&gt;
&lt;br /&gt;
 Packet 0, BOS, 16 bytes&lt;br /&gt;
  8  0x00   Stream Header Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;  Codec identifier &lt;br /&gt;
  -&lt;br /&gt;
  8  0x01   Version Major (breaks backwards compatability to increment)&lt;br /&gt;
  8  0x00   Version Minor (backwards compatable, ie, more supported format id&#039;s)&lt;br /&gt;
  8  [uint] Number of comment packets preceding data&lt;br /&gt;
  8  [uint] Number of Channels, 0 = 256&lt;br /&gt;
  -&lt;br /&gt;
 16  [flag] Flags&lt;br /&gt;
 16  [enum] PCM Format ID&lt;br /&gt;
  -&lt;br /&gt;
 32  [uint] Sample Rate&lt;br /&gt;
&lt;br /&gt;
The flags field is defined as follows:&lt;br /&gt;
   Bit       Description&lt;br /&gt;
    0 (LSB)  Interleaved/Chunked - If set, data in the packets is &amp;quot;chunked&amp;quot; by channel. In a data&lt;br /&gt;
             packet containing 3 channels and 2 samples/channel, the chunked storage order would be&lt;br /&gt;
             001122. For the interleaved storage format (default), the order would be 012012.&lt;br /&gt;
   others    Reserved&lt;br /&gt;
&lt;br /&gt;
Applications conforming to version 1.0 of this spec MUST:&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;set all reserved flags to false (zero) when creating these streams.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;preserve all values of all reserved flags when reading or modifying these streams, unless the application sets the minor version field to zero, in which case the reserved flags must be set to false as well.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Comment Packets ===&lt;br /&gt;
At this time, there is only one defined comment packet.&lt;br /&gt;
 Comment Header Packet&lt;br /&gt;
  8  0x03   Comment Header Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;  Codec Identifier&lt;br /&gt;
 -- Continues as [[http://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#vorbis-spec-comment|Vorbis&#039;s Comment Header]]&lt;br /&gt;
&lt;br /&gt;
=== Data Packets ===&lt;br /&gt;
Data packets have no header word. This is done to preserve the alignment of the data payload. The contents of the data packets are specified by a combination of the &#039;PCM Format ID&#039; field and the &#039;Flags&#039; field. The length of the data packet must be a multiple of the number of channels specified in the header, and the storage size of a single sample, as specified by the &#039;PCM Format ID&#039; field.&lt;br /&gt;
&lt;br /&gt;
=== Supported PCM Formats ===&lt;br /&gt;
Formats are identified within a header packet by a 16 bit &amp;quot;format type&amp;quot; field. While&lt;br /&gt;
most applications will treat this as an opaque type, it is possible to discern some&lt;br /&gt;
information about the format from the value of this field itself. Specifically, the&lt;br /&gt;
format&#039;s storage size, in bytes, and its byte ordering, can be discerned by parsing&lt;br /&gt;
the lower 6 bits of the value. These values are exposed so that it is possible to&lt;br /&gt;
extract individual samples without necessarily understanding the coding scheme involved.&lt;br /&gt;
While for pratical purposes, due to performance concerns, most applications will&lt;br /&gt;
choose to operate on a buffer directly, it is nonetheless possible to work a sample&lt;br /&gt;
at a time. &lt;br /&gt;
&lt;br /&gt;
 Binary Value    Meaning&lt;br /&gt;
 ..xxxx00        N/A, or data not accurately described by this scheme.&lt;br /&gt;
 ..xxxx01        Least significant byte first. Bytes are MS bit first.&lt;br /&gt;
 ..xxxx10        Most significant byte first. Bytes are MS bit first.&lt;br /&gt;
 ..xxxx11        Data is machine endian&lt;br /&gt;
 ..0000xx        Data can not be described by this bytepacking scheme.&lt;br /&gt;
 ..0001xx        Samples are stored using one byte per sample&lt;br /&gt;
 ..0010xx        Samples are stored using two bytes per sample&lt;br /&gt;
 ..0011xx        Samples are stored using three bytes per sample&lt;br /&gt;
 ..0100xx        Samples are stored using four bytes per sample&lt;br /&gt;
 ..1000xx        Samples are stored using eight bytes per sample&lt;br /&gt;
&lt;br /&gt;
The remaining 10 bits describe the coding scheme used to convert the digital value&lt;br /&gt;
to an audio signal. The following formats are defined for version 1.0 of this&lt;br /&gt;
format. For purposes of attribution, it should be noted that these formats are the&lt;br /&gt;
PCM formats supported by the Advanced Linux Sound Architecture (ALSA) project, and&lt;br /&gt;
should be fairly comprehensive.&lt;br /&gt;
&lt;br /&gt;
 Format ID  Short Name             Description&lt;br /&gt;
  -- Signed integer coding (0)&lt;br /&gt;
  0x0004    OGGPCM_FMT_S8          Signed integer 8 bit&lt;br /&gt;
  0x0009    OGGPCM_FMT_S16_LE      Signed integer 16 bit little endian&lt;br /&gt;
  0x000A    OGGPCM_FMT_S16_BE      Signed integer 16 bit big endian&lt;br /&gt;
  0x000B    OGGPCM_FMT_S16         Signed integer 16 bit machine endian&lt;br /&gt;
  0x000D    OGGPCM_FMT_S24_3LE     Signed integer 24 bit little endian&lt;br /&gt;
  0x000E    OGGPCM_FMT_S24_3BE     Signed integer 24 bit big endian&lt;br /&gt;
  0x0011    OGGPCM_FMT_S32_LE      Signed integer 32 bit little endian&lt;br /&gt;
  0x0012    OGGPCM_FMT_S32_BE      Signed integer 32 bit big endian&lt;br /&gt;
  0x0013    OGGPCM_FMT_S32         Signed integer 32 bit machine endian&lt;br /&gt;
  --&lt;br /&gt;
  -- Unsigned integer coding (1)&lt;br /&gt;
  0x0044    OGGPCM_FMT_U8          Unsigned integer 8 bit&lt;br /&gt;
  0x0049    OGGPCM_FMT_U16_LE      Unsigned integer 16 bit little endian&lt;br /&gt;
  0x004A    OGGPCM_FMT_U16_BE      Unsigned integer 16 bit big endian&lt;br /&gt;
  0x004B    OGGPCM_FMT_U16         Unsigned integer 16 bit machine endian&lt;br /&gt;
  0x004D    OGGPCM_FMT_U24_3LE     Unsigned integer 24 bit little endian&lt;br /&gt;
  0x004E    OGGPCM_FMT_U24_3BE     Unsigned integer 24 bit big endian&lt;br /&gt;
  0x0051    OGGPCM_FMT_U32_LE      Unsigned integer 32 bit little endian&lt;br /&gt;
  0x0052    OGGPCM_FMT_U32_BE      Unsigned integer 32 bit big endian&lt;br /&gt;
  0x0053    OGGPCM_FMT_U32         Unsigned integer 32 bit machine endian&lt;br /&gt;
  --&lt;br /&gt;
  -- IEEE Floating point coding (2)&lt;br /&gt;
  0x0091    OGGPCM_FMT_FLT_LE      IEEE Float (-1,1) 32 bit little endian&lt;br /&gt;
  0x0092    OGGPCM_FMT_FLT_BE      IEEE Float (-1,1) 32 bit big endian&lt;br /&gt;
  0x0093    OGGPCM_FMT_FLT         IEEE Float (-1,1) 32 bit machine endian&lt;br /&gt;
  0x00A1    OGGPCM_FMT_FLT64_LE    IEEE Float (-1,1) 64 bit little endian&lt;br /&gt;
  0x00A2    OGGPCM_FMT_FLT64_BE    IEEE Float (-1,1) 64 bit big endian&lt;br /&gt;
  0x00A3    OGGPCM_FMT_FLT64       IEEE Float (-1,1) 64 bit machine endian&lt;br /&gt;
  --&lt;br /&gt;
  -- IEC958 coding (?) (3)&lt;br /&gt;
  0x00CD    OGGPCM_FMT_IEC958_3LE  IEC958 Subframe, 24 bit little endian&lt;br /&gt;
  0x00CE    OGGPCM_FMT_IEC958_3BE  IEC958 Subframe, 24 bit big endian&lt;br /&gt;
  0x00D1    OGGPCM_FMT_IEC958_LE   IEC958 Subframe, 32 bit little endian&lt;br /&gt;
  0x00D2    OGGPCM_FMT_IEC958_BE   IEC958 Subframe, 32 bit big endian&lt;br /&gt;
  0x00D3    OGGPCM_FMT_IEC958      IEC965 Subframe, 32 bit machine endian&lt;br /&gt;
  --&lt;br /&gt;
  -- Mu-Law coding (4)&lt;br /&gt;
  0x0104    OGGPCM_FMT_MU_LAW      Mu-Law&lt;br /&gt;
  --&lt;br /&gt;
  -- A-Law coding (5)&lt;br /&gt;
  0x0144    OGGPCM_FMT_A_LAW       A-Law&lt;br /&gt;
  --&lt;br /&gt;
  -- ADPCM coding (6)&lt;br /&gt;
  0x0180    OGGPCM_FMT_ADPCM       Ima-ADPCM    &lt;br /&gt;
  --&lt;br /&gt;
  -- GSM coding (7)&lt;br /&gt;
  0x01C0    OGGPCM_FMT_GSM         GSM&lt;br /&gt;
  --&lt;br /&gt;
  -- 24 bit signed integer in 32 bit storage (8)&lt;br /&gt;
  0x0211    OGGPCM_FMT_S24_LE      Signed integer 24 bit little endian&lt;br /&gt;
  0x0212    OGGPCM_FMT_S24_BE      Signed integer 24 bit big endian&lt;br /&gt;
  0x0213    OGGPCM_FMT_S24         Signed integer 24 bit machine endian&lt;br /&gt;
  --&lt;br /&gt;
  -- 24 bit unsigned integer in 32 bit storage (9)&lt;br /&gt;
  0x0251    OGGPCM_FMT_U24_LE      Unsigned integer 24 bit little endian&lt;br /&gt;
  0x0252    OGGPCM_FMT_U24_BE      Unsigned integer 24 bit big endian&lt;br /&gt;
  0x0253    OGGPCM_FMT_U24         Unsigned integer 24 bit machine endian&lt;br /&gt;
  --&lt;br /&gt;
  -- 20 bit signed integer in 24 bit storage (10)&lt;br /&gt;
  0x028D    OGGPCM_FMT_S20_3LE     Signed integer 20 bit little endian&lt;br /&gt;
  0x028E    OGGPCM_FMT_S20_3BE     Signed integer 20 bit big endian&lt;br /&gt;
  --&lt;br /&gt;
  -- 20 bit unsigned integer in 24 bit storage (11)&lt;br /&gt;
  0x02CD    OGGPCM_FMT_U20_3LE     Unsigned integer 20 bit little endian&lt;br /&gt;
  0x02CE    OGGPCM_FMT_U20_3BE     Unsigned integer 20 bit big endian&lt;br /&gt;
  --&lt;br /&gt;
  -- 18 bit signed integer in 24 bit storage (12)&lt;br /&gt;
  0x030D    OGGPCM_FMT_S18_3LE     Signed integer 18 bit little endian&lt;br /&gt;
  0x030E    OGGPCM_FMT_S18_3BE     Signed integer 18 bit big endian&lt;br /&gt;
  --&lt;br /&gt;
  -- 18 bit unsigned integer in 24 bit storage (13)&lt;br /&gt;
  0x034D    OGGPCM_FMT_U18_3LE     Unsigned integer 18 bit little endian&lt;br /&gt;
  0x034E    OGGPCM_FMT_U18_3BE     Unsigned integer 18 bit big endian&lt;br /&gt;
  --&lt;br /&gt;
  Other coding schemes supported by ALSA but not specified here:&lt;br /&gt;
    MPEG&lt;br /&gt;
  --&lt;br /&gt;
  TODO: ADPCM and GSM need further specification (or elimination) since these aren&#039;t really&lt;br /&gt;
        byte packed like the other formats here are.&lt;br /&gt;
 &lt;br /&gt;
== Encapsulation in Ogg ==&lt;br /&gt;
Following standard terminology for uncompressed audio, an audio frame is the collection of samples for all channels for a single sampling period. For example, an audio frame for a stereo signal is a pair of sample values for the left and right channels.&lt;br /&gt;
&lt;br /&gt;
The granulepos of an Ogg page indicates the presentation time of the last presentable element in the last complete packet within that page; for &#039;&#039;&#039;OggPCM&#039;&#039;&#039;, a granule is an audio frame. The granule position specified is the total audio frames in the stream including the last complete packet in a page.  Audio frames must not be split across packets.  The rationale here is that the position specified in the frame header of the last page tells how long the data coded by the bitstream is in samples as well as provides the current stream position to seeking routines.  A truncated stream will still return the proper number of audio frames that can be decoded fully.&lt;/div&gt;</summary>
		<author><name>Jkoleszar</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=OggPCM_Draft1&amp;diff=2044</id>
		<title>OggPCM Draft1</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=OggPCM_Draft1&amp;diff=2044"/>
		<updated>2005-11-13T21:34:48Z</updated>

		<summary type="html">&lt;p&gt;Jkoleszar: Removed /* Alternative Format */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Warning: OggPCM is currently a topic of [http://lists.xiph.org/pipermail/ogg-dev/2005-November/thread.html heated debate]. The following is *not* the final spec.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== What is it ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;OggPCM&#039;&#039;&#039; is a pulse-code modulation (PCM) audio codec for Ogg.  Similar to Microsoft&#039;s .wav or Apple&#039;s .aiff formats, it&#039;s a simple way to store and transfer uncompressed audio within an Ogg container. For the purposes of this document, the term PCM is used to describe a digital representation of an audio signal, where volume samples are taken at regular uniform intervals and then quantized into a digital (usually binary) code. A more complete definition of PCM and related terminology can be found at [[Wikipedia:Pulse-code_modulation|Wikipedia]].&lt;br /&gt;
&lt;br /&gt;
== Why is it ==&lt;br /&gt;
The intention for this format is as an interchange format, for example for use with [[OggStream]].  It is also useful for storing time-synced decoded audio/video, as opposed to using RIFF/WAV (.wav) and YUV4MPEG (.yuv) in separate files as was done during [[Theora]] development. It is intended to be less complex to use than either RIFF or AIFF&lt;br /&gt;
&lt;br /&gt;
The degenerate stream is a single header packet followed by the raw data packets. While this degenerate stream is not incredibly useful for long term storage or as a general purpose container, it is useful for applications where other data describing the stream is available out of band, for instance amongst cooperating applications in an inter-process communication scheme. Streams providing the extra defined comment packets are intended to be useful for long term storage and communication amongst diverse applications.&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; This is a the current working draft, a compromise between the different promposed elements needed &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Packets are processed as per the value of their first byte.  Packets of unknown ID should be silently ignored, providing a convient way to add future expandability which does not break the data format.  Multibyte fields in the header packets are packed in little endian order.  Multibyte fields in the data packet are packed according to the endian flag in the stream header packet.&lt;br /&gt;
&lt;br /&gt;
An audio frame consists of one sample from each audio channel encoded in sequence.  The granule position specified is the total audio frames in the stream including the last complete packet in a page.  Audio frames must not be split across packets.  The rationale here is that the position specified in the frame header of the last page tells how long the data coded by the bitstream is in samples as well as provides the current stream position to seeking routines.  A truncated stream will still return the proper number of audio frames that can be decoded fully.&lt;br /&gt;
&lt;br /&gt;
An example of how this can be useful is the proposed ReplayGain extension to .wav format: http://replaygain.hydrogenaudio.org/file_format_wav.html&lt;br /&gt;
&lt;br /&gt;
Note that no such extension is planned, nor is the need for a future format forseen, but history has shown that even the most basic formats eventually become obsolete.&lt;br /&gt;
&lt;br /&gt;
 Packet 0, BOS, 12 bytes&lt;br /&gt;
  8  0x00   Stream Header Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;  Codec identifier &lt;br /&gt;
  -&lt;br /&gt;
  8  0x01   Version Major (breaks backwards compatability to increment)&lt;br /&gt;
  8  0x00   Version Minor (backwards compatable, ie, via extended header)&lt;br /&gt;
  8  [int]  Number of Channels (1-256)&lt;br /&gt;
  1  [flg]  False = MSB, True = LSB&lt;br /&gt;
  3  [int]  PCM Data Type (see table below)&lt;br /&gt;
  4  [nil]  Padding to byte, may be used in later minor version&lt;br /&gt;
  -&lt;br /&gt;
 32  [int]  Samplerate (samples/second)&lt;br /&gt;
&lt;br /&gt;
 Comment Header Packet&lt;br /&gt;
  8  0x03   Comment Header Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;  Codec Identifier&lt;br /&gt;
 -- Continues as [[http://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#vorbis-spec-comment|Vorbis&#039;s Comment Header]]&lt;br /&gt;
&lt;br /&gt;
 Data Packet&lt;br /&gt;
  8  0xFF   Data Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;  Codec identifier, pads data to 32-bits&lt;br /&gt;
 ..  [data] variable length pcm data&lt;br /&gt;
&lt;br /&gt;
 PCM Data Type&lt;br /&gt;
 =============&lt;br /&gt;
 ID#  Bits  Type&lt;br /&gt;
  0   8     signed   (char)&lt;br /&gt;
  1   8     unsigned (char)&lt;br /&gt;
  2   16    signed   (short int)&lt;br /&gt;
  3   24    signed   (int + 8bit padding)&lt;br /&gt;
  4   32    signed   (int)&lt;br /&gt;
  5   32    float    (float)&lt;br /&gt;
  6   64    float    (double)&lt;br /&gt;
  7   ?     Extended unsupported by 1.0 software&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Encapsulation in Ogg&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The granulepos of an Ogg page indicates the presentation time of the last presentable element in the last complete packet within that page; for &#039;&#039;&#039;OggPCM&#039;&#039;&#039;, a granule is an audio frame.&lt;br /&gt;
&lt;br /&gt;
Following standard terminology for uncompressed audio, an audio frame is the collection of samples for all channels for a single sampling period. For example, an audio frame for a stereo signal is a pair of sample values for the left and right channels.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Constraints&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Version 1.0 codec software MUST NOT attempt to decode when the Extended (7) Data Type is specified.&lt;br /&gt;
&lt;br /&gt;
* An OggPCM packet MUST NOT be constructed with a partial frame; ie. an audio frame must not span two Ogg packets.&lt;/div&gt;</summary>
		<author><name>Jkoleszar</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=OggPCM_Draft1&amp;diff=2032</id>
		<title>OggPCM Draft1</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=OggPCM_Draft1&amp;diff=2032"/>
		<updated>2005-11-12T14:11:40Z</updated>

		<summary type="html">&lt;p&gt;Jkoleszar: /* Why is it */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is it ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;OggPCM&#039;&#039;&#039; is a pulse-code modulation (PCM) audio codec for Ogg.  Similar to Microsoft&#039;s .wav or Apple&#039;s .aiff formats, it&#039;s a simple way to store and transfer uncompressed audio within an Ogg container. For the purposes of this document, the term PCM is used to describe a digital representation of an audio signal, where volume samples are taken at regular uniform intervals and then quantized into a digital (usually binary) code. A more complete definition of PCM and related terminology can be found at [http://en.wikipedia.org/wiki/Pulse-code_modulation Wikipedia.]&lt;br /&gt;
&lt;br /&gt;
== Why is it ==&lt;br /&gt;
The intention for this format is as an interchange format, for example for use with [[OggStream]].  It is also useful for storing time-synced decoded audio/video, as opposed to using RIFF/WAV (.wav) and YUV4MPEG (.yuv) in separate files as was done during [[Theora]] development. It is intended to be less complex to use than either RIFF or AIFF&lt;br /&gt;
&lt;br /&gt;
The degenerate stream is a single header packet followed by the raw data packets. While this degenerate stream is not incredibly useful for long term storage or as a general purpose container, it is useful for applications where other data describing the stream is available out of band, for instance amongst cooperating applications in an inter-process communication scheme. Streams providing the extra defined comment packets are intended to be useful for long term storage and communication amongst diverse applications.&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; This is a the current working draft, a compromise between the different promposed elements needed &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Packets are processed as per the value of their first byte.  Packets of unknown ID should be silently ignored, providing a convient way to add future expandability which does not break the data format.  Multibyte fields in the header packets are packed in little endian order.  Multibyte fields in the data packet are packed according to the endian flag in the stream header packet.&lt;br /&gt;
&lt;br /&gt;
An audio frame consists of one sample from each audio channel encoded in sequence.  The granule position specified is the total audio frames in the stream including the last complete packet in a page.  Audio frames must not be split across packets.  The rationale here is that the position specified in the frame header of the last page tells how long the data coded by the bitstream is in samples as well as provides the current stream position to seeking routines.  A truncated stream will still return the proper number of audio frames that can be decoded fully.&lt;br /&gt;
&lt;br /&gt;
An example of how this can be useful is the proposed ReplayGain extension to .wav format: http://replaygain.hydrogenaudio.org/file_format_wav.html&lt;br /&gt;
&lt;br /&gt;
Note that no such extension is planned, nor is the need for a future format forseen, but history has shown that even the most basic formats eventually become obsolete.&lt;br /&gt;
&lt;br /&gt;
 Packet 0, BOS, 12 bytes&lt;br /&gt;
  8  0x00   Stream Header Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;  Codec identifier &lt;br /&gt;
  -&lt;br /&gt;
  8  0x01   Version Major (breaks backwards compatability to increment)&lt;br /&gt;
  8  0x00   Version Minor (backwards compatable, ie, via extended header)&lt;br /&gt;
  8  [int]  Number of Channels (1-256)&lt;br /&gt;
  1  [flg]  False = MSB, True = LSB&lt;br /&gt;
  3  [int]  PCM Data Type (see table below)&lt;br /&gt;
  4  [nil]  Padding to byte, may be used in later minor version&lt;br /&gt;
  -&lt;br /&gt;
 32  [int]  Samplerate (samples/second)&lt;br /&gt;
&lt;br /&gt;
 Comment Header Packet&lt;br /&gt;
  8  0x03   Comment Header Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;  Codec Identifier&lt;br /&gt;
 -- Continues as [[http://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#vorbis-spec-comment|Vorbis&#039;s Comment Header]]&lt;br /&gt;
&lt;br /&gt;
 Data Packet&lt;br /&gt;
  8  0xFF   Data Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;  Codec identifier, pads data to 32-bits&lt;br /&gt;
 ..  [data] variable length pcm data&lt;br /&gt;
&lt;br /&gt;
 PCM Data Type&lt;br /&gt;
 =============&lt;br /&gt;
 ID#  Bits  Type&lt;br /&gt;
  0   8     signed   (char)&lt;br /&gt;
  1   8     unsigned (char)&lt;br /&gt;
  2   16    signed   (short int)&lt;br /&gt;
  3   24    signed   (int + 8bit padding)&lt;br /&gt;
  4   32    signed   (int)&lt;br /&gt;
  5   32    float    (float)&lt;br /&gt;
  6   64    float    (double)&lt;br /&gt;
  7   ?     Extended unsupported by 1.0 software&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Encapsulation in Ogg&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The granulepos of an Ogg page indicates the presentation time of the last presentable element in the last complete packet within that page; for &#039;&#039;&#039;OggPCM&#039;&#039;&#039;, a granule is an audio frame.&lt;br /&gt;
&lt;br /&gt;
Following standard terminology for uncompressed audio, an audio frame is the collection of samples for all channels for a single sampling period. For example, an audio frame for a stereo signal is a pair of sample values for the left and right channels.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Constraints&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Version 1.0 codec software MUST NOT attempt to decode when the Extended (7) Data Type is specified.&lt;br /&gt;
&lt;br /&gt;
* An OggPCM packet MUST NOT be constructed with a partial frame; ie. an audio frame must not span two Ogg packets.&lt;br /&gt;
&lt;br /&gt;
== Alternative Format ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This format was written by [[User:Jkoleszar|Jkoleszar]], and has since been combined with other ideas into the primary format (above)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
It is intended to support channels from the same source having different sampling parameters.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Packet structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 Packet 0, BOS, tbd bytes&lt;br /&gt;
  8  0x00       Header Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;      Codec identifier &lt;br /&gt;
  -&lt;br /&gt;
  8  0x01       Version Major (breaks backwards compatability to increment)&lt;br /&gt;
  8  0x00       Version Minor (backwards compatable, ie, via extended header)&lt;br /&gt;
  8  [uint]     Source ID (Unique amongst all OggPCM streams in the physical stream)&lt;br /&gt;
  8  [uint]     Channel Block&lt;br /&gt;
  -&lt;br /&gt;
 16  [bitfield] Indicates which of the 16 channels in this channel block &lt;br /&gt;
                are present in this logical OGGPCM stream.&lt;br /&gt;
  8  [enum]     Sample format (OGGPCM_FMT_U8, OGGPCM_FMT_LE_S16, OGGPCM_FMT_BE_S16, etc) &lt;br /&gt;
 24  [uint]     Sample rate ** this field crosses a 32bit-word barrier **  &lt;br /&gt;
&lt;br /&gt;
 Data Packet&lt;br /&gt;
  8  0xFF       Data Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;      Codec identifier, pads data to 32-bits&lt;br /&gt;
 ..  [data]     variable length pcm data, packing defined by Sample Format field in header&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Sample Format&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 OGG_PCM_S8      = 0x1       /* Signed 8 bit. */&lt;br /&gt;
 OGG_PCM_S16     = 0x2&lt;br /&gt;
 OGG_PCM_S24     = 0x3&lt;br /&gt;
 OGG_PCM_S32     = 0x4&lt;br /&gt;
 OGG_PCM_U8      = 0x5        /* Unsigned 8 bit */&lt;br /&gt;
 OGG_PCM_FLOAT32 = 0x6&lt;br /&gt;
 OGG_PCM_FLOAT64 = 0x7&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Discussion&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This seems to make it easy to support the simple/normal cases and possible to support the pathological cases, for instance:&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;1&amp;quot;&lt;br /&gt;
| Source ID || Channel Bitfield || Sample Rate || Sample Format || Comment&lt;br /&gt;
|-&lt;br /&gt;
| 0x00 || 0000 0000 0000 0011 || 96000 || OGGPCM_FMT_LE_S24 || Front Stereo Pair&lt;br /&gt;
|-&lt;br /&gt;
| 0x00 || 0000 0000 0011 1100 || 44100 || OGGPCM_FMT_LE_S16 || Center And Surrounds&lt;br /&gt;
|-&lt;br /&gt;
| 0x00 || 0000 0000 0010 0000 || 8000 || OGGPCM_FMT_LE_S16 || LFE Channel&lt;br /&gt;
|-&lt;br /&gt;
| 0x01 || 0000 0000 0000 0001 || 8000 || OGGPCM_FMT_U8 || PC Speaker&lt;br /&gt;
|-&lt;br /&gt;
| 0x02 || 0000 0000 0000 0001 || 8000 || OGGPCM_FMT_U8 || Microphone&lt;br /&gt;
|-&lt;br /&gt;
| 0x03 || 0000 0000 0000 0011 || 8000 || OGGPCM_FMT_LE_S16 || Voice Chat&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry in the table is a logical Ogg stream.  [[User:Jkoleszar|Jkoleszar]] is not convinced that the source id and channel block are necessary, but figured he&#039;d throw it out there.&lt;/div&gt;</summary>
		<author><name>Jkoleszar</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=OggPCM_Draft1&amp;diff=2031</id>
		<title>OggPCM Draft1</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=OggPCM_Draft1&amp;diff=2031"/>
		<updated>2005-11-12T13:56:15Z</updated>

		<summary type="html">&lt;p&gt;Jkoleszar: /* Why is it */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is it ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;OggPCM&#039;&#039;&#039; is a pulse-code modulation (PCM) audio codec for Ogg.  Similar to Microsoft&#039;s .wav or Apple&#039;s .aiff formats, it&#039;s a simple way to store and transfer uncompressed audio within an Ogg container. For the purposes of this document, the term PCM is used to describe a digital representation of an audio signal, where volume samples are taken at regular uniform intervals and then quantized into a digital (usually binary) code. A more complete definition of PCM and related terminology can be found at [http://en.wikipedia.org/wiki/Pulse-code_modulation Wikipedia.]&lt;br /&gt;
&lt;br /&gt;
== Why is it ==&lt;br /&gt;
The intention for this format is as an interchange format, for example for use with [[OggStream]].  It is also useful for storing time-synced decoded audio/video, as opposed to using RIFF/WAV (.wav) and YUV4MPEG (.yuv) in separate files as was done during [[Theora]] development. It is intended to be less complex to use than either RIFF or AIFF&lt;br /&gt;
&lt;br /&gt;
What is needed is a header followed by raw PCM data - nothing more complicated.&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; This is a the current working draft, a compromise between the different promposed elements needed &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Packets are processed as per the value of their first byte.  Packets of unknown ID should be silently ignored, providing a convient way to add future expandability which does not break the data format.  Multibyte fields in the header packets are packed in little endian order.  Multibyte fields in the data packet are packed according to the endian flag in the stream header packet.&lt;br /&gt;
&lt;br /&gt;
An audio frame consists of one sample from each audio channel encoded in sequence.  The granule position specified is the total audio frames in the stream including the last complete packet in a page.  Audio frames must not be split across packets.  The rationale here is that the position specified in the frame header of the last page tells how long the data coded by the bitstream is in samples as well as provides the current stream position to seeking routines.  A truncated stream will still return the proper number of audio frames that can be decoded fully.&lt;br /&gt;
&lt;br /&gt;
An example of how this can be useful is the proposed ReplayGain extension to .wav format: http://replaygain.hydrogenaudio.org/file_format_wav.html&lt;br /&gt;
&lt;br /&gt;
Note that no such extension is planned, nor is the need for a future format forseen, but history has shown that even the most basic formats eventually become obsolete.&lt;br /&gt;
&lt;br /&gt;
 Packet 0, BOS, 12 bytes&lt;br /&gt;
  8  0x00   Stream Header Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;  Codec identifier &lt;br /&gt;
  -&lt;br /&gt;
  8  0x01   Version Major (breaks backwards compatability to increment)&lt;br /&gt;
  8  0x00   Version Minor (backwards compatable, ie, via extended header)&lt;br /&gt;
  8  [int]  Number of Channels (1-256)&lt;br /&gt;
  1  [flg]  False = MSB, True = LSB&lt;br /&gt;
  3  [int]  PCM Data Type (see table below)&lt;br /&gt;
  4  [nil]  Padding to byte, may be used in later minor version&lt;br /&gt;
  -&lt;br /&gt;
 32  [int]  Samplerate (samples/second)&lt;br /&gt;
&lt;br /&gt;
 Comment Header Packet&lt;br /&gt;
  8  0x03   Comment Header Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;  Codec Identifier&lt;br /&gt;
 -- Continues as [[http://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#vorbis-spec-comment|Vorbis&#039;s Comment Header]]&lt;br /&gt;
&lt;br /&gt;
 Data Packet&lt;br /&gt;
  8  0xFF   Data Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;  Codec identifier, pads data to 32-bits&lt;br /&gt;
 ..  [data] variable length pcm data&lt;br /&gt;
&lt;br /&gt;
 PCM Data Type&lt;br /&gt;
 =============&lt;br /&gt;
 ID#  Bits  Type&lt;br /&gt;
  0   8     signed   (char)&lt;br /&gt;
  1   8     unsigned (char)&lt;br /&gt;
  2   16    signed   (short int)&lt;br /&gt;
  3   24    signed   (int + 8bit padding)&lt;br /&gt;
  4   32    signed   (int)&lt;br /&gt;
  5   32    float    (float)&lt;br /&gt;
  6   64    float    (double)&lt;br /&gt;
  7   ?     Extended unsupported by 1.0 software&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Encapsulation in Ogg&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The granulepos of an Ogg page indicates the presentation time of the last presentable element in the last complete packet within that page; for &#039;&#039;&#039;OggPCM&#039;&#039;&#039;, a granule is an audio frame.&lt;br /&gt;
&lt;br /&gt;
Following standard terminology for uncompressed audio, an audio frame is the collection of samples for all channels for a single sampling period. For example, an audio frame for a stereo signal is a pair of sample values for the left and right channels.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Constraints&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Version 1.0 codec software MUST NOT attempt to decode when the Extended (7) Data Type is specified.&lt;br /&gt;
&lt;br /&gt;
* An OggPCM packet MUST NOT be constructed with a partial frame; ie. an audio frame must not span two Ogg packets.&lt;br /&gt;
&lt;br /&gt;
== Alternative Format ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This format was written by [[User:Jkoleszar|Jkoleszar]], and has since been combined with other ideas into the primary format (above)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
It is intended to support channels from the same source having different sampling parameters.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Packet structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 Packet 0, BOS, tbd bytes&lt;br /&gt;
  8  0x00       Header Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;      Codec identifier &lt;br /&gt;
  -&lt;br /&gt;
  8  0x01       Version Major (breaks backwards compatability to increment)&lt;br /&gt;
  8  0x00       Version Minor (backwards compatable, ie, via extended header)&lt;br /&gt;
  8  [uint]     Source ID (Unique amongst all OggPCM streams in the physical stream)&lt;br /&gt;
  8  [uint]     Channel Block&lt;br /&gt;
  -&lt;br /&gt;
 16  [bitfield] Indicates which of the 16 channels in this channel block &lt;br /&gt;
                are present in this logical OGGPCM stream.&lt;br /&gt;
  8  [enum]     Sample format (OGGPCM_FMT_U8, OGGPCM_FMT_LE_S16, OGGPCM_FMT_BE_S16, etc) &lt;br /&gt;
 24  [uint]     Sample rate ** this field crosses a 32bit-word barrier **  &lt;br /&gt;
&lt;br /&gt;
 Data Packet&lt;br /&gt;
  8  0xFF       Data Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;      Codec identifier, pads data to 32-bits&lt;br /&gt;
 ..  [data]     variable length pcm data, packing defined by Sample Format field in header&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Sample Format&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 OGG_PCM_S8      = 0x1       /* Signed 8 bit. */&lt;br /&gt;
 OGG_PCM_S16     = 0x2&lt;br /&gt;
 OGG_PCM_S24     = 0x3&lt;br /&gt;
 OGG_PCM_S32     = 0x4&lt;br /&gt;
 OGG_PCM_U8      = 0x5        /* Unsigned 8 bit */&lt;br /&gt;
 OGG_PCM_FLOAT32 = 0x6&lt;br /&gt;
 OGG_PCM_FLOAT64 = 0x7&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Discussion&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This seems to make it easy to support the simple/normal cases and possible to support the pathological cases, for instance:&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;1&amp;quot;&lt;br /&gt;
| Source ID || Channel Bitfield || Sample Rate || Sample Format || Comment&lt;br /&gt;
|-&lt;br /&gt;
| 0x00 || 0000 0000 0000 0011 || 96000 || OGGPCM_FMT_LE_S24 || Front Stereo Pair&lt;br /&gt;
|-&lt;br /&gt;
| 0x00 || 0000 0000 0011 1100 || 44100 || OGGPCM_FMT_LE_S16 || Center And Surrounds&lt;br /&gt;
|-&lt;br /&gt;
| 0x00 || 0000 0000 0010 0000 || 8000 || OGGPCM_FMT_LE_S16 || LFE Channel&lt;br /&gt;
|-&lt;br /&gt;
| 0x01 || 0000 0000 0000 0001 || 8000 || OGGPCM_FMT_U8 || PC Speaker&lt;br /&gt;
|-&lt;br /&gt;
| 0x02 || 0000 0000 0000 0001 || 8000 || OGGPCM_FMT_U8 || Microphone&lt;br /&gt;
|-&lt;br /&gt;
| 0x03 || 0000 0000 0000 0011 || 8000 || OGGPCM_FMT_LE_S16 || Voice Chat&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry in the table is a logical Ogg stream.  [[User:Jkoleszar|Jkoleszar]] is not convinced that the source id and channel block are necessary, but figured he&#039;d throw it out there.&lt;/div&gt;</summary>
		<author><name>Jkoleszar</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=OggPCM_Draft1&amp;diff=2030</id>
		<title>OggPCM Draft1</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=OggPCM_Draft1&amp;diff=2030"/>
		<updated>2005-11-12T13:51:04Z</updated>

		<summary type="html">&lt;p&gt;Jkoleszar: /* What is it */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is it ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;OggPCM&#039;&#039;&#039; is a pulse-code modulation (PCM) audio codec for Ogg.  Similar to Microsoft&#039;s .wav or Apple&#039;s .aiff formats, it&#039;s a simple way to store and transfer uncompressed audio within an Ogg container. For the purposes of this document, the term PCM is used to describe a digital representation of an audio signal, where volume samples are taken at regular uniform intervals and then quantized into a digital (usually binary) code. A more complete definition of PCM and related terminology can be found at [http://en.wikipedia.org/wiki/Pulse-code_modulation Wikipedia.]&lt;br /&gt;
&lt;br /&gt;
== Why is it ==&lt;br /&gt;
The intention for this format is as an interchange format, for example for use with [[OggStream]].  It is also useful for storing time-synced decoded audio/video, as opposed to using RIFF/WAV (.wav) and YUV4MPEG (.yuv) in separate files as was done during [[Theora]] development.&lt;br /&gt;
&lt;br /&gt;
It is also less complex than either .wav (RIFF) or .aiff (AIFF), both of these formats being designed for generic multimedia (audio, video, etc).  Full compatability with these formats includes support for non-PCM data.&lt;br /&gt;
&lt;br /&gt;
Using raw PCM data, on the other hand, doesn&#039;t give that all-important header which carries information about the number of channels, sample width, and sample frequency.  So what is needed is a header followed by raw PCM data - nothing more complicated.&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; This is a the current working draft, a compromise between the different promposed elements needed &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Packets are processed as per the value of their first byte.  Packets of unknown ID should be silently ignored, providing a convient way to add future expandability which does not break the data format.  Multibyte fields in the header packets are packed in little endian order.  Multibyte fields in the data packet are packed according to the endian flag in the stream header packet.&lt;br /&gt;
&lt;br /&gt;
An audio frame consists of one sample from each audio channel encoded in sequence.  The granule position specified is the total audio frames in the stream including the last complete packet in a page.  Audio frames must not be split across packets.  The rationale here is that the position specified in the frame header of the last page tells how long the data coded by the bitstream is in samples as well as provides the current stream position to seeking routines.  A truncated stream will still return the proper number of audio frames that can be decoded fully.&lt;br /&gt;
&lt;br /&gt;
An example of how this can be useful is the proposed ReplayGain extension to .wav format: http://replaygain.hydrogenaudio.org/file_format_wav.html&lt;br /&gt;
&lt;br /&gt;
Note that no such extension is planned, nor is the need for a future format forseen, but history has shown that even the most basic formats eventually become obsolete.&lt;br /&gt;
&lt;br /&gt;
 Packet 0, BOS, 12 bytes&lt;br /&gt;
  8  0x00   Stream Header Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;  Codec identifier &lt;br /&gt;
  -&lt;br /&gt;
  8  0x01   Version Major (breaks backwards compatability to increment)&lt;br /&gt;
  8  0x00   Version Minor (backwards compatable, ie, via extended header)&lt;br /&gt;
  8  [int]  Number of Channels (1-256)&lt;br /&gt;
  1  [flg]  False = MSB, True = LSB&lt;br /&gt;
  3  [int]  PCM Data Type (see table below)&lt;br /&gt;
  4  [nil]  Padding to byte, may be used in later minor version&lt;br /&gt;
  -&lt;br /&gt;
 32  [int]  Samplerate (samples/second)&lt;br /&gt;
&lt;br /&gt;
 Comment Header Packet&lt;br /&gt;
  8  0x03   Comment Header Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;  Codec Identifier&lt;br /&gt;
 -- Continues as [[http://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#vorbis-spec-comment|Vorbis&#039;s Comment Header]]&lt;br /&gt;
&lt;br /&gt;
 Data Packet&lt;br /&gt;
  8  0xFF   Data Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;  Codec identifier, pads data to 32-bits&lt;br /&gt;
 ..  [data] variable length pcm data&lt;br /&gt;
&lt;br /&gt;
 PCM Data Type&lt;br /&gt;
 =============&lt;br /&gt;
 ID#  Bits  Type&lt;br /&gt;
  0   8     signed   (char)&lt;br /&gt;
  1   8     unsigned (char)&lt;br /&gt;
  2   16    signed   (short int)&lt;br /&gt;
  3   24    signed   (int + 8bit padding)&lt;br /&gt;
  4   32    signed   (int)&lt;br /&gt;
  5   32    float    (float)&lt;br /&gt;
  6   64    float    (double)&lt;br /&gt;
  7   ?     Extended unsupported by 1.0 software&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Encapsulation in Ogg&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The granulepos of an Ogg page indicates the presentation time of the last presentable element in the last complete packet within that page; for &#039;&#039;&#039;OggPCM&#039;&#039;&#039;, a granule is an audio frame.&lt;br /&gt;
&lt;br /&gt;
Following standard terminology for uncompressed audio, an audio frame is the collection of samples for all channels for a single sampling period. For example, an audio frame for a stereo signal is a pair of sample values for the left and right channels.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Constraints&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Version 1.0 codec software MUST NOT attempt to decode when the Extended (7) Data Type is specified.&lt;br /&gt;
&lt;br /&gt;
* An OggPCM packet MUST NOT be constructed with a partial frame; ie. an audio frame must not span two Ogg packets.&lt;br /&gt;
&lt;br /&gt;
== Alternative Format ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This format was written by [[User:Jkoleszar|Jkoleszar]], and has since been combined with other ideas into the primary format (above)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
It is intended to support channels from the same source having different sampling parameters.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Packet structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 Packet 0, BOS, tbd bytes&lt;br /&gt;
  8  0x00       Header Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;      Codec identifier &lt;br /&gt;
  -&lt;br /&gt;
  8  0x01       Version Major (breaks backwards compatability to increment)&lt;br /&gt;
  8  0x00       Version Minor (backwards compatable, ie, via extended header)&lt;br /&gt;
  8  [uint]     Source ID (Unique amongst all OggPCM streams in the physical stream)&lt;br /&gt;
  8  [uint]     Channel Block&lt;br /&gt;
  -&lt;br /&gt;
 16  [bitfield] Indicates which of the 16 channels in this channel block &lt;br /&gt;
                are present in this logical OGGPCM stream.&lt;br /&gt;
  8  [enum]     Sample format (OGGPCM_FMT_U8, OGGPCM_FMT_LE_S16, OGGPCM_FMT_BE_S16, etc) &lt;br /&gt;
 24  [uint]     Sample rate ** this field crosses a 32bit-word barrier **  &lt;br /&gt;
&lt;br /&gt;
 Data Packet&lt;br /&gt;
  8  0xFF       Data Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;      Codec identifier, pads data to 32-bits&lt;br /&gt;
 ..  [data]     variable length pcm data, packing defined by Sample Format field in header&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Sample Format&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 OGG_PCM_S8      = 0x1       /* Signed 8 bit. */&lt;br /&gt;
 OGG_PCM_S16     = 0x2&lt;br /&gt;
 OGG_PCM_S24     = 0x3&lt;br /&gt;
 OGG_PCM_S32     = 0x4&lt;br /&gt;
 OGG_PCM_U8      = 0x5        /* Unsigned 8 bit */&lt;br /&gt;
 OGG_PCM_FLOAT32 = 0x6&lt;br /&gt;
 OGG_PCM_FLOAT64 = 0x7&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Discussion&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This seems to make it easy to support the simple/normal cases and possible to support the pathological cases, for instance:&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;1&amp;quot;&lt;br /&gt;
| Source ID || Channel Bitfield || Sample Rate || Sample Format || Comment&lt;br /&gt;
|-&lt;br /&gt;
| 0x00 || 0000 0000 0000 0011 || 96000 || OGGPCM_FMT_LE_S24 || Front Stereo Pair&lt;br /&gt;
|-&lt;br /&gt;
| 0x00 || 0000 0000 0011 1100 || 44100 || OGGPCM_FMT_LE_S16 || Center And Surrounds&lt;br /&gt;
|-&lt;br /&gt;
| 0x00 || 0000 0000 0010 0000 || 8000 || OGGPCM_FMT_LE_S16 || LFE Channel&lt;br /&gt;
|-&lt;br /&gt;
| 0x01 || 0000 0000 0000 0001 || 8000 || OGGPCM_FMT_U8 || PC Speaker&lt;br /&gt;
|-&lt;br /&gt;
| 0x02 || 0000 0000 0000 0001 || 8000 || OGGPCM_FMT_U8 || Microphone&lt;br /&gt;
|-&lt;br /&gt;
| 0x03 || 0000 0000 0000 0011 || 8000 || OGGPCM_FMT_LE_S16 || Voice Chat&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry in the table is a logical Ogg stream.  [[User:Jkoleszar|Jkoleszar]] is not convinced that the source id and channel block are necessary, but figured he&#039;d throw it out there.&lt;/div&gt;</summary>
		<author><name>Jkoleszar</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=OggPCM_Draft1&amp;diff=2029</id>
		<title>OggPCM Draft1</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=OggPCM_Draft1&amp;diff=2029"/>
		<updated>2005-11-12T13:48:18Z</updated>

		<summary type="html">&lt;p&gt;Jkoleszar: /* What is it */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is it ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;OggPCM&#039;&#039;&#039; is a pulse-code modulation (PCM) audio codec for Ogg.  Similar to Microsoft&#039;s .wav or Apple&#039;s .aiff formats, it&#039;s a simple way to store and transfer uncompressed audio within an Ogg container. For the purposes of this document, the term PCM is used to describe a digital representation of an audio signal, where volume samples are taken at regular uniform intervals and then quantized into a digital (usually binary) code. A more complete definition of PCM and related terminology can be found at [http://en.wikipedia.org/wiki/Pulse-code_modulation link Wikipedia.]&lt;br /&gt;
&lt;br /&gt;
== Why is it ==&lt;br /&gt;
The intention for this format is as an interchange format, for example for use with [[OggStream]].  It is also useful for storing time-synced decoded audio/video, as opposed to using RIFF/WAV (.wav) and YUV4MPEG (.yuv) in separate files as was done during [[Theora]] development.&lt;br /&gt;
&lt;br /&gt;
It is also less complex than either .wav (RIFF) or .aiff (AIFF), both of these formats being designed for generic multimedia (audio, video, etc).  Full compatability with these formats includes support for non-PCM data.&lt;br /&gt;
&lt;br /&gt;
Using raw PCM data, on the other hand, doesn&#039;t give that all-important header which carries information about the number of channels, sample width, and sample frequency.  So what is needed is a header followed by raw PCM data - nothing more complicated.&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039; This is a the current working draft, a compromise between the different promposed elements needed &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Packets are processed as per the value of their first byte.  Packets of unknown ID should be silently ignored, providing a convient way to add future expandability which does not break the data format.  Multibyte fields in the header packets are packed in little endian order.  Multibyte fields in the data packet are packed according to the endian flag in the stream header packet.&lt;br /&gt;
&lt;br /&gt;
An audio frame consists of one sample from each audio channel encoded in sequence.  The granule position specified is the total audio frames in the stream including the last complete packet in a page.  Audio frames must not be split across packets.  The rationale here is that the position specified in the frame header of the last page tells how long the data coded by the bitstream is in samples as well as provides the current stream position to seeking routines.  A truncated stream will still return the proper number of audio frames that can be decoded fully.&lt;br /&gt;
&lt;br /&gt;
An example of how this can be useful is the proposed ReplayGain extension to .wav format: http://replaygain.hydrogenaudio.org/file_format_wav.html&lt;br /&gt;
&lt;br /&gt;
Note that no such extension is planned, nor is the need for a future format forseen, but history has shown that even the most basic formats eventually become obsolete.&lt;br /&gt;
&lt;br /&gt;
 Packet 0, BOS, 12 bytes&lt;br /&gt;
  8  0x00   Stream Header Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;  Codec identifier &lt;br /&gt;
  -&lt;br /&gt;
  8  0x01   Version Major (breaks backwards compatability to increment)&lt;br /&gt;
  8  0x00   Version Minor (backwards compatable, ie, via extended header)&lt;br /&gt;
  8  [int]  Number of Channels (1-256)&lt;br /&gt;
  1  [flg]  False = MSB, True = LSB&lt;br /&gt;
  3  [int]  PCM Data Type (see table below)&lt;br /&gt;
  4  [nil]  Padding to byte, may be used in later minor version&lt;br /&gt;
  -&lt;br /&gt;
 32  [int]  Samplerate (samples/second)&lt;br /&gt;
&lt;br /&gt;
 Comment Header Packet&lt;br /&gt;
  8  0x03   Comment Header Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;  Codec Identifier&lt;br /&gt;
 -- Continues as [[http://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#vorbis-spec-comment|Vorbis&#039;s Comment Header]]&lt;br /&gt;
&lt;br /&gt;
 Data Packet&lt;br /&gt;
  8  0xFF   Data Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;  Codec identifier, pads data to 32-bits&lt;br /&gt;
 ..  [data] variable length pcm data&lt;br /&gt;
&lt;br /&gt;
 PCM Data Type&lt;br /&gt;
 =============&lt;br /&gt;
 ID#  Bits  Type&lt;br /&gt;
  0   8     signed   (char)&lt;br /&gt;
  1   8     unsigned (char)&lt;br /&gt;
  2   16    signed   (short int)&lt;br /&gt;
  3   24    signed   (int + 8bit padding)&lt;br /&gt;
  4   32    signed   (int)&lt;br /&gt;
  5   32    float    (float)&lt;br /&gt;
  6   64    float    (double)&lt;br /&gt;
  7   ?     Extended unsupported by 1.0 software&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Encapsulation in Ogg&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The granulepos of an Ogg page indicates the presentation time of the last presentable element in the last complete packet within that page; for &#039;&#039;&#039;OggPCM&#039;&#039;&#039;, a granule is an audio frame.&lt;br /&gt;
&lt;br /&gt;
Following standard terminology for uncompressed audio, an audio frame is the collection of samples for all channels for a single sampling period. For example, an audio frame for a stereo signal is a pair of sample values for the left and right channels.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Constraints&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Version 1.0 codec software MUST NOT attempt to decode when the Extended (7) Data Type is specified.&lt;br /&gt;
&lt;br /&gt;
* An OggPCM packet MUST NOT be constructed with a partial frame; ie. an audio frame must not span two Ogg packets.&lt;br /&gt;
&lt;br /&gt;
== Alternative Format ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This format was written by [[User:Jkoleszar|Jkoleszar]], and has since been combined with other ideas into the primary format (above)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
It is intended to support channels from the same source having different sampling parameters.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Packet structure&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 Packet 0, BOS, tbd bytes&lt;br /&gt;
  8  0x00       Header Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;      Codec identifier &lt;br /&gt;
  -&lt;br /&gt;
  8  0x01       Version Major (breaks backwards compatability to increment)&lt;br /&gt;
  8  0x00       Version Minor (backwards compatable, ie, via extended header)&lt;br /&gt;
  8  [uint]     Source ID (Unique amongst all OggPCM streams in the physical stream)&lt;br /&gt;
  8  [uint]     Channel Block&lt;br /&gt;
  -&lt;br /&gt;
 16  [bitfield] Indicates which of the 16 channels in this channel block &lt;br /&gt;
                are present in this logical OGGPCM stream.&lt;br /&gt;
  8  [enum]     Sample format (OGGPCM_FMT_U8, OGGPCM_FMT_LE_S16, OGGPCM_FMT_BE_S16, etc) &lt;br /&gt;
 24  [uint]     Sample rate ** this field crosses a 32bit-word barrier **  &lt;br /&gt;
&lt;br /&gt;
 Data Packet&lt;br /&gt;
  8  0xFF       Data Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;      Codec identifier, pads data to 32-bits&lt;br /&gt;
 ..  [data]     variable length pcm data, packing defined by Sample Format field in header&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Sample Format&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
 OGG_PCM_S8      = 0x1       /* Signed 8 bit. */&lt;br /&gt;
 OGG_PCM_S16     = 0x2&lt;br /&gt;
 OGG_PCM_S24     = 0x3&lt;br /&gt;
 OGG_PCM_S32     = 0x4&lt;br /&gt;
 OGG_PCM_U8      = 0x5        /* Unsigned 8 bit */&lt;br /&gt;
 OGG_PCM_FLOAT32 = 0x6&lt;br /&gt;
 OGG_PCM_FLOAT64 = 0x7&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Discussion&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This seems to make it easy to support the simple/normal cases and possible to support the pathological cases, for instance:&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;1&amp;quot;&lt;br /&gt;
| Source ID || Channel Bitfield || Sample Rate || Sample Format || Comment&lt;br /&gt;
|-&lt;br /&gt;
| 0x00 || 0000 0000 0000 0011 || 96000 || OGGPCM_FMT_LE_S24 || Front Stereo Pair&lt;br /&gt;
|-&lt;br /&gt;
| 0x00 || 0000 0000 0011 1100 || 44100 || OGGPCM_FMT_LE_S16 || Center And Surrounds&lt;br /&gt;
|-&lt;br /&gt;
| 0x00 || 0000 0000 0010 0000 || 8000 || OGGPCM_FMT_LE_S16 || LFE Channel&lt;br /&gt;
|-&lt;br /&gt;
| 0x01 || 0000 0000 0000 0001 || 8000 || OGGPCM_FMT_U8 || PC Speaker&lt;br /&gt;
|-&lt;br /&gt;
| 0x02 || 0000 0000 0000 0001 || 8000 || OGGPCM_FMT_U8 || Microphone&lt;br /&gt;
|-&lt;br /&gt;
| 0x03 || 0000 0000 0000 0011 || 8000 || OGGPCM_FMT_LE_S16 || Voice Chat&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry in the table is a logical Ogg stream.  [[User:Jkoleszar|Jkoleszar]] is not convinced that the source id and channel block are necessary, but figured he&#039;d throw it out there.&lt;/div&gt;</summary>
		<author><name>Jkoleszar</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=OggYUV&amp;diff=3027</id>
		<title>OggYUV</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=OggYUV&amp;diff=3027"/>
		<updated>2005-11-10T19:47:05Z</updated>

		<summary type="html">&lt;p&gt;Jkoleszar: /* John&amp;#039;s Draft */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is it ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;OggYUV&#039;&#039;&#039; is an uncompressed YUV (YCbCr) video codec for Ogg.  It&#039;s a simple way to store and transfer uncompressed video within an Ogg container.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Why is it ==&lt;br /&gt;
&lt;br /&gt;
The purpose of &#039;&#039;&#039;OggYUV&#039;&#039;&#039; is as a raw video interchange format within [[OggStream]] and other media frameworks.  The format design is to be simple, complete, and efficient enough to be reasonably used to export decoded video to a media player for display.&lt;br /&gt;
&lt;br /&gt;
It can also replace our dependence on yuv4mpeg2 for lossless video storage, which Ogg [[Theora]] originally used as an encoding source.  The main advantage over yuv4mpeg2 files is that, within an Ogg container, it can be time-synced with [[OggPCM]] in a much more reliable way than yuv4mpeg2 + wav audio.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
Packets are processed as per the value of their first byte.  Packets of unknown ID should be silently ignored, providing a convient way to add future expandability which does not break the data format.  Additional data in packet 0 (the header packet) must also be silently ignored.&lt;br /&gt;
&lt;br /&gt;
=== Arc&#039;s Draft ===&lt;br /&gt;
 Packet 0, BOS, 24 bytes&lt;br /&gt;
  8  0x00   Header Packet ID&lt;br /&gt;
 24  &amp;quot;YUV&amp;quot;  Codec identifier &lt;br /&gt;
 --&lt;br /&gt;
  8  0x01   Version Major (breaks backwards compatability to increment)&lt;br /&gt;
  8  0x00   Version Minor (backwards compatable, ie, via extended header)&lt;br /&gt;
  1  [flg]  Color (false = B/W, next 8 bits and must be null)&lt;br /&gt;
  3  [int]  Chroma Pixel &amp;quot;Shape&amp;quot; (see [[Talk:OggYUV#Chroma_Subsampling_Methods|Draft Table]])&lt;br /&gt;
  1  [flg]  50% physical horizontal offset for Cr samples&lt;br /&gt;
  1  [flg]  50% physical verticle offset for Cr samples&lt;br /&gt;
  2  [int]  Chroma blending: 0=None, 1=UpperLeft Sampled/Blend Others, 2=Blend All&lt;br /&gt;
  1  [flg]  Packed (false = Planar, next 2 bits must be null)&lt;br /&gt;
  1  [flg]  Cr Staggered Horizontally in Bytestream&lt;br /&gt;
  1  [flg]  Cr Staggered Vertically in Bytestream&lt;br /&gt;
  1  [flg]  Big Endian/LSB (false = Little Endian/MSB)&lt;br /&gt;
  1  [flg]  Interlaced (false = Progressive)&lt;br /&gt;
  3  ?????  Interlace Options, other bytestream options&lt;br /&gt;
  --&lt;br /&gt;
  8  [int]  Alpha channel bpp&lt;br /&gt;
  8  [int]  Luma channel bpp&lt;br /&gt;
  8  [int]  Chroma channels bpp&lt;br /&gt;
  8  [int]  Colorspace (same as in [[theora]])&lt;br /&gt;
 --&lt;br /&gt;
 24  [int]  Frame Width&lt;br /&gt;
 24  [int]  Frame Height&lt;br /&gt;
 24  [int]  Aspect Numerator&lt;br /&gt;
 24  [int]  Aspect Denominator&lt;br /&gt;
 --&lt;br /&gt;
 32  [int]  Framerate Numerator&lt;br /&gt;
 32  [int]  Framerate Denominator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Data Packet&lt;br /&gt;
  8  0xFF       Data Packet ID&lt;br /&gt;
 24  &amp;quot;YUV&amp;quot;      Codec identifier, pads data to 32-bits&lt;br /&gt;
 ..  [data]     variable length packed [a]rgb frame&lt;br /&gt;
&lt;br /&gt;
=== John&#039;s Draft ===&lt;br /&gt;
This stream format is field based, rather than frame based. It supports only two fields per frame, and one field per data packet. Fields are stored in temporal order, so granulepos maintains its temporal significance.&lt;br /&gt;
&lt;br /&gt;
 Packet 0, BOS, 72 bytes&lt;br /&gt;
  8  0x00   Header Packet ID&lt;br /&gt;
 24  &amp;quot;UVS&amp;quot;  Codec identifier (uncompressed video stream)&lt;br /&gt;
  8  0x01   Version Major (breaks backwards compatability to increment)&lt;br /&gt;
  8  0x00   Version Minor (backwards compatable, ie, via extended header)&lt;br /&gt;
 ---- Video description ----&lt;br /&gt;
  8  [bits] Reserved 1&lt;br /&gt;
  8  [enum] Colorspace&lt;br /&gt;
 16  [uint] Display Width&lt;br /&gt;
 16  [uint] Display Height&lt;br /&gt;
 16  [uint] Frame Aspect Ratio Numerator&lt;br /&gt;
 16  [uint] Frame Aspect Ratio Denomonator&lt;br /&gt;
 16  [uint] Field Rate Numerator&lt;br /&gt;
 16  [uint] Field Rate Denomonator&lt;br /&gt;
 32  [uint] FourCC (optional, set to zero if N/A or unknown)&lt;br /&gt;
 ---- Sampling description ----&lt;br /&gt;
 16  [uint] Stored Width&lt;br /&gt;
 16  [uint] Stored Height&lt;br /&gt;
 14  [uint] Reserved 2&lt;br /&gt;
  1  [uint] Endianness Flag&lt;br /&gt;
  1  [uint] Interlaced Flag&lt;br /&gt;
  2  [uint] U Channel Horiz. (X) Samples/Macropixel, 0 = 4.&lt;br /&gt;
  2  [uint] U Channel Vert. (Y) Samples/Macropixel, 0 = 4.&lt;br /&gt;
  2  [uint] V Channel Horiz. (X) Samples/Macropixel, 0 = 4.&lt;br /&gt;
  2  [uint] V Channel Vert. (Y) Samples/Macropixel, 0 = 4.&lt;br /&gt;
  1  [uint] Top Field U Channel Horiz. Sample Offset Flag&lt;br /&gt;
  1  [uint] Bot Field U Channel Horiz. Sample Offset Flag&lt;br /&gt;
  1  [uint] Top Field U Channel Vert. Sample Offset Flag&lt;br /&gt;
  1  [uint] Bot Field U Channel Vert. Sample Offset Flag&lt;br /&gt;
  1  [uint] Top Field V Channel Horiz. Sample Offset Flag&lt;br /&gt;
  1  [uint] Bot Field V Channel Horiz. Sample Offset Flag&lt;br /&gt;
  1  [uint] Top Field V Channel Vert. Sample Offset Flag&lt;br /&gt;
  1  [uint] Bot Field V Channel Vert. Sample Offset Flag&lt;br /&gt;
  ---- Storage description ----&lt;br /&gt;
  8  [uint] A Channel Bits Per Sample&lt;br /&gt;
  8  [uint] Y/R Channel Bits Per Sample&lt;br /&gt;
  8  [uint] U/G Channel Bits Per Sample&lt;br /&gt;
  8  [uint] V/B Channel Bits Per Sample&lt;br /&gt;
 32  [uint] A Channel Data Offset (in bits)&lt;br /&gt;
 32  [uint] Y/R Channel Data Offset (in bits)&lt;br /&gt;
 32  [uint] U/G Channel Data Offset (in bits)&lt;br /&gt;
 32  [uint] V/B Channel Data Offset (in bits)&lt;br /&gt;
 32  [ int] A Channel Y Stride (in bits)&lt;br /&gt;
 32  [ int] Y/R Channel Y Stride (in bits)&lt;br /&gt;
 32  [ int] U/G Channel Y Stride (in bits)&lt;br /&gt;
 32  [ int] V/B Channel Y Stride (in bits)&lt;br /&gt;
  8  [ int] A Channel X Stride (in bits)&lt;br /&gt;
  8  [ int] Y/R Channel X Stride (in bits)&lt;br /&gt;
  8  [ int] U/G Channel X Stride (in bits)&lt;br /&gt;
  8  [ int] V/B Channel X Stride (in bits)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Data Packets&#039;&#039;&#039;&lt;br /&gt;
  8  0xFF       Top Field Packet ID&lt;br /&gt;
 24  &amp;quot;UVS&amp;quot;      Codec identifier, pads data to 32-bits&lt;br /&gt;
 ..  [data]     variable length packed field&lt;br /&gt;
&lt;br /&gt;
  8  0xFB       Bottom Field Packet ID&lt;br /&gt;
 24  &amp;quot;UVS&amp;quot;      Codec identifier, pads data to 32-bits&lt;br /&gt;
 ..  [data]     variable length packed field&lt;/div&gt;</summary>
		<author><name>Jkoleszar</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=OggYUV&amp;diff=1990</id>
		<title>OggYUV</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=OggYUV&amp;diff=1990"/>
		<updated>2005-11-10T19:29:01Z</updated>

		<summary type="html">&lt;p&gt;Jkoleszar: /* John&amp;#039;s Draft */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is it ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;OggYUV&#039;&#039;&#039; is an uncompressed YUV (YCbCr) video codec for Ogg.  It&#039;s a simple way to store and transfer uncompressed video within an Ogg container.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Why is it ==&lt;br /&gt;
&lt;br /&gt;
The purpose of &#039;&#039;&#039;OggYUV&#039;&#039;&#039; is as a raw video interchange format within [[OggStream]] and other media frameworks.  The format design is to be simple, complete, and efficient enough to be reasonably used to export decoded video to a media player for display.&lt;br /&gt;
&lt;br /&gt;
It can also replace our dependence on yuv4mpeg2 for lossless video storage, which Ogg [[Theora]] originally used as an encoding source.  The main advantage over yuv4mpeg2 files is that, within an Ogg container, it can be time-synced with [[OggPCM]] in a much more reliable way than yuv4mpeg2 + wav audio.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
Packets are processed as per the value of their first byte.  Packets of unknown ID should be silently ignored, providing a convient way to add future expandability which does not break the data format.  Additional data in packet 0 (the header packet) must also be silently ignored.&lt;br /&gt;
&lt;br /&gt;
=== Arc&#039;s Draft ===&lt;br /&gt;
 Packet 0, BOS, 24 bytes&lt;br /&gt;
  8  0x00   Header Packet ID&lt;br /&gt;
 24  &amp;quot;YUV&amp;quot;  Codec identifier &lt;br /&gt;
 --&lt;br /&gt;
  8  0x01   Version Major (breaks backwards compatability to increment)&lt;br /&gt;
  8  0x00   Version Minor (backwards compatable, ie, via extended header)&lt;br /&gt;
  1  [flg]  Color (false = B/W, next 8 bits and must be null)&lt;br /&gt;
  3  [int]  Chroma Pixel &amp;quot;Shape&amp;quot; (see [[Talk:OggYUV#Chroma_Subsampling_Methods|Draft Table]])&lt;br /&gt;
  1  [flg]  50% physical horizontal offset for Cr samples&lt;br /&gt;
  1  [flg]  50% physical verticle offset for Cr samples&lt;br /&gt;
  2  [int]  Chroma blending: 0=None, 1=UpperLeft Sampled/Blend Others, 2=Blend All&lt;br /&gt;
  1  [flg]  Packed (false = Planar, next 2 bits must be null)&lt;br /&gt;
  1  [flg]  Cr Staggered Horizontally in Bytestream&lt;br /&gt;
  1  [flg]  Cr Staggered Vertically in Bytestream&lt;br /&gt;
  1  [flg]  Big Endian/LSB (false = Little Endian/MSB)&lt;br /&gt;
  1  [flg]  Interlaced (false = Progressive)&lt;br /&gt;
  3  ?????  Interlace Options, other bytestream options&lt;br /&gt;
  --&lt;br /&gt;
  8  [int]  Alpha channel bpp&lt;br /&gt;
  8  [int]  Luma channel bpp&lt;br /&gt;
  8  [int]  Chroma channels bpp&lt;br /&gt;
  8  [int]  Colorspace (same as in [[theora]])&lt;br /&gt;
 --&lt;br /&gt;
 24  [int]  Frame Width&lt;br /&gt;
 24  [int]  Frame Height&lt;br /&gt;
 24  [int]  Aspect Numerator&lt;br /&gt;
 24  [int]  Aspect Denominator&lt;br /&gt;
 --&lt;br /&gt;
 32  [int]  Framerate Numerator&lt;br /&gt;
 32  [int]  Framerate Denominator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Data Packet&lt;br /&gt;
  8  0xFF       Data Packet ID&lt;br /&gt;
 24  &amp;quot;YUV&amp;quot;      Codec identifier, pads data to 32-bits&lt;br /&gt;
 ..  [data]     variable length packed [a]rgb frame&lt;br /&gt;
&lt;br /&gt;
=== John&#039;s Draft ===&lt;br /&gt;
This stream format is field based, rather than frame based. It supports only two fields per frame, and one field per data packet. Fields are stored in temporal order, so granulepos maintains its temporal significance.&lt;br /&gt;
&lt;br /&gt;
 Packet 0, BOS, 72 bytes&lt;br /&gt;
  8  0x00   Header Packet ID&lt;br /&gt;
 24  &amp;quot;UVS&amp;quot;  Codec identifier (uncompressed video stream)&lt;br /&gt;
  8  0x01   Version Major (breaks backwards compatability to increment)&lt;br /&gt;
  8  0x00   Version Minor (backwards compatable, ie, via extended header)&lt;br /&gt;
 ---- Video description ----&lt;br /&gt;
  8  [bits] Reserved 1&lt;br /&gt;
  8  [enum] Colorspace&lt;br /&gt;
 16  [uint] Display Width&lt;br /&gt;
 16  [uint] Display Height&lt;br /&gt;
 16  [uint] Frame Aspect Ratio Numerator&lt;br /&gt;
 16  [uint] Frame Aspect Ratio Denomonator&lt;br /&gt;
 16  [uint] Field Rate Numerator&lt;br /&gt;
 16  [uint] Field Rate Denomonator&lt;br /&gt;
 32  [uint] FourCC (optional, set to zero if N/A or unknown)&lt;br /&gt;
 ---- Sampling description ----&lt;br /&gt;
 16  [uint] Stored Width&lt;br /&gt;
 16  [uint] Stored Height&lt;br /&gt;
 15  [uint] Reserved 2&lt;br /&gt;
  1  [uint] Interlaced Flag&lt;br /&gt;
  2  [uint] U Channel Horiz. (X) Samples/Macropixel, 0 = 4.&lt;br /&gt;
  2  [uint] U Channel Vert. (Y) Samples/Macropixel, 0 = 4.&lt;br /&gt;
  2  [uint] V Channel Horiz. (X) Samples/Macropixel, 0 = 4.&lt;br /&gt;
  2  [uint] V Channel Vert. (Y) Samples/Macropixel, 0 = 4.&lt;br /&gt;
  1  [uint] Top Field U Channel Horiz. Sample Offset Flag&lt;br /&gt;
  1  [uint] Bot Field U Channel Horiz. Sample Offset Flag&lt;br /&gt;
  1  [uint] Top Field U Channel Vert. Sample Offset Flag&lt;br /&gt;
  1  [uint] Bot Field U Channel Vert. Sample Offset Flag&lt;br /&gt;
  1  [uint] Top Field V Channel Horiz. Sample Offset Flag&lt;br /&gt;
  1  [uint] Bot Field V Channel Horiz. Sample Offset Flag&lt;br /&gt;
  1  [uint] Top Field V Channel Vert. Sample Offset Flag&lt;br /&gt;
  1  [uint] Bot Field V Channel Vert. Sample Offset Flag&lt;br /&gt;
  ---- Storage description ----&lt;br /&gt;
  8  [uint] A Channel Bits Per Sample&lt;br /&gt;
  8  [uint] Y/R Channel Bits Per Sample&lt;br /&gt;
  8  [uint] U/G Channel Bits Per Sample&lt;br /&gt;
  8  [uint] V/B Channel Bits Per Sample&lt;br /&gt;
 32  [uint] A Channel Data Offset (in bits)&lt;br /&gt;
 32  [uint] Y/R Channel Data Offset (in bits)&lt;br /&gt;
 32  [uint] U/G Channel Data Offset (in bits)&lt;br /&gt;
 32  [uint] V/B Channel Data Offset (in bits)&lt;br /&gt;
 32  [ int] A Channel Y Stride (in bits)&lt;br /&gt;
 32  [ int] Y/R Channel Y Stride (in bits)&lt;br /&gt;
 32  [ int] U/G Channel Y Stride (in bits)&lt;br /&gt;
 32  [ int] V/B Channel Y Stride (in bits)&lt;br /&gt;
  8  [ int] A Channel X Stride (in bits)&lt;br /&gt;
  8  [ int] Y/R Channel X Stride (in bits)&lt;br /&gt;
  8  [ int] U/G Channel X Stride (in bits)&lt;br /&gt;
  8  [ int] V/B Channel X Stride (in bits)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Data Packets&#039;&#039;&#039;&lt;br /&gt;
  8  0xFF       Top Field Packet ID&lt;br /&gt;
 24  &amp;quot;UVS&amp;quot;      Codec identifier, pads data to 32-bits&lt;br /&gt;
 ..  [data]     variable length packed field&lt;br /&gt;
&lt;br /&gt;
  8  0xFB       Bottom Field Packet ID&lt;br /&gt;
 24  &amp;quot;UVS&amp;quot;      Codec identifier, pads data to 32-bits&lt;br /&gt;
 ..  [data]     variable length packed field&lt;/div&gt;</summary>
		<author><name>Jkoleszar</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=Talk:OggYUV&amp;diff=2025</id>
		<title>Talk:OggYUV</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=Talk:OggYUV&amp;diff=2025"/>
		<updated>2005-11-10T19:09:54Z</updated>

		<summary type="html">&lt;p&gt;Jkoleszar: /* Chroma Subsampling Methods */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Interlace Flag? ===&lt;br /&gt;
* The interlacing information doesn&#039;t seem complete to me.  How do you know which field(s) you have in any give packet, for example?  How do you distinguish between a 25Hz shutter and a 50Hz shutter?  Field order switching?  Mixing with uninterlaced data?&lt;br /&gt;
--[[User:Gumboot|Gumboot]] 03:00, 9 Nov 2005 (PST)&lt;br /&gt;
&lt;br /&gt;
* In my experience, all interlace is every other frame, even scanlines followed by odd scanlines.  Is there any video codec which supports more than an interlace flag? &lt;br /&gt;
--[[User:Arc|Arc]] 10:42, 9 Nov 2005 (PST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Variable frame-rates ===&lt;br /&gt;
* There doesn&#039;t seem to be any handling of variable frame-rate data, or a specification for a timebase for the granulepos.&lt;br /&gt;
--[[User:Gumboot|Gumboot]] 03:00, 9 Nov 2005 (PST)&lt;br /&gt;
&lt;br /&gt;
* Granulepos is the last frame decodable in the current packet/page.  As far as variable framerates within a single stream, is there any codec which supports this currently? &lt;br /&gt;
--[[User:Arc|Arc]] 10:42, 9 Nov 2005 (PST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Codec Identifier ===&lt;br /&gt;
* The identifier seems a little short.  You&#039;d get false positives if somebody wanted to use a &amp;quot;YUVx&amp;quot; format, for example.&lt;br /&gt;
--[[User:Gumboot|Gumboot]] 03:00, 9 Nov 2005 (PST)&lt;br /&gt;
&lt;br /&gt;
* I believe that&#039;s OK with raw formats, if someone wanted to use a YUV-like codec they could use a prefix, vs a suffix, to identify it by.  Also, if their header packet ID is something other than 0x00, it will not generate a false positive to have a YUV* codec identifier since the YUV plugins only support streams which begin with packet id 0. &lt;br /&gt;
--[[User:Arc|Arc]] 10:42, 9 Nov 2005 (PST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Aspect ratio ===&lt;br /&gt;
* Is the aspect ratio the pixel aspect or the frame aspect? &lt;br /&gt;
--[[User:Gumboot|Gumboot]] 03:00, 9 Nov 2005 (PST)&lt;br /&gt;
&lt;br /&gt;
* Frame aspect, this acts exactly like the aspect ratio in the Theora header, right down to having the same bit-size for the fields. Typically, the ratio is 4:3 or 16:9.  &lt;br /&gt;
--[[User:Arc|Arc]] 10:42, 9 Nov 2005 (PST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Chroma Subsampling Methods ===&lt;br /&gt;
* We need to know two things, what the size/shape of chroma pixels are, and if they are packed, what order they are provided in the bitstream.&lt;br /&gt;
** This seperates the order of the data and the processing of the data, both of which are important but get very complicated if mixed&lt;br /&gt;
** The order must match the shape it&#039;s based on, ie, 4:4:4 should be in &amp;quot;0:0&amp;quot; order, any other value (which is illegal) should not be supported by any software if encountered and should never be generated.&lt;br /&gt;
&lt;br /&gt;
 Chroma Pixel &amp;quot;Shapes&amp;quot;&lt;br /&gt;
 =====================&lt;br /&gt;
 ID  Shape  Used-In&lt;br /&gt;
  0  #---   4:4:4&lt;br /&gt;
     ----&lt;br /&gt;
     ----&lt;br /&gt;
     ----&lt;br /&gt;
  .&lt;br /&gt;
  1  ##--   4:2:2&lt;br /&gt;
     ----&lt;br /&gt;
     ---- &lt;br /&gt;
     ----&lt;br /&gt;
  .&lt;br /&gt;
  2  ####   4:1:1&lt;br /&gt;
     ----&lt;br /&gt;
     ----&lt;br /&gt;
     ----&lt;br /&gt;
  .&lt;br /&gt;
  3  #---   ?&lt;br /&gt;
     #---&lt;br /&gt;
     ----&lt;br /&gt;
     ----&lt;br /&gt;
  .&lt;br /&gt;
  4  ##--   4:2:0&lt;br /&gt;
     ##--&lt;br /&gt;
     ----&lt;br /&gt;
     ----&lt;br /&gt;
  .&lt;br /&gt;
  5  ####   4:1:0&lt;br /&gt;
     ####&lt;br /&gt;
     ----&lt;br /&gt;
     ----&lt;br /&gt;
  .&lt;br /&gt;
  6  ####   ?&lt;br /&gt;
     ####&lt;br /&gt;
     ####&lt;br /&gt;
     ####&lt;br /&gt;
  .&lt;br /&gt;
  7  Extended Shape, unsupported in v1.0&lt;br /&gt;
&lt;br /&gt;
* In things like 420 you also need to know the relative phase of the sampling of the chroma.  Some standards have it as being sampled exactly on the top left, some halfway across the top row, some halfway down the left edge, some in the centre of everything... then there are all the interlaced variants.&lt;br /&gt;
: You also have the matter of whether or not there are unused areas at the top and bottom of the range of legal values, and many other things along those lines.&lt;br /&gt;
--[[User:Gumboot|Gumboot]] 02:58, 10 Nov 2005 (PST)&lt;br /&gt;
&lt;br /&gt;
I&#039;m a little confused about the x:y:z notation, so I&#039;m not going to use that here. But here are a couple formats that aren&#039;t described in this table that I use. Dash (-) indicates a luma sample without a chroma sample, and # indicates a luma and chroma sample, I&#039;m not sure if this is the same as used above or not..&lt;br /&gt;
&lt;br /&gt;
  ####&lt;br /&gt;
  ####   Luma and Chroma sampled at at every pixel.&lt;br /&gt;
  ####&lt;br /&gt;
  ####&lt;br /&gt;
 .&lt;br /&gt;
  ----     #-#-&lt;br /&gt;
  #-#- and ----    Typically sampled with a phase offset, but ignoring that for now. One   &lt;br /&gt;
  ----     #-#-    chroma sample per two luma horizontally, every other row. &lt;br /&gt;
  #-#-     ----&lt;br /&gt;
 .&lt;br /&gt;
  #-#- &lt;br /&gt;
  #-#-     One chroma sample per two luma horizontally, every row.  &lt;br /&gt;
  #-#-     &lt;br /&gt;
  #-#- &lt;br /&gt;
 .&lt;br /&gt;
  There may be variants of #-#- (eg -#-#, maybe even -##- or #--#) out there too&lt;br /&gt;
--[[User:Jkoleszar|Jkoleszar]] 11:09, 10 Nov 2005 (PST)&lt;/div&gt;</summary>
		<author><name>Jkoleszar</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=OggYUV&amp;diff=1989</id>
		<title>OggYUV</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=OggYUV&amp;diff=1989"/>
		<updated>2005-11-10T18:48:43Z</updated>

		<summary type="html">&lt;p&gt;Jkoleszar: /* John&amp;#039;s Draft */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is it ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;OggYUV&#039;&#039;&#039; is an uncompressed YUV (YCbCr) video codec for Ogg.  It&#039;s a simple way to store and transfer uncompressed video within an Ogg container.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Why is it ==&lt;br /&gt;
&lt;br /&gt;
The purpose of &#039;&#039;&#039;OggYUV&#039;&#039;&#039; is as a raw video interchange format within [[OggStream]] and other media frameworks.  The format design is to be simple, complete, and efficient enough to be reasonably used to export decoded video to a media player for display.&lt;br /&gt;
&lt;br /&gt;
It can also replace our dependence on yuv4mpeg2 for lossless video storage, which Ogg [[Theora]] originally used as an encoding source.  The main advantage over yuv4mpeg2 files is that, within an Ogg container, it can be time-synced with [[OggPCM]] in a much more reliable way than yuv4mpeg2 + wav audio.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
Packets are processed as per the value of their first byte.  Packets of unknown ID should be silently ignored, providing a convient way to add future expandability which does not break the data format.  Additional data in packet 0 (the header packet) must also be silently ignored.&lt;br /&gt;
&lt;br /&gt;
=== Arc&#039;s Draft ===&lt;br /&gt;
 Packet 0, BOS, 24 bytes&lt;br /&gt;
  8  0x00   Header Packet ID&lt;br /&gt;
 24  &amp;quot;YUV&amp;quot;  Codec identifier &lt;br /&gt;
 --&lt;br /&gt;
  8  0x01   Version Major (breaks backwards compatability to increment)&lt;br /&gt;
  8  0x00   Version Minor (backwards compatable, ie, via extended header)&lt;br /&gt;
  1  [flg]  Color (false = B/W, next 8 bits and must be null)&lt;br /&gt;
  3  [int]  Chroma Pixel &amp;quot;Shape&amp;quot; (see [[Talk:OggYUV#Chroma_Subsampling_Methods|Draft Table]])&lt;br /&gt;
  1  [flg]  50% physical horizontal offset for Cr samples&lt;br /&gt;
  1  [flg]  50% physical verticle offset for Cr samples&lt;br /&gt;
  2  [int]  Chroma blending: 0=None, 1=UpperLeft Sampled/Blend Others, 2=Blend All&lt;br /&gt;
  1  [flg]  Packed (false = Planar, next 2 bits must be null)&lt;br /&gt;
  1  [flg]  Cr Staggered Horizontally in Bytestream&lt;br /&gt;
  1  [flg]  Cr Staggered Vertically in Bytestream&lt;br /&gt;
  1  [flg]  Big Endian/LSB (false = Little Endian/MSB)&lt;br /&gt;
  1  [flg]  Interlaced (false = Progressive)&lt;br /&gt;
  3  ?????  Interlace Options, other bytestream options&lt;br /&gt;
  --&lt;br /&gt;
  8  [int]  Alpha channel bpp&lt;br /&gt;
  8  [int]  Luma channel bpp&lt;br /&gt;
  8  [int]  Chroma channels bpp&lt;br /&gt;
  8  [int]  Colorspace (same as in [[theora]])&lt;br /&gt;
 --&lt;br /&gt;
 24  [int]  Frame Width&lt;br /&gt;
 24  [int]  Frame Height&lt;br /&gt;
 24  [int]  Aspect Numerator&lt;br /&gt;
 24  [int]  Aspect Denominator&lt;br /&gt;
 --&lt;br /&gt;
 32  [int]  Framerate Numerator&lt;br /&gt;
 32  [int]  Framerate Denominator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Data Packet&lt;br /&gt;
  8  0xFF       Data Packet ID&lt;br /&gt;
 24  &amp;quot;YUV&amp;quot;      Codec identifier, pads data to 32-bits&lt;br /&gt;
 ..  [data]     variable length packed [a]rgb frame&lt;br /&gt;
&lt;br /&gt;
=== John&#039;s Draft ===&lt;br /&gt;
This stream format is field based, rather than frame based. It supports only two fields per frame. Fields are stored in temporal order, so granulepos maintains its temporal significance.&lt;br /&gt;
&lt;br /&gt;
 Packet 0, BOS, 72 bytes&lt;br /&gt;
  8  0x00   Header Packet ID&lt;br /&gt;
 24  &amp;quot;UVS&amp;quot;  Codec identifier (uncompressed video stream)&lt;br /&gt;
  8  0x01   Version Major (breaks backwards compatability to increment)&lt;br /&gt;
  8  0x00   Version Minor (backwards compatable, ie, via extended header)&lt;br /&gt;
 ---- Video description ----&lt;br /&gt;
  8  [bits] Reserved 1&lt;br /&gt;
  8  [enum] Colorspace&lt;br /&gt;
 16  [uint] Display Width&lt;br /&gt;
 16  [uint] Display Height&lt;br /&gt;
 16  [uint] Frame Aspect Ratio Numerator&lt;br /&gt;
 16  [uint] Frame Aspect Ratio Denomonator&lt;br /&gt;
 16  [uint] Field Rate Numerator&lt;br /&gt;
 16  [uint] Field Rate Denomonator&lt;br /&gt;
 32  [uint] FourCC (optional, set to zero if N/A or unknown)&lt;br /&gt;
 ---- Sampling description ----&lt;br /&gt;
 16  [uint] Stored Width&lt;br /&gt;
 16  [uint] Stored Height&lt;br /&gt;
 15  [uint] Reserved 2&lt;br /&gt;
  1  [uint] Interlaced Flag&lt;br /&gt;
  2  [uint] U Channel Horiz. (X) Samples/Macropixel, 0 = 4.&lt;br /&gt;
  2  [uint] U Channel Vert. (Y) Samples/Macropixel, 0 = 4.&lt;br /&gt;
  2  [uint] V Channel Horiz. (X) Samples/Macropixel, 0 = 4.&lt;br /&gt;
  2  [uint] V Channel Vert. (Y) Samples/Macropixel, 0 = 4.&lt;br /&gt;
  1  [uint] Top Field U Channel Horiz. Sample Offset Flag&lt;br /&gt;
  1  [uint] Bot Field U Channel Horiz. Sample Offset Flag&lt;br /&gt;
  1  [uint] Top Field U Channel Vert. Sample Offset Flag&lt;br /&gt;
  1  [uint] Bot Field U Channel Vert. Sample Offset Flag&lt;br /&gt;
  1  [uint] Top Field V Channel Horiz. Sample Offset Flag&lt;br /&gt;
  1  [uint] Bot Field V Channel Horiz. Sample Offset Flag&lt;br /&gt;
  1  [uint] Top Field V Channel Vert. Sample Offset Flag&lt;br /&gt;
  1  [uint] Bot Field V Channel Vert. Sample Offset Flag&lt;br /&gt;
  ---- Storage description ----&lt;br /&gt;
  8  [uint] A Channel Bits Per Sample&lt;br /&gt;
  8  [uint] Y/R Channel Bits Per Sample&lt;br /&gt;
  8  [uint] U/G Channel Bits Per Sample&lt;br /&gt;
  8  [uint] V/B Channel Bits Per Sample&lt;br /&gt;
 32  [uint] A Channel Data Offset (in bits)&lt;br /&gt;
 32  [uint] Y/R Channel Data Offset (in bits)&lt;br /&gt;
 32  [uint] U/G Channel Data Offset (in bits)&lt;br /&gt;
 32  [uint] V/B Channel Data Offset (in bits)&lt;br /&gt;
 32  [ int] A Channel Y Stride (in bits)&lt;br /&gt;
 32  [ int] Y/R Channel Y Stride (in bits)&lt;br /&gt;
 32  [ int] U/G Channel Y Stride (in bits)&lt;br /&gt;
 32  [ int] V/B Channel Y Stride (in bits)&lt;br /&gt;
  8  [ int] A Channel X Stride (in bits)&lt;br /&gt;
  8  [ int] Y/R Channel X Stride (in bits)&lt;br /&gt;
  8  [ int] U/G Channel X Stride (in bits)&lt;br /&gt;
  8  [ int] V/B Channel X Stride (in bits)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Data Packets&#039;&#039;&#039;&lt;br /&gt;
  8  0xFF       Top Field Packet ID&lt;br /&gt;
 24  &amp;quot;UVS&amp;quot;      Codec identifier, pads data to 32-bits&lt;br /&gt;
 ..  [data]     variable length packed field&lt;br /&gt;
&lt;br /&gt;
  8  0xFB       Bottom Field Packet ID&lt;br /&gt;
 24  &amp;quot;UVS&amp;quot;      Codec identifier, pads data to 32-bits&lt;br /&gt;
 ..  [data]     variable length packed field&lt;/div&gt;</summary>
		<author><name>Jkoleszar</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=Main_Page&amp;diff=1985</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=Main_Page&amp;diff=1985"/>
		<updated>2005-11-10T15:21:04Z</updated>

		<summary type="html">&lt;p&gt;Jkoleszar: Revert spam&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Projects/Formats =&lt;br /&gt;
&lt;br /&gt;
In an effort to bring open-source ideals to the world of multimedia The Xiph.org Foundation ([[XiphOrg]]) develops a multitude of amazing products. &lt;br /&gt;
&lt;br /&gt;
== Container Formats ==&lt;br /&gt;
&lt;br /&gt;
* [[Ogg]]: Media container. This is our native format and the recommeded container for Xiph codecs.&lt;br /&gt;
* [[OggSkeleton]]: Skeleton information on all logical content bitstreams in Ogg&lt;br /&gt;
&lt;br /&gt;
* [[SpeexRTP]]: RTP payload format for voice&lt;br /&gt;
* [[VorbisRTP]]: RTP payload format for general audio&lt;br /&gt;
* [[TheoraRTP]]: RTP payload format for video&lt;br /&gt;
* [[XSPF]]: XML playlist format&lt;br /&gt;
&lt;br /&gt;
== Codecs ==&lt;br /&gt;
&lt;br /&gt;
* [[Vorbis]]: Audio codec&lt;br /&gt;
* [[Tremor]]: Fixed-point decoder&lt;br /&gt;
* [[Theora]]: Video codec&lt;br /&gt;
* [[FLAC]]: Free Lossless Audio Codec&lt;br /&gt;
* [[Speex]]: Speech codec&lt;br /&gt;
* [[Ogg Writ]]: Text phrase codec (e.g. subtitles)&lt;br /&gt;
* &#039;&#039;&#039;Under Development:&#039;&#039;&#039;&lt;br /&gt;
** [[Metadata]]: Arbitrary metadata stream format (vapourware so far)&lt;br /&gt;
** [[OggMNG]]: A mapping for encapsulating the MNG animation format in Ogg&lt;br /&gt;
** [[OggPCM]]: Uncompressed PCM audio, primarily as an interchange codec&lt;br /&gt;
** [[OggRGB]]: Uncompressed RGB video, primarily as an interchange codec&lt;br /&gt;
** [[OggYUV]]: Uncompressed YUV video, primarily as an interchange codec, undergoing heavy debate&lt;br /&gt;
&lt;br /&gt;
== Software for distributing media ==&lt;br /&gt;
&lt;br /&gt;
* [[Icecast]]: Streaming server&lt;br /&gt;
* [[Ices]]: Source client for Icecast servers&lt;br /&gt;
* [[IceShare]]: P2P content distribution&lt;br /&gt;
&lt;br /&gt;
== Other software ==&lt;br /&gt;
&lt;br /&gt;
* [[OggComponent/VorbisComponent]]: Wrappers to integrate Ogg-Vorbis into MacOsX&lt;br /&gt;
&lt;br /&gt;
= Demonstrations =&lt;br /&gt;
&lt;br /&gt;
Want to hear Xiph in action?  These projects are using our codecs, formats, or libraries.&lt;br /&gt;
&lt;br /&gt;
* [[VorbisStreams]]: Stations streaming with the Vorbis codec&lt;br /&gt;
* [[Games that use Vorbis]]: Games using the Vorbis codec for music or sound effects&lt;br /&gt;
* [[VorbisHardware]]: Hardware players using the Vorbis codec&lt;br /&gt;
* [http://www.tversity.com TVersity Media Server]: A UPNP/AV compliant media server that uses the Ogg Vorbis libraries to transcode audio files to the Ogg Vorbis format.&lt;br /&gt;
&lt;br /&gt;
= Project management =&lt;br /&gt;
&lt;br /&gt;
* [[MonthlyMeeting]]&lt;br /&gt;
* [[MailingLists]]&lt;br /&gt;
* [[Bounties]]&lt;br /&gt;
* [[HyperFish]]&lt;br /&gt;
&lt;br /&gt;
= Wiki internal =&lt;br /&gt;
* [[Sandbox]]: Testbed for testing editing skills.&lt;br /&gt;
* [[Translations]]: What about some translation work&lt;/div&gt;</summary>
		<author><name>Jkoleszar</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=OggPCM_Draft1&amp;diff=1992</id>
		<title>OggPCM Draft1</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=OggPCM_Draft1&amp;diff=1992"/>
		<updated>2005-11-10T14:08:47Z</updated>

		<summary type="html">&lt;p&gt;Jkoleszar: /* Format */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is it ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;OggPCM&#039;&#039;&#039; is a pulse-code modulation (PCM) audio codec for Ogg.  Similar to Microsoft&#039;s .wav or Apple&#039;s .aiff formats, it&#039;s a simple way to store and transfer uncompressed audio within an Ogg container.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Why is it ==&lt;br /&gt;
The intention for this format is as an interchange format, especially for use with [[OggStream]].  It is also useful for storing time-synced decoded audio/video for development, vs RIFF/WAV (.wav) and YUV4MPEG (.yuv) in seperate files as we did with [[Theora]].&lt;br /&gt;
&lt;br /&gt;
It is also less complex than either .wav (RIFF) or .aiff (AIFF), both of these formats being designed for generic multimedia (audio, video, etc).  Full compatability with these formats includes support for non-PCM data.&lt;br /&gt;
&lt;br /&gt;
Using raw PCM data, on the other hand, doesn&#039;t give us that all-important header which carries information about the number of channels, sample width, and sample frequency.  So what we need is a header followed by raw PCM data - nothing more complicated.&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
Packets are processed as per the value of their first byte.  Packets of unknown ID should be silently ignored, providing a convient way to add future expandability which does not break the data format. Multibyte fields in the header packet are packed in big endian order. Other fields are stored MSB first. Multibyte fields in the data packet are packed in little endian order.&lt;br /&gt;
&lt;br /&gt;
The granule position specified is the total samples encoded after including all samples on the page. Samples must not be split across pages. The rationale here is that the position specified in the frame header of the last page tells how long the data coded by the bitstream is. A truncated stream will still return the proper number of samples that can be decoded fully.&lt;br /&gt;
&lt;br /&gt;
An example of how this can be useful is the proposed ReplayGain extension to .wav format: http://replaygain.hydrogenaudio.org/file_format_wav.html&lt;br /&gt;
&lt;br /&gt;
Note that no such extension is planned, nor is the need for a future format forseen, but history has shown that even the most basic formats eventually become obsolete.&lt;br /&gt;
&lt;br /&gt;
 Packet 0, BOS, 12 bytes&lt;br /&gt;
  8  0x00       Header Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;      Codec identifier &lt;br /&gt;
  8  0x01       Version Major (breaks backwards compatability to increment)&lt;br /&gt;
  8  0x00       Version Minor (backwards compatable, ie, via extended header)&lt;br /&gt;
  8  [variable] Number of Channels&lt;br /&gt;
  8  [variable] Bits per Sample&lt;br /&gt;
 24  [variable] Samples per Second&lt;br /&gt;
  2  [variable] Data Type: 0=signed int, 1=unsigned int, 2=float, 3=extended&lt;br /&gt;
  6  [null]     Padding to byte/int - may be used for &amp;quot;extended&amp;quot; data type&lt;br /&gt;
&lt;br /&gt;
 Data Packet&lt;br /&gt;
  8  0xFF       Data Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;      Codec identifier, pads data to 32-bits&lt;br /&gt;
 ..  [data]     variable length pcm data&lt;br /&gt;
&lt;br /&gt;
=== Alternative Format ===&lt;br /&gt;
&lt;br /&gt;
The primary difference between this format and the one above is that it is intended to support channels from the same source having different sampling parameters.&lt;br /&gt;
&lt;br /&gt;
 Packet 0, BOS, tbd bytes&lt;br /&gt;
  8  0x00       Header Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;      Codec identifier &lt;br /&gt;
  8  0x01       Version Major (breaks backwards compatability to increment)&lt;br /&gt;
  8  0x00       Version Minor (backwards compatable, ie, via extended header)&lt;br /&gt;
  8  [uint]     Source ID (Unique amongst all OggPCM streams in the physical stream)&lt;br /&gt;
  8  [uint]     Channel Block&lt;br /&gt;
 16  [bitfield] Indicates which of the 16 channels in this channel block &lt;br /&gt;
                are present in this logical OGGPCM stream.&lt;br /&gt;
  8  [enum]     Sample format (OGGPCM_FMT_U8, OGGPCM_FMT_LE_S16, OGGPCM_FMT_BE_S16, etc) &lt;br /&gt;
 24  [uint]     Sample rate&lt;br /&gt;
&lt;br /&gt;
 Data Packet&lt;br /&gt;
  8  0xFF       Data Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;      Codec identifier, pads data to 32-bits&lt;br /&gt;
 ..  [data]     variable length pcm data, packing defined by Sample Format field in header&lt;br /&gt;
&lt;br /&gt;
Constraints:&lt;br /&gt;
This format can support any __documented and registered__ format by since it uses an enumeration. Each logical stream can support up to 16 channels sharing a fixed sample rate. Logical streams from the same source may be multiplexed to provide up to 4096 channels per source, each with their own sample rate. Up to 256 Sources may be multiplexed within a physical Ogg stream, unless an application takes other measures to logically partition the stream. &lt;br /&gt;
&lt;br /&gt;
Discussion:&lt;br /&gt;
This seems to make it easy to support the simple/normal cases and possible to support the pathological cases, for instance:&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;1&amp;quot;&lt;br /&gt;
| Source ID || Channel Bitfield || Sample Rate || Sample Format || Comment&lt;br /&gt;
|-&lt;br /&gt;
| 0x00 || 0000 0000 0000 0011 || 96000 || OGGPCM_FMT_LE_S24 || Front Stereo Pair&lt;br /&gt;
|-&lt;br /&gt;
| 0x00 || 0000 0000 0011 1100 || 44100 || OGGPCM_FMT_LE_S16 || Center And Surrounds&lt;br /&gt;
|-&lt;br /&gt;
| 0x00 || 0000 0000 0010 0000 || 8000 || OGGPCM_FMT_LE_S16 || LFE Channel&lt;br /&gt;
|-&lt;br /&gt;
| 0x01 || 0000 0000 0000 0001 || 8000 || OGGPCM_FMT_U8 || PC Speaker&lt;br /&gt;
|-&lt;br /&gt;
| 0x02 || 0000 0000 0000 0001 || 8000 || OGGPCM_FMT_U8 || Microphone&lt;br /&gt;
|-&lt;br /&gt;
| 0x03 || 0000 0000 0000 0011 || 8000 || OGGPCM_FMT_LE_S16 || Voice Chat&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each entry in the table is a logical Ogg stream. I&#039;m not convinced that the source id and channel block are necessary, but figured I&#039;d throw it out there.&lt;/div&gt;</summary>
		<author><name>Jkoleszar</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=OggYUV&amp;diff=1975</id>
		<title>OggYUV</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=OggYUV&amp;diff=1975"/>
		<updated>2005-11-09T22:17:41Z</updated>

		<summary type="html">&lt;p&gt;Jkoleszar: /* Format */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is it ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;OggYUV&#039;&#039;&#039; is an uncompressed YUV (YCbCr) video codec for Ogg.  It&#039;s a simple way to store and transfer uncompressed video within an Ogg container.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Why is it ==&lt;br /&gt;
&lt;br /&gt;
The purpose of &#039;&#039;&#039;OggYUV&#039;&#039;&#039; is as a raw video interchange format within [[OggStream]] and other media frameworks.  The format design is to be simple, complete, and efficient enough to be reasonably used to export decoded video to a media player for display.&lt;br /&gt;
&lt;br /&gt;
It can also replace our dependence on yuv4mpeg2 for lossless video storage, which Ogg [[Theora]] originally used as an encoding source.  The main advantage over yuv4mpeg2 files is that, within an Ogg container, it can be time-synced with [[OggPCM]] in a much more reliable way than yuv4mpeg2 + wav audio.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
Packets are processed as per the value of their first byte.  Packets of unknown ID should be silently ignored, providing a convient way to add future expandability which does not break the data format.  Additional data in packet 0 (the header packet) must also be silently ignored.&lt;br /&gt;
&lt;br /&gt;
=== Arc&#039;s Draft ===&lt;br /&gt;
 Packet 0, BOS, 24 bytes&lt;br /&gt;
  8  0x00   Header Packet ID&lt;br /&gt;
 24  &amp;quot;YUV&amp;quot;  Codec identifier &lt;br /&gt;
 --&lt;br /&gt;
  8  0x01   Version Major (breaks backwards compatability to increment)&lt;br /&gt;
  8  0x00   Version Minor (backwards compatable, ie, via extended header)&lt;br /&gt;
  1  [flg]  Interlaced&lt;br /&gt;
  1  [flg]  Packed (False = Planar)&lt;br /&gt;
  2  [int]  Number of Chroma/Luna (1, 2, 4, or 8)&lt;br /&gt;
  1  [flg]  Horizontal Staggered Chroma&lt;br /&gt;
  1  [flg]  Verticle Staggered Chroma&lt;br /&gt;
  1  [flg]  Staggered Chroma&lt;br /&gt;
  1  [flg]  Horizontal Stagger&lt;br /&gt;
  8  [nil]  Padding to bring to 32-bit border&lt;br /&gt;
  --&lt;br /&gt;
  8  [int]  Alpha channel bpp&lt;br /&gt;
  8  [int]  Luma channel bpp&lt;br /&gt;
  8  [int]  Chroma channels bpp&lt;br /&gt;
  8  [int]  Colorspace (same as in [[theora]])&lt;br /&gt;
 --&lt;br /&gt;
 24  [int]  Frame Width&lt;br /&gt;
 24  [int]  Frame Height&lt;br /&gt;
 24  [int]  Aspect Numerator&lt;br /&gt;
 24  [int]  Aspect Denominator&lt;br /&gt;
 --&lt;br /&gt;
 32  [int]  Framerate Numerator&lt;br /&gt;
 32  [int]  Framerate Denominator&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Data Packet&lt;br /&gt;
  8  0xFF       Data Packet ID&lt;br /&gt;
 24  &amp;quot;YUV&amp;quot;      Codec identifier, pads data to 32-bits&lt;br /&gt;
 ..  [data]     variable length packed [a]rgb frame&lt;br /&gt;
&lt;br /&gt;
=== John&#039;s Draft ===&lt;br /&gt;
 Packet 0, BOS, 24 bytes&lt;br /&gt;
  8  0x00   Header Packet ID&lt;br /&gt;
 24  &amp;quot;UVS&amp;quot;  Codec identifier (uncompressed video stream)&lt;br /&gt;
  8  0x01   Version Major (breaks backwards compatability to increment)&lt;br /&gt;
  8  0x00   Version Minor (backwards compatable, ie, via extended header)&lt;br /&gt;
 ---- Video description ----&lt;br /&gt;
 16  [uint] Display Width&lt;br /&gt;
 16  [uint] Display Height&lt;br /&gt;
 16  [uint] Frame Aspect Ratio Numerator&lt;br /&gt;
 16  [uint] Frame Aspect Ratio Denomonator&lt;br /&gt;
 16  [uint] Field Rate Numerator&lt;br /&gt;
 16  [uint] Field Rate Denomonator&lt;br /&gt;
  8  [uint] Fields Per Frame&lt;br /&gt;
  8  [enum] Colorspace&lt;br /&gt;
 32  [uint] FourCC (optional, set to zero if N/A or unknown)&lt;br /&gt;
 ---- Sampling description ----&lt;br /&gt;
 16  [uint] Stored Width&lt;br /&gt;
 16  [uint] Stored Height&lt;br /&gt;
  2  [uint] U Channel Horiz. (X) Samples/Macropixel, 0 = 4.&lt;br /&gt;
  2  [uint] U Channel Vert. (Y) Samples/Macropixel, 0 = 4.&lt;br /&gt;
  2  [uint] U Channel Horiz. Sample Offset (Fraction of pixel stride)&lt;br /&gt;
  2  [uint] U Channel Vert. Sample Offset (Fraction of pixel stride)&lt;br /&gt;
  2  [uint] V Channel Horiz. (X) Samples/Macropixel, 0 = 4.&lt;br /&gt;
  2  [uint] V Channel Vert. (Y) Samples/Macropixel, 0 = 4.&lt;br /&gt;
  2  [uint] V Channel Horiz. Sample Offset (Fraction of pixel stride)&lt;br /&gt;
  2  [uint] V Channel Vert. Sample Offset (Fraction of pixel stride)&lt;br /&gt;
 16  [uint] Pad&lt;br /&gt;
 ---- Storage description ----&lt;br /&gt;
  8  [uint] A Channel Bits Per Sample&lt;br /&gt;
  8  [uint] Y/R Channel Bits Per Sample&lt;br /&gt;
  8  [uint] U/G Channel Bits Per Sample&lt;br /&gt;
  8  [uint] V/B Channel Bits Per Sample&lt;br /&gt;
 32  [uint] A Channel Data Offset (in bits)&lt;br /&gt;
 32  [ int] A Channel X Stride (in bits)&lt;br /&gt;
 32  [ int] A Channel Y Stride (in bits)&lt;br /&gt;
 32  [uint] Y/R Channel Data Offset (in bits)&lt;br /&gt;
 32  [ int] Y/R Channel X Stride (in bits)&lt;br /&gt;
 32  [ int] Y/R Channel Y Stride (in bits)&lt;br /&gt;
 32  [uint] U/G Channel Data Offset (in bits)&lt;br /&gt;
 32  [ int] U/G Channel X Stride (in bits)&lt;br /&gt;
 32  [ int] U/G Channel Y Stride (in bits)&lt;br /&gt;
 32  [uint] V/B Channel Data Offset (in bits)&lt;br /&gt;
 32  [ int] V/B Channel X Stride (in bits)&lt;br /&gt;
 32  [ int] V/B Channel Y Stride (in bits)&lt;br /&gt;
&lt;br /&gt;
 Data Packet&lt;br /&gt;
  8  0xFF       Data Packet ID&lt;br /&gt;
 24  &amp;quot;UVS&amp;quot;      Codec identifier, pads data to 32-bits&lt;br /&gt;
 ..  [data]     variable length packed field&lt;/div&gt;</summary>
		<author><name>Jkoleszar</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=OggPCM_Draft1&amp;diff=1983</id>
		<title>OggPCM Draft1</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=OggPCM_Draft1&amp;diff=1983"/>
		<updated>2005-11-09T20:17:01Z</updated>

		<summary type="html">&lt;p&gt;Jkoleszar: /* Format */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is it ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;OggPCM&#039;&#039;&#039; is a pulse-code modulation (PCM) audio codec for Ogg.  Similar to Microsoft&#039;s .wav or Apple&#039;s .aiff formats, it&#039;s a simple way to store and transfer uncompressed audio within an Ogg container.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Why is it ==&lt;br /&gt;
The intention for this format is as an interchange format, especially for use with [[OggStream]].  It is also useful for storing time-synced decoded audio/video for development, vs RIFF/WAV (.wav) and YUV4MPEG (.yuv) in seperate files as we did with [[Theora]].&lt;br /&gt;
&lt;br /&gt;
It is also less complex than either .wav (RIFF) or .aiff (AIFF), both of these formats being designed for generic multimedia (audio, video, etc).  Full compatability with these formats includes support for non-PCM data.&lt;br /&gt;
&lt;br /&gt;
Using raw PCM data, on the other hand, doesn&#039;t give us that all-important header which carries information about the number of channels, sample width, and sample frequency.  So what we need is a header followed by raw PCM data - nothing more complicated.&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
Packets are processed as per the value of their first byte.  Packets of unknown ID should be silently ignored, providing a convient way to add future expandability which does not break the data format. Multibyte fields in the header packet are packed in big endian order. Other fields are stored MSB first. Multibyte fields in the data packet are packed in little endian order.&lt;br /&gt;
&lt;br /&gt;
The granule position specified is the total samples encoded after including all samples on the page. Samples must not be split across pages. The rationale here is that the position specified in the frame header of the last page tells how long the data coded by the bitstream is. A truncated stream will still return the proper number of samples that can be decoded fully.&lt;br /&gt;
&lt;br /&gt;
An example of how this can be useful is the proposed ReplayGain extension to .wav format: http://replaygain.hydrogenaudio.org/file_format_wav.html&lt;br /&gt;
&lt;br /&gt;
Note that no such extension is planned, nor is the need for a future format forseen, but history has shown that even the most basic formats eventually become obsolete.&lt;br /&gt;
&lt;br /&gt;
 Packet 0, BOS, 12 bytes&lt;br /&gt;
  8  0x00       Header Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;      Codec identifier &lt;br /&gt;
  8  0x01       Version Major (breaks backwards compatability to increment)&lt;br /&gt;
  8  0x00       Version Minor (backwards compatable, ie, via extended header)&lt;br /&gt;
  8  [variable] Number of Channels&lt;br /&gt;
  8  [variable] Bits per Sample&lt;br /&gt;
 24  [variable] Samples per Second&lt;br /&gt;
  2  [variable] Data Type: 0=signed int, 1=unsigned int, 2=float, 3=extended&lt;br /&gt;
  6  [null]     Padding to byte/int - may be used for &amp;quot;extended&amp;quot; data type&lt;br /&gt;
&lt;br /&gt;
 Data Packet&lt;br /&gt;
  8  0xFF       Data Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;      Codec identifier, pads data to 32-bits&lt;br /&gt;
 ..  [data]     variable length pcm data&lt;/div&gt;</summary>
		<author><name>Jkoleszar</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=OggPCM_Draft1&amp;diff=1958</id>
		<title>OggPCM Draft1</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=OggPCM_Draft1&amp;diff=1958"/>
		<updated>2005-11-09T19:59:54Z</updated>

		<summary type="html">&lt;p&gt;Jkoleszar: Specified byte ordering&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is it ==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;OggPCM&#039;&#039;&#039; is a pulse-code modulation (PCM) audio codec for Ogg.  Similar to Microsoft&#039;s .wav or Apple&#039;s .aiff formats, it&#039;s a simple way to store and transfer uncompressed audio within an Ogg container.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Why is it ==&lt;br /&gt;
The intention for this format is as an interchange format, especially for use with [[OggStream]].  It is also useful for storing time-synced decoded audio/video for development, vs RIFF/WAV (.wav) and YUV4MPEG (.yuv) in seperate files as we did with [[Theora]].&lt;br /&gt;
&lt;br /&gt;
It is also less complex than either .wav (RIFF) or .aiff (AIFF), both of these formats being designed for generic multimedia (audio, video, etc).  Full compatability with these formats includes support for non-PCM data.&lt;br /&gt;
&lt;br /&gt;
Using raw PCM data, on the other hand, doesn&#039;t give us that all-important header which carries information about the number of channels, sample width, and sample frequency.  So what we need is a header followed by raw PCM data - nothing more complicated.&lt;br /&gt;
&lt;br /&gt;
== Format ==&lt;br /&gt;
&lt;br /&gt;
Packets are processed as per the value of their first byte.  Packets of unknown ID should be silently ignored, providing a convient way to add future expandability which does not break the data format. Multibyte fields in the header packet are packed in big endian order. Multibyte fields in the data packet are packed in little endian order.&lt;br /&gt;
&lt;br /&gt;
An example of how this can be useful is the proposed ReplayGain extension to .wav format: http://replaygain.hydrogenaudio.org/file_format_wav.html&lt;br /&gt;
&lt;br /&gt;
Note that no such extension is planned, nor is the need for a future format forseen, but history has shown that even the most basic formats eventually become obsolete.&lt;br /&gt;
&lt;br /&gt;
 Packet 0, BOS, 12 bytes&lt;br /&gt;
  8  0x00       Header Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;      Codec identifier &lt;br /&gt;
  8  0x01       Version Major (breaks backwards compatability to increment)&lt;br /&gt;
  8  0x00       Version Minor (backwards compatable, ie, via extended header)&lt;br /&gt;
  8  [variable] Number of Channels&lt;br /&gt;
  8  [variable] Bits per Sample&lt;br /&gt;
 24  [variable] Samples per Second&lt;br /&gt;
  2  [variable] Data Type: 0=signed int, 1=unsigned int, 2=float, 3=extended&lt;br /&gt;
  6  [null]     Padding to byte/int - may be used for &amp;quot;extended&amp;quot; data type&lt;br /&gt;
&lt;br /&gt;
 Data Packet&lt;br /&gt;
  8  0xFF       Data Packet ID&lt;br /&gt;
 24  &amp;quot;PCM&amp;quot;      Codec identifier, pads data to 32-bits&lt;br /&gt;
 ..  [data]     variable length pcm data&lt;/div&gt;</summary>
		<author><name>Jkoleszar</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=Talk:OggPCM_Draft1&amp;diff=1961</id>
		<title>Talk:OggPCM Draft1</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=Talk:OggPCM_Draft1&amp;diff=1961"/>
		<updated>2005-11-09T19:56:49Z</updated>

		<summary type="html">&lt;p&gt;Jkoleszar: Changed suggestion on odd sized sample packing&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Do we need signed/unsigned data flag?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Not really.  The data can be easily changed to signed as default losslessly.  Unsigned 8-bit data (where 128 is the median) is easily changed to signed, and changed back if being saved as RIFF/WAV (which only supports unsigned 8-bit).&lt;br /&gt;
&lt;br /&gt;
However, it wouldn&#039;t hurt to support it.  Applications can be built to support one or multiple formats, thus requesting conversion if not supported by the codec.&lt;br /&gt;
* I don&#039;t agree with that.  It just puts more conditional code into packages that would normally have only one native format and it gives them more opportunity to fail to support variants of the format. If it&#039;s fixed then a few packages will always have to modify the data, and most will never get it wrong. If it&#039;s variable then every package will have to do something sometimes, or fail occasionally. --[[User:Gumboot|Gumboot]] 01:28, 8 Nov 2005 (PST)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Do we need to record int/float data flag?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Some codecs (Vorbis) use floating point samples nativly.  Others only support int.  Support for int/float data flag is thus important.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Do we need to offer endian data flag?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LSB/MSB can be changed losslessly, one should probobally be settled on for the data and stick with it.  It&#039;s a fainly low-CPU process to change the endian on the application side in any event, and if the application uses the bitpacker, this isn&#039;t even an issue.&lt;br /&gt;
&lt;br /&gt;
Supporting both is possible, too, but adds complexity to a format intended to be &#039;&#039;simple&#039;&#039;.&lt;br /&gt;
* We should just standardize on little endian ordering for the data. It&#039;s commonly used and well supported in hardware and software. Any cross architecture application that can deal WAV&#039;s will already know how to support it.&lt;br /&gt;
--[[User:Jkoleszar|Jkoleszar]] 11:48, 9 Nov 2005 (PST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Which endian is it?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Is it worth supporting a vorbiscomment header?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
It&#039;d be useful to be able to carry information like what was decoded, or CDDB IDs, or replaygain information.  Besides, if you don&#039;t put it in then five other people will do it five different ways.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;How does one interpret a file where the Bits per Sample is neither 32 nor 64 and the Data Type is float?&#039;&#039;&#039;&lt;br /&gt;
* One doesn&#039;t. Standardize on IEEE floats and be done with it. Simple, remember? :)&lt;br /&gt;
--[[User:Jkoleszar|Jkoleszar]] 11:48, 9 Nov 2005 (PST)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Are samples padded to some round number of bits?&#039;&#039;&#039;&lt;br /&gt;
* I don&#039;t know of any PCM formats for non-octet based samples, but if you want to specify something, I&#039;d say pack them into the MSB&#039;s of the next larger byte boundary, round toward zero, on a per channel basis. This should allow software that knows how to handle 16 bit audio but not 10 bit to operate on the data.&lt;br /&gt;
&lt;br /&gt;
--[[User:Jkoleszar|Jkoleszar]] 11:48, 9 Nov 2005 (PST)&lt;br /&gt;
 &lt;br /&gt;
== Do we want/need the 32-bit data packet header? ==&lt;br /&gt;
&lt;br /&gt;
The issue was raised on the ogg-dev mailing list of wether this is necessary.  With only a single header packet, it could be considered an unneeded complication, however, additional header packets (current or future) will make this a requirement.&lt;br /&gt;
* I can definitely see people wanting to use comment pages, so I&#039;d say leave the header on the data pages as well. On the other hand, if ogg provides guarantees about the alignment of packet data from packetout, I could see getting rid of it since there are benefits to working on buffers aligned to larger boundaries on some architectures. As far as I can tell, either no guarantees are made, or you&#039;ll get a buffer aligned to a word boundary, in which case having the header has no penalty.&lt;br /&gt;
--[[User:Jkoleszar|Jkoleszar]] 11:48, 9 Nov 2005 (PST)&lt;/div&gt;</summary>
		<author><name>Jkoleszar</name></author>
	</entry>
	<entry>
		<id>https://wiki.xiph.org/index.php?title=Talk:OggPCM_Draft1&amp;diff=1956</id>
		<title>Talk:OggPCM Draft1</title>
		<link rel="alternate" type="text/html" href="https://wiki.xiph.org/index.php?title=Talk:OggPCM_Draft1&amp;diff=1956"/>
		<updated>2005-11-09T19:48:27Z</updated>

		<summary type="html">&lt;p&gt;Jkoleszar: Thoughts on the topic&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Do we need signed/unsigned data flag?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Not really.  The data can be easily changed to signed as default losslessly.  Unsigned 8-bit data (where 128 is the median) is easily changed to signed, and changed back if being saved as RIFF/WAV (which only supports unsigned 8-bit).&lt;br /&gt;
&lt;br /&gt;
However, it wouldn&#039;t hurt to support it.  Applications can be built to support one or multiple formats, thus requesting conversion if not supported by the codec.&lt;br /&gt;
* I don&#039;t agree with that.  It just puts more conditional code into packages that would normally have only one native format and it gives them more opportunity to fail to support variants of the format. If it&#039;s fixed then a few packages will always have to modify the data, and most will never get it wrong. If it&#039;s variable then every package will have to do something sometimes, or fail occasionally. --[[User:Gumboot|Gumboot]] 01:28, 8 Nov 2005 (PST)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Do we need to record int/float data flag?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Some codecs (Vorbis) use floating point samples nativly.  Others only support int.  Support for int/float data flag is thus important.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Do we need to offer endian data flag?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LSB/MSB can be changed losslessly, one should probobally be settled on for the data and stick with it.  It&#039;s a fainly low-CPU process to change the endian on the application side in any event, and if the application uses the bitpacker, this isn&#039;t even an issue.&lt;br /&gt;
&lt;br /&gt;
Supporting both is possible, too, but adds complexity to a format intended to be &#039;&#039;simple&#039;&#039;.&lt;br /&gt;
* We should just standardize on little endian ordering for the data. It&#039;s commonly used and well supported in hardware and software. Any cross architecture application that can deal WAV&#039;s will already know how to support it.&lt;br /&gt;
--[[User:Jkoleszar|Jkoleszar]] 11:48, 9 Nov 2005 (PST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Which endian is it?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Is it worth supporting a vorbiscomment header?&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
It&#039;d be useful to be able to carry information like what was decoded, or CDDB IDs, or replaygain information.  Besides, if you don&#039;t put it in then five other people will do it five different ways.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;How does one interpret a file where the Bits per Sample is neither 32 nor 64 and the Data Type is float?&#039;&#039;&#039;&lt;br /&gt;
* One doesn&#039;t. Standardize on IEEE floats and be done with it. Simple, remember? :)&lt;br /&gt;
--[[User:Jkoleszar|Jkoleszar]] 11:48, 9 Nov 2005 (PST)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Are samples padded to some round number of bits?&#039;&#039;&#039;&lt;br /&gt;
* I don&#039;t know of any PCM formats for non-octet based samples, but if you want to specify something, I&#039;d say pack them into the LSB&#039;s of the next larger byte boundary, with sign extention, on a per channel basis. &lt;br /&gt;
--[[User:Jkoleszar|Jkoleszar]] 11:48, 9 Nov 2005 (PST)&lt;br /&gt;
 &lt;br /&gt;
== Do we want/need the 32-bit data packet header? ==&lt;br /&gt;
&lt;br /&gt;
The issue was raised on the ogg-dev mailing list of wether this is necessary.  With only a single header packet, it could be considered an unneeded complication, however, additional header packets (current or future) will make this a requirement.&lt;br /&gt;
* I can definitely see people wanting to use comment pages, so I&#039;d say leave the header on the data pages as well. On the other hand, if ogg provides guarantees about the alignment of packet data from packetout, I could see getting rid of it since there are benefits to working on buffers aligned to larger boundaries on some architectures. As far as I can tell, either no guarantees are made, or you&#039;ll get a buffer aligned to a word boundary, in which case having the header has no penalty.&lt;br /&gt;
--[[User:Jkoleszar|Jkoleszar]] 11:48, 9 Nov 2005 (PST)&lt;/div&gt;</summary>
		<author><name>Jkoleszar</name></author>
	</entry>
</feed>