The Pixel Rosetta Stone: Packings and Colorspaces

Assembled by Chris Pirazzi. Information provided by folks throughout the company, including Brian Beach, David Blythe, Nelson Bolyard, Terry Crane, Patricia Creek, Carolyn Curtis, Hilton Goldstein, Bent Hagemark, Angela Lai, Michael Minakami, Paul Ning, Michael Portuesi, Mark Segal, Paul Spencer, Mike Travis, Ashok Yerneni, and several mailing lists.

This document has two goals:

This document makes no attempt at generality. As new packings and colorspaces are born, or otherwise become useful to video developers, we'll change our descriptive mechanism to fit them. The sections are:

Introduction

Tower of Babel?

Your first question is probably "Which of these zillions of packings are useful?" Each of these packings has some reason to exist, but the three most commonly used packings are:

Packing vs. Colorspace

In our model, all images have four components, numbered 1 through 4.

A packing

A colorspace

In most SGI libraries, a single token encodes both colorspace and packing. Often, details of the colorspace are implicit. For the VL of divo and beyond, the two parameters are specified separately and explicitly, using VL_PACKING and VL_COLORSPACE. See How to Tell Which Colorspace You Have to understand which libraries use which colorspace when.

If you were wondering, 12-13 bit signed components are useful for storing rgba components which have been converted from the vyua color set. For example, this happens when you transfer in-memory RGB pixels to or from an external Rec. 601 digital video signal. Because of the way the color sets are defined, there exist vyua values which map outside of the normal rgba color cube. The rgba values must either be clamped, in which case information is lost, or the rgba component representation must be allowed to exceed the normal values. This is fully described in the most excellent Appendix "Color-Space Conversions" of the DIVO (Digital Video Option) XIO Board Owner's Guide.

Packings

How to Read the Packing Diagrams

In the diagrams below,

Pixel Packings, Sorted by Width

8 Bit Pixel Packings

Pixel 1
Byte 1
yyyyyyyy


Pixel 1
Byte 1
bbgggrrr


Pixel 1
Byte 1
rrrbbggg


Pixel 1
Byte 1
rrrgggbb


12 Bit Pixel Packings

Pixels 1-4
Byte 1Byte 2Byte 3Byte 4Byte 5Byte 6
uuuuuuuuyyyyyyyyvvvvvvvvyyyyyyyyyyyyyyyyyyyyyyyy
center top left center top right bottom left bottom right


16 Bit Pixel Packings

Pixel 1
Byte 1Byte 2
yyyyyyyyaaaaaaaa


Pixels 1-2
Byte 1Byte 2Byte 3Byte 4
vvvvvvvvyyyyyyyyuuuuuuuuyyyyyyyy
left right


Pixels 1-2
Byte 1Byte 2Byte 3Byte 4
uuuuuuuuyyyyyyyyvvvvvvvvyyyyyyyy
left right


Pixel 1
Byte 1Byte 2
arrrrrgggggbbbbb


Pixel 1
Byte 1Byte 2
rrrrrgggggbbbbba


Pixel 1
Byte 1Byte 2
rrrrrggggggbbbbb


20 Bit Pixel Packings

Pixels 1-2
Byte 1Byte 2Byte 3Byte 4Byte 5
uuuuuuuuuuyyyyyyyyyyvvvvvvvvvvyyyyyyyyyy
left right


Pixels 1-2
Byte 1Byte 2Byte 3Byte 4Byte 5
vvvvvvvvvvyyyyyyyyyyuuuuuuuuuuyyyyyyyyyy
left right


24 Bit Pixel Packings

Pixel 1
Byte 1Byte 2Byte 3
rrrrrrrrggggggggbbbbbbbb
vvvvvvvvyyyyyyyyuuuuuuuu


Pixel 1
Byte 1Byte 2Byte 3
bbbbbbbbggggggggrrrrrrrr
uuuuuuuuyyyyyyyyvvvvvvvv


Pixel 1
Byte 1Byte 2Byte 3
rrrrrrggggggbbbbbbaaaaaa
vvvvvvyyyyyyuuuuuuaaaaaa


OpenGL-Like 32-bit Packings:

Pixel 1
Byte 1Byte 2Byte 3Byte 4
rrrrrrrrggggggggbbbbbbbbaaaaaaaa
vvvvvvvvyyyyyyyyuuuuuuuuaaaaaaaa


Pixel 1
Byte 1Byte 2Byte 3Byte 4
rrrrrrrrggggggggbbbbbbbbxxxxxxxx


IRIS GL-Like 32-bit Packings:

Pixel 1
Byte 1Byte 2Byte 3Byte 4
aaaaaaaabbbbbbbbggggggggrrrrrrrr
aaaaaaaauuuuuuuuyyyyyyyyvvvvvvvv


Pixel 1
Byte 1Byte 2Byte 3Byte 4
xxxxxxxxbbbbbbbbggggggggrrrrrrrr
xxxxxxxxuuuuuuuuyyyyyyyyvvvvvvvv


Unusual 32-bit Packings:

Pixel 1
Byte 1Byte 2Byte 3Byte 4
aaaaaaaarrrrrrrrggggggggbbbbbbbb


Pixel 1
Byte 1Byte 2Byte 3Byte 4
xxxxxxxxrrrrrrrrggggggggbbbbbbbb
xxxxxxxxvvvvvvvvyyyyyyyyuuuuuuuu


