^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) ******************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) Single-planar format structure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) ******************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) .. tabularcolumns:: |p{4.0cm}|p{2.5cm}|p{11.0cm}|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) .. c:type:: v4l2_pix_format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) .. cssclass:: longtable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) .. flat-table:: struct v4l2_pix_format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) :header-rows: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) :stub-columns: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) :widths: 1 1 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) - ``width``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) - Image width in pixels.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) - ``height``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) - Image height in pixels. If ``field`` is one of ``V4L2_FIELD_TOP``,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) ``V4L2_FIELD_BOTTOM`` or ``V4L2_FIELD_ALTERNATE`` then height
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) refers to the number of lines in the field, otherwise it refers to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) the number of lines in the frame (which is twice the field height
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) for interlaced formats).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) * - :cspan:`2` Applications set these fields to request an image
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) size, drivers return the closest possible values. In case of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) planar formats the ``width`` and ``height`` applies to the largest
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) plane. To avoid ambiguities drivers must return values rounded up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) to a multiple of the scale factor of any smaller planes. For
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) example when the image format is YUV 4:2:0, ``width`` and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) ``height`` must be multiples of two.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) For compressed formats that contain the resolution information encoded
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) inside the stream, when fed to a stateful mem2mem decoder, the fields
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) may be zero to rely on the decoder to detect the right values. For more
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) details see :ref:`decoder` and format descriptions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) For compressed formats on the CAPTURE side of a stateful mem2mem
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) encoder, the fields must be zero, since the coded size is expected to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) be calculated internally by the encoder itself, based on the OUTPUT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) side. For more details see :ref:`encoder` and format descriptions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) - ``pixelformat``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) - The pixel format or type of compression, set by the application.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) This is a little endian
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) :ref:`four character code <v4l2-fourcc>`. V4L2 defines standard
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) RGB formats in :ref:`pixfmt-rgb`, YUV formats in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) :ref:`yuv-formats`, and reserved codes in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) :ref:`reserved-formats`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) - ``field``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) - Field order, from enum :c:type:`v4l2_field`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) Video images are typically interlaced. Applications can request to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) capture or output only the top or bottom field, or both fields
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) interlaced or sequentially stored in one buffer or alternating in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) separate buffers. Drivers return the actual field order selected.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) For more details on fields see :ref:`field-order`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) - ``bytesperline``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) - Distance in bytes between the leftmost pixels in two adjacent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) lines.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) * - :cspan:`2`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) Both applications and drivers can set this field to request
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) padding bytes at the end of each line. Drivers however may ignore
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) the value requested by the application, returning ``width`` times
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) bytes per pixel or a larger value required by the hardware. That
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) implies applications can just set this field to zero to get a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) reasonable default.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) Video hardware may access padding bytes, therefore they must
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) reside in accessible memory. Consider cases where padding bytes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) after the last line of an image cross a system page boundary.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) Input devices may write padding bytes, the value is undefined.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) Output devices ignore the contents of padding bytes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) When the image format is planar the ``bytesperline`` value applies
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) to the first plane and is divided by the same factor as the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) ``width`` field for the other planes. For example the Cb and Cr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) planes of a YUV 4:2:0 image have half as many padding bytes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) following each line as the Y plane. To avoid ambiguities drivers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) must return a ``bytesperline`` value rounded up to a multiple of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) the scale factor.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) For compressed formats the ``bytesperline`` value makes no sense.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) Applications and drivers must set this to 0 in that case.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) - ``sizeimage``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) - Size in bytes of the buffer to hold a complete image, set by the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) driver. Usually this is ``bytesperline`` times ``height``. When
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) the image consists of variable length compressed data this is the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) number of bytes required by the codec to support the worst-case
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) compression scenario.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) The driver will set the value for uncompressed images.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) Clients are allowed to set the sizeimage field for variable length
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) compressed data flagged with ``V4L2_FMT_FLAG_COMPRESSED`` at
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) :ref:`VIDIOC_ENUM_FMT`, but the driver may ignore it and set the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) value itself, or it may modify the provided value based on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) alignment requirements or minimum/maximum size requirements.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) If the client wants to leave this to the driver, then it should
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) set sizeimage to 0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) - ``colorspace``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) - Image colorspace, from enum :c:type:`v4l2_colorspace`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) This information supplements the ``pixelformat`` and must be set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) by the driver for capture streams and by the application for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) output streams, see :ref:`colorspaces`. If the application sets the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) flag ``V4L2_PIX_FMT_FLAG_SET_CSC`` then the application can set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) this field for a capture stream to request a specific colorspace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) for the captured image data. If the driver cannot handle requested
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) conversion, it will return another supported colorspace.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) The driver indicates that colorspace conversion is supported by setting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) the flag V4L2_FMT_FLAG_CSC_COLORSPACE in the corresponding struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) :c:type:`v4l2_fmtdesc` during enumeration. See :ref:`fmtdesc-flags`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) - ``priv``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) - This field indicates whether the remaining fields of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) struct :c:type:`v4l2_pix_format`, also called the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) extended fields, are valid. When set to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) ``V4L2_PIX_FMT_PRIV_MAGIC``, it indicates that the extended fields
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) have been correctly initialized. When set to any other value it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) indicates that the extended fields contain undefined values.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) Applications that wish to use the pixel format extended fields
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) must first ensure that the feature is supported by querying the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) device for the :ref:`V4L2_CAP_EXT_PIX_FORMAT <querycap>`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) capability. If the capability isn't set the pixel format extended
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) fields are not supported and using the extended fields will lead
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) to undefined results.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) To use the extended fields, applications must set the ``priv``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) field to ``V4L2_PIX_FMT_PRIV_MAGIC``, initialize all the extended
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) fields and zero the unused bytes of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) struct :c:type:`v4l2_format` ``raw_data`` field.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) When the ``priv`` field isn't set to ``V4L2_PIX_FMT_PRIV_MAGIC``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) drivers must act as if all the extended fields were set to zero.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) On return drivers must set the ``priv`` field to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) ``V4L2_PIX_FMT_PRIV_MAGIC`` and all the extended fields to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) applicable values.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) - ``flags``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) - Flags set by the application or driver, see :ref:`format-flags`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) * - union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) - (anonymous)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) - ``ycbcr_enc``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) - Y'CbCr encoding, from enum :c:type:`v4l2_ycbcr_encoding`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) This information supplements the ``colorspace`` and must be set by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) the driver for capture streams and by the application for output
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) streams, see :ref:`colorspaces`. If the application sets the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) flag ``V4L2_PIX_FMT_FLAG_SET_CSC`` then the application can set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) this field for a capture stream to request a specific Y'CbCr encoding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) for the captured image data. If the driver cannot handle requested
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) conversion, it will return another supported encoding.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) This field is ignored for HSV pixelformats. The driver indicates that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) ycbcr_enc conversion is supported by setting the flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) V4L2_FMT_FLAG_CSC_YCBCR_ENC in the corresponding struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) :c:type:`v4l2_fmtdesc` during enumeration. See :ref:`fmtdesc-flags`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) - ``hsv_enc``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) - HSV encoding, from enum :c:type:`v4l2_hsv_encoding`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) This information supplements the ``colorspace`` and must be set by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) the driver for capture streams and by the application for output
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) streams, see :ref:`colorspaces`. If the application sets the flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) ``V4L2_PIX_FMT_FLAG_SET_CSC`` then the application can set this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) field for a capture stream to request a specific HSV encoding for the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) captured image data. If the driver cannot handle requested
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) conversion, it will return another supported encoding.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) This field is ignored for non-HSV pixelformats. The driver indicates
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) that hsv_enc conversion is supported by setting the flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) V4L2_FMT_FLAG_CSC_HSV_ENC in the corresponding struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) :c:type:`v4l2_fmtdesc` during enumeration. See :ref:`fmtdesc-flags`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) * - }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) - ``quantization``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) - Quantization range, from enum :c:type:`v4l2_quantization`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) This information supplements the ``colorspace`` and must be set by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) the driver for capture streams and by the application for output
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) streams, see :ref:`colorspaces`. If the application sets the flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) ``V4L2_PIX_FMT_FLAG_SET_CSC`` then the application can set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) this field for a capture stream to request a specific quantization
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) range for the captured image data. If the driver cannot handle requested
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) conversion, it will return another supported quantization.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) The driver indicates that quantization conversion is supported by setting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) the flag V4L2_FMT_FLAG_CSC_QUANTIZATION in the corresponding struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) :c:type:`v4l2_fmtdesc` during enumeration. See :ref:`fmtdesc-flags`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) * - __u32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) - ``xfer_func``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) - Transfer function, from enum :c:type:`v4l2_xfer_func`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) This information supplements the ``colorspace`` and must be set by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) the driver for capture streams and by the application for output
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) streams, see :ref:`colorspaces`. If the application sets the flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) ``V4L2_PIX_FMT_FLAG_SET_CSC`` then the application can set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) this field for a capture stream to request a specific transfer function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) for the captured image data. If the driver cannot handle requested
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) conversion, it will return another supported transfer function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) The driver indicates that xfer_func conversion is supported by setting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) the flag V4L2_FMT_FLAG_CSC_XFER_FUNC in the corresponding struct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) :c:type:`v4l2_fmtdesc` during enumeration. See :ref:`fmtdesc-flags`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) .. _format-flags:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) .. flat-table:: Format Flags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) :header-rows: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) :stub-columns: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) :widths: 3 1 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) * - ``V4L2_PIX_FMT_FLAG_PREMUL_ALPHA``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) - 0x00000001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) - The color values are premultiplied by the alpha channel value. For
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) example, if a light blue pixel with 50% transparency was described
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) by RGBA values (128, 192, 255, 128), the same pixel described with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) premultiplied colors would be described by RGBA values (64, 96,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 128, 128)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) * .. _`v4l2-pix-fmt-flag-set-csc`:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) - ``V4L2_PIX_FMT_FLAG_SET_CSC``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) - 0x00000002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) - Set by the application. It is only used for capture and is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) ignored for output streams. If set, then request the device to do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) colorspace conversion from the received colorspace to the requested
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) colorspace values. If the colorimetry field (``colorspace``, ``xfer_func``,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) ``ycbcr_enc``, ``hsv_enc`` or ``quantization``) is set to ``*_DEFAULT``,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) then that colorimetry setting will remain unchanged from what was received.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) So in order to change the quantization, only the ``quantization`` field shall
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) be set to non default value (``V4L2_QUANTIZATION_FULL_RANGE`` or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) ``V4L2_QUANTIZATION_LIM_RANGE``) and all other colorimetry fields shall
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) be set to ``*_DEFAULT``.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) To check which conversions are supported by the hardware for the current
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) pixel format, see :ref:`fmtdesc-flags`.