2.5.1. Packed RGB formats

2.5.1.1. Description

These formats are designed to match the pixel formats of typical PC graphics frame buffers. They occupy 8, 16, 24 or 32 bits per pixel. These are all packed-pixel formats, meaning all the data for a pixel lie next to each other in memory.

Packed RGB Image Formats
Identifier Code Byte 0 in memory Byte 1 Byte 2 Byte 3
    7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
V4L2_PIX_FMT_RGB332 ‘RGB1’ r2 r1 r0 g2 g1 g0 b1 b0
V4L2_PIX_FMT_ARGB444 ‘AR12’ g3 g2 g1 g0 b3 b2 b1 b0 a3 a2 a1 a0 r3 r2 r1 r0
V4L2_PIX_FMT_XRGB444 ‘XR12’ g3 g2 g1 g0 b3 b2 b1 b0 r3 r2 r1 r0
V4L2_PIX_FMT_RGBA444 ‘RA12’ b3 b2 b1 b0 a3 a2 a1 a0 r3 r2 r1 r0 g3 g2 g1 g0
V4L2_PIX_FMT_RGBX444 ‘RX12’ b3 b2 b1 b0 r3 r2 r1 r0 g3 g2 g1 g0
V4L2_PIX_FMT_ABGR444 ‘AB12’ g3 g2 g1 g0 r3 r2 r1 r0 a3 a2 a1 a0 b3 b2 b1 b0
V4L2_PIX_FMT_XBGR444 ‘XB12’ g3 g2 g1 g0 r3 r2 r1 r0 b3 b2 b1 b0
V4L2_PIX_FMT_BGRA444 ‘BA12’ r3 r2 r1 r0 a3 a2 a1 a0 b3 b2 b1 b0 g3 g2 g1 g0
V4L2_PIX_FMT_BGRX444 ‘BX12’ r3 r2 r1 r0 b3 b2 b1 b0 g3 g2 g1 g0
V4L2_PIX_FMT_ARGB555 ‘AR15’ g2 g1 g0 b4 b3 b2 b1 b0 a r4 r3 r2 r1 r0 g4 g3
V4L2_PIX_FMT_XRGB555 ‘XR15’ g2 g1 g0 b4 b3 b2 b1 b0 r4 r3 r2 r1 r0 g4 g3
V4L2_PIX_FMT_RGBA555 ‘RA15’ g1 g0 b4 b3 b2 b1 b0 a r4 r3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 g6 g5 g4 g3 g2 g1 g0 r7 r6 r5 r4 r3 r2 r1 r0 a7 a6 a5 a4 a3 a2 a1

a0

V4L2_PIX_FMT_XBGR32 ‘XR24’ b7 b6 b5 b4 b3 b2 b1 b0 g7 g6 g5 g4 g3 g2 g1 g0 r7 r6 r5 r4 r3 r2 r1 r0
V4L2_PIX_FMT_BGRA32 ‘RA24’ a7 a6 a5 a4 a3 a2 a1 a0 b7 b6 b5 b4 b3 b2 b1 b0 g7 g6 g5 g4 g3 g2 g1 g0 r7 r6 r5 r4 r3 r2 r1

r0

V4L2_PIX_FMT_BGRX32 ‘RX24’ b7 b6 b5 b4 b3 b2 b1 b0 g7 g6 g5 g4 g3 g2 g1 g0 r7 r6 r5 r4 r3 r2 r1

r0

V4L2_PIX_FMT_RGBA32 ‘AB24’ r7 r6 r5 r4 r3 r2 r1 r0 g7 g6 g5 g4 g3 g2 g1 g0 b7 b6 b5 b4 b3 b2 b1 b0 a7 a6 a5 a4 a3 a2 a1

a0

