^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) .. _jpeg-controls:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) **********************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) JPEG Control Reference
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) **********************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) The JPEG class includes controls for common features of JPEG encoders
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) and decoders. Currently it includes features for codecs implementing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) progressive baseline DCT compression process with Huffman entrophy
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) coding.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) .. _jpeg-control-id:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) JPEG Control IDs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) ================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) ``V4L2_CID_JPEG_CLASS (class)``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) The JPEG class descriptor. Calling
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) :ref:`VIDIOC_QUERYCTRL` for this control will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) return a description of this control class.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) ``V4L2_CID_JPEG_CHROMA_SUBSAMPLING (menu)``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) The chroma subsampling factors describe how each component of an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) input image is sampled, in respect to maximum sample rate in each
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) spatial dimension. See :ref:`itu-t81`, clause A.1.1. for more
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) details. The ``V4L2_CID_JPEG_CHROMA_SUBSAMPLING`` control determines
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) how Cb and Cr components are downsampled after converting an input
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) image from RGB to Y'CbCr color space.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) .. tabularcolumns:: |p{7.5cm}|p{10.0cm}|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) .. flat-table::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) :header-rows: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) :stub-columns: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_444``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) - No chroma subsampling, each pixel has Y, Cr and Cb values.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_422``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) - Horizontally subsample Cr, Cb components by a factor of 2.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_420``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) - Subsample Cr, Cb components horizontally and vertically by 2.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_411``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) - Horizontally subsample Cr, Cb components by a factor of 4.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_410``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) - Subsample Cr, Cb components horizontally by 4 and vertically by 2.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) - Use only luminance component.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) ``V4L2_CID_JPEG_RESTART_INTERVAL (integer)``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) The restart interval determines an interval of inserting RSTm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) markers (m = 0..7). The purpose of these markers is to additionally
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) reinitialize the encoder process, in order to process blocks of an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) image independently. For the lossy compression processes the restart
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) interval unit is MCU (Minimum Coded Unit) and its value is contained
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) in DRI (Define Restart Interval) marker. If
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) ``V4L2_CID_JPEG_RESTART_INTERVAL`` control is set to 0, DRI and RSTm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) markers will not be inserted.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) .. _jpeg-quality-control:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) ``V4L2_CID_JPEG_COMPRESSION_QUALITY (integer)``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) ``V4L2_CID_JPEG_COMPRESSION_QUALITY`` control determines trade-off
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) between image quality and size. It provides simpler method for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) applications to control image quality, without a need for direct
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) reconfiguration of luminance and chrominance quantization tables. In
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) cases where a driver uses quantization tables configured directly by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) an application, using interfaces defined elsewhere,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) ``V4L2_CID_JPEG_COMPRESSION_QUALITY`` control should be set by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) driver to 0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) The value range of this control is driver-specific. Only positive,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) non-zero values are meaningful. The recommended range is 1 - 100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) where larger values correspond to better image quality.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) .. _jpeg-active-marker-control:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) ``V4L2_CID_JPEG_ACTIVE_MARKER (bitmask)``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) Specify which JPEG markers are included in compressed stream. This
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) control is valid only for encoders.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) .. flat-table::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) :header-rows: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) :stub-columns: 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) * - ``V4L2_JPEG_ACTIVE_MARKER_APP0``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) - Application data segment APP\ :sub:`0`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) * - ``V4L2_JPEG_ACTIVE_MARKER_APP1``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) - Application data segment APP\ :sub:`1`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) * - ``V4L2_JPEG_ACTIVE_MARKER_COM``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) - Comment segment.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) * - ``V4L2_JPEG_ACTIVE_MARKER_DQT``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) - Quantization tables segment.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) * - ``V4L2_JPEG_ACTIVE_MARKER_DHT``
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) - Huffman tables segment.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) For more details about JPEG specification, refer to :ref:`itu-t81`,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) :ref:`jfif`, :ref:`w3c-jpeg-jfif`.