Appendix A. Pixels in Memory

This appendix provides examples of the more common in-memory pixel formats and their corresponding ML parameters:

Greyscale Examples

This section discusses the following:

8-bit Greyscale (1 Byte Per Pixel)

byte 0
7      0
+------+
YYYYYYYY

Parameters:

ML_PACKING_8
ML_COLORSPACE_CbYCr_*
ML_SAMPLING_400

Padded 12-bit Greyscale (1 Short Per Pixel)

short 0
15             0
+--------------+
ssssYYYYYYYYYYYY

Parameters:

ML_PACKING_S12in16R
ML_COLORSPACE_CbYCr_*
ML_SAMPLING_400

RGB Examples

This section discusses the following:

8-bit RGB (3 Bytes Per Pixel)

byte 0    byte 1    byte 2
7      0  7      0  7      0
+------+  +------+  +------+
RRRRRRRR  GGGGGGGG  BBBBBBBB

Parameters:

ML_PACKING_8
ML_COLORSPACE_RGB_*
ML_SAMPLING_444

8-bit BGR (3 Bytes Per Pixel)

byte 0    byte 1    byte 2
7      0  7      0  7      0
+------+  +------+  +------+
BBBBBBBB  GGGGGGGG  RRRRRRRR

Parameters:

ML_PACKING_8_R
ML_COLORSPACE_RGB_*
ML_SAMPLING_444

8-bit RGBA (4 Bytes Per Pixel)

byte 0    byte 1    byte 2    byte 3
7      0  7      0  7      0  7      0
+------+  +------+  +------+  +------+
RRRRRRRR  GGGGGGGG  BBBBBBBB  AAAAAAAA

Parameters:

ML_PACKING_8
ML_COLORSPACE_RGB_*
ML_SAMPLING_4444

8-bit ABGR (4 Bytes Per Pixel)

byte 0    byte 1    byte 2    byte3
7      0  7      0  7      0  7      0
+------+  +------+  +------+  +------+
AAAAAAAA  BBBBBBBB  GGGGGGGG  RRRRRRRR

Parameters:

ML_PACKING_8_R
ML_COLORSPACE_RGB_*
ML_SAMPLING_444

10-bit RGB (One 32-bit Integer Per Pixel)

31            int              0
+------------------------------+
RRRRRRRRRRGGGGGGGGGGBBBBBBBBBB00

Parameters:

ML_PACKING_10_10_10_2
ML_COLORSPACE_RGB_*
ML_SAMPLING_444

10-bit RGBA (One 32-bit Integer Per Pixel)

31            int              0
+------------------------------+
RRRRRRRRRRGGGGGGGGGGBBBBBBBBBBAA

Parameters:

ML_PACKING_10_10_10_2
ML_COLORSPACE_RGB_*
ML_SAMPLING_4444

12-bit RGBA (6 Bytes Per Pixel)

byte 0    byte 1    byte 2    byte 3    byte 4    byte 5
7      0  7      0  7      0  7      0  7      0  7      0
+------+  +------+  +------+  +------+  +------+  +------+
RRRRRRRR  RRRRGGGG  GGGGGGGG  BBBBBBBB  BBBBAAAA  AAAAAAAA

Parameters:

ML_PACKING_S12
ML_COLORSPACE_RGB_*
ML_SAMPLING_4444

Padded 12-bit RGB (Three 16-bit shorts per pixel)

short 0           short 1           short 2
15             0  15             0  15             0
+--------------+  +--------------+  +--------------+
ssssRRRRRRRRRRRR  ssssGGGGGGGGGGGG  ssssBBBBBBBBBBBB

Parameters:

ML_PACKING_S12in16R
ML_COLORSPACE_RGB_*
ML_SAMPLING_444

Padded 12-bit RGBA (Four 16-bit Shorts Per Pixel)

short 0           short 1           short 2           short 3
15             0  15             0  15             0  15             0
+--------------+  +--------------+  +--------------+  +--------------+
ssssRRRRRRRRRRRR  ssssGGGGGGGGGGGG  ssssBBBBBBBBBBBB  ssssAAAAAAAAAAAA

Parameters:

ML_PACKING_S12in16R
ML_COLORSPACE_RGB_*
ML_SAMPLING_4444

CbYCr Examples

This section discusses the following:

8-bit CbYCr (3 Bytes Per Pixel)

byte 0    byte 1    byte 2
7      0  7      0  7      0
+------+  +------+  +------+
bbbbbbbb  YYYYYYYY  rrrrrrrr

