Media Bus Formats struct <structname>v4l2_mbus_framefmt</structname> &cs-str; __u32 width Image width, in pixels. __u32 height Image height, in pixels. __u32 code Format code, from &v4l2-mbus-pixelcode;. __u32 field Field order, from &v4l2-field;. See for details. __u32 colorspace Image colorspace, from &v4l2-colorspace;. See for details. __u32 reserved[7] Reserved for future extensions. Applications and drivers must set the array to zero.
Media Bus Pixel Codes The media bus pixel codes describe image formats as flowing over physical busses (both between separate physical components and inside SoC devices). This should not be confused with the V4L2 pixel formats that describe, using four character codes, image formats as stored in memory. While there is a relationship between image formats on busses and image formats in memory (a raw Bayer image won't be magically converted to JPEG just by storing it to memory), there is no one-to-one correspondance between them.
Packed RGB Formats Those formats transfer pixel data as red, green and blue components. The format code is made of the following information. The red, green and blue components order code, as encoded in a pixel sample. Possible values are RGB and BGR. The number of bits per component, for each component. The values can be different for all components. Common values are 555 and 565. The number of bus samples per pixel. Pixels that are wider than the bus width must be transferred in multiple samples. Common values are 1 and 2. The bus width. For formats where the total number of bits per pixel is smaller than the number of bus samples per pixel times the bus width, a padding value stating if the bytes are padded in their most high order bits (PADHI) or low order bits (PADLO). For formats where the number of bus samples per pixel is larger than 1, an endianness value stating if the pixel is transferred MSB first (BE) or LSB first (LE). For instance, a format where pixels are encoded as 5-bits red, 5-bits green and 5-bit blue values padded on the high bit, transferred as 2 8-bit samples per pixel with the most significant bits (padding, red and half of the green value) transferred first will be named V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE. The following tables list existing packet RGB formats. RGB formats Identifier Code Data organization Bit 7 6 5 4 3 2 1 0 V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE 0x1001 0 0 0 0 r3 r2 r1 r0 g3 g2 g1 g0 b3 b2 b1 b0 V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE 0x1002 g3 g2 g1 g0 b3 b2 b1 b0 0 0 0 0 r3 r2 r1 r0 V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE 0x1003 0 r4 r3 r2 r1 r0 g4 g3 g2 g1 g0 b4 b3 b2 b1 b0 V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE 0x1004 g2 g1 g0 b4 b3 b2 b1 b0 0 r4 r3 r2 r1 r0 g4 g3 V4L2_MBUS_FMT_BGR565_2X8_BE 0x1005 b4 b3 b2 b1 b0 g5 g4 g3 g2 g1 g0 r4 r3 r2 r1 r0 V4L2_MBUS_FMT_BGR565_2X8_LE 0x1006 g2 g1 g0 r4 r3 r2 r1 r0 b4 b3 b2 b1 b0 g5 g4 g3 V4L2_MBUS_FMT_RGB565_2X8_BE 0x1007 r4 r3 r2 r1 r0 g5 g4 g3 g2 g1 g0 b4 b3 b2 b1 b0 V4L2_MBUS_FMT_RGB565_2X8_LE 0x1008 g2 g1 g0 b4 b3 b2 b1 b0 r4 r3 r2 r1 r0 g5 g4 g3
Bayer Formats Those formats transfer pixel data as red, green and blue components. The format code is made of the following information. The red, green and blue components order code, as encoded in a pixel sample. The possible values are shown in . The number of bits per pixel component. All components are transferred on the same number of bits. Common values are 8, 10 and 12. If the pixel components are DPCM-compressed, a mention of the DPCM compression and the number of bits per compressed pixel component. The number of bus samples per pixel. Pixels that are wider than the bus width must be transferred in multiple samples. Common values are 1 and 2. The bus width. For formats where the total number of bits per pixel is smaller than the number of bus samples per pixel times the bus width, a padding value stating if the bytes are padded in their most high order bits (PADHI) or low order bits (PADLO). For formats where the number of bus samples per pixel is larger than 1, an endianness value stating if the pixel is transferred MSB first (BE) or LSB first (LE). For instance, a format with uncompressed 10-bit Bayer components arranged in a red, green, green, blue pattern transferred as 2 8-bit samples per pixel with the least significant bits transferred first will be named V4L2_MBUS_FMT_SRGGB10_2X8_PADHI_LE.
Bayer Patterns Bayer filter color patterns
The following table lists existing packet Bayer formats. The data organization is given as an example for the first pixel only. Bayer Formats Identifier Code Data organization Bit 11 10 9 8 7 6 5 4 3 2 1 0 V4L2_MBUS_FMT_SBGGR8_1X8 0x3001 - - - - b7 b6 b5 b4 b3 b2 b1 b0 V4L2_MBUS_FMT_SGBRG8_1X8 0x3013 - - - - g7 g6 g5 g4 g3 g2 g1 g0 V4L2_MBUS_FMT_SGRBG8_1X8 0x3002 - - - - g7 g6 g5 g4 g3 g2 g1 g0 V4L2_MBUS_FMT_SRGGB8_1X8 0x3014 - - - - r7 r6 r5 r4 r3 r2 r1 r0 V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8 0x300b - - - - b7 b6 b5 b4 b3 b2 b1 b0 V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8 0x300c - - - - g7 g6 g5 g4 g3 g2 g1 g0 V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8 0x3009 - - - - g7 g6 g5 g4 g3 g2 g1 g0 V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8 0x300d - - - - r7 r6 r5 r4 r3 r2 r1 r0 V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE 0x3003 - - - - 0 0 0 0 0 0 b9 b8 - - - - b7 b6 b5 b4 b3 b2 b1 b0 V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE 0x3004 - - - - b7 b6 b5 b4 b3 b2 b1 b0 - - - - 0 0 0 0 0 0 b9 b8 V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE 0x3005 - - - - b9 b8 b7 b6 b5 b4 b3 b2 - - - - b1 b0 0 0 0 0 0 0 V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE 0x3006 - - - - b1 b0 0 0 0 0 0 0 - - - - b9 b8 b7 b6 b5 b4 b3 b2 V4L2_MBUS_FMT_SBGGR10_1X10 0x3007 - - b9 b8 b7 b6 b5 b4 b3 b2 b1 b0 V4L2_MBUS_FMT_SGBRG10_1X10 0x300e - - g9 g8 g7 g6 g5 g4 g3 g2 g1 g0 V4L2_MBUS_FMT_SGRBG10_1X10 0x300a - - g9 g8 g7 g6 g5 g4 g3 g2 g1 g0 V4L2_MBUS_FMT_SRGGB10_1X10 0x300f - - r9 r8 r7 r6 r5 r4 r3 r2 r1 r0 V4L2_MBUS_FMT_SBGGR12_1X12 0x3008 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0 V4L2_MBUS_FMT_SGBRG12_1X12 0x3010 g11 g10 g9 g8 g7 g6 g5 g4 g3 g2 g1 g0 V4L2_MBUS_FMT_SGRBG12_1X12 0x3011 g11 g10 g9 g8 g7 g6 g5 g4 g3 g2 g1 g0 V4L2_MBUS_FMT_SRGGB12_1X12 0x3012 r11 r10 r9 r8 r7 r6 r5 r4 r3 r2 r1 r0
Packed YUV Formats Those data formats transfer pixel data as (possibly downsampled) Y, U and V components. The format code is made of the following information. The Y, U and V components order code, as transferred on the bus. Possible values are YUYV, UYVY, YVYU and VYUY. The number of bits per pixel component. All components are transferred on the same number of bits. Common values are 8, 10 and 12. The number of bus samples per pixel. Pixels that are wider than the bus width must be transferred in multiple samples. Common values are 1, 1.5 (encoded as 1_5) and 2. The bus width. When the bus width is larger than the number of bits per pixel component, several components are packed in a single bus sample. The components are ordered as specified by the order code, with components on the left of the code transferred in the high order bits. Common values are 8 and 16. For instance, a format where pixels are encoded as 8-bit YUV values downsampled to 4:2:2 and transferred as 2 8-bit bus samples per pixel in the U, Y, V, Y order will be named V4L2_MBUS_FMT_UYVY8_2X8. The following table lisst existing packet YUV formats. YUV Formats Identifier Code Data organization Bit 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 V4L2_MBUS_FMT_Y8_1X8 0x2001 - - - - - - - - - - - - y7 y6 y5 y4 y3 y2 y1 y0 V4L2_MBUS_FMT_UYVY8_1_5X8 0x2002 - - - - - - - - - - - - u7 u6 u5 u4 u3 u2 u1 u0 - - - - - - - - - - - - y7 y6 y5 y4 y3 y2 y1 y0 - - - - - - - - - - - - y7 y6 y5 y4 y3 y2 y1 y0 - - - - - - - - - - - - v7 v6 v5 v4 v3 v2 v1 v0 - - - - - - - - - - - - y7 y6 y5 y4 y3 y2 y1 y0 - - - - - - - - - - - - y7 y6 y5 y4 y3 y2 y1 y0 V4L2_MBUS_FMT_VYUY8_1_5X8 0x2003 - - - - - - - - - - - - v7 v6 v5 v4 v3 v2 v1 v0 - - - - - - - - - - - - y7 y6 y5 y4 y3 y2 y1 y0 - - - - - - - - - - - - y7 y6 y5 y4 y3 y2 y1 y0 - - - - - - - - - - - - u7 u6 u5 u4 u3 u2 u1 u0 - - - - - - - - - - - - y7 y6 y5 y4 y3 y2 y1 y0 - - - - - - - - - - - - y7 y6 y5 y4 y3 y2 y1 y0 V4L2_MBUS_FMT_YUYV8_1_5X8 0x2004 - - - - - - - - - - - - y7 y6 y5 y4 y3 y2 y1 y0 - - - - - - - - - - - - y7 y6 y5 y4 y3 y2 y1 y0 - - - - - - - - - - - - u7 u6 u5 u4 u3 u2 u1 u0 - - - - - - - - - - - - y7 y6 y5 y4 y3 y2 y1 y0 - - - - - - - - - - - - y7 y6 y5 y4 y3 y2 y1 y0 - - - - - - - - - - - - v7 v6 v5 v4 v3 v2 v1 v0 V4L2_MBUS_FMT_YVYU8_1_5X8 0x2005 - - - - - - - - - - - - y7 y6 y5 y4 y3 y2 y1 y0 - - - - - - - - - - - - y7 y6 y5 y4 y3 y2 y1 y0 - - - - - - - - - - - - v7 v6 v5 v4 v3 v2 v1 v0 - - - - - - - - - - - - y7 y6 y5 y4 y3 y2 y1 y0 - - - - - - - - - - - - y7 y6 y5 y4 y3 y2 y1 y0 - - - - - - - - - - - - u7 u6 u5 u4 u3 u2 u1 u0 V4L2_MBUS_FMT_UYVY8_2X8 0x2006 - - - - - - - - - - - - u7 u6 u5 u4 u3 u2 u1 u0 - - - - - - - - - - - - y7 y6 y5 y4 y3 y2 y1 y0 - - - - - - - - - - - - v7 v6 v5 v4 v3 v2 v1 v0 - - - - - - - - - - - - y7 y6 y5 y4 y3 y2 y1 y0 V4L2_MBUS_FMT_VYUY8_2X8 0x2007 - - - - - - - - - - - - v7 v6 v5 v4 v3 v2 v1 v0 - - - - - - - - - - - - y7 y6 y5 y4 y3 y2 y1 y0 - - - - - - - - - - - - u7 u6 u5 u4 u3 u2 u1 u0 - - - - - - - - - - - - y7 y6 y5 y4 y3 y2 y1 y0 V4L2_MBUS_FMT_YUYV8_2X8 0x2008 - - - - - - - - - - - - y7 y6 y5 y4 y3 y2 y1 y0 - - - - - - - - - - - - u7 u6 u5 u4 u3 u2 u1 u0 - - - - - - - - - - - - y7 y6 y5 y4 y3 y2 y1 y0 - - - - - - - - - - - - v7 v6 v5 v4 v3 v2 v1 v0 V4L2_MBUS_FMT_YVYU8_2X8 0x2009 - - - - - - - - - - - - y7 y6 y5 y4 y3 y2 y1 y0 - - - - - - - - - - - - v7 v6 v5 v4 v3 v2 v1 v0 - - - - - - - - - - - - y7 y6 y5 y4 y3 y2 y1 y0 - - - - - - - - - - - - u7 u6 u5 u4 u3 u2 u1 u0 V4L2_MBUS_FMT_Y10_1X10 0x200a - - - - - - - - - - y9 y8 y7 y6 y5 y4 y3 y2 y1 y0 V4L2_MBUS_FMT_YUYV10_2X10 0x200b - - - - - - - - - - y9 y8 y7 y6 y5 y4 y3 y2 y1 y0 - - - - - - - - - - u9 u8 u7 u6 u5 u4 u3 u2 u1 u0 - - - - - - - - - - y9 y8 y7 y6 y5 y4 y3 y2 y1 y0 - - - - - - - - - - v9 v8 v7 v6 v5 v4 v3 v2 v1 v0 V4L2_MBUS_FMT_YVYU10_2X10 0x200c - - - - - - - - - - y9 y8 y7 y6 y5 y4 y3 y2 y1 y0 - - - - - - - - - - v9 v8 v7 v6 v5 v4 v3 v2 v1 v0 - - - - - - - - - - y9 y8 y7 y6 y5 y4 y3 y2 y1 y0 - - - - - - - - - - u9 u8 u7 u6 u5 u4 u3 u2 u1 u0 V4L2_MBUS_FMT_Y12_1X12 0x2013 - - - - - - - - y11 y10 y9 y8 y7 y6 y5 y4 y3 y2 y1 y0 V4L2_MBUS_FMT_UYVY8_1X16 0x200f - - - - u7 u6 u5 u4 u3 u2 u1 u0 y7 y6 y5 y4 y3 y2 y1 y0 - - - - v7 v6 v5 v4 v3 v2 v1 v0 y7 y6 y5 y4 y3 y2 y1 y0 V4L2_MBUS_FMT_VYUY8_1X16 0x2010 - - - - v7 v6 v5 v4 v3 v2 v1 v0 y7 y6 y5 y4 y3 y2 y1 y0 - - - - u7 u6 u5 u4 u3 u2 u1 u0 y7 y6 y5 y4 y3 y2 y1 y0 V4L2_MBUS_FMT_YUYV8_1X16 0x2011 - - - - y7 y6 y5 y4 y3 y2 y1 y0 u7 u6 u5 u4 u3 u2 u1 u0 - - - - y7 y6 y5 y4 y3 y2 y1 y0 v7 v6 v5 v4 v3 v2 v1 v0 V4L2_MBUS_FMT_YVYU8_1X16 0x2012 - - - - y7 y6 y5 y4 y3 y2 y1 y0 v7 v6 v5 v4 v3 v2 v1 v0 - - - - y7 y6 y5 y4 y3 y2 y1 y0 u7 u6 u5 u4 u3 u2 u1 u0 V4L2_MBUS_FMT_YUYV10_1X20 0x200d y9 y8 y7 y6 y5 y4 y3 y2 y1 y0 u9 u8 u7 u6 u5 u4 u3 u2 u1 u0 y9 y8 y7 y6 y5 y4 y3 y2 y1 y0 v9 v8 v7 v6 v5 v4 v3 v2 v1 v0 V4L2_MBUS_FMT_YVYU10_1X20 0x200e y9 y8 y7 y6 y5 y4 y3 y2 y1 y0 v9 v8 v7 v6 v5 v4 v3 v2 v1 v0 y9 y8 y7 y6 y5 y4 y3 y2 y1 y0 u9 u8 u7 u6 u5 u4 u3 u2 u1 u0
JPEG Compressed Formats Those data formats consist of an ordered sequence of 8-bit bytes obtained from JPEG compression process. Additionally to the _JPEG postfix the format code is made of the following information. The number of bus samples per entropy encoded byte. The bus width. For instance, for a JPEG baseline process and an 8-bit bus width the format will be named V4L2_MBUS_FMT_JPEG_1X8. The following table lists existing JPEG compressed formats. JPEG Formats Identifier Code Remarks V4L2_MBUS_FMT_JPEG_1X8 0x4001 Besides of its usage for the parallel bus this format is recommended for transmission of JPEG data over MIPI CSI bus using the User Defined 8-bit Data types.