nihed-cros-libva: expose and document some generated data structures
authorKostya Shishkov <kostya.shishkov@gmail.com>
Fri, 20 Oct 2023 16:33:27 +0000 (18:33 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Fri, 20 Oct 2023 16:33:27 +0000 (18:33 +0200)
nihed-cros-libva/src/bindings/va.rs

index 42bbd82231b3696a4656e1790e9fc68f7e77a30c..fd887c76cacb473eb09317620f90f328066a65e0 100644 (file)
@@ -948,7 +948,7 @@ impl Default for _VAMacroblockParameterBufferMPEG2 {
 pub type VAMacroblockParameterBufferMPEG2 = _VAMacroblockParameterBufferMPEG2;
 #[repr(C)]
 #[derive(Debug, Default, Copy, Clone, PartialEq, Eq)]
-pub struct _VAPictureH264 {
+pub struct VAPictureH264 {
     pub picture_id: VASurfaceID,
     pub frame_idx: u32,
     pub flags: u32,
@@ -956,10 +956,14 @@ pub struct _VAPictureH264 {
     pub BottomFieldOrderCnt: i32,
     pub va_reserved: [u32; 4usize],
 }
-pub type VAPictureH264 = _VAPictureH264;
+
+/// H.264 Picture Parameter Buffer
+///
+/// For each picture, and before any slice data, a single
+/// picture parameter buffer must be send.
 #[repr(C)]
 #[derive(Copy, Clone)]
-pub struct _VAPictureParameterBufferH264 {
+pub struct VAPictureParameterBufferH264 {
     pub CurrPic: VAPictureH264,
     pub ReferenceFrames: [VAPictureH264; 16usize],
     pub picture_width_in_mbs_minus1: u16,
@@ -1390,7 +1394,7 @@ impl Default for _VAPictureParameterBufferH264__bindgen_ty_2 {
         }
     }
 }
-impl Default for _VAPictureParameterBufferH264 {
+impl Default for VAPictureParameterBufferH264 {
     fn default() -> Self {
         let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
         unsafe {
@@ -1399,15 +1403,17 @@ impl Default for _VAPictureParameterBufferH264 {
         }
     }
 }
-pub type VAPictureParameterBufferH264 = _VAPictureParameterBufferH264;
+/// H.264 Inverse Quantization Matrix Buffer
+///
+/// Fill scaling lists with the default value (16) if they are not available.
 #[repr(C)]
 #[derive(Debug, Copy, Clone, PartialEq, Eq)]
-pub struct _VAIQMatrixBufferH264 {
+pub struct VAIQMatrixBufferH264 {
     pub ScalingList4x4: [[u8; 16usize]; 6usize],
     pub ScalingList8x8: [[u8; 64usize]; 2usize],
     pub va_reserved: [u32; 4usize],
 }
-impl Default for _VAIQMatrixBufferH264 {
+impl Default for VAIQMatrixBufferH264 {
     fn default() -> Self {
         let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
         unsafe {
@@ -1416,18 +1422,38 @@ impl Default for _VAIQMatrixBufferH264 {
         }
     }
 }
-pub type VAIQMatrixBufferH264 = _VAIQMatrixBufferH264;
+/// H.264 Slice Parameter Buffer
+///
+/// For each picture before each slice data buffer, a single
+/// slice parameter buffer must be send.
 #[repr(C)]
 #[derive(Debug, Default, Copy, Clone, PartialEq, Eq)]
-pub struct _VASliceParameterBufferH264 {
+pub struct VASliceParameterBufferH264 {
+    /// Number of bytes in the slice data buffer for this slice
     pub slice_data_size: u32,
     pub slice_data_offset: u32,
     pub slice_data_flag: u32,
+    /// Bit offset from NAL Header Unit to the begining of slice_data().
+    ///
+    /// This bit offset is relative to and includes the NAL unit byte
+    /// and represents the number of bits parsed in the slice_header()
+    /// after the removal of any emulation prevention bytes in
+    /// there. However, the slice data buffer passed to the hardware is
+    /// the original bitstream, thus including any emulation prevention
+    /// bytes.
     pub slice_data_bit_offset: u16,
     pub first_mb_in_slice: u16,
     pub slice_type: u8,
     pub direct_spatial_mv_pred_flag: u8,
+    /// H264/AVC syntax element
+    ///
+    /// if num_ref_idx_active_override_flag equals 0, host decoder should
+    /// set its value to num_ref_idx_l0_default_active_minus1.
     pub num_ref_idx_l0_active_minus1: u8,
+    /// H264/AVC syntax element
+    ///
+    /// if num_ref_idx_active_override_flag equals 0, host decoder should
+    /// set its value to num_ref_idx_l1_default_active_minus1.
     pub num_ref_idx_l1_active_minus1: u8,
     pub cabac_init_idc: u8,
     pub slice_qp_delta: i8,
@@ -1452,7 +1478,6 @@ pub struct _VASliceParameterBufferH264 {
     pub chroma_offset_l1: [[i16; 2usize]; 32usize],
     pub va_reserved: [u32; 4usize],
 }
-pub type VASliceParameterBufferH264 = _VASliceParameterBufferH264;
 pub mod VAEncPictureType {
     pub type Type = ::std::os::raw::c_uint;
     pub const VAEncPictureTypeIntra: Type = 0;
@@ -1589,7 +1614,7 @@ extern "C" {
 }
 #[repr(C)]
 #[derive(Debug, Default, Copy, Clone, PartialEq, Eq)]
-pub struct _VAImageFormat {
+pub struct VAImageFormat {
     pub fourcc: u32,
     pub byte_order: u32,
     pub bits_per_pixel: u32,
@@ -1600,11 +1625,10 @@ pub struct _VAImageFormat {
     pub alpha_mask: u32,
     pub va_reserved: [u32; 4usize],
 }
-pub type VAImageFormat = _VAImageFormat;
 pub type VAImageID = VAGenericID;
 #[repr(C)]
 #[derive(Debug, Default, Copy, Clone, PartialEq, Eq)]
-pub struct _VAImage {
+pub struct VAImage {
     pub image_id: VAImageID,
     pub format: VAImageFormat,
     pub buf: VABufferID,
@@ -1619,7 +1643,6 @@ pub struct _VAImage {
     pub component_order: [i8; 4usize],
     pub va_reserved: [u32; 4usize],
 }
-pub type VAImage = _VAImage;
 extern "C" {
     pub fn vaMaxNumImageFormats(dpy: VADisplay) -> ::std::os::raw::c_int;
 }