GNU Linux-libre 6.1.90-gnu
[releases.git] / Documentation / userspace-api / media / v4l / pixfmt-compressed.rst
1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2
3 ******************
4 Compressed Formats
5 ******************
6
7
8 .. _compressed-formats:
9
10 .. raw:: latex
11
12     \small
13
14 .. tabularcolumns:: |p{5.8cm}|p{1.2cm}|p{10.3cm}|
15
16 .. cssclass:: longtable
17
18 .. flat-table:: Compressed Image Formats
19     :header-rows:  1
20     :stub-columns: 0
21     :widths:       3 1 4
22
23     * - Identifier
24       - Code
25       - Details
26     * .. _V4L2-PIX-FMT-JPEG:
27
28       - ``V4L2_PIX_FMT_JPEG``
29       - 'JPEG'
30       - TBD. See also :ref:`VIDIOC_G_JPEGCOMP <VIDIOC_G_JPEGCOMP>`,
31         :ref:`VIDIOC_S_JPEGCOMP <VIDIOC_G_JPEGCOMP>`.
32     * .. _V4L2-PIX-FMT-MPEG:
33
34       - ``V4L2_PIX_FMT_MPEG``
35       - 'MPEG'
36       - MPEG multiplexed stream. The actual format is determined by
37         extended control ``V4L2_CID_MPEG_STREAM_TYPE``, see
38         :ref:`mpeg-control-id`.
39     * .. _V4L2-PIX-FMT-H264:
40
41       - ``V4L2_PIX_FMT_H264``
42       - 'H264'
43       - H264 Access Unit.
44         The decoder expects one Access Unit per buffer.
45         The encoder generates one Access Unit per buffer.
46         If :ref:`VIDIOC_ENUM_FMT` reports ``V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM``
47         then the decoder has no requirements since it can parse all the
48         information from the raw bytestream.
49     * .. _V4L2-PIX-FMT-H264-NO-SC:
50
51       - ``V4L2_PIX_FMT_H264_NO_SC``
52       - 'AVC1'
53       - H264 video elementary stream without start codes.
54     * .. _V4L2-PIX-FMT-H264-MVC:
55
56       - ``V4L2_PIX_FMT_H264_MVC``
57       - 'M264'
58       - H264 MVC video elementary stream.
59     * .. _V4L2-PIX-FMT-H264-SLICE:
60
61       - ``V4L2_PIX_FMT_H264_SLICE``
62       - 'S264'
63       - H264 parsed slice data, including slice headers, either with or
64         without the start code, as extracted from the H264 bitstream.
65         This format is adapted for stateless video decoders that implement an
66         H264 pipeline with the :ref:`stateless_decoder`.
67         This pixelformat has two modifiers that must be set at least once
68         through the ``V4L2_CID_STATELESS_H264_DECODE_MODE``
69         and ``V4L2_CID_STATELESS_H264_START_CODE`` controls.
70         In addition, metadata associated with the frame to decode are
71         required to be passed through the ``V4L2_CID_STATELESS_H264_SPS``,
72         ``V4L2_CID_STATELESS_H264_PPS``,
73         ``V4L2_CID_STATELESS_H264_SCALING_MATRIX``,
74         ``V4L2_CID_STATELESS_H264_SLICE_PARAMS`` and
75         ``V4L2_CID_STATELESS_H264_DECODE_PARAMS`` controls.  See the
76         :ref:`associated Codec Control IDs <v4l2-codec-stateless-h264>`.
77         Exactly one output and one capture buffer must be provided for use
78         with this pixel format. The output buffer must contain the
79         appropriate number of macroblocks to decode a full
80         corresponding frame to the matching capture buffer.
81
82         The syntax for this format is documented in :ref:`h264`, section
83         7.3.2.8 "Slice layer without partitioning RBSP syntax" and the following
84         sections.
85
86     * .. _V4L2-PIX-FMT-H263:
87
88       - ``V4L2_PIX_FMT_H263``
89       - 'H263'
90       - H263 video elementary stream.
91     * .. _V4L2-PIX-FMT-MPEG1:
92
93       - ``V4L2_PIX_FMT_MPEG1``
94       - 'MPG1'
95       - MPEG1 Picture. Each buffer starts with a Picture header, followed
96         by other headers as needed and ending with the Picture data.
97         If :ref:`VIDIOC_ENUM_FMT` reports ``V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM``
98         then the decoder has no requirements since it can parse all the
99         information from the raw bytestream.
100     * .. _V4L2-PIX-FMT-MPEG2:
101
102       - ``V4L2_PIX_FMT_MPEG2``
103       - 'MPG2'
104       - MPEG2 Picture. Each buffer starts with a Picture header, followed
105         by other headers as needed and ending with the Picture data.
106         If :ref:`VIDIOC_ENUM_FMT` reports ``V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM``
107         then the decoder has no requirements since it can parse all the
108         information from the raw bytestream.
109     * .. _V4L2-PIX-FMT-MPEG2-SLICE:
110
111       - ``V4L2_PIX_FMT_MPEG2_SLICE``
112       - 'MG2S'
113       - MPEG-2 parsed slice data, as extracted from the MPEG-2 bitstream.
114         This format is adapted for stateless video decoders that implement a
115         MPEG-2 pipeline with the :ref:`stateless_decoder`.
116         Metadata associated with the frame to decode is required to be passed
117         through the ``V4L2_CID_STATELESS_MPEG2_SEQUENCE`` and
118         ``V4L2_CID_STATELESS_MPEG2_PICTURE`` controls.
119         Quantisation matrices can optionally be specified through the
120         ``V4L2_CID_STATELESS_MPEG2_QUANTISATION`` control.
121         See the :ref:`associated Codec Control IDs <v4l2-codec-stateless-mpeg2>`.
122         Exactly one output and one capture buffer must be provided for use with
123         this pixel format. The output buffer must contain the appropriate number
124         of macroblocks to decode a full corresponding frame to the matching
125         capture buffer.
126     * .. _V4L2-PIX-FMT-MPEG4:
127
128       - ``V4L2_PIX_FMT_MPEG4``
129       - 'MPG4'
130       - MPEG4 video elementary stream.
131     * .. _V4L2-PIX-FMT-XVID:
132
133       - ``V4L2_PIX_FMT_XVID``
134       - 'XVID'
135       - Xvid video elementary stream.
136     * .. _V4L2-PIX-FMT-VC1-ANNEX-G:
137
138       - ``V4L2_PIX_FMT_VC1_ANNEX_G``
139       - 'VC1G'
140       - VC1, SMPTE 421M Annex G compliant stream.
141     * .. _V4L2-PIX-FMT-VC1-ANNEX-L:
142
143       - ``V4L2_PIX_FMT_VC1_ANNEX_L``
144       - 'VC1L'
145       - VC1, SMPTE 421M Annex L compliant stream.
146     * .. _V4L2-PIX-FMT-VP8:
147
148       - ``V4L2_PIX_FMT_VP8``
149       - 'VP80'
150       - VP8 compressed video frame. The encoder generates one
151         compressed frame per buffer, and the decoder requires one
152         compressed frame per buffer.
153     * .. _V4L2-PIX-FMT-VP8-FRAME:
154
155       - ``V4L2_PIX_FMT_VP8_FRAME``
156       - 'VP8F'
157       - VP8 parsed frame, including the frame header, as extracted from the container.
158         This format is adapted for stateless video decoders that implement an
159         VP8 pipeline with the :ref:`stateless_decoder`.
160         Metadata associated with the frame to decode is required to be passed
161         through the ``V4L2_CID_STATELESS_VP8_FRAME`` control.
162         See the :ref:`associated Codec Control IDs <v4l2-codec-stateless-vp8>`.
163         Exactly one output and one capture buffer must be provided for use with
164         this pixel format. The output buffer must contain the appropriate number
165         of macroblocks to decode a full corresponding frame to the matching
166         capture buffer.
167
168     * .. _V4L2-PIX-FMT-VP9:
169
170       - ``V4L2_PIX_FMT_VP9``
171       - 'VP90'
172       - VP9 compressed video frame. The encoder generates one
173         compressed frame per buffer, and the decoder requires one
174         compressed frame per buffer.
175     * .. _V4L2-PIX-FMT-VP9-FRAME:
176
177       - ``V4L2_PIX_FMT_VP9_FRAME``
178       - 'VP9F'
179       - VP9 parsed frame, including the frame header, as extracted from the container.
180         This format is adapted for stateless video decoders that implement a
181         VP9 pipeline with the :ref:`stateless_decoder`.
182         Metadata associated with the frame to decode is required to be passed
183         through the ``V4L2_CID_STATELESS_VP9_FRAME`` and
184         the ``V4L2_CID_STATELESS_VP9_COMPRESSED_HDR`` controls.
185         See the :ref:`associated Codec Control IDs <v4l2-codec-stateless-vp9>`.
186         Exactly one output and one capture buffer must be provided for use with
187         this pixel format. The output buffer must contain the appropriate number
188         of macroblocks to decode a full corresponding frame to the matching
189         capture buffer.
190     * .. _V4L2-PIX-FMT-HEVC:
191
192       - ``V4L2_PIX_FMT_HEVC``
193       - 'HEVC'
194       - HEVC/H.265 Access Unit.
195         The decoder expects one Access Unit per buffer.
196         The encoder generates one Access Unit per buffer.
197         If :ref:`VIDIOC_ENUM_FMT` reports ``V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM``
198         then the decoder has no requirements since it can parse all the
199         information from the raw bytestream.
200     * .. _V4L2-PIX-FMT-HEVC-SLICE:
201
202       - ``V4L2_PIX_FMT_HEVC_SLICE``
203       - 'S265'
204       - HEVC parsed slice data, as extracted from the HEVC bitstream.
205         This format is adapted for stateless video decoders that implement a
206         HEVC pipeline (using the :ref:`mem2mem` and :ref:`media-request-api`).
207         This pixelformat has two modifiers that must be set at least once
208         through the ``V4L2_CID_MPEG_VIDEO_HEVC_DECODE_MODE``
209         and ``V4L2_CID_MPEG_VIDEO_HEVC_START_CODE`` controls.
210         Metadata associated with the frame to decode is required to be passed
211         through the following controls:
212         ``V4L2_CID_MPEG_VIDEO_HEVC_SPS``,
213         ``V4L2_CID_MPEG_VIDEO_HEVC_PPS``, and
214         ``V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS``.
215         See the :ref:`associated Codec Control IDs <v4l2-codec-stateless-hevc>`.
216         Buffers associated with this pixel format must contain the appropriate
217         number of macroblocks to decode a full corresponding frame.
218     * .. _V4L2-PIX-FMT-FWHT:
219
220       - ``V4L2_PIX_FMT_FWHT``
221       - 'FWHT'
222       - Video elementary stream using a codec based on the Fast Walsh Hadamard
223         Transform. This codec is implemented by the vicodec ('Virtual Codec')
224         driver. See the codec-fwht.h header for more details.
225         :ref:`VIDIOC_ENUM_FMT` reports ``V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM``
226         since the decoder can parse all the information from the raw bytestream.
227     * .. _V4L2-PIX-FMT-FWHT-STATELESS:
228
229       - ``V4L2_PIX_FMT_FWHT_STATELESS``
230       - 'SFWH'
231       - Same format as V4L2_PIX_FMT_FWHT but requires stateless codec implementation.
232         Metadata associated with the frame to decode is required to be passed
233         through the ``V4L2_CID_STATELESS_FWHT_PARAMS`` control.
234         See the :ref:`associated Codec Control ID <codec-stateless-fwht>`.
235
236 .. raw:: latex
237
238     \normalsize