Name

Packed RGB formats — Packed RGB formats

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.

When one of these formats is used, drivers shall report the colorspace V4L2_COLORSPACE_SRGB.

Table 2.6. Packed RGB Image Formats

IdentifierCode Byte 0 in memory Byte 1 Byte 2 Byte 3
  Bit76543210 76543210 76543210 76543210
V4L2_PIX_FMT_RGB332'RGB1' b1b0g2g1g0r2r1r0                          
V4L2_PIX_FMT_RGB444'R444' g3g2g1g0b3b2b1b0 a3a2a1a0r3r2r1r0                 
V4L2_PIX_FMT_RGB555'RGBO' g2g1g0r4r3r2r1r0 ab4b3b2b1b0g4g3                 
V4L2_PIX_FMT_RGB565'RGBP' g2g1g0r4r3r2r1r0 b4b3b2b1b0g5g4g3                 
V4L2_PIX_FMT_RGB555X'RGBQ' ab4b3b2b1b0g4g3 g2g1g0r4r3r2r1r0                 
V4L2_PIX_FMT_RGB565X'RGBR' b4b3b2b1b0g5g4g3 g2g1g0r4r3r2r1r0                 
V4L2_PIX_FMT_BGR666'BGRH' b5b4b3b2b1b0g5g4 g3g2g1g0r5r4r3r2 r1r0              
V4L2_PIX_FMT_BGR24'BGR3' b7b6b5b4b3b2b1b0 g7g6g5g4g3g2g1g0 r7r6r5r4r3r2r1r0        
V4L2_PIX_FMT_RGB24'RGB3' r7r6r5r4r3r2r1r0 g7g6g5g4g3g2g1g0 b7b6b5b4b3b2b1b0        
V4L2_PIX_FMT_BGR32'BGR4' b7b6b5b4b3b2b1b0 g7g6g5g4g3g2g1g0 r7r6r5r4r3r2r1r0 a7a6a5a4a3a2a1a0
V4L2_PIX_FMT_RGB32'RGB4' r7r6r5r4r3r2r1r0 g7g6g5g4g3g2g1g0 b7b6b5b4b3b2b1b0 a7a6a5a4a3a2a1a0

Bit 7 is the most significant bit. The value of a = alpha bits is undefined when reading from the driver, ignored when writing to the driver, except when alpha blending has been negotiated for a Video Overlay or Video Output Overlay or when alpha component has been configured for a Video Capture by means of V4L2_CID_ALPHA_COMPONENT control.

Example 2.2. V4L2_PIX_FMT_BGR24 4 × 4 pixel image

Byte Order. Each cell is one byte.

start + 0:B00G00R00B01G01R01B02G02R02B03G03R03
start + 12:B10G10R10B11G11R11B12G12R12B13G13R13
start + 24:B20G20R20B21G21R21B22G22R22B23G23R23
start + 36:B30G30R30B31G31R31B32G32R32B33G33R33


Important

Drivers may interpret these formats differently.

Some RGB formats above are uncommon and were probably defined in error. Drivers may interpret them as in Table 2.7, “Packed RGB Image Formats (corrected)”.

Table 2.7. Packed RGB Image Formats (corrected)

IdentifierCode Byte 0 in memory Byte 1 Byte 2 Byte 3
  Bit76543210 76543210 76543210 76543210
V4L2_PIX_FMT_RGB332'RGB1' r2r1r0g2g1g0b1b0                          
V4L2_PIX_FMT_RGB444'R444' g3g2g1g0b3b2b1b0 a3a2a1a0r3r2r1r0                 
V4L2_PIX_FMT_RGB555'RGBO' g2g1g0b4b3b2b1b0 ar4r3r2r1r0g4g3                 
V4L2_PIX_FMT_RGB565'RGBP' g2g1g0b4b3b2b1b0 r4r3r2r1r0g5g4g3                 
V4L2_PIX_FMT_RGB555X'RGBQ' ar4r3r2r1r0g4g3 g2g1g0b4b3b2b1b0                 
V4L2_PIX_FMT_RGB565X'RGBR' r4r3r2r1r0g5g4g3 g2g1g0b4b3b2b1b0                 
V4L2_PIX_FMT_BGR666'BGRH' b5b4b3b2b1b0g5g4 g3g2g1g0r5r4r3r2 r1r0              
V4L2_PIX_FMT_BGR24'BGR3' b7b6b5b4b3b2b1b0 g7g6g5g4g3g2g1g0 r7r6r5r4r3r2r1r0        
V4L2_PIX_FMT_RGB24'RGB3' r7r6r5r4r3r2r1r0 g7g6g5g4g3g2g1g0 b7b6b5b4b3b2b1b0        
V4L2_PIX_FMT_BGR32'BGR4' b7b6b5b4b3b2b1b0 g7g6g5g4g3g2g1g0 r7r6r5r4r3r2r1r0 a7a6a5a4a3a2a1a0
V4L2_PIX_FMT_RGB32'RGB4' a7a6a5a4a3a2a1a0 r7r6r5r4r3r2r1r0 g7g6g5g4g3g2g1g0 b7b6b5b4b3b2b1b0

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