18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci.. _jpeg-controls:
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci**********************
68c2ecf20Sopenharmony_ciJPEG Control Reference
78c2ecf20Sopenharmony_ci**********************
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ciThe JPEG class includes controls for common features of JPEG encoders
108c2ecf20Sopenharmony_ciand decoders. Currently it includes features for codecs implementing
118c2ecf20Sopenharmony_ciprogressive baseline DCT compression process with Huffman entrophy
128c2ecf20Sopenharmony_cicoding.
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci.. _jpeg-control-id:
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ciJPEG Control IDs
188c2ecf20Sopenharmony_ci================
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci``V4L2_CID_JPEG_CLASS (class)``
218c2ecf20Sopenharmony_ci    The JPEG class descriptor. Calling
228c2ecf20Sopenharmony_ci    :ref:`VIDIOC_QUERYCTRL` for this control will
238c2ecf20Sopenharmony_ci    return a description of this control class.
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci``V4L2_CID_JPEG_CHROMA_SUBSAMPLING (menu)``
268c2ecf20Sopenharmony_ci    The chroma subsampling factors describe how each component of an
278c2ecf20Sopenharmony_ci    input image is sampled, in respect to maximum sample rate in each
288c2ecf20Sopenharmony_ci    spatial dimension. See :ref:`itu-t81`, clause A.1.1. for more
298c2ecf20Sopenharmony_ci    details. The ``V4L2_CID_JPEG_CHROMA_SUBSAMPLING`` control determines
308c2ecf20Sopenharmony_ci    how Cb and Cr components are downsampled after converting an input
318c2ecf20Sopenharmony_ci    image from RGB to Y'CbCr color space.
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{7.5cm}|p{10.0cm}|
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci.. flat-table::
368c2ecf20Sopenharmony_ci    :header-rows:  0
378c2ecf20Sopenharmony_ci    :stub-columns: 0
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci    * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_444``
408c2ecf20Sopenharmony_ci      - No chroma subsampling, each pixel has Y, Cr and Cb values.
418c2ecf20Sopenharmony_ci    * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_422``
428c2ecf20Sopenharmony_ci      - Horizontally subsample Cr, Cb components by a factor of 2.
438c2ecf20Sopenharmony_ci    * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_420``
448c2ecf20Sopenharmony_ci      - Subsample Cr, Cb components horizontally and vertically by 2.
458c2ecf20Sopenharmony_ci    * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_411``
468c2ecf20Sopenharmony_ci      - Horizontally subsample Cr, Cb components by a factor of 4.
478c2ecf20Sopenharmony_ci    * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_410``
488c2ecf20Sopenharmony_ci      - Subsample Cr, Cb components horizontally by 4 and vertically by 2.
498c2ecf20Sopenharmony_ci    * - ``V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY``
508c2ecf20Sopenharmony_ci      - Use only luminance component.
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci``V4L2_CID_JPEG_RESTART_INTERVAL (integer)``
558c2ecf20Sopenharmony_ci    The restart interval determines an interval of inserting RSTm
568c2ecf20Sopenharmony_ci    markers (m = 0..7). The purpose of these markers is to additionally
578c2ecf20Sopenharmony_ci    reinitialize the encoder process, in order to process blocks of an
588c2ecf20Sopenharmony_ci    image independently. For the lossy compression processes the restart
598c2ecf20Sopenharmony_ci    interval unit is MCU (Minimum Coded Unit) and its value is contained
608c2ecf20Sopenharmony_ci    in DRI (Define Restart Interval) marker. If
618c2ecf20Sopenharmony_ci    ``V4L2_CID_JPEG_RESTART_INTERVAL`` control is set to 0, DRI and RSTm
628c2ecf20Sopenharmony_ci    markers will not be inserted.
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci.. _jpeg-quality-control:
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci``V4L2_CID_JPEG_COMPRESSION_QUALITY (integer)``
678c2ecf20Sopenharmony_ci    ``V4L2_CID_JPEG_COMPRESSION_QUALITY`` control determines trade-off
688c2ecf20Sopenharmony_ci    between image quality and size. It provides simpler method for
698c2ecf20Sopenharmony_ci    applications to control image quality, without a need for direct
708c2ecf20Sopenharmony_ci    reconfiguration of luminance and chrominance quantization tables. In
718c2ecf20Sopenharmony_ci    cases where a driver uses quantization tables configured directly by
728c2ecf20Sopenharmony_ci    an application, using interfaces defined elsewhere,
738c2ecf20Sopenharmony_ci    ``V4L2_CID_JPEG_COMPRESSION_QUALITY`` control should be set by
748c2ecf20Sopenharmony_ci    driver to 0.
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci    The value range of this control is driver-specific. Only positive,
778c2ecf20Sopenharmony_ci    non-zero values are meaningful. The recommended range is 1 - 100,
788c2ecf20Sopenharmony_ci    where larger values correspond to better image quality.
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci.. _jpeg-active-marker-control:
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci``V4L2_CID_JPEG_ACTIVE_MARKER (bitmask)``
838c2ecf20Sopenharmony_ci    Specify which JPEG markers are included in compressed stream. This
848c2ecf20Sopenharmony_ci    control is valid only for encoders.
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci.. flat-table::
898c2ecf20Sopenharmony_ci    :header-rows:  0
908c2ecf20Sopenharmony_ci    :stub-columns: 0
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci    * - ``V4L2_JPEG_ACTIVE_MARKER_APP0``
938c2ecf20Sopenharmony_ci      - Application data segment APP\ :sub:`0`.
948c2ecf20Sopenharmony_ci    * - ``V4L2_JPEG_ACTIVE_MARKER_APP1``
958c2ecf20Sopenharmony_ci      - Application data segment APP\ :sub:`1`.
968c2ecf20Sopenharmony_ci    * - ``V4L2_JPEG_ACTIVE_MARKER_COM``
978c2ecf20Sopenharmony_ci      - Comment segment.
988c2ecf20Sopenharmony_ci    * - ``V4L2_JPEG_ACTIVE_MARKER_DQT``
998c2ecf20Sopenharmony_ci      - Quantization tables segment.
1008c2ecf20Sopenharmony_ci    * - ``V4L2_JPEG_ACTIVE_MARKER_DHT``
1018c2ecf20Sopenharmony_ci      - Huffman tables segment.
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ciFor more details about JPEG specification, refer to :ref:`itu-t81`,
1068c2ecf20Sopenharmony_ci:ref:`jfif`, :ref:`w3c-jpeg-jfif`.
107