OggYUV: Difference between revisions
(deleted notes and "Needs" section) |
(→Arc's Draft: The total number of bits allocated is 256.) |
||
(16 intermediate revisions by 6 users 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 [[ | 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. | ||
Line 15: | 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, | === 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 21: | 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] | 1 [flg] Color (false = B/W, next 8 bits and must be null) | ||
1 [flg] | 3 [int] Chroma Pixel "Shape" (see [[Talk:OggYUV#Chroma_Subsampling_Methods|Draft Table]]) | ||
2 [int] | 1 [flg] 50% physical horizontal offset for Cr samples | ||
1 [flg] | 1 [flg] 50% physical verticle offset for Cr samples | ||
1 [flg] | 2 [int] Chroma blending: 0=None, 1=UpperLeft Sampled/Blend Others, 2=Blend All | ||
1 [flg] | 1 [flg] Packed (false = Planar, next 2 bits must be null) | ||
1 [flg] | 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] Alpha channel bpp | ||
Line 42: | 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 " | 24 "YUV" Codec identifier, pads data to 32-bits | ||
.. [data] variable length packed [a]rgb frame | .. [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 |
Latest revision as of 10:43, 3 June 2010
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