Parameters:

ML_PACKING_8
ML_COLORSPACE_CbYCr_*
ML_SAMPLING_444

8-bit CbYCrA (4 Bytes Per Pixel)

byte 0    byte 1    byte 2    byte 3
7      0  7      0  7      0  7      0
+------+  +------+  +------+  +------+
bbbbbbbb  YYYYYYYY  rrrrrrrr  AAAAAAAA

Parameters:

ML_PACKING_8
ML_COLORSPACE_CbYCr_*
ML_SAMPLING_4444

10-bit CbYCr (One 32-bit Integer Per Pixel)

31            int              0
+------------------------------+
bbbbbbbbbbYYYYYYYYYYrrrrrrrrrr00

Parameters:

ML_PACKING_10_10_10_2
ML_COLORSPACE_CbYCr_*
ML_SAMPLING_444

10-bit CbYCrA (One 32-bit Integer Per Pixel)

31             int             0
+------------------------------+
bbbbbbbbbbYYYYYYYYYYrrrrrrrrrrAA

Parameters:

ML_PACKING_10_10_10_2
ML_COLORSPACE_CbYCr_*
ML_SAMPLING_4444

Padded 12-bit CbYCrA (Four 16-bit Shorts Per Pixel)

short 0           short 1           short 2           short 3
15             0  15             0  15             0  15             0
+--------------+  +--------------+  +--------------+  +--------------+
ssssbbbbbbbbbbbb  ssssYYYYYYYYYYYY  ssssrrrrrrrrrrrr  ssssAAAAAAAAAAAA

Parameters:

ML_PACKING_S12in16R
ML_COLORSPACE_CbYCr_*
ML_SAMPLING_4444

422x CbYCr Examples

This section discusses the following:

10-bit 422 CbYCr (5 Bytes Per 2 Pixels)

   byte 0    byte 1    byte 2    byte 3    byte 4
   7      0  7      0  7      0  7      0  7      0
   +------+  +------+  +------+  +------+  +------+
   bbbbbbbb  bbYYYYYY  YYYYrrrr  rrrrrrYY  YYYYYYYY

pixel 1

      ++++++++  ++++++++  ++++++++  ++++++

pixel 2

      ++++++++  ++        ++++      ++++++++  ++++++++

Parameters:

ML_PACKING_10
ML_COLORSPACE_CbYCr_*
ML_SAMPLING_422

10-bit 422 CbYCr (5 Bytes Per 2 Pixels)

   byte 0    byte 1    byte 2    byte 3    byte 4
   7      0  7      0  7      0  7      0  7      0
   +------+  +------+  +------+  +------+  +------+
   bbbbbbbb  bbYYYYYY  YYYYrrrr  rrrrrrYY  YYYYYYYY

pixel 1

      ++++++++  ++++++++  ++++++++  ++++++

pixel 2

      ++++++++  ++        ++++      ++++++++  ++++++++

Parameters:

ML_PACKING_10_R
ML_COLORSPACE_CbYCr_*
ML_SAMPLING_422

Padded 12-bit 422 CbYCr (Four 16-bit Shorts Per 2 Pixels)

short 0           short 1           short 2           short 3
15             0  15             0  15             0  15             0
+--------------+  +--------------+  +--------------+  +--------------+
ssssbbbbbbbbbbbb  ssssYYYYYYYYYYYY  ssssrrrrrrrrrrrr  ssssYYYYYYYYYYYY

pixel 1

   ++++++++++++++++  ++++++++++++++++  ++++++++++++++++

pixel 2
   ++++++++++++++++                    ++++++++++++++++  ++++++++++++++++

Parameters:

ML_PACKING_S12in16R
ML_COLORSPACE_CbYCr_*
ML_SAMPLING_422

10-bit 4224 CbYCrA (Two 32-bit Integers Per 2 Pixels)

31          int 0              0  31          int 1              0
+------------------------------+  +------------------------------+
bbbbbbbbbbYYYYYYYYYYAAAAAAAAAA00  rrrrrrrrrrYYYYYYYYYYAAAAAAAAAA00

pixel 1

   ++++++++++++++++++++++++++++++    ++++++++++

pixel 2
   ++++++++++                        ++++++++++++++++++++++++++++++

Parameters:

ML_PACKING_10_10_10_2
ML_COLORSPACE_CbYCr_*
ML_SAMPLING_4224