1 // Copyright 2023 The ChromiumOS Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 //! Wrappers around MPEG2 `VABuffer` types.
9 /// Wrapper over the `picture_coding_extension` bindgen field in `VAPictureParameterBufferMPEG2`.
10 pub struct MPEG2PictureCodingExtension(bindings::_VAPictureParameterBufferMPEG2__bindgen_ty_1);
12 impl MPEG2PictureCodingExtension {
13 /// Creates the bindgen field.
14 #[allow(clippy::too_many_arguments)]
16 intra_dc_precision: u32,
17 picture_structure: u32,
19 frame_pred_frame_dct: u32,
20 concealment_motion_vectors: u32,
22 intra_vlc_format: u32,
24 repeat_first_field: u32,
25 progressive_frame: u32,
29 bindings::_VAPictureParameterBufferMPEG2__bindgen_ty_1__bindgen_ty_1::new_bitfield_1(
34 concealment_motion_vectors,
43 Self(bindings::_VAPictureParameterBufferMPEG2__bindgen_ty_1 {
44 bits: bindings::_VAPictureParameterBufferMPEG2__bindgen_ty_1__bindgen_ty_1 {
45 _bitfield_align_1: Default::default(),
47 __bindgen_padding_0: Default::default(),
52 /// Returns the inner FFI type. Useful for testing purposes.
53 pub fn inner(&mut self) -> &bindings::_VAPictureParameterBufferMPEG2__bindgen_ty_1 {
58 /// Wrapper over the `PictureParameterBufferMPEG2` FFI type.
59 pub struct PictureParameterBufferMPEG2(Box<bindings::VAPictureParameterBufferMPEG2>);
61 impl PictureParameterBufferMPEG2 {
62 /// Creates the wrapper.
66 forward_reference_picture: bindings::VASurfaceID,
67 backward_reference_picture: bindings::VASurfaceID,
68 picture_coding_type: i32,
70 picture_coding_extension: &MPEG2PictureCodingExtension,
72 let picture_coding_extension = picture_coding_extension.0;
74 Self(Box::new(bindings::VAPictureParameterBufferMPEG2 {
77 forward_reference_picture,
78 backward_reference_picture,
81 picture_coding_extension,
82 va_reserved: Default::default(),
86 pub(crate) fn inner_mut(&mut self) -> &mut bindings::VAPictureParameterBufferMPEG2 {
90 /// Returns the inner FFI type. Useful for testing purposes.
91 pub fn inner(&mut self) -> &bindings::VAPictureParameterBufferMPEG2 {
96 /// Wrapper over the `VASliceParameterBufferMPEG2` FFI type.
97 pub struct SliceParameterBufferMPEG2(Box<bindings::VASliceParameterBufferMPEG2>);
99 impl SliceParameterBufferMPEG2 {
100 /// Creates the wrapper.
101 #[allow(clippy::too_many_arguments)]
103 slice_data_size: u32,
104 slice_data_offset: u32,
105 slice_data_flag: u32,
106 macroblock_offset: u32,
107 slice_horizontal_position: u32,
108 slice_vertical_position: u32,
109 quantiser_scale_code: i32,
110 intra_slice_flag: i32,
112 Self(Box::new(bindings::VASliceParameterBufferMPEG2 {
117 slice_horizontal_position,
118 slice_vertical_position,
119 quantiser_scale_code,
121 va_reserved: Default::default(),
125 pub(crate) fn inner_mut(&mut self) -> &mut bindings::VASliceParameterBufferMPEG2 {
129 /// Returns the inner FFI type. Useful for testing purposes.
130 pub fn inner(&self) -> &bindings::VASliceParameterBufferMPEG2 {
135 /// Wrapper over the `VAIQMatrixBufferMPEG2` FFI type.
136 pub struct IQMatrixBufferMPEG2(Box<bindings::VAIQMatrixBufferMPEG2>);
138 impl IQMatrixBufferMPEG2 {
139 /// Creates the wrapper.
140 #[allow(clippy::too_many_arguments)]
142 load_intra_quantiser_matrix: i32,
143 load_non_intra_quantiser_matrix: i32,
144 load_chroma_intra_quantiser_matrix: i32,
145 load_chroma_non_intra_quantiser_matrix: i32,
146 intra_quantiser_matrix: [u8; 64usize],
147 non_intra_quantiser_matrix: [u8; 64usize],
148 chroma_intra_quantiser_matrix: [u8; 64usize],
149 chroma_non_intra_quantiser_matrix: [u8; 64usize],
151 Self(Box::new(bindings::VAIQMatrixBufferMPEG2 {
152 load_intra_quantiser_matrix,
153 load_non_intra_quantiser_matrix,
154 load_chroma_intra_quantiser_matrix,
155 load_chroma_non_intra_quantiser_matrix,
156 intra_quantiser_matrix,
157 non_intra_quantiser_matrix,
158 chroma_intra_quantiser_matrix,
159 chroma_non_intra_quantiser_matrix,
160 va_reserved: Default::default(),
164 pub(crate) fn inner_mut(&mut self) -> &mut bindings::VAIQMatrixBufferMPEG2 {
168 /// Returns the inner FFI type. Useful for testing purposes.
169 pub fn inner(&self) -> &bindings::VAIQMatrixBufferMPEG2 {