OggYUV: Difference between revisions

From XiphWiki
Jump to navigation Jump to search
Line 22: Line 22:
   8  0x01  Version Major (breaks backwards compatability to increment)
   8  0x01  Version Major (breaks backwards compatability to increment)
   8  0x00  Version Minor (backwards compatable, ie, via extended header)
   8  0x00  Version Minor (backwards compatable, ie, via extended header)
   1  [flg]  Interlaced
   1  [flg]  Color (false = B/W, next 8 bits and must be null)
   1  [flg]  Packed (False = Planar)
  3  [int]  Chroma Pixel "Shape" (see [[Talk:OggYUV#Chroma_Subsampling_Methods|Draft Table]])
   2  [int]  Number of Chroma/Luna (1, 2, 4, or 8)
  1  [flg]  50% physical horizontal offset for Cr samples
   1  [flg]  Horizontal Staggered Chroma
   1  [flg]  50% physical verticle offset for Cr samples
   1  [flg]  Verticle Staggered Chroma
   2  [int]  Chroma blending: 0=None, 1=UpperLeft Sampled/Blend Others, 2=Blend All
   1  [flg]  Staggered Chroma
  1  [flg]  Packed (false = Planar, next 2 bits must be null)
   1  [flg]  Horizontal Stagger
   1  [flg]  Cr Staggered Horizontally in Bytestream
   8 [nil] Padding to bring to 32-bit border
   1  [flg]  Cr Staggered Vertically in Bytestream
   1  [flg]  Big Endian/LSB (false = Little Endian/MSB)
   1  [flg]  Interlaced (false = Progressive)
   3 ????? Interlace Options, other bytestream options
   --
   --
   8  [int]  Alpha channel bpp
   8  [int]  Alpha channel bpp

Revision as of 23:08, 9 November 2005

What is it

OggYUV is an uncompressed YUV (YCbCr) video codec for Ogg. It's a simple way to store and transfer uncompressed video within an Ogg container.


Why is it

The purpose of OggYUV 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.

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.


Format

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.

Arc's Draft

Packet 0, BOS, 24 bytes
 8  0x00   Header Packet ID
24  "YUV"  Codec identifier 
--
 8  0x01   Version Major (breaks backwards compatability to increment)
 8  0x00   Version Minor (backwards compatable, ie, via extended header)
 1  [flg]  Color (false = B/W, next 8 bits and must be null)
 3  [int]  Chroma Pixel "Shape" (see Draft Table)
 1  [flg]  50% physical horizontal offset for Cr samples
 1  [flg]  50% physical verticle offset for Cr samples
 2  [int]  Chroma blending: 0=None, 1=UpperLeft Sampled/Blend Others, 2=Blend All
 1  [flg]  Packed (false = Planar, next 2 bits must be null)
 1  [flg]  Cr Staggered Horizontally in Bytestream
 1  [flg]  Cr Staggered Vertically in Bytestream
 1  [flg]  Big Endian/LSB (false = Little Endian/MSB)
 1  [flg]  Interlaced (false = Progressive)
 3  ?????  Interlace Options, other bytestream options
 --
 8  [int]  Alpha channel bpp
 8  [int]  Luma channel bpp
 8  [int]  Chroma channels bpp
 8  [int]  Colorspace (same as in theora)
--
24  [int]  Frame Width
24  [int]  Frame Height
24  [int]  Aspect Numerator
24  [int]  Aspect Denominator
--
32  [int]  Framerate Numerator
32  [int]  Framerate Denominator


Data Packet
 8  0xFF       Data Packet ID
24  "YUV"      Codec identifier, pads data to 32-bits
..  [data]     variable length packed [a]rgb frame

John's Draft

Packet 0, BOS, 24 bytes
 8  0x00   Header Packet ID
24  "UVS"  Codec identifier (uncompressed video stream)
 8  0x01   Version Major (breaks backwards compatability to increment)
 8  0x00   Version Minor (backwards compatable, ie, via extended header)
---- Video description ----
16  [uint] Display Width
16  [uint] Display Height
16  [uint] Frame Aspect Ratio Numerator
16  [uint] Frame Aspect Ratio Denomonator
16  [uint] Field Rate Numerator
16  [uint] Field Rate Denomonator
 8  [uint] Fields Per Frame
 8  [enum] Colorspace
32  [uint] FourCC (optional, set to zero if N/A or unknown)
---- Sampling description ----
16  [uint] Stored Width
16  [uint] Stored Height
 2  [uint] U Channel Horiz. (X) Samples/Macropixel, 0 = 4.
 2  [uint] U Channel Vert. (Y) Samples/Macropixel, 0 = 4.
 2  [uint] U Channel Horiz. Sample Offset (Fraction of pixel stride)
 2  [uint] U Channel Vert. Sample Offset (Fraction of pixel stride)
 2  [uint] V Channel Horiz. (X) Samples/Macropixel, 0 = 4.
 2  [uint] V Channel Vert. (Y) Samples/Macropixel, 0 = 4.
 2  [uint] V Channel Horiz. Sample Offset (Fraction of pixel stride)
 2  [uint] V Channel Vert. Sample Offset (Fraction of pixel stride)
16  [uint] Pad
---- Storage description ----
 8  [uint] A Channel Bits Per Sample
 8  [uint] Y/R Channel Bits Per Sample
 8  [uint] U/G Channel Bits Per Sample
 8  [uint] V/B Channel Bits Per Sample
32  [uint] A Channel Data Offset (in bits)
32  [ int] A Channel X Stride (in bits)
32  [ int] A Channel Y Stride (in bits)
32  [uint] Y/R Channel Data Offset (in bits)
32  [ int] Y/R Channel X Stride (in bits)
32  [ int] Y/R Channel Y Stride (in bits)
32  [uint] U/G Channel Data Offset (in bits)
32  [ int] U/G Channel X Stride (in bits)
32  [ int] U/G Channel Y Stride (in bits)
32  [uint] V/B Channel Data Offset (in bits)
32  [ int] V/B Channel X Stride (in bits)
32  [ int] V/B Channel Y Stride (in bits)
Data Packet
 8  0xFF       Data Packet ID
24  "UVS"      Codec identifier, pads data to 32-bits
..  [data]     variable length packed field