1.. Permission is granted to copy, distribute and/or modify this
2.. document under the terms of the GNU Free Documentation License,
3.. Version 1.1 or any later version published by the Free Software
4.. Foundation, with no Invariant Sections, no Front-Cover Texts
5.. and no Back-Cover Texts. A copy of the license is included at
6.. Documentation/userspace-api/media/fdl-appendix.rst.
7..
8.. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
9
10******************
11Compressed Formats
12******************
13
14
15.. _compressed-formats:
16
17.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
18
19.. flat-table:: Compressed Image Formats
20    :header-rows:  1
21    :stub-columns: 0
22    :widths:       3 1 4
23
24    * - Identifier
25      - Code
26      - Details
27    * .. _V4L2-PIX-FMT-JPEG:
28
29      - ``V4L2_PIX_FMT_JPEG``
30      - 'JPEG'
31      - TBD. See also :ref:`VIDIOC_G_JPEGCOMP <VIDIOC_G_JPEGCOMP>`,
32	:ref:`VIDIOC_S_JPEGCOMP <VIDIOC_G_JPEGCOMP>`.
33    * .. _V4L2-PIX-FMT-MPEG:
34
35      - ``V4L2_PIX_FMT_MPEG``
36      - 'MPEG'
37      - MPEG multiplexed stream. The actual format is determined by
38	extended control ``V4L2_CID_MPEG_STREAM_TYPE``, see
39	:ref:`mpeg-control-id`.
40    * .. _V4L2-PIX-FMT-H264:
41
42      - ``V4L2_PIX_FMT_H264``
43      - 'H264'
44      - H264 Access Unit.
45	The decoder expects one Access Unit per buffer.
46	The encoder generates one Access Unit per buffer.
47	If :ref:`VIDIOC_ENUM_FMT` reports ``V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM``
48	then the decoder has no requirements since it can parse all the
49	information from the raw bytestream.
50    * .. _V4L2-PIX-FMT-H264-NO-SC:
51
52      - ``V4L2_PIX_FMT_H264_NO_SC``
53      - 'AVC1'
54      - H264 video elementary stream without start codes.
55    * .. _V4L2-PIX-FMT-H264-MVC:
56
57      - ``V4L2_PIX_FMT_H264_MVC``
58      - 'M264'
59      - H264 MVC video elementary stream.
60    * .. _V4L2-PIX-FMT-H264-SLICE:
61
62      - ``V4L2_PIX_FMT_H264_SLICE``
63      - 'S264'
64      - H264 parsed slice data, including slice headers, either with or
65	without the start code, as extracted from the H264 bitstream.
66	This format is adapted for stateless video decoders that implement an
67	H264 pipeline (using the :ref:`mem2mem` and :ref:`media-request-api`).
68	This pixelformat has two modifiers that must be set at least once
69	through the ``V4L2_CID_MPEG_VIDEO_H264_DECODE_MODE``
70        and ``V4L2_CID_MPEG_VIDEO_H264_START_CODE`` controls.
71	In addition, metadata associated with the frame to decode are
72	required to be passed through the ``V4L2_CID_MPEG_VIDEO_H264_SPS``,
73	``V4L2_CID_MPEG_VIDEO_H264_PPS``,
74	``V4L2_CID_MPEG_VIDEO_H264_SCALING_MATRIX``,
75	``V4L2_CID_MPEG_VIDEO_H264_SLICE_PARAMS`` and
76	``V4L2_CID_MPEG_VIDEO_H264_DECODE_PARAMS`` controls.  See the
77	:ref:`associated Codec Control IDs <v4l2-mpeg-h264>`.  Exactly
78	one output and one capture buffer must be provided for use
79	with this pixel format. The output buffer must contain the
80	appropriate number of macroblocks to decode a full
81	corresponding frame to the matching capture buffer.
82
83	The syntax for this format is documented in :ref:`h264`, section
84	7.3.2.8 "Slice layer without partitioning RBSP syntax" and the following
85	sections.
86
87	.. note::
88
89	   This format is not yet part of the public kernel API and it
90	   is expected to change.
91
92    * .. _V4L2-PIX-FMT-H263:
93
94      - ``V4L2_PIX_FMT_H263``
95      - 'H263'
96      - H263 video elementary stream.
97    * .. _V4L2-PIX-FMT-MPEG1:
98
99      - ``V4L2_PIX_FMT_MPEG1``
100      - 'MPG1'
101      - MPEG1 Picture. Each buffer starts with a Picture header, followed
102	by other headers as needed and ending with the Picture data.
103	If :ref:`VIDIOC_ENUM_FMT` reports ``V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM``
104	then the decoder has no requirements since it can parse all the
105	information from the raw bytestream.
106    * .. _V4L2-PIX-FMT-MPEG2:
107
108      - ``V4L2_PIX_FMT_MPEG2``
109      - 'MPG2'
110      - MPEG2 Picture. Each buffer starts with a Picture header, followed
111	by other headers as needed and ending with the Picture data.
112	If :ref:`VIDIOC_ENUM_FMT` reports ``V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM``
113	then the decoder has no requirements since it can parse all the
114	information from the raw bytestream.
115    * .. _V4L2-PIX-FMT-MPEG2-SLICE:
116
117      - ``V4L2_PIX_FMT_MPEG2_SLICE``
118      - 'MG2S'
119      - MPEG-2 parsed slice data, as extracted from the MPEG-2 bitstream.
120	This format is adapted for stateless video decoders that implement a
121	MPEG-2 pipeline (using the :ref:`mem2mem` and :ref:`media-request-api`).
122	Metadata associated with the frame to decode is required to be passed
123	through the ``V4L2_CID_MPEG_VIDEO_MPEG2_SLICE_PARAMS`` control and
124	quantization matrices can optionally be specified through the
125	``V4L2_CID_MPEG_VIDEO_MPEG2_QUANTIZATION`` control.
126	See the :ref:`associated Codec Control IDs <v4l2-mpeg-mpeg2>`.
127	Exactly one output and one capture buffer must be provided for use with
128	this pixel format. The output buffer must contain the appropriate number
129	of macroblocks to decode a full corresponding frame to the matching
130	capture buffer.
131    * .. _V4L2-PIX-FMT-MPEG4:
132
133      - ``V4L2_PIX_FMT_MPEG4``
134      - 'MPG4'
135      - MPEG4 video elementary stream.
136    * .. _V4L2-PIX-FMT-XVID:
137
138      - ``V4L2_PIX_FMT_XVID``
139      - 'XVID'
140      - Xvid video elementary stream.
141    * .. _V4L2-PIX-FMT-VC1-ANNEX-G:
142
143      - ``V4L2_PIX_FMT_VC1_ANNEX_G``
144      - 'VC1G'
145      - VC1, SMPTE 421M Annex G compliant stream.
146    * .. _V4L2-PIX-FMT-VC1-ANNEX-L:
147
148      - ``V4L2_PIX_FMT_VC1_ANNEX_L``
149      - 'VC1L'
150      - VC1, SMPTE 421M Annex L compliant stream.
151    * .. _V4L2-PIX-FMT-VP8:
152
153      - ``V4L2_PIX_FMT_VP8``
154      - 'VP80'
155      - VP8 compressed video frame. The encoder generates one
156	compressed frame per buffer, and the decoder requires one
157	compressed frame per buffer.
158    * .. _V4L2-PIX-FMT-VP8-FRAME:
159
160      - ``V4L2_PIX_FMT_VP8_FRAME``
161      - 'VP8F'
162      - VP8 parsed frame, as extracted from the container.
163	This format is adapted for stateless video decoders that implement a
164	VP8 pipeline (using the :ref:`mem2mem` and :ref:`media-request-api`).
165	Metadata associated with the frame to decode is required to be passed
166	through the ``V4L2_CID_MPEG_VIDEO_VP8_FRAME_HEADER`` control.
167	See the :ref:`associated Codec Control IDs <v4l2-mpeg-vp8>`.
168	Exactly one output and one capture buffer must be provided for use with
169	this pixel format. The output buffer must contain the appropriate number
170	of macroblocks to decode a full corresponding frame to the matching
171	capture buffer.
172
173	.. note::
174
175	   This format is not yet part of the public kernel API and it
176	   is expected to change.
177
178    * .. _V4L2-PIX-FMT-VP9:
179
180      - ``V4L2_PIX_FMT_VP9``
181      - 'VP90'
182      - VP9 compressed video frame. The encoder generates one
183	compressed frame per buffer, and the decoder requires one
184	compressed frame per buffer.
185    * .. _V4L2-PIX-FMT-HEVC:
186
187      - ``V4L2_PIX_FMT_HEVC``
188      - 'HEVC'
189      - HEVC/H.265 Access Unit.
190	The decoder expects one Access Unit per buffer.
191	The encoder generates one Access Unit per buffer.
192	If :ref:`VIDIOC_ENUM_FMT` reports ``V4L2_FMT_FLAG_CONTINUOUS_BYTESTREAM``
193	then the decoder has no	requirements since it can parse all the
194	information from the raw bytestream.
195    * .. _V4L2-PIX-FMT-HEVC-SLICE:
196
197      - ``V4L2_PIX_FMT_HEVC_SLICE``
198      - 'S265'
199      - HEVC parsed slice data, as extracted from the HEVC bitstream.
200	This format is adapted for stateless video decoders that implement a
201	HEVC pipeline (using the :ref:`mem2mem` and :ref:`media-request-api`).
202	This pixelformat has two modifiers that must be set at least once
203	through the ``V4L2_CID_MPEG_VIDEO_HEVC_DECODE_MODE``
204        and ``V4L2_CID_MPEG_VIDEO_HEVC_START_CODE`` controls.
205	Metadata associated with the frame to decode is required to be passed
206	through the following controls :
207        * ``V4L2_CID_MPEG_VIDEO_HEVC_SPS``
208        * ``V4L2_CID_MPEG_VIDEO_HEVC_PPS``
209        * ``V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS``
210	See the :ref:`associated Codec Control IDs <v4l2-mpeg-hevc>`.
211	Buffers associated with this pixel format must contain the appropriate
212	number of macroblocks to decode a full corresponding frame.
213
214	.. note::
215
216	   This format is not yet part of the public kernel API and it
217	   is expected to change.
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	See the :ref:`associated Codec Control IDs <v4l2-mpeg-fwht>`.
233