OggYUV

From XiphWiki

(Difference between revisions)
Jump to: navigation, search
(Arc's Draft: The total number of bits allocated is 256.)
 
(17 intermediate revisions not shown)
Line 1: Line 1:
 +
{{historical}}
 +
{{draft}}
== What is it ==
== What is it ==
Line 8: Line 10:
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.
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.
+
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_Draft1]] in a much more reliable way than yuv4mpeg2 + wav audio.
-
 
+
-
 
+
-
== Needs ==
+
-
 
+
-
We need to support the following options:
+
-
* chroma subsampling (typically 4:2:0, 4:2:2, or 4:4:4)
+
-
 
+
-
 
+
-
Chroma Subsampling (these are my suggestions used for example only)
+
-
  0 4:4:4
+
-
  1 4:1:1
+
-
  2 4:2:2 doubled
+
-
  3 4:2:2 blended
+
-
  4 4:2:0 doubled
+
-
  5 4:2:0 blended
+
-
  6 <something else, maybe 4:1:0>
+
-
  7 Extended
+
-
 
+
-
Bit Packing (again, only examples)
+
-
  0 Planar Y8 UV8
+
-
  1 Planar Y16 UV8
+
-
  2 Planar Y16 UV16
+
-
  3 Planar Y24 UV12
+
-
  3 Packed Y8 UV8
+
-
  4 Packed Y16 UV8
+
-
  5 Packed Y16 UV16
+
-
  6 Packed Y12 UV10
+
-
  7 <something else>
+
-
  ...
+
-
15 Extended
+
-
 
+
Line 46: Line 17:
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.
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.
-
  Packet 0, BOS, 24 bytes
+
=== Arc's Draft ===
 +
  Packet 0, BOS, 32 bytes
   8  0x00  Header Packet ID
   8  0x00  Header Packet ID
  24  "YUV"  Codec identifier  
  24  "YUV"  Codec identifier  
