162306a36Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 262306a36Sopenharmony_ci 362306a36Sopenharmony_ci.. _jpeg-controls: 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci********************** 662306a36Sopenharmony_ciJPEG Control Reference 762306a36Sopenharmony_ci********************** 862306a36Sopenharmony_ci 962306a36Sopenharmony_ciThe JPEG class includes controls for common features of JPEG encoders 1062306a36Sopenharmony_ciand decoders. Currently it includes features for codecs implementing 1162306a36Sopenharmony_ciprogressive baseline DCT compression process with Huffman entropy 1262306a36Sopenharmony_cicoding. 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci.. _jpeg-control-id: 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ciJPEG Control IDs 1862306a36Sopenharmony_ci================ 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci``V4L2_CID_JPEG_CLASS (class)`` 2162306a36Sopenharmony_ci The JPEG class descriptor. Calling 2262306a36Sopenharmony_ci :ref:`VIDIOC_QUERYCTRL` for this control will 2362306a36Sopenharmony_ci return a description of this control class. 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci``V4L2_CID_JPEG_CHROMA_SUBSAMPLING (menu)`` 2662306a36Sopenharmony_ci The chroma subsampling factors describe how each component of an 2762306a36Sopenharmony_ci input image is sampled, in respect to maximum sample rate in each 2862306a36Sopenharmony_ci spatial dimension. See :ref:`itu-t81`, clause A.1.1. for more 2962306a36Sopenharmony_ci details. The ``V4L2_CID_JPEG_CHROMA_SUBSAMPLING`` control determines 3062306a36Sopenharmony_ci how Cb and Cr components are downsampled after converting an input 3162306a36Sopenharmony_ci image from RGB to Y'CbCr color space. 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci.. tabularcolumns:: |p{7.5cm}|p{10.0cm}| 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ci.. flat-table:: 3662306a36Sopenharmony_ci :header-rows: 0 3762306a36Sopenharmony_ci :stub-columns: 0 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_444`` 4062306a36Sopenharmony_ci - No chroma subsampling, each pixel has Y, Cr and Cb values. 4162306a36Sopenharmony_ci * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_422`` 4262306a36Sopenharmony_ci - Horizontally subsample Cr, Cb components by a factor of 2. 4362306a36Sopenharmony_ci * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_420`` 4462306a36Sopenharmony_ci - Subsample Cr, Cb components horizontally and vertically by 2. 4562306a36Sopenharmony_ci * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_411`` 4662306a36Sopenharmony_ci - Horizontally subsample Cr, Cb components by a factor of 4. 4762306a36Sopenharmony_ci * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_410`` 4862306a36Sopenharmony_ci - Subsample Cr, Cb components horizontally by 4 and vertically by 2. 4962306a36Sopenharmony_ci * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY`` 5062306a36Sopenharmony_ci - Use only luminance component. 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci``V4L2_CID_JPEG_RESTART_INTERVAL (integer)`` 5562306a36Sopenharmony_ci The restart interval determines an interval of inserting RSTm 5662306a36Sopenharmony_ci markers (m = 0..7). The purpose of these markers is to additionally 5762306a36Sopenharmony_ci reinitialize the encoder process, in order to process blocks of an 5862306a36Sopenharmony_ci image independently. For the lossy compression processes the restart 5962306a36Sopenharmony_ci interval unit is MCU (Minimum Coded Unit) and its value is contained 6062306a36Sopenharmony_ci in DRI (Define Restart Interval) marker. If 6162306a36Sopenharmony_ci ``V4L2_CID_JPEG_RESTART_INTERVAL`` control is set to 0, DRI and RSTm 6262306a36Sopenharmony_ci markers will not be inserted. 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci.. _jpeg-quality-control: 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ci``V4L2_CID_JPEG_COMPRESSION_QUALITY (integer)`` 6762306a36Sopenharmony_ci Determines trade-off between image quality and size. 6862306a36Sopenharmony_ci It provides simpler method for applications to control image quality, 6962306a36Sopenharmony_ci without a need for direct reconfiguration of luminance and chrominance 7062306a36Sopenharmony_ci quantization tables. In cases where a driver uses quantization tables 7162306a36Sopenharmony_ci configured directly by an application, using interfaces defined 7262306a36Sopenharmony_ci elsewhere, ``V4L2_CID_JPEG_COMPRESSION_QUALITY`` control should be set by 7362306a36Sopenharmony_ci driver to 0. 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_ci The value range of this control is driver-specific. Only positive, 7662306a36Sopenharmony_ci non-zero values are meaningful. The recommended range is 1 - 100, 7762306a36Sopenharmony_ci where larger values correspond to better image quality. 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_ci.. _jpeg-active-marker-control: 8062306a36Sopenharmony_ci 8162306a36Sopenharmony_ci``V4L2_CID_JPEG_ACTIVE_MARKER (bitmask)`` 8262306a36Sopenharmony_ci Specify which JPEG markers are included in compressed stream. This 8362306a36Sopenharmony_ci control is valid only for encoders. 8462306a36Sopenharmony_ci 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci 8762306a36Sopenharmony_ci.. flat-table:: 8862306a36Sopenharmony_ci :header-rows: 0 8962306a36Sopenharmony_ci :stub-columns: 0 9062306a36Sopenharmony_ci 9162306a36Sopenharmony_ci * - ``V4L2_JPEG_ACTIVE_MARKER_APP0`` 9262306a36Sopenharmony_ci - Application data segment APP\ :sub:`0`. 9362306a36Sopenharmony_ci * - ``V4L2_JPEG_ACTIVE_MARKER_APP1`` 9462306a36Sopenharmony_ci - Application data segment APP\ :sub:`1`. 9562306a36Sopenharmony_ci * - ``V4L2_JPEG_ACTIVE_MARKER_COM`` 9662306a36Sopenharmony_ci - Comment segment. 9762306a36Sopenharmony_ci * - ``V4L2_JPEG_ACTIVE_MARKER_DQT`` 9862306a36Sopenharmony_ci - Quantization tables segment. 9962306a36Sopenharmony_ci * - ``V4L2_JPEG_ACTIVE_MARKER_DHT`` 10062306a36Sopenharmony_ci - Huffman tables segment. 10162306a36Sopenharmony_ci 10262306a36Sopenharmony_ci 10362306a36Sopenharmony_ci 10462306a36Sopenharmony_ciFor more details about JPEG specification, refer to :ref:`itu-t81`, 10562306a36Sopenharmony_ci:ref:`jfif`, :ref:`w3c-jpeg-jfif`. 106