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 VP8 `VABuffer` types.
9 /// Wrapper over the `pic_fields` bindgen field in `VAPictureParameterBufferVP8`.
10 pub struct VP8PicFields(bindings::_VAPictureParameterBufferVP8__bindgen_ty_1);
13 /// Creates the bindgen field
14 #[allow(clippy::too_many_arguments)]
18 segmentation_enabled: u32,
19 update_mb_segmentation_map: u32,
20 update_segment_feature_data: u32,
23 loop_filter_adj_enable: u32,
24 mode_ref_lf_delta_update: u32,
25 sign_bias_golden: u32,
26 sign_bias_alternate: u32,
27 mb_no_coeff_skip: u32,
28 loop_filter_disable: u32,
31 bindings::_VAPictureParameterBufferVP8__bindgen_ty_1__bindgen_ty_1::new_bitfield_1(
35 update_mb_segmentation_map,
36 update_segment_feature_data,
39 loop_filter_adj_enable,
40 mode_ref_lf_delta_update,
47 Self(bindings::_VAPictureParameterBufferVP8__bindgen_ty_1 {
48 bits: bindings::_VAPictureParameterBufferVP8__bindgen_ty_1__bindgen_ty_1 {
49 _bitfield_align_1: Default::default(),
51 __bindgen_padding_0: Default::default(),
56 /// Returns the inner FFI type. Useful for testing purposes.
57 pub fn inner(&self) -> &bindings::_VAPictureParameterBufferVP8__bindgen_ty_1 {
62 /// Wrapper over the `VABoolCoderContextVPX` FFI type.
63 pub struct BoolCoderContextVPX(bindings::VABoolCoderContextVPX);
65 impl BoolCoderContextVPX {
66 /// Creates the wrapper
67 pub fn new(range: u8, value: u8, count: u8) -> Self {
68 Self(bindings::VABoolCoderContextVPX {
76 /// Wrapper over the `PictureParameterBufferVP8` FFI type.
77 pub struct PictureParameterBufferVP8(Box<bindings::VAPictureParameterBufferVP8>);
79 impl PictureParameterBufferVP8 {
80 /// Creates the wrapper
81 #[allow(clippy::too_many_arguments)]
85 last_ref_frame: bindings::VASurfaceID,
86 golden_ref_frame: bindings::VASurfaceID,
87 alt_ref_frame: bindings::VASurfaceID,
88 pic_fields: &VP8PicFields,
89 mb_segment_tree_probs: [u8; 3usize],
90 loop_filter_level: [u8; 4usize],
91 loop_filter_deltas_ref_frame: [i8; 4usize],
92 loop_filter_deltas_mode: [i8; 4usize],
97 y_mode_probs: [u8; 4usize],
98 uv_mode_probs: [u8; 3usize],
99 mv_probs: [[u8; 19usize]; 2usize],
100 bool_coder_ctx: &BoolCoderContextVPX,
102 let pic_fields = pic_fields.0;
103 let bool_coder_ctx = bool_coder_ctx.0;
105 Self(Box::new(bindings::VAPictureParameterBufferVP8 {
111 out_of_loop_frame: bindings::constants::VA_INVALID_SURFACE,
113 mb_segment_tree_probs,
115 loop_filter_deltas_ref_frame,
116 loop_filter_deltas_mode,
125 va_reserved: Default::default(),
129 pub(crate) fn inner_mut(&mut self) -> &mut bindings::VAPictureParameterBufferVP8 {
133 /// Returns the inner FFI type. Useful for testing purposes.
134 pub fn inner(&self) -> &bindings::VAPictureParameterBufferVP8 {
139 /// Wrapper over the `VASliceParameterBufferVP8` FFI type.
140 pub struct SliceParameterBufferVP8(Box<bindings::VASliceParameterBufferVP8>);
142 impl SliceParameterBufferVP8 {
143 /// Creates the wrapper.
145 slice_data_size: u32,
146 slice_data_offset: u32,
147 slice_data_flag: u32,
148 macroblock_offset: u32,
149 num_of_partitions: u8,
150 partition_size: [u32; 9usize],
152 Self(Box::new(bindings::VASliceParameterBufferVP8 {
159 va_reserved: Default::default(),
163 pub(crate) fn inner_mut(&mut self) -> &mut bindings::VASliceParameterBufferVP8 {
167 /// Returns the inner FFI type. Useful for testing purposes.
168 pub fn inner(&self) -> &bindings::VASliceParameterBufferVP8 {
173 /// Wrapper over the `VAIQMatrixBufferVP8` FFI type.
174 pub struct IQMatrixBufferVP8(Box<bindings::VAIQMatrixBufferVP8>);
176 impl IQMatrixBufferVP8 {
177 /// Creates the wrapper.
178 pub fn new(quantization_index: [[u16; 6usize]; 4usize]) -> Self {
179 Self(Box::new(bindings::VAIQMatrixBufferVP8 {
181 va_reserved: Default::default(),
185 pub(crate) fn inner_mut(&mut self) -> &mut bindings::VAIQMatrixBufferVP8 {
189 /// Returns the inner FFI type. Useful for testing purposes.
190 pub fn inner(&self) -> &bindings::VAIQMatrixBufferVP8 {
195 /// Wrapper over the VAProbabilityDataBufferVP8 FFI type.
196 pub struct ProbabilityDataBufferVP8(Box<bindings::VAProbabilityDataBufferVP8>);
198 impl ProbabilityDataBufferVP8 {
199 /// Creates the wrapper.
200 pub fn new(dct_coeff_probs: [[[[u8; 11usize]; 3usize]; 8usize]; 4usize]) -> Self {
201 Self(Box::new(bindings::VAProbabilityDataBufferVP8 {
203 va_reserved: Default::default(),
207 pub(crate) fn inner_mut(&mut self) -> &mut bindings::VAProbabilityDataBufferVP8 {
211 /// Returns the inner FFI type. Useful for testing purposes.
212 pub fn inner(&self) -> &bindings::VAProbabilityDataBufferVP8 {