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