1 .. -*- coding: utf-8; mode: rst -*-
9 .. _v4l2-mbus-framefmt:
11 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
13 .. flat-table:: struct v4l2_mbus_framefmt
25 - Image width, in pixels.
33 - Image height, in pixels.
41 - Format code, from enum
42 :ref:`v4l2_mbus_pixelcode <v4l2-mbus-pixelcode>`.
50 - Field order, from enum :ref:`v4l2_field <v4l2-field>`. See
51 :ref:`field-order` for details.
59 - Image colorspace, from enum
60 :ref:`v4l2_colorspace <v4l2-colorspace>`. See
61 :ref:`colorspaces` for details.
65 - enum :ref:`v4l2_ycbcr_encoding <v4l2-ycbcr-encoding>`
69 - This information supplements the ``colorspace`` and must be set by
70 the driver for capture streams and by the application for output
71 streams, see :ref:`colorspaces`.
75 - enum :ref:`v4l2_quantization <v4l2-quantization>`
79 - This information supplements the ``colorspace`` and must be set by
80 the driver for capture streams and by the application for output
81 streams, see :ref:`colorspaces`.
85 - enum :ref:`v4l2_xfer_func <v4l2-xfer-func>`
89 - This information supplements the ``colorspace`` and must be set by
90 the driver for capture streams and by the application for output
91 streams, see :ref:`colorspaces`.
99 - Reserved for future extensions. Applications and drivers must set
104 .. _v4l2-mbus-pixelcode:
106 Media Bus Pixel Codes
107 ---------------------
109 The media bus pixel codes describe image formats as flowing over
110 physical busses (both between separate physical components and inside
111 SoC devices). This should not be confused with the V4L2 pixel formats
112 that describe, using four character codes, image formats as stored in
115 While there is a relationship between image formats on busses and image
116 formats in memory (a raw Bayer image won't be magically converted to
117 JPEG just by storing it to memory), there is no one-to-one
118 correspondance between them.
124 Those formats transfer pixel data as red, green and blue components. The
125 format code is made of the following information.
127 - The red, green and blue components order code, as encoded in a pixel
128 sample. Possible values are RGB and BGR.
130 - The number of bits per component, for each component. The values can
131 be different for all components. Common values are 555 and 565.
133 - The number of bus samples per pixel. Pixels that are wider than the
134 bus width must be transferred in multiple samples. Common values are
139 - For formats where the total number of bits per pixel is smaller than
140 the number of bus samples per pixel times the bus width, a padding
141 value stating if the bytes are padded in their most high order bits
142 (PADHI) or low order bits (PADLO). A "C" prefix is used for
143 component-wise padding in the most high order bits (CPADHI) or low
144 order bits (CPADLO) of each separate component.
146 - For formats where the number of bus samples per pixel is larger than
147 1, an endianness value stating if the pixel is transferred MSB first
148 (BE) or LSB first (LE).
150 For instance, a format where pixels are encoded as 5-bits red, 5-bits
151 green and 5-bit blue values padded on the high bit, transferred as 2
152 8-bit samples per pixel with the most significant bits (padding, red and
153 half of the green value) transferred first will be named
154 ``MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE``.
156 The following tables list existing packed RGB formats.
159 .. _v4l2-mbus-pixelcode-rgb:
161 .. flat-table:: RGB formats
173 - :cspan:`31` Data organization
245 - .. _MEDIA-BUS-FMT-RGB444-1X12:
247 - MEDIA_BUS_FMT_RGB444_1X12
316 - .. _MEDIA-BUS-FMT-RGB444-2X8-PADHI-BE:
318 - MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE
456 - .. _MEDIA-BUS-FMT-RGB444-2X8-PADHI-LE:
458 - MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE
596 - .. _MEDIA-BUS-FMT-RGB555-2X8-PADHI-BE:
598 - MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE
736 - .. _MEDIA-BUS-FMT-RGB555-2X8-PADHI-LE:
738 - MEDIA_BUS_FMT_RGB555_2X8_PADHI_LE
876 - .. _MEDIA-BUS-FMT-RGB565-1X16:
878 - MEDIA_BUS_FMT_RGB565_1X16
947 - .. _MEDIA-BUS-FMT-BGR565-2X8-BE:
949 - MEDIA_BUS_FMT_BGR565_2X8_BE
1087 - .. _MEDIA-BUS-FMT-BGR565-2X8-LE:
1089 - MEDIA_BUS_FMT_BGR565_2X8_LE
1227 - .. _MEDIA-BUS-FMT-RGB565-2X8-BE:
1229 - MEDIA_BUS_FMT_RGB565_2X8_BE
1367 - .. _MEDIA-BUS-FMT-RGB565-2X8-LE:
1369 - MEDIA_BUS_FMT_RGB565_2X8_LE
1507 - .. _MEDIA-BUS-FMT-RGB666-1X18:
1509 - MEDIA_BUS_FMT_RGB666_1X18
1578 - .. _MEDIA-BUS-FMT-RBG888-1X24:
1580 - MEDIA_BUS_FMT_RBG888_1X24
1649 - .. _MEDIA-BUS-FMT-RGB666-1X24_CPADHI:
1651 - MEDIA_BUS_FMT_RGB666_1X24_CPADHI
1720 - .. _MEDIA-BUS-FMT-BGR888-1X24:
1722 - MEDIA_BUS_FMT_BGR888_1X24
1791 - .. _MEDIA-BUS-FMT-GBR888-1X24:
1793 - MEDIA_BUS_FMT_GBR888_1X24
1862 - .. _MEDIA-BUS-FMT-RGB888-1X24:
1864 - MEDIA_BUS_FMT_RGB888_1X24
1933 - .. _MEDIA-BUS-FMT-RGB888-2X12-BE:
1935 - MEDIA_BUS_FMT_RGB888_2X12_BE
2073 - .. _MEDIA-BUS-FMT-RGB888-2X12-LE:
2075 - MEDIA_BUS_FMT_RGB888_2X12_LE
2213 - .. _MEDIA-BUS-FMT-ARGB888-1X32:
2215 - MEDIA_BUS_FMT_ARGB888_1X32
2284 - .. _MEDIA-BUS-FMT-RGB888-1X32-PADHI:
2286 - MEDIA_BUS_FMT_RGB888_1X32_PADHI
2356 On LVDS buses, usually each sample is transferred serialized in seven
2357 time slots per pixel clock, on three (18-bit) or four (24-bit)
2358 differential data pairs at the same time. The remaining bits are used
2359 for control signals as defined by SPWG/PSWG/VESA or JEIDA standards. The
2360 24-bit RGB format serialized in seven time slots on four lanes using
2361 JEIDA defined bit mapping will be named
2362 ``MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA``, for example.
2365 .. _v4l2-mbus-pixelcode-rgb-lvds:
2367 .. flat-table:: LVDS RGB formats
2380 - :cspan:`3` Data organization
2398 - .. _MEDIA-BUS-FMT-RGB666-1X7X3-SPWG:
2400 - MEDIA_BUS_FMT_RGB666_1X7X3_SPWG
2505 - .. _MEDIA-BUS-FMT-RGB888-1X7X4-SPWG:
2507 - MEDIA_BUS_FMT_RGB888_1X7X4_SPWG
2612 - .. _MEDIA-BUS-FMT-RGB888-1X7X4-JEIDA:
2614 - MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA
2724 Those formats transfer pixel data as red, green and blue components. The
2725 format code is made of the following information.
2727 - The red, green and blue components order code, as encoded in a pixel
2728 sample. The possible values are shown in :ref:`bayer-patterns`.
2730 - The number of bits per pixel component. All components are
2731 transferred on the same number of bits. Common values are 8, 10 and
2734 - The compression (optional). If the pixel components are ALAW- or
2735 DPCM-compressed, a mention of the compression scheme and the number
2736 of bits per compressed pixel component.
2738 - The number of bus samples per pixel. Pixels that are wider than the
2739 bus width must be transferred in multiple samples. Common values are
2744 - For formats where the total number of bits per pixel is smaller than
2745 the number of bus samples per pixel times the bus width, a padding
2746 value stating if the bytes are padded in their most high order bits
2747 (PADHI) or low order bits (PADLO).
2749 - For formats where the number of bus samples per pixel is larger than
2750 1, an endianness value stating if the pixel is transferred MSB first
2751 (BE) or LSB first (LE).
2753 For instance, a format with uncompressed 10-bit Bayer components
2754 arranged in a red, green, green, blue pattern transferred as 2 8-bit
2755 samples per pixel with the least significant bits transferred first will
2756 be named ``MEDIA_BUS_FMT_SRGGB10_2X8_PADHI_LE``.
2761 .. figure:: subdev-formats_files/bayer.*
2765 **Figure 4.8 Bayer Patterns**
2769 The following table lists existing packed Bayer formats. The data
2770 organization is given as an example for the first pixel only.
2773 .. _v4l2-mbus-pixelcode-bayer:
2775 .. flat-table:: Bayer Formats
2787 - :cspan:`11` Data organization
2819 - .. _MEDIA-BUS-FMT-SBGGR8-1X8:
2821 - MEDIA_BUS_FMT_SBGGR8_1X8
2850 - .. _MEDIA-BUS-FMT-SGBRG8-1X8:
2852 - MEDIA_BUS_FMT_SGBRG8_1X8
2881 - .. _MEDIA-BUS-FMT-SGRBG8-1X8:
2883 - MEDIA_BUS_FMT_SGRBG8_1X8
2912 - .. _MEDIA-BUS-FMT-SRGGB8-1X8:
2914 - MEDIA_BUS_FMT_SRGGB8_1X8
2943 - .. _MEDIA-BUS-FMT-SBGGR10-ALAW8-1X8:
2945 - MEDIA_BUS_FMT_SBGGR10_ALAW8_1X8
2974 - .. _MEDIA-BUS-FMT-SGBRG10-ALAW8-1X8:
2976 - MEDIA_BUS_FMT_SGBRG10_ALAW8_1X8
3005 - .. _MEDIA-BUS-FMT-SGRBG10-ALAW8-1X8:
3007 - MEDIA_BUS_FMT_SGRBG10_ALAW8_1X8
3036 - .. _MEDIA-BUS-FMT-SRGGB10-ALAW8-1X8:
3038 - MEDIA_BUS_FMT_SRGGB10_ALAW8_1X8
3067 - .. _MEDIA-BUS-FMT-SBGGR10-DPCM8-1X8:
3069 - MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8
3098 - .. _MEDIA-BUS-FMT-SGBRG10-DPCM8-1X8:
3100 - MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8
3129 - .. _MEDIA-BUS-FMT-SGRBG10-DPCM8-1X8:
3131 - MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8
3160 - .. _MEDIA-BUS-FMT-SRGGB10-DPCM8-1X8:
3162 - MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8
3191 - .. _MEDIA-BUS-FMT-SBGGR10-2X8-PADHI-BE:
3193 - MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_BE
3251 - .. _MEDIA-BUS-FMT-SBGGR10-2X8-PADHI-LE:
3253 - MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE
3311 - .. _MEDIA-BUS-FMT-SBGGR10-2X8-PADLO-BE:
3313 - MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_BE
3371 - .. _MEDIA-BUS-FMT-SBGGR10-2X8-PADLO-LE:
3373 - MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_LE
3431 - .. _MEDIA-BUS-FMT-SBGGR10-1X10:
3433 - MEDIA_BUS_FMT_SBGGR10_1X10
3462 - .. _MEDIA-BUS-FMT-SGBRG10-1X10:
3464 - MEDIA_BUS_FMT_SGBRG10_1X10
3493 - .. _MEDIA-BUS-FMT-SGRBG10-1X10:
3495 - MEDIA_BUS_FMT_SGRBG10_1X10
3524 - .. _MEDIA-BUS-FMT-SRGGB10-1X10:
3526 - MEDIA_BUS_FMT_SRGGB10_1X10
3555 - .. _MEDIA-BUS-FMT-SBGGR12-1X12:
3557 - MEDIA_BUS_FMT_SBGGR12_1X12
3586 - .. _MEDIA-BUS-FMT-SGBRG12-1X12:
3588 - MEDIA_BUS_FMT_SGBRG12_1X12
3617 - .. _MEDIA-BUS-FMT-SGRBG12-1X12:
3619 - MEDIA_BUS_FMT_SGRBG12_1X12
3648 - .. _MEDIA-BUS-FMT-SRGGB12-1X12:
3650 - MEDIA_BUS_FMT_SRGGB12_1X12
3684 Those data formats transfer pixel data as (possibly downsampled) Y, U
3685 and V components. Some formats include dummy bits in some of their
3686 samples and are collectively referred to as "YDYC" (Y-Dummy-Y-Chroma)
3687 formats. One cannot rely on the values of these dummy bits as those are
3690 The format code is made of the following information.
3692 - The Y, U and V components order code, as transferred on the bus.
3693 Possible values are YUYV, UYVY, YVYU and VYUY for formats with no
3694 dummy bit, and YDYUYDYV, YDYVYDYU, YUYDYVYD and YVYDYUYD for YDYC
3697 - The number of bits per pixel component. All components are
3698 transferred on the same number of bits. Common values are 8, 10 and
3701 - The number of bus samples per pixel. Pixels that are wider than the
3702 bus width must be transferred in multiple samples. Common values are
3703 1, 1.5 (encoded as 1_5) and 2.
3705 - The bus width. When the bus width is larger than the number of bits
3706 per pixel component, several components are packed in a single bus
3707 sample. The components are ordered as specified by the order code,
3708 with components on the left of the code transferred in the high order
3709 bits. Common values are 8 and 16.
3711 For instance, a format where pixels are encoded as 8-bit YUV values
3712 downsampled to 4:2:2 and transferred as 2 8-bit bus samples per pixel in
3713 the U, Y, V, Y order will be named ``MEDIA_BUS_FMT_UYVY8_2X8``.
3715 :ref:`v4l2-mbus-pixelcode-yuv8` lists existing packed YUV formats and
3716 describes the organization of each pixel data in each sample. When a
3717 format pattern is split across multiple samples each of the samples in
3718 the pattern is described.
3720 The role of each bit transferred over the bus is identified by one of
3721 the following codes.
3723 - y\ :sub:`x` for luma component bit number x
3725 - u\ :sub:`x` for blue chroma component bit number x
3727 - v\ :sub:`x` for red chroma component bit number x
3729 - a\ :sub:`x` for alpha component bit number x
3731 - - for non-available bits (for positions higher than the bus width)
3736 .. _v4l2-mbus-pixelcode-yuv8:
3738 .. flat-table:: YUV Formats
3750 - :cspan:`31` Data organization
3822 - .. _MEDIA-BUS-FMT-Y8-1X8:
3824 - MEDIA_BUS_FMT_Y8_1X8
3893 - .. _MEDIA-BUS-FMT-UV8-1X8:
3895 - MEDIA_BUS_FMT_UV8_1X8
4033 - .. _MEDIA-BUS-FMT-UYVY8-1_5X8:
4035 - MEDIA_BUS_FMT_UYVY8_1_5X8
4449 - .. _MEDIA-BUS-FMT-VYUY8-1_5X8:
4451 - MEDIA_BUS_FMT_VYUY8_1_5X8
4865 - .. _MEDIA-BUS-FMT-YUYV8-1_5X8:
4867 - MEDIA_BUS_FMT_YUYV8_1_5X8
5281 - .. _MEDIA-BUS-FMT-YVYU8-1_5X8:
5283 - MEDIA_BUS_FMT_YVYU8_1_5X8
5697 - .. _MEDIA-BUS-FMT-UYVY8-2X8:
5699 - MEDIA_BUS_FMT_UYVY8_2X8
5975 - .. _MEDIA-BUS-FMT-VYUY8-2X8:
5977 - MEDIA_BUS_FMT_VYUY8_2X8
6253 - .. _MEDIA-BUS-FMT-YUYV8-2X8:
6255 - MEDIA_BUS_FMT_YUYV8_2X8
6531 - .. _MEDIA-BUS-FMT-YVYU8-2X8:
6533 - MEDIA_BUS_FMT_YVYU8_2X8
6809 - .. _MEDIA-BUS-FMT-Y10-1X10:
6811 - MEDIA_BUS_FMT_Y10_1X10
6880 - .. _MEDIA-BUS-FMT-UYVY10-2X10:
6882 - MEDIA_BUS_FMT_UYVY10_2X10
7158 - .. _MEDIA-BUS-FMT-VYUY10-2X10:
7160 - MEDIA_BUS_FMT_VYUY10_2X10
7436 - .. _MEDIA-BUS-FMT-YUYV10-2X10:
7438 - MEDIA_BUS_FMT_YUYV10_2X10
7714 - .. _MEDIA-BUS-FMT-YVYU10-2X10:
7716 - MEDIA_BUS_FMT_YVYU10_2X10
7992 - .. _MEDIA-BUS-FMT-Y12-1X12:
7994 - MEDIA_BUS_FMT_Y12_1X12
8063 - .. _MEDIA-BUS-FMT-UYVY12-2X12:
8065 - MEDIA_BUS_FMT_UYVY12_2X12
8341 - .. _MEDIA-BUS-FMT-VYUY12-2X12:
8343 - MEDIA_BUS_FMT_VYUY12_2X12
8619 - .. _MEDIA-BUS-FMT-YUYV12-2X12:
8621 - MEDIA_BUS_FMT_YUYV12_2X12
8897 - .. _MEDIA-BUS-FMT-YVYU12-2X12:
8899 - MEDIA_BUS_FMT_YVYU12_2X12
9175 - .. _MEDIA-BUS-FMT-UYVY8-1X16:
9177 - MEDIA_BUS_FMT_UYVY8_1X16
9315 - .. _MEDIA-BUS-FMT-VYUY8-1X16:
9317 - MEDIA_BUS_FMT_VYUY8_1X16
9455 - .. _MEDIA-BUS-FMT-YUYV8-1X16:
9457 - MEDIA_BUS_FMT_YUYV8_1X16
9595 - .. _MEDIA-BUS-FMT-YVYU8-1X16:
9597 - MEDIA_BUS_FMT_YVYU8_1X16
9735 - .. _MEDIA-BUS-FMT-YDYUYDYV8-1X16:
9737 - MEDIA_BUS_FMT_YDYUYDYV8_1X16
10013 - .. _MEDIA-BUS-FMT-UYVY10-1X20:
10015 - MEDIA_BUS_FMT_UYVY10_1X20
10153 - .. _MEDIA-BUS-FMT-VYUY10-1X20:
10155 - MEDIA_BUS_FMT_VYUY10_1X20
10293 - .. _MEDIA-BUS-FMT-YUYV10-1X20:
10295 - MEDIA_BUS_FMT_YUYV10_1X20
10433 - .. _MEDIA-BUS-FMT-YVYU10-1X20:
10435 - MEDIA_BUS_FMT_YVYU10_1X20
10573 - .. _MEDIA-BUS-FMT-VUY8-1X24:
10575 - MEDIA_BUS_FMT_VUY8_1X24
10644 - .. _MEDIA-BUS-FMT-YUV8-1X24:
10646 - MEDIA_BUS_FMT_YUV8_1X24
10715 - .. _MEDIA-BUS-FMT-UYVY12-1X24:
10717 - MEDIA_BUS_FMT_UYVY12_1X24
10855 - .. _MEDIA-BUS-FMT-VYUY12-1X24:
10857 - MEDIA_BUS_FMT_VYUY12_1X24
10995 - .. _MEDIA-BUS-FMT-YUYV12-1X24:
10997 - MEDIA_BUS_FMT_YUYV12_1X24
11135 - .. _MEDIA-BUS-FMT-YVYU12-1X24:
11137 - MEDIA_BUS_FMT_YVYU12_1X24
11275 - .. _MEDIA-BUS-FMT-YUV10-1X30:
11277 - MEDIA_BUS_FMT_YUV10_1X30
11346 - .. _MEDIA-BUS-FMT-AYUV8-1X32:
11348 - MEDIA_BUS_FMT_AYUV8_1X32
11422 Those formats transfer pixel data as RGB values in a
11423 cylindrical-coordinate system using Hue-Saturation-Value or
11424 Hue-Saturation-Lightness components. The format code is made of the
11425 following information.
11427 - The hue, saturation, value or lightness and optional alpha components
11428 order code, as encoded in a pixel sample. The only currently
11429 supported value is AHSV.
11431 - The number of bits per component, for each component. The values can
11432 be different for all components. The only currently supported value
11435 - The number of bus samples per pixel. Pixels that are wider than the
11436 bus width must be transferred in multiple samples. The only currently
11437 supported value is 1.
11441 - For formats where the total number of bits per pixel is smaller than
11442 the number of bus samples per pixel times the bus width, a padding
11443 value stating if the bytes are padded in their most high order bits
11444 (PADHI) or low order bits (PADLO).
11446 - For formats where the number of bus samples per pixel is larger than
11447 1, an endianness value stating if the pixel is transferred MSB first
11448 (BE) or LSB first (LE).
11450 The following table lists existing HSV/HSL formats.
11453 .. _v4l2-mbus-pixelcode-hsv:
11455 .. flat-table:: HSV/HSL formats
11467 - :cspan:`31` Data organization
11539 - .. _MEDIA-BUS-FMT-AHSV8888-1X32:
11541 - MEDIA_BUS_FMT_AHSV8888_1X32
11612 JPEG Compressed Formats
11613 ^^^^^^^^^^^^^^^^^^^^^^^
11615 Those data formats consist of an ordered sequence of 8-bit bytes
11616 obtained from JPEG compression process. Additionally to the ``_JPEG``
11617 postfix the format code is made of the following information.
11619 - The number of bus samples per entropy encoded byte.
11623 For instance, for a JPEG baseline process and an 8-bit bus width the
11624 format will be named ``MEDIA_BUS_FMT_JPEG_1X8``.
11626 The following table lists existing JPEG compressed formats.
11629 .. _v4l2-mbus-pixelcode-jpeg:
11631 .. flat-table:: JPEG Formats
11644 - .. _MEDIA-BUS-FMT-JPEG-1X8:
11646 - MEDIA_BUS_FMT_JPEG_1X8
11650 - Besides of its usage for the parallel bus this format is
11651 recommended for transmission of JPEG data over MIPI CSI bus using
11652 the User Defined 8-bit Data types.
11656 .. _v4l2-mbus-vendor-spec-fmts:
11658 Vendor and Device Specific Formats
11659 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11661 This section lists complex data formats that are either vendor or device
11664 The following table lists the existing vendor and device specific
11668 .. _v4l2-mbus-pixelcode-vendor-specific:
11670 .. flat-table:: Vendor and device specific formats
11683 - .. _MEDIA-BUS-FMT-S5C-UYVY-JPEG-1X8:
11685 - MEDIA_BUS_FMT_S5C_UYVY_JPEG_1X8
11689 - Interleaved raw UYVY and JPEG image format with embedded meta-data
11690 used by Samsung S3C73MX camera sensors.