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