V4L2_PIX_FMT_RGBX32 ‘XB24’ r7 r6 r5 r4 r3 r2 r1 r0 g7 g6 g5 g4 g3 g2 g1 g0 b7 b6 b5 b4 b3 b2 b1 b0
V4L2_PIX_FMT_ARGB32 ‘BA24’ a7 a6 a5 a4 a3 a2 a1 a0 r7 r6 r5 r4 r3 r2 r1 r0 g7 g6 g5 g4 g3 g2 g1 g0 b7 b6 b5 b4 b3 b2 b1

b0

V4L2_PIX_FMT_XRGB32 ‘BX24’ r7 r6 r5 r4 r3 r2 r1 r0 g7 g6 g5 g4 g3 g2 g1 g0 b7 b6 b5 b4 b3 b2 b1

b0

Note

Bit 7 is the most significant bit.

The usage and value of the alpha bits (a) in the ARGB and ABGR formats (collectively referred to as alpha formats) depend on the device type and hardware operation. Capture devices (including capture queues of mem-to-mem devices) fill the alpha component in memory. When the device outputs an alpha channel the alpha component will have a meaningful value. Otherwise, when the device doesn’t output an alpha channel but can set the alpha bit to a user-configurable value, the V4L2_CID_ALPHA_COMPONENT control is used to specify that alpha value, and the alpha component of all pixels will be set to the value specified by that control. Otherwise a corresponding format without an alpha component (XRGB or XBGR) must be used instead of an alpha format.

Output devices (including output queues of mem-to-mem devices and video output overlay devices) read the alpha component from memory. When the device processes the alpha channel the alpha component must be filled with meaningful values by applications. Otherwise a corresponding format without an alpha component (XRGB or XBGR) must be used instead of an alpha format.

The XRGB and XBGR formats contain undefined bits (-). Applications, devices and drivers must ignore those bits, for both Video Capture Interface and Video Output Interface devices.

Byte Order. Each cell is one byte.

RGB byte order
start + 0: B00 G00 R00 B01 G01 R01 B02 G02 R02 B03 G03 R03
start + 12: B10 G10 R10 B11 G11 R11 B12 G12 R12 B13 G13 R13
start + 24: B20 G20 R20 B21 G21 R21 B22 G22 R22 B23 G23 R23
start + 36: B30 G30 R30 B31 G31 R31 B32 G32 R32 B33 G33 R33

Formats defined in Deprecated Packed RGB Image Formats are deprecated and must not be used by new drivers. They are documented here for reference. The meaning of their alpha bits (a) are ill-defined and interpreted as in either the corresponding ARGB or XRGB format, depending on the driver.

Deprecated Packed RGB Image Formats
Identifier Code Byte 0 in memory Byte 1 Byte 2 Byte 3
    7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
V4L2_PIX_FMT_RGB444 ‘R444’ g3 g2 g1 g0 b3 b2 b1 b0 a3 a2 a1 a0 r3 r2 r1 r0
V4L2_PIX_FMT_RGB555 ‘RGBO’ g2 g1 g0 b4 b3 b2 b1 b0 a r4 r3 r2 r1 r0 g4 g3
V4L2_PIX_FMT_RGB555X ‘RGBQ’ a r4 r3 r2 r1 r0 g4 g3 g2 g1 g0 b4 b3 b2 b1 b0
V4L2_PIX_FMT_BGR32 ‘BGR4’ b7 b6 b5 b4 b3 b2 b1 b0 g7 g6 g5 g4 g3 g2 g1 g0 r7 r6 r5 r4 r3 r2 r1 r0 a7 a6 a5 a4 a3 a2 a1

a0

V4L2_PIX_FMT_RGB32 ‘RGB4’ a7 a6 a5 a4 a3 a2 a1 a0 r7 r6 r5 r4 r3 r2 r1 r0 g7 g6 g5 g4 g3 g2 g1 g0 b7 b6 b5 b4 b3 b2 b1

b0

A test utility to determine which RGB formats a driver actually supports is available from the LinuxTV v4l-dvb repository. See https://linuxtv.org/repo/ for access instructions.