edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching·0 forks·Rust·370.3 MiB·9b67700·Tahinli·3 days ago·4021 commits
| 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. |
| 4 | |
| 5 | //! Wrappers around AV1 `VABuffer` types. |
| 6 | |
| 7 | use crate::bindings; |
| 8 | |
| 9 | /// Wrapper over the `seq_fields` bindgen field in `VADecPictureParameterBufferAV1`. |
| 10 | pub struct AV1SeqFields(bindings::_VADecPictureParameterBufferAV1__bindgen_ty_1); |
| 11 | |
| 12 | impl AV1SeqFields { |
| 13 | /// Creates the bindgen field |
| 14 | #[allow(clippy::too_many_arguments)] |
| 15 | pub fn new( |
| 16 | still_picture: u32, |
| 17 | use_128x128_superblock: u32, |
| 18 | enable_filter_intra: u32, |
| 19 | enable_intra_edge_filter: u32, |
| 20 | enable_interintra_compound: u32, |
| 21 | enable_masked_compound: u32, |
| 22 | enable_dual_filter: u32, |
| 23 | enable_order_hint: u32, |
| 24 | enable_jnt_comp: u32, |
| 25 | enable_cdef: u32, |
| 26 | mono_chrome: u32, |
| 27 | color_range: u32, |
| 28 | subsampling_x: u32, |
| 29 | subsampling_y: u32, |
| 30 | chroma_sample_position: u32, |
| 31 | film_grain_params_present: u32, |
| 32 | ) -> Self { |
| 33 | let _bitfield_1 = |
| 34 | bindings::_VADecPictureParameterBufferAV1__bindgen_ty_1__bindgen_ty_1::new_bitfield_1( |
| 35 | still_picture, |
| 36 | use_128x128_superblock, |
| 37 | enable_filter_intra, |
| 38 | enable_intra_edge_filter, |
| 39 | enable_interintra_compound, |
| 40 | enable_masked_compound, |
| 41 | enable_dual_filter, |
| 42 | enable_order_hint, |
| 43 | enable_jnt_comp, |
| 44 | enable_cdef, |
| 45 | mono_chrome, |
| 46 | color_range, |
| 47 | subsampling_x, |
| 48 | subsampling_y, |
| 49 | chroma_sample_position, |
| 50 | film_grain_params_present, |
| 51 | 0, |
| 52 | ); |
| 53 | |
| 54 | Self(bindings::_VADecPictureParameterBufferAV1__bindgen_ty_1 { |
| 55 | fields: bindings::_VADecPictureParameterBufferAV1__bindgen_ty_1__bindgen_ty_1 { |
| 56 | _bitfield_align_1: Default::default(), |
| 57 | _bitfield_1, |
| 58 | }, |
| 59 | }) |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | /// Wrapper over the `segment_info_fields` bindgen field in `VASegmentationStructAV1`. |
| 64 | pub struct AV1SegmentInfoFields(bindings::_VASegmentationStructAV1__bindgen_ty_1); |
| 65 | |
| 66 | impl AV1SegmentInfoFields { |
| 67 | /// Creates the bindgen field |
| 68 | pub fn new(enabled: u32, update_map: u32, temporal_update: u32, update_data: u32) -> Self { |
| 69 | let _bitfield_1 = |
| 70 | bindings::_VASegmentationStructAV1__bindgen_ty_1__bindgen_ty_1::new_bitfield_1( |
| 71 | enabled, |
| 72 | update_map, |
| 73 | temporal_update, |
| 74 | update_data, |
| 75 | 0, |
| 76 | ); |
| 77 | |
| 78 | Self(bindings::_VASegmentationStructAV1__bindgen_ty_1 { |
| 79 | bits: bindings::_VASegmentationStructAV1__bindgen_ty_1__bindgen_ty_1 { |
| 80 | _bitfield_align_1: Default::default(), |
| 81 | _bitfield_1, |
| 82 | }, |
| 83 | }) |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | /// Wrapper over the `seg_info` bindgen field in `VADecPictureParameterBufferAV1`. |
| 88 | pub struct AV1Segmentation(bindings::VASegmentationStructAV1); |
| 89 | |
| 90 | impl AV1Segmentation { |
| 91 | /// Creates the bindgen field |
| 92 | pub fn new( |
| 93 | segment_info_fields: &AV1SegmentInfoFields, |
| 94 | feature_data: [[i16; 8usize]; 8usize], |
| 95 | feature_mask: [u8; 8usize], |
| 96 | ) -> Self { |
| 97 | let segment_info_fields = segment_info_fields.0; |
| 98 | Self(bindings::VASegmentationStructAV1 { |
| 99 | segment_info_fields, |
| 100 | feature_data, |
| 101 | feature_mask, |
| 102 | va_reserved: Default::default(), |
| 103 | }) |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | /// Wrapper over the `film_grain_fields` bindgen field in `VADecPictureParameterBufferAV1`. |
| 108 | pub struct AV1FilmGrainFields(bindings::_VAFilmGrainStructAV1__bindgen_ty_1); |
| 109 | |
| 110 | impl AV1FilmGrainFields { |
| 111 | /// Creates the bindgen field |
| 112 | #[allow(clippy::too_many_arguments)] |
| 113 | pub fn new( |
| 114 | apply_grain: u32, |
| 115 | chroma_scaling_from_luma: u32, |
| 116 | grain_scaling_minus_8: u32, |
| 117 | ar_coeff_lag: u32, |
| 118 | ar_coeff_shift_minus_6: u32, |
| 119 | grain_scale_shift: u32, |
| 120 | overlap_flag: u32, |
| 121 | clip_to_restricted_range: u32, |
| 122 | ) -> Self { |
| 123 | let _bitfield_1 = |
| 124 | bindings::_VAFilmGrainStructAV1__bindgen_ty_1__bindgen_ty_1::new_bitfield_1( |
| 125 | apply_grain, |
| 126 | chroma_scaling_from_luma, |
| 127 | grain_scaling_minus_8, |
| 128 | ar_coeff_lag, |
| 129 | ar_coeff_shift_minus_6, |
| 130 | grain_scale_shift, |
| 131 | overlap_flag, |
| 132 | clip_to_restricted_range, |
| 133 | 0, |
| 134 | ); |
| 135 | Self(bindings::_VAFilmGrainStructAV1__bindgen_ty_1 { |
| 136 | bits: bindings::_VAFilmGrainStructAV1__bindgen_ty_1__bindgen_ty_1 { |
| 137 | _bitfield_align_1: Default::default(), |
| 138 | _bitfield_1, |
| 139 | }, |
| 140 | }) |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | /// Wrapper over the `film_grain_info` bindgen field in `VADecPictureParameterBufferAV1`. |
| 145 | pub struct AV1FilmGrain(bindings::VAFilmGrainStructAV1); |
| 146 | |
| 147 | impl AV1FilmGrain { |
| 148 | /// Creates the wrapper |
| 149 | #[allow(clippy::too_many_arguments)] |
| 150 | pub fn new( |
| 151 | film_grain_info_fields: &AV1FilmGrainFields, |
| 152 | grain_seed: u16, |
| 153 | num_y_points: u8, |
| 154 | point_y_value: [u8; 14usize], |
| 155 | point_y_scaling: [u8; 14usize], |
| 156 | num_cb_points: u8, |
| 157 | point_cb_value: [u8; 10usize], |
| 158 | point_cb_scaling: [u8; 10usize], |
| 159 | num_cr_points: u8, |
| 160 | point_cr_value: [u8; 10usize], |
| 161 | point_cr_scaling: [u8; 10usize], |
| 162 | ar_coeffs_y: [i8; 24usize], |
| 163 | ar_coeffs_cb: [i8; 25usize], |
| 164 | ar_coeffs_cr: [i8; 25usize], |
| 165 | cb_mult: u8, |
| 166 | cb_luma_mult: u8, |
| 167 | cb_offset: u16, |
| 168 | cr_mult: u8, |
| 169 | cr_luma_mult: u8, |
| 170 | cr_offset: u16, |
| 171 | ) -> Self { |
| 172 | let film_grain_info_fields = film_grain_info_fields.0; |
| 173 | Self(bindings::VAFilmGrainStructAV1 { |
| 174 | film_grain_info_fields, |
| 175 | grain_seed, |
| 176 | num_y_points, |
| 177 | point_y_value, |
| 178 | point_y_scaling, |
| 179 | num_cb_points, |
| 180 | point_cb_value, |
| 181 | point_cb_scaling, |
| 182 | num_cr_points, |
| 183 | point_cr_value, |
| 184 | point_cr_scaling, |
| 185 | ar_coeffs_y, |
| 186 | ar_coeffs_cb, |
| 187 | ar_coeffs_cr, |
| 188 | cb_mult, |
| 189 | cb_luma_mult, |
| 190 | cb_offset, |
| 191 | cr_mult, |
| 192 | cr_luma_mult, |
| 193 | cr_offset, |
| 194 | va_reserved: Default::default(), |
| 195 | }) |
| 196 | } |
| 197 | } |
| 198 | |
| 199 | /// Wrapper over the `pic_info_fields` bindgen field in `VADecPictureParameterBufferAV1`. |
| 200 | pub struct AV1PicInfoFields(bindings::_VADecPictureParameterBufferAV1__bindgen_ty_2); |
| 201 | |
| 202 | impl AV1PicInfoFields { |
| 203 | /// Creates the wrapper |
| 204 | #[allow(clippy::too_many_arguments)] |
| 205 | pub fn new( |
| 206 | frame_type: u32, |
| 207 | show_frame: u32, |
| 208 | showable_frame: u32, |
| 209 | error_resilient_mode: u32, |
| 210 | disable_cdf_update: u32, |
| 211 | allow_screen_content_tools: u32, |
| 212 | force_integer_mv: u32, |
| 213 | allow_intrabc: u32, |
| 214 | use_superres: u32, |
| 215 | allow_high_precision_mv: u32, |
| 216 | is_motion_mode_switchable: u32, |
| 217 | use_ref_frame_mvs: u32, |
| 218 | disable_frame_end_update_cdf: u32, |
| 219 | uniform_tile_spacing_flag: u32, |
| 220 | allow_warped_motion: u32, |
| 221 | large_scale_tile: u32, |
| 222 | ) -> Self { |
| 223 | let _bitfield_1 = |
| 224 | bindings::_VADecPictureParameterBufferAV1__bindgen_ty_2__bindgen_ty_1::new_bitfield_1( |
| 225 | frame_type, |
| 226 | show_frame, |
| 227 | showable_frame, |
| 228 | error_resilient_mode, |
| 229 | disable_cdf_update, |
| 230 | allow_screen_content_tools, |
| 231 | force_integer_mv, |
| 232 | allow_intrabc, |
| 233 | use_superres, |
| 234 | allow_high_precision_mv, |
| 235 | is_motion_mode_switchable, |
| 236 | use_ref_frame_mvs, |
| 237 | disable_frame_end_update_cdf, |
| 238 | uniform_tile_spacing_flag, |
| 239 | allow_warped_motion, |
| 240 | large_scale_tile, |
| 241 | 0, |
| 242 | ); |
| 243 | Self(bindings::_VADecPictureParameterBufferAV1__bindgen_ty_2 { |
| 244 | bits: bindings::_VADecPictureParameterBufferAV1__bindgen_ty_2__bindgen_ty_1 { |
| 245 | _bitfield_align_1: Default::default(), |
| 246 | _bitfield_1, |
| 247 | }, |
| 248 | }) |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | /// Wrapper over the `loop_filter_fields` bindgen field in `VADecPictureParameterBufferAV1`. |
| 253 | pub struct AV1LoopFilterFields(bindings::_VADecPictureParameterBufferAV1__bindgen_ty_3); |
| 254 | |
| 255 | impl AV1LoopFilterFields { |
| 256 | /// Creates the wrapper |
| 257 | pub fn new(sharpness_level: u8, mode_ref_delta_enabled: u8, mode_ref_delta_update: u8) -> Self { |
| 258 | let _bitfield_1 = |
| 259 | bindings::_VADecPictureParameterBufferAV1__bindgen_ty_3__bindgen_ty_1::new_bitfield_1( |
| 260 | sharpness_level, |
| 261 | mode_ref_delta_enabled, |
| 262 | mode_ref_delta_update, |
| 263 | 0, |
| 264 | ); |
| 265 | Self(bindings::_VADecPictureParameterBufferAV1__bindgen_ty_3 { |
| 266 | bits: bindings::_VADecPictureParameterBufferAV1__bindgen_ty_3__bindgen_ty_1 { |
| 267 | _bitfield_align_1: Default::default(), |
| 268 | _bitfield_1, |
| 269 | }, |
| 270 | }) |
| 271 | } |
| 272 | } |
| 273 | |
| 274 | /// Wrapper over the `wm` bindgen field in `VADecPictureParameterBufferAV1`. |
| 275 | pub struct AV1WarpedMotionParams(bindings::VAWarpedMotionParamsAV1); |
| 276 | |
| 277 | impl AV1WarpedMotionParams { |
| 278 | /// Creates the wrapper |
| 279 | pub fn new( |
| 280 | wmtype: bindings::VAAV1TransformationType::Type, |
| 281 | wmmat: [i32; 8], |
| 282 | invalid: u8, |
| 283 | ) -> Self { |
| 284 | Self(bindings::VAWarpedMotionParamsAV1 { |
| 285 | wmtype, |
| 286 | wmmat, |
| 287 | invalid, |
| 288 | va_reserved: Default::default(), |
| 289 | }) |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | /// Wrapper over the `loop_restoration_fields` bindgen field in `VADecPictureParameterBufferAV1`. |
| 294 | pub struct AV1LoopRestorationFields(bindings::_VADecPictureParameterBufferAV1__bindgen_ty_6); |
| 295 | |
| 296 | impl AV1LoopRestorationFields { |
| 297 | /// Creates the wrapper |
| 298 | pub fn new( |
| 299 | yframe_restoration_type: u16, |
| 300 | cbframe_restoration_type: u16, |
| 301 | crframe_restoration_type: u16, |
| 302 | lr_unit_shift: u16, |
| 303 | lr_uv_shift: u16, |
| 304 | ) -> Self { |
| 305 | let _bitfield_1 = |
| 306 | bindings::_VADecPictureParameterBufferAV1__bindgen_ty_6__bindgen_ty_1::new_bitfield_1( |
| 307 | yframe_restoration_type, |
| 308 | cbframe_restoration_type, |
| 309 | crframe_restoration_type, |
| 310 | lr_unit_shift, |
| 311 | lr_uv_shift, |
| 312 | 0, |
| 313 | ); |
| 314 | Self(bindings::_VADecPictureParameterBufferAV1__bindgen_ty_6 { |
| 315 | bits: bindings::_VADecPictureParameterBufferAV1__bindgen_ty_6__bindgen_ty_1 { |
| 316 | _bitfield_align_1: Default::default(), |
| 317 | _bitfield_1, |
| 318 | }, |
| 319 | }) |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | /// Wrapper over the `mode_control_fields` bindgen field in `VADecPictureParameterBufferAV1`. |
| 324 | pub struct AV1ModeControlFields(bindings::_VADecPictureParameterBufferAV1__bindgen_ty_5); |
| 325 | |
| 326 | impl AV1ModeControlFields { |
| 327 | /// Creates the wrapper |
| 328 | #[allow(clippy::too_many_arguments)] |
| 329 | pub fn new( |
| 330 | delta_q_present_flag: u32, |
| 331 | log2_delta_q_res: u32, |
| 332 | delta_lf_present_flag: u32, |
| 333 | log2_delta_lf_res: u32, |
| 334 | delta_lf_multi: u32, |
| 335 | tx_mode: u32, |
| 336 | reference_select: u32, |
| 337 | reduced_tx_set_used: u32, |
| 338 | skip_mode_present: u32, |
| 339 | ) -> Self { |
| 340 | let _bitfield_1 = |
| 341 | bindings::_VADecPictureParameterBufferAV1__bindgen_ty_5__bindgen_ty_1::new_bitfield_1( |
| 342 | delta_q_present_flag, |
| 343 | log2_delta_q_res, |
| 344 | delta_lf_present_flag, |
| 345 | log2_delta_lf_res, |
| 346 | delta_lf_multi, |
| 347 | tx_mode, |
| 348 | reference_select, |
| 349 | reduced_tx_set_used, |
| 350 | skip_mode_present, |
| 351 | 0, |
| 352 | ); |
| 353 | Self(bindings::_VADecPictureParameterBufferAV1__bindgen_ty_5 { |
| 354 | bits: bindings::_VADecPictureParameterBufferAV1__bindgen_ty_5__bindgen_ty_1 { |
| 355 | _bitfield_align_1: Default::default(), |
| 356 | _bitfield_1, |
| 357 | }, |
| 358 | }) |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | /// Wrapper over the `qmatrix_fields` bindgen field in `VADecPictureParameterBufferAV1`. |
| 363 | pub struct AV1QMatrixFields(bindings::_VADecPictureParameterBufferAV1__bindgen_ty_4); |
| 364 | |
| 365 | impl AV1QMatrixFields { |
| 366 | /// Creates the wrapper |
| 367 | pub fn new(using_qmatrix: u16, qm_y: u16, qm_u: u16, qm_v: u16) -> Self { |
| 368 | let _bitfield_1 = |
| 369 | bindings::_VADecPictureParameterBufferAV1__bindgen_ty_4__bindgen_ty_1::new_bitfield_1( |
| 370 | using_qmatrix, |
| 371 | qm_y, |
| 372 | qm_u, |
| 373 | qm_v, |
| 374 | 0, |
| 375 | ); |
| 376 | Self(bindings::_VADecPictureParameterBufferAV1__bindgen_ty_4 { |
| 377 | bits: bindings::_VADecPictureParameterBufferAV1__bindgen_ty_4__bindgen_ty_1 { |
| 378 | _bitfield_align_1: Default::default(), |
| 379 | _bitfield_1, |
| 380 | }, |
| 381 | }) |
| 382 | } |
| 383 | } |
| 384 | |
| 385 | /// A wrapper over `VADecPictureParameterBufferAV1` FFI type |
| 386 | pub struct PictureParameterBufferAV1(Box<bindings::VADecPictureParameterBufferAV1>); |
| 387 | |
| 388 | impl PictureParameterBufferAV1 { |
| 389 | /// Creates the wrapper |
| 390 | #[allow(clippy::too_many_arguments)] |
| 391 | pub fn new( |
| 392 | profile: u8, |
| 393 | order_hint_bits_minus_1: u8, |
| 394 | bit_depth_idx: u8, |
| 395 | matrix_coefficients: u8, |
| 396 | seq_info_fields: &AV1SeqFields, |
| 397 | current_frame: bindings::VASurfaceID, |
| 398 | current_display_picture: bindings::VASurfaceID, |
| 399 | mut anchor_frames_list: Vec<bindings::VASurfaceID>, |
| 400 | frame_width_minus1: u16, |
| 401 | frame_height_minus1: u16, |
| 402 | output_frame_width_in_tiles_minus_1: u16, |
| 403 | output_frame_height_in_tiles_minus_1: u16, |
| 404 | ref_frame_map: [bindings::VASurfaceID; 8usize], |
| 405 | ref_frame_idx: [u8; 7usize], |
| 406 | primary_ref_frame: u8, |
| 407 | order_hint: u8, |
| 408 | seg_info: &AV1Segmentation, |
| 409 | film_grain_info: &AV1FilmGrain, |
| 410 | tile_cols: u8, |
| 411 | tile_rows: u8, |
| 412 | width_in_sbs_minus_1: [u16; 63usize], |
| 413 | height_in_sbs_minus_1: [u16; 63usize], |
| 414 | tile_count_minus_1: u16, |
| 415 | context_update_tile_id: u16, |
| 416 | pic_info_fields: &AV1PicInfoFields, |
| 417 | superres_scale_denominator: u8, |
| 418 | interp_filter: u8, |
| 419 | filter_level: [u8; 2usize], |
| 420 | filter_level_u: u8, |
| 421 | filter_level_v: u8, |
| 422 | loop_filter_info_fields: &AV1LoopFilterFields, |
| 423 | ref_deltas: [i8; 8usize], |
| 424 | mode_deltas: [i8; 2usize], |
| 425 | base_qindex: u8, |
| 426 | y_dc_delta_q: i8, |
| 427 | u_dc_delta_q: i8, |
| 428 | u_ac_delta_q: i8, |
| 429 | v_dc_delta_q: i8, |
| 430 | v_ac_delta_q: i8, |
| 431 | qmatrix_fields: &AV1QMatrixFields, |
| 432 | mode_control_fields: &AV1ModeControlFields, |
| 433 | cdef_damping_minus_3: u8, |
| 434 | cdef_bits: u8, |
| 435 | cdef_y_strengths: [u8; 8usize], |
| 436 | cdef_uv_strengths: [u8; 8usize], |
| 437 | loop_restoration_fields: &AV1LoopRestorationFields, |
| 438 | wm: &[AV1WarpedMotionParams; 7usize], |
| 439 | ) -> Self { |
| 440 | let seq_info_fields = seq_info_fields.0; |
| 441 | let seg_info = seg_info.0; |
| 442 | let pic_info_fields = pic_info_fields.0; |
| 443 | let loop_filter_info_fields = loop_filter_info_fields.0; |
| 444 | let qmatrix_fields = qmatrix_fields.0; |
| 445 | let mode_control_fields = mode_control_fields.0; |
| 446 | |
| 447 | let anchor_frames_num = anchor_frames_list.len() as u8; |
| 448 | let anchor_frames_list = anchor_frames_list.as_mut_ptr(); |
| 449 | |
| 450 | let film_grain_info = film_grain_info.0; |
| 451 | let loop_restoration_fields = loop_restoration_fields.0; |
| 452 | |
| 453 | // Will not panic, as the arrays are the same size. |
| 454 | let wm = wm |
| 455 | .iter() |
| 456 | .map(|wm| wm.0) |
| 457 | .collect::<Vec<_>>() |
| 458 | .try_into() |
| 459 | .unwrap(); |
| 460 | |
| 461 | Self(Box::new(bindings::VADecPictureParameterBufferAV1 { |
| 462 | profile, |
| 463 | order_hint_bits_minus_1, |
| 464 | bit_depth_idx, |
| 465 | matrix_coefficients, |
| 466 | seq_info_fields, |
| 467 | current_frame, |
| 468 | current_display_picture, |
| 469 | anchor_frames_num, |
| 470 | anchor_frames_list, |
| 471 | frame_width_minus1, |
| 472 | frame_height_minus1, |
| 473 | output_frame_width_in_tiles_minus_1, |
| 474 | output_frame_height_in_tiles_minus_1, |
| 475 | ref_frame_map, |
| 476 | ref_frame_idx, |
| 477 | primary_ref_frame, |
| 478 | order_hint, |
| 479 | seg_info, |
| 480 | film_grain_info, |
| 481 | tile_cols, |
| 482 | tile_rows, |
| 483 | width_in_sbs_minus_1, |
| 484 | height_in_sbs_minus_1, |
| 485 | tile_count_minus_1, |
| 486 | context_update_tile_id, |
| 487 | pic_info_fields, |
| 488 | superres_scale_denominator, |
| 489 | interp_filter, |
| 490 | filter_level, |
| 491 | filter_level_u, |
| 492 | filter_level_v, |
| 493 | loop_filter_info_fields, |
| 494 | ref_deltas, |
| 495 | mode_deltas, |
| 496 | base_qindex, |
| 497 | y_dc_delta_q, |
| 498 | u_dc_delta_q, |
| 499 | u_ac_delta_q, |
| 500 | v_dc_delta_q, |
| 501 | v_ac_delta_q, |
| 502 | qmatrix_fields, |
| 503 | mode_control_fields, |
| 504 | cdef_damping_minus_3, |
| 505 | cdef_bits, |
| 506 | cdef_y_strengths, |
| 507 | cdef_uv_strengths, |
| 508 | loop_restoration_fields, |
| 509 | wm, |
| 510 | va_reserved: Default::default(), |
| 511 | })) |
| 512 | } |
| 513 | |
| 514 | pub(crate) fn inner_mut(&mut self) -> &mut bindings::VADecPictureParameterBufferAV1 { |
| 515 | self.0.as_mut() |
| 516 | } |
| 517 | } |
| 518 | |
| 519 | /// A wrapper over an array of the `VASliceParameterBufferAV1` FFI type. This |
| 520 | /// allows for passing all tile parameters in a single call if multiple tiles |
| 521 | /// are present in the tile group. |
| 522 | #[derive(Default)] |
| 523 | pub struct SliceParameterBufferAV1(Vec<bindings::VASliceParameterBufferAV1>); |
| 524 | |
| 525 | impl SliceParameterBufferAV1 { |
| 526 | /// Creates the wrapper |
| 527 | pub fn new() -> Self { |
| 528 | Default::default() |
| 529 | } |
| 530 | |
| 531 | /// Adds a slice parameter to the wrapper |
| 532 | #[allow(clippy::too_many_arguments)] |
| 533 | pub fn add_slice_parameter( |
| 534 | &mut self, |
| 535 | slice_data_size: u32, |
| 536 | slice_data_offset: u32, |
| 537 | slice_data_flag: u32, |
| 538 | tile_row: u16, |
| 539 | tile_column: u16, |
| 540 | tg_start: u16, |
| 541 | tg_end: u16, |
| 542 | anchor_frame_idx: u8, |
| 543 | tile_idx_in_tile_list: u16, |
| 544 | ) { |
| 545 | self.0.push(bindings::VASliceParameterBufferAV1 { |
| 546 | slice_data_size, |
| 547 | slice_data_offset, |
| 548 | slice_data_flag, |
| 549 | tile_row, |
| 550 | tile_column, |
| 551 | tg_start, |
| 552 | tg_end, |
| 553 | anchor_frame_idx, |
| 554 | tile_idx_in_tile_list, |
| 555 | va_reserved: Default::default(), |
| 556 | }); |
| 557 | } |
| 558 | |
| 559 | pub(crate) fn inner_mut(&mut self) -> &mut Vec<bindings::VASliceParameterBufferAV1> { |
| 560 | self.0.as_mut() |
| 561 | } |
| 562 | } |
| 563 | |
| 564 | pub struct AV1EncSeqFields(bindings::_VAEncSequenceParameterBufferAV1__bindgen_ty_1); |
| 565 | |
| 566 | impl AV1EncSeqFields { |
| 567 | pub fn new( |
| 568 | still_picture: bool, |
| 569 | use_128x128_superblock: bool, |
| 570 | enable_filter_intra: bool, |
| 571 | enable_intra_edge_filter: bool, |
| 572 | enable_interintra_compound: bool, |
| 573 | enable_masked_compound: bool, |
| 574 | enable_warped_motion: bool, |
| 575 | enable_dual_filter: bool, |
| 576 | enable_order_hint: bool, |
| 577 | enable_jnt_comp: bool, |
| 578 | enable_ref_frame_mvs: bool, |
| 579 | enable_superres: bool, |
| 580 | enable_cdef: bool, |
| 581 | enable_restoration: bool, |
| 582 | bit_depth_minus8: u32, |
| 583 | subsampling_x: bool, |
| 584 | subsampling_y: bool, |
| 585 | mono_chrome: bool, |
| 586 | ) -> Self { |
| 587 | let still_picture = still_picture as u32; |
| 588 | let use_128x128_superblock = use_128x128_superblock as u32; |
| 589 | let enable_filter_intra = enable_filter_intra as u32; |
| 590 | let enable_intra_edge_filter = enable_intra_edge_filter as u32; |
| 591 | let enable_interintra_compound = enable_interintra_compound as u32; |
| 592 | let enable_masked_compound = enable_masked_compound as u32; |
| 593 | let enable_warped_motion = enable_warped_motion as u32; |
| 594 | let enable_dual_filter = enable_dual_filter as u32; |
| 595 | let enable_order_hint = enable_order_hint as u32; |
| 596 | let enable_jnt_comp = enable_jnt_comp as u32; |
| 597 | let enable_ref_frame_mvs = enable_ref_frame_mvs as u32; |
| 598 | let enable_superres = enable_superres as u32; |
| 599 | let enable_cdef = enable_cdef as u32; |
| 600 | let enable_restoration = enable_restoration as u32; |
| 601 | let subsampling_x = subsampling_x as u32; |
| 602 | let subsampling_y = subsampling_y as u32; |
| 603 | let mono_chrome = mono_chrome as u32; |
| 604 | |
| 605 | let _bitfield_1 = |
| 606 | bindings::_VAEncSequenceParameterBufferAV1__bindgen_ty_1__bindgen_ty_1::new_bitfield_1( |
| 607 | still_picture, |
| 608 | use_128x128_superblock, |
| 609 | enable_filter_intra, |
| 610 | enable_intra_edge_filter, |
| 611 | enable_interintra_compound, |
| 612 | enable_masked_compound, |
| 613 | enable_warped_motion, |
| 614 | enable_dual_filter, |
| 615 | enable_order_hint, |
| 616 | enable_jnt_comp, |
| 617 | enable_ref_frame_mvs, |
| 618 | enable_superres, |
| 619 | enable_cdef, |
| 620 | enable_restoration, |
| 621 | bit_depth_minus8, |
| 622 | subsampling_x, |
| 623 | subsampling_y, |
| 624 | #[cfg(libva_1_19_or_higher)] |
| 625 | mono_chrome, |
| 626 | Default::default(), |
| 627 | ); |
| 628 | |
| 629 | Self(bindings::_VAEncSequenceParameterBufferAV1__bindgen_ty_1 { |
| 630 | bits: bindings::_VAEncSequenceParameterBufferAV1__bindgen_ty_1__bindgen_ty_1 { |
| 631 | _bitfield_align_1: Default::default(), |
| 632 | _bitfield_1, |
| 633 | }, |
| 634 | }) |
| 635 | } |
| 636 | } |
| 637 | |
| 638 | #[derive(Default)] |
| 639 | pub struct EncSequenceParameterBufferAV1(Box<bindings::VAEncSequenceParameterBufferAV1>); |
| 640 | |
| 641 | impl EncSequenceParameterBufferAV1 { |
| 642 | pub fn new( |
| 643 | seq_profile: u8, |
| 644 | seq_level_idx: u8, |
| 645 | seq_tier: u8, |
| 646 | hierarchical_flag: u8, |
| 647 | intra_period: u32, |
| 648 | ip_period: u32, |
| 649 | bits_per_second: u32, |
| 650 | seq_fields: &AV1EncSeqFields, |
| 651 | order_hint_bits_minus_1: u8, |
| 652 | ) -> Self { |
| 653 | let seq_fields = seq_fields.0; |
| 654 | |
| 655 | Self(Box::new(bindings::_VAEncSequenceParameterBufferAV1 { |
| 656 | seq_profile, |
| 657 | seq_level_idx, |
| 658 | seq_tier, |
| 659 | #[cfg(libva_1_16_or_higher)] |
| 660 | hierarchical_flag, |
| 661 | intra_period, |
| 662 | ip_period, |
| 663 | bits_per_second, |
| 664 | seq_fields, |
| 665 | order_hint_bits_minus_1, |
| 666 | ..Default::default() |
| 667 | })) |
| 668 | } |
| 669 | |
| 670 | pub(crate) fn inner_mut(&mut self) -> &mut bindings::VAEncSequenceParameterBufferAV1 { |
| 671 | &mut self.0 |
| 672 | } |
| 673 | } |
| 674 | |
| 675 | #[derive(Default)] |
| 676 | pub struct RefFrameCtrlAV1(bindings::VARefFrameCtrlAV1); |
| 677 | |
| 678 | impl RefFrameCtrlAV1 { |
| 679 | pub fn new( |
| 680 | search_idx0: u32, |
| 681 | search_idx1: u32, |
| 682 | search_idx2: u32, |
| 683 | search_idx3: u32, |
| 684 | search_idx4: u32, |
| 685 | search_idx5: u32, |
| 686 | search_idx6: u32, |
| 687 | ) -> Self { |
| 688 | let _bitfield_1 = bindings::VARefFrameCtrlAV1__bindgen_ty_1::new_bitfield_1( |
| 689 | search_idx0, |
| 690 | search_idx1, |
| 691 | search_idx2, |
| 692 | search_idx3, |
| 693 | search_idx4, |
| 694 | search_idx5, |
| 695 | search_idx6, |
| 696 | Default::default(), |
| 697 | ); |
| 698 | |
| 699 | Self(bindings::VARefFrameCtrlAV1 { |
| 700 | fields: bindings::VARefFrameCtrlAV1__bindgen_ty_1 { |
| 701 | _bitfield_align_1: Default::default(), |
| 702 | _bitfield_1, |
| 703 | }, |
| 704 | }) |
| 705 | } |
| 706 | } |
| 707 | |
| 708 | #[derive(Default)] |
| 709 | pub struct AV1EncPictureFlags(bindings::_VAEncPictureParameterBufferAV1__bindgen_ty_1); |
| 710 | |
| 711 | impl AV1EncPictureFlags { |
| 712 | pub fn new( |
| 713 | frame_type: u32, |
| 714 | error_resilient_mode: bool, |
| 715 | disable_cdf_update: bool, |
| 716 | use_superres: bool, |
| 717 | allow_high_precision_mv: bool, |
| 718 | use_ref_frame_mvs: bool, |
| 719 | disable_frame_end_update_cdf: bool, |
| 720 | reduced_tx_set: bool, |
| 721 | enable_frame_obu: bool, |
| 722 | long_term_reference: bool, |
| 723 | disable_frame_recon: bool, |
| 724 | allow_intrabc: bool, |
| 725 | palette_mode_enable: bool, |
| 726 | allow_screen_content_tools: bool, |
| 727 | force_integer_mv: bool, |
| 728 | ) -> Self { |
| 729 | let error_resilient_mode = error_resilient_mode as u32; |
| 730 | let disable_cdf_update = disable_cdf_update as u32; |
| 731 | let use_superres = use_superres as u32; |
| 732 | let allow_high_precision_mv = allow_high_precision_mv as u32; |
| 733 | let use_ref_frame_mvs = use_ref_frame_mvs as u32; |
| 734 | let disable_frame_end_update_cdf = disable_frame_end_update_cdf as u32; |
| 735 | let reduced_tx_set = reduced_tx_set as u32; |
| 736 | let enable_frame_obu = enable_frame_obu as u32; |
| 737 | let long_term_reference = long_term_reference as u32; |
| 738 | let disable_frame_recon = disable_frame_recon as u32; |
| 739 | let allow_intrabc = allow_intrabc as u32; |
| 740 | let palette_mode_enable = palette_mode_enable as u32; |
| 741 | #[cfg(libva_1_21_or_higher)] |
| 742 | let allow_screen_content_tools = allow_screen_content_tools as u32; |
| 743 | #[cfg(libva_1_21_or_higher)] |
| 744 | let force_integer_mv = force_integer_mv as u32; |
| 745 | |
| 746 | let _bitfield_1 = { |
| 747 | bindings::_VAEncPictureParameterBufferAV1__bindgen_ty_1__bindgen_ty_1::new_bitfield_1( |
| 748 | frame_type, |
| 749 | error_resilient_mode, |
| 750 | disable_cdf_update, |
| 751 | use_superres, |
| 752 | allow_high_precision_mv, |
| 753 | use_ref_frame_mvs, |
| 754 | disable_frame_end_update_cdf, |
| 755 | reduced_tx_set, |
| 756 | enable_frame_obu, |
| 757 | long_term_reference, |
| 758 | disable_frame_recon, |
| 759 | allow_intrabc, |
| 760 | palette_mode_enable, |
| 761 | #[cfg(libva_1_21_or_higher)] |
| 762 | allow_screen_content_tools, |
| 763 | #[cfg(libva_1_21_or_higher)] |
| 764 | force_integer_mv, |
| 765 | Default::default(), |
| 766 | ) |
| 767 | }; |
| 768 | Self(bindings::_VAEncPictureParameterBufferAV1__bindgen_ty_1 { |
| 769 | bits: bindings::_VAEncPictureParameterBufferAV1__bindgen_ty_1__bindgen_ty_1 { |
| 770 | _bitfield_align_1: Default::default(), |
| 771 | _bitfield_1, |
| 772 | }, |
| 773 | }) |
| 774 | } |
| 775 | } |
| 776 | |
| 777 | #[derive(Default)] |
| 778 | pub struct AV1EncLoopFilterFlags(bindings::_VAEncPictureParameterBufferAV1__bindgen_ty_2); |
| 779 | |
| 780 | impl AV1EncLoopFilterFlags { |
| 781 | pub fn new( |
| 782 | sharpness_level: u8, |
| 783 | mode_ref_delta_enabled: bool, |
| 784 | mode_ref_delta_update: bool, |
| 785 | ) -> Self { |
| 786 | let mode_ref_delta_enabled = mode_ref_delta_enabled as u8; |
| 787 | let mode_ref_delta_update = mode_ref_delta_update as u8; |
| 788 | |
| 789 | let _bitfield_1 = |
| 790 | bindings::_VAEncPictureParameterBufferAV1__bindgen_ty_2__bindgen_ty_1::new_bitfield_1( |
| 791 | sharpness_level, |
| 792 | mode_ref_delta_enabled, |
| 793 | mode_ref_delta_update, |
| 794 | Default::default(), |
| 795 | ); |
| 796 | |
| 797 | Self(bindings::_VAEncPictureParameterBufferAV1__bindgen_ty_2 { |
| 798 | bits: bindings::_VAEncPictureParameterBufferAV1__bindgen_ty_2__bindgen_ty_1 { |
| 799 | _bitfield_align_1: Default::default(), |
| 800 | _bitfield_1, |
| 801 | }, |
| 802 | }) |
| 803 | } |
| 804 | } |
| 805 | |
| 806 | #[derive(Default)] |
| 807 | pub struct AV1EncQMatrixFlags(bindings::_VAEncPictureParameterBufferAV1__bindgen_ty_3); |
| 808 | |
| 809 | impl AV1EncQMatrixFlags { |
| 810 | pub fn new(using_qmatrix: bool, qm_y: u16, qm_u: u16, qm_v: u16) -> Self { |
| 811 | let using_qmatrix = using_qmatrix as u16; |
| 812 | |
| 813 | let _bitfield_1 = |
| 814 | bindings::_VAEncPictureParameterBufferAV1__bindgen_ty_3__bindgen_ty_1::new_bitfield_1( |
| 815 | using_qmatrix, |
| 816 | qm_y, |
| 817 | qm_u, |
| 818 | qm_v, |
| 819 | Default::default(), |
| 820 | ); |
| 821 | |
| 822 | Self(bindings::_VAEncPictureParameterBufferAV1__bindgen_ty_3 { |
| 823 | bits: bindings::_VAEncPictureParameterBufferAV1__bindgen_ty_3__bindgen_ty_1 { |
| 824 | _bitfield_1, |
| 825 | _bitfield_align_1: Default::default(), |
| 826 | }, |
| 827 | }) |
| 828 | } |
| 829 | } |
| 830 | |
| 831 | #[derive(Default)] |
| 832 | pub struct AV1EncModeControlFlags(bindings::_VAEncPictureParameterBufferAV1__bindgen_ty_4); |
| 833 | |
| 834 | impl AV1EncModeControlFlags { |
| 835 | pub fn new( |
| 836 | delta_q_present: bool, |
| 837 | delta_q_res: u32, |
| 838 | delta_lf_present: bool, |
| 839 | delta_lf_res: u32, |
| 840 | delta_lf_multi: bool, |
| 841 | tx_mode: u32, |
| 842 | reference_mode: u32, |
| 843 | skip_mode_present: bool, |
| 844 | ) -> Self { |
| 845 | let delta_q_present = delta_q_present as u32; |
| 846 | let delta_lf_present = delta_lf_present as u32; |
| 847 | let delta_lf_multi = delta_lf_multi as u32; |
| 848 | let skip_mode_present = skip_mode_present as u32; |
| 849 | |
| 850 | let _bitfield_1 = |
| 851 | bindings::_VAEncPictureParameterBufferAV1__bindgen_ty_4__bindgen_ty_1::new_bitfield_1( |
| 852 | delta_q_present, |
| 853 | delta_q_res, |
| 854 | delta_lf_present, |
| 855 | delta_lf_res, |
| 856 | delta_lf_multi, |
| 857 | tx_mode, |
| 858 | reference_mode, |
| 859 | skip_mode_present, |
| 860 | Default::default(), |
| 861 | ); |
| 862 | |
| 863 | Self(bindings::_VAEncPictureParameterBufferAV1__bindgen_ty_4 { |
| 864 | bits: bindings::_VAEncPictureParameterBufferAV1__bindgen_ty_4__bindgen_ty_1 { |
| 865 | _bitfield_align_1: Default::default(), |
| 866 | _bitfield_1, |
| 867 | }, |
| 868 | }) |
| 869 | } |
| 870 | } |
| 871 | |
| 872 | #[derive(Default)] |
| 873 | pub struct EncSegParamFlagsAV1(bindings::_VAEncSegParamAV1__bindgen_ty_1); |
| 874 | |
| 875 | impl EncSegParamFlagsAV1 { |
| 876 | pub fn new( |
| 877 | segmentation_enabled: bool, |
| 878 | segmentation_update_map: bool, |
| 879 | segmentation_temporal_update: bool, |
| 880 | ) -> Self { |
| 881 | let segmentation_enabled = segmentation_enabled as u8; |
| 882 | let segmentation_update_map = segmentation_update_map as u8; |
| 883 | let segmentation_temporal_update = segmentation_temporal_update as u8; |
| 884 | |
| 885 | let _bitfield_1 = bindings::_VAEncSegParamAV1__bindgen_ty_1__bindgen_ty_1::new_bitfield_1( |
| 886 | segmentation_enabled, |
| 887 | segmentation_update_map, |
| 888 | segmentation_temporal_update, |
| 889 | Default::default(), |
| 890 | ); |
| 891 | |
| 892 | Self(bindings::_VAEncSegParamAV1__bindgen_ty_1 { |
| 893 | bits: bindings::_VAEncSegParamAV1__bindgen_ty_1__bindgen_ty_1 { |
| 894 | _bitfield_align_1: Default::default(), |
| 895 | _bitfield_1, |
| 896 | }, |
| 897 | }) |
| 898 | } |
| 899 | } |
| 900 | |
| 901 | #[derive(Default)] |
| 902 | pub struct EncSegParamAV1(bindings::VAEncSegParamAV1); |
| 903 | |
| 904 | impl EncSegParamAV1 { |
| 905 | pub fn new( |
| 906 | seg_flags: &EncSegParamFlagsAV1, |
| 907 | segment_number: u8, |
| 908 | feature_data: [[i16; 8usize]; 8usize], |
| 909 | feature_mask: [u8; 8usize], |
| 910 | ) -> Self { |
| 911 | let seg_flags = seg_flags.0; |
| 912 | |
| 913 | Self(bindings::_VAEncSegParamAV1 { |
| 914 | seg_flags, |
| 915 | segment_number, |
| 916 | feature_data, |
| 917 | feature_mask, |
| 918 | va_reserved: Default::default(), |
| 919 | }) |
| 920 | } |
| 921 | } |
| 922 | |
| 923 | pub struct AV1EncLoopRestorationFlags(bindings::_VAEncPictureParameterBufferAV1__bindgen_ty_5); |
| 924 | |
| 925 | impl AV1EncLoopRestorationFlags { |
| 926 | pub fn new( |
| 927 | yframe_restoration_type: u16, |
| 928 | cbframe_restoration_type: u16, |
| 929 | crframe_restoration_type: u16, |
| 930 | lr_unit_shift: u16, |
| 931 | lr_uv_shift: bool, |
| 932 | ) -> Self { |
| 933 | let lr_uv_shift = lr_uv_shift as u16; |
| 934 | |
| 935 | let _bitfield_1 = |
| 936 | bindings::_VAEncPictureParameterBufferAV1__bindgen_ty_5__bindgen_ty_1::new_bitfield_1( |
| 937 | yframe_restoration_type, |
| 938 | cbframe_restoration_type, |
| 939 | crframe_restoration_type, |
| 940 | lr_unit_shift, |
| 941 | lr_uv_shift, |
| 942 | Default::default(), |
| 943 | ); |
| 944 | |
| 945 | Self(bindings::_VAEncPictureParameterBufferAV1__bindgen_ty_5 { |
| 946 | bits: bindings::_VAEncPictureParameterBufferAV1__bindgen_ty_5__bindgen_ty_1 { |
| 947 | _bitfield_align_1: Default::default(), |
| 948 | _bitfield_1, |
| 949 | }, |
| 950 | }) |
| 951 | } |
| 952 | } |
| 953 | |
| 954 | #[derive(Default, Copy, Clone)] |
| 955 | pub struct EncWarpedMotionParamsAV1(bindings::VAEncWarpedMotionParamsAV1); |
| 956 | |
| 957 | impl EncWarpedMotionParamsAV1 { |
| 958 | pub fn new( |
| 959 | wmtype: bindings::VAEncTransformationTypeAV1::Type, |
| 960 | wmmat: [i32; 8usize], |
| 961 | invalid: u8, |
| 962 | ) -> Self { |
| 963 | Self(bindings::_VAEncWarpedMotionParamsAV1 { |
| 964 | wmtype, |
| 965 | wmmat, |
| 966 | invalid, |
| 967 | va_reserved: Default::default(), |
| 968 | }) |
| 969 | } |
| 970 | } |
| 971 | |
| 972 | pub struct AV1EncTileGroupObuHdrInfo(bindings::_VAEncPictureParameterBufferAV1__bindgen_ty_6); |
| 973 | |
| 974 | impl AV1EncTileGroupObuHdrInfo { |
| 975 | pub fn new( |
| 976 | obu_extension_flag: bool, |
| 977 | obu_has_size_field: bool, |
| 978 | temporal_id: u8, |
| 979 | spatial_id: u8, |
| 980 | ) -> Self { |
| 981 | let obu_extension_flag = obu_extension_flag as u8; |
| 982 | let obu_has_size_field = obu_has_size_field as u8; |
| 983 | |
| 984 | let _bitfield_1 = |
| 985 | bindings::_VAEncPictureParameterBufferAV1__bindgen_ty_6__bindgen_ty_1::new_bitfield_1( |
| 986 | obu_extension_flag, |
| 987 | obu_has_size_field, |
| 988 | temporal_id, |
| 989 | spatial_id, |
| 990 | Default::default(), |
| 991 | ); |
| 992 | |
| 993 | Self(bindings::_VAEncPictureParameterBufferAV1__bindgen_ty_6 { |
| 994 | bits: bindings::_VAEncPictureParameterBufferAV1__bindgen_ty_6__bindgen_ty_1 { |
| 995 | _bitfield_align_1: Default::default(), |
| 996 | _bitfield_1, |
| 997 | }, |
| 998 | }) |
| 999 | } |
| 1000 | } |
| 1001 | |
| 1002 | #[derive(Default)] |
| 1003 | pub struct EncPictureParameterBufferAV1(Box<bindings::VAEncPictureParameterBufferAV1>); |
| 1004 | |
| 1005 | impl EncPictureParameterBufferAV1 { |
| 1006 | pub fn new( |
| 1007 | frame_width_minus_1: u16, |
| 1008 | frame_height_minus_1: u16, |
| 1009 | reconstructed_frame: bindings::VASurfaceID, |
| 1010 | coded_buf: bindings::VABufferID, |
| 1011 | reference_frames: [bindings::VASurfaceID; 8usize], |
| 1012 | ref_frame_idx: [u8; 7usize], |
| 1013 | hierarchical_level_plus1: u8, |
| 1014 | primary_ref_frame: u8, |
| 1015 | order_hint: u8, |
| 1016 | refresh_frame_flags: u8, |
| 1017 | ref_frame_ctrl_l0: &RefFrameCtrlAV1, |
| 1018 | ref_frame_ctrl_l1: &RefFrameCtrlAV1, |
| 1019 | picture_flags: &AV1EncPictureFlags, |
| 1020 | seg_id_block_size: u8, |
| 1021 | num_tile_groups_minus1: u8, |
| 1022 | temporal_id: u8, |
| 1023 | filter_level: [u8; 2usize], |
| 1024 | filter_level_u: u8, |
| 1025 | filter_level_v: u8, |
| 1026 | loop_filter_flags: &AV1EncLoopFilterFlags, |
| 1027 | superres_scale_denominator: u8, |
| 1028 | interpolation_filter: u8, |
| 1029 | ref_deltas: [i8; 8usize], |
| 1030 | mode_deltas: [i8; 2usize], |
| 1031 | base_qindex: u8, |
| 1032 | y_dc_delta_q: i8, |
| 1033 | u_dc_delta_q: i8, |
| 1034 | u_ac_delta_q: i8, |
| 1035 | v_dc_delta_q: i8, |
| 1036 | v_ac_delta_q: i8, |
| 1037 | min_base_qindex: u8, |
| 1038 | max_base_qindex: u8, |
| 1039 | qmatrix_flags: &AV1EncQMatrixFlags, |
| 1040 | mode_control_flags: &AV1EncModeControlFlags, |
| 1041 | segments: &EncSegParamAV1, |
| 1042 | tile_cols: u8, |
| 1043 | tile_rows: u8, |
| 1044 | width_in_sbs_minus_1: [u16; 63usize], |
| 1045 | height_in_sbs_minus_1: [u16; 63usize], |
| 1046 | context_update_tile_id: u16, |
| 1047 | cdef_damping_minus_3: u8, |
| 1048 | cdef_bits: u8, |
| 1049 | cdef_y_strengths: [u8; 8usize], |
| 1050 | cdef_uv_strengths: [u8; 8usize], |
| 1051 | loop_restoration_flags: &AV1EncLoopRestorationFlags, |
| 1052 | wm: [EncWarpedMotionParamsAV1; 7usize], |
| 1053 | bit_offset_qindex: u32, |
| 1054 | bit_offset_segmentation: u32, |
| 1055 | bit_offset_loopfilter_params: u32, |
| 1056 | bit_offset_cdef_params: u32, |
| 1057 | size_in_bits_cdef_params: u32, |
| 1058 | byte_offset_frame_hdr_obu_size: u32, |
| 1059 | size_in_bits_frame_hdr_obu: u32, |
| 1060 | tile_group_obu_hdr_info: &AV1EncTileGroupObuHdrInfo, |
| 1061 | number_skip_frames: u8, |
| 1062 | skip_frames_reduced_size: i32, |
| 1063 | ) -> Self { |
| 1064 | let ref_frame_ctrl_l0 = ref_frame_ctrl_l0.0; |
| 1065 | let ref_frame_ctrl_l1 = ref_frame_ctrl_l1.0; |
| 1066 | let picture_flags = picture_flags.0; |
| 1067 | let loop_filter_flags = loop_filter_flags.0; |
| 1068 | let qmatrix_flags = qmatrix_flags.0; |
| 1069 | let mode_control_flags = mode_control_flags.0; |
| 1070 | let segments = segments.0; |
| 1071 | let loop_restoration_flags = loop_restoration_flags.0; |
| 1072 | let wm = wm.map(|e| e.0); |
| 1073 | let tile_group_obu_hdr_info = tile_group_obu_hdr_info.0; |
| 1074 | |
| 1075 | Self(Box::new(bindings::_VAEncPictureParameterBufferAV1 { |
| 1076 | frame_width_minus_1, |
| 1077 | frame_height_minus_1, |
| 1078 | reconstructed_frame, |
| 1079 | coded_buf, |
| 1080 | reference_frames, |
| 1081 | ref_frame_idx, |
| 1082 | #[cfg(libva_1_19_or_higher)] |
| 1083 | hierarchical_level_plus1, |
| 1084 | primary_ref_frame, |
| 1085 | order_hint, |
| 1086 | refresh_frame_flags, |
| 1087 | ref_frame_ctrl_l0, |
| 1088 | ref_frame_ctrl_l1, |
| 1089 | picture_flags, |
| 1090 | seg_id_block_size, |
| 1091 | num_tile_groups_minus1, |
| 1092 | temporal_id, |
| 1093 | filter_level, |
| 1094 | filter_level_u, |
| 1095 | filter_level_v, |
| 1096 | loop_filter_flags, |
| 1097 | superres_scale_denominator, |
| 1098 | interpolation_filter, |
| 1099 | ref_deltas, |
| 1100 | mode_deltas, |
| 1101 | base_qindex, |
| 1102 | y_dc_delta_q, |
| 1103 | u_dc_delta_q, |
| 1104 | u_ac_delta_q, |
| 1105 | v_dc_delta_q, |
| 1106 | v_ac_delta_q, |
| 1107 | min_base_qindex, |
| 1108 | max_base_qindex, |
| 1109 | qmatrix_flags, |
| 1110 | mode_control_flags, |
| 1111 | segments, |
| 1112 | tile_cols, |
| 1113 | tile_rows, |
| 1114 | width_in_sbs_minus_1, |
| 1115 | height_in_sbs_minus_1, |
| 1116 | context_update_tile_id, |
| 1117 | cdef_damping_minus_3, |
| 1118 | cdef_bits, |
| 1119 | cdef_y_strengths, |
| 1120 | cdef_uv_strengths, |
| 1121 | loop_restoration_flags, |
| 1122 | wm, |
| 1123 | bit_offset_qindex, |
| 1124 | bit_offset_segmentation, |
| 1125 | bit_offset_loopfilter_params, |
| 1126 | bit_offset_cdef_params, |
| 1127 | size_in_bits_cdef_params, |
| 1128 | byte_offset_frame_hdr_obu_size, |
| 1129 | size_in_bits_frame_hdr_obu, |
| 1130 | tile_group_obu_hdr_info, |
| 1131 | number_skip_frames, |
| 1132 | skip_frames_reduced_size, |
| 1133 | ..Default::default() |
| 1134 | })) |
| 1135 | } |
| 1136 | |
| 1137 | pub(crate) fn inner_mut(&mut self) -> &mut bindings::VAEncPictureParameterBufferAV1 { |
| 1138 | &mut self.0 |
| 1139 | } |
| 1140 | } |
| 1141 | |
| 1142 | pub struct EncTileGroupBufferAV1(Box<bindings::VAEncTileGroupBufferAV1>); |
| 1143 | |
| 1144 | impl EncTileGroupBufferAV1 { |
| 1145 | pub fn new(tg_start: u8, tg_end: u8) -> Self { |
| 1146 | Self(Box::new(bindings::VAEncTileGroupBufferAV1 { |
| 1147 | tg_start, |
| 1148 | tg_end, |
| 1149 | va_reserved: Default::default(), |
| 1150 | })) |
| 1151 | } |
| 1152 | |
| 1153 | pub(crate) fn inner_mut(&mut self) -> &mut bindings::VAEncTileGroupBufferAV1 { |
| 1154 | &mut self.0 |
| 1155 | } |
| 1156 | } |