xref: /linux/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst (revision 69050f8d6d075dc01af7a5f2f550a8067510366f)
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_CID_STATELESS_HEVC_EXT_SPS_LT_RPS (struct)``
2963    Subset of the :c:type:`v4l2_ctrl_hevc_sps` control.
2964    It extends it with the list of Long-term reference sets parameters.
2965    These parameters are defined according to :ref:`hevc`.
2966    They are described in section 7.4.3.2.1 "General sequence parameter set
2967    RBSP semantics" of the specification.
2968    This control is a dynamically sized 1-dimensional array.
2969    The values in the array should be ignored when either
2970    num_long_term_ref_pics_sps is 0 or the
2971    V4L2_HEVC_SPS_FLAG_LONG_TERM_REF_PICS_PRESENT flag is not set in
2972    :c:type:`v4l2_ctrl_hevc_sps`.
2973
2974.. c:type:: v4l2_ctrl_hevc_ext_sps_lt_rps
2975
2976.. cssclass:: longtable
2977
2978.. flat-table:: struct v4l2_ctrl_hevc_ext_sps_lt_rps
2979    :header-rows:  0
2980    :stub-columns: 0
2981    :widths:       1 1 2
2982
2983    * - __u16
2984      - ``lt_ref_pic_poc_lsb_sps``
2985      - Long term reference picture order count as described in section 7.4.3.2.1
2986        "General sequence parameter set RBSP semantics" of the specification.
2987    * - __u16
2988      - ``flags``
2989      - See :ref:`Extended Long-Term RPS Flags <hevc_ext_sps_lt_rps_flags>`
2990
2991.. _hevc_ext_sps_lt_rps_flags:
2992
2993``Extended SPS Long-Term RPS Flags``
2994
2995.. cssclass:: longtable
2996
2997.. flat-table::
2998    :header-rows:  0
2999    :stub-columns: 0
3000    :widths:       1 1 2
3001
3002    * - ``V4L2_HEVC_EXT_SPS_LT_RPS_FLAG_USED_LT``
3003      - 0x00000001
3004      - Specifies if the long-term reference picture is used 7.4.3.2.1 "General sequence parameter
3005        set RBSP semantics" of the specification.
3006
3007``V4L2_CID_STATELESS_HEVC_EXT_SPS_ST_RPS (struct)``
3008    Subset of the :c:type:`v4l2_ctrl_hevc_sps` control.
3009    It extends it with the list of Short-term reference sets parameters.
3010    These parameters are defined according to :ref:`hevc`.
3011    They are described in section 7.4.8 "Short-term reference picture set
3012    semantics" of the specification.
3013    This control is a dynamically sized 1-dimensional array.
3014    The values in the array should be ignored when
3015    num_short_term_ref_pic_sets is 0.
3016
3017.. c:type:: v4l2_ctrl_hevc_ext_sps_st_rps
3018
3019.. cssclass:: longtable
3020
3021.. flat-table:: struct v4l2_ctrl_hevc_ext_sps_st_rps
3022    :header-rows:  0
3023    :stub-columns: 0
3024    :widths:       1 1 2
3025
3026    * - __u8
3027      - ``delta_idx_minus1``
3028      - Specifies the delta compare to the index. See details in section 7.4.8 "Short-term
3029        reference picture set semantics" of the specification.
3030    * - __u8
3031      - ``delta_rps_sign``
3032      - Sign of the delta as specified in section 7.4.8 "Short-term reference picture set
3033        semantics" of the specification.
3034    * - __u8
3035      - ``num_negative_pics``
3036      - Number of short-term RPS entries that have picture order count values less than the
3037        picture order count value of the current picture.
3038    * - __u8
3039      - ``num_positive_pics``
3040      - Number of short-term RPS entries that have picture order count values greater than the
3041        picture order count value of the current picture.
3042    * - __u32
3043      - ``used_by_curr_pic``
3044      - Bit i specifies if short-term RPS i is used by the current picture.
3045    * - __u32
3046      - ``use_delta_flag``
3047      - Bit i specifies if short-term RPS i is included in the short-term RPS entries.
3048    * - __u16
3049      - ``abs_delta_rps_minus1``
3050      - Absolute delta RPS as specified in section 7.4.8 "Short-term reference picture set
3051        semantics" of the specification.
3052    * - __u16
3053      - ``delta_poc_s0_minus1[16]``
3054      - Specifies the negative picture order count delta for the i-th entry in the short-term RPS.
3055        See details in section 7.4.8 "Short-term reference picture set semantics" of the
3056        specification.
3057    * - __u16
3058      - ``delta_poc_s1_minus1[16]``
3059      - Specifies the positive picture order count delta for the i-th entry in the short-term RPS.
3060        See details in section 7.4.8 "Short-term reference picture set semantics" of the
3061        specification.
3062    * - __u16
3063      - ``flags``
3064      - See :ref:`Extended Short-Term RPS Flags <hevc_ext_sps_st_rps_flags>`
3065
3066.. _hevc_ext_sps_st_rps_flags:
3067
3068``Extended SPS Short-Term RPS Flags``
3069
3070.. cssclass:: longtable
3071
3072.. flat-table::
3073    :header-rows:  0
3074    :stub-columns: 0
3075    :widths:       1 1 2
3076
3077    * - ``V4L2_HEVC_EXT_SPS_ST_RPS_FLAG_INTER_REF_PIC_SET_PRED``
3078      - 0x00000001
3079      - Specifies if the short-term RPS is predicted from another short term RPS. See details in
3080        section 7.4.8 "Short-term reference picture set semantics" of the specification.
3081
3082.. _v4l2-codec-stateless-av1:
3083
3084``V4L2_CID_STATELESS_AV1_SEQUENCE (struct)``
3085    Represents an AV1 Sequence OBU (Open Bitstream Unit). See section 5.5
3086    "Sequence header OBU syntax" in :ref:`av1` for more details.
3087
3088.. c:type:: v4l2_ctrl_av1_sequence
3089
3090.. cssclass:: longtable
3091
3092.. tabularcolumns:: |p{5.8cm}|p{4.8cm}|p{6.6cm}|
3093
3094.. flat-table:: struct v4l2_ctrl_av1_sequence
3095    :header-rows:  0
3096    :stub-columns: 0
3097    :widths:       1 1 2
3098
3099    * - __u32
3100      - ``flags``
3101      - See :ref:`AV1 Sequence Flags <av1_sequence_flags>`.
3102    * - __u8
3103      - ``seq_profile``
3104      - Specifies the features that can be used in the coded video sequence.
3105    * - __u8
3106      - ``order_hint_bits``
3107      - Specifies the number of bits used for the order_hint field at each frame.
3108    * - __u8
3109      - ``bit_depth``
3110      - the bit depth to use for the sequence as described in section 5.5.2
3111        "Color config syntax" in :ref:`av1` for more details.
3112    * - __u8
3113      - ``reserved``
3114      - Applications and drivers must set this to zero.
3115    * - __u16
3116      - ``max_frame_width_minus_1``
3117      - Specifies the maximum frame width minus 1 for the frames represented by
3118        this sequence header.
3119    * - __u16
3120      - ``max_frame_height_minus_1``
3121      - Specifies the maximum frame height minus 1 for the frames represented by
3122        this sequence header.
3123
3124.. _av1_sequence_flags:
3125
3126``AV1 Sequence Flags``
3127
3128.. cssclass:: longtable
3129
3130.. flat-table::
3131    :header-rows:  0
3132    :stub-columns: 0
3133    :widths:       1 1 2
3134
3135    * - ``V4L2_AV1_SEQUENCE_FLAG_STILL_PICTURE``
3136      - 0x00000001
3137      - If set, specifies that the coded video sequence contains only one coded
3138        frame. If not set, specifies that the coded video sequence contains one
3139        or more coded frames.
3140    * - ``V4L2_AV1_SEQUENCE_FLAG_USE_128X128_SUPERBLOCK``
3141      - 0x00000002
3142      - If set, indicates that superblocks contain 128x128 luma samples.
3143        When equal to 0, it indicates that superblocks contain 64x64 luma
3144        samples. The number of contained chroma samples depends on
3145        subsampling_x and subsampling_y.
3146    * - ``V4L2_AV1_SEQUENCE_FLAG_ENABLE_FILTER_INTRA``
3147      - 0x00000004
3148      - If set, specifies that the use_filter_intra syntax element may be
3149        present. If not set, specifies that the use_filter_intra syntax element
3150        will not be present.
3151    * - ``V4L2_AV1_SEQUENCE_FLAG_ENABLE_INTRA_EDGE_FILTER``
3152      - 0x00000008
3153      - Specifies whether the intra edge filtering process should be enabled.
3154    * - ``V4L2_AV1_SEQUENCE_FLAG_ENABLE_INTERINTRA_COMPOUND``
3155      - 0x00000010
3156      - If set, specifies that the mode info for inter blocks may contain the
3157        syntax element interintra. If not set, specifies that the syntax element
3158        interintra will not be present.
3159    * - ``V4L2_AV1_SEQUENCE_FLAG_ENABLE_MASKED_COMPOUND``
3160      - 0x00000020
3161      - If set, specifies that the mode info for inter blocks may contain the
3162        syntax element compound_type. If not set, specifies that the syntax
3163        element compound_type will not be present.
3164    * - ``V4L2_AV1_SEQUENCE_FLAG_ENABLE_WARPED_MOTION``
3165      - 0x00000040
3166      - If set, indicates that the allow_warped_motion syntax element may be
3167        present. If not set, indicates that the allow_warped_motion syntax
3168        element will not be present.
3169    * - ``V4L2_AV1_SEQUENCE_FLAG_ENABLE_DUAL_FILTER``
3170      - 0x00000080
3171      - If set, indicates that the inter prediction filter type may be specified
3172        independently in the horizontal and vertical directions. If the flag is
3173        equal to 0, only one filter type may be specified, which is then used in
3174        both directions.
3175    * - ``V4L2_AV1_SEQUENCE_FLAG_ENABLE_ORDER_HINT``
3176      - 0x00000100
3177      - If set, indicates that tools based on the values of order hints may be
3178        used. If not set, indicates that tools based on order hints are
3179        disabled.
3180    * - ``V4L2_AV1_SEQUENCE_FLAG_ENABLE_JNT_COMP``
3181      - 0x00000200
3182      - If set, indicates that the distance weights process may be used for
3183        inter prediction.
3184    * - ``V4L2_AV1_SEQUENCE_FLAG_ENABLE_REF_FRAME_MVS``
3185      - 0x00000400
3186      - If set, indicates that the use_ref_frame_mvs syntax element may be
3187        present. If not set, indicates that the use_ref_frame_mvs syntax element
3188        will not be present.
3189    * - ``V4L2_AV1_SEQUENCE_FLAG_ENABLE_SUPERRES``
3190      - 0x00000800
3191      - If set, specifies that the use_superres syntax element will be present
3192        in the uncompressed header. If not set, specifies that the use_superres
3193        syntax element will not be present (instead use_superres will be set to
3194        0 in the uncompressed header without being read).
3195    * - ``V4L2_AV1_SEQUENCE_FLAG_ENABLE_CDEF``
3196      - 0x00001000
3197      - If set, specifies that cdef filtering may be enabled. If not set,
3198        specifies that cdef filtering is disabled.
3199    * - ``V4L2_AV1_SEQUENCE_FLAG_ENABLE_RESTORATION``
3200      - 0x00002000
3201      - If set, specifies that loop restoration filtering may be enabled. If not
3202        set, specifies that loop restoration filtering is disabled.
3203    * - ``V4L2_AV1_SEQUENCE_FLAG_MONO_CHROME``
3204      - 0x00004000
3205      - If set, indicates that the video does not contain U and V color planes.
3206        If not set, indicates that the video contains Y, U, and V color planes.
3207    * - ``V4L2_AV1_SEQUENCE_FLAG_COLOR_RANGE``
3208      - 0x00008000
3209      - If set, signals full swing representation, i.e. "Full Range
3210        Quantization". If not set, signals studio swing representation, i.e.
3211        "Limited Range Quantization".
3212    * - ``V4L2_AV1_SEQUENCE_FLAG_SUBSAMPLING_X``
3213      - 0x00010000
3214      - Specify the chroma subsampling format.
3215    * - ``V4L2_AV1_SEQUENCE_FLAG_SUBSAMPLING_Y``
3216      - 0x00020000
3217      - Specify the chroma subsampling format.
3218    * - ``V4L2_AV1_SEQUENCE_FLAG_FILM_GRAIN_PARAMS_PRESENT``
3219      - 0x00040000
3220      - Specifies whether film grain parameters are present in the coded video
3221        sequence.
3222    * - ``V4L2_AV1_SEQUENCE_FLAG_SEPARATE_UV_DELTA_Q``
3223      - 0x00080000
3224      - If set, indicates that the U and V planes may have separate delta
3225        quantizer values. If not set, indicates that the U and V planes will share
3226        the same delta quantizer value.
3227
3228``V4L2_CID_STATELESS_AV1_TILE_GROUP_ENTRY (struct)``
3229    Represents a single AV1 tile inside an AV1 Tile Group. Note that MiRowStart,
3230    MiRowEnd, MiColStart and MiColEnd can be retrieved from struct
3231    v4l2_av1_tile_info in struct v4l2_ctrl_av1_frame using tile_row and
3232    tile_col. See section 6.10.1 "General tile group OBU semantics" in
3233    :ref:`av1` for more details.
3234
3235.. c:type:: v4l2_ctrl_av1_tile_group_entry
3236
3237.. cssclass:: longtable
3238
3239.. tabularcolumns:: |p{5.8cm}|p{4.8cm}|p{6.6cm}|
3240
3241.. flat-table:: struct v4l2_ctrl_av1_tile_group_entry
3242    :header-rows:  0
3243    :stub-columns: 0
3244    :widths:       1 1 2
3245
3246    * - __u32
3247      - ``tile_offset``
3248      - Offset from the OBU data, i.e. where the coded tile data actually starts.
3249    * - __u32
3250      - ``tile_size``
3251      - Specifies the size in bytes of the coded tile. Equivalent to "TileSize"
3252        in :ref:`av1`.
3253    * - __u32
3254      - ``tile_row``
3255      - Specifies the row of the current tile. Equivalent to "TileRow" in
3256        :ref:`av1`.
3257    * - __u32
3258      - ``tile_col``
3259      - Specifies the column of the current tile. Equivalent to "TileColumn" in
3260        :ref:`av1`.
3261
3262.. c:type:: v4l2_av1_warp_model
3263
3264	AV1 Warp Model as described in section 3 "Symbols and abbreviated terms" of
3265	:ref:`av1`.
3266
3267.. raw:: latex
3268
3269    \scriptsize
3270
3271.. tabularcolumns:: |p{7.4cm}|p{0.3cm}|p{9.6cm}|
3272
3273.. flat-table::
3274    :header-rows:  0
3275    :stub-columns: 0
3276    :widths:       1 1 2
3277
3278    * - ``V4L2_AV1_WARP_MODEL_IDENTITY``
3279      - 0
3280      - Warp model is just an identity transform.
3281    * - ``V4L2_AV1_WARP_MODEL_TRANSLATION``
3282      - 1
3283      - Warp model is a pure translation.
3284    * - ``V4L2_AV1_WARP_MODEL_ROTZOOM``
3285      - 2
3286      - Warp model is a rotation + symmetric zoom + translation.
3287    * - ``V4L2_AV1_WARP_MODEL_AFFINE``
3288      - 3
3289      - Warp model is a general affine transform.
3290
3291.. c:type:: v4l2_av1_reference_frame
3292
3293AV1 Reference Frames as described in section 6.10.24 "Ref frames semantics"
3294of :ref:`av1`.
3295
3296.. raw:: latex
3297
3298    \scriptsize
3299
3300.. tabularcolumns:: |p{7.4cm}|p{0.3cm}|p{9.6cm}|
3301
3302.. flat-table::
3303    :header-rows:  0
3304    :stub-columns: 0
3305    :widths:       1 1 2
3306
3307    * - ``V4L2_AV1_REF_INTRA_FRAME``
3308      - 0
3309      - Intra Frame Reference.
3310    * - ``V4L2_AV1_REF_LAST_FRAME``
3311      - 1
3312      - Last Frame Reference.
3313    * - ``V4L2_AV1_REF_LAST2_FRAME``
3314      - 2
3315      - Last2 Frame Reference.
3316    * - ``V4L2_AV1_REF_LAST3_FRAME``
3317      - 3
3318      - Last3 Frame Reference.
3319    * - ``V4L2_AV1_REF_GOLDEN_FRAME``
3320      - 4
3321      - Golden Frame Reference.
3322    * - ``V4L2_AV1_REF_BWDREF_FRAME``
3323      - 5
3324      - BWD Frame Reference.
3325    * - ``V4L2_AV1_REF_ALTREF2_FRAME``
3326      - 6
3327      - ALTREF2 Frame Reference.
3328    * - ``V4L2_AV1_REF_ALTREF_FRAME``
3329      - 7
3330      - ALTREF Frame Reference.
3331
3332.. c:type:: v4l2_av1_global_motion
3333
3334AV1 Global Motion parameters as described in section 6.8.17
3335"Global motion params semantics" of :ref:`av1`.
3336
3337.. cssclass:: longtable
3338
3339.. tabularcolumns:: |p{1.5cm}|p{5.8cm}|p{10.0cm}|
3340
3341.. flat-table:: struct v4l2_av1_global_motion
3342    :header-rows:  0
3343    :stub-columns: 0
3344    :widths:       1 1 2
3345
3346    * - __u8
3347      - ``flags[V4L2_AV1_TOTAL_REFS_PER_FRAME]``
3348      - A bitfield containing the flags per reference frame. See
3349        :ref:`AV1 Global Motion Flags <av1_global_motion_flags>` for more
3350        details.
3351    * - enum :c:type:`v4l2_av1_warp_model`
3352      - ``type[V4L2_AV1_TOTAL_REFS_PER_FRAME]``
3353      - The type of global motion transform used.
3354    * - __s32
3355      - ``params[V4L2_AV1_TOTAL_REFS_PER_FRAME][6]``
3356      - This field has the same meaning as "gm_params" in :ref:`av1`.
3357    * - __u8
3358      - ``invalid``
3359      - Bitfield indicating whether the global motion params are invalid for a
3360        given reference frame. See section 7.11.3.6 Setup shear process and the
3361        variable "warpValid". Use V4L2_AV1_GLOBAL_MOTION_IS_INVALID(ref) to
3362        create a suitable mask.
3363    * - __u8
3364      - ``reserved[3]``
3365      - Applications and drivers must set this to zero.
3366
3367.. _av1_global_motion_flags:
3368
3369``AV1 Global Motion Flags``
3370
3371.. cssclass:: longtable
3372
3373.. flat-table::
3374    :header-rows:  0
3375    :stub-columns: 0
3376    :widths:       1 1 2
3377
3378    * - ``V4L2_AV1_GLOBAL_MOTION_FLAG_IS_GLOBAL``
3379      - 0x00000001
3380      - Specifies whether global motion parameters are present for a particular
3381        reference frame.
3382    * - ``V4L2_AV1_GLOBAL_MOTION_FLAG_IS_ROT_ZOOM``
3383      - 0x00000002
3384      - Specifies whether a particular reference frame uses rotation and zoom
3385        global motion.
3386    * - ``V4L2_AV1_GLOBAL_MOTION_FLAG_IS_TRANSLATION``
3387      - 0x00000004
3388      - Specifies whether a particular reference frame uses translation global
3389        motion
3390
3391.. c:type:: v4l2_av1_frame_restoration_type
3392
3393AV1 Frame Restoration Type.
3394
3395.. raw:: latex
3396
3397    \scriptsize
3398
3399.. tabularcolumns:: |p{7.4cm}|p{0.3cm}|p{9.6cm}|
3400
3401.. flat-table::
3402    :header-rows:  0
3403    :stub-columns: 0
3404    :widths:       1 1 2
3405
3406    * - ``V4L2_AV1_FRAME_RESTORE_NONE``
3407      - 0
3408      - No filtering is applied.
3409    * - ``V4L2_AV1_FRAME_RESTORE_WIENER``
3410      - 1
3411      - Wiener filter process is invoked.
3412    * - ``V4L2_AV1_FRAME_RESTORE_SGRPROJ``
3413      - 2
3414      - Self guided filter process is invoked.
3415    * - ``V4L2_AV1_FRAME_RESTORE_SWITCHABLE``
3416      - 3
3417      - Restoration filter is swichtable.
3418
3419.. c:type:: v4l2_av1_loop_restoration
3420
3421AV1 Loop Restoration as described in section 6.10.15 "Loop restoration params
3422semantics" of :ref:`av1`.
3423
3424.. cssclass:: longtable
3425
3426.. tabularcolumns:: |p{1.5cm}|p{5.8cm}|p{10.0cm}|
3427
3428.. flat-table:: struct v4l2_av1_loop_restoration
3429    :header-rows:  0
3430    :stub-columns: 0
3431    :widths:       1 1 2
3432
3433    * - __u8
3434      - ``flags``
3435      - See :ref:`AV1 Loop Restoration Flags <av1_loop_restoration_flags>`.
3436    * - __u8
3437      - ``lr_unit_shift``
3438      - Specifies if the luma restoration size should be halved.
3439    * - __u8
3440      - ``lr_uv_shift``
3441      - Specifies if the chroma size should be half the luma size.
3442    * - __u8
3443      - ``reserved``
3444      - Applications and drivers must set this to zero.
3445    * - :c:type:`v4l2_av1_frame_restoration_type`
3446      - ``frame_restoration_type[V4L2_AV1_NUM_PLANES_MAX]``
3447      - Specifies the type of restoration used for each plane.
3448    * - __u8
3449      - ``loop_restoration_size[V4L2_AV1_MAX_NUM_PLANES]``
3450      - Specifies the size of loop restoration units in units of samples in the
3451        current plane.
3452
3453.. _av1_loop_restoration_flags:
3454
3455``AV1 Loop Restoration Flags``
3456
3457.. cssclass:: longtable
3458
3459.. flat-table::
3460    :header-rows:  0
3461    :stub-columns: 0
3462    :widths:       1 1 2
3463
3464    * - ``V4L2_AV1_LOOP_RESTORATION_FLAG_USES_LR``
3465      - 0x00000001
3466      - Retains the same meaning as UsesLr in :ref:`av1`.
3467    * - ``V4L2_AV1_LOOP_RESTORATION_FLAG_USES_CHROMA_LR``
3468      - 0x00000002
3469      - Retains the same meaning as UsesChromaLr in :ref:`av1`.
3470
3471.. c:type:: v4l2_av1_cdef
3472
3473AV1 CDEF params semantics as described in section 6.10.14 "CDEF params
3474semantics" of :ref:`av1`.
3475
3476.. cssclass:: longtable
3477
3478.. tabularcolumns:: |p{1.5cm}|p{5.8cm}|p{10.0cm}|
3479
3480.. flat-table:: struct v4l2_av1_cdef
3481    :header-rows:  0
3482    :stub-columns: 0
3483    :widths:       1 1 2
3484
3485    * - __u8
3486      - ``damping_minus_3``
3487      - Controls the amount of damping in the deringing filter.
3488    * - __u8
3489      - ``bits``
3490      - Specifies the number of bits needed to specify which CDEF filter to
3491        apply.
3492    * - __u8
3493      - ``y_pri_strength[V4L2_AV1_CDEF_MAX]``
3494      -  Specifies the strength of the primary filter.
3495    * - __u8
3496      - ``y_sec_strength[V4L2_AV1_CDEF_MAX]``
3497      -  Specifies the strength of the secondary filter.
3498    * - __u8
3499      - ``uv_pri_strength[V4L2_AV1_CDEF_MAX]``
3500      -  Specifies the strength of the primary filter.
3501    * - __u8
3502      - ``uv_sec_strength[V4L2_AV1_CDEF_MAX]``
3503      -  Specifies the strength of the secondary filter.
3504
3505.. c:type:: v4l2_av1_segment_feature
3506
3507AV1 segment features as described in section 3 "Symbols and abbreviated terms"
3508of :ref:`av1`.
3509
3510.. raw:: latex
3511
3512    \scriptsize
3513
3514.. tabularcolumns:: |p{7.4cm}|p{0.3cm}|p{9.6cm}|
3515
3516.. flat-table::
3517    :header-rows:  0
3518    :stub-columns: 0
3519    :widths:       1 1 2
3520
3521    * - ``V4L2_AV1_SEG_LVL_ALT_Q``
3522      - 0
3523      - Index for quantizer segment feature.
3524    * - ``V4L2_AV1_SEG_LVL_ALT_LF_Y_V``
3525      - 1
3526      - Index for vertical luma loop filter segment feature.
3527    * - ``V4L2_AV1_SEG_LVL_REF_FRAME``
3528      - 5
3529      - Index for reference frame segment feature.
3530    * - ``V4L2_AV1_SEG_LVL_REF_SKIP``
3531      - 6
3532      - Index for skip segment feature.
3533    * - ``V4L2_AV1_SEG_LVL_REF_GLOBALMV``
3534      - 7
3535      - Index for global mv feature.
3536    * - ``V4L2_AV1_SEG_LVL_MAX``
3537      - 8
3538      - Number of segment features.
3539
3540.. c:type:: v4l2_av1_segmentation
3541
3542AV1 Segmentation params as defined in section 6.8.13 "Segmentation params
3543semantics" of :ref:`av1`.
3544
3545.. cssclass:: longtable
3546
3547.. tabularcolumns:: |p{1.5cm}|p{5.8cm}|p{10.0cm}|
3548
3549.. flat-table:: struct v4l2_av1_segmentation
3550    :header-rows:  0
3551    :stub-columns: 0
3552    :widths:       1 1 2
3553
3554    * - __u8
3555      - ``flags``
3556      - See :ref:`AV1 Segmentation Flags <av1_segmentation_flags>`
3557    * - __u8
3558      - ``last_active_seg_id``
3559      -  Indicates the highest numbered segment id that has some
3560         enabled feature. This is used when decoding the segment id to only decode
3561         choices corresponding to used segments.
3562    * - __u8
3563      - ``feature_enabled[V4L2_AV1_MAX_SEGMENTS]``
3564      - Bitmask defining which features are enabled in each segment. Use
3565        V4L2_AV1_SEGMENT_FEATURE_ENABLED to build a suitable mask.
3566    * - __u16
3567      - ``feature_data[V4L2_AV1_MAX_SEGMENTS][V4L2_AV1_SEG_LVL_MAX]``
3568      -  Data attached to each feature. Data entry is only valid if the feature
3569         is enabled.
3570
3571.. _av1_segmentation_flags:
3572
3573``AV1 Segmentation Flags``
3574
3575.. cssclass:: longtable
3576
3577.. flat-table::
3578    :header-rows:  0
3579    :stub-columns: 0
3580    :widths:       1 1 2
3581
3582    * - ``V4L2_AV1_SEGMENTATION_FLAG_ENABLED``
3583      - 0x00000001
3584      - If set, indicates that this frame makes use of the segmentation tool. If
3585        not set, indicates that the frame does not use segmentation.
3586    * - ``V4L2_AV1_SEGMENTATION_FLAG_UPDATE_MAP``
3587      - 0x00000002
3588      - If set, indicates that the segmentation map are updated during the
3589        decoding of this frame. If not set, indicates that the segmentation map
3590        from the previous frame is used.
3591    * - ``V4L2_AV1_SEGMENTATION_FLAG_TEMPORAL_UPDATE``
3592      - 0x00000004
3593      - If set, indicates that the updates to the segmentation map are coded
3594        relative to the existing segmentation map. If not set, indicates that
3595        the new segmentation map is coded without reference to the existing
3596        segmentation map.
3597    * - ``V4L2_AV1_SEGMENTATION_FLAG_UPDATE_DATA``
3598      - 0x00000008
3599      - If set, indicates that the updates to the segmentation map are coded
3600        relative to the existing segmentation map. If not set, indicates that
3601        the new segmentation map is coded without reference to the existing
3602        segmentation map.
3603    * - ``V4L2_AV1_SEGMENTATION_FLAG_SEG_ID_PRE_SKIP``
3604      - 0x00000010
3605      - If set, indicates that the segment id will be read before the skip
3606        syntax element. If not set, indicates that the skip syntax element will
3607        be read first.
3608
3609.. c:type:: v4l2_av1_loop_filter
3610
3611AV1 Loop filter params as defined in section 6.8.10 "Loop filter semantics" of
3612:ref:`av1`.
3613
3614.. cssclass:: longtable
3615
3616.. tabularcolumns:: |p{1.5cm}|p{5.8cm}|p{10.0cm}|
3617
3618.. flat-table:: struct v4l2_av1_loop_filter
3619    :header-rows:  0
3620    :stub-columns: 0
3621    :widths:       1 1 2
3622
3623    * - __u8
3624      - ``flags``
3625      - See
3626        :ref:`AV1 Loop Filter flags <av1_loop_filter_flags>` for more details.
3627    * - __u8
3628      - ``level[4]``
3629      - An array containing loop filter strength values. Different loop
3630        filter strength values from the array are used depending on the image
3631        plane being filtered, and the edge direction (vertical or horizontal)
3632        being filtered.
3633    * - __u8
3634      - ``sharpness``
3635      - indicates the sharpness level. The loop_filter_level and
3636        loop_filter_sharpness together determine when a block edge is filtered,
3637        and by how much the filtering can change the sample values. The loop
3638        filter process is described in section 7.14 of :ref:`av1`.
3639    * - __u8
3640      - ``ref_deltas[V4L2_AV1_TOTAL_REFS_PER_FRAME]``
3641      - contains the adjustment needed for the filter level based on the
3642        chosen reference frame. If this syntax element is not present, it
3643        maintains its previous value.
3644    * - __u8
3645      - ``mode_deltas[2]``
3646      - contains the adjustment needed for the filter level based on
3647        the chosen mode. If this syntax element is not present, it maintains its
3648        previous value.
3649    * - __u8
3650      - ``delta_lf_res``
3651      - specifies the left shift which should be applied to decoded loop filter
3652        delta values.
3653
3654.. _av1_loop_filter_flags:
3655
3656``AV1 Loop Filter Flags``
3657
3658.. cssclass:: longtable
3659
3660.. flat-table::
3661    :header-rows:  0
3662    :stub-columns: 0
3663    :widths:       1 1 2
3664
3665    * - ``V4L2_AV1_LOOP_FILTER_FLAG_DELTA_ENABLED``
3666      - 0x00000001
3667      - If set, means that the filter level depends on the mode and reference
3668        frame used to predict a block. If not set, means that the filter level
3669        does not depend on the mode and reference frame.
3670    * - ``V4L2_AV1_LOOP_FILTER_FLAG_DELTA_UPDATE``
3671      - 0x00000002
3672      - If set, means that additional syntax elements are present that specify
3673        which mode and reference frame deltas are to be updated. If not set,
3674        means that these syntax elements are not present.
3675    * - ``V4L2_AV1_LOOP_FILTER_FLAG_DELTA_LF_PRESENT``
3676      - 0x00000004
3677      - Specifies whether loop filter delta values are present
3678    * - ``V4L2_AV1_LOOP_FILTER_FLAG_DELTA_LF_MULTI``
3679      - 0x00000008
3680      - A value equal to 1 specifies that separate loop filter
3681        deltas are sent for horizontal luma edges, vertical luma edges,
3682        the U edges, and the V edges. A value of delta_lf_multi equal to 0
3683        specifies that the same loop filter delta is used for all edges.
3684
3685.. c:type:: v4l2_av1_quantization
3686
3687AV1 Quantization params as defined in section 6.8.11 "Quantization params
3688semantics" of :ref:`av1`.
3689
3690.. cssclass:: longtable
3691
3692.. tabularcolumns:: |p{1.5cm}|p{5.8cm}|p{10.0cm}|
3693
3694.. flat-table:: struct v4l2_av1_quantization
3695    :header-rows:  0
3696    :stub-columns: 0
3697    :widths:       1 1 2
3698
3699    * - __u8
3700      - ``flags``
3701      - See
3702        :ref:`AV1 Loop Filter flags <av1_quantization_flags>` for more details.
3703    * - __u8
3704      - ``base_q_idx``
3705      - Indicates the base frame qindex. This is used for Y AC coefficients and
3706        as the base value for the other quantizers.
3707    * - __u8
3708      - ``delta_q_y_dc``
3709      - Indicates the Y DC quantizer relative to base_q_idx.
3710    * - __u8
3711      - ``delta_q_u_dc``
3712      - Indicates the U DC quantizer relative to base_q_idx.
3713    * - __u8
3714      - ``delta_q_u_ac``
3715      - Indicates the U AC quantizer relative to base_q_idx.
3716    * - __u8
3717      - ``delta_q_v_dc``
3718      - Indicates the V DC quantizer relative to base_q_idx.
3719    * - __u8
3720      - ``delta_q_v_ac``
3721      - Indicates the V AC quantizer relative to base_q_idx.
3722    * - __u8
3723      - ``qm_y``
3724      - Specifies the level in the quantizer matrix that should be used for
3725        luma plane decoding.
3726    * - __u8
3727      - ``qm_u``
3728      - Specifies the level in the quantizer matrix that should be used for
3729        chroma U plane decoding.
3730    * - __u8
3731      - ``qm_v``
3732      - Specifies the level in the quantizer matrix that should be used for
3733        chroma V plane decoding.
3734    * - __u8
3735      - ``delta_q_res``
3736      - Specifies the left shift which should be applied to decoded quantizer
3737        index delta values.
3738
3739.. _av1_quantization_flags:
3740
3741``AV1 Quantization Flags``
3742
3743.. cssclass:: longtable
3744
3745.. flat-table::
3746    :header-rows:  0
3747    :stub-columns: 0
3748    :widths:       1 1 2
3749
3750    * - ``V4L2_AV1_QUANTIZATION_FLAG_DIFF_UV_DELTA``
3751      - 0x00000001
3752      - If set, indicates that the U and V delta quantizer values are coded
3753        separately. If not set, indicates that the U and V delta quantizer
3754        values share a common value.
3755    * - ``V4L2_AV1_QUANTIZATION_FLAG_USING_QMATRIX``
3756      - 0x00000002
3757      - If set, specifies that the quantizer matrix will be used to compute
3758        quantizers.
3759    * - ``V4L2_AV1_QUANTIZATION_FLAG_DELTA_Q_PRESENT``
3760      - 0x00000004
3761      - Specifies whether quantizer index delta values are present.
3762
3763.. c:type:: v4l2_av1_tile_info
3764
3765AV1 Tile info as defined in section 6.8.14 "Tile info semantics" of ref:`av1`.
3766
3767.. cssclass:: longtable
3768
3769.. tabularcolumns:: |p{1.5cm}|p{5.8cm}|p{10.0cm}|
3770
3771.. flat-table:: struct v4l2_av1_tile_info
3772    :header-rows:  0
3773    :stub-columns: 0
3774    :widths:       1 1 2
3775
3776    * - __u8
3777      - ``flags``
3778      - See
3779        :ref:`AV1 Tile Info flags <av1_tile_info_flags>` for more details.
3780    * - __u8
3781      - ``context_update_tile_id``
3782      - Specifies which tile to use for the CDF update.
3783    * - __u8
3784      - ``tile_cols``
3785      - Specifies the number of tiles across the frame.
3786    * - __u8
3787      - ``tile_rows``
3788      - Specifies the number of tiles down the frame.
3789    * - __u32
3790      - ``mi_col_starts[V4L2_AV1_MAX_TILE_COLS + 1]``
3791      - An array specifying the start column (in units of 4x4 luma
3792        samples) for each tile across the image.
3793    * - __u32
3794      - ``mi_row_starts[V4L2_AV1_MAX_TILE_ROWS + 1]``
3795      - An array specifying the start row (in units of 4x4 luma
3796        samples) for each tile across the image.
3797    * - __u32
3798      - ``width_in_sbs_minus_1[V4L2_AV1_MAX_TILE_COLS]``
3799      - Specifies the width of a tile minus 1 in units of superblocks.
3800    * - __u32
3801      - ``height_in_sbs_minus_1[V4L2_AV1_MAX_TILE_ROWS]``
3802      - Specifies the height of a tile minus 1 in units of superblocks.
3803    * - __u8
3804      - ``tile_size_bytes``
3805      - Specifies the number of bytes needed to code each tile size.
3806    * - __u8
3807      - ``reserved[3]``
3808      - Applications and drivers must set this to zero.
3809
3810.. _av1_tile_info_flags:
3811
3812``AV1 Tile Info Flags``
3813
3814.. cssclass:: longtable
3815
3816.. flat-table::
3817    :header-rows:  0
3818    :stub-columns: 0
3819    :widths:       1 1 2
3820
3821    * - ``V4L2_AV1_TILE_INFO_FLAG_UNIFORM_TILE_SPACING``
3822      - 0x00000001
3823      - If set, means that the tiles are uniformly spaced across the frame. (In
3824        other words, all tiles are the same size except for the ones at the
3825        right and bottom edge which can be smaller). If not set means that the
3826        tile sizes are coded.
3827
3828.. c:type:: v4l2_av1_frame_type
3829
3830AV1 Frame Type
3831
3832.. raw:: latex
3833
3834    \scriptsize
3835
3836.. tabularcolumns:: |p{7.4cm}|p{0.3cm}|p{9.6cm}|
3837
3838.. flat-table::
3839    :header-rows:  0
3840    :stub-columns: 0
3841    :widths:       1 1 2
3842
3843    * - ``V4L2_AV1_KEY_FRAME``
3844      - 0
3845      - Key frame.
3846    * - ``V4L2_AV1_INTER_FRAME``
3847      - 1
3848      - Inter frame.
3849    * - ``V4L2_AV1_INTRA_ONLY_FRAME``
3850      - 2
3851      - Intra-only frame.
3852    * - ``V4L2_AV1_SWITCH_FRAME``
3853      - 3
3854      - Switch frame.
3855
3856.. c:type:: v4l2_av1_interpolation_filter
3857
3858AV1 Interpolation Filter
3859
3860.. raw:: latex
3861
3862    \scriptsize
3863
3864.. tabularcolumns:: |p{7.4cm}|p{0.3cm}|p{9.6cm}|
3865
3866.. flat-table::
3867    :header-rows:  0
3868    :stub-columns: 0
3869    :widths:       1 1 2
3870
3871    * - ``V4L2_AV1_INTERPOLATION_FILTER_EIGHTTAP``
3872      - 0
3873      - Eight tap filter.
3874    * - ``V4L2_AV1_INTERPOLATION_FILTER_EIGHTTAP_SMOOTH``
3875      - 1
3876      - Eight tap smooth filter.
3877    * - ``V4L2_AV1_INTERPOLATION_FILTER_EIGHTTAP_SHARP``
3878      - 2
3879      - Eight tap sharp filter.
3880    * - ``V4L2_AV1_INTERPOLATION_FILTER_BILINEAR``
3881      - 3
3882      - Bilinear filter.
3883    * - ``V4L2_AV1_INTERPOLATION_FILTER_SWITCHABLE``
3884      - 4
3885      - Filter selection is signaled at the block level.
3886
3887.. c:type:: v4l2_av1_tx_mode
3888
3889AV1 Tx mode as described in section 6.8.21 "TX mode semantics" of :ref:`av1`.
3890
3891.. raw:: latex
3892
3893    \scriptsize
3894
3895.. tabularcolumns:: |p{7.4cm}|p{0.3cm}|p{9.6cm}|
3896
3897.. flat-table::
3898    :header-rows:  0
3899    :stub-columns: 0
3900    :widths:       1 1 2
3901
3902    * - ``V4L2_AV1_TX_MODE_ONLY_4X4``
3903      - 0
3904      -  The inverse transform will use only 4x4 transforms.
3905    * - ``V4L2_AV1_TX_MODE_LARGEST``
3906      - 1
3907      - The inverse transform will use the largest transform size that fits
3908        inside the block.
3909    * - ``V4L2_AV1_TX_MODE_SELECT``
3910      - 2
3911      - The choice of transform size is specified explicitly for each block.
3912
3913``V4L2_CID_STATELESS_AV1_FRAME (struct)``
3914    Represents a Frame Header OBU. See 6.8 "Frame Header OBU semantics" of
3915    :ref:`av1` for more details.
3916
3917.. c:type:: v4l2_ctrl_av1_frame
3918
3919.. cssclass:: longtable
3920
3921.. tabularcolumns:: |p{5.8cm}|p{4.8cm}|p{6.6cm}|
3922
3923.. flat-table:: struct v4l2_ctrl_av1_frame
3924    :header-rows:  0
3925    :stub-columns: 0
3926    :widths:       1 1 2
3927
3928    * - struct :c:type:`v4l2_av1_tile_info`
3929      - ``tile_info``
3930      - Tile info
3931    * - struct :c:type:`v4l2_av1_quantization`
3932      - ``quantization``
3933      - Quantization parameters.
3934    * - __u8
3935      - ``superres_denom``
3936      - The denominator for the upscaling ratio.
3937    * - struct :c:type:`v4l2_av1_segmentation`
3938      - ``segmentation``
3939      - Segmentation parameters.
3940    * - struct :c:type:`v4l2_av1_loop_filter`
3941      - ``loop_filter``
3942      - Loop filter params
3943    * - struct :c:type:`v4l2_av1_cdef`
3944      - ``cdef``
3945      - CDEF params
3946    * - __u8
3947      - ``skip_mode_frame[2]``
3948      - Specifies the frames to use for compound prediction when skip_mode is
3949        equal to 1.
3950    * - __u8
3951      - ``primary_ref_frame``
3952      - Specifies which reference frame contains the CDF values and other state
3953        that should be loaded at the start of the frame.
3954    * - struct :c:type:`v4l2_av1_loop_restoration`
3955      - ``loop_restoration``
3956      - Loop restoration parameters.
3957    * - struct :c:type:`v4l2_av1_global_motion`
3958      - ``global_motion``
3959      - Global motion parameters.
3960    * - __u32
3961      - ``flags``
3962      - See
3963        :ref:`AV1 Frame flags <av1_frame_flags>` for more details.
3964    * - enum :c:type:`v4l2_av1_frame_type`
3965      - ``frame_type``
3966      - Specifies the AV1 frame type
3967    * - __u32
3968      - ``order_hint``
3969      - Specifies OrderHintBits least significant bits of the expected output
3970        order for this frame.
3971    * - __u32
3972      - ``upscaled_width``
3973      - The upscaled width.
3974    * - enum :c:type:`v4l2_av1_interpolation_filter`
3975      - ``interpolation_filter``
3976      - Specifies the filter selection used for performing inter prediction.
3977    * - enum :c:type:`v4l2_av1_tx_mode`
3978      - ``tx_mode``
3979      - Specifies how the transform size is determined.
3980    * - __u32
3981      - ``frame_width_minus_1``
3982      - Add 1 to get the frame's width.
3983    * - __u32
3984      - ``frame_height_minus_1``
3985      - Add 1 to get the frame's height.
3986    * - __u16
3987      - ``render_width_minus_1``
3988      - Add 1 to get the render width of the frame in luma samples.
3989    * - __u16
3990      - ``render_height_minus_1``
3991      - Add 1 to get the render height of the frame in luma samples.
3992    * - __u32
3993      - ``current_frame_id``
3994      - Specifies the frame id number for the current frame. Frame
3995        id numbers are additional information that do not affect the decoding
3996        process, but provide decoders with a way of detecting missing reference
3997        frames so that appropriate action can be taken.
3998    * - __u8
3999      - ``buffer_removal_time[V4L2_AV1_MAX_OPERATING_POINTS]``
4000      - Specifies the frame removal time in units of DecCT clock ticks counted
4001        from the removal time of the last random access point for operating point
4002        opNum.
4003    * - __u8
4004      - ``reserved[4]``
4005      - Applications and drivers must set this to zero.
4006    * - __u32
4007      - ``order_hints[V4L2_AV1_TOTAL_REFS_PER_FRAME]``
4008      - Specifies the expected output order hint for each reference frame.
4009        This field corresponds to the OrderHints variable from the specification
4010        (section 5.9.2  "Uncompressed header syntax"). As such, this is only
4011        used for non-intra frames and ignored otherwise. order_hints[0] is
4012        always ignored.
4013    * - __u64
4014      - ``reference_frame_ts[V4L2_AV1_TOTAL_REFS_PER_FRAME]``
4015      - The V4L2 timestamp for each of the reference frames enumerated in
4016        enum :c:type:`v4l2_av1_reference_frame` starting at
4017        ``V4L2_AV1_REF_LAST_FRAME``. This represents the state of reference
4018        slot as described in the spec and updated by userland through the
4019        "Reference frame update process" in section 7.20 The timestamp refers
4020        to the ``timestamp`` field in struct :c:type:`v4l2_buffer`. Use the
4021        :c:func:`v4l2_timeval_to_ns()` function to convert the struct
4022        :c:type:`timeval` in struct :c:type:`v4l2_buffer` to a __u64.
4023    * - __s8
4024      - ``ref_frame_idx[V4L2_AV1_REFS_PER_FRAME]``
4025      - An index into ``reference_frame_ts`` representing the ordered list of
4026        references used by inter-frame. Matches the bitstream syntax
4027        element of the same name.
4028    * - __u8
4029      - ``refresh_frame_flags``
4030      - Contains a bitmask that specifies which reference frame slots will be
4031        updated with the current frame after it is decoded.
4032
4033.. _av1_frame_flags:
4034
4035``AV1 Frame Flags``
4036
4037.. cssclass:: longtable
4038
4039.. flat-table::
4040    :header-rows:  0
4041    :stub-columns: 0
4042    :widths:       1 1 2
4043
4044    * - ``V4L2_AV1_FRAME_FLAG_SHOW_FRAME``
4045      - 0x00000001
4046      - If set, specifies that this frame should be immediately output once
4047        decoded. If not set, specifies that this frame should not be immediately
4048        output; it may be output later if a later uncompressed header uses
4049        show_existing_frame equal to 1.
4050    * - ``V4L2_AV1_FRAME_FLAG_SHOWABLE_FRAME``
4051      - 0x00000002
4052      - If set, specifies that the frame may be output using the
4053        show_existing_frame mechanism. If not set, specifies that this frame
4054        will not be output using the show_existing_frame mechanism.
4055    * - ``V4L2_AV1_FRAME_FLAG_ERROR_RESILIENT_MODE``
4056      - 0x00000004
4057      - Specifies whether error resilient mode is enabled.
4058    * - ``V4L2_AV1_FRAME_FLAG_DISABLE_CDF_UPDATE``
4059      - 0x00000008
4060      - Specifies whether the CDF update in the symbol decoding process should
4061        be disabled.
4062    * - ``V4L2_AV1_FRAME_FLAG_ALLOW_SCREEN_CONTENT_TOOLS``
4063      - 0x00000010
4064      - If set, indicates that intra blocks may use palette encoding. If not
4065        set, indicates that palette encoding is never used.
4066    * - ``V4L2_AV1_FRAME_FLAG_FORCE_INTEGER_MV``
4067      - 0x00000020
4068      - If set, specifies that motion vectors will always be integers. If not
4069        set, specifies that motion vectors can contain fractional bits.
4070    * - ``V4L2_AV1_FRAME_FLAG_ALLOW_INTRABC``
4071      - 0x00000040
4072      - If set, indicates that intra block copy may be used in this frame. If
4073        not set, indicates that intra block copy is not allowed in this frame.
4074    * - ``V4L2_AV1_FRAME_FLAG_USE_SUPERRES``
4075      - 0x00000080
4076      - If set, indicates that upscaling is needed.
4077    * - ``V4L2_AV1_FRAME_FLAG_ALLOW_HIGH_PRECISION_MV``
4078      - 0x00000100
4079      - If set, specifies that motion vectors are specified to eighth pel
4080        precision. If not set, specifies that motion vectors are specified to
4081        quarter pel precision;
4082    * - ``V4L2_AV1_FRAME_FLAG_IS_MOTION_MODE_SWITCHABLE``
4083      - 0x00000200
4084      - If not set, specifies that only the SIMPLE motion mode will be used.
4085    * - ``V4L2_AV1_FRAME_FLAG_USE_REF_FRAME_MVS``
4086      - 0x00000400
4087      - If set specifies that motion vector information from a previous frame
4088        can be used when decoding the current frame. If not set, specifies that
4089        this information will not be used.
4090    * - ``V4L2_AV1_FRAME_FLAG_DISABLE_FRAME_END_UPDATE_CDF``
4091      - 0x00000800
4092      - If set indicates that the end of frame CDF update is disabled. If not
4093        set, indicates that the end of frame CDF update is enabled
4094    * - ``V4L2_AV1_FRAME_FLAG_ALLOW_WARPED_MOTION``
4095      - 0x00001000
4096      - If set, indicates that the syntax element motion_mode may be present, if
4097        not set, indicates that the syntax element motion_mode will not be
4098        present.
4099    * - ``V4L2_AV1_FRAME_FLAG_REFERENCE_SELECT``
4100      - 0x00002000
4101      - If set, specifies that the mode info for inter blocks contains the
4102        syntax element comp_mode that indicates whether to use single or
4103        compound reference prediction. If not set, specifies that all inter
4104        blocks will use single prediction.
4105    * - ``V4L2_AV1_FRAME_FLAG_REDUCED_TX_SET``
4106      - 0x00004000
4107      - If set, specifies that the frame is restricted to a reduced subset of
4108        the full set of transform types.
4109    * - ``V4L2_AV1_FRAME_FLAG_SKIP_MODE_ALLOWED``
4110      - 0x00008000
4111      - This flag retains the same meaning as SkipModeAllowed in :ref:`av1`.
4112    * - ``V4L2_AV1_FRAME_FLAG_SKIP_MODE_PRESENT``
4113      - 0x00010000
4114      - If set, specifies that the syntax element skip_mode will be present, if
4115        not set, specifies that skip_mode will not be used for this frame.
4116    * - ``V4L2_AV1_FRAME_FLAG_FRAME_SIZE_OVERRIDE``
4117      - 0x00020000
4118      - If set, specifies that the frame size will either be specified as the
4119        size of one of the reference frames, or computed from the
4120        frame_width_minus_1 and frame_height_minus_1 syntax elements. If not
4121        set, specifies that the frame size is equal to the size in the sequence
4122        header.
4123    * - ``V4L2_AV1_FRAME_FLAG_BUFFER_REMOVAL_TIME_PRESENT``
4124      - 0x00040000
4125      - If set, specifies that buffer_removal_time is present. If not set,
4126        specifies that buffer_removal_time is not present.
4127    * - ``V4L2_AV1_FRAME_FLAG_FRAME_REFS_SHORT_SIGNALING``
4128      - 0x00080000
4129      - If set, indicates that only two reference frames are explicitly
4130        signaled. If not set, indicates that all reference frames are explicitly
4131        signaled.
4132
4133``V4L2_CID_STATELESS_AV1_FILM_GRAIN (struct)``
4134    Represents the optional film grain parameters. See section
4135    6.8.20 "Film grain params semantics" of :ref:`av1` for more details.
4136
4137.. c:type:: v4l2_ctrl_av1_film_grain
4138
4139.. cssclass:: longtable
4140
4141.. tabularcolumns:: |p{1.5cm}|p{5.8cm}|p{10.0cm}|
4142
4143.. flat-table:: struct v4l2_ctrl_av1_film_grain
4144    :header-rows:  0
4145    :stub-columns: 0
4146    :widths:       1 1 2
4147
4148    * - __u8
4149      - ``flags``
4150      - See :ref:`AV1 Film Grain Flags <av1_film_grain_flags>`.
4151    * - __u8
4152      - ``cr_mult``
4153      - Represents a multiplier for the cr component used in derivation of the
4154        input index to the cr component scaling function.
4155    * - __u16
4156      - ``grain_seed``
4157      - Specifies the starting value for the pseudo-random numbers used during
4158        film grain synthesis.
4159    * - __u8
4160      - ``film_grain_params_ref_idx``
4161      - Indicates which reference frame contains the film grain parameters to be
4162	used for this frame.
4163    * - __u8
4164      - ``num_y_points``
4165      - Specifies the number of points for the piece-wise linear scaling
4166        function of the luma component.
4167    * - __u8
4168      - ``point_y_value[V4L2_AV1_MAX_NUM_Y_POINTS]``
4169      - Represents the x (luma value) coordinate for the i-th point
4170        of the piecewise linear scaling function for luma component. The values
4171        are signaled on the scale of 0..255. In case of 10 bit video, these
4172        values correspond to luma values divided by 4. In case of 12 bit video,
4173        these values correspond to luma values divided by 16.
4174    * - __u8
4175      - ``point_y_scaling[V4L2_AV1_MAX_NUM_Y_POINTS]``
4176      - Represents the scaling (output) value for the i-th point
4177        of the piecewise linear scaling function for luma component.
4178    * - __u8
4179      - ``num_cb_points``
4180      -  Specifies the number of points for the piece-wise linear scaling
4181         function of the cb component.
4182    * - __u8
4183      - ``point_cb_value[V4L2_AV1_MAX_NUM_CB_POINTS]``
4184      - Represents the x coordinate for the i-th point of the
4185        piece-wise linear scaling function for cb component. The values are
4186        signaled on the scale of 0..255.
4187    * - __u8
4188      - ``point_cb_scaling[V4L2_AV1_MAX_NUM_CB_POINTS]``
4189      - Represents the scaling (output) value for the i-th point of the
4190        piecewise linear scaling function for cb component.
4191    * - __u8
4192      - ``num_cr_points``
4193      - Represents the number of points for the piece-wise
4194        linear scaling function of the cr component.
4195    * - __u8
4196      - ``point_cr_value[V4L2_AV1_MAX_NUM_CR_POINTS]``
4197      - Represents the x coordinate for the i-th point of the
4198        piece-wise linear scaling function for cr component. The values are
4199        signaled on the scale of 0..255.
4200    * - __u8
4201      - ``point_cr_scaling[V4L2_AV1_MAX_NUM_CR_POINTS]``
4202      - Represents the scaling (output) value for the i-th point of the
4203        piecewise linear scaling function for cr component.
4204    * - __u8
4205      - ``grain_scaling_minus_8``
4206      - Represents the shift - 8 applied to the values of the chroma component.
4207        The grain_scaling_minus_8 can take values of 0..3 and determines the
4208        range and quantization step of the standard deviation of film grain.
4209    * - __u8
4210      - ``ar_coeff_lag``
4211      - Specifies the number of auto-regressive coefficients for luma and
4212        chroma.
4213    * - __u8
4214      - ``ar_coeffs_y_plus_128[V4L2_AV1_AR_COEFFS_SIZE]``
4215      - Specifies auto-regressive coefficients used for the Y plane.
4216    * - __u8
4217      - ``ar_coeffs_cb_plus_128[V4L2_AV1_AR_COEFFS_SIZE]``
4218      - Specifies auto-regressive coefficients used for the U plane.
4219    * - __u8
4220      - ``ar_coeffs_cr_plus_128[V4L2_AV1_AR_COEFFS_SIZE]``
4221      - Specifies auto-regressive coefficients used for the V plane.
4222    * - __u8
4223      - ``ar_coeff_shift_minus_6``
4224      - Specifies the range of the auto-regressive coefficients. Values of 0,
4225        1, 2, and 3 correspond to the ranges for auto-regressive coefficients of
4226        [-2, 2), [-1, 1), [-0.5, 0.5) and [-0.25, 0.25) respectively.
4227    * - __u8
4228      - ``grain_scale_shift``
4229      - Specifies how much the Gaussian random numbers should be scaled down
4230        during the grain synthesis process.
4231    * - __u8
4232      - ``cb_mult``
4233      - Represents a multiplier for the cb component used in derivation of the
4234        input index to the cb component scaling function.
4235    * - __u8
4236      - ``cb_luma_mult``
4237      - Represents a multiplier for the average luma component used in
4238        derivation of the input index to the cb component scaling function..
4239    * - __u8
4240      - ``cr_luma_mult``
4241      - Represents a multiplier for the average luma component used in
4242        derivation of the input index to the cr component scaling function.
4243    * - __u16
4244      - ``cb_offset``
4245      - Represents an offset used in derivation of the input index to the
4246        cb component scaling function.
4247    * - __u16
4248      - ``cr_offset``
4249      - Represents an offset used in derivation of the input index to the
4250        cr component scaling function.
4251    * - __u8
4252      - ``reserved[4]``
4253      - Applications and drivers must set this to zero.
4254
4255.. _av1_film_grain_flags:
4256
4257``AV1 Film Grain Flags``
4258
4259.. cssclass:: longtable
4260
4261.. flat-table::
4262    :header-rows:  0
4263    :stub-columns: 0
4264    :widths:       1 1 2
4265
4266    * - ``V4L2_AV1_FILM_GRAIN_FLAG_APPLY_GRAIN``
4267      - 0x00000001
4268      - If set, specifies that film grain should be added to this frame. If not
4269        set, specifies that film grain should not be added.
4270    * - ``V4L2_AV1_FILM_GRAIN_FLAG_UPDATE_GRAIN``
4271      - 0x00000002
4272      - If set, means that a new set of parameters should be sent. If not set,
4273        specifies that the previous set of parameters should be used.
4274    * - ``V4L2_AV1_FILM_GRAIN_FLAG_CHROMA_SCALING_FROM_LUMA``
4275      - 0x00000004
4276      - If set, specifies that the chroma scaling is inferred from the luma
4277        scaling.
4278    * - ``V4L2_AV1_FILM_GRAIN_FLAG_OVERLAP``
4279      - 0x00000008
4280      - If set, indicates that the overlap between film grain blocks shall be
4281        applied. If not set, indicates that the overlap between film grain blocks
4282        shall not be applied.
4283    * - ``V4L2_AV1_FILM_GRAIN_FLAG_CLIP_TO_RESTRICTED_RANGE``
4284      - 0x00000010
4285      - If set, indicates that clipping to the restricted (studio, i.e. limited)
4286        range shall be applied to the sample values after adding the film grain
4287        (see the semantics for color_range for an explanation of studio swing).
4288        If not set, indicates that clipping to the full range shall be applied
4289        to the sample values after adding the film grain.
4290