v4l2codecs: Align v4l2-controls header with kernel 5.15-rc3
authorBenjamin Gaignard <benjamin.gaignard@collabora.com>
Thu, 30 Sep 2021 12:59:31 +0000 (14:59 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Sun, 10 Oct 2021 15:50:57 +0000 (15:50 +0000)
Update v4l2-controls to be aligned with kernel 5.15-rc3.
Fix VP8 decoder to use the correct field name.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1081>

subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2codecvp8dec.c
subprojects/gst-plugins-bad/sys/v4l2codecs/linux/v4l2-controls.h

index fd2a690..5f43a5e 100644 (file)
@@ -536,7 +536,7 @@ gst_v4l2_codec_vp8_dec_decode_picture (GstVp8Decoder * decoder,
   }
 
   gst_v4l2_codec_vp8_dec_fill_frame_header (self, &picture->frame_hdr);
-  gst_v4l2_codec_vp8_dec_fill_segment (&self->frame_header.seg,
+  gst_v4l2_codec_vp8_dec_fill_segment (&self->frame_header.segment,
       &parser->segmentation);
   gst_v4l2_codec_vp8_dec_fill_lf (&self->frame_header.lf,
       &parser->mb_lf_adjust);
index 19433ee..0b6e7cf 100644 (file)
@@ -66,6 +66,7 @@
 #define V4L2_CTRL_CLASS_RF_TUNER       0x00a20000      /* RF tuner controls */
 #define V4L2_CTRL_CLASS_DETECT         0x00a30000      /* Detection controls */
 #define V4L2_CTRL_CLASS_CODEC_STATELESS 0x00a40000     /* Stateless codecs controls */
+#define V4L2_CTRL_CLASS_COLORIMETRY    0x00a50000      /* Colorimetry controls */
 
 /* User-class control IDs */
 
@@ -426,6 +427,12 @@ enum v4l2_mpeg_video_multi_slice_mode {
 #define V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE          (V4L2_CID_CODEC_BASE+228)
 #define V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME            (V4L2_CID_CODEC_BASE+229)
 #define V4L2_CID_MPEG_VIDEO_BASELAYER_PRIORITY_ID      (V4L2_CID_CODEC_BASE+230)
+#define V4L2_CID_MPEG_VIDEO_AU_DELIMITER               (V4L2_CID_CODEC_BASE+231)
+#define V4L2_CID_MPEG_VIDEO_LTR_COUNT                  (V4L2_CID_CODEC_BASE+232)
+#define V4L2_CID_MPEG_VIDEO_FRAME_LTR_INDEX            (V4L2_CID_CODEC_BASE+233)
+#define V4L2_CID_MPEG_VIDEO_USE_LTR_FRAMES             (V4L2_CID_CODEC_BASE+234)
+#define V4L2_CID_MPEG_VIDEO_DEC_CONCEAL_COLOR          (V4L2_CID_CODEC_BASE+235)
+#define V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD       (V4L2_CID_CODEC_BASE+236)
 
 /* CIDs for the MPEG-2 Part 2 (H.262) codec */
 #define V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL                        (V4L2_CID_CODEC_BASE+270)
@@ -795,6 +802,9 @@ enum v4l2_mpeg_video_frame_skip_mode {
 #define V4L2_CID_MPEG_VIDEO_HEVC_B_FRAME_MIN_QP        (V4L2_CID_CODEC_BASE + 651)
 #define V4L2_CID_MPEG_VIDEO_HEVC_B_FRAME_MAX_QP        (V4L2_CID_CODEC_BASE + 652)
 
+#define V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY          (V4L2_CID_CODEC_BASE + 653)
+#define V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY_ENABLE   (V4L2_CID_CODEC_BASE + 654)
+
 /*  MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */
 #define V4L2_CID_CODEC_CX2341X_BASE                            (V4L2_CTRL_CLASS_CODEC | 0x1000)
 #define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE                (V4L2_CID_CODEC_CX2341X_BASE+0)
@@ -1327,7 +1337,7 @@ struct v4l2_ctrl_h264_sps {
  * struct v4l2_ctrl_h264_pps - H264 picture parameter set
  *
  * Except where noted, all the members on this picture parameter set
- * structure match the sequence parameter set syntax as specified
+ * structure match the picture parameter set syntax as specified
  * by the H264 specification.
  *
  * In particular, V4L2_H264_PPS_FLAG_SCALING_MATRIX_PRESENT flag
@@ -1591,30 +1601,30 @@ struct v4l2_ctrl_h264_decode_params {
 #define V4L2_FWHT_VERSION                      3
 
 /* Set if this is an interlaced format */
-#define V4L2_FWHT_FL_IS_INTERLACED             BIT(0)
+#define V4L2_FWHT_FL_IS_INTERLACED             _BITUL(0)
 /* Set if this is a bottom-first (NTSC) interlaced format */
-#define V4L2_FWHT_FL_IS_BOTTOM_FIRST           BIT(1)
+#define V4L2_FWHT_FL_IS_BOTTOM_FIRST           _BITUL(1)
 /* Set if each 'frame' contains just one field */
-#define V4L2_FWHT_FL_IS_ALTERNATE              BIT(2)
+#define V4L2_FWHT_FL_IS_ALTERNATE              _BITUL(2)
 /*
  * If V4L2_FWHT_FL_IS_ALTERNATE was set, then this is set if this
  * 'frame' is the bottom field, else it is the top field.
  */
-#define V4L2_FWHT_FL_IS_BOTTOM_FIELD           BIT(3)
+#define V4L2_FWHT_FL_IS_BOTTOM_FIELD           _BITUL(3)
 /* Set if the Y' plane is uncompressed */
-#define V4L2_FWHT_FL_LUMA_IS_UNCOMPRESSED      BIT(4)
+#define V4L2_FWHT_FL_LUMA_IS_UNCOMPRESSED      _BITUL(4)
 /* Set if the Cb plane is uncompressed */
-#define V4L2_FWHT_FL_CB_IS_UNCOMPRESSED                BIT(5)
+#define V4L2_FWHT_FL_CB_IS_UNCOMPRESSED                _BITUL(5)
 /* Set if the Cr plane is uncompressed */
-#define V4L2_FWHT_FL_CR_IS_UNCOMPRESSED                BIT(6)
+#define V4L2_FWHT_FL_CR_IS_UNCOMPRESSED                _BITUL(6)
 /* Set if the chroma plane is full height, if cleared it is half height */
-#define V4L2_FWHT_FL_CHROMA_FULL_HEIGHT                BIT(7)
+#define V4L2_FWHT_FL_CHROMA_FULL_HEIGHT                _BITUL(7)
 /* Set if the chroma plane is full width, if cleared it is half width */
-#define V4L2_FWHT_FL_CHROMA_FULL_WIDTH         BIT(8)
+#define V4L2_FWHT_FL_CHROMA_FULL_WIDTH         _BITUL(8)
 /* Set if the alpha plane is uncompressed */
-#define V4L2_FWHT_FL_ALPHA_IS_UNCOMPRESSED     BIT(9)
+#define V4L2_FWHT_FL_ALPHA_IS_UNCOMPRESSED     _BITUL(9)
 /* Set if this is an I Frame */
-#define V4L2_FWHT_FL_I_FRAME                   BIT(10)
+#define V4L2_FWHT_FL_I_FRAME                   _BITUL(10)
 
 /* A 4-values flag - the number of components - 1 */
 #define V4L2_FWHT_FL_COMPONENTS_NUM_MSK                GENMASK(18, 16)
@@ -1722,7 +1732,7 @@ struct v4l2_vp8_loop_filter {
  * @uv_dc_delta: chroma DC delta value.
  * @uv_ac_delta: chroma AC delta value.
  * @padding: padding field. Should be zeroed by applications.
-
+ *
  * This structure contains the quantization indices present
  * in 'quant_indices()' part of the frame header syntax.
  * See section '9.6. Dequantization Indices' of the VP8 specification
@@ -1793,12 +1803,13 @@ struct v4l2_vp8_entropy_coder_state {
 
 #define V4L2_CID_STATELESS_VP8_FRAME (V4L2_CID_CODEC_STATELESS_BASE + 200)
 /**
- * struct v4l2_vp8_frame - VP8 frame parameters
+ * struct v4l2_ctrl_vp8_frame - VP8 frame parameters
  *
- * @seg: segmentation parameters. See &v4l2_vp8_segment for more details
+ * @segment: segmentation parameters. See &v4l2_vp8_segment for more details
  * @lf: loop filter parameters. See &v4l2_vp8_loop_filter for more details
  * @quant: quantization parameters. See &v4l2_vp8_quantization for more details
- * @probs: probabilities. See &v4l2_vp9_probabilities for more details
+ * @entropy: update probabilities. See &v4l2_vp8_entropy for more details
+ * @coder_state: boolean coder state. See &v4l2_vp8_entropy_coder_state for more details
  * @width: frame width.
  * @height: frame height.
  * @horizontal_scale: horizontal scaling factor.
@@ -1820,7 +1831,7 @@ struct v4l2_vp8_entropy_coder_state {
  * @flags: see V4L2_VP8_FRAME_FLAG_{}.
  */
 struct v4l2_ctrl_vp8_frame {
-       struct v4l2_vp8_segment seg;
+       struct v4l2_vp8_segment segment;
        struct v4l2_vp8_loop_filter lf;
        struct v4l2_vp8_quantization quant;
        struct v4l2_vp8_entropy entropy;
@@ -1850,6 +1861,152 @@ struct v4l2_ctrl_vp8_frame {
        __u64 flags;
 };
 
+/* Stateless MPEG-2 controls */
+
+#define V4L2_MPEG2_SEQ_FLAG_PROGRESSIVE        0x01
+
+#define V4L2_CID_STATELESS_MPEG2_SEQUENCE (V4L2_CID_CODEC_STATELESS_BASE+220)
+/**
+ * struct v4l2_ctrl_mpeg2_sequence - MPEG-2 sequence header
+ *
+ * All the members on this structure match the sequence header and sequence
+ * extension syntaxes as specified by the MPEG-2 specification.
+ *
+ * Fields horizontal_size, vertical_size and vbv_buffer_size are a
+ * combination of respective _value and extension syntax elements,
+ * as described in section 6.3.3 "Sequence header".
+ *
+ * @horizontal_size: combination of elements horizontal_size_value and
+ * horizontal_size_extension.
+ * @vertical_size: combination of elements vertical_size_value and
+ * vertical_size_extension.
+ * @vbv_buffer_size: combination of elements vbv_buffer_size_value and
+ * vbv_buffer_size_extension.
+ * @profile_and_level_indication: see MPEG-2 specification.
+ * @chroma_format: see MPEG-2 specification.
+ * @flags: see V4L2_MPEG2_SEQ_FLAG_{}.
+ */
+struct v4l2_ctrl_mpeg2_sequence {
+       __u16   horizontal_size;
+       __u16   vertical_size;
+       __u32   vbv_buffer_size;
+       __u16   profile_and_level_indication;
+       __u8    chroma_format;
+       __u8    flags;
+};
+
+#define V4L2_MPEG2_PIC_CODING_TYPE_I                   1
+#define V4L2_MPEG2_PIC_CODING_TYPE_P                   2
+#define V4L2_MPEG2_PIC_CODING_TYPE_B                   3
+#define V4L2_MPEG2_PIC_CODING_TYPE_D                   4
+
+#define V4L2_MPEG2_PIC_TOP_FIELD                       0x1
+#define V4L2_MPEG2_PIC_BOTTOM_FIELD                    0x2
+#define V4L2_MPEG2_PIC_FRAME                           0x3
+
+#define V4L2_MPEG2_PIC_FLAG_TOP_FIELD_FIRST            0x0001
+#define V4L2_MPEG2_PIC_FLAG_FRAME_PRED_DCT             0x0002
+#define V4L2_MPEG2_PIC_FLAG_CONCEALMENT_MV             0x0004
+#define V4L2_MPEG2_PIC_FLAG_Q_SCALE_TYPE               0x0008
+#define V4L2_MPEG2_PIC_FLAG_INTRA_VLC                  0x0010
+#define V4L2_MPEG2_PIC_FLAG_ALT_SCAN                   0x0020
+#define V4L2_MPEG2_PIC_FLAG_REPEAT_FIRST               0x0040
+#define V4L2_MPEG2_PIC_FLAG_PROGRESSIVE                        0x0080
+
+#define V4L2_CID_STATELESS_MPEG2_PICTURE (V4L2_CID_CODEC_STATELESS_BASE+221)
+/**
+ * struct v4l2_ctrl_mpeg2_picture - MPEG-2 picture header
+ *
+ * All the members on this structure match the picture header and picture
+ * coding extension syntaxes as specified by the MPEG-2 specification.
+ *
+ * @backward_ref_ts: timestamp of the V4L2 capture buffer to use as
+ * reference for backward prediction.
+ * @forward_ref_ts: timestamp of the V4L2 capture buffer to use as
+ * reference for forward prediction. These timestamp refers to the
+ * timestamp field in struct v4l2_buffer. Use v4l2_timeval_to_ns()
+ * to convert the struct timeval to a __u64.
+ * @flags: see V4L2_MPEG2_PIC_FLAG_{}.
+ * @f_code: see MPEG-2 specification.
+ * @picture_coding_type: see MPEG-2 specification.
+ * @picture_structure: see V4L2_MPEG2_PIC_{}_FIELD.
+ * @intra_dc_precision: see MPEG-2 specification.
+ * @reserved: padding field. Should be zeroed by applications.
+ */
+struct v4l2_ctrl_mpeg2_picture {
+       __u64   backward_ref_ts;
+       __u64   forward_ref_ts;
+       __u32   flags;
+       __u8    f_code[2][2];
+       __u8    picture_coding_type;
+       __u8    picture_structure;
+       __u8    intra_dc_precision;
+       __u8    reserved[5];
+};
+
+#define V4L2_CID_STATELESS_MPEG2_QUANTISATION (V4L2_CID_CODEC_STATELESS_BASE+222)
+/**
+ * struct v4l2_ctrl_mpeg2_quantisation - MPEG-2 quantisation
+ *
+ * Quantisation matrices as specified by section 6.3.7
+ * "Quant matrix extension".
+ *
+ * @intra_quantiser_matrix: The quantisation matrix coefficients
+ * for intra-coded frames, in zigzag scanning order. It is relevant
+ * for both luma and chroma components, although it can be superseded
+ * by the chroma-specific matrix for non-4:2:0 YUV formats.
+ * @non_intra_quantiser_matrix: The quantisation matrix coefficients
+ * for non-intra-coded frames, in zigzag scanning order. It is relevant
+ * for both luma and chroma components, although it can be superseded
+ * by the chroma-specific matrix for non-4:2:0 YUV formats.
+ * @chroma_intra_quantiser_matrix: The quantisation matrix coefficients
+ * for the chominance component of intra-coded frames, in zigzag scanning
+ * order. Only relevant for 4:2:2 and 4:4:4 YUV formats.
+ * @chroma_non_intra_quantiser_matrix: The quantisation matrix coefficients
+ * for the chrominance component of non-intra-coded frames, in zigzag scanning
+ * order. Only relevant for 4:2:2 and 4:4:4 YUV formats.
+ */
+struct v4l2_ctrl_mpeg2_quantisation {
+       __u8    intra_quantiser_matrix[64];
+       __u8    non_intra_quantiser_matrix[64];
+       __u8    chroma_intra_quantiser_matrix[64];
+       __u8    chroma_non_intra_quantiser_matrix[64];
+};
+
+#define V4L2_CID_COLORIMETRY_CLASS_BASE        (V4L2_CTRL_CLASS_COLORIMETRY | 0x900)
+#define V4L2_CID_COLORIMETRY_CLASS     (V4L2_CTRL_CLASS_COLORIMETRY | 1)
+
+#define V4L2_CID_COLORIMETRY_HDR10_CLL_INFO    (V4L2_CID_COLORIMETRY_CLASS_BASE + 0)
+
+struct v4l2_ctrl_hdr10_cll_info {
+       __u16 max_content_light_level;
+       __u16 max_pic_average_light_level;
+};
+
+#define V4L2_CID_COLORIMETRY_HDR10_MASTERING_DISPLAY   (V4L2_CID_COLORIMETRY_CLASS_BASE + 1)
+
+#define V4L2_HDR10_MASTERING_PRIMARIES_X_LOW   5
+#define V4L2_HDR10_MASTERING_PRIMARIES_X_HIGH  37000
+#define V4L2_HDR10_MASTERING_PRIMARIES_Y_LOW   5
+#define V4L2_HDR10_MASTERING_PRIMARIES_Y_HIGH  42000
+#define V4L2_HDR10_MASTERING_WHITE_POINT_X_LOW 5
+#define V4L2_HDR10_MASTERING_WHITE_POINT_X_HIGH        37000
+#define V4L2_HDR10_MASTERING_WHITE_POINT_Y_LOW 5
+#define V4L2_HDR10_MASTERING_WHITE_POINT_Y_HIGH        42000
+#define V4L2_HDR10_MASTERING_MAX_LUMA_LOW      50000
+#define V4L2_HDR10_MASTERING_MAX_LUMA_HIGH     100000000
+#define V4L2_HDR10_MASTERING_MIN_LUMA_LOW      1
+#define V4L2_HDR10_MASTERING_MIN_LUMA_HIGH     50000
+
+struct v4l2_ctrl_hdr10_mastering_display {
+       __u16 display_primaries_x[3];
+       __u16 display_primaries_y[3];
+       __u16 white_point_x;
+       __u16 white_point_y;
+       __u32 max_display_mastering_luminance;
+       __u32 min_display_mastering_luminance;
+};
+
 /* MPEG-compression definitions kept for backwards compatibility */
 #define V4L2_CTRL_CLASS_MPEG            V4L2_CTRL_CLASS_CODEC
 #define V4L2_CID_MPEG_CLASS             V4L2_CID_CODEC_CLASS