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