xref: /OK3568_Linux_fs/kernel/Documentation/userspace-api/media/v4l/pixfmt-v4l2-mplane.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun******************************
4*4882a593SmuzhiyunMulti-planar format structures
5*4882a593Smuzhiyun******************************
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunThe struct :c:type:`v4l2_plane_pix_format` structures define size
8*4882a593Smuzhiyunand layout for each of the planes in a multi-planar format. The
9*4882a593Smuzhiyunstruct :c:type:`v4l2_pix_format_mplane` structure contains
10*4882a593Smuzhiyuninformation common to all planes (such as image width and height) and an
11*4882a593Smuzhiyunarray of struct :c:type:`v4l2_plane_pix_format` structures,
12*4882a593Smuzhiyundescribing all planes of that format.
13*4882a593Smuzhiyun
14*4882a593Smuzhiyun
15*4882a593Smuzhiyun
16*4882a593Smuzhiyun.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
17*4882a593Smuzhiyun
18*4882a593Smuzhiyun.. c:type:: v4l2_plane_pix_format
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun.. flat-table:: struct v4l2_plane_pix_format
21*4882a593Smuzhiyun    :header-rows:  0
22*4882a593Smuzhiyun    :stub-columns: 0
23*4882a593Smuzhiyun    :widths:       1 1 2
24*4882a593Smuzhiyun
25*4882a593Smuzhiyun    * - __u32
26*4882a593Smuzhiyun      - ``sizeimage``
27*4882a593Smuzhiyun      - Maximum size in bytes required for image data in this plane,
28*4882a593Smuzhiyun	set by the driver. When the image consists of variable length
29*4882a593Smuzhiyun	compressed data this is the number of bytes required by the
30*4882a593Smuzhiyun	codec to support the worst-case compression scenario.
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun	The driver will set the value for uncompressed images.
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun	Clients are allowed to set the sizeimage field for variable length
35*4882a593Smuzhiyun	compressed data flagged with ``V4L2_FMT_FLAG_COMPRESSED`` at
36*4882a593Smuzhiyun	:ref:`VIDIOC_ENUM_FMT`, but the driver may ignore it and set the
37*4882a593Smuzhiyun	value itself, or it may modify the provided value based on
38*4882a593Smuzhiyun	alignment requirements or minimum/maximum size requirements.
39*4882a593Smuzhiyun	If the client wants to leave this to the driver, then it should
40*4882a593Smuzhiyun	set sizeimage to 0.
41*4882a593Smuzhiyun    * - __u32
42*4882a593Smuzhiyun      - ``bytesperline``
43*4882a593Smuzhiyun      - Distance in bytes between the leftmost pixels in two adjacent
44*4882a593Smuzhiyun	lines. See struct :c:type:`v4l2_pix_format`.
45*4882a593Smuzhiyun    * - __u16
46*4882a593Smuzhiyun      - ``reserved[6]``
47*4882a593Smuzhiyun      - Reserved for future extensions. Should be zeroed by drivers and
48*4882a593Smuzhiyun	applications.
49*4882a593Smuzhiyun
50*4882a593Smuzhiyun
51*4882a593Smuzhiyun.. raw:: latex
52*4882a593Smuzhiyun
53*4882a593Smuzhiyun    \small
54*4882a593Smuzhiyun
55*4882a593Smuzhiyun.. tabularcolumns:: |p{4.4cm}|p{5.6cm}|p{7.5cm}|
56*4882a593Smuzhiyun
57*4882a593Smuzhiyun.. c:type:: v4l2_pix_format_mplane
58*4882a593Smuzhiyun
59*4882a593Smuzhiyun.. flat-table:: struct v4l2_pix_format_mplane
60*4882a593Smuzhiyun    :header-rows:  0
61*4882a593Smuzhiyun    :stub-columns: 0
62*4882a593Smuzhiyun    :widths:       1 1 2
63*4882a593Smuzhiyun
64*4882a593Smuzhiyun    * - __u32
65*4882a593Smuzhiyun      - ``width``
66*4882a593Smuzhiyun      - Image width in pixels. See struct
67*4882a593Smuzhiyun	:c:type:`v4l2_pix_format`.
68*4882a593Smuzhiyun    * - __u32
69*4882a593Smuzhiyun      - ``height``
70*4882a593Smuzhiyun      - Image height in pixels. See struct
71*4882a593Smuzhiyun	:c:type:`v4l2_pix_format`.
72*4882a593Smuzhiyun    * - __u32
73*4882a593Smuzhiyun      - ``pixelformat``
74*4882a593Smuzhiyun      - The pixel format. Both single- and multi-planar four character
75*4882a593Smuzhiyun	codes can be used.
76*4882a593Smuzhiyun    * - __u32
77*4882a593Smuzhiyun      - ``field``
78*4882a593Smuzhiyun      - Field order, from enum :c:type:`v4l2_field`.
79*4882a593Smuzhiyun        See struct :c:type:`v4l2_pix_format`.
80*4882a593Smuzhiyun    * - __u32
81*4882a593Smuzhiyun      - ``colorspace``
82*4882a593Smuzhiyun      - Colorspace encoding, from enum :c:type:`v4l2_colorspace`.
83*4882a593Smuzhiyun        See struct :c:type:`v4l2_pix_format`.
84*4882a593Smuzhiyun    * - struct :c:type:`v4l2_plane_pix_format`
85*4882a593Smuzhiyun      - ``plane_fmt[VIDEO_MAX_PLANES]``
86*4882a593Smuzhiyun      - An array of structures describing format of each plane this pixel
87*4882a593Smuzhiyun	format consists of. The number of valid entries in this array has
88*4882a593Smuzhiyun	to be put in the ``num_planes`` field.
89*4882a593Smuzhiyun    * - __u8
90*4882a593Smuzhiyun      - ``num_planes``
91*4882a593Smuzhiyun      - Number of planes (i.e. separate memory buffers) for this format
92*4882a593Smuzhiyun	and the number of valid entries in the ``plane_fmt`` array.
93*4882a593Smuzhiyun    * - __u8
94*4882a593Smuzhiyun      - ``flags``
95*4882a593Smuzhiyun      - Flags set by the application or driver, see :ref:`format-flags`.
96*4882a593Smuzhiyun    * - union {
97*4882a593Smuzhiyun      - (anonymous)
98*4882a593Smuzhiyun    * - __u8
99*4882a593Smuzhiyun      - ``ycbcr_enc``
100*4882a593Smuzhiyun      - Y'CbCr encoding, from enum :c:type:`v4l2_ycbcr_encoding`.
101*4882a593Smuzhiyun	See struct :c:type:`v4l2_pix_format`.
102*4882a593Smuzhiyun    * - __u8
103*4882a593Smuzhiyun      - ``hsv_enc``
104*4882a593Smuzhiyun      - HSV encoding, from enum :c:type:`v4l2_hsv_encoding`.
105*4882a593Smuzhiyun	See struct :c:type:`v4l2_pix_format`.
106*4882a593Smuzhiyun    * - }
107*4882a593Smuzhiyun      -
108*4882a593Smuzhiyun    * - __u8
109*4882a593Smuzhiyun      - ``quantization``
110*4882a593Smuzhiyun      - Quantization range, from enum :c:type:`v4l2_quantization`.
111*4882a593Smuzhiyun	See struct :c:type:`v4l2_pix_format`.
112*4882a593Smuzhiyun    * - __u8
113*4882a593Smuzhiyun      - ``xfer_func``
114*4882a593Smuzhiyun      - Transfer function, from enum :c:type:`v4l2_xfer_func`.
115*4882a593Smuzhiyun	See struct :c:type:`v4l2_pix_format`.
116*4882a593Smuzhiyun    * - __u8
117*4882a593Smuzhiyun      - ``reserved[7]``
118*4882a593Smuzhiyun      - Reserved for future extensions. Should be zeroed by drivers and
119*4882a593Smuzhiyun	applications.
120*4882a593Smuzhiyun
121*4882a593Smuzhiyun.. raw:: latex
122*4882a593Smuzhiyun
123*4882a593Smuzhiyun    \normalsize
124