xref: /linux/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst (revision 6dfafbd0299a60bfb5d5e277fdf100037c7ded07)
1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2.. c:namespace:: V4L
3
4.. _codec-stateless-controls:
5
6*********************************
7Stateless Codec Control Reference
8*********************************
9
10The Stateless Codec control class is intended to support
11stateless decoder and encoders (i.e. hardware accelerators).
12
13These drivers are typically supported by the :ref:`stateless_decoder`,
14and deal with parsed pixel formats such as V4L2_PIX_FMT_H264_SLICE.
15
16Stateless Codec Control ID
17==========================
18
19.. _codec-stateless-control-id:
20
21``V4L2_CID_CODEC_STATELESS_CLASS (class)``
22    The Stateless Codec class descriptor.
23
24.. _v4l2-codec-stateless-h264:
25
26``V4L2_CID_STATELESS_H264_SPS (struct)``
27    Specifies the sequence parameter set (as extracted from the
28    bitstream) for the associated H264 slice data. This includes the
29    necessary parameters for configuring a stateless hardware decoding
30    pipeline for H264. The bitstream parameters are defined according
31    to :ref:`h264`, section 7.4.2.1.1 "Sequence Parameter Set Data
32    Semantics". For further documentation, refer to the above
33    specification, unless there is an explicit comment stating
34    otherwise.
35
36.. c:type:: v4l2_ctrl_h264_sps
37
38.. raw:: latex
39
40    \small
41
42.. tabularcolumns:: |p{1.2cm}|p{8.6cm}|p{7.5cm}|
43
44.. flat-table:: struct v4l2_ctrl_h264_sps
45    :header-rows:  0
46    :stub-columns: 0
47    :widths:       1 1 2
48
49    * - __u8
50      - ``profile_idc``
51      -
52    * - __u8
53      - ``constraint_set_flags``
54      - See :ref:`Sequence Parameter Set Constraints Set Flags <h264_sps_constraints_set_flags>`
55    * - __u8
56      - ``level_idc``
57      -
58    * - __u8
59      - ``seq_parameter_set_id``
60      -
61    * - __u8
62      - ``chroma_format_idc``
63      -
64    * - __u8
65      - ``bit_depth_luma_minus8``
66      -
67    * - __u8
68      - ``bit_depth_chroma_minus8``
69      -
70    * - __u8
71      - ``log2_max_frame_num_minus4``
72      -
73    * - __u8
74      - ``pic_order_cnt_type``
75      -
76    * - __u8
77      - ``log2_max_pic_order_cnt_lsb_minus4``
78      -
79    * - __u8
80      - ``max_num_ref_frames``
81      -
82    * - __u8
83      - ``num_ref_frames_in_pic_order_cnt_cycle``
84      -
85    * - __s32
86      - ``offset_for_ref_frame[255]``
87      -
88    * - __s32
89      - ``offset_for_non_ref_pic``
90      -
91    * - __s32
92      - ``offset_for_top_to_bottom_field``
93      -
94    * - __u16
95      - ``pic_width_in_mbs_minus1``
96      -
97    * - __u16
98      - ``pic_height_in_map_units_minus1``
99      -
100    * - __u32
101      - ``flags``
102      - See :ref:`Sequence Parameter Set Flags <h264_sps_flags>`
103
104.. raw:: latex
105
106    \normalsize
107
108.. _h264_sps_constraints_set_flags:
109
110``Sequence Parameter Set Constraints Set Flags``
111
112.. cssclass:: longtable
113
114.. flat-table::
115    :header-rows:  0
116    :stub-columns: 0
117    :widths:       1 1 2
118
119    * - ``V4L2_H264_SPS_CONSTRAINT_SET0_FLAG``
120      - 0x00000001
121      -
122    * - ``V4L2_H264_SPS_CONSTRAINT_SET1_FLAG``
123      - 0x00000002
124      -
125    * - ``V4L2_H264_SPS_CONSTRAINT_SET2_FLAG``
126      - 0x00000004
127      -
128    * - ``V4L2_H264_SPS_CONSTRAINT_SET3_FLAG``
129      - 0x00000008
130      -
131    * - ``V4L2_H264_SPS_CONSTRAINT_SET4_FLAG``
132      - 0x00000010
133      -
134    * - ``V4L2_H264_SPS_CONSTRAINT_SET5_FLAG``
135      - 0x00000020
136      -
137
138.. _h264_sps_flags:
139
140``Sequence Parameter Set Flags``
141
142.. cssclass:: longtable
143
144.. flat-table::
145    :header-rows:  0
146    :stub-columns: 0
147    :widths:       1 1 2
148
149    * - ``V4L2_H264_SPS_FLAG_SEPARATE_COLOUR_PLANE``
150      - 0x00000001
151      -
152    * - ``V4L2_H264_SPS_FLAG_QPPRIME_Y_ZERO_TRANSFORM_BYPASS``
153      - 0x00000002
154      -
155    * - ``V4L2_H264_SPS_FLAG_DELTA_PIC_ORDER_ALWAYS_ZERO``
156      - 0x00000004
157      -
158    * - ``V4L2_H264_SPS_FLAG_GAPS_IN_FRAME_NUM_VALUE_ALLOWED``
159      - 0x00000008
160      -
161    * - ``V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY``
162      - 0x00000010
163      -
164    * - ``V4L2_H264_SPS_FLAG_MB_ADAPTIVE_FRAME_FIELD``
165      - 0x00000020
166      -
167    * - ``V4L2_H264_SPS_FLAG_DIRECT_8X8_INFERENCE``
168      - 0x00000040
169      -
170
171``V4L2_CID_STATELESS_H264_PPS (struct)``
172    Specifies the picture parameter set (as extracted from the
173    bitstream) for the associated H264 slice data. This includes the
174    necessary parameters for configuring a stateless hardware decoding
175    pipeline for H264.  The bitstream parameters are defined according
176    to :ref:`h264`, section 7.4.2.2 "Picture Parameter Set RBSP
177    Semantics". For further documentation, refer to the above
178    specification, unless there is an explicit comment stating
179    otherwise.
180
181.. c:type:: v4l2_ctrl_h264_pps
182
183.. raw:: latex
184
185    \small
186
187.. flat-table:: struct v4l2_ctrl_h264_pps
188    :header-rows:  0
189    :stub-columns: 0
190    :widths:       1 1 2
191
192    * - __u8
193      - ``pic_parameter_set_id``
194      -
195    * - __u8
196      - ``seq_parameter_set_id``
197      -
198    * - __u8
199      - ``num_slice_groups_minus1``
200      -
201    * - __u8
202      - ``num_ref_idx_l0_default_active_minus1``
203      -
204    * - __u8
205      - ``num_ref_idx_l1_default_active_minus1``
206      -
207    * - __u8
208      - ``weighted_bipred_idc``
209      -
210    * - __s8
211      - ``pic_init_qp_minus26``
212      -
213    * - __s8
214      - ``pic_init_qs_minus26``
215      -
216    * - __s8
217      - ``chroma_qp_index_offset``
218      -
219    * - __s8
220      - ``second_chroma_qp_index_offset``
221      -
222    * - __u16
223      - ``flags``
224      - See :ref:`Picture Parameter Set Flags <h264_pps_flags>`
225
226.. raw:: latex
227
228    \normalsize
229
230.. _h264_pps_flags:
231
232``Picture Parameter Set Flags``
233
234.. raw:: latex
235
236    \begingroup
237    \scriptsize
238    \setlength{\tabcolsep}{2pt}
239
240.. tabularcolumns:: |p{9.8cm}|p{1.0cm}|p{6.5cm}|
241
242.. flat-table::
243    :header-rows:  0
244    :stub-columns: 0
245    :widths:       10 1 4
246
247    * - ``V4L2_H264_PPS_FLAG_ENTROPY_CODING_MODE``
248      - 0x0001
249      -
250    * - ``V4L2_H264_PPS_FLAG_BOTTOM_FIELD_PIC_ORDER_IN_FRAME_PRESENT``
251      - 0x0002
252      -
253    * - ``V4L2_H264_PPS_FLAG_WEIGHTED_PRED``
254      - 0x0004
255      -
256    * - ``V4L2_H264_PPS_FLAG_DEBLOCKING_FILTER_CONTROL_PRESENT``
257      - 0x0008
258      -
259    * - ``V4L2_H264_PPS_FLAG_CONSTRAINED_INTRA_PRED``
260      - 0x0010
261      -
262    * - ``V4L2_H264_PPS_FLAG_REDUNDANT_PIC_CNT_PRESENT``
263      - 0x0020
264      -
265    * - ``V4L2_H264_PPS_FLAG_TRANSFORM_8X8_MODE``
266      - 0x0040
267      -
268    * - ``V4L2_H264_PPS_FLAG_SCALING_MATRIX_PRESENT``
269      - 0x0080
270      - ``V4L2_CID_STATELESS_H264_SCALING_MATRIX``
271        must be used for this picture.
272
273.. raw:: latex
274
275    \endgroup
276
277``V4L2_CID_STATELESS_H264_SCALING_MATRIX (struct)``
278    Specifies the scaling matrix (as extracted from the bitstream) for
279    the associated H264 slice data. The bitstream parameters are
280    defined according to :ref:`h264`, section 7.4.2.1.1.1 "Scaling
281    List Semantics". For further documentation, refer to the above
282    specification, unless there is an explicit comment stating
283    otherwise.
284
285.. c:type:: v4l2_ctrl_h264_scaling_matrix
286
287.. raw:: latex
288
289    \small
290
291.. tabularcolumns:: |p{0.6cm}|p{4.8cm}|p{11.9cm}|
292
293.. flat-table:: struct v4l2_ctrl_h264_scaling_matrix
294    :header-rows:  0
295    :stub-columns: 0
296    :widths:       1 1 2
297
298    * - __u8
299      - ``scaling_list_4x4[6][16]``
300      - Scaling matrix after applying the inverse scanning process.
301        Expected list order is Intra Y, Intra Cb, Intra Cr, Inter Y,
302        Inter Cb, Inter Cr. The values on each scaling list are
303        expected in raster scan order.
304    * - __u8
305      - ``scaling_list_8x8[6][64]``
306      - Scaling matrix after applying the inverse scanning process.
307        Expected list order is Intra Y, Inter Y, Intra Cb, Inter Cb,
308        Intra Cr, Inter Cr. The values on each scaling list are
309        expected in raster scan order.
310
311``V4L2_CID_STATELESS_H264_SLICE_PARAMS (struct)``
312    Specifies the slice parameters (as extracted from the bitstream)
313    for the associated H264 slice data. This includes the necessary
314    parameters for configuring a stateless hardware decoding pipeline
315    for H264.  The bitstream parameters are defined according to
316    :ref:`h264`, section 7.4.3 "Slice Header Semantics". For further
317    documentation, refer to the above specification, unless there is
318    an explicit comment stating otherwise.
319
320.. c:type:: v4l2_ctrl_h264_slice_params
321
322.. raw:: latex
323
324    \small
325
326.. tabularcolumns:: |p{4.0cm}|p{5.9cm}|p{7.4cm}|
327
328.. flat-table:: struct v4l2_ctrl_h264_slice_params
329    :header-rows:  0
330    :stub-columns: 0
331    :widths:       1 1 2
332
333    * - __u32
334      - ``header_bit_size``
335      - Offset in bits to slice_data() from the beginning of this slice.
336    * - __u32
337      - ``first_mb_in_slice``
338      -
339    * - __u8
340      - ``slice_type``
341      -
342    * - __u8
343      - ``colour_plane_id``
344      -
345    * - __u8
346      - ``redundant_pic_cnt``
347      -
348    * - __u8
349      - ``cabac_init_idc``
350      -
351    * - __s8
352      - ``slice_qp_delta``
353      -
354    * - __s8
355      - ``slice_qs_delta``
356      -
357    * - __u8
358      - ``disable_deblocking_filter_idc``
359      -
360    * - __s8
361      - ``slice_alpha_c0_offset_div2``
362      -
363    * - __s8
364      - ``slice_beta_offset_div2``
365      -
366    * - __u8
367      - ``num_ref_idx_l0_active_minus1``
368      - If num_ref_idx_active_override_flag is not set, this field must be
369        set to the value of num_ref_idx_l0_default_active_minus1
370    * - __u8
371      - ``num_ref_idx_l1_active_minus1``
372      - If num_ref_idx_active_override_flag is not set, this field must be
373        set to the value of num_ref_idx_l1_default_active_minus1
374    * - __u8
375      - ``reserved``
376      - Applications and drivers must set this to zero.
377    * - struct :c:type:`v4l2_h264_reference`
378      - ``ref_pic_list0[32]``
379      - Reference picture list after applying the per-slice modifications
380    * - struct :c:type:`v4l2_h264_reference`
381      - ``ref_pic_list1[32]``
382      - Reference picture list after applying the per-slice modifications
383    * - __u32
384      - ``flags``
385      - See :ref:`Slice Parameter Flags <h264_slice_flags>`
386
387.. raw:: latex
388
389    \normalsize
390
391.. _h264_slice_flags:
392
393``Slice Parameter Set Flags``
394
395.. cssclass:: longtable
396
397.. flat-table::
398    :header-rows:  0
399    :stub-columns: 0
400    :widths:       1 1 2
401
402    * - ``V4L2_H264_SLICE_FLAG_DIRECT_SPATIAL_MV_PRED``
403      - 0x00000001
404      -
405    * - ``V4L2_H264_SLICE_FLAG_SP_FOR_SWITCH``
406      - 0x00000002
407      -
408
409``V4L2_CID_STATELESS_H264_PRED_WEIGHTS (struct)``
410    Prediction weight table defined according to :ref:`h264`,
411    section 7.4.3.2 "Prediction Weight Table Semantics".
412    The prediction weight table must be passed by applications
413    under the conditions explained in section 7.3.3 "Slice header
414    syntax".
415
416.. c:type:: v4l2_ctrl_h264_pred_weights
417
418.. raw:: latex
419
420    \small
421
422.. tabularcolumns:: |p{4.9cm}|p{4.9cm}|p{7.5cm}|
423
424.. flat-table:: struct v4l2_ctrl_h264_pred_weights
425    :header-rows:  0
426    :stub-columns: 0
427    :widths:       1 1 2
428
429    * - __u16
430      - ``luma_log2_weight_denom``
431      -
432    * - __u16
433      - ``chroma_log2_weight_denom``
434      -
435    * - struct :c:type:`v4l2_h264_weight_factors`
436      - ``weight_factors[2]``
437      - The weight factors at index 0 are the weight factors for the reference
438        list 0, the one at index 1 for the reference list 1.
439
440.. raw:: latex
441
442    \normalsize
443
444.. c:type:: v4l2_h264_weight_factors
445
446.. raw:: latex
447
448    \small
449
450.. tabularcolumns:: |p{1.0cm}|p{4.5cm}|p{11.8cm}|
451
452.. flat-table:: struct v4l2_h264_weight_factors
453    :header-rows:  0
454    :stub-columns: 0
455    :widths:       1 1 2
456
457    * - __s16
458      - ``luma_weight[32]``
459      -
460    * - __s16
461      - ``luma_offset[32]``
462      -
463    * - __s16
464      - ``chroma_weight[32][2]``
465      -
466    * - __s16
467      - ``chroma_offset[32][2]``
468      -
469
470.. raw:: latex
471
472    \normalsize
473
474``Picture Reference``
475
476.. c:type:: v4l2_h264_reference
477
478.. cssclass:: longtable
479
480.. flat-table:: struct v4l2_h264_reference
481    :header-rows:  0
482    :stub-columns: 0
483    :widths:       1 1 2
484
485    * - __u8
486      - ``fields``
487      - Specifies how the picture is referenced. See :ref:`Reference Fields <h264_ref_fields>`
488    * - __u8
489      - ``index``
490      - Index into the :c:type:`v4l2_ctrl_h264_decode_params`.dpb array.
491
492.. _h264_ref_fields:
493
494``Reference Fields``
495
496.. raw:: latex
497
498    \small
499
500.. tabularcolumns:: |p{5.4cm}|p{0.8cm}|p{11.1cm}|
501
502.. flat-table::
503    :header-rows:  0
504    :stub-columns: 0
505    :widths:       1 1 2
506
507    * - ``V4L2_H264_TOP_FIELD_REF``
508      - 0x1
509      - The top field in field pair is used for short-term reference.
510    * - ``V4L2_H264_BOTTOM_FIELD_REF``
511      - 0x2
512      - The bottom field in field pair is used for short-term reference.
513    * - ``V4L2_H264_FRAME_REF``
514      - 0x3
515      - The frame (or the top/bottom fields, if it's a field pair)
516        is used for short-term reference.
517
518.. raw:: latex
519
520    \normalsize
521
522``V4L2_CID_STATELESS_H264_DECODE_PARAMS (struct)``
523    Specifies the decode parameters (as extracted from the bitstream)
524    for the associated H264 slice data. This includes the necessary
525    parameters for configuring a stateless hardware decoding pipeline
526    for H264. The bitstream parameters are defined according to
527    :ref:`h264`. For further documentation, refer to the above
528    specification, unless there is an explicit comment stating
529    otherwise.
530
531.. c:type:: v4l2_ctrl_h264_decode_params
532
533.. raw:: latex
534
535    \small
536
537.. tabularcolumns:: |p{4.0cm}|p{5.9cm}|p{7.4cm}|
538
539.. flat-table:: struct v4l2_ctrl_h264_decode_params
540    :header-rows:  0
541    :stub-columns: 0
542    :widths:       1 1 2
543
544    * - struct :c:type:`v4l2_h264_dpb_entry`
545      - ``dpb[16]``
546      -
547    * - __u16
548      - ``nal_ref_idc``
549      - NAL reference ID value coming from the NAL Unit header
550    * - __u16
551      - ``frame_num``
552      -
553    * - __s32
554      - ``top_field_order_cnt``
555      - Picture Order Count for the coded top field
556    * - __s32
557      - ``bottom_field_order_cnt``
558      - Picture Order Count for the coded bottom field
559    * - __u16
560      - ``idr_pic_id``
561      -
562    * - __u16
563      - ``pic_order_cnt_lsb``
564      -
565    * - __s32
566      - ``delta_pic_order_cnt_bottom``
567      -
568    * - __s32
569      - ``delta_pic_order_cnt0``
570      -
571    * - __s32
572      - ``delta_pic_order_cnt1``
573      -
574    * - __u32
575      - ``dec_ref_pic_marking_bit_size``
576      - Size in bits of the dec_ref_pic_marking() syntax element.
577    * - __u32
578      - ``pic_order_cnt_bit_size``
579      - Combined size in bits of the picture order count related syntax
580        elements: pic_order_cnt_lsb, delta_pic_order_cnt_bottom,
581        delta_pic_order_cnt0, and delta_pic_order_cnt1.
582    * - __u32
583      - ``slice_group_change_cycle``
584      -
585    * - __u32
586      - ``reserved``
587      - Applications and drivers must set this to zero.
588    * - __u32
589      - ``flags``
590      - See :ref:`Decode Parameters Flags <h264_decode_params_flags>`
591
592.. raw:: latex
593
594    \normalsize
595
596.. _h264_decode_params_flags:
597
598``Decode Parameters Flags``
599
600.. raw:: latex
601
602    \small
603
604.. tabularcolumns:: |p{8.3cm}|p{2.1cm}|p{6.9cm}|
605
606.. flat-table::
607    :header-rows:  0
608    :stub-columns: 0
609    :widths:       1 1 2
610
611    * - ``V4L2_H264_DECODE_PARAM_FLAG_IDR_PIC``
612      - 0x00000001
613      - That picture is an IDR picture
614    * - ``V4L2_H264_DECODE_PARAM_FLAG_FIELD_PIC``
615      - 0x00000002
616      -
617    * - ``V4L2_H264_DECODE_PARAM_FLAG_BOTTOM_FIELD``
618      - 0x00000004
619      -
620    * - ``V4L2_H264_DECODE_PARAM_FLAG_PFRAME``
621      - 0x00000008
622      -
623    * - ``V4L2_H264_DECODE_PARAM_FLAG_BFRAME``
624      - 0x00000010
625      -
626
627.. raw:: latex
628
629    \normalsize
630
631.. c:type:: v4l2_h264_dpb_entry
632
633.. raw:: latex
634
635    \small
636
637.. tabularcolumns:: |p{1.0cm}|p{4.9cm}|p{11.4cm}|
638
639.. flat-table:: struct v4l2_h264_dpb_entry
640    :header-rows:  0
641    :stub-columns: 0
642    :widths:       1 1 2
643
644    * - __u64
645      - ``reference_ts``
646      - Timestamp of the V4L2 capture buffer to use as reference, used
647        with B-coded and P-coded frames. The timestamp refers to the
648        ``timestamp`` field in struct :c:type:`v4l2_buffer`. Use the
649        :c:func:`v4l2_timeval_to_ns()` function to convert the struct
650        :c:type:`timeval` in struct :c:type:`v4l2_buffer` to a __u64.
651    * - __u32
652      - ``pic_num``
653      - For short term references, this must match the derived value PicNum
654	(8-28) and for long term references it must match the derived value
655	LongTermPicNum (8-29). When decoding frames (as opposed to fields)
656	pic_num is the same as FrameNumWrap.
657    * - __u16
658      - ``frame_num``
659      - For short term references, this must match the frame_num value from
660	the slice header syntax (the driver will wrap the value if needed). For
661	long term references, this must be set to the value of
662	long_term_frame_idx described in the dec_ref_pic_marking() syntax.
663    * - __u8
664      - ``fields``
665      - Specifies how the DPB entry is referenced. See :ref:`Reference Fields <h264_ref_fields>`
666    * - __u8
667      - ``reserved[5]``
668      - Applications and drivers must set this to zero.
669    * - __s32
670      - ``top_field_order_cnt``
671      -
672    * - __s32
673      - ``bottom_field_order_cnt``
674      -
675    * - __u32
676      - ``flags``
677      - See :ref:`DPB Entry Flags <h264_dpb_flags>`
678
679.. raw:: latex
680
681    \normalsize
682
683.. _h264_dpb_flags:
684
685``DPB Entries Flags``
686
687.. raw:: latex
688
689    \small
690
691.. tabularcolumns:: |p{7.7cm}|p{2.1cm}|p{7.5cm}|
692
693.. flat-table::
694    :header-rows:  0
695    :stub-columns: 0
696    :widths:       1 1 2
697
698    * - ``V4L2_H264_DPB_ENTRY_FLAG_VALID``
699      - 0x00000001
700      - The DPB entry is valid (non-empty) and should be considered.
701    * - ``V4L2_H264_DPB_ENTRY_FLAG_ACTIVE``
702      - 0x00000002
703      - The DPB entry is used for reference.
704    * - ``V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM``
705      - 0x00000004
706      - The DPB entry is used for long-term reference.
707    * - ``V4L2_H264_DPB_ENTRY_FLAG_FIELD``
708      - 0x00000008
709      - The DPB entry is a single field or a complementary field pair.
710
711.. raw:: latex
712
713    \normalsize
714
715``V4L2_CID_STATELESS_H264_DECODE_MODE (enum)``
716    Specifies the decoding mode to use. Currently exposes slice-based and
717    frame-based decoding but new modes might be added later on.
718    This control is used as a modifier for V4L2_PIX_FMT_H264_SLICE
719    pixel format. Applications that support V4L2_PIX_FMT_H264_SLICE
720    are required to set this control in order to specify the decoding mode
721    that is expected for the buffer.
722    Drivers may expose a single or multiple decoding modes, depending
723    on what they can support.
724
725.. c:type:: v4l2_stateless_h264_decode_mode
726
727.. raw:: latex
728
729    \scriptsize
730
731.. tabularcolumns:: |p{7.4cm}|p{0.3cm}|p{9.6cm}|
732
733.. flat-table::
734    :header-rows:  0
735    :stub-columns: 0
736    :widths:       1 1 2
737
738    * - ``V4L2_STATELESS_H264_DECODE_MODE_SLICE_BASED``
739      - 0
740      - Decoding is done at the slice granularity.
741        The OUTPUT buffer must contain a single slice.
742        When this mode is selected, the ``V4L2_CID_STATELESS_H264_SLICE_PARAMS``
743        control shall be set. When multiple slices compose a frame,
744        use of ``V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTURE_BUF`` flag
745        is required.
746    * - ``V4L2_STATELESS_H264_DECODE_MODE_FRAME_BASED``
747      - 1
748      - Decoding is done at the frame granularity,
749        The OUTPUT buffer must contain all slices needed to decode the
750        frame. The OUTPUT buffer must also contain both fields.
751        This mode will be supported by devices that
752        parse the slice(s) header(s) in hardware. When this mode is
753        selected, the ``V4L2_CID_STATELESS_H264_SLICE_PARAMS``
754        control shall not be set.
755
756.. raw:: latex
757
758    \normalsize
759
760``V4L2_CID_STATELESS_H264_START_CODE (enum)``
761    Specifies the H264 slice start code expected for each slice.
762    This control is used as a modifier for V4L2_PIX_FMT_H264_SLICE
763    pixel format. Applications that support V4L2_PIX_FMT_H264_SLICE
764    are required to set this control in order to specify the start code
765    that is expected for the buffer.
766    Drivers may expose a single or multiple start codes, depending
767    on what they can support.
768
769.. c:type:: v4l2_stateless_h264_start_code
770
771.. raw:: latex
772
773    \small
774
775.. tabularcolumns:: |p{7.9cm}|p{0.4cm}|p{9.0cm}|
776
777.. flat-table::
778    :header-rows:  0
779    :stub-columns: 0
780    :widths:       4 1 4
781
782    * - ``V4L2_STATELESS_H264_START_CODE_NONE``
783      - 0
784      - Selecting this value specifies that H264 slices are passed
785        to the driver without any start code. The bitstream data should be
786        according to :ref:`h264` 7.3.1 NAL unit syntax, hence contains
787        emulation prevention bytes when required.
788    * - ``V4L2_STATELESS_H264_START_CODE_ANNEX_B``
789      - 1
790      - Selecting this value specifies that H264 slices are expected
791        to be prefixed by Annex B start codes. According to :ref:`h264`
792        valid start codes can be 3-bytes 0x000001 or 4-bytes 0x00000001.
793
794.. raw:: latex
795
796    \normalsize
797
798.. _codec-stateless-fwht:
799
800``V4L2_CID_STATELESS_FWHT_PARAMS (struct)``
801    Specifies the FWHT (Fast Walsh Hadamard Transform) parameters (as extracted
802    from the bitstream) for the associated FWHT data. This includes the necessary
803    parameters for configuring a stateless hardware decoding pipeline for FWHT.
804    This codec is specific to the vicodec test driver.
805
806.. c:type:: v4l2_ctrl_fwht_params
807
808.. raw:: latex
809
810    \small
811
812.. tabularcolumns:: |p{1.4cm}|p{3.9cm}|p{12.0cm}|
813
814.. flat-table:: struct v4l2_ctrl_fwht_params
815    :header-rows:  0
816    :stub-columns: 0
817    :widths:       1 1 2
818
819    * - __u64
820      - ``backward_ref_ts``
821      - Timestamp of the V4L2 capture buffer to use as backward reference, used
822        with P-coded frames. The timestamp refers to the
823	``timestamp`` field in struct :c:type:`v4l2_buffer`. Use the
824	:c:func:`v4l2_timeval_to_ns()` function to convert the struct
825	:c:type:`timeval` in struct :c:type:`v4l2_buffer` to a __u64.
826    * - __u32
827      - ``version``
828      - The version of the codec. Set to ``V4L2_FWHT_VERSION``.
829    * - __u32
830      - ``width``
831      - The width of the frame.
832    * - __u32
833      - ``height``
834      - The height of the frame.
835    * - __u32
836      - ``flags``
837      - The flags of the frame, see :ref:`fwht-flags`.
838    * - __u32
839      - ``colorspace``
840      - The colorspace of the frame, from enum :c:type:`v4l2_colorspace`.
841    * - __u32
842      - ``xfer_func``
843      - The transfer function, from enum :c:type:`v4l2_xfer_func`.
844    * - __u32
845      - ``ycbcr_enc``
846      - The Y'CbCr encoding, from enum :c:type:`v4l2_ycbcr_encoding`.
847    * - __u32
848      - ``quantization``
849      - The quantization range, from enum :c:type:`v4l2_quantization`.
850
851.. raw:: latex
852
853    \normalsize
854
855.. _fwht-flags:
856
857FWHT Flags
858==========
859
860.. raw:: latex
861
862    \small
863
864.. tabularcolumns:: |p{7.0cm}|p{2.3cm}|p{8.0cm}|
865
866.. flat-table::
867    :header-rows:  0
868    :stub-columns: 0
869    :widths:       3 1 4
870
871    * - ``V4L2_FWHT_FL_IS_INTERLACED``
872      - 0x00000001
873      - Set if this is an interlaced format.
874    * - ``V4L2_FWHT_FL_IS_BOTTOM_FIRST``
875      - 0x00000002
876      - Set if this is a bottom-first (NTSC) interlaced format.
877    * - ``V4L2_FWHT_FL_IS_ALTERNATE``
878      - 0x00000004
879      - Set if each 'frame' contains just one field.
880    * - ``V4L2_FWHT_FL_IS_BOTTOM_FIELD``
881      - 0x00000008
882      - If V4L2_FWHT_FL_IS_ALTERNATE was set, then this is set if this 'frame' is the
883	bottom field, else it is the top field.
884    * - ``V4L2_FWHT_FL_LUMA_IS_UNCOMPRESSED``
885      - 0x00000010
886      - Set if the Y' (luma) plane is uncompressed.
887    * - ``V4L2_FWHT_FL_CB_IS_UNCOMPRESSED``
888      - 0x00000020
889      - Set if the Cb plane is uncompressed.
890    * - ``V4L2_FWHT_FL_CR_IS_UNCOMPRESSED``
891      - 0x00000040
892      - Set if the Cr plane is uncompressed.
893    * - ``V4L2_FWHT_FL_CHROMA_FULL_HEIGHT``
894      - 0x00000080
895      - Set if the chroma plane has the same height as the luma plane,
896	else the chroma plane is half the height of the luma plane.
897    * - ``V4L2_FWHT_FL_CHROMA_FULL_WIDTH``
898      - 0x00000100
899      - Set if the chroma plane has the same width as the luma plane,
900	else the chroma plane is half the width of the luma plane.
901    * - ``V4L2_FWHT_FL_ALPHA_IS_UNCOMPRESSED``
902      - 0x00000200
903      - Set if the alpha plane is uncompressed.
904    * - ``V4L2_FWHT_FL_I_FRAME``
905      - 0x00000400
906      - Set if this is an I-frame.
907    * - ``V4L2_FWHT_FL_COMPONENTS_NUM_MSK``
908      - 0x00070000
909      - The number of color components minus one.
910    * - ``V4L2_FWHT_FL_PIXENC_MSK``
911      - 0x00180000
912      - The mask for the pixel encoding.
913    * - ``V4L2_FWHT_FL_PIXENC_YUV``
914      - 0x00080000
915      - Set if the pixel encoding is YUV.
916    * - ``V4L2_FWHT_FL_PIXENC_RGB``
917      - 0x00100000
918      - Set if the pixel encoding is RGB.
919    * - ``V4L2_FWHT_FL_PIXENC_HSV``
920      - 0x00180000
921      - Set if the pixel encoding is HSV.
922
923.. raw:: latex
924
925    \normalsize
926
927.. _v4l2-codec-stateless-vp8:
928
929``V4L2_CID_STATELESS_VP8_FRAME (struct)``
930    Specifies the frame parameters for the associated VP8 parsed frame data.
931    This includes the necessary parameters for
932    configuring a stateless hardware decoding pipeline for VP8.
933    The bitstream parameters are defined according to :ref:`vp8`.
934
935.. c:type:: v4l2_ctrl_vp8_frame
936
937.. raw:: latex
938
939    \small
940
941.. tabularcolumns:: |p{7.0cm}|p{4.6cm}|p{5.7cm}|
942
943.. cssclass:: longtable
944
945.. flat-table:: struct v4l2_ctrl_vp8_frame
946    :header-rows:  0
947    :stub-columns: 0
948    :widths:       1 1 2
949
950    * - struct :c:type:`v4l2_vp8_segment`
951      - ``segment``
952      - Structure with segment-based adjustments metadata.
953    * - struct :c:type:`v4l2_vp8_loop_filter`
954      - ``lf``
955      - Structure with loop filter level adjustments metadata.
956    * - struct :c:type:`v4l2_vp8_quantization`
957      - ``quant``
958      - Structure with VP8 dequantization indices metadata.
959    * - struct :c:type:`v4l2_vp8_entropy`
960      - ``entropy``
961      - Structure with VP8 entropy coder probabilities metadata.
962    * - struct :c:type:`v4l2_vp8_entropy_coder_state`
963      - ``coder_state``
964      - Structure with VP8 entropy coder state.
965    * - __u16
966      - ``width``
967      - The width of the frame. Must be set for all frames.
968    * - __u16
969      - ``height``
970      - The height of the frame. Must be set for all frames.
971    * - __u8
972      - ``horizontal_scale``
973      - Horizontal scaling factor.
974    * - __u8
975      - ``vertical_scale``
976      - Vertical scaling factor.
977    * - __u8
978      - ``version``
979      - Bitstream version.
980    * - __u8
981      - ``prob_skip_false``
982      - Indicates the probability that the macroblock is not skipped.
983    * - __u8
984      - ``prob_intra``
985      - Indicates the probability that a macroblock is intra-predicted.
986    * - __u8
987      - ``prob_last``
988      - Indicates the probability that the last reference frame is used
989        for inter-prediction
990    * - __u8
991      - ``prob_gf``
992      - Indicates the probability that the golden reference frame is used
993        for inter-prediction
994    * - __u8
995      - ``num_dct_parts``
996      - Number of DCT coefficients partitions. Must be one of: 1, 2, 4, or 8.
997    * - __u32
998      - ``first_part_size``
999      - Size of the first partition, i.e. the control partition.
1000    * - __u32
1001      - ``first_part_header_bits``
1002      - Size in bits of the first partition header portion.
1003    * - __u32
1004      - ``dct_part_sizes[8]``
1005      - DCT coefficients sizes.
1006    * - __u64
1007      - ``last_frame_ts``
1008      - Timestamp for the V4L2 capture buffer to use as last reference frame, used
1009        with inter-coded frames. The timestamp refers to the ``timestamp`` field in
1010	struct :c:type:`v4l2_buffer`. Use the :c:func:`v4l2_timeval_to_ns()`
1011	function to convert the struct :c:type:`timeval` in struct
1012	:c:type:`v4l2_buffer` to a __u64.
1013    * - __u64
1014      - ``golden_frame_ts``
1015      - Timestamp for the V4L2 capture buffer to use as last reference frame, used
1016        with inter-coded frames. The timestamp refers to the ``timestamp`` field in
1017	struct :c:type:`v4l2_buffer`. Use the :c:func:`v4l2_timeval_to_ns()`
1018	function to convert the struct :c:type:`timeval` in struct
1019	:c:type:`v4l2_buffer` to a __u64.
1020    * - __u64
1021      - ``alt_frame_ts``
1022      - Timestamp for the V4L2 capture buffer to use as alternate reference frame, used
1023        with inter-coded frames. The timestamp refers to the ``timestamp`` field in
1024	struct :c:type:`v4l2_buffer`. Use the :c:func:`v4l2_timeval_to_ns()`
1025	function to convert the struct :c:type:`timeval` in struct
1026	:c:type:`v4l2_buffer` to a __u64.
1027    * - __u64
1028      - ``flags``
1029      - See :ref:`Frame Flags <vp8_frame_flags>`
1030
1031.. raw:: latex
1032
1033    \normalsize
1034
1035.. _vp8_frame_flags:
1036
1037``Frame Flags``
1038
1039.. tabularcolumns:: |p{9.8cm}|p{0.8cm}|p{6.7cm}|
1040
1041.. cssclass:: longtable
1042
1043.. flat-table::
1044    :header-rows:  0
1045    :stub-columns: 0
1046    :widths:       1 1 2
1047
1048    * - ``V4L2_VP8_FRAME_FLAG_KEY_FRAME``
1049      - 0x01
1050      - Indicates if the frame is a key frame.
1051    * - ``V4L2_VP8_FRAME_FLAG_EXPERIMENTAL``
1052      - 0x02
1053      - Experimental bitstream.
1054    * - ``V4L2_VP8_FRAME_FLAG_SHOW_FRAME``
1055      - 0x04
1056      - Show frame flag, indicates if the frame is for display.
1057    * - ``V4L2_VP8_FRAME_FLAG_MB_NO_SKIP_COEFF``
1058      - 0x08
1059      - Enable/disable skipping of macroblocks with no non-zero coefficients.
1060    * - ``V4L2_VP8_FRAME_FLAG_SIGN_BIAS_GOLDEN``
1061      - 0x10
1062      - Sign of motion vectors when the golden frame is referenced.
1063    * - ``V4L2_VP8_FRAME_FLAG_SIGN_BIAS_ALT``
1064      - 0x20
1065      - Sign of motion vectors when the alt frame is referenced.
1066
1067.. c:type:: v4l2_vp8_entropy_coder_state
1068
1069.. cssclass:: longtable
1070
1071.. tabularcolumns:: |p{1.0cm}|p{2.0cm}|p{14.3cm}|
1072
1073.. flat-table:: struct v4l2_vp8_entropy_coder_state
1074    :header-rows:  0
1075    :stub-columns: 0
1076    :widths:       1 1 2
1077
1078    * - __u8
1079      - ``range``
1080      - coder state value for "Range"
1081    * - __u8
1082      - ``value``
1083      - coder state value for "Value"-
1084    * - __u8
1085      - ``bit_count``
1086      - number of bits left.
1087    * - __u8
1088      - ``padding``
1089      - Applications and drivers must set this to zero.
1090
1091.. c:type:: v4l2_vp8_segment
1092
1093.. cssclass:: longtable
1094
1095.. tabularcolumns:: |p{1.2cm}|p{4.0cm}|p{12.1cm}|
1096
1097.. flat-table:: struct v4l2_vp8_segment
1098    :header-rows:  0
1099    :stub-columns: 0
1100    :widths:       1 1 2
1101
1102    * - __s8
1103      - ``quant_update[4]``
1104      - Signed quantizer value update.
1105    * - __s8
1106      - ``lf_update[4]``
1107      - Signed loop filter level value update.
1108    * - __u8
1109      - ``segment_probs[3]``
1110      - Segment probabilities.
1111    * - __u8
1112      - ``padding``
1113      - Applications and drivers must set this to zero.
1114    * - __u32
1115      - ``flags``
1116      - See :ref:`Segment Flags <vp8_segment_flags>`
1117
1118.. _vp8_segment_flags:
1119
1120``Segment Flags``
1121
1122.. raw:: latex
1123
1124    \small
1125
1126.. tabularcolumns:: |p{10cm}|p{1.0cm}|p{6.3cm}|
1127
1128.. flat-table::
1129    :header-rows:  0
1130    :stub-columns: 0
1131    :widths:       1 1 2
1132
1133    * - ``V4L2_VP8_SEGMENT_FLAG_ENABLED``
1134      - 0x01
1135      - Enable/disable segment-based adjustments.
1136    * - ``V4L2_VP8_SEGMENT_FLAG_UPDATE_MAP``
1137      - 0x02
1138      - Indicates if the macroblock segmentation map is updated in this frame.
1139    * - ``V4L2_VP8_SEGMENT_FLAG_UPDATE_FEATURE_DATA``
1140      - 0x04
1141      - Indicates if the segment feature data is updated in this frame.
1142    * - ``V4L2_VP8_SEGMENT_FLAG_DELTA_VALUE_MODE``
1143      - 0x08
1144      - If is set, the segment feature data mode is delta-value.
1145        If cleared, it's absolute-value.
1146
1147.. raw:: latex
1148
1149    \normalsize
1150
1151.. c:type:: v4l2_vp8_loop_filter
1152
1153.. cssclass:: longtable
1154
1155.. tabularcolumns:: |p{1.5cm}|p{3.9cm}|p{11.9cm}|
1156
1157.. flat-table:: struct v4l2_vp8_loop_filter
1158    :header-rows:  0
1159    :stub-columns: 0
1160    :widths:       1 1 2
1161
1162    * - __s8
1163      - ``ref_frm_delta[4]``
1164      - Reference adjustment (signed) delta value.
1165    * - __s8
1166      - ``mb_mode_delta[4]``
1167      - Macroblock prediction mode adjustment (signed) delta value.
1168    * - __u8
1169      - ``sharpness_level``
1170      - Sharpness level
1171    * - __u8
1172      - ``level``
1173      - Filter level
1174    * - __u16
1175      - ``padding``
1176      - Applications and drivers must set this to zero.
1177    * - __u32
1178      - ``flags``
1179      - See :ref:`Loop Filter Flags <vp8_loop_filter_flags>`
1180
1181.. _vp8_loop_filter_flags:
1182
1183``Loop Filter Flags``
1184
1185.. tabularcolumns:: |p{7.0cm}|p{1.2cm}|p{9.1cm}|
1186
1187.. flat-table::
1188    :header-rows:  0
1189    :stub-columns: 0
1190    :widths:       1 1 2
1191
1192    * - ``V4L2_VP8_LF_ADJ_ENABLE``
1193      - 0x01
1194      - Enable/disable macroblock-level loop filter adjustment.
1195    * - ``V4L2_VP8_LF_DELTA_UPDATE``
1196      - 0x02
1197      - Indicates if the delta values used in an adjustment are updated.
1198    * - ``V4L2_VP8_LF_FILTER_TYPE_SIMPLE``
1199      - 0x04
1200      - If set, indicates the filter type is simple.
1201        If cleared, the filter type is normal.
1202
1203.. c:type:: v4l2_vp8_quantization
1204
1205.. tabularcolumns:: |p{1.5cm}|p{3.5cm}|p{12.3cm}|
1206
1207.. flat-table:: struct v4l2_vp8_quantization
1208    :header-rows:  0
1209    :stub-columns: 0
1210    :widths:       1 1 2
1211
1212    * - __u8
1213      - ``y_ac_qi``
1214      - Luma AC coefficient table index.
1215    * - __s8
1216      - ``y_dc_delta``
1217      - Luma DC delta value.
1218    * - __s8
1219      - ``y2_dc_delta``
1220      - Y2 block DC delta value.
1221    * - __s8
1222      - ``y2_ac_delta``
1223      - Y2 block AC delta value.
1224    * - __s8
1225      - ``uv_dc_delta``
1226      - Chroma DC delta value.
1227    * - __s8
1228      - ``uv_ac_delta``
1229      - Chroma AC delta value.
1230    * - __u16
1231      - ``padding``
1232      - Applications and drivers must set this to zero.
1233
1234.. c:type:: v4l2_vp8_entropy
1235
1236.. cssclass:: longtable
1237
1238.. tabularcolumns:: |p{1.5cm}|p{5.8cm}|p{10.0cm}|
1239
1240.. flat-table:: struct v4l2_vp8_entropy
1241    :header-rows:  0
1242    :stub-columns: 0
1243    :widths:       1 1 2
1244
1245    * - __u8
1246      - ``coeff_probs[4][8][3][11]``
1247      - Coefficient update probabilities.
1248    * - __u8
1249      - ``y_mode_probs[4]``
1250      - Luma mode update probabilities.
1251    * - __u8
1252      - ``uv_mode_probs[3]``
1253      - Chroma mode update probabilities.
1254    * - __u8
1255      - ``mv_probs[2][19]``
1256      - MV decoding update probabilities.
1257    * - __u8
1258      - ``padding[3]``
1259      - Applications and drivers must set this to zero.
1260
1261.. _v4l2-codec-stateless-mpeg2:
1262
1263``V4L2_CID_STATELESS_MPEG2_SEQUENCE (struct)``
1264    Specifies the sequence parameters (as extracted from the bitstream) for the
1265    associated MPEG-2 slice data. This includes fields matching the syntax
1266    elements from the sequence header and sequence extension parts of the
1267    bitstream as specified by :ref:`mpeg2part2`.
1268
1269.. c:type:: v4l2_ctrl_mpeg2_sequence
1270
1271.. raw:: latex
1272
1273    \small
1274
1275.. cssclass:: longtable
1276
1277.. tabularcolumns:: |p{1.4cm}|p{6.5cm}|p{9.4cm}|
1278
1279.. flat-table:: struct v4l2_ctrl_mpeg2_sequence
1280    :header-rows:  0
1281    :stub-columns: 0
1282    :widths:       1 1 2
1283
1284    * - __u16
1285      - ``horizontal_size``
1286      - The width of the displayable part of the frame's luminance component.
1287    * - __u16
1288      - ``vertical_size``
1289      - The height of the displayable part of the frame's luminance component.
1290    * - __u32
1291      - ``vbv_buffer_size``
1292      - Used to calculate the required size of the video buffering verifier,
1293	defined (in bits) as: 16 * 1024 * vbv_buffer_size.
1294    * - __u16
1295      - ``profile_and_level_indication``
1296      - The current profile and level indication as extracted from the
1297	bitstream.
1298    * - __u8
1299      - ``chroma_format``
1300      - The chrominance sub-sampling format (1: 4:2:0, 2: 4:2:2, 3: 4:4:4).
1301    * - __u8
1302      - ``flags``
1303      - See :ref:`MPEG-2 Sequence Flags <mpeg2_sequence_flags>`.
1304
1305.. _mpeg2_sequence_flags:
1306
1307``MPEG-2 Sequence Flags``
1308
1309.. cssclass:: longtable
1310
1311.. flat-table::
1312    :header-rows:  0
1313    :stub-columns: 0
1314    :widths:       1 1 2
1315
1316    * - ``V4L2_MPEG2_SEQ_FLAG_PROGRESSIVE``
1317      - 0x01
1318      - Indication that all the frames for the sequence are progressive instead
1319	of interlaced.
1320
1321.. raw:: latex
1322
1323    \normalsize
1324
1325``V4L2_CID_STATELESS_MPEG2_PICTURE (struct)``
1326    Specifies the picture parameters (as extracted from the bitstream) for the
1327    associated MPEG-2 slice data. This includes fields matching the syntax
1328    elements from the picture header and picture coding extension parts of the
1329    bitstream as specified by :ref:`mpeg2part2`.
1330
1331.. c:type:: v4l2_ctrl_mpeg2_picture
1332
1333.. raw:: latex
1334
1335    \small
1336
1337.. cssclass:: longtable
1338
1339.. tabularcolumns:: |p{1.0cm}|p{5.6cm}|p{10.7cm}|
1340
1341.. flat-table:: struct v4l2_ctrl_mpeg2_picture
1342    :header-rows:  0
1343    :stub-columns: 0
1344    :widths:       1 1 2
1345
1346    * - __u64
1347      - ``backward_ref_ts``
1348      - Timestamp of the V4L2 capture buffer to use as backward reference, used
1349        with B-coded and P-coded frames. The timestamp refers to the
1350	``timestamp`` field in struct :c:type:`v4l2_buffer`. Use the
1351	:c:func:`v4l2_timeval_to_ns()` function to convert the struct
1352	:c:type:`timeval` in struct :c:type:`v4l2_buffer` to a __u64.
1353    * - __u64
1354      - ``forward_ref_ts``
1355      - Timestamp for the V4L2 capture buffer to use as forward reference, used
1356        with B-coded frames. The timestamp refers to the ``timestamp`` field in
1357	struct :c:type:`v4l2_buffer`. Use the :c:func:`v4l2_timeval_to_ns()`
1358	function to convert the struct :c:type:`timeval` in struct
1359	:c:type:`v4l2_buffer` to a __u64.
1360    * - __u32
1361      - ``flags``
1362      - See :ref:`MPEG-2 Picture Flags <mpeg2_picture_flags>`.
1363    * - __u8
1364      - ``f_code[2][2]``
1365      - Motion vector codes.
1366    * - __u8
1367      - ``picture_coding_type``
1368      - Picture coding type for the frame covered by the current slice
1369	(V4L2_MPEG2_PIC_CODING_TYPE_I, V4L2_MPEG2_PIC_CODING_TYPE_P or
1370	V4L2_MPEG2_PIC_CODING_TYPE_B).
1371    * - __u8
1372      - ``picture_structure``
1373      - Picture structure (1: interlaced top field, 2: interlaced bottom field,
1374	3: progressive frame).
1375    * - __u8
1376      - ``intra_dc_precision``
1377      - Precision of Discrete Cosine transform (0: 8 bits precision,
1378	1: 9 bits precision, 2: 10 bits precision, 3: 11 bits precision).
1379    * - __u8
1380      - ``reserved[5]``
1381      - Applications and drivers must set this to zero.
1382
1383.. _mpeg2_picture_flags:
1384
1385``MPEG-2 Picture Flags``
1386
1387.. cssclass:: longtable
1388
1389.. flat-table::
1390    :header-rows:  0
1391    :stub-columns: 0
1392    :widths:       1 1 2
1393
1394    * - ``V4L2_MPEG2_PIC_FLAG_TOP_FIELD_FIRST``
1395      - 0x00000001
1396      - If set and it's an interlaced stream, top field is output first.
1397    * - ``V4L2_MPEG2_PIC_FLAG_FRAME_PRED_DCT``
1398      - 0x00000002
1399      - If set only frame-DCT and frame prediction are used.
1400    * - ``V4L2_MPEG2_PIC_FLAG_CONCEALMENT_MV``
1401      - 0x00000004
1402      -  If set motion vectors are coded for intra macroblocks.
1403    * - ``V4L2_MPEG2_PIC_FLAG_Q_SCALE_TYPE``
1404      - 0x00000008
1405      - This flag affects the inverse quantization process.
1406    * - ``V4L2_MPEG2_PIC_FLAG_INTRA_VLC``
1407      - 0x00000010
1408      - This flag affects the decoding of transform coefficient data.
1409    * - ``V4L2_MPEG2_PIC_FLAG_ALT_SCAN``
1410      - 0x00000020
1411      - This flag affects the decoding of transform coefficient data.
1412    * - ``V4L2_MPEG2_PIC_FLAG_REPEAT_FIRST``
1413      - 0x00000040
1414      - This flag affects the decoding process of progressive frames.
1415    * - ``V4L2_MPEG2_PIC_FLAG_PROGRESSIVE``
1416      - 0x00000080
1417      - Indicates whether the current frame is progressive.
1418
1419.. raw:: latex
1420
1421    \normalsize
1422
1423``V4L2_CID_STATELESS_MPEG2_QUANTISATION (struct)``
1424    Specifies quantisation matrices, in zigzag scanning order, for the
1425    associated MPEG-2 slice data. This control is initialized by the kernel
1426    to the matrices default values. If a bitstream transmits a user-defined
1427    quantisation matrices load, applications are expected to use this control.
1428    Applications are also expected to set the control loading the default
1429    values, if the quantisation matrices need to be reset, for instance on a
1430    sequence header. This process is specified by section 6.3.7.
1431    "Quant matrix extension" of the specification.
1432
1433.. c:type:: v4l2_ctrl_mpeg2_quantisation
1434
1435.. tabularcolumns:: |p{0.8cm}|p{8.0cm}|p{8.5cm}|
1436
1437.. cssclass:: longtable
1438
1439.. raw:: latex
1440
1441    \small
1442
1443.. flat-table:: struct v4l2_ctrl_mpeg2_quantisation
1444    :header-rows:  0
1445    :stub-columns: 0
1446    :widths:       1 1 2
1447
1448    * - __u8
1449      - ``intra_quantiser_matrix[64]``
1450      - The quantisation matrix coefficients for intra-coded frames, in zigzag
1451	scanning order. It is relevant for both luma and chroma components,
1452	although it can be superseded by the chroma-specific matrix for
1453	non-4:2:0 YUV formats.
1454    * - __u8
1455      - ``non_intra_quantiser_matrix[64]``
1456      - The quantisation matrix coefficients for non-intra-coded frames, in
1457	zigzag scanning order. It is relevant for both luma and chroma
1458	components, although it can be superseded by the chroma-specific matrix
1459	for non-4:2:0 YUV formats.
1460    * - __u8
1461      - ``chroma_intra_quantiser_matrix[64]``
1462      - The quantisation matrix coefficients for the chominance component of
1463	intra-coded frames, in zigzag scanning order. Only relevant for
1464	non-4:2:0 YUV formats.
1465    * - __u8
1466      - ``chroma_non_intra_quantiser_matrix[64]``
1467      - The quantisation matrix coefficients for the chrominance component of
1468	non-intra-coded frames, in zigzag scanning order. Only relevant for
1469	non-4:2:0 YUV formats.
1470
1471.. raw:: latex
1472
1473    \normalsize
1474
1475.. _v4l2-codec-stateless-vp9:
1476
1477``V4L2_CID_STATELESS_VP9_COMPRESSED_HDR (struct)``
1478    Stores VP9 probabilities updates as parsed from the current compressed frame
1479    header. A value of zero in an array element means no update of the relevant
1480    probability. Motion vector-related updates contain a new value or zero. All
1481    other updates contain values translated with inv_map_table[] (see 6.3.5 in
1482    :ref:`vp9`).
1483
1484.. c:type:: v4l2_ctrl_vp9_compressed_hdr
1485
1486.. tabularcolumns:: |p{1cm}|p{4.8cm}|p{11.4cm}|
1487
1488.. cssclass:: longtable
1489
1490.. flat-table:: struct v4l2_ctrl_vp9_compressed_hdr
1491    :header-rows:  0
1492    :stub-columns: 0
1493    :widths:       1 1 2
1494
1495    * - __u8
1496      - ``tx_mode``
1497      - Specifies the TX mode. See :ref:`TX Mode <vp9_tx_mode>` for more details.
1498    * - __u8
1499      - ``tx8[2][1]``
1500      - TX 8x8 probabilities delta.
1501    * - __u8
1502      - ``tx16[2][2]``
1503      - TX 16x16 probabilities delta.
1504    * - __u8
1505      - ``tx32[2][3]``
1506      - TX 32x32 probabilities delta.
1507    * - __u8
1508      - ``coef[4][2][2][6][6][3]``
1509      - Coefficient probabilities delta.
1510    * - __u8
1511      - ``skip[3]``
1512      - Skip probabilities delta.
1513    * - __u8
1514      - ``inter_mode[7][3]``
1515      - Inter prediction mode probabilities delta.
1516    * - __u8
1517      - ``interp_filter[4][2]``
1518      - Interpolation filter probabilities delta.
1519    * - __u8
1520      - ``is_inter[4]``
1521      - Is inter-block probabilities delta.
1522    * - __u8
1523      - ``comp_mode[5]``
1524      - Compound prediction mode probabilities delta.
1525    * - __u8
1526      - ``single_ref[5][2]``
1527      - Single reference probabilities delta.
1528    * - __u8
1529      - ``comp_ref[5]``
1530      - Compound reference probabilities delta.
1531    * - __u8
1532      - ``y_mode[4][9]``
1533      - Y prediction mode probabilities delta.
1534    * - __u8
1535      - ``uv_mode[10][9]``
1536      - UV prediction mode probabilities delta.
1537    * - __u8
1538      - ``partition[16][3]``
1539      - Partition probabilities delta.
1540    * - __u8
1541      - ``mv.joint[3]``
1542      - Motion vector joint probabilities delta.
1543    * - __u8
1544      - ``mv.sign[2]``
1545      - Motion vector sign probabilities delta.
1546    * - __u8
1547      - ``mv.classes[2][10]``
1548      - Motion vector class probabilities delta.
1549    * - __u8
1550      - ``mv.class0_bit[2]``
1551      - Motion vector class0 bit probabilities delta.
1552    * - __u8
1553      - ``mv.bits[2][10]``
1554      - Motion vector bits probabilities delta.
1555    * - __u8
1556      - ``mv.class0_fr[2][2][3]``
1557      - Motion vector class0 fractional bit probabilities delta.
1558    * - __u8
1559      - ``mv.fr[2][3]``
1560      - Motion vector fractional bit probabilities delta.
1561    * - __u8
1562      - ``mv.class0_hp[2]``
1563      - Motion vector class0 high precision fractional bit probabilities delta.
1564    * - __u8
1565      - ``mv.hp[2]``
1566      - Motion vector high precision fractional bit probabilities delta.
1567
1568.. _vp9_tx_mode:
1569
1570``TX Mode``
1571
1572.. tabularcolumns:: |p{6.5cm}|p{0.5cm}|p{10.3cm}|
1573
1574.. flat-table::
1575    :header-rows:  0
1576    :stub-columns: 0
1577    :widths:       1 1 2
1578
1579    * - ``V4L2_VP9_TX_MODE_ONLY_4X4``
1580      - 0
1581      - Transform size is 4x4.
1582    * - ``V4L2_VP9_TX_MODE_ALLOW_8X8``
1583      - 1
1584      - Transform size can be up to 8x8.
1585    * - ``V4L2_VP9_TX_MODE_ALLOW_16X16``
1586      - 2
1587      - Transform size can be up to 16x16.
1588    * - ``V4L2_VP9_TX_MODE_ALLOW_32X32``
1589      - 3
1590      - transform size can be up to 32x32.
1591    * - ``V4L2_VP9_TX_MODE_SELECT``
1592      - 4
1593      - Bitstream contains the transform size for each block.
1594
1595See section '7.3.1 Tx mode semantics' of the :ref:`vp9` specification for more details.
1596
1597``V4L2_CID_STATELESS_VP9_FRAME (struct)``
1598    Specifies the frame parameters for the associated VP9 frame decode request.
1599    This includes the necessary parameters for configuring a stateless hardware
1600    decoding pipeline for VP9. The bitstream parameters are defined according
1601    to :ref:`vp9`.
1602
1603.. c:type:: v4l2_ctrl_vp9_frame
1604
1605.. raw:: latex
1606
1607    \small
1608
1609.. tabularcolumns:: |p{4.7cm}|p{5.5cm}|p{7.1cm}|
1610
1611.. cssclass:: longtable
1612
1613.. flat-table:: struct v4l2_ctrl_vp9_frame
1614    :header-rows:  0
1615    :stub-columns: 0
1616    :widths:       1 1 2
1617
1618    * - struct :c:type:`v4l2_vp9_loop_filter`
1619      - ``lf``
1620      - Loop filter parameters. See struct :c:type:`v4l2_vp9_loop_filter` for more details.
1621    * - struct :c:type:`v4l2_vp9_quantization`
1622      - ``quant``
1623      - Quantization parameters. See :c:type:`v4l2_vp9_quantization` for more details.
1624    * - struct :c:type:`v4l2_vp9_segmentation`
1625      - ``seg``
1626      - Segmentation parameters. See :c:type:`v4l2_vp9_segmentation` for more details.
1627    * - __u32
1628      - ``flags``
1629      - Combination of V4L2_VP9_FRAME_FLAG_* flags. See :ref:`Frame Flags<vp9_frame_flags>`.
1630    * - __u16
1631      - ``compressed_header_size``
1632      - Compressed header size in bytes.
1633    * - __u16
1634      - ``uncompressed_header_size``
1635      - Uncompressed header size in bytes.
1636    * - __u16
1637      - ``frame_width_minus_1``
1638      - Add 1 to get the frame width expressed in pixels. See section 7.2.3 in :ref:`vp9`.
1639    * - __u16
1640      - ``frame_height_minus_1``
1641      - Add 1 to get the frame height expressed in pixels. See section 7.2.3 in :ref:`vp9`.
1642    * - __u16
1643      - ``render_width_minus_1``
1644      - Add 1 to get the expected render width expressed in pixels. This is
1645        not used during the decoding process but might be used by HW scalers to
1646        prepare a frame that's ready for scanout. See section 7.2.4 in :ref:`vp9`.
1647    * - __u16
1648      - render_height_minus_1
1649      - Add 1 to get the expected render height expressed in pixels. This is
1650        not used during the decoding process but might be used by HW scalers to
1651        prepare a frame that's ready for scanout. See section 7.2.4 in :ref:`vp9`.
1652    * - __u64
1653      - ``last_frame_ts``
1654      - "last" reference buffer timestamp.
1655	The timestamp refers to the ``timestamp`` field in
1656        struct :c:type:`v4l2_buffer`. Use the :c:func:`v4l2_timeval_to_ns()`
1657        function to convert the struct :c:type:`timeval` in struct
1658        :c:type:`v4l2_buffer` to a __u64.
1659    * - __u64
1660      - ``golden_frame_ts``
1661      - "golden" reference buffer timestamp.
1662	The timestamp refers to the ``timestamp`` field in
1663        struct :c:type:`v4l2_buffer`. Use the :c:func:`v4l2_timeval_to_ns()`
1664        function to convert the struct :c:type:`timeval` in struct
1665        :c:type:`v4l2_buffer` to a __u64.
1666    * - __u64
1667      - ``alt_frame_ts``
1668      - "alt" reference buffer timestamp.
1669	The timestamp refers to the ``timestamp`` field in
1670        struct :c:type:`v4l2_buffer`. Use the :c:func:`v4l2_timeval_to_ns()`
1671        function to convert the struct :c:type:`timeval` in struct
1672        :c:type:`v4l2_buffer` to a __u64.
1673    * - __u8
1674      - ``ref_frame_sign_bias``
1675      - a bitfield specifying whether the sign bias is set for a given
1676        reference frame. See :ref:`Reference Frame Sign Bias<vp9_ref_frame_sign_bias>`
1677        for more details.
1678    * - __u8
1679      - ``reset_frame_context``
1680      - specifies whether the frame context should be reset to default values. See
1681        :ref:`Reset Frame Context<vp9_reset_frame_context>` for more details.
1682    * - __u8
1683      - ``frame_context_idx``
1684      - Frame context that should be used/updated.
1685    * - __u8
1686      - ``profile``
1687      - VP9 profile. Can be 0, 1, 2 or 3.
1688    * - __u8
1689      - ``bit_depth``
1690      - Component depth in bits. Can be 8, 10 or 12. Note that not all profiles
1691        support 10 and/or 12 bits depths.
1692    * - __u8
1693      - ``interpolation_filter``
1694      - Specifies the filter selection used for performing inter prediction. See
1695        :ref:`Interpolation Filter<vp9_interpolation_filter>` for more details.
1696    * - __u8
1697      - ``tile_cols_log2``
1698      - Specifies the base 2 logarithm of the width of each tile (where the
1699        width is measured in units of 8x8 blocks). Shall be less than or equal
1700        to 6.
1701    * - __u8
1702      - ``tile_rows_log2``
1703      - Specifies the base 2 logarithm of the height of each tile (where the
1704        height is measured in units of 8x8 blocks).
1705    * - __u8
1706      - ``reference_mode``
1707      - Specifies the type of inter prediction to be used. See
1708        :ref:`Reference Mode<vp9_reference_mode>` for more details. Note that
1709	this is derived as part of the compressed header parsing process and
1710	for this reason should have been part of
1711	:c:type: `v4l2_ctrl_vp9_compressed_hdr` optional control. It is safe to
1712	set this value to zero if the driver does not require compressed
1713	headers.
1714    * - __u8
1715      - ``reserved[7]``
1716      - Applications and drivers must set this to zero.
1717
1718.. raw:: latex
1719
1720    \normalsize
1721
1722.. _vp9_frame_flags:
1723
1724``Frame Flags``
1725
1726.. tabularcolumns:: |p{10.0cm}|p{1.2cm}|p{6.1cm}|
1727
1728.. flat-table::
1729    :header-rows:  0
1730    :stub-columns: 0
1731    :widths:       1 1 2
1732
1733    * - ``V4L2_VP9_FRAME_FLAG_KEY_FRAME``
1734      - 0x001
1735      - The frame is a key frame.
1736    * - ``V4L2_VP9_FRAME_FLAG_SHOW_FRAME``
1737      - 0x002
1738      - The frame should be displayed.
1739    * - ``V4L2_VP9_FRAME_FLAG_ERROR_RESILIENT``
1740      - 0x004
1741      - The decoding should be error resilient.
1742    * - ``V4L2_VP9_FRAME_FLAG_INTRA_ONLY``
1743      - 0x008
1744      - The frame does not reference other frames.
1745    * - ``V4L2_VP9_FRAME_FLAG_ALLOW_HIGH_PREC_MV``
1746      - 0x010
1747      - The frame can use high precision motion vectors.
1748    * - ``V4L2_VP9_FRAME_FLAG_REFRESH_FRAME_CTX``
1749      - 0x020
1750      - Frame context should be updated after decoding.
1751    * - ``V4L2_VP9_FRAME_FLAG_PARALLEL_DEC_MODE``
1752      - 0x040
1753      - Parallel decoding is used.
1754    * - ``V4L2_VP9_FRAME_FLAG_X_SUBSAMPLING``
1755      - 0x080
1756      - Vertical subsampling is enabled.
1757    * - ``V4L2_VP9_FRAME_FLAG_Y_SUBSAMPLING``
1758      - 0x100
1759      - Horizontal subsampling is enabled.
1760    * - ``V4L2_VP9_FRAME_FLAG_COLOR_RANGE_FULL_SWING``
1761      - 0x200
1762      - The full UV range is used.
1763
1764.. _vp9_ref_frame_sign_bias:
1765
1766``Reference Frame Sign Bias``
1767
1768.. tabularcolumns:: |p{7.0cm}|p{1.2cm}|p{9.1cm}|
1769
1770.. flat-table::
1771    :header-rows:  0
1772    :stub-columns: 0
1773    :widths:       1 1 2
1774
1775    * - ``V4L2_VP9_SIGN_BIAS_LAST``
1776      - 0x1
1777      - Sign bias is set for the last reference frame.
1778    * - ``V4L2_VP9_SIGN_BIAS_GOLDEN``
1779      - 0x2
1780      - Sign bias is set for the golden reference frame.
1781    * - ``V4L2_VP9_SIGN_BIAS_ALT``
1782      - 0x2
1783      - Sign bias is set for the alt reference frame.
1784
1785.. _vp9_reset_frame_context:
1786
1787``Reset Frame Context``
1788
1789.. tabularcolumns:: |p{7.0cm}|p{1.2cm}|p{9.1cm}|
1790
1791.. flat-table::
1792    :header-rows:  0
1793    :stub-columns: 0
1794    :widths:       1 1 2
1795
1796    * - ``V4L2_VP9_RESET_FRAME_CTX_NONE``
1797      - 0
1798      - Do not reset any frame context.
1799    * - ``V4L2_VP9_RESET_FRAME_CTX_SPEC``
1800      - 1
1801      - Reset the frame context pointed to by
1802        :c:type:`v4l2_ctrl_vp9_frame`.frame_context_idx.
1803    * - ``V4L2_VP9_RESET_FRAME_CTX_ALL``
1804      - 2
1805      - Reset all frame contexts.
1806
1807See section '7.2 Uncompressed header semantics' of the :ref:`vp9` specification
1808for more details.
1809
1810.. _vp9_interpolation_filter:
1811
1812``Interpolation Filter``
1813
1814.. tabularcolumns:: |p{9.0cm}|p{1.2cm}|p{7.1cm}|
1815
1816.. flat-table::
1817    :header-rows:  0
1818    :stub-columns: 0
1819    :widths:       1 1 2
1820
1821    * - ``V4L2_VP9_INTERP_FILTER_EIGHTTAP``
1822      - 0
1823      - Eight tap filter.
1824    * - ``V4L2_VP9_INTERP_FILTER_EIGHTTAP_SMOOTH``
1825      - 1
1826      - Eight tap smooth filter.
1827    * - ``V4L2_VP9_INTERP_FILTER_EIGHTTAP_SHARP``
1828      - 2
1829      - Eeight tap sharp filter.
1830    * - ``V4L2_VP9_INTERP_FILTER_BILINEAR``
1831      - 3
1832      - Bilinear filter.
1833    * - ``V4L2_VP9_INTERP_FILTER_SWITCHABLE``
1834      - 4
1835      - Filter selection is signaled at the block level.
1836
1837See section '7.2.7 Interpolation filter semantics' of the :ref:`vp9` specification
1838for more details.
1839
1840.. _vp9_reference_mode:
1841
1842``Reference Mode``
1843
1844.. tabularcolumns:: |p{9.6cm}|p{0.5cm}|p{7.2cm}|
1845
1846.. flat-table::
1847    :header-rows:  0
1848    :stub-columns: 0
1849    :widths:       1 1 2
1850
1851    * - ``V4L2_VP9_REFERENCE_MODE_SINGLE_REFERENCE``
1852      - 0
1853      - Indicates that all the inter blocks use only a single reference frame
1854        to generate motion compensated prediction.
1855    * - ``V4L2_VP9_REFERENCE_MODE_COMPOUND_REFERENCE``
1856      - 1
1857      - Requires all the inter blocks to use compound mode. Single reference
1858        frame prediction is not allowed.
1859    * - ``V4L2_VP9_REFERENCE_MODE_SELECT``
1860      - 2
1861      - Allows each individual inter block to select between single and
1862        compound prediction modes.
1863
1864See section '7.3.6 Frame reference mode semantics' of the :ref:`vp9` specification for more details.
1865
1866.. c:type:: v4l2_vp9_segmentation
1867
1868Encodes the quantization parameters. See section '7.2.10 Segmentation
1869params syntax' of the :ref:`vp9` specification for more details.
1870
1871.. tabularcolumns:: |p{0.8cm}|p{5cm}|p{11.4cm}|
1872
1873.. cssclass:: longtable
1874
1875.. flat-table:: struct v4l2_vp9_segmentation
1876    :header-rows:  0
1877    :stub-columns: 0
1878    :widths:       1 1 2
1879
1880    * - __u8
1881      - ``feature_data[8][4]``
1882      - Data attached to each feature. Data entry is only valid if the feature
1883        is enabled. The array shall be indexed with segment number as the first dimension
1884        (0..7) and one of V4L2_VP9_SEG_* as the second dimension.
1885        See :ref:`Segment Feature IDs<vp9_segment_feature>`.
1886    * - __u8
1887      - ``feature_enabled[8]``
1888      - Bitmask defining which features are enabled in each segment. The value for each
1889        segment is a combination of V4L2_VP9_SEGMENT_FEATURE_ENABLED(id) values where id is
1890        one of V4L2_VP9_SEG_*. See :ref:`Segment Feature IDs<vp9_segment_feature>`.
1891    * - __u8
1892      - ``tree_probs[7]``
1893      - Specifies the probability values to be used when decoding a Segment-ID.
1894        See '5.15 Segmentation map' section of :ref:`vp9` for more details.
1895    * - __u8
1896      - ``pred_probs[3]``
1897      - Specifies the probability values to be used when decoding a
1898        Predicted-Segment-ID. See '6.4.14 Get segment id syntax'
1899        section of :ref:`vp9` for more details.
1900    * - __u8
1901      - ``flags``
1902      - Combination of V4L2_VP9_SEGMENTATION_FLAG_* flags. See
1903        :ref:`Segmentation Flags<vp9_segmentation_flags>`.
1904    * - __u8
1905      - ``reserved[5]``
1906      - Applications and drivers must set this to zero.
1907
1908.. _vp9_segment_feature:
1909
1910``Segment feature IDs``
1911
1912.. tabularcolumns:: |p{6.0cm}|p{1cm}|p{10.3cm}|
1913
1914.. flat-table::
1915    :header-rows:  0
1916    :stub-columns: 0
1917    :widths:       1 1 2
1918
1919    * - ``V4L2_VP9_SEG_LVL_ALT_Q``
1920      - 0
1921      - Quantizer segment feature.
1922    * - ``V4L2_VP9_SEG_LVL_ALT_L``
1923      - 1
1924      - Loop filter segment feature.
1925    * - ``V4L2_VP9_SEG_LVL_REF_FRAME``
1926      - 2
1927      - Reference frame segment feature.
1928    * - ``V4L2_VP9_SEG_LVL_SKIP``
1929      - 3
1930      - Skip segment feature.
1931    * - ``V4L2_VP9_SEG_LVL_MAX``
1932      - 4
1933      - Number of segment features.
1934
1935.. _vp9_segmentation_flags:
1936
1937``Segmentation Flags``
1938
1939.. tabularcolumns:: |p{10.6cm}|p{0.8cm}|p{5.9cm}|
1940
1941.. flat-table::
1942    :header-rows:  0
1943    :stub-columns: 0
1944    :widths:       1 1 2
1945
1946    * - ``V4L2_VP9_SEGMENTATION_FLAG_ENABLED``
1947      - 0x01
1948      - Indicates that this frame makes use of the segmentation tool.
1949    * - ``V4L2_VP9_SEGMENTATION_FLAG_UPDATE_MAP``
1950      - 0x02
1951      - Indicates that the segmentation map should be updated during the
1952        decoding of this frame.
1953    * - ``V4L2_VP9_SEGMENTATION_FLAG_TEMPORAL_UPDATE``
1954      - 0x04
1955      - Indicates that the updates to the segmentation map are coded
1956        relative to the existing segmentation map.
1957    * - ``V4L2_VP9_SEGMENTATION_FLAG_UPDATE_DATA``
1958      - 0x08
1959      - Indicates that new parameters are about to be specified for each
1960        segment.
1961    * - ``V4L2_VP9_SEGMENTATION_FLAG_ABS_OR_DELTA_UPDATE``
1962      - 0x10
1963      - Indicates that the segmentation parameters represent the actual values
1964        to be used.
1965
1966.. c:type:: v4l2_vp9_quantization
1967
1968Encodes the quantization parameters. See section '7.2.9 Quantization params
1969syntax' of the VP9 specification for more details.
1970
1971.. tabularcolumns:: |p{0.8cm}|p{4cm}|p{12.4cm}|
1972
1973.. cssclass:: longtable
1974
1975.. flat-table:: struct v4l2_vp9_quantization
1976    :header-rows:  0
1977    :stub-columns: 0
1978    :widths:       1 1 2
1979
1980    * - __u8
1981      - ``base_q_idx``
1982      - Indicates the base frame qindex.
1983    * - __s8
1984      - ``delta_q_y_dc``
1985      - Indicates the Y DC quantizer relative to base_q_idx.
1986    * - __s8
1987      - ``delta_q_uv_dc``
1988      - Indicates the UV DC quantizer relative to base_q_idx.
1989    * - __s8
1990      - ``delta_q_uv_ac``
1991      - Indicates the UV AC quantizer relative to base_q_idx.
1992    * - __u8
1993      - ``reserved[4]``
1994      - Applications and drivers must set this to zero.
1995
1996.. c:type:: v4l2_vp9_loop_filter
1997
1998This structure contains all loop filter related parameters. See sections
1999'7.2.8 Loop filter semantics' of the :ref:`vp9` specification for more details.
2000
2001.. tabularcolumns:: |p{0.8cm}|p{4cm}|p{12.4cm}|
2002
2003.. cssclass:: longtable
2004
2005.. flat-table:: struct v4l2_vp9_loop_filter
2006    :header-rows:  0
2007    :stub-columns: 0
2008    :widths:       1 1 2
2009
2010    * - __s8
2011      - ``ref_deltas[4]``
2012      - Contains the adjustment needed for the filter level based on the chosen
2013        reference frame.
2014    * - __s8
2015      - ``mode_deltas[2]``
2016      - Contains the adjustment needed for the filter level based on the chosen
2017        mode.
2018    * - __u8
2019      - ``level``
2020      - Indicates the loop filter strength.
2021    * - __u8
2022      - ``sharpness``
2023      - Indicates the sharpness level.
2024    * - __u8
2025      - ``flags``
2026      - Combination of V4L2_VP9_LOOP_FILTER_FLAG_* flags.
2027        See :ref:`Loop Filter Flags <vp9_loop_filter_flags>`.
2028    * - __u8
2029      - ``reserved[7]``
2030      - Applications and drivers must set this to zero.
2031
2032
2033.. _vp9_loop_filter_flags:
2034
2035``Loop Filter Flags``
2036
2037.. tabularcolumns:: |p{9.6cm}|p{0.5cm}|p{7.2cm}|
2038
2039.. flat-table::
2040    :header-rows:  0
2041    :stub-columns: 0
2042    :widths:       1 1 2
2043
2044    * - ``V4L2_VP9_LOOP_FILTER_FLAG_DELTA_ENABLED``
2045      - 0x1
2046      - When set, the filter level depends on the mode and reference frame used
2047        to predict a block.
2048    * - ``V4L2_VP9_LOOP_FILTER_FLAG_DELTA_UPDATE``
2049      - 0x2
2050      - When set, the bitstream contains additional syntax elements that
2051        specify which mode and reference frame deltas are to be updated.
2052
2053.. _v4l2-codec-stateless-hevc:
2054
2055``V4L2_CID_STATELESS_HEVC_SPS (struct)``
2056    Specifies the Sequence Parameter Set fields (as extracted from the
2057    bitstream) for the associated HEVC slice data.
2058    These bitstream parameters are defined according to :ref:`hevc`.
2059    They are described in section 7.4.3.2 "Sequence parameter set RBSP
2060    semantics" of the specification.
2061
2062.. c:type:: v4l2_ctrl_hevc_sps
2063
2064.. raw:: latex
2065
2066    \small
2067
2068.. tabularcolumns:: |p{1.2cm}|p{9.2cm}|p{6.9cm}|
2069
2070.. cssclass:: longtable
2071
2072.. flat-table:: struct v4l2_ctrl_hevc_sps
2073    :header-rows:  0
2074    :stub-columns: 0
2075    :widths:       1 1 2
2076
2077    * - __u8
2078      - ``video_parameter_set_id``
2079      - Specifies the value of the vps_video_parameter_set_id of the active VPS
2080        as described in section "7.4.3.2.1 General sequence parameter set RBSP semantics"
2081        of H.265 specifications.
2082    * - __u8
2083      - ``seq_parameter_set_id``
2084      - Provides an identifier for the SPS for reference by other syntax elements
2085        as described in section "7.4.3.2.1 General sequence parameter set RBSP semantics"
2086        of H.265 specifications.
2087    * - __u16
2088      - ``pic_width_in_luma_samples``
2089      - Specifies the width of each decoded picture in units of luma samples.
2090    * - __u16
2091      - ``pic_height_in_luma_samples``
2092      - Specifies the height of each decoded picture in units of luma samples.
2093    * - __u8
2094      - ``bit_depth_luma_minus8``
2095      - This value plus 8 specifies the bit depth of the samples of the luma array.
2096    * - __u8
2097      - ``bit_depth_chroma_minus8``
2098      - This value plus 8 specifies the bit depth of the samples of the chroma arrays.
2099    * - __u8
2100      - ``log2_max_pic_order_cnt_lsb_minus4``
2101      - Specifies the value of the variable MaxPicOrderCntLsb.
2102    * - __u8
2103      - ``sps_max_dec_pic_buffering_minus1``
2104      - This value plus 1 specifies the maximum required size of the decoded picture buffer for
2105        the coded video sequence (CVS).
2106    * - __u8
2107      - ``sps_max_num_reorder_pics``
2108      - Indicates the maximum allowed number of pictures.
2109    * - __u8
2110      - ``sps_max_latency_increase_plus1``
2111      - Used to signal MaxLatencyPictures, which indicates the maximum number of
2112        pictures that can precede any picture in output order and follow that
2113        picture in decoding order.
2114    * - __u8
2115      - ``log2_min_luma_coding_block_size_minus3``
2116      - This value plus 3 specifies the minimum luma coding block size.
2117    * - __u8
2118      - ``log2_diff_max_min_luma_coding_block_size``
2119      - Specifies the difference between the maximum and minimum luma coding block size.
2120    * - __u8
2121      - ``log2_min_luma_transform_block_size_minus2``
2122      - This value plus 2 specifies the minimum luma transform block size.
2123    * - __u8
2124      - ``log2_diff_max_min_luma_transform_block_size``
2125      - Specifies the difference between the maximum and minimum luma transform block size.
2126    * - __u8
2127      - ``max_transform_hierarchy_depth_inter``
2128      - Specifies the maximum hierarchy depth for transform units of coding units coded
2129        in inter prediction mode.
2130    * - __u8
2131      - ``max_transform_hierarchy_depth_intra``
2132      - Specifies the maximum hierarchy depth for transform units of coding units coded in
2133        intra prediction mode.
2134    * - __u8
2135      - ``pcm_sample_bit_depth_luma_minus1``
2136      - This value plus 1 specifies the number of bits used to represent each of PCM sample values of the
2137        luma component.
2138    * - __u8
2139      - ``pcm_sample_bit_depth_chroma_minus1``
2140      - Specifies the number of bits used to represent each of PCM sample values of
2141        the chroma components.
2142    * - __u8
2143      - ``log2_min_pcm_luma_coding_block_size_minus3``
2144      - Plus 3 specifies the minimum size of coding blocks.
2145    * - __u8
2146      - ``log2_diff_max_min_pcm_luma_coding_block_size``
2147      - Specifies the difference between the maximum and minimum size of coding blocks.
2148    * - __u8
2149      - ``num_short_term_ref_pic_sets``
2150      - Specifies the number of st_ref_pic_set() syntax structures included in the SPS.
2151    * - __u8
2152      - ``num_long_term_ref_pics_sps``
2153      - Specifies the number of candidate long-term reference pictures that are
2154        specified in the SPS.
2155    * - __u8
2156      - ``chroma_format_idc``
2157      - Specifies the chroma sampling.
2158    * - __u8
2159      - ``sps_max_sub_layers_minus1``
2160      - This value plus 1 specifies the maximum number of temporal sub-layers.
2161    * - __u64
2162      - ``flags``
2163      - See :ref:`Sequence Parameter Set Flags <hevc_sps_flags>`
2164
2165.. raw:: latex
2166
2167    \normalsize
2168
2169.. _hevc_sps_flags:
2170
2171``Sequence Parameter Set Flags``
2172
2173.. raw:: latex
2174
2175    \small
2176
2177.. cssclass:: longtable
2178
2179.. flat-table::
2180    :header-rows:  0
2181    :stub-columns: 0
2182    :widths:       1 1 2
2183
2184    * - ``V4L2_HEVC_SPS_FLAG_SEPARATE_COLOUR_PLANE``
2185      - 0x00000001
2186      -
2187    * - ``V4L2_HEVC_SPS_FLAG_SCALING_LIST_ENABLED``
2188      - 0x00000002
2189      -
2190    * - ``V4L2_HEVC_SPS_FLAG_AMP_ENABLED``
2191      - 0x00000004
2192      -
2193    * - ``V4L2_HEVC_SPS_FLAG_SAMPLE_ADAPTIVE_OFFSET``
2194      - 0x00000008
2195      -
2196    * - ``V4L2_HEVC_SPS_FLAG_PCM_ENABLED``
2197      - 0x00000010
2198      -
2199    * - ``V4L2_HEVC_SPS_FLAG_PCM_LOOP_FILTER_DISABLED``
2200      - 0x00000020
2201      -
2202    * - ``V4L2_HEVC_SPS_FLAG_LONG_TERM_REF_PICS_PRESENT``
2203      - 0x00000040
2204      -
2205    * - ``V4L2_HEVC_SPS_FLAG_SPS_TEMPORAL_MVP_ENABLED``
2206      - 0x00000080
2207      -
2208    * - ``V4L2_HEVC_SPS_FLAG_STRONG_INTRA_SMOOTHING_ENABLED``
2209      - 0x00000100
2210      -
2211
2212.. raw:: latex
2213
2214    \normalsize
2215
2216``V4L2_CID_STATELESS_HEVC_PPS (struct)``
2217    Specifies the Picture Parameter Set fields (as extracted from the
2218    bitstream) for the associated HEVC slice data.
2219    These bitstream parameters are defined according to :ref:`hevc`.
2220    They are described in section 7.4.3.3 "Picture parameter set RBSP
2221    semantics" of the specification.
2222
2223.. c:type:: v4l2_ctrl_hevc_pps
2224
2225.. tabularcolumns:: |p{1.2cm}|p{8.6cm}|p{7.5cm}|
2226
2227.. cssclass:: longtable
2228
2229.. flat-table:: struct v4l2_ctrl_hevc_pps
2230    :header-rows:  0
2231    :stub-columns: 0
2232    :widths:       1 1 2
2233
2234    * - __u8
2235      - ``pic_parameter_set_id``
2236      - Identifies the PPS for reference by other syntax elements.
2237    * - __u8
2238      - ``num_extra_slice_header_bits``
2239      - Specifies the number of extra slice header bits that are present
2240        in the slice header RBSP for coded pictures referring to the PPS.
2241    * - __u8
2242      - ``num_ref_idx_l0_default_active_minus1``
2243      - This value plus 1 specifies the inferred value of num_ref_idx_l0_active_minus1.
2244    * - __u8
2245      - ``num_ref_idx_l1_default_active_minus1``
2246      - This value plus 1 specifies the inferred value of num_ref_idx_l1_active_minus1.
2247    * - __s8
2248      - ``init_qp_minus26``
2249      - This value plus 26 specifies the initial value of SliceQp Y for each slice
2250        referring to the PPS.
2251    * - __u8
2252      - ``diff_cu_qp_delta_depth``
2253      - Specifies the difference between the luma coding tree block size
2254        and the minimum luma coding block size of coding units that
2255        convey cu_qp_delta_abs and cu_qp_delta_sign_flag.
2256    * - __s8
2257      - ``pps_cb_qp_offset``
2258      - Specifies the offsets to the luma quantization parameter Cb.
2259    * - __s8
2260      - ``pps_cr_qp_offset``
2261      - Specifies the offsets to the luma quantization parameter Cr.
2262    * - __u8
2263      - ``num_tile_columns_minus1``
2264      - This value plus 1 specifies the number of tile columns partitioning the picture.
2265    * - __u8
2266      - ``num_tile_rows_minus1``
2267      - This value plus 1 specifies the number of tile rows partitioning the picture.
2268    * - __u8
2269      - ``column_width_minus1[20]``
2270      - This value plus 1 specifies the width of the i-th tile column in units of
2271        coding tree blocks.
2272    * - __u8
2273      - ``row_height_minus1[22]``
2274      - This value plus 1 specifies the height of the i-th tile row in units of coding
2275        tree blocks.
2276    * - __s8
2277      - ``pps_beta_offset_div2``
2278      - Specifies the default deblocking parameter offsets for beta divided by 2.
2279    * - __s8
2280      - ``pps_tc_offset_div2``
2281      - Specifies the default deblocking parameter offsets for tC divided by 2.
2282    * - __u8
2283      - ``log2_parallel_merge_level_minus2``
2284      - This value plus 2 specifies the value of the variable Log2ParMrgLevel.
2285    * - __u8
2286      - ``padding[4]``
2287      - Applications and drivers must set this to zero.
2288    * - __u64
2289      - ``flags``
2290      - See :ref:`Picture Parameter Set Flags <hevc_pps_flags>`
2291
2292.. _hevc_pps_flags:
2293
2294``Picture Parameter Set Flags``
2295
2296.. raw:: latex
2297
2298    \small
2299
2300.. flat-table::
2301    :header-rows:  0
2302    :stub-columns: 0
2303    :widths:       1 1 2
2304
2305    * - ``V4L2_HEVC_PPS_FLAG_DEPENDENT_SLICE_SEGMENT_ENABLED``
2306      - 0x00000001
2307      -
2308    * - ``V4L2_HEVC_PPS_FLAG_OUTPUT_FLAG_PRESENT``
2309      - 0x00000002
2310      -
2311    * - ``V4L2_HEVC_PPS_FLAG_SIGN_DATA_HIDING_ENABLED``
2312      - 0x00000004
2313      -
2314    * - ``V4L2_HEVC_PPS_FLAG_CABAC_INIT_PRESENT``
2315      - 0x00000008
2316      -
2317    * - ``V4L2_HEVC_PPS_FLAG_CONSTRAINED_INTRA_PRED``
2318      - 0x00000010
2319      -
2320    * - ``V4L2_HEVC_PPS_FLAG_TRANSFORM_SKIP_ENABLED``
2321      - 0x00000020
2322      -
2323    * - ``V4L2_HEVC_PPS_FLAG_CU_QP_DELTA_ENABLED``
2324      - 0x00000040
2325      -
2326    * - ``V4L2_HEVC_PPS_FLAG_PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT``
2327      - 0x00000080
2328      -
2329    * - ``V4L2_HEVC_PPS_FLAG_WEIGHTED_PRED``
2330      - 0x00000100
2331      -
2332    * - ``V4L2_HEVC_PPS_FLAG_WEIGHTED_BIPRED``
2333      - 0x00000200
2334      -
2335    * - ``V4L2_HEVC_PPS_FLAG_TRANSQUANT_BYPASS_ENABLED``
2336      - 0x00000400
2337      -
2338    * - ``V4L2_HEVC_PPS_FLAG_TILES_ENABLED``
2339      - 0x00000800
2340      -
2341    * - ``V4L2_HEVC_PPS_FLAG_ENTROPY_CODING_SYNC_ENABLED``
2342      - 0x00001000
2343      -
2344    * - ``V4L2_HEVC_PPS_FLAG_LOOP_FILTER_ACROSS_TILES_ENABLED``
2345      - 0x00002000
2346      -
2347    * - ``V4L2_HEVC_PPS_FLAG_PPS_LOOP_FILTER_ACROSS_SLICES_ENABLED``
2348      - 0x00004000
2349      -
2350    * - ``V4L2_HEVC_PPS_FLAG_DEBLOCKING_FILTER_OVERRIDE_ENABLED``
2351      - 0x00008000
2352      -
2353    * - ``V4L2_HEVC_PPS_FLAG_PPS_DISABLE_DEBLOCKING_FILTER``
2354      - 0x00010000
2355      -
2356    * - ``V4L2_HEVC_PPS_FLAG_LISTS_MODIFICATION_PRESENT``
2357      - 0x00020000
2358      -
2359    * - ``V4L2_HEVC_PPS_FLAG_SLICE_SEGMENT_HEADER_EXTENSION_PRESENT``
2360      - 0x00040000
2361      -
2362    * - ``V4L2_HEVC_PPS_FLAG_DEBLOCKING_FILTER_CONTROL_PRESENT``
2363      - 0x00080000
2364      - Specifies the presence of deblocking filter control syntax elements in
2365        the PPS
2366    * - ``V4L2_HEVC_PPS_FLAG_UNIFORM_SPACING``
2367      - 0x00100000
2368      - Specifies that tile column boundaries and likewise tile row boundaries
2369        are distributed uniformly across the picture
2370
2371.. raw:: latex
2372
2373    \normalsize
2374
2375``V4L2_CID_STATELESS_HEVC_SLICE_PARAMS (struct)``
2376    Specifies various slice-specific parameters, especially from the NAL unit
2377    header, general slice segment header and weighted prediction parameter
2378    parts of the bitstream.
2379    These bitstream parameters are defined according to :ref:`hevc`.
2380    They are described in section 7.4.7 "General slice segment header
2381    semantics" of the specification.
2382    This control is a dynamically sized 1-dimensional array,
2383    V4L2_CTRL_FLAG_DYNAMIC_ARRAY flag must be set when using it.
2384
2385.. c:type:: v4l2_ctrl_hevc_slice_params
2386
2387.. raw:: latex
2388
2389    \scriptsize
2390
2391.. tabularcolumns:: |p{5.4cm}|p{6.8cm}|p{5.1cm}|
2392
2393.. cssclass:: longtable
2394
2395.. flat-table:: struct v4l2_ctrl_hevc_slice_params
2396    :header-rows:  0
2397    :stub-columns: 0
2398    :widths:       1 1 2
2399
2400    * - __u32
2401      - ``bit_size``
2402      - Size (in bits) of the current slice data.
2403    * - __u32
2404      - ``data_byte_offset``
2405      - Offset (in byte) to the video data in the current slice data.
2406    * - __u32
2407      - ``num_entry_point_offsets``
2408      - Specifies the number of entry point offset syntax elements in the slice header.
2409        When the driver supports it, the ``V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS``
2410        must be set.
2411    * - __u8
2412      - ``nal_unit_type``
2413      - Specifies the coding type of the slice (B, P or I).
2414    * - __u8
2415      - ``nuh_temporal_id_plus1``
2416      - Minus 1 specifies a temporal identifier for the NAL unit.
2417    * - __u8
2418      - ``slice_type``
2419      -
2420	(V4L2_HEVC_SLICE_TYPE_I, V4L2_HEVC_SLICE_TYPE_P or
2421	V4L2_HEVC_SLICE_TYPE_B).
2422    * - __u8
2423      - ``colour_plane_id``
2424      - Specifies the colour plane associated with the current slice.
2425    * - __s32
2426      - ``slice_pic_order_cnt``
2427      - Specifies the picture order count.
2428    * - __u8
2429      - ``num_ref_idx_l0_active_minus1``
2430      - This value plus 1 specifies the maximum reference index for reference picture list 0
2431        that may be used to decode the slice.
2432    * - __u8
2433      - ``num_ref_idx_l1_active_minus1``
2434      - This value plus 1 specifies the maximum reference index for reference picture list 1
2435        that may be used to decode the slice.
2436    * - __u8
2437      - ``collocated_ref_idx``
2438      - Specifies the reference index of the collocated picture used for
2439        temporal motion vector prediction.
2440    * - __u8
2441      - ``five_minus_max_num_merge_cand``
2442      - Specifies the maximum number of merging motion vector prediction
2443        candidates supported in the slice subtracted from 5.
2444    * - __s8
2445      - ``slice_qp_delta``
2446      - Specifies the initial value of QpY to be used for the coding blocks in the slice.
2447    * - __s8
2448      - ``slice_cb_qp_offset``
2449      - Specifies a difference to be added to the value of pps_cb_qp_offset.
2450    * - __s8
2451      - ``slice_cr_qp_offset``
2452      - Specifies a difference to be added to the value of pps_cr_qp_offset.
2453    * - __s8
2454      - ``slice_act_y_qp_offset``
2455      - Specifies the offset to the luma of quantization parameter qP derived in section 8.6.2
2456    * - __s8
2457      - ``slice_act_cb_qp_offset``
2458      - Specifies the offset to the cb of quantization parameter qP derived in section 8.6.2
2459    * - __s8
2460      - ``slice_act_cr_qp_offset``
2461      - Specifies the offset to the cr of quantization parameter qP derived in section 8.6.2
2462    * - __s8
2463      - ``slice_beta_offset_div2``
2464      - Specifies the deblocking parameter offsets for beta divided by 2.
2465    * - __s8
2466      - ``slice_tc_offset_div2``
2467      - Specifies the deblocking parameter offsets for tC divided by 2.
2468    * - __u8
2469      - ``pic_struct``
2470      - Indicates whether a picture should be displayed as a frame or as one or more fields.
2471    * - __u32
2472      - ``slice_segment_addr``
2473      - Specifies the address of the first coding tree block in the slice segment.
2474    * - __u8
2475      - ``ref_idx_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]``
2476      - The list of L0 reference elements as indices in the DPB.
2477    * - __u8
2478      - ``ref_idx_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]``
2479      - The list of L1 reference elements as indices in the DPB.
2480    * - __u16
2481      - ``short_term_ref_pic_set_size``
2482      - Specifies the size, in bits, of the short-term reference picture set, described as st_ref_pic_set()
2483        in the specification, included in the slice header or SPS (section 7.3.6.1).
2484    * - __u16
2485      - ``long_term_ref_pic_set_size``
2486      - Specifies the size, in bits, of the long-term reference picture set include in the slice header
2487        or SPS. It is the number of bits in the conditional block if(long_term_ref_pics_present_flag)
2488        in section 7.3.6.1 of the specification.
2489    * - __u8
2490      - ``padding``
2491      - Applications and drivers must set this to zero.
2492    * - struct :c:type:`v4l2_hevc_pred_weight_table`
2493      - ``pred_weight_table``
2494      - The prediction weight coefficients for inter-picture prediction.
2495    * - __u64
2496      - ``flags``
2497      - See :ref:`Slice Parameters Flags <hevc_slice_params_flags>`
2498
2499.. raw:: latex
2500
2501    \normalsize
2502
2503.. _hevc_slice_params_flags:
2504
2505``Slice Parameters Flags``
2506
2507.. raw:: latex
2508
2509    \scriptsize
2510
2511.. flat-table::
2512    :header-rows:  0
2513    :stub-columns: 0
2514    :widths:       1 1 2
2515
2516    * - ``V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_SAO_LUMA``
2517      - 0x00000001
2518      -
2519    * - ``V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_SAO_CHROMA``
2520      - 0x00000002
2521      -
2522    * - ``V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_TEMPORAL_MVP_ENABLED``
2523      - 0x00000004
2524      -
2525    * - ``V4L2_HEVC_SLICE_PARAMS_FLAG_MVD_L1_ZERO``
2526      - 0x00000008
2527      -
2528    * - ``V4L2_HEVC_SLICE_PARAMS_FLAG_CABAC_INIT``
2529      - 0x00000010
2530      -
2531    * - ``V4L2_HEVC_SLICE_PARAMS_FLAG_COLLOCATED_FROM_L0``
2532      - 0x00000020
2533      -
2534    * - ``V4L2_HEVC_SLICE_PARAMS_FLAG_USE_INTEGER_MV``
2535      - 0x00000040
2536      -
2537    * - ``V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_DEBLOCKING_FILTER_DISABLED``
2538      - 0x00000080
2539      -
2540    * - ``V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_LOOP_FILTER_ACROSS_SLICES_ENABLED``
2541      - 0x00000100
2542      -
2543    * - ``V4L2_HEVC_SLICE_PARAMS_FLAG_DEPENDENT_SLICE_SEGMENT``
2544      - 0x00000200
2545      -
2546
2547.. raw:: latex
2548
2549    \normalsize
2550
2551``V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS (integer)``
2552    Specifies entry point offsets in bytes.
2553    This control is a dynamically sized array. The number of entry point
2554    offsets is reported by the ``elems`` field.
2555    This bitstream parameter is defined according to :ref:`hevc`.
2556    They are described in section 7.4.7.1 "General slice segment header
2557    semantics" of the specification.
2558    When multiple slices are submitted in a request, the length of
2559    this array must be the sum of num_entry_point_offsets of all the
2560    slices in the request.
2561
2562``V4L2_CID_STATELESS_HEVC_SCALING_MATRIX (struct)``
2563    Specifies the HEVC scaling matrix parameters used for the scaling process
2564    for transform coefficients.
2565    These matrix and parameters are defined according to :ref:`hevc`.
2566    They are described in section 7.4.5 "Scaling list data semantics" of
2567    the specification.
2568
2569.. c:type:: v4l2_ctrl_hevc_scaling_matrix
2570
2571.. raw:: latex
2572
2573    \scriptsize
2574
2575.. tabularcolumns:: |p{5.4cm}|p{6.8cm}|p{5.1cm}|
2576
2577.. cssclass:: longtable
2578
2579.. flat-table:: struct v4l2_ctrl_hevc_scaling_matrix
2580    :header-rows:  0
2581    :stub-columns: 0
2582    :widths:       1 1 2
2583
2584    * - __u8
2585      - ``scaling_list_4x4[6][16]``
2586      - Scaling list is used for the scaling process for transform
2587        coefficients. The values on each scaling list are expected
2588        in raster scan order.
2589    * - __u8
2590      - ``scaling_list_8x8[6][64]``
2591      - Scaling list is used for the scaling process for transform
2592        coefficients. The values on each scaling list are expected
2593        in raster scan order.
2594    * - __u8
2595      - ``scaling_list_16x16[6][64]``
2596      - Scaling list is used for the scaling process for transform
2597        coefficients. The values on each scaling list are expected
2598        in raster scan order.
2599    * - __u8
2600      - ``scaling_list_32x32[2][64]``
2601      - Scaling list is used for the scaling process for transform
2602        coefficients. The values on each scaling list are expected
2603        in raster scan order.
2604    * - __u8
2605      - ``scaling_list_dc_coef_16x16[6]``
2606      - Scaling list is used for the scaling process for transform
2607        coefficients. The values on each scaling list are expected
2608        in raster scan order.
2609    * - __u8
2610      - ``scaling_list_dc_coef_32x32[2]``
2611      - Scaling list is used for the scaling process for transform
2612        coefficients. The values on each scaling list are expected
2613        in raster scan order.
2614
2615.. raw:: latex
2616
2617    \normalsize
2618
2619.. c:type:: v4l2_hevc_dpb_entry
2620
2621.. raw:: latex
2622
2623    \small
2624
2625.. tabularcolumns:: |p{1.0cm}|p{4.2cm}|p{12.1cm}|
2626
2627.. flat-table:: struct v4l2_hevc_dpb_entry
2628    :header-rows:  0
2629    :stub-columns: 0
2630    :widths:       1 1 2
2631
2632    * - __u64
2633      - ``timestamp``
2634      - Timestamp of the V4L2 capture buffer to use as reference, used
2635        with B-coded and P-coded frames. The timestamp refers to the
2636	``timestamp`` field in struct :c:type:`v4l2_buffer`. Use the
2637	:c:func:`v4l2_timeval_to_ns()` function to convert the struct
2638	:c:type:`timeval` in struct :c:type:`v4l2_buffer` to a __u64.
2639    * - __u8
2640      - ``flags``
2641      - Long term flag for the reference frame
2642        (V4L2_HEVC_DPB_ENTRY_LONG_TERM_REFERENCE). The flag is set as
2643        described in the ITU HEVC specification chapter "8.3.2 Decoding
2644        process for reference picture set".
2645    * - __u8
2646      - ``field_pic``
2647      - Whether the reference is a field picture or a frame.
2648        See :ref:`HEVC dpb field pic Flags <hevc_dpb_field_pic_flags>`
2649    * - __s32
2650      - ``pic_order_cnt_val``
2651      - The picture order count of the current picture.
2652    * - __u8
2653      - ``padding[2]``
2654      - Applications and drivers must set this to zero.
2655
2656.. raw:: latex
2657
2658    \normalsize
2659
2660.. _hevc_dpb_field_pic_flags:
2661
2662``HEVC dpb field pic Flags``
2663
2664.. raw:: latex
2665
2666    \scriptsize
2667
2668.. flat-table::
2669    :header-rows:  0
2670    :stub-columns: 0
2671    :widths:       1 1 2
2672
2673    * - ``V4L2_HEVC_SEI_PIC_STRUCT_FRAME``
2674      - 0
2675      - (progressive) Frame
2676    * - ``V4L2_HEVC_SEI_PIC_STRUCT_TOP_FIELD``
2677      - 1
2678      - Top field
2679    * - ``V4L2_HEVC_SEI_PIC_STRUCT_BOTTOM_FIELD``
2680      - 2
2681      - Bottom field
2682    * - ``V4L2_HEVC_SEI_PIC_STRUCT_TOP_BOTTOM``
2683      - 3
2684      - Top field, bottom field, in that order
2685    * - ``V4L2_HEVC_SEI_PIC_STRUCT_BOTTOM_TOP``
2686      - 4
2687      - Bottom field, top field, in that order
2688    * - ``V4L2_HEVC_SEI_PIC_STRUCT_TOP_BOTTOM_TOP``
2689      - 5
2690      - Top field, bottom field, top field repeated, in that order
2691    * - ``V4L2_HEVC_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM``
2692      - 6
2693      - Bottom field, top field, bottom field repeated, in that order
2694    * - ``V4L2_HEVC_SEI_PIC_STRUCT_FRAME_DOUBLING``
2695      - 7
2696      - Frame doubling
2697    * - ``V4L2_HEVC_SEI_PIC_STRUCT_FRAME_TRIPLING``
2698      - 8
2699      - Frame tripling
2700    * - ``V4L2_HEVC_SEI_PIC_STRUCT_TOP_PAIRED_PREVIOUS_BOTTOM``
2701      - 9
2702      - Top field paired with previous bottom field in output order
2703    * - ``V4L2_HEVC_SEI_PIC_STRUCT_BOTTOM_PAIRED_PREVIOUS_TOP``
2704      - 10
2705      - Bottom field paired with previous top field in output order
2706    * - ``V4L2_HEVC_SEI_PIC_STRUCT_TOP_PAIRED_NEXT_BOTTOM``
2707      - 11
2708      - Top field paired with next bottom field in output order
2709    * - ``V4L2_HEVC_SEI_PIC_STRUCT_BOTTOM_PAIRED_NEXT_TOP``
2710      - 12
2711      - Bottom field paired with next top field in output order
2712
2713.. c:type:: v4l2_hevc_pred_weight_table
2714
2715.. raw:: latex
2716
2717    \footnotesize
2718
2719.. tabularcolumns:: |p{0.8cm}|p{10.6cm}|p{5.9cm}|
2720
2721.. flat-table:: struct v4l2_hevc_pred_weight_table
2722    :header-rows:  0
2723    :stub-columns: 0
2724    :widths:       1 1 2
2725
2726    * - __s8
2727      - ``delta_luma_weight_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]``
2728      - The difference of the weighting factor applied to the luma
2729        prediction value for list 0.
2730    * - __s8
2731      - ``luma_offset_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]``
2732      - The additive offset applied to the luma prediction value for list 0.
2733    * - __s8
2734      - ``delta_chroma_weight_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2]``
2735      - The difference of the weighting factor applied to the chroma
2736        prediction value for list 0.
2737    * - __s8
2738      - ``chroma_offset_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2]``
2739      - The difference of the additive offset applied to the chroma
2740        prediction values for list 0.
2741    * - __s8
2742      - ``delta_luma_weight_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]``
2743      - The difference of the weighting factor applied to the luma
2744        prediction value for list 1.
2745    * - __s8
2746      - ``luma_offset_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]``
2747      - The additive offset applied to the luma prediction value for list 1.
2748    * - __s8
2749      - ``delta_chroma_weight_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2]``
2750      - The difference of the weighting factor applied to the chroma
2751        prediction value for list 1.
2752    * - __s8
2753      - ``chroma_offset_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2]``
2754      - The difference of the additive offset applied to the chroma
2755        prediction values for list 1.
2756    * - __u8
2757      - ``luma_log2_weight_denom``
2758      - The base 2 logarithm of the denominator for all luma weighting
2759        factors.
2760    * - __s8
2761      - ``delta_chroma_log2_weight_denom``
2762      - The difference of the base 2 logarithm of the denominator for
2763        all chroma weighting factors.
2764    * - __u8
2765      - ``padding[6]``
2766      - Applications and drivers must set this to zero.
2767
2768.. raw:: latex
2769
2770    \normalsize
2771
2772``V4L2_CID_STATELESS_HEVC_DECODE_MODE (enum)``
2773    Specifies the decoding mode to use. Currently exposes slice-based and
2774    frame-based decoding but new modes might be added later on.
2775    This control is used as a modifier for V4L2_PIX_FMT_HEVC_SLICE
2776    pixel format. Applications that support V4L2_PIX_FMT_HEVC_SLICE
2777    are required to set this control in order to specify the decoding mode
2778    that is expected for the buffer.
2779    Drivers may expose a single or multiple decoding modes, depending
2780    on what they can support.
2781
2782.. c:type:: v4l2_stateless_hevc_decode_mode
2783
2784.. raw:: latex
2785
2786    \small
2787
2788.. tabularcolumns:: |p{9.4cm}|p{0.6cm}|p{7.3cm}|
2789
2790.. flat-table::
2791    :header-rows:  0
2792    :stub-columns: 0
2793    :widths:       1 1 2
2794
2795    * - ``V4L2_STATELESS_HEVC_DECODE_MODE_SLICE_BASED``
2796      - 0
2797      - Decoding is done at the slice granularity.
2798        The OUTPUT buffer must contain a single slice.
2799    * - ``V4L2_STATELESS_HEVC_DECODE_MODE_FRAME_BASED``
2800      - 1
2801      - Decoding is done at the frame granularity.
2802        The OUTPUT buffer must contain all slices needed to decode the
2803        frame.
2804
2805.. raw:: latex
2806
2807    \normalsize
2808
2809``V4L2_CID_STATELESS_HEVC_START_CODE (enum)``
2810    Specifies the HEVC slice start code expected for each slice.
2811    This control is used as a modifier for V4L2_PIX_FMT_HEVC_SLICE
2812    pixel format. Applications that support V4L2_PIX_FMT_HEVC_SLICE
2813    are required to set this control in order to specify the start code
2814    that is expected for the buffer.
2815    Drivers may expose a single or multiple start codes, depending
2816    on what they can support.
2817
2818.. c:type:: v4l2_stateless_hevc_start_code
2819
2820.. tabularcolumns:: |p{9.2cm}|p{0.6cm}|p{7.5cm}|
2821
2822.. flat-table::
2823    :header-rows:  0
2824    :stub-columns: 0
2825    :widths:       1 1 2
2826
2827    * - ``V4L2_STATELESS_HEVC_START_CODE_NONE``
2828      - 0
2829      - Selecting this value specifies that HEVC slices are passed
2830        to the driver without any start code. The bitstream data should be
2831        according to :ref:`hevc` 7.3.1.1 General NAL unit syntax, hence
2832        contains emulation prevention bytes when required.
2833    * - ``V4L2_STATELESS_HEVC_START_CODE_ANNEX_B``
2834      - 1
2835      - Selecting this value specifies that HEVC slices are expected
2836        to be prefixed by Annex B start codes. According to :ref:`hevc`
2837        valid start codes can be 3-bytes 0x000001 or 4-bytes 0x00000001.
2838
2839.. raw:: latex
2840
2841    \normalsize
2842
2843``V4L2_CID_MPEG_VIDEO_BASELAYER_PRIORITY_ID (integer)``
2844    Specifies a priority identifier for the NAL unit, which will be applied to
2845    the base layer. By default this value is set to 0 for the base layer,
2846    and the next layer will have the priority ID assigned as 1, 2, 3 and so on.
2847    The video encoder can't decide the priority id to be applied to a layer,
2848    so this has to come from client.
2849    This is applicable to H264 and valid Range is from 0 to 63.
2850    Source Rec. ITU-T H.264 (06/2019); G.7.4.1.1, G.8.8.1.
2851
2852``V4L2_CID_MPEG_VIDEO_LTR_COUNT (integer)``
2853    Specifies the maximum number of Long Term Reference (LTR) frames at any
2854    given time that the encoder can keep.
2855    This is applicable to the H264 and HEVC encoders.
2856
2857``V4L2_CID_MPEG_VIDEO_FRAME_LTR_INDEX (integer)``
2858    After setting this control the frame that will be queued next
2859    will be marked as a Long Term Reference (LTR) frame
2860    and given this LTR index which ranges from 0 to LTR_COUNT-1.
2861    This is applicable to the H264 and HEVC encoders.
2862    Source Rec. ITU-T H.264 (06/2019); Table 7.9
2863
2864``V4L2_CID_MPEG_VIDEO_USE_LTR_FRAMES (bitmask)``
2865    Specifies the Long Term Reference (LTR) frame(s) to be used for
2866    encoding the next frame queued after setting this control.
2867    This provides a bitmask which consists of bits [0, LTR_COUNT-1].
2868    This is applicable to the H264 and HEVC encoders.
2869
2870``V4L2_CID_STATELESS_HEVC_DECODE_PARAMS (struct)``
2871    Specifies various decode parameters, especially the references picture order
2872    count (POC) for all the lists (short, long, before, current, after) and the
2873    number of entries for each of them.
2874    These parameters are defined according to :ref:`hevc`.
2875    They are described in section 8.3 "Slice decoding process" of the
2876    specification.
2877
2878.. c:type:: v4l2_ctrl_hevc_decode_params
2879
2880.. cssclass:: longtable
2881
2882.. flat-table:: struct v4l2_ctrl_hevc_decode_params
2883    :header-rows:  0
2884    :stub-columns: 0
2885    :widths:       1 1 2
2886
2887    * - __s32
2888      - ``pic_order_cnt_val``
2889      - PicOrderCntVal as described in section 8.3.1 "Decoding process
2890        for picture order count" of the specification.
2891    * - __u16
2892      - ``short_term_ref_pic_set_size``
2893      - Specifies the size, in bits, of the short-term reference picture set, of the first slice
2894        described as st_ref_pic_set() in the specification, included in the slice header
2895        or SPS (section 7.3.6.1).
2896    * - __u16
2897      - ``long_term_ref_pic_set_size``
2898      - Specifies the size, in bits, of the long-term reference picture set, of the first slice
2899        included in the slice header or SPS. It is the number of bits in the conditional block
2900        if(long_term_ref_pics_present_flag) in section 7.3.6.1 of the specification.
2901    * - __u8
2902      - ``num_active_dpb_entries``
2903      - The number of entries in ``dpb``.
2904    * - __u8
2905      - ``num_poc_st_curr_before``
2906      - The number of reference pictures in the short-term set that come before
2907        the current frame.
2908    * - __u8
2909      - ``num_poc_st_curr_after``
2910      - The number of reference pictures in the short-term set that come after
2911        the current frame.
2912    * - __u8
2913      - ``num_poc_lt_curr``
2914      - The number of reference pictures in the long-term set.
2915    * - __u8
2916      - ``poc_st_curr_before[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]``
2917      - PocStCurrBefore as described in section 8.3.2 "Decoding process for reference
2918        picture set": provides the index of the short term before references in DPB array.
2919    * - __u8
2920      - ``poc_st_curr_after[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]``
2921      - PocStCurrAfter as described in section 8.3.2 "Decoding process for reference
2922        picture set": provides the index of the short term after references in DPB array.
2923    * - __u8
2924      - ``poc_lt_curr[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]``
2925      - PocLtCurr as described in section 8.3.2 "Decoding process for reference
2926        picture set": provides the index of the long term references in DPB array.
2927    * - __u8
2928      - ``num_delta_pocs_of_ref_rps_idx``
2929      - When the short_term_ref_pic_set_sps_flag in the slice header is equal to 0,
2930        it is the same as the derived value NumDeltaPocs[RefRpsIdx]. It can be used to parse
2931        the RPS data in slice headers instead of skipping it with @short_term_ref_pic_set_size.
2932        When the value of short_term_ref_pic_set_sps_flag in the slice header is
2933        equal to 1, num_delta_pocs_of_ref_rps_idx shall be set to 0.
2934    * - struct :c:type:`v4l2_hevc_dpb_entry`
2935      - ``dpb[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]``
2936      - The decoded picture buffer, for meta-data about reference frames.
2937    * - __u64
2938      - ``flags``
2939      - See :ref:`Decode Parameters Flags <hevc_decode_params_flags>`
2940
2941.. _hevc_decode_params_flags:
2942
2943``Decode Parameters Flags``
2944
2945.. cssclass:: longtable
2946
2947.. flat-table::
2948    :header-rows:  0
2949    :stub-columns: 0
2950    :widths:       1 1 2
2951
2952    * - ``V4L2_HEVC_DECODE_PARAM_FLAG_IRAP_PIC``
2953      - 0x00000001
2954      -
2955    * - ``V4L2_HEVC_DECODE_PARAM_FLAG_IDR_PIC``
2956      - 0x00000002
2957      -
2958    * - ``V4L2_HEVC_DECODE_PARAM_FLAG_NO_OUTPUT_OF_PRIOR``
2959      - 0x00000004
2960      -
2961
2962.. _v4l2-codec-stateless-av1:
2963
2964``V4L2_CID_STATELESS_AV1_SEQUENCE (struct)``
2965    Represents an AV1 Sequence OBU (Open Bitstream Unit). See section 5.5
2966    "Sequence header OBU syntax" in :ref:`av1` for more details.
2967
2968.. c:type:: v4l2_ctrl_av1_sequence
2969
2970.. cssclass:: longtable
2971
2972.. tabularcolumns:: |p{5.8cm}|p{4.8cm}|p{6.6cm}|
2973
2974.. flat-table:: struct v4l2_ctrl_av1_sequence
2975    :header-rows:  0
2976    :stub-columns: 0
2977    :widths:       1 1 2
2978
2979    * - __u32
2980      - ``flags``
2981      - See :ref:`AV1 Sequence Flags <av1_sequence_flags>`.
2982    * - __u8
2983      - ``seq_profile``
2984      - Specifies the features that can be used in the coded video sequence.
2985    * - __u8
2986      - ``order_hint_bits``
2987      - Specifies the number of bits used for the order_hint field at each frame.
2988    * - __u8
2989      - ``bit_depth``
2990      - the bit depth to use for the sequence as described in section 5.5.2
2991        "Color config syntax" in :ref:`av1` for more details.
2992    * - __u8
2993      - ``reserved``
2994      - Applications and drivers must set this to zero.
2995    * - __u16
2996      - ``max_frame_width_minus_1``
2997      - Specifies the maximum frame width minus 1 for the frames represented by
2998        this sequence header.
2999    * - __u16
3000      - ``max_frame_height_minus_1``
3001      - Specifies the maximum frame height minus 1 for the frames represented by
3002        this sequence header.
3003
3004.. _av1_sequence_flags:
3005
3006``AV1 Sequence Flags``
3007
3008.. cssclass:: longtable
3009
3010.. flat-table::
3011    :header-rows:  0
3012    :stub-columns: 0
3013    :widths:       1 1 2
3014
3015    * - ``V4L2_AV1_SEQUENCE_FLAG_STILL_PICTURE``
3016      - 0x00000001
3017      - If set, specifies that the coded video sequence contains only one coded
3018        frame. If not set, specifies that the coded video sequence contains one
3019        or more coded frames.
3020    * - ``V4L2_AV1_SEQUENCE_FLAG_USE_128X128_SUPERBLOCK``
3021      - 0x00000002
3022      - If set, indicates that superblocks contain 128x128 luma samples.
3023        When equal to 0, it indicates that superblocks contain 64x64 luma
3024        samples. The number of contained chroma samples depends on
3025        subsampling_x and subsampling_y.
3026    * - ``V4L2_AV1_SEQUENCE_FLAG_ENABLE_FILTER_INTRA``
3027      - 0x00000004
3028      - If set, specifies that the use_filter_intra syntax element may be
3029        present. If not set, specifies that the use_filter_intra syntax element
3030        will not be present.
3031    * - ``V4L2_AV1_SEQUENCE_FLAG_ENABLE_INTRA_EDGE_FILTER``
3032      - 0x00000008
3033      - Specifies whether the intra edge filtering process should be enabled.
3034    * - ``V4L2_AV1_SEQUENCE_FLAG_ENABLE_INTERINTRA_COMPOUND``
3035      - 0x00000010
3036      - If set, specifies that the mode info for inter blocks may contain the
3037        syntax element interintra. If not set, specifies that the syntax element
3038        interintra will not be present.
3039    * - ``V4L2_AV1_SEQUENCE_FLAG_ENABLE_MASKED_COMPOUND``
3040      - 0x00000020
3041      - If set, specifies that the mode info for inter blocks may contain the
3042        syntax element compound_type. If not set, specifies that the syntax
3043        element compound_type will not be present.
3044    * - ``V4L2_AV1_SEQUENCE_FLAG_ENABLE_WARPED_MOTION``
3045      - 0x00000040
3046      - If set, indicates that the allow_warped_motion syntax element may be
3047        present. If not set, indicates that the allow_warped_motion syntax
3048        element will not be present.
3049    * - ``V4L2_AV1_SEQUENCE_FLAG_ENABLE_DUAL_FILTER``
3050      - 0x00000080
3051      - If set, indicates that the inter prediction filter type may be specified
3052        independently in the horizontal and vertical directions. If the flag is
3053        equal to 0, only one filter type may be specified, which is then used in
3054        both directions.
3055    * - ``V4L2_AV1_SEQUENCE_FLAG_ENABLE_ORDER_HINT``
3056      - 0x00000100
3057      - If set, indicates that tools based on the values of order hints may be
3058        used. If not set, indicates that tools based on order hints are
3059        disabled.
3060    * - ``V4L2_AV1_SEQUENCE_FLAG_ENABLE_JNT_COMP``
3061      - 0x00000200
3062      - If set, indicates that the distance weights process may be used for
3063        inter prediction.
3064    * - ``V4L2_AV1_SEQUENCE_FLAG_ENABLE_REF_FRAME_MVS``
3065      - 0x00000400
3066      - If set, indicates that the use_ref_frame_mvs syntax element may be
3067        present. If not set, indicates that the use_ref_frame_mvs syntax element
3068        will not be present.
3069    * - ``V4L2_AV1_SEQUENCE_FLAG_ENABLE_SUPERRES``
3070      - 0x00000800
3071      - If set, specifies that the use_superres syntax element will be present
3072        in the uncompressed header. If not set, specifies that the use_superres
3073        syntax element will not be present (instead use_superres will be set to
3074        0 in the uncompressed header without being read).
3075    * - ``V4L2_AV1_SEQUENCE_FLAG_ENABLE_CDEF``
3076      - 0x00001000
3077      - If set, specifies that cdef filtering may be enabled. If not set,
3078        specifies that cdef filtering is disabled.
3079    * - ``V4L2_AV1_SEQUENCE_FLAG_ENABLE_RESTORATION``
3080      - 0x00002000
3081      - If set, specifies that loop restoration filtering may be enabled. If not
3082        set, specifies that loop restoration filtering is disabled.
3083    * - ``V4L2_AV1_SEQUENCE_FLAG_MONO_CHROME``
3084      - 0x00004000
3085      - If set, indicates that the video does not contain U and V color planes.
3086        If not set, indicates that the video contains Y, U, and V color planes.
3087    * - ``V4L2_AV1_SEQUENCE_FLAG_COLOR_RANGE``
3088      - 0x00008000
3089      - If set, signals full swing representation, i.e. "Full Range
3090        Quantization". If not set, signals studio swing representation, i.e.
3091        "Limited Range Quantization".
3092    * - ``V4L2_AV1_SEQUENCE_FLAG_SUBSAMPLING_X``
3093      - 0x00010000
3094      - Specify the chroma subsampling format.
3095    * - ``V4L2_AV1_SEQUENCE_FLAG_SUBSAMPLING_Y``
3096      - 0x00020000
3097      - Specify the chroma subsampling format.
3098    * - ``V4L2_AV1_SEQUENCE_FLAG_FILM_GRAIN_PARAMS_PRESENT``
3099      - 0x00040000
3100      - Specifies whether film grain parameters are present in the coded video
3101        sequence.
3102    * - ``V4L2_AV1_SEQUENCE_FLAG_SEPARATE_UV_DELTA_Q``
3103      - 0x00080000
3104      - If set, indicates that the U and V planes may have separate delta
3105        quantizer values. If not set, indicates that the U and V planes will share
3106        the same delta quantizer value.
3107
3108``V4L2_CID_STATELESS_AV1_TILE_GROUP_ENTRY (struct)``
3109    Represents a single AV1 tile inside an AV1 Tile Group. Note that MiRowStart,
3110    MiRowEnd, MiColStart and MiColEnd can be retrieved from struct
3111    v4l2_av1_tile_info in struct v4l2_ctrl_av1_frame using tile_row and
3112    tile_col. See section 6.10.1 "General tile group OBU semantics" in
3113    :ref:`av1` for more details.
3114
3115.. c:type:: v4l2_ctrl_av1_tile_group_entry
3116
3117.. cssclass:: longtable
3118
3119.. tabularcolumns:: |p{5.8cm}|p{4.8cm}|p{6.6cm}|
3120
3121.. flat-table:: struct v4l2_ctrl_av1_tile_group_entry
3122    :header-rows:  0
3123    :stub-columns: 0
3124    :widths:       1 1 2
3125
3126    * - __u32
3127      - ``tile_offset``
3128      - Offset from the OBU data, i.e. where the coded tile data actually starts.
3129    * - __u32
3130      - ``tile_size``
3131      - Specifies the size in bytes of the coded tile. Equivalent to "TileSize"
3132        in :ref:`av1`.
3133    * - __u32
3134      - ``tile_row``
3135      - Specifies the row of the current tile. Equivalent to "TileRow" in
3136        :ref:`av1`.
3137    * - __u32
3138      - ``tile_col``
3139      - Specifies the column of the current tile. Equivalent to "TileColumn" in
3140        :ref:`av1`.
3141
3142.. c:type:: v4l2_av1_warp_model
3143
3144	AV1 Warp Model as described in section 3 "Symbols and abbreviated terms" of
3145	:ref:`av1`.
3146
3147.. raw:: latex
3148
3149    \scriptsize
3150
3151.. tabularcolumns:: |p{7.4cm}|p{0.3cm}|p{9.6cm}|
3152
3153.. flat-table::
3154    :header-rows:  0
3155    :stub-columns: 0
3156    :widths:       1 1 2
3157
3158    * - ``V4L2_AV1_WARP_MODEL_IDENTITY``
3159      - 0
3160      - Warp model is just an identity transform.
3161    * - ``V4L2_AV1_WARP_MODEL_TRANSLATION``
3162      - 1
3163      - Warp model is a pure translation.
3164    * - ``V4L2_AV1_WARP_MODEL_ROTZOOM``
3165      - 2
3166      - Warp model is a rotation + symmetric zoom + translation.
3167    * - ``V4L2_AV1_WARP_MODEL_AFFINE``
3168      - 3
3169      - Warp model is a general affine transform.
3170
3171.. c:type:: v4l2_av1_reference_frame
3172
3173AV1 Reference Frames as described in section 6.10.24 "Ref frames semantics"
3174of :ref:`av1`.
3175
3176.. raw:: latex
3177
3178    \scriptsize
3179
3180.. tabularcolumns:: |p{7.4cm}|p{0.3cm}|p{9.6cm}|
3181
3182.. flat-table::
3183    :header-rows:  0
3184    :stub-columns: 0
3185    :widths:       1 1 2
3186
3187    * - ``V4L2_AV1_REF_INTRA_FRAME``
3188      - 0
3189      - Intra Frame Reference.
3190    * - ``V4L2_AV1_REF_LAST_FRAME``
3191      - 1
3192      - Last Frame Reference.
3193    * - ``V4L2_AV1_REF_LAST2_FRAME``
3194      - 2
3195      - Last2 Frame Reference.
3196    * - ``V4L2_AV1_REF_LAST3_FRAME``
3197      - 3
3198      - Last3 Frame Reference.
3199    * - ``V4L2_AV1_REF_GOLDEN_FRAME``
3200      - 4
3201      - Golden Frame Reference.
3202    * - ``V4L2_AV1_REF_BWDREF_FRAME``
3203      - 5
3204      - BWD Frame Reference.
3205    * - ``V4L2_AV1_REF_ALTREF2_FRAME``
3206      - 6
3207      - ALTREF2 Frame Reference.
3208    * - ``V4L2_AV1_REF_ALTREF_FRAME``
3209      - 7
3210      - ALTREF Frame Reference.
3211
3212.. c:type:: v4l2_av1_global_motion
3213
3214AV1 Global Motion parameters as described in section 6.8.17
3215"Global motion params semantics" of :ref:`av1`.
3216
3217.. cssclass:: longtable
3218
3219.. tabularcolumns:: |p{1.5cm}|p{5.8cm}|p{10.0cm}|
3220
3221.. flat-table:: struct v4l2_av1_global_motion
3222    :header-rows:  0
3223    :stub-columns: 0
3224    :widths:       1 1 2
3225
3226    * - __u8
3227      - ``flags[V4L2_AV1_TOTAL_REFS_PER_FRAME]``
3228      - A bitfield containing the flags per reference frame. See
3229        :ref:`AV1 Global Motion Flags <av1_global_motion_flags>` for more
3230        details.
3231    * - enum :c:type:`v4l2_av1_warp_model`
3232      - ``type[V4L2_AV1_TOTAL_REFS_PER_FRAME]``
3233      - The type of global motion transform used.
3234    * - __s32
3235      - ``params[V4L2_AV1_TOTAL_REFS_PER_FRAME][6]``
3236      - This field has the same meaning as "gm_params" in :ref:`av1`.
3237    * - __u8
3238      - ``invalid``
3239      - Bitfield indicating whether the global motion params are invalid for a
3240        given reference frame. See section 7.11.3.6 Setup shear process and the
3241        variable "warpValid". Use V4L2_AV1_GLOBAL_MOTION_IS_INVALID(ref) to
3242        create a suitable mask.
3243    * - __u8
3244      - ``reserved[3]``
3245      - Applications and drivers must set this to zero.
3246
3247.. _av1_global_motion_flags:
3248
3249``AV1 Global Motion Flags``
3250
3251.. cssclass:: longtable
3252
3253.. flat-table::
3254    :header-rows:  0
3255    :stub-columns: 0
3256    :widths:       1 1 2
3257
3258    * - ``V4L2_AV1_GLOBAL_MOTION_FLAG_IS_GLOBAL``
3259      - 0x00000001
3260      - Specifies whether global motion parameters are present for a particular
3261        reference frame.
3262    * - ``V4L2_AV1_GLOBAL_MOTION_FLAG_IS_ROT_ZOOM``
3263      - 0x00000002
3264      - Specifies whether a particular reference frame uses rotation and zoom
3265        global motion.
3266    * - ``V4L2_AV1_GLOBAL_MOTION_FLAG_IS_TRANSLATION``
3267      - 0x00000004
3268      - Specifies whether a particular reference frame uses translation global
3269        motion
3270
3271.. c:type:: v4l2_av1_frame_restoration_type
3272
3273AV1 Frame Restoration Type.
3274
3275.. raw:: latex
3276
3277    \scriptsize
3278
3279.. tabularcolumns:: |p{7.4cm}|p{0.3cm}|p{9.6cm}|
3280
3281.. flat-table::
3282    :header-rows:  0
3283    :stub-columns: 0
3284    :widths:       1 1 2
3285
3286    * - ``V4L2_AV1_FRAME_RESTORE_NONE``
3287      - 0
3288      - No filtering is applied.
3289    * - ``V4L2_AV1_FRAME_RESTORE_WIENER``
3290      - 1
3291      - Wiener filter process is invoked.
3292    * - ``V4L2_AV1_FRAME_RESTORE_SGRPROJ``
3293      - 2
3294      - Self guided filter process is invoked.
3295    * - ``V4L2_AV1_FRAME_RESTORE_SWITCHABLE``
3296      - 3
3297      - Restoration filter is swichtable.
3298
3299.. c:type:: v4l2_av1_loop_restoration
3300
3301AV1 Loop Restoration as described in section 6.10.15 "Loop restoration params
3302semantics" of :ref:`av1`.
3303
3304.. cssclass:: longtable
3305
3306.. tabularcolumns:: |p{1.5cm}|p{5.8cm}|p{10.0cm}|
3307
3308.. flat-table:: struct v4l2_av1_loop_restoration
3309    :header-rows:  0
3310    :stub-columns: 0
3311    :widths:       1 1 2
3312
3313    * - __u8
3314      - ``flags``
3315      - See :ref:`AV1 Loop Restoration Flags <av1_loop_restoration_flags>`.
3316    * - __u8
3317      - ``lr_unit_shift``
3318      - Specifies if the luma restoration size should be halved.
3319    * - __u8
3320      - ``lr_uv_shift``
3321      - Specifies if the chroma size should be half the luma size.
3322    * - __u8
3323      - ``reserved``
3324      - Applications and drivers must set this to zero.
3325    * - :c:type:`v4l2_av1_frame_restoration_type`
3326      - ``frame_restoration_type[V4L2_AV1_NUM_PLANES_MAX]``
3327      - Specifies the type of restoration used for each plane.
3328    * - __u8
3329      - ``loop_restoration_size[V4L2_AV1_MAX_NUM_PLANES]``
3330      - Specifies the size of loop restoration units in units of samples in the
3331        current plane.
3332
3333.. _av1_loop_restoration_flags:
3334
3335``AV1 Loop Restoration Flags``
3336
3337.. cssclass:: longtable
3338
3339.. flat-table::
3340    :header-rows:  0
3341    :stub-columns: 0
3342    :widths:       1 1 2
3343
3344    * - ``V4L2_AV1_LOOP_RESTORATION_FLAG_USES_LR``
3345      - 0x00000001
3346      - Retains the same meaning as UsesLr in :ref:`av1`.
3347    * - ``V4L2_AV1_LOOP_RESTORATION_FLAG_USES_CHROMA_LR``
3348      - 0x00000002
3349      - Retains the same meaning as UsesChromaLr in :ref:`av1`.
3350
3351.. c:type:: v4l2_av1_cdef
3352
3353AV1 CDEF params semantics as described in section 6.10.14 "CDEF params
3354semantics" of :ref:`av1`.
3355
3356.. cssclass:: longtable
3357
3358.. tabularcolumns:: |p{1.5cm}|p{5.8cm}|p{10.0cm}|
3359
3360.. flat-table:: struct v4l2_av1_cdef
3361    :header-rows:  0
3362    :stub-columns: 0
3363    :widths:       1 1 2
3364
3365    * - __u8
3366      - ``damping_minus_3``
3367      - Controls the amount of damping in the deringing filter.
3368    * - __u8
3369      - ``bits``
3370      - Specifies the number of bits needed to specify which CDEF filter to
3371        apply.
3372    * - __u8
3373      - ``y_pri_strength[V4L2_AV1_CDEF_MAX]``
3374      -  Specifies the strength of the primary filter.
3375    * - __u8
3376      - ``y_sec_strength[V4L2_AV1_CDEF_MAX]``
3377      -  Specifies the strength of the secondary filter.
3378    * - __u8
3379      - ``uv_pri_strength[V4L2_AV1_CDEF_MAX]``
3380      -  Specifies the strength of the primary filter.
3381    * - __u8
3382      - ``uv_sec_strength[V4L2_AV1_CDEF_MAX]``
3383      -  Specifies the strength of the secondary filter.
3384
3385.. c:type:: v4l2_av1_segment_feature
3386
3387AV1 segment features as described in section 3 "Symbols and abbreviated terms"
3388of :ref:`av1`.
3389
3390.. raw:: latex
3391
3392    \scriptsize
3393
3394.. tabularcolumns:: |p{7.4cm}|p{0.3cm}|p{9.6cm}|
3395
3396.. flat-table::
3397    :header-rows:  0
3398    :stub-columns: 0
3399    :widths:       1 1 2
3400
3401    * - ``V4L2_AV1_SEG_LVL_ALT_Q``
3402      - 0
3403      - Index for quantizer segment feature.
3404    * - ``V4L2_AV1_SEG_LVL_ALT_LF_Y_V``
3405      - 1
3406      - Index for vertical luma loop filter segment feature.
3407    * - ``V4L2_AV1_SEG_LVL_REF_FRAME``
3408      - 5
3409      - Index for reference frame segment feature.
3410    * - ``V4L2_AV1_SEG_LVL_REF_SKIP``
3411      - 6
3412      - Index for skip segment feature.
3413    * - ``V4L2_AV1_SEG_LVL_REF_GLOBALMV``
3414      - 7
3415      - Index for global mv feature.
3416    * - ``V4L2_AV1_SEG_LVL_MAX``
3417      - 8
3418      - Number of segment features.
3419
3420.. c:type:: v4l2_av1_segmentation
3421
3422AV1 Segmentation params as defined in section 6.8.13 "Segmentation params
3423semantics" of :ref:`av1`.
3424
3425.. cssclass:: longtable
3426
3427.. tabularcolumns:: |p{1.5cm}|p{5.8cm}|p{10.0cm}|
3428
3429.. flat-table:: struct v4l2_av1_segmentation
3430    :header-rows:  0
3431    :stub-columns: 0
3432    :widths:       1 1 2
3433
3434    * - __u8
3435      - ``flags``
3436      - See :ref:`AV1 Segmentation Flags <av1_segmentation_flags>`
3437    * - __u8
3438      - ``last_active_seg_id``
3439      -  Indicates the highest numbered segment id that has some
3440         enabled feature. This is used when decoding the segment id to only decode
3441         choices corresponding to used segments.
3442    * - __u8
3443      - ``feature_enabled[V4L2_AV1_MAX_SEGMENTS]``
3444      - Bitmask defining which features are enabled in each segment. Use
3445        V4L2_AV1_SEGMENT_FEATURE_ENABLED to build a suitable mask.
3446    * - __u16
3447      - ``feature_data[V4L2_AV1_MAX_SEGMENTS][V4L2_AV1_SEG_LVL_MAX]``
3448      -  Data attached to each feature. Data entry is only valid if the feature
3449         is enabled.
3450
3451.. _av1_segmentation_flags:
3452
3453``AV1 Segmentation Flags``
3454
3455.. cssclass:: longtable
3456
3457.. flat-table::
3458    :header-rows:  0
3459    :stub-columns: 0
3460    :widths:       1 1 2
3461
3462    * - ``V4L2_AV1_SEGMENTATION_FLAG_ENABLED``
3463      - 0x00000001
3464      - If set, indicates that this frame makes use of the segmentation tool. If
3465        not set, indicates that the frame does not use segmentation.
3466    * - ``V4L2_AV1_SEGMENTATION_FLAG_UPDATE_MAP``
3467      - 0x00000002
3468      - If set, indicates that the segmentation map are updated during the
3469        decoding of this frame. If not set, indicates that the segmentation map
3470        from the previous frame is used.
3471    * - ``V4L2_AV1_SEGMENTATION_FLAG_TEMPORAL_UPDATE``
3472      - 0x00000004
3473      - If set, indicates that the updates to the segmentation map are coded
3474        relative to the existing segmentation map. If not set, indicates that
3475        the new segmentation map is coded without reference to the existing
3476        segmentation map.
3477    * - ``V4L2_AV1_SEGMENTATION_FLAG_UPDATE_DATA``
3478      - 0x00000008
3479      - If set, indicates that the updates to the segmentation map are coded
3480        relative to the existing segmentation map. If not set, indicates that
3481        the new segmentation map is coded without reference to the existing
3482        segmentation map.
3483    * - ``V4L2_AV1_SEGMENTATION_FLAG_SEG_ID_PRE_SKIP``
3484      - 0x00000010
3485      - If set, indicates that the segment id will be read before the skip
3486        syntax element. If not set, indicates that the skip syntax element will
3487        be read first.
3488
3489.. c:type:: v4l2_av1_loop_filter
3490
3491AV1 Loop filter params as defined in section 6.8.10 "Loop filter semantics" of
3492:ref:`av1`.
3493
3494.. cssclass:: longtable
3495
3496.. tabularcolumns:: |p{1.5cm}|p{5.8cm}|p{10.0cm}|
3497
3498.. flat-table:: struct v4l2_av1_loop_filter
3499    :header-rows:  0
3500    :stub-columns: 0
3501    :widths:       1 1 2
3502
3503    * - __u8
3504      - ``flags``
3505      - See
3506        :ref:`AV1 Loop Filter flags <av1_loop_filter_flags>` for more details.
3507    * - __u8
3508      - ``level[4]``
3509      - An array containing loop filter strength values. Different loop
3510        filter strength values from the array are used depending on the image
3511        plane being filtered, and the edge direction (vertical or horizontal)
3512        being filtered.
3513    * - __u8
3514      - ``sharpness``
3515      - indicates the sharpness level. The loop_filter_level and
3516        loop_filter_sharpness together determine when a block edge is filtered,
3517        and by how much the filtering can change the sample values. The loop
3518        filter process is described in section 7.14 of :ref:`av1`.
3519    * - __u8
3520      - ``ref_deltas[V4L2_AV1_TOTAL_REFS_PER_FRAME]``
3521      - contains the adjustment needed for the filter level based on the
3522        chosen reference frame. If this syntax element is not present, it
3523        maintains its previous value.
3524    * - __u8
3525      - ``mode_deltas[2]``
3526      - contains the adjustment needed for the filter level based on
3527        the chosen mode. If this syntax element is not present, it maintains its
3528        previous value.
3529    * - __u8
3530      - ``delta_lf_res``
3531      - specifies the left shift which should be applied to decoded loop filter
3532        delta values.
3533
3534.. _av1_loop_filter_flags:
3535
3536``AV1 Loop Filter Flags``
3537
3538.. cssclass:: longtable
3539
3540.. flat-table::
3541    :header-rows:  0
3542    :stub-columns: 0
3543    :widths:       1 1 2
3544
3545    * - ``V4L2_AV1_LOOP_FILTER_FLAG_DELTA_ENABLED``
3546      - 0x00000001
3547      - If set, means that the filter level depends on the mode and reference
3548        frame used to predict a block. If not set, means that the filter level
3549        does not depend on the mode and reference frame.
3550    * - ``V4L2_AV1_LOOP_FILTER_FLAG_DELTA_UPDATE``
3551      - 0x00000002
3552      - If set, means that additional syntax elements are present that specify
3553        which mode and reference frame deltas are to be updated. If not set,
3554        means that these syntax elements are not present.
3555    * - ``V4L2_AV1_LOOP_FILTER_FLAG_DELTA_LF_PRESENT``
3556      - 0x00000004
3557      - Specifies whether loop filter delta values are present
3558    * - ``V4L2_AV1_LOOP_FILTER_FLAG_DELTA_LF_MULTI``
3559      - 0x00000008
3560      - A value equal to 1 specifies that separate loop filter
3561        deltas are sent for horizontal luma edges, vertical luma edges,
3562        the U edges, and the V edges. A value of delta_lf_multi equal to 0
3563        specifies that the same loop filter delta is used for all edges.
3564
3565.. c:type:: v4l2_av1_quantization
3566
3567AV1 Quantization params as defined in section 6.8.11 "Quantization params
3568semantics" of :ref:`av1`.
3569
3570.. cssclass:: longtable
3571
3572.. tabularcolumns:: |p{1.5cm}|p{5.8cm}|p{10.0cm}|
3573
3574.. flat-table:: struct v4l2_av1_quantization
3575    :header-rows:  0
3576    :stub-columns: 0
3577    :widths:       1 1 2
3578
3579    * - __u8
3580      - ``flags``
3581      - See
3582        :ref:`AV1 Loop Filter flags <av1_quantization_flags>` for more details.
3583    * - __u8
3584      - ``base_q_idx``
3585      - Indicates the base frame qindex. This is used for Y AC coefficients and
3586        as the base value for the other quantizers.
3587    * - __u8
3588      - ``delta_q_y_dc``
3589      - Indicates the Y DC quantizer relative to base_q_idx.
3590    * - __u8
3591      - ``delta_q_u_dc``
3592      - Indicates the U DC quantizer relative to base_q_idx.
3593    * - __u8
3594      - ``delta_q_u_ac``
3595      - Indicates the U AC quantizer relative to base_q_idx.
3596    * - __u8
3597      - ``delta_q_v_dc``
3598      - Indicates the V DC quantizer relative to base_q_idx.
3599    * - __u8
3600      - ``delta_q_v_ac``
3601      - Indicates the V AC quantizer relative to base_q_idx.
3602    * - __u8
3603      - ``qm_y``
3604      - Specifies the level in the quantizer matrix that should be used for
3605        luma plane decoding.
3606    * - __u8
3607      - ``qm_u``
3608      - Specifies the level in the quantizer matrix that should be used for
3609        chroma U plane decoding.
3610    * - __u8
3611      - ``qm_v``
3612      - Specifies the level in the quantizer matrix that should be used for
3613        chroma V plane decoding.
3614    * - __u8
3615      - ``delta_q_res``
3616      - Specifies the left shift which should be applied to decoded quantizer
3617        index delta values.
3618
3619.. _av1_quantization_flags:
3620
3621``AV1 Quantization Flags``
3622
3623.. cssclass:: longtable
3624
3625.. flat-table::
3626    :header-rows:  0
3627    :stub-columns: 0
3628    :widths:       1 1 2
3629
3630    * - ``V4L2_AV1_QUANTIZATION_FLAG_DIFF_UV_DELTA``
3631      - 0x00000001
3632      - If set, indicates that the U and V delta quantizer values are coded
3633        separately. If not set, indicates that the U and V delta quantizer
3634        values share a common value.
3635    * - ``V4L2_AV1_QUANTIZATION_FLAG_USING_QMATRIX``
3636      - 0x00000002
3637      - If set, specifies that the quantizer matrix will be used to compute
3638        quantizers.
3639    * - ``V4L2_AV1_QUANTIZATION_FLAG_DELTA_Q_PRESENT``
3640      - 0x00000004
3641      - Specifies whether quantizer index delta values are present.
3642
3643.. c:type:: v4l2_av1_tile_info
3644
3645AV1 Tile info as defined in section 6.8.14 "Tile info semantics" of ref:`av1`.
3646
3647.. cssclass:: longtable
3648
3649.. tabularcolumns:: |p{1.5cm}|p{5.8cm}|p{10.0cm}|
3650
3651.. flat-table:: struct v4l2_av1_tile_info
3652    :header-rows:  0
3653    :stub-columns: 0
3654    :widths:       1 1 2
3655
3656    * - __u8
3657      - ``flags``
3658      - See
3659        :ref:`AV1 Tile Info flags <av1_tile_info_flags>` for more details.
3660    * - __u8
3661      - ``context_update_tile_id``
3662      - Specifies which tile to use for the CDF update.
3663    * - __u8
3664      - ``tile_cols``
3665      - Specifies the number of tiles across the frame.
3666    * - __u8
3667      - ``tile_rows``
3668      - Specifies the number of tiles down the frame.
3669    * - __u32
3670      - ``mi_col_starts[V4L2_AV1_MAX_TILE_COLS + 1]``
3671      - An array specifying the start column (in units of 4x4 luma
3672        samples) for each tile across the image.
3673    * - __u32
3674      - ``mi_row_starts[V4L2_AV1_MAX_TILE_ROWS + 1]``
3675      - An array specifying the start row (in units of 4x4 luma
3676        samples) for each tile across the image.
3677    * - __u32
3678      - ``width_in_sbs_minus_1[V4L2_AV1_MAX_TILE_COLS]``
3679      - Specifies the width of a tile minus 1 in units of superblocks.
3680    * - __u32
3681      - ``height_in_sbs_minus_1[V4L2_AV1_MAX_TILE_ROWS]``
3682      - Specifies the height of a tile minus 1 in units of superblocks.
3683    * - __u8
3684      - ``tile_size_bytes``
3685      - Specifies the number of bytes needed to code each tile size.
3686    * - __u8
3687      - ``reserved[3]``
3688      - Applications and drivers must set this to zero.
3689
3690.. _av1_tile_info_flags:
3691
3692``AV1 Tile Info Flags``
3693
3694.. cssclass:: longtable
3695
3696.. flat-table::
3697    :header-rows:  0
3698    :stub-columns: 0
3699    :widths:       1 1 2
3700
3701    * - ``V4L2_AV1_TILE_INFO_FLAG_UNIFORM_TILE_SPACING``
3702      - 0x00000001
3703      - If set, means that the tiles are uniformly spaced across the frame. (In
3704        other words, all tiles are the same size except for the ones at the
3705        right and bottom edge which can be smaller). If not set means that the
3706        tile sizes are coded.
3707
3708.. c:type:: v4l2_av1_frame_type
3709
3710AV1 Frame Type
3711
3712.. raw:: latex
3713
3714    \scriptsize
3715
3716.. tabularcolumns:: |p{7.4cm}|p{0.3cm}|p{9.6cm}|
3717
3718.. flat-table::
3719    :header-rows:  0
3720    :stub-columns: 0
3721    :widths:       1 1 2
3722
3723    * - ``V4L2_AV1_KEY_FRAME``
3724      - 0
3725      - Key frame.
3726    * - ``V4L2_AV1_INTER_FRAME``
3727      - 1
3728      - Inter frame.
3729    * - ``V4L2_AV1_INTRA_ONLY_FRAME``
3730      - 2
3731      - Intra-only frame.
3732    * - ``V4L2_AV1_SWITCH_FRAME``
3733      - 3
3734      - Switch frame.
3735
3736.. c:type:: v4l2_av1_interpolation_filter
3737
3738AV1 Interpolation Filter
3739
3740.. raw:: latex
3741
3742    \scriptsize
3743
3744.. tabularcolumns:: |p{7.4cm}|p{0.3cm}|p{9.6cm}|
3745
3746.. flat-table::
3747    :header-rows:  0
3748    :stub-columns: 0
3749    :widths:       1 1 2
3750
3751    * - ``V4L2_AV1_INTERPOLATION_FILTER_EIGHTTAP``
3752      - 0
3753      - Eight tap filter.
3754    * - ``V4L2_AV1_INTERPOLATION_FILTER_EIGHTTAP_SMOOTH``
3755      - 1
3756      - Eight tap smooth filter.
3757    * - ``V4L2_AV1_INTERPOLATION_FILTER_EIGHTTAP_SHARP``
3758      - 2
3759      - Eight tap sharp filter.
3760    * - ``V4L2_AV1_INTERPOLATION_FILTER_BILINEAR``
3761      - 3
3762      - Bilinear filter.
3763    * - ``V4L2_AV1_INTERPOLATION_FILTER_SWITCHABLE``
3764      - 4
3765      - Filter selection is signaled at the block level.
3766
3767.. c:type:: v4l2_av1_tx_mode
3768
3769AV1 Tx mode as described in section 6.8.21 "TX mode semantics" of :ref:`av1`.
3770
3771.. raw:: latex
3772
3773    \scriptsize
3774
3775.. tabularcolumns:: |p{7.4cm}|p{0.3cm}|p{9.6cm}|
3776
3777.. flat-table::
3778    :header-rows:  0
3779    :stub-columns: 0
3780    :widths:       1 1 2
3781
3782    * - ``V4L2_AV1_TX_MODE_ONLY_4X4``
3783      - 0
3784      -  The inverse transform will use only 4x4 transforms.
3785    * - ``V4L2_AV1_TX_MODE_LARGEST``
3786      - 1
3787      - The inverse transform will use the largest transform size that fits
3788        inside the block.
3789    * - ``V4L2_AV1_TX_MODE_SELECT``
3790      - 2
3791      - The choice of transform size is specified explicitly for each block.
3792
3793``V4L2_CID_STATELESS_AV1_FRAME (struct)``
3794    Represents a Frame Header OBU. See 6.8 "Frame Header OBU semantics" of
3795    :ref:`av1` for more details.
3796
3797.. c:type:: v4l2_ctrl_av1_frame
3798
3799.. cssclass:: longtable
3800
3801.. tabularcolumns:: |p{5.8cm}|p{4.8cm}|p{6.6cm}|
3802
3803.. flat-table:: struct v4l2_ctrl_av1_frame
3804    :header-rows:  0
3805    :stub-columns: 0
3806    :widths:       1 1 2
3807
3808    * - struct :c:type:`v4l2_av1_tile_info`
3809      - ``tile_info``
3810      - Tile info
3811    * - struct :c:type:`v4l2_av1_quantization`
3812      - ``quantization``
3813      - Quantization parameters.
3814    * - __u8
3815      - ``superres_denom``
3816      - The denominator for the upscaling ratio.
3817    * - struct :c:type:`v4l2_av1_segmentation`
3818      - ``segmentation``
3819      - Segmentation parameters.
3820    * - struct :c:type:`v4l2_av1_loop_filter`
3821      - ``loop_filter``
3822      - Loop filter params
3823    * - struct :c:type:`v4l2_av1_cdef`
3824      - ``cdef``
3825      - CDEF params
3826    * - __u8
3827      - ``skip_mode_frame[2]``
3828      - Specifies the frames to use for compound prediction when skip_mode is
3829        equal to 1.
3830    * - __u8
3831      - ``primary_ref_frame``
3832      - Specifies which reference frame contains the CDF values and other state
3833        that should be loaded at the start of the frame.
3834    * - struct :c:type:`v4l2_av1_loop_restoration`
3835      - ``loop_restoration``
3836      - Loop restoration parameters.
3837    * - struct :c:type:`v4l2_av1_global_motion`
3838      - ``global_motion``
3839      - Global motion parameters.
3840    * - __u32
3841      - ``flags``
3842      - See
3843        :ref:`AV1 Frame flags <av1_frame_flags>` for more details.
3844    * - enum :c:type:`v4l2_av1_frame_type`
3845      - ``frame_type``
3846      - Specifies the AV1 frame type
3847    * - __u32
3848      - ``order_hint``
3849      - Specifies OrderHintBits least significant bits of the expected output
3850        order for this frame.
3851    * - __u32
3852      - ``upscaled_width``
3853      - The upscaled width.
3854    * - enum :c:type:`v4l2_av1_interpolation_filter`
3855      - ``interpolation_filter``
3856      - Specifies the filter selection used for performing inter prediction.
3857    * - enum :c:type:`v4l2_av1_tx_mode`
3858      - ``tx_mode``
3859      - Specifies how the transform size is determined.
3860    * - __u32
3861      - ``frame_width_minus_1``
3862      - Add 1 to get the frame's width.
3863    * - __u32
3864      - ``frame_height_minus_1``
3865      - Add 1 to get the frame's height.
3866    * - __u16
3867      - ``render_width_minus_1``
3868      - Add 1 to get the render width of the frame in luma samples.
3869    * - __u16
3870      - ``render_height_minus_1``
3871      - Add 1 to get the render height of the frame in luma samples.
3872    * - __u32
3873      - ``current_frame_id``
3874      - Specifies the frame id number for the current frame. Frame
3875        id numbers are additional information that do not affect the decoding
3876        process, but provide decoders with a way of detecting missing reference
3877        frames so that appropriate action can be taken.
3878    * - __u8
3879      - ``buffer_removal_time[V4L2_AV1_MAX_OPERATING_POINTS]``
3880      - Specifies the frame removal time in units of DecCT clock ticks counted
3881        from the removal time of the last random access point for operating point
3882        opNum.
3883    * - __u8
3884      - ``reserved[4]``
3885      - Applications and drivers must set this to zero.
3886    * - __u32
3887      - ``order_hints[V4L2_AV1_TOTAL_REFS_PER_FRAME]``
3888      - Specifies the expected output order hint for each reference frame.
3889        This field corresponds to the OrderHints variable from the specification
3890        (section 5.9.2  "Uncompressed header syntax"). As such, this is only
3891        used for non-intra frames and ignored otherwise. order_hints[0] is
3892        always ignored.
3893    * - __u64
3894      - ``reference_frame_ts[V4L2_AV1_TOTAL_REFS_PER_FRAME]``
3895      - The V4L2 timestamp for each of the reference frames enumerated in
3896        enum :c:type:`v4l2_av1_reference_frame` starting at
3897        ``V4L2_AV1_REF_LAST_FRAME``. This represents the state of reference
3898        slot as described in the spec and updated by userland through the
3899        "Reference frame update process" in section 7.20 The timestamp refers
3900        to the ``timestamp`` field in struct :c:type:`v4l2_buffer`. Use the
3901        :c:func:`v4l2_timeval_to_ns()` function to convert the struct
3902        :c:type:`timeval` in struct :c:type:`v4l2_buffer` to a __u64.
3903    * - __s8
3904      - ``ref_frame_idx[V4L2_AV1_REFS_PER_FRAME]``
3905      - An index into ``reference_frame_ts`` representing the ordered list of
3906        references used by inter-frame. Matches the bitstream syntax
3907        element of the same name.
3908    * - __u8
3909      - ``refresh_frame_flags``
3910      - Contains a bitmask that specifies which reference frame slots will be
3911        updated with the current frame after it is decoded.
3912
3913.. _av1_frame_flags:
3914
3915``AV1 Frame Flags``
3916
3917.. cssclass:: longtable
3918
3919.. flat-table::
3920    :header-rows:  0
3921    :stub-columns: 0
3922    :widths:       1 1 2
3923
3924    * - ``V4L2_AV1_FRAME_FLAG_SHOW_FRAME``
3925      - 0x00000001
3926      - If set, specifies that this frame should be immediately output once
3927        decoded. If not set, specifies that this frame should not be immediately
3928        output; it may be output later if a later uncompressed header uses
3929        show_existing_frame equal to 1.
3930    * - ``V4L2_AV1_FRAME_FLAG_SHOWABLE_FRAME``
3931      - 0x00000002
3932      - If set, specifies that the frame may be output using the
3933        show_existing_frame mechanism. If not set, specifies that this frame
3934        will not be output using the show_existing_frame mechanism.
3935    * - ``V4L2_AV1_FRAME_FLAG_ERROR_RESILIENT_MODE``
3936      - 0x00000004
3937      - Specifies whether error resilient mode is enabled.
3938    * - ``V4L2_AV1_FRAME_FLAG_DISABLE_CDF_UPDATE``
3939      - 0x00000008
3940      - Specifies whether the CDF update in the symbol decoding process should
3941        be disabled.
3942    * - ``V4L2_AV1_FRAME_FLAG_ALLOW_SCREEN_CONTENT_TOOLS``
3943      - 0x00000010
3944      - If set, indicates that intra blocks may use palette encoding. If not
3945        set, indicates that palette encoding is never used.
3946    * - ``V4L2_AV1_FRAME_FLAG_FORCE_INTEGER_MV``
3947      - 0x00000020
3948      - If set, specifies that motion vectors will always be integers. If not
3949        set, specifies that motion vectors can contain fractional bits.
3950    * - ``V4L2_AV1_FRAME_FLAG_ALLOW_INTRABC``
3951      - 0x00000040
3952      - If set, indicates that intra block copy may be used in this frame. If
3953        not set, indicates that intra block copy is not allowed in this frame.
3954    * - ``V4L2_AV1_FRAME_FLAG_USE_SUPERRES``
3955      - 0x00000080
3956      - If set, indicates that upscaling is needed.
3957    * - ``V4L2_AV1_FRAME_FLAG_ALLOW_HIGH_PRECISION_MV``
3958      - 0x00000100
3959      - If set, specifies that motion vectors are specified to eighth pel
3960        precision. If not set, specifies that motion vectors are specified to
3961        quarter pel precision;
3962    * - ``V4L2_AV1_FRAME_FLAG_IS_MOTION_MODE_SWITCHABLE``
3963      - 0x00000200
3964      - If not set, specifies that only the SIMPLE motion mode will be used.
3965    * - ``V4L2_AV1_FRAME_FLAG_USE_REF_FRAME_MVS``
3966      - 0x00000400
3967      - If set specifies that motion vector information from a previous frame
3968        can be used when decoding the current frame. If not set, specifies that
3969        this information will not be used.
3970    * - ``V4L2_AV1_FRAME_FLAG_DISABLE_FRAME_END_UPDATE_CDF``
3971      - 0x00000800
3972      - If set indicates that the end of frame CDF update is disabled. If not
3973        set, indicates that the end of frame CDF update is enabled
3974    * - ``V4L2_AV1_FRAME_FLAG_ALLOW_WARPED_MOTION``
3975      - 0x00001000
3976      - If set, indicates that the syntax element motion_mode may be present, if
3977        not set, indicates that the syntax element motion_mode will not be
3978        present.
3979    * - ``V4L2_AV1_FRAME_FLAG_REFERENCE_SELECT``
3980      - 0x00002000
3981      - If set, specifies that the mode info for inter blocks contains the
3982        syntax element comp_mode that indicates whether to use single or
3983        compound reference prediction. If not set, specifies that all inter
3984        blocks will use single prediction.
3985    * - ``V4L2_AV1_FRAME_FLAG_REDUCED_TX_SET``
3986      - 0x00004000
3987      - If set, specifies that the frame is restricted to a reduced subset of
3988        the full set of transform types.
3989    * - ``V4L2_AV1_FRAME_FLAG_SKIP_MODE_ALLOWED``
3990      - 0x00008000
3991      - This flag retains the same meaning as SkipModeAllowed in :ref:`av1`.
3992    * - ``V4L2_AV1_FRAME_FLAG_SKIP_MODE_PRESENT``
3993      - 0x00010000
3994      - If set, specifies that the syntax element skip_mode will be present, if
3995        not set, specifies that skip_mode will not be used for this frame.
3996    * - ``V4L2_AV1_FRAME_FLAG_FRAME_SIZE_OVERRIDE``
3997      - 0x00020000
3998      - If set, specifies that the frame size will either be specified as the
3999        size of one of the reference frames, or computed from the
4000        frame_width_minus_1 and frame_height_minus_1 syntax elements. If not
4001        set, specifies that the frame size is equal to the size in the sequence
4002        header.
4003    * - ``V4L2_AV1_FRAME_FLAG_BUFFER_REMOVAL_TIME_PRESENT``
4004      - 0x00040000
4005      - If set, specifies that buffer_removal_time is present. If not set,
4006        specifies that buffer_removal_time is not present.
4007    * - ``V4L2_AV1_FRAME_FLAG_FRAME_REFS_SHORT_SIGNALING``
4008      - 0x00080000
4009      - If set, indicates that only two reference frames are explicitly
4010        signaled. If not set, indicates that all reference frames are explicitly
4011        signaled.
4012
4013``V4L2_CID_STATELESS_AV1_FILM_GRAIN (struct)``
4014    Represents the optional film grain parameters. See section
4015    6.8.20 "Film grain params semantics" of :ref:`av1` for more details.
4016
4017.. c:type:: v4l2_ctrl_av1_film_grain
4018
4019.. cssclass:: longtable
4020
4021.. tabularcolumns:: |p{1.5cm}|p{5.8cm}|p{10.0cm}|
4022
4023.. flat-table:: struct v4l2_ctrl_av1_film_grain
4024    :header-rows:  0
4025    :stub-columns: 0
4026    :widths:       1 1 2
4027
4028    * - __u8
4029      - ``flags``
4030      - See :ref:`AV1 Film Grain Flags <av1_film_grain_flags>`.
4031    * - __u8
4032      - ``cr_mult``
4033      - Represents a multiplier for the cr component used in derivation of the
4034        input index to the cr component scaling function.
4035    * - __u16
4036      - ``grain_seed``
4037      - Specifies the starting value for the pseudo-random numbers used during
4038        film grain synthesis.
4039    * - __u8
4040      - ``film_grain_params_ref_idx``
4041      - Indicates which reference frame contains the film grain parameters to be
4042	used for this frame.
4043    * - __u8
4044      - ``num_y_points``
4045      - Specifies the number of points for the piece-wise linear scaling
4046        function of the luma component.
4047    * - __u8
4048      - ``point_y_value[V4L2_AV1_MAX_NUM_Y_POINTS]``
4049      - Represents the x (luma value) coordinate for the i-th point
4050        of the piecewise linear scaling function for luma component. The values
4051        are signaled on the scale of 0..255. In case of 10 bit video, these
4052        values correspond to luma values divided by 4. In case of 12 bit video,
4053        these values correspond to luma values divided by 16.
4054    * - __u8
4055      - ``point_y_scaling[V4L2_AV1_MAX_NUM_Y_POINTS]``
4056      - Represents the scaling (output) value for the i-th point
4057        of the piecewise linear scaling function for luma component.
4058    * - __u8
4059      - ``num_cb_points``
4060      -  Specifies the number of points for the piece-wise linear scaling
4061         function of the cb component.
4062    * - __u8
4063      - ``point_cb_value[V4L2_AV1_MAX_NUM_CB_POINTS]``
4064      - Represents the x coordinate for the i-th point of the
4065        piece-wise linear scaling function for cb component. The values are
4066        signaled on the scale of 0..255.
4067    * - __u8
4068      - ``point_cb_scaling[V4L2_AV1_MAX_NUM_CB_POINTS]``
4069      - Represents the scaling (output) value for the i-th point of the
4070        piecewise linear scaling function for cb component.
4071    * - __u8
4072      - ``num_cr_points``
4073      - Represents the number of points for the piece-wise
4074        linear scaling function of the cr component.
4075    * - __u8
4076      - ``point_cr_value[V4L2_AV1_MAX_NUM_CR_POINTS]``
4077      - Represents the x coordinate for the i-th point of the
4078        piece-wise linear scaling function for cr component. The values are
4079        signaled on the scale of 0..255.
4080    * - __u8
4081      - ``point_cr_scaling[V4L2_AV1_MAX_NUM_CR_POINTS]``
4082      - Represents the scaling (output) value for the i-th point of the
4083        piecewise linear scaling function for cr component.
4084    * - __u8
4085      - ``grain_scaling_minus_8``
4086      - Represents the shift - 8 applied to the values of the chroma component.
4087        The grain_scaling_minus_8 can take values of 0..3 and determines the
4088        range and quantization step of the standard deviation of film grain.
4089    * - __u8
4090      - ``ar_coeff_lag``
4091      - Specifies the number of auto-regressive coefficients for luma and
4092        chroma.
4093    * - __u8
4094      - ``ar_coeffs_y_plus_128[V4L2_AV1_AR_COEFFS_SIZE]``
4095      - Specifies auto-regressive coefficients used for the Y plane.
4096    * - __u8
4097      - ``ar_coeffs_cb_plus_128[V4L2_AV1_AR_COEFFS_SIZE]``
4098      - Specifies auto-regressive coefficients used for the U plane.
4099    * - __u8
4100      - ``ar_coeffs_cr_plus_128[V4L2_AV1_AR_COEFFS_SIZE]``
4101      - Specifies auto-regressive coefficients used for the V plane.
4102    * - __u8
4103      - ``ar_coeff_shift_minus_6``
4104      - Specifies the range of the auto-regressive coefficients. Values of 0,
4105        1, 2, and 3 correspond to the ranges for auto-regressive coefficients of
4106        [-2, 2), [-1, 1), [-0.5, 0.5) and [-0.25, 0.25) respectively.
4107    * - __u8
4108      - ``grain_scale_shift``
4109      - Specifies how much the Gaussian random numbers should be scaled down
4110        during the grain synthesis process.
4111    * - __u8
4112      - ``cb_mult``
4113      - Represents a multiplier for the cb component used in derivation of the
4114        input index to the cb component scaling function.
4115    * - __u8
4116      - ``cb_luma_mult``
4117      - Represents a multiplier for the average luma component used in
4118        derivation of the input index to the cb component scaling function..
4119    * - __u8
4120      - ``cr_luma_mult``
4121      - Represents a multiplier for the average luma component used in
4122        derivation of the input index to the cr component scaling function.
4123    * - __u16
4124      - ``cb_offset``
4125      - Represents an offset used in derivation of the input index to the
4126        cb component scaling function.
4127    * - __u16
4128      - ``cr_offset``
4129      - Represents an offset used in derivation of the input index to the
4130        cr component scaling function.
4131    * - __u8
4132      - ``reserved[4]``
4133      - Applications and drivers must set this to zero.
4134
4135.. _av1_film_grain_flags:
4136
4137``AV1 Film Grain Flags``
4138
4139.. cssclass:: longtable
4140
4141.. flat-table::
4142    :header-rows:  0
4143    :stub-columns: 0
4144    :widths:       1 1 2
4145
4146    * - ``V4L2_AV1_FILM_GRAIN_FLAG_APPLY_GRAIN``
4147      - 0x00000001
4148      - If set, specifies that film grain should be added to this frame. If not
4149        set, specifies that film grain should not be added.
4150    * - ``V4L2_AV1_FILM_GRAIN_FLAG_UPDATE_GRAIN``
4151      - 0x00000002
4152      - If set, means that a new set of parameters should be sent. If not set,
4153        specifies that the previous set of parameters should be used.
4154    * - ``V4L2_AV1_FILM_GRAIN_FLAG_CHROMA_SCALING_FROM_LUMA``
4155      - 0x00000004
4156      - If set, specifies that the chroma scaling is inferred from the luma
4157        scaling.
4158    * - ``V4L2_AV1_FILM_GRAIN_FLAG_OVERLAP``
4159      - 0x00000008
4160      - If set, indicates that the overlap between film grain blocks shall be
4161        applied. If not set, indicates that the overlap between film grain blocks
4162        shall not be applied.
4163    * - ``V4L2_AV1_FILM_GRAIN_FLAG_CLIP_TO_RESTRICTED_RANGE``
4164      - 0x00000010
4165      - If set, indicates that clipping to the restricted (studio, i.e. limited)
4166        range shall be applied to the sample values after adding the film grain
4167        (see the semantics for color_range for an explanation of studio swing).
4168        If not set, indicates that clipping to the full range shall be applied
4169        to the sample values after adding the film grain.
4170