OggYUV
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.
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
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.
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] Interlaced 1 [flg] Packed (False = Planar) 2 [int] Number of Chroma/Luna (1, 2, 4, or 8) 1 [flg] Horizontal Staggered Chroma 1 [flg] Verticle Staggered Chroma 1 [flg] Staggered Chroma 1 [flg] Horizontal Stagger 8 [nil] Padding to bring to 32-bit border -- 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 "RGB" Codec identifier, pads data to 32-bits .. [data] variable length packed [a]rgb frame
- bits per channel (typically 8:8:8, does this ever differ?)