Pixel 1
Byte 1Byte 2Byte 3Byte 4
uuuuuuuuyyyyyyyyvvvvvvvvaaaaaaaa


4:4:4:4 10_10_10_2 32-bit Packings:

Pixel 1
Byte 1Byte 2Byte 3Byte 4
rrrrrrrrrrggggggggggbbbbbbbbbbaa
vvvvvvvvvvyyyyyyyyyyuuuuuuuuuuaa


Pixel 1
Byte 1Byte 2Byte 3Byte 4
aabbbbbbbbbbggggggggggrrrrrrrrrr
aauuuuuuuuuuyyyyyyyyyyvvvvvvvvvv


4:2:2:4 10_10_10_2 32-bit Packings:

Pixels 1-2
Byte 1Byte 2Byte 3Byte 4Byte 5Byte 6Byte 7Byte 8
vvvvvvvvvvyyyyyyyyyyaaaaaaaaaa00uuuuuuuuuuyyyyyyyyyyaaaaaaaaaa00
left 00left right 00


Pixels 1-2
Byte 1Byte 2Byte 3Byte 4Byte 5Byte 6Byte 7Byte 8
uuuuuuuuuuyyyyyyyyyyaaaaaaaaaa00vvvvvvvvvvyyyyyyyyyyaaaaaaaaaa00
left 00left right 00


4:2:2 10_in_16 32-bit Packings:

Pixels 1-2
Byte 1Byte 2Byte 3Byte 4Byte 5Byte 6Byte 7Byte 8
vvvvvvvvvvppppppyyyyyyyyyyppppppuuuuuuuuuuppppppyyyyyyyyyypppppp
left ppppppleft ppppppleft ppppppright pppppp


Pixels 1-2
Byte 1Byte 2Byte 3Byte 4Byte 5Byte 6Byte 7Byte 8
000000vvvvvvvvvv000000yyyyyyyyyy000000uuuuuuuuuu000000yyyyyyyyyy
000000left 000000left 000000left 000000right


Pixels 1-2
Byte 1Byte 2Byte 3Byte 4Byte 5Byte 6Byte 7Byte 8
uuuuuuuuuuppppppyyyyyyyyyyppppppvvvvvvvvvvppppppyyyyyyyyyypppppp
left ppppppleft ppppppleft ppppppright pppppp


Pixels 1-2
Byte 1Byte 2Byte 3Byte 4Byte 5Byte 6Byte 7Byte 8
000000uuuuuuuuuu000000yyyyyyyyyy000000vvvvvvvvvv000000yyyyyyyyyy
000000left 000000left 000000left 000000right


36 Bit Pixel Packings

Pixel 1Pixel 2
Byte 1Byte 2Byte 3Byte 4Byte 5Byte 6Byte 7Byte 8Byte 9
rrrrrrrrrrrrggggggggggggbbbbbbbbbbbbrrrrrrrrrrrrggggggggggggbbbbbbbbbbbb
vvvvvvvvvvvvyyyyyyyyyyyyuuuuuuuuuuuuvvvvvvvvvvvvyyyyyyyyyyyyuuuuuuuuuuuu


48 Bit Pixel Packings

Pixel 1
Byte 1Byte 2Byte 3Byte 4Byte 5Byte 6
rrrrrrrrrrppppppggggggggggppppppbbbbbbbbbbpppppp
vvvvvvvvvvppppppyyyyyyyyyyppppppuuuuuuuuuupppppp


Pixel 1
Byte 1Byte 2Byte 3Byte 4Byte 5Byte 6
rrrrrrrrrrrrggggggggggggbbbbbbbbbbbbaaaaaaaaaaaa
vvvvvvvvvvvvyyyyyyyyyyyyuuuuuuuuuuuuaaaaaaaaaaaa


64 Bit Pixel Packings

Pixel 1
Byte 1Byte 2Byte 3Byte 4Byte 5Byte 6Byte 7Byte 8
rrrrrrrrrrppppppggggggggggppppppbbbbbbbbbbppppppaaaaaaaaaapppppp
vvvvvvvvvvppppppyyyyyyyyyyppppppuuuuuuuuuuppppppaaaaaaaaaapppppp


Pixel 1
Byte 1Byte 2Byte 3Byte 4Byte 5Byte 6Byte 7Byte 8
000000rrrrrrrrrr000000gggggggggg000000bbbbbbbbbb000000aaaaaaaaaa
000000vvvvvvvvvv000000yyyyyyyyyy000000uuuuuuuuuu000000aaaaaaaaaa


Pixel 1
Byte 1Byte 2Byte 3Byte 4Byte 5Byte 6Byte 7Byte 8
aaaaaaaaaappppppbbbbbbbbbbppppppggggggggggpppppprrrrrrrrrrpppppp
aaaaaaaaaappppppuuuuuuuuuuppppppyyyyyyyyyyppppppvvvvvvvvvvpppppp


Pixel 1
Byte 1Byte 2Byte 3Byte 4Byte 5Byte 6Byte 7Byte 8
xxxxxxxxxxppppppbbbbbbbbbbppppppggggggggggpppppprrrrrrrrrrpppppp


Pixel 1
Byte 1Byte 2Byte 3Byte 4Byte 5Byte 6Byte 7Byte 8
rrrrrrrrrrrrppppggggggggggggppppbbbbbbbbbbbbppppaaaaaaaaaaaapppp


Pixel 1
Byte 1Byte 2Byte 3Byte 4Byte 5