Line 52: Line 24:
   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 [flgPacked (False = Planar)
+
   3 [intChroma 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 [nilPadding to bring to 32-bit border
+
   1  [flg]  Cr Staggered Vertically in Bytestream
 +
   1  [flg]  Big Endian/LSB (false = Little Endian/MSB)
 +
   1 [flgInterlaced (false = Progressive)
 +
  3  ?????  Interlace Options, other bytestream options
   --
   --
   8  [int]  Alpha channel bpp
   8  [int]  Alpha channel bpp
Line 73: Line 48:
  32  [int]  Framerate Numerator
  32  [int]  Framerate Numerator
  32  [int]  Framerate Denominator
  32  [int]  Framerate Denominator
-
 
  Data Packet
  Data Packet
   8  0xFF      Data Packet ID
   8  0xFF      Data Packet ID
-
  24  "RGB"      Codec identifier, pads data to 32-bits
+
  24  "YUV"      Codec identifier, pads data to 32-bits
  ..  [data]    variable length packed [a]rgb frame
  ..  [data]    variable length packed [a]rgb frame
-
* bits per channel (typically 8:8:8, does this ever differ?)
+
=== John's Draft ===
 +
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.
 +
 
 +
Packet 0, BOS, 72 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 ----
 +
  8 [bits] Reserved 1
 +
  8  [enum] Colorspace
 +
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
 +
32  [uint] FourCC (optional, set to zero if N/A or unknown)
 +
---- Sampling description ----
 +
16  [uint] Stored Width
 +
16  [uint] Stored Height
 +
14  [uint] Reserved 2
 +
  1  [uint] Endianness Flag
 +
  1  [uint] Interlaced Flag
 +
  2  [uint] U Channel Horiz. (X) Samples/Macropixel, 0 = 4.
 +
  2  [uint] U Channel Vert. (Y) Samples/Macropixel, 0 = 4.
 +
  2  [uint] V Channel Horiz. (X) Samples/Macropixel, 0 = 4.
 +
  2  [uint] V Channel Vert. (Y) Samples/Macropixel, 0 = 4.
 +
  1  [uint] Top Field U Channel Horiz. Sample Offset Flag
 +
  1  [uint] Bot Field U Channel Horiz. Sample Offset Flag
 +
  1  [uint] Top Field U Channel Vert. Sample Offset Flag
 +
  1  [uint] Bot Field U Channel Vert. Sample Offset Flag
 +
  1  [uint] Top Field V Channel Horiz. Sample Offset Flag
 +
  1  [uint] Bot Field V Channel Horiz. Sample Offset Flag
 +
  1  [uint] Top Field V Channel Vert. Sample Offset Flag
 +
  1  [uint] Bot Field V Channel Vert. Sample Offset Flag
 +
  ---- 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  [uint] Y/R Channel Data Offset (in bits)
 +
32  [uint] U/G Channel Data Offset (in bits)
 +
32  [uint] V/B Channel Data Offset (in bits)
 +
32  [ int] A Channel Y Stride (in bits)
 +
32  [ int] Y/R Channel Y Stride (in bits)
 +
32  [ int] U/G Channel Y Stride (in bits)
 +
32  [ int] V/B Channel Y Stride (in bits)
 +
  8  [ int] A Channel X Stride (in bits)
 +
  8  [ int] Y/R Channel X Stride (in bits)
 +
  8  [ int] U/G Channel X Stride (in bits)
 +
  8  [ int] V/B Channel X Stride (in bits)
 +
 
 +
'''Data Packets'''
 +
  8  0xFF      Top Field Packet ID
 +
24  "UVS"      Codec identifier, pads data to 32-bits
 +
..  [data]    variable length packed field
 +
 
 +
  8  0xFB      Bottom Field Packet ID
 +
24  "UVS"      Codec identifier, pads data to 32-bits
 +
..  [data]    variable length packed field

Latest revision as of 18:43, 3 June 2010

This page is currently inactive and is kept primarily for historical interest.

Contents

The following is a draft. It is at best incomplete and at worst completely broken. In any case, it is not an "official" Xiph spec/codec, so use with care.

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_Draft1 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, 32 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

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.

Packet 0, BOS, 72 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 ----
 8  [bits] Reserved 1
 8  [enum] Colorspace
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
32  [uint] FourCC (optional, set to zero if N/A or unknown)
---- Sampling description ----
16  [uint] Stored Width
16  [uint] Stored Height
14  [uint] Reserved 2
 1  [uint] Endianness Flag
 1  [uint] Interlaced Flag
 2  [uint] U Channel Horiz. (X) Samples/Macropixel, 0 = 4.
 2  [uint] U Channel Vert. (Y) Samples/Macropixel, 0 = 4.
 2  [uint] V Channel Horiz. (X) Samples/Macropixel, 0 = 4.
 2  [uint] V Channel Vert. (Y) Samples/Macropixel, 0 = 4.
 1  [uint] Top Field U Channel Horiz. Sample Offset Flag
 1  [uint] Bot Field U Channel Horiz. Sample Offset Flag
 1  [uint] Top Field U Channel Vert. Sample Offset Flag
 1  [uint] Bot Field U Channel Vert. Sample Offset Flag
 1  [uint] Top Field V Channel Horiz. Sample Offset Flag
 1  [uint] Bot Field V Channel Horiz. Sample Offset Flag
 1  [uint] Top Field V Channel Vert. Sample Offset Flag
 1  [uint] Bot Field V Channel Vert. Sample Offset Flag
 ---- 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  [uint] Y/R Channel Data Offset (in bits)
32  [uint] U/G Channel Data Offset (in bits)
32  [uint] V/B Channel Data Offset (in bits)
32  [ int] A Channel Y Stride (in bits)
32  [ int] Y/R Channel Y Stride (in bits)
32  [ int] U/G Channel Y Stride (in bits)
32  [ int] V/B Channel Y Stride (in bits)
 8  [ int] A Channel X Stride (in bits)
 8  [ int] Y/R Channel X Stride (in bits)
 8  [ int] U/G Channel X Stride (in bits)
 8  [ int] V/B Channel X Stride (in bits)

Data Packets

 8  0xFF       Top Field Packet ID
24  "UVS"      Codec identifier, pads data to 32-bits
..  [data]     variable length packed field
 8  0xFB       Bottom Field Packet ID
24  "UVS"      Codec identifier, pads data to 32-bits
..  [data]     variable length packed field
Retrieved from "http://wiki.xiph.org/OggYUV"
Personal tools


Main Page

Xiph.Org Projects

Audio—

Video—

Text—

Container—

Streaming—