| 1 | |
| 2 | |
| 3 | |
| 4 | use ec_va::sys::{ |
| 5 | VAEncPackedHeaderParameterBufferType, VAEncPictureParameterBufferType, |
| 6 | VAEncSequenceParameterBufferType, VAEncSliceParameterBufferType, VASurfaceID, |
| 7 | }; |
| 8 | |
| 9 | use super::VaParam; |
| 10 | use super::h264::VAPictureH264; |
| 11 | use super::hevc::VAPictureHEVC; |
| 12 | use crate::va_bits; |
| 13 | |
| 14 | |
| 15 | pub const PACKED_HEADER_SEQUENCE: u32 = 1; |
| 16 | |
| 17 | pub const PACKED_HEADER_PICTURE: u32 = 2; |
| 18 | |
| 19 | pub const PACKED_HEADER_SLICE: u32 = 3; |
| 20 | |
| 21 | pub const PACKED_HEADER_RAW_DATA: u32 = 4; |
| 22 | |
| 23 | |
| 24 | pub const MISC_FRAME_RATE: u32 = 0; |
| 25 | |
| 26 | pub const MISC_RATE_CONTROL: u32 = 1; |
| 27 | |
| 28 | pub const MISC_HRD: u32 = 5; |
| 29 | |
| 30 | pub const MISC_QUALITY_LEVEL: u32 = 6; |
| 31 | |
| 32 | |
| 33 | #[repr(C)] |
| 34 | #[derive(Debug, Clone, Copy, Default)] |
| 35 | pub struct PackedHeaderParameterBuffer { |
| 36 | |
| 37 | pub type_: u32, |
| 38 | |
| 39 | pub bit_length: u32, |
| 40 | |
| 41 | pub has_emulation_bytes: u8, |
| 42 | pub(crate) va_reserved: [u32; 4], |
| 43 | } |
| 44 | |
| 45 | impl PackedHeaderParameterBuffer { |
| 46 | |
| 47 | |
| 48 | pub fn escaped(type_: u32, bytes: usize) -> PackedHeaderParameterBuffer { |
| 49 | PackedHeaderParameterBuffer { |
| 50 | type_, |
| 51 | bit_length: (bytes * 8) as u32, |
| 52 | has_emulation_bytes: 1, |
| 53 | va_reserved: [0; 4], |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | |
| 59 | |
| 60 | unsafe impl VaParam for PackedHeaderParameterBuffer { |
| 61 | const TYPE: i32 = VAEncPackedHeaderParameterBufferType; |
| 62 | } |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | #[derive(Debug, Clone, Copy, Default)] |
| 71 | pub struct RateControl { |
| 72 | |
| 73 | pub bits_per_second: u32, |
| 74 | |
| 75 | pub target_percentage: u32, |
| 76 | |
| 77 | pub window_size: u32, |
| 78 | |
| 79 | pub initial_qp: u32, |
| 80 | |
| 81 | pub min_qp: u32, |
| 82 | |
| 83 | pub max_qp: u32, |
| 84 | } |
| 85 | |
| 86 | impl RateControl { |
| 87 | |
| 88 | pub fn words(&self) -> [u32; 15] { |
| 89 | [ |
| 90 | self.bits_per_second, |
| 91 | self.target_percentage, |
| 92 | self.window_size, |
| 93 | self.initial_qp, |
| 94 | self.min_qp, |
| 95 | 0, |
| 96 | 0, |
| 97 | 0, |
| 98 | self.max_qp, |
| 99 | 0, |
| 100 | 0, |
| 101 | 0, |
| 102 | 0, |
| 103 | 0, |
| 104 | 0, |
| 105 | ] |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | |
| 110 | #[derive(Debug, Clone, Copy)] |
| 111 | pub struct FrameRate { |
| 112 | |
| 113 | pub num: u32, |
| 114 | |
| 115 | pub den: u32, |
| 116 | } |
| 117 | |
| 118 | impl FrameRate { |
| 119 | |
| 120 | |
| 121 | pub fn words(&self) -> [u32; 6] { |
| 122 | let packed = if self.den <= 1 { |
| 123 | self.num |
| 124 | } else { |
| 125 | (self.den << 16) | (self.num & 0xffff) |
| 126 | }; |
| 127 | [packed, 0, 0, 0, 0, 0] |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | |
| 132 | #[derive(Debug, Clone, Copy, Default)] |
| 133 | pub struct Hrd { |
| 134 | |
| 135 | pub initial_buffer_fullness: u32, |
| 136 | |
| 137 | pub buffer_size: u32, |
| 138 | } |
| 139 | |
| 140 | impl Hrd { |
| 141 | |
| 142 | pub fn words(&self) -> [u32; 6] { |
| 143 | [self.initial_buffer_fullness, self.buffer_size, 0, 0, 0, 0] |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | |
| 148 | pub fn misc_bytes(type_: u32, words: &[u32]) -> Vec<u8> { |
| 149 | let mut out = Vec::with_capacity(4 + words.len() * 4); |
| 150 | out.extend_from_slice(&type_.to_ne_bytes()); |
| 151 | for w in words { |
| 152 | out.extend_from_slice(&w.to_ne_bytes()); |
| 153 | } |
| 154 | out |
| 155 | } |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | va_bits! { |
| 162 | |
| 163 | H264SeqFields: u32 { |
| 164 | chroma_format_idc: 2, |
| 165 | frame_mbs_only_flag: 1, |
| 166 | mb_adaptive_frame_field_flag: 1, |
| 167 | seq_scaling_matrix_present_flag: 1, |
| 168 | direct_8x8_inference_flag: 1, |
| 169 | log2_max_frame_num_minus4: 4, |
| 170 | pic_order_cnt_type: 2, |
| 171 | log2_max_pic_order_cnt_lsb_minus4: 4, |
| 172 | delta_pic_order_always_zero_flag: 1, |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | va_bits! { |
| 177 | |
| 178 | H264VuiFields: u32 { |
| 179 | aspect_ratio_info_present_flag: 1, |
| 180 | timing_info_present_flag: 1, |
| 181 | bitstream_restriction_flag: 1, |
| 182 | log2_max_mv_length_horizontal: 5, |
| 183 | log2_max_mv_length_vertical: 5, |
| 184 | fixed_frame_rate_flag: 1, |
| 185 | low_delay_hrd_flag: 1, |
| 186 | motion_vectors_over_pic_boundaries_flag: 1, |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | |
| 191 | #[repr(C)] |
| 192 | #[derive(Debug, Clone, Copy)] |
| 193 | pub struct EncSequenceParameterBufferH264 { |
| 194 | |
| 195 | pub seq_parameter_set_id: u8, |
| 196 | |
| 197 | pub level_idc: u8, |
| 198 | |
| 199 | pub intra_period: u32, |
| 200 | |
| 201 | pub intra_idr_period: u32, |
| 202 | |
| 203 | pub ip_period: u32, |
| 204 | |
| 205 | pub bits_per_second: u32, |
| 206 | |
| 207 | pub max_num_ref_frames: u32, |
| 208 | |
| 209 | pub picture_width_in_mbs: u16, |
| 210 | |
| 211 | pub picture_height_in_mbs: u16, |
| 212 | |
| 213 | pub seq_fields: H264SeqFields, |
| 214 | |
| 215 | pub bit_depth_luma_minus8: u8, |
| 216 | |
| 217 | pub bit_depth_chroma_minus8: u8, |
| 218 | |
| 219 | pub num_ref_frames_in_pic_order_cnt_cycle: u8, |
| 220 | |
| 221 | pub offset_for_non_ref_pic: i32, |
| 222 | |
| 223 | pub offset_for_top_to_bottom_field: i32, |
| 224 | |
| 225 | pub offset_for_ref_frame: [i32; 256], |
| 226 | |
| 227 | pub frame_cropping_flag: u8, |
| 228 | |
| 229 | pub frame_crop_left_offset: u32, |
| 230 | |
| 231 | pub frame_crop_right_offset: u32, |
| 232 | |
| 233 | pub frame_crop_top_offset: u32, |
| 234 | |
| 235 | pub frame_crop_bottom_offset: u32, |
| 236 | |
| 237 | pub vui_parameters_present_flag: u8, |
| 238 | |
| 239 | pub vui_fields: H264VuiFields, |
| 240 | |
| 241 | pub aspect_ratio_idc: u8, |
| 242 | |
| 243 | pub sar_width: u32, |
| 244 | |
| 245 | pub sar_height: u32, |
| 246 | |
| 247 | pub num_units_in_tick: u32, |
| 248 | |
| 249 | pub time_scale: u32, |
| 250 | pub(crate) va_reserved: [u32; 4], |
| 251 | } |
| 252 | |
| 253 | impl Default for EncSequenceParameterBufferH264 { |
| 254 | fn default() -> Self { |
| 255 | EncSequenceParameterBufferH264 { |
| 256 | seq_parameter_set_id: 0, |
| 257 | level_idc: 41, |
| 258 | intra_period: 0, |
| 259 | intra_idr_period: 0, |
| 260 | ip_period: 1, |
| 261 | bits_per_second: 0, |
| 262 | max_num_ref_frames: 1, |
| 263 | picture_width_in_mbs: 0, |
| 264 | picture_height_in_mbs: 0, |
| 265 | seq_fields: H264SeqFields::default(), |
| 266 | bit_depth_luma_minus8: 0, |
| 267 | bit_depth_chroma_minus8: 0, |
| 268 | num_ref_frames_in_pic_order_cnt_cycle: 0, |
| 269 | offset_for_non_ref_pic: 0, |
| 270 | offset_for_top_to_bottom_field: 0, |
| 271 | offset_for_ref_frame: [0; 256], |
| 272 | frame_cropping_flag: 0, |
| 273 | frame_crop_left_offset: 0, |
| 274 | frame_crop_right_offset: 0, |
| 275 | frame_crop_top_offset: 0, |
| 276 | frame_crop_bottom_offset: 0, |
| 277 | vui_parameters_present_flag: 0, |
| 278 | vui_fields: H264VuiFields::default(), |
| 279 | aspect_ratio_idc: 0, |
| 280 | sar_width: 0, |
| 281 | sar_height: 0, |
| 282 | num_units_in_tick: 0, |
| 283 | time_scale: 0, |
| 284 | va_reserved: [0; 4], |
| 285 | } |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | |
| 290 | unsafe impl VaParam for EncSequenceParameterBufferH264 { |
| 291 | const TYPE: i32 = VAEncSequenceParameterBufferType; |
| 292 | } |
| 293 | |
| 294 | va_bits! { |
| 295 | |
| 296 | H264EncPicFields: u32 { |
| 297 | idr_pic_flag: 1, |
| 298 | reference_pic_flag: 2, |
| 299 | entropy_coding_mode_flag: 1, |
| 300 | weighted_pred_flag: 1, |
| 301 | weighted_bipred_idc: 2, |
| 302 | constrained_intra_pred_flag: 1, |
| 303 | transform_8x8_mode_flag: 1, |
| 304 | deblocking_filter_control_present_flag: 1, |
| 305 | redundant_pic_cnt_present_flag: 1, |
| 306 | pic_order_present_flag: 1, |
| 307 | pic_scaling_matrix_present_flag: 1, |
| 308 | } |
| 309 | } |
| 310 | |
| 311 | |
| 312 | #[repr(C)] |
| 313 | #[derive(Debug, Clone, Copy)] |
| 314 | pub struct EncPictureParameterBufferH264 { |
| 315 | |
| 316 | pub curr_pic: VAPictureH264, |
| 317 | |
| 318 | pub reference_frames: [VAPictureH264; 16], |
| 319 | |
| 320 | pub coded_buf: u32, |
| 321 | |
| 322 | pub pic_parameter_set_id: u8, |
| 323 | |
| 324 | pub seq_parameter_set_id: u8, |
| 325 | |
| 326 | pub last_picture: u8, |
| 327 | |
| 328 | pub frame_num: u16, |
| 329 | |
| 330 | pub pic_init_qp: u8, |
| 331 | |
| 332 | pub num_ref_idx_l0_active_minus1: u8, |
| 333 | |
| 334 | pub num_ref_idx_l1_active_minus1: u8, |
| 335 | |
| 336 | pub chroma_qp_index_offset: i8, |
| 337 | |
| 338 | pub second_chroma_qp_index_offset: i8, |
| 339 | |
| 340 | pub pic_fields: H264EncPicFields, |
| 341 | pub(crate) va_reserved: [u32; 4], |
| 342 | } |
| 343 | |
| 344 | impl Default for EncPictureParameterBufferH264 { |
| 345 | fn default() -> Self { |
| 346 | EncPictureParameterBufferH264 { |
| 347 | curr_pic: VAPictureH264::INVALID, |
| 348 | reference_frames: [VAPictureH264::INVALID; 16], |
| 349 | coded_buf: 0, |
| 350 | pic_parameter_set_id: 0, |
| 351 | seq_parameter_set_id: 0, |
| 352 | last_picture: 0, |
| 353 | frame_num: 0, |
| 354 | pic_init_qp: 26, |
| 355 | num_ref_idx_l0_active_minus1: 0, |
| 356 | num_ref_idx_l1_active_minus1: 0, |
| 357 | chroma_qp_index_offset: 0, |
| 358 | second_chroma_qp_index_offset: 0, |
| 359 | pic_fields: H264EncPicFields::default(), |
| 360 | va_reserved: [0; 4], |
| 361 | } |
| 362 | } |
| 363 | } |
| 364 | |
| 365 | |
| 366 | unsafe impl VaParam for EncPictureParameterBufferH264 { |
| 367 | const TYPE: i32 = VAEncPictureParameterBufferType; |
| 368 | } |
| 369 | |
| 370 | |
| 371 | #[repr(C)] |
| 372 | #[derive(Debug, Clone, Copy)] |
| 373 | pub struct EncSliceParameterBufferH264 { |
| 374 | |
| 375 | pub macroblock_address: u32, |
| 376 | |
| 377 | pub num_macroblocks: u32, |
| 378 | |
| 379 | pub macroblock_info: u32, |
| 380 | |
| 381 | pub slice_type: u8, |
| 382 | |
| 383 | pub pic_parameter_set_id: u8, |
| 384 | |
| 385 | pub idr_pic_id: u16, |
| 386 | |
| 387 | pub pic_order_cnt_lsb: u16, |
| 388 | |
| 389 | pub delta_pic_order_cnt_bottom: i32, |
| 390 | |
| 391 | pub delta_pic_order_cnt: [i32; 2], |
| 392 | |
| 393 | pub direct_spatial_mv_pred_flag: u8, |
| 394 | |
| 395 | pub num_ref_idx_active_override_flag: u8, |
| 396 | |
| 397 | pub num_ref_idx_l0_active_minus1: u8, |
| 398 | |
| 399 | pub num_ref_idx_l1_active_minus1: u8, |
| 400 | |
| 401 | pub ref_pic_list0: [VAPictureH264; 32], |
| 402 | |
| 403 | pub ref_pic_list1: [VAPictureH264; 32], |
| 404 | |
| 405 | pub luma_log2_weight_denom: u8, |
| 406 | |
| 407 | pub chroma_log2_weight_denom: u8, |
| 408 | |
| 409 | pub luma_weight_l0_flag: u8, |
| 410 | |
| 411 | pub luma_weight_l0: [i16; 32], |
| 412 | |
| 413 | pub luma_offset_l0: [i16; 32], |
| 414 | |
| 415 | pub chroma_weight_l0_flag: u8, |
| 416 | |
| 417 | pub chroma_weight_l0: [[i16; 2]; 32], |
| 418 | |
| 419 | pub chroma_offset_l0: [[i16; 2]; 32], |
| 420 | |
| 421 | pub luma_weight_l1_flag: u8, |
| 422 | |
| 423 | pub luma_weight_l1: [i16; 32], |
| 424 | |
| 425 | pub luma_offset_l1: [i16; 32], |
| 426 | |
| 427 | pub chroma_weight_l1_flag: u8, |
| 428 | |
| 429 | pub chroma_weight_l1: [[i16; 2]; 32], |
| 430 | |
| 431 | pub chroma_offset_l1: [[i16; 2]; 32], |
| 432 | |
| 433 | pub cabac_init_idc: u8, |
| 434 | |
| 435 | pub slice_qp_delta: i8, |
| 436 | |
| 437 | pub disable_deblocking_filter_idc: u8, |
| 438 | |
| 439 | pub slice_alpha_c0_offset_div2: i8, |
| 440 | |
| 441 | pub slice_beta_offset_div2: i8, |
| 442 | pub(crate) va_reserved: [u32; 4], |
| 443 | } |
| 444 | |
| 445 | impl Default for EncSliceParameterBufferH264 { |
| 446 | fn default() -> Self { |
| 447 | EncSliceParameterBufferH264 { |
| 448 | macroblock_address: 0, |
| 449 | num_macroblocks: 0, |
| 450 | macroblock_info: ec_va::sys::VA_INVALID_ID, |
| 451 | slice_type: 2, |
| 452 | pic_parameter_set_id: 0, |
| 453 | idr_pic_id: 0, |
| 454 | pic_order_cnt_lsb: 0, |
| 455 | delta_pic_order_cnt_bottom: 0, |
| 456 | delta_pic_order_cnt: [0; 2], |
| 457 | direct_spatial_mv_pred_flag: 0, |
| 458 | num_ref_idx_active_override_flag: 0, |
| 459 | num_ref_idx_l0_active_minus1: 0, |
| 460 | num_ref_idx_l1_active_minus1: 0, |
| 461 | ref_pic_list0: [VAPictureH264::INVALID; 32], |
| 462 | ref_pic_list1: [VAPictureH264::INVALID; 32], |
| 463 | luma_log2_weight_denom: 0, |
| 464 | chroma_log2_weight_denom: 0, |
| 465 | luma_weight_l0_flag: 0, |
| 466 | luma_weight_l0: [0; 32], |
| 467 | luma_offset_l0: [0; 32], |
| 468 | chroma_weight_l0_flag: 0, |
| 469 | chroma_weight_l0: [[0; 2]; 32], |
| 470 | chroma_offset_l0: [[0; 2]; 32], |
| 471 | luma_weight_l1_flag: 0, |
| 472 | luma_weight_l1: [0; 32], |
| 473 | luma_offset_l1: [0; 32], |
| 474 | chroma_weight_l1_flag: 0, |
| 475 | chroma_weight_l1: [[0; 2]; 32], |
| 476 | chroma_offset_l1: [[0; 2]; 32], |
| 477 | cabac_init_idc: 0, |
| 478 | slice_qp_delta: 0, |
| 479 | disable_deblocking_filter_idc: 0, |
| 480 | slice_alpha_c0_offset_div2: 0, |
| 481 | slice_beta_offset_div2: 0, |
| 482 | va_reserved: [0; 4], |
| 483 | } |
| 484 | } |
| 485 | } |
| 486 | |
| 487 | |
| 488 | unsafe impl VaParam for EncSliceParameterBufferH264 { |
| 489 | const TYPE: i32 = VAEncSliceParameterBufferType; |
| 490 | } |
| 491 | |
| 492 | |
| 493 | |
| 494 | |
| 495 | |
| 496 | va_bits! { |
| 497 | |
| 498 | HevcSeqFields: u32 { |
| 499 | chroma_format_idc: 2, |
| 500 | separate_colour_plane_flag: 1, |
| 501 | bit_depth_luma_minus8: 3, |
| 502 | bit_depth_chroma_minus8: 3, |
| 503 | scaling_list_enabled_flag: 1, |
| 504 | strong_intra_smoothing_enabled_flag: 1, |
| 505 | amp_enabled_flag: 1, |
| 506 | sample_adaptive_offset_enabled_flag: 1, |
| 507 | pcm_enabled_flag: 1, |
| 508 | pcm_loop_filter_disabled_flag: 1, |
| 509 | sps_temporal_mvp_enabled_flag: 1, |
| 510 | low_delay_seq: 1, |
| 511 | hierachical_flag: 1, |
| 512 | } |
| 513 | } |
| 514 | |
| 515 | va_bits! { |
| 516 | |
| 517 | HevcVuiFields: u32 { |
| 518 | aspect_ratio_info_present_flag: 1, |
| 519 | neutral_chroma_indication_flag: 1, |
| 520 | field_seq_flag: 1, |
| 521 | vui_timing_info_present_flag: 1, |
| 522 | bitstream_restriction_flag: 1, |
| 523 | tiles_fixed_structure_flag: 1, |
| 524 | motion_vectors_over_pic_boundaries_flag: 1, |
| 525 | restricted_ref_pic_lists_flag: 1, |
| 526 | log2_max_mv_length_horizontal: 5, |
| 527 | log2_max_mv_length_vertical: 5, |
| 528 | } |
| 529 | } |
| 530 | |
| 531 | |
| 532 | #[repr(C)] |
| 533 | #[derive(Debug, Clone, Copy)] |
| 534 | pub struct EncSequenceParameterBufferHEVC { |
| 535 | |
| 536 | pub general_profile_idc: u8, |
| 537 | |
| 538 | pub general_level_idc: u8, |
| 539 | |
| 540 | pub general_tier_flag: u8, |
| 541 | |
| 542 | pub intra_period: u32, |
| 543 | |
| 544 | pub intra_idr_period: u32, |
| 545 | |
| 546 | pub ip_period: u32, |
| 547 | |
| 548 | pub bits_per_second: u32, |
| 549 | |
| 550 | pub pic_width_in_luma_samples: u16, |
| 551 | |
| 552 | pub pic_height_in_luma_samples: u16, |
| 553 | |
| 554 | pub seq_fields: HevcSeqFields, |
| 555 | |
| 556 | pub log2_min_luma_coding_block_size_minus3: u8, |
| 557 | |
| 558 | pub log2_diff_max_min_luma_coding_block_size: u8, |
| 559 | |
| 560 | pub log2_min_transform_block_size_minus2: u8, |
| 561 | |
| 562 | pub log2_diff_max_min_transform_block_size: u8, |
| 563 | |
| 564 | pub max_transform_hierarchy_depth_inter: u8, |
| 565 | |
| 566 | pub max_transform_hierarchy_depth_intra: u8, |
| 567 | |
| 568 | pub pcm_sample_bit_depth_luma_minus1: u32, |
| 569 | |
| 570 | pub pcm_sample_bit_depth_chroma_minus1: u32, |
| 571 | |
| 572 | pub log2_min_pcm_luma_coding_block_size_minus3: u32, |
| 573 | |
| 574 | pub log2_max_pcm_luma_coding_block_size_minus3: u32, |
| 575 | |
| 576 | pub vui_parameters_present_flag: u8, |
| 577 | |
| 578 | pub vui_fields: HevcVuiFields, |
| 579 | |
| 580 | pub aspect_ratio_idc: u8, |
| 581 | |
| 582 | pub sar_width: u32, |
| 583 | |
| 584 | pub sar_height: u32, |
| 585 | |
| 586 | pub vui_num_units_in_tick: u32, |
| 587 | |
| 588 | pub vui_time_scale: u32, |
| 589 | |
| 590 | pub min_spatial_segmentation_idc: u16, |
| 591 | |
| 592 | pub max_bytes_per_pic_denom: u8, |
| 593 | |
| 594 | pub max_bits_per_min_cu_denom: u8, |
| 595 | |
| 596 | pub scc_fields: u32, |
| 597 | pub(crate) va_reserved: [u32; 7], |
| 598 | } |
| 599 | |
| 600 | impl Default for EncSequenceParameterBufferHEVC { |
| 601 | fn default() -> Self { |
| 602 | EncSequenceParameterBufferHEVC { |
| 603 | general_profile_idc: 1, |
| 604 | general_level_idc: 120, |
| 605 | general_tier_flag: 0, |
| 606 | intra_period: 0, |
| 607 | intra_idr_period: 0, |
| 608 | ip_period: 1, |
| 609 | bits_per_second: 0, |
| 610 | pic_width_in_luma_samples: 0, |
| 611 | pic_height_in_luma_samples: 0, |
| 612 | seq_fields: HevcSeqFields::default(), |
| 613 | log2_min_luma_coding_block_size_minus3: 0, |
| 614 | log2_diff_max_min_luma_coding_block_size: 3, |
| 615 | log2_min_transform_block_size_minus2: 0, |
| 616 | log2_diff_max_min_transform_block_size: 3, |
| 617 | max_transform_hierarchy_depth_inter: 0, |
| 618 | max_transform_hierarchy_depth_intra: 0, |
| 619 | pcm_sample_bit_depth_luma_minus1: 7, |
| 620 | pcm_sample_bit_depth_chroma_minus1: 7, |
| 621 | log2_min_pcm_luma_coding_block_size_minus3: 0, |
| 622 | log2_max_pcm_luma_coding_block_size_minus3: 0, |
| 623 | vui_parameters_present_flag: 0, |
| 624 | vui_fields: HevcVuiFields::default(), |
| 625 | aspect_ratio_idc: 0, |
| 626 | sar_width: 0, |
| 627 | sar_height: 0, |
| 628 | vui_num_units_in_tick: 0, |
| 629 | vui_time_scale: 0, |
| 630 | min_spatial_segmentation_idc: 0, |
| 631 | max_bytes_per_pic_denom: 0, |
| 632 | max_bits_per_min_cu_denom: 0, |
| 633 | scc_fields: 0, |
| 634 | va_reserved: [0; 7], |
| 635 | } |
| 636 | } |
| 637 | } |
| 638 | |
| 639 | |
| 640 | unsafe impl VaParam for EncSequenceParameterBufferHEVC { |
| 641 | const TYPE: i32 = VAEncSequenceParameterBufferType; |
| 642 | } |
| 643 | |
| 644 | va_bits! { |
| 645 | |
| 646 | HevcEncPicFields: u32 { |
| 647 | idr_pic_flag: 1, |
| 648 | coding_type: 3, |
| 649 | reference_pic_flag: 1, |
| 650 | dependent_slice_segments_enabled_flag: 1, |
| 651 | sign_data_hiding_enabled_flag: 1, |
| 652 | constrained_intra_pred_flag: 1, |
| 653 | transform_skip_enabled_flag: 1, |
| 654 | cu_qp_delta_enabled_flag: 1, |
| 655 | weighted_pred_flag: 1, |
| 656 | weighted_bipred_flag: 1, |
| 657 | transquant_bypass_enabled_flag: 1, |
| 658 | tiles_enabled_flag: 1, |
| 659 | entropy_coding_sync_enabled_flag: 1, |
| 660 | loop_filter_across_tiles_enabled_flag: 1, |
| 661 | pps_loop_filter_across_slices_enabled_flag: 1, |
| 662 | scaling_list_data_present_flag: 1, |
| 663 | screen_content_flag: 1, |
| 664 | enable_gpu_weighted_prediction: 1, |
| 665 | no_output_of_prior_pics_flag: 1, |
| 666 | } |
| 667 | } |
| 668 | |
| 669 | |
| 670 | #[repr(C)] |
| 671 | #[derive(Debug, Clone, Copy)] |
| 672 | pub struct EncPictureParameterBufferHEVC { |
| 673 | |
| 674 | pub decoded_curr_pic: VAPictureHEVC, |
| 675 | |
| 676 | pub reference_frames: [VAPictureHEVC; 15], |
| 677 | |
| 678 | pub coded_buf: u32, |
| 679 | |
| 680 | pub collocated_ref_pic_index: u8, |
| 681 | |
| 682 | pub last_picture: u8, |
| 683 | |
| 684 | pub pic_init_qp: u8, |
| 685 | |
| 686 | pub diff_cu_qp_delta_depth: u8, |
| 687 | |
| 688 | pub pps_cb_qp_offset: i8, |
| 689 | |
| 690 | pub pps_cr_qp_offset: i8, |
| 691 | |
| 692 | pub num_tile_columns_minus1: u8, |
| 693 | |
| 694 | pub num_tile_rows_minus1: u8, |
| 695 | |
| 696 | pub column_width_minus1: [u8; 19], |
| 697 | |
| 698 | pub row_height_minus1: [u8; 21], |
| 699 | |
| 700 | pub log2_parallel_merge_level_minus2: u8, |
| 701 | |
| 702 | pub ctu_max_bitsize_allowed: u8, |
| 703 | |
| 704 | pub num_ref_idx_l0_default_active_minus1: u8, |
| 705 | |
| 706 | pub num_ref_idx_l1_default_active_minus1: u8, |
| 707 | |
| 708 | pub slice_pic_parameter_set_id: u8, |
| 709 | |
| 710 | pub nal_unit_type: u8, |
| 711 | |
| 712 | pub pic_fields: HevcEncPicFields, |
| 713 | |
| 714 | pub hierarchical_level_plus1: u8, |
| 715 | pub(crate) va_byte_reserved: u8, |
| 716 | |
| 717 | pub scc_fields: u16, |
| 718 | pub(crate) va_reserved: [u32; 15], |
| 719 | } |
| 720 | |
| 721 | impl Default for EncPictureParameterBufferHEVC { |
| 722 | fn default() -> Self { |
| 723 | EncPictureParameterBufferHEVC { |
| 724 | decoded_curr_pic: VAPictureHEVC::INVALID, |
| 725 | reference_frames: [VAPictureHEVC::INVALID; 15], |
| 726 | coded_buf: 0, |
| 727 | collocated_ref_pic_index: 0xff, |
| 728 | last_picture: 0, |
| 729 | pic_init_qp: 26, |
| 730 | diff_cu_qp_delta_depth: 0, |
| 731 | pps_cb_qp_offset: 0, |
| 732 | pps_cr_qp_offset: 0, |
| 733 | num_tile_columns_minus1: 0, |
| 734 | num_tile_rows_minus1: 0, |
| 735 | column_width_minus1: [0; 19], |
| 736 | row_height_minus1: [0; 21], |
| 737 | log2_parallel_merge_level_minus2: 0, |
| 738 | ctu_max_bitsize_allowed: 0, |
| 739 | num_ref_idx_l0_default_active_minus1: 0, |
| 740 | num_ref_idx_l1_default_active_minus1: 0, |
| 741 | slice_pic_parameter_set_id: 0, |
| 742 | nal_unit_type: 19, |
| 743 | pic_fields: HevcEncPicFields::default(), |
| 744 | hierarchical_level_plus1: 0, |
| 745 | va_byte_reserved: 0, |
| 746 | scc_fields: 0, |
| 747 | va_reserved: [0; 15], |
| 748 | } |
| 749 | } |
| 750 | } |
| 751 | |
| 752 | |
| 753 | unsafe impl VaParam for EncPictureParameterBufferHEVC { |
| 754 | const TYPE: i32 = VAEncPictureParameterBufferType; |
| 755 | } |
| 756 | |
| 757 | va_bits! { |
| 758 | |
| 759 | HevcEncSliceFields: u32 { |
| 760 | last_slice_of_pic_flag: 1, |
| 761 | dependent_slice_segment_flag: 1, |
| 762 | colour_plane_id: 2, |
| 763 | slice_temporal_mvp_enabled_flag: 1, |
| 764 | slice_sao_luma_flag: 1, |
| 765 | slice_sao_chroma_flag: 1, |
| 766 | num_ref_idx_active_override_flag: 1, |
| 767 | mvd_l1_zero_flag: 1, |
| 768 | cabac_init_flag: 1, |
| 769 | slice_deblocking_filter_disabled_flag: 2, |
| 770 | slice_loop_filter_across_slices_enabled_flag: 1, |
| 771 | collocated_from_l0_flag: 1, |
| 772 | } |
| 773 | } |
| 774 | |
| 775 | |
| 776 | #[repr(C)] |
| 777 | #[derive(Debug, Clone, Copy)] |
| 778 | pub struct EncSliceParameterBufferHEVC { |
| 779 | |
| 780 | pub slice_segment_address: u32, |
| 781 | |
| 782 | pub num_ctu_in_slice: u32, |
| 783 | |
| 784 | pub slice_type: u8, |
| 785 | |
| 786 | pub slice_pic_parameter_set_id: u8, |
| 787 | |
| 788 | pub num_ref_idx_l0_active_minus1: u8, |
| 789 | |
| 790 | pub num_ref_idx_l1_active_minus1: u8, |
| 791 | |
| 792 | pub ref_pic_list0: [VAPictureHEVC; 15], |
| 793 | |
| 794 | pub ref_pic_list1: [VAPictureHEVC; 15], |
| 795 | |
| 796 | pub luma_log2_weight_denom: u8, |
| 797 | |
| 798 | pub delta_chroma_log2_weight_denom: i8, |
| 799 | |
| 800 | pub delta_luma_weight_l0: [i8; 15], |
| 801 | |
| 802 | pub luma_offset_l0: [i8; 15], |
| 803 | |
| 804 | pub delta_chroma_weight_l0: [[i8; 2]; 15], |
| 805 | |
| 806 | pub chroma_offset_l0: [[i8; 2]; 15], |
| 807 | |
| 808 | pub delta_luma_weight_l1: [i8; 15], |
| 809 | |
| 810 | pub luma_offset_l1: [i8; 15], |
| 811 | |
| 812 | pub delta_chroma_weight_l1: [[i8; 2]; 15], |
| 813 | |
| 814 | pub chroma_offset_l1: [[i8; 2]; 15], |
| 815 | |
| 816 | pub max_num_merge_cand: u8, |
| 817 | |
| 818 | pub slice_qp_delta: i8, |
| 819 | |
| 820 | pub slice_cb_qp_offset: i8, |
| 821 | |
| 822 | pub slice_cr_qp_offset: i8, |
| 823 | |
| 824 | pub slice_beta_offset_div2: i8, |
| 825 | |
| 826 | pub slice_tc_offset_div2: i8, |
| 827 | |
| 828 | pub slice_fields: HevcEncSliceFields, |
| 829 | |
| 830 | pub pred_weight_table_bit_offset: u32, |
| 831 | |
| 832 | pub pred_weight_table_bit_length: u32, |
| 833 | pub(crate) va_reserved: [u32; 6], |
| 834 | } |
| 835 | |
| 836 | impl Default for EncSliceParameterBufferHEVC { |
| 837 | fn default() -> Self { |
| 838 | EncSliceParameterBufferHEVC { |
| 839 | slice_segment_address: 0, |
| 840 | num_ctu_in_slice: 0, |
| 841 | slice_type: 2, |
| 842 | slice_pic_parameter_set_id: 0, |
| 843 | num_ref_idx_l0_active_minus1: 0, |
| 844 | num_ref_idx_l1_active_minus1: 0, |
| 845 | ref_pic_list0: [VAPictureHEVC::INVALID; 15], |
| 846 | ref_pic_list1: [VAPictureHEVC::INVALID; 15], |
| 847 | luma_log2_weight_denom: 0, |
| 848 | delta_chroma_log2_weight_denom: 0, |
| 849 | delta_luma_weight_l0: [0; 15], |
| 850 | luma_offset_l0: [0; 15], |
| 851 | delta_chroma_weight_l0: [[0; 2]; 15], |
| 852 | chroma_offset_l0: [[0; 2]; 15], |
| 853 | delta_luma_weight_l1: [0; 15], |
| 854 | luma_offset_l1: [0; 15], |
| 855 | delta_chroma_weight_l1: [[0; 2]; 15], |
| 856 | chroma_offset_l1: [[0; 2]; 15], |
| 857 | max_num_merge_cand: 5, |
| 858 | slice_qp_delta: 0, |
| 859 | slice_cb_qp_offset: 0, |
| 860 | slice_cr_qp_offset: 0, |
| 861 | slice_beta_offset_div2: 0, |
| 862 | slice_tc_offset_div2: 0, |
| 863 | slice_fields: HevcEncSliceFields::default(), |
| 864 | pred_weight_table_bit_offset: 0, |
| 865 | pred_weight_table_bit_length: 0, |
| 866 | va_reserved: [0; 6], |
| 867 | } |
| 868 | } |
| 869 | } |
| 870 | |
| 871 | |
| 872 | unsafe impl VaParam for EncSliceParameterBufferHEVC { |
| 873 | const TYPE: i32 = VAEncSliceParameterBufferType; |
| 874 | } |
| 875 | |
| 876 | |
| 877 | |
| 878 | |
| 879 | |
| 880 | va_bits! { |
| 881 | |
| 882 | Av1SeqFields: u32 { |
| 883 | still_picture: 1, |
| 884 | use_128x128_superblock: 1, |
| 885 | enable_filter_intra: 1, |
| 886 | enable_intra_edge_filter: 1, |
| 887 | enable_interintra_compound: 1, |
| 888 | enable_masked_compound: 1, |
| 889 | enable_warped_motion: 1, |
| 890 | enable_dual_filter: 1, |
| 891 | enable_order_hint: 1, |
| 892 | enable_jnt_comp: 1, |
| 893 | enable_ref_frame_mvs: 1, |
| 894 | enable_superres: 1, |
| 895 | enable_cdef: 1, |
| 896 | enable_restoration: 1, |
| 897 | bit_depth_minus8: 3, |
| 898 | subsampling_x: 1, |
| 899 | subsampling_y: 1, |
| 900 | mono_chrome: 1, |
| 901 | } |
| 902 | } |
| 903 | |
| 904 | |
| 905 | #[repr(C)] |
| 906 | #[derive(Debug, Clone, Copy)] |
| 907 | pub struct EncSequenceParameterBufferAV1 { |
| 908 | |
| 909 | pub seq_profile: u8, |
| 910 | |
| 911 | pub seq_level_idx: u8, |
| 912 | |
| 913 | pub seq_tier: u8, |
| 914 | |
| 915 | pub hierarchical_flag: u8, |
| 916 | |
| 917 | pub intra_period: u32, |
| 918 | |
| 919 | pub ip_period: u32, |
| 920 | |
| 921 | pub bits_per_second: u32, |
| 922 | |
| 923 | pub seq_fields: Av1SeqFields, |
| 924 | |
| 925 | pub order_hint_bits_minus_1: u8, |
| 926 | pub(crate) va_reserved: [u32; 16], |
| 927 | } |
| 928 | |
| 929 | impl Default for EncSequenceParameterBufferAV1 { |
| 930 | fn default() -> Self { |
| 931 | EncSequenceParameterBufferAV1 { |
| 932 | seq_profile: 0, |
| 933 | seq_level_idx: 0, |
| 934 | seq_tier: 0, |
| 935 | hierarchical_flag: 0, |
| 936 | intra_period: 0, |
| 937 | ip_period: 1, |
| 938 | bits_per_second: 0, |
| 939 | seq_fields: Av1SeqFields::default(), |
| 940 | order_hint_bits_minus_1: 0, |
| 941 | va_reserved: [0; 16], |
| 942 | } |
| 943 | } |
| 944 | } |
| 945 | |
| 946 | |
| 947 | unsafe impl VaParam for EncSequenceParameterBufferAV1 { |
| 948 | const TYPE: i32 = VAEncSequenceParameterBufferType; |
| 949 | } |
| 950 | |
| 951 | va_bits! { |
| 952 | |
| 953 | Av1SegFlags: u8 { |
| 954 | segmentation_enabled: 1, |
| 955 | segmentation_update_map: 1, |
| 956 | segmentation_temporal_update: 1, |
| 957 | } |
| 958 | } |
| 959 | |
| 960 | |
| 961 | #[repr(C)] |
| 962 | #[derive(Debug, Clone, Copy, Default)] |
| 963 | pub struct EncSegParamAV1 { |
| 964 | |
| 965 | pub seg_flags: Av1SegFlags, |
| 966 | |
| 967 | pub segment_number: u8, |
| 968 | |
| 969 | pub feature_data: [[i16; 8]; 8], |
| 970 | |
| 971 | pub feature_mask: [u8; 8], |
| 972 | pub(crate) va_reserved: [u32; 4], |
| 973 | } |
| 974 | |
| 975 | |
| 976 | #[repr(C)] |
| 977 | #[derive(Debug, Clone, Copy, Default)] |
| 978 | pub struct EncWarpedMotionParamsAV1 { |
| 979 | |
| 980 | pub wmtype: i32, |
| 981 | |
| 982 | pub wmmat: [i32; 8], |
| 983 | |
| 984 | pub invalid: u8, |
| 985 | pub(crate) va_reserved: [u32; 4], |
| 986 | } |
| 987 | |
| 988 | va_bits! { |
| 989 | |
| 990 | Av1EncPicFlags: u32 { |
| 991 | frame_type: 2, |
| 992 | error_resilient_mode: 1, |
| 993 | disable_cdf_update: 1, |
| 994 | use_superres: 1, |
| 995 | allow_high_precision_mv: 1, |
| 996 | use_ref_frame_mvs: 1, |
| 997 | disable_frame_end_update_cdf: 1, |
| 998 | reduced_tx_set: 1, |
| 999 | enable_frame_obu: 1, |
| 1000 | long_term_reference: 1, |
| 1001 | disable_frame_recon: 1, |
| 1002 | allow_intrabc: 1, |
| 1003 | palette_mode_enable: 1, |
| 1004 | allow_screen_content_tools: 1, |
| 1005 | force_integer_mv: 1, |
| 1006 | } |
| 1007 | } |
| 1008 | |
| 1009 | va_bits! { |
| 1010 | |
| 1011 | Av1ModeControlFlags: u32 { |
| 1012 | delta_q_present: 1, |
| 1013 | delta_q_res: 2, |
| 1014 | delta_lf_present: 1, |
| 1015 | delta_lf_res: 2, |
| 1016 | delta_lf_multi: 1, |
| 1017 | tx_mode: 2, |
| 1018 | reference_mode: 2, |
| 1019 | skip_mode_present: 1, |
| 1020 | } |
| 1021 | } |
| 1022 | |
| 1023 | va_bits! { |
| 1024 | |
| 1025 | Av1TileGroupObuHdrInfo: u8 { |
| 1026 | obu_extension_flag: 1, |
| 1027 | obu_has_size_field: 1, |
| 1028 | temporal_id: 3, |
| 1029 | spatial_id: 2, |
| 1030 | } |
| 1031 | } |
| 1032 | |
| 1033 | |
| 1034 | #[repr(C)] |
| 1035 | #[derive(Debug, Clone, Copy)] |
| 1036 | pub struct EncPictureParameterBufferAV1 { |
| 1037 | |
| 1038 | pub frame_width_minus_1: u16, |
| 1039 | |
| 1040 | pub frame_height_minus_1: u16, |
| 1041 | |
| 1042 | pub reconstructed_frame: VASurfaceID, |
| 1043 | |
| 1044 | pub coded_buf: u32, |
| 1045 | |
| 1046 | pub reference_frames: [VASurfaceID; 8], |
| 1047 | |
| 1048 | pub ref_frame_idx: [u8; 7], |
| 1049 | |
| 1050 | pub hierarchical_level_plus1: u8, |
| 1051 | |
| 1052 | pub primary_ref_frame: u8, |
| 1053 | |
| 1054 | pub order_hint: u8, |
| 1055 | |
| 1056 | pub refresh_frame_flags: u8, |
| 1057 | pub(crate) reserved8bits1: u8, |
| 1058 | |
| 1059 | pub ref_frame_ctrl_l0: u32, |
| 1060 | |
| 1061 | pub ref_frame_ctrl_l1: u32, |
| 1062 | |
| 1063 | pub picture_flags: Av1EncPicFlags, |
| 1064 | |
| 1065 | pub seg_id_block_size: u8, |
| 1066 | |
| 1067 | pub num_tile_groups_minus1: u8, |
| 1068 | |
| 1069 | pub temporal_id: u8, |
| 1070 | |
| 1071 | pub filter_level: [u8; 2], |
| 1072 | |
| 1073 | pub filter_level_u: u8, |
| 1074 | |
| 1075 | pub filter_level_v: u8, |
| 1076 | |
| 1077 | pub loop_filter_flags: u8, |
| 1078 | |
| 1079 | pub superres_scale_denominator: u8, |
| 1080 | |
| 1081 | pub interpolation_filter: u8, |
| 1082 | |
| 1083 | pub ref_deltas: [i8; 8], |
| 1084 | |
| 1085 | pub mode_deltas: [i8; 2], |
| 1086 | |
| 1087 | pub base_qindex: u8, |
| 1088 | |
| 1089 | pub y_dc_delta_q: i8, |
| 1090 | |
| 1091 | pub u_dc_delta_q: i8, |
| 1092 | |
| 1093 | pub u_ac_delta_q: i8, |
| 1094 | |
| 1095 | pub v_dc_delta_q: i8, |
| 1096 | |
| 1097 | pub v_ac_delta_q: i8, |
| 1098 | |
| 1099 | pub min_base_qindex: u8, |
| 1100 | |
| 1101 | pub max_base_qindex: u8, |
| 1102 | |
| 1103 | pub qmatrix_flags: u16, |
| 1104 | pub(crate) reserved16bits1: u16, |
| 1105 | |
| 1106 | pub mode_control_flags: Av1ModeControlFlags, |
| 1107 | |
| 1108 | pub segments: EncSegParamAV1, |
| 1109 | |
| 1110 | pub tile_cols: u8, |
| 1111 | |
| 1112 | pub tile_rows: u8, |
| 1113 | pub(crate) reserved16bits2: u16, |
| 1114 | |
| 1115 | pub width_in_sbs_minus_1: [u16; 63], |
| 1116 | |
| 1117 | pub height_in_sbs_minus_1: [u16; 63], |
| 1118 | |
| 1119 | pub context_update_tile_id: u16, |
| 1120 | |
| 1121 | pub cdef_damping_minus_3: u8, |
| 1122 | |
| 1123 | pub cdef_bits: u8, |
| 1124 | |
| 1125 | pub cdef_y_strengths: [u8; 8], |
| 1126 | |
| 1127 | pub cdef_uv_strengths: [u8; 8], |
| 1128 | |
| 1129 | pub loop_restoration_flags: u16, |
| 1130 | |
| 1131 | pub wm: [EncWarpedMotionParamsAV1; 7], |
| 1132 | |
| 1133 | pub bit_offset_qindex: u32, |
| 1134 | |
| 1135 | pub bit_offset_segmentation: u32, |
| 1136 | |
| 1137 | pub bit_offset_loopfilter_params: u32, |
| 1138 | |
| 1139 | pub bit_offset_cdef_params: u32, |
| 1140 | |
| 1141 | pub size_in_bits_cdef_params: u32, |
| 1142 | |
| 1143 | pub byte_offset_frame_hdr_obu_size: u32, |
| 1144 | |
| 1145 | pub size_in_bits_frame_hdr_obu: u32, |
| 1146 | |
| 1147 | pub tile_group_obu_hdr_info: Av1TileGroupObuHdrInfo, |
| 1148 | |
| 1149 | pub number_skip_frames: u8, |
| 1150 | pub(crate) reserved16bits3: u16, |
| 1151 | |
| 1152 | pub skip_frames_reduced_size: i32, |
| 1153 | pub(crate) va_reserved: [u32; 16], |
| 1154 | } |
| 1155 | |
| 1156 | impl Default for EncPictureParameterBufferAV1 { |
| 1157 | fn default() -> Self { |
| 1158 | EncPictureParameterBufferAV1 { |
| 1159 | frame_width_minus_1: 0, |
| 1160 | frame_height_minus_1: 0, |
| 1161 | reconstructed_frame: super::INVALID_SURFACE, |
| 1162 | coded_buf: 0, |
| 1163 | reference_frames: [super::INVALID_SURFACE; 8], |
| 1164 | ref_frame_idx: [0; 7], |
| 1165 | hierarchical_level_plus1: 0, |
| 1166 | primary_ref_frame: 7, |
| 1167 | order_hint: 0, |
| 1168 | refresh_frame_flags: 0xff, |
| 1169 | reserved8bits1: 0, |
| 1170 | ref_frame_ctrl_l0: 0, |
| 1171 | ref_frame_ctrl_l1: 0, |
| 1172 | picture_flags: Av1EncPicFlags::default(), |
| 1173 | seg_id_block_size: 0, |
| 1174 | num_tile_groups_minus1: 0, |
| 1175 | temporal_id: 0, |
| 1176 | filter_level: [0; 2], |
| 1177 | filter_level_u: 0, |
| 1178 | filter_level_v: 0, |
| 1179 | loop_filter_flags: 0, |
| 1180 | superres_scale_denominator: 8, |
| 1181 | interpolation_filter: 0, |
| 1182 | ref_deltas: [0; 8], |
| 1183 | mode_deltas: [0; 2], |
| 1184 | base_qindex: 128, |
| 1185 | y_dc_delta_q: 0, |
| 1186 | u_dc_delta_q: 0, |
| 1187 | u_ac_delta_q: 0, |
| 1188 | v_dc_delta_q: 0, |
| 1189 | v_ac_delta_q: 0, |
| 1190 | min_base_qindex: 0, |
| 1191 | max_base_qindex: 255, |
| 1192 | qmatrix_flags: 0, |
| 1193 | reserved16bits1: 0, |
| 1194 | mode_control_flags: Av1ModeControlFlags::default(), |
| 1195 | segments: EncSegParamAV1::default(), |
| 1196 | tile_cols: 1, |
| 1197 | tile_rows: 1, |
| 1198 | reserved16bits2: 0, |
| 1199 | width_in_sbs_minus_1: [0; 63], |
| 1200 | height_in_sbs_minus_1: [0; 63], |
| 1201 | context_update_tile_id: 0, |
| 1202 | cdef_damping_minus_3: 0, |
| 1203 | cdef_bits: 0, |
| 1204 | cdef_y_strengths: [0; 8], |
| 1205 | cdef_uv_strengths: [0; 8], |
| 1206 | loop_restoration_flags: 0, |
| 1207 | wm: [EncWarpedMotionParamsAV1::default(); 7], |
| 1208 | bit_offset_qindex: 0, |
| 1209 | bit_offset_segmentation: 0, |
| 1210 | bit_offset_loopfilter_params: 0, |
| 1211 | bit_offset_cdef_params: 0, |
| 1212 | size_in_bits_cdef_params: 0, |
| 1213 | byte_offset_frame_hdr_obu_size: 0, |
| 1214 | size_in_bits_frame_hdr_obu: 0, |
| 1215 | tile_group_obu_hdr_info: Av1TileGroupObuHdrInfo::default(), |
| 1216 | number_skip_frames: 0, |
| 1217 | reserved16bits3: 0, |
| 1218 | skip_frames_reduced_size: 0, |
| 1219 | va_reserved: [0; 16], |
| 1220 | } |
| 1221 | } |
| 1222 | } |
| 1223 | |
| 1224 | |
| 1225 | unsafe impl VaParam for EncPictureParameterBufferAV1 { |
| 1226 | const TYPE: i32 = VAEncPictureParameterBufferType; |
| 1227 | } |
| 1228 | |
| 1229 | |
| 1230 | #[repr(C)] |
| 1231 | #[derive(Debug, Clone, Copy, Default)] |
| 1232 | pub struct EncTileGroupBufferAV1 { |
| 1233 | |
| 1234 | pub tg_start: u8, |
| 1235 | |
| 1236 | pub tg_end: u8, |
| 1237 | pub(crate) va_reserved: [u32; 4], |
| 1238 | } |
| 1239 | |
| 1240 | |
| 1241 | unsafe impl VaParam for EncTileGroupBufferAV1 { |
| 1242 | const TYPE: i32 = VAEncSliceParameterBufferType; |
| 1243 | } |
| 1244 | |
| 1245 | |
| 1246 | |
| 1247 | |
| 1248 | |
| 1249 | |
| 1250 | |
| 1251 | |
| 1252 | |
| 1253 | |
| 1254 | |
| 1255 | |
| 1256 | |
| 1257 | |
| 1258 | |
| 1259 | |
| 1260 | |
| 1261 | |
| 1262 | |
| 1263 | |
| 1264 | |
| 1265 | |
| 1266 | |
| 1267 | |
| 1268 | |
| 1269 | |
| 1270 | |
| 1271 | |
| 1272 | |
| 1273 | |
| 1274 | |
| 1275 | |
| 1276 | |
| 1277 | |
| 1278 | |
| 1279 | |
| 1280 | |
| 1281 | |
| 1282 | |
| 1283 | |
| 1284 | |
| 1285 | |
| 1286 | |
| 1287 | |
| 1288 | |
| 1289 | |
| 1290 | |
| 1291 | |
| 1292 | |
| 1293 | |
| 1294 | |
| 1295 | |
| 1296 | |
| 1297 | |
| 1298 | |
| 1299 | |
| 1300 | |
| 1301 | |
| 1302 | |
| 1303 | |
| 1304 | |
| 1305 | |
| 1306 | |
| 1307 | |
| 1308 | |
| 1309 | |
| 1310 | |
| 1311 | |
| 1312 | |
| 1313 | |
| 1314 | |
| 1315 | |
| 1316 | |
| 1317 | |
| 1318 | |
| 1319 | |
| 1320 | |
| 1321 | |
| 1322 | |
| 1323 | |
| 1324 | |
| 1325 | |
| 1326 | |
| 1327 | |
| 1328 | |
| 1329 | |
| 1330 | |
| 1331 | |
| 1332 | const _: () = { |
| 1333 | use std::mem::{align_of, offset_of, size_of}; |
| 1334 | |
| 1335 | assert!( |
| 1336 | size_of::<PackedHeaderParameterBuffer>() == 28 |
| 1337 | && align_of::<PackedHeaderParameterBuffer>() == 4 |
| 1338 | ); |
| 1339 | assert!(offset_of!(PackedHeaderParameterBuffer, bit_length) == 4); |
| 1340 | assert!(offset_of!(PackedHeaderParameterBuffer, has_emulation_bytes) == 8); |
| 1341 | |
| 1342 | |
| 1343 | |
| 1344 | assert!(size_of::<u32>() * (1 + 15) == 64); |
| 1345 | assert!(size_of::<u32>() * (1 + 6) == 28); |
| 1346 | |
| 1347 | assert!( |
| 1348 | size_of::<EncSequenceParameterBufferH264>() == 1132 |
| 1349 | && align_of::<EncSequenceParameterBufferH264>() == 4 |
| 1350 | ); |
| 1351 | assert!(offset_of!(EncSequenceParameterBufferH264, intra_period) == 4); |
| 1352 | assert!(offset_of!(EncSequenceParameterBufferH264, picture_width_in_mbs) == 24); |
| 1353 | assert!(offset_of!(EncSequenceParameterBufferH264, seq_fields) == 28); |
| 1354 | assert!(offset_of!(EncSequenceParameterBufferH264, bit_depth_luma_minus8) == 32); |
| 1355 | assert!(offset_of!(EncSequenceParameterBufferH264, offset_for_non_ref_pic) == 36); |
| 1356 | assert!(offset_of!(EncSequenceParameterBufferH264, offset_for_ref_frame) == 44); |
| 1357 | assert!(offset_of!(EncSequenceParameterBufferH264, frame_cropping_flag) == 1068); |
| 1358 | assert!(offset_of!(EncSequenceParameterBufferH264, frame_crop_left_offset) == 1072); |
| 1359 | assert!(offset_of!(EncSequenceParameterBufferH264, vui_parameters_present_flag) == 1088); |
| 1360 | assert!(offset_of!(EncSequenceParameterBufferH264, vui_fields) == 1092); |
| 1361 | assert!(offset_of!(EncSequenceParameterBufferH264, aspect_ratio_idc) == 1096); |
| 1362 | assert!(offset_of!(EncSequenceParameterBufferH264, num_units_in_tick) == 1108); |
| 1363 | assert!(offset_of!(EncSequenceParameterBufferH264, time_scale) == 1112); |
| 1364 | |
| 1365 | assert!( |
| 1366 | size_of::<EncPictureParameterBufferH264>() == 648 |
| 1367 | && align_of::<EncPictureParameterBufferH264>() == 4 |
| 1368 | ); |
| 1369 | assert!(offset_of!(EncPictureParameterBufferH264, reference_frames) == 36); |
| 1370 | assert!(offset_of!(EncPictureParameterBufferH264, coded_buf) == 612); |
| 1371 | assert!(offset_of!(EncPictureParameterBufferH264, pic_parameter_set_id) == 616); |
| 1372 | assert!(offset_of!(EncPictureParameterBufferH264, frame_num) == 620); |
| 1373 | assert!(offset_of!(EncPictureParameterBufferH264, pic_init_qp) == 622); |
| 1374 | assert!(offset_of!(EncPictureParameterBufferH264, pic_fields) == 628); |
| 1375 | |
| 1376 | assert!( |
| 1377 | size_of::<EncSliceParameterBufferH264>() == 3140 |
| 1378 | && align_of::<EncSliceParameterBufferH264>() == 4 |
| 1379 | ); |
| 1380 | assert!(offset_of!(EncSliceParameterBufferH264, macroblock_info) == 8); |
| 1381 | assert!(offset_of!(EncSliceParameterBufferH264, slice_type) == 12); |
| 1382 | assert!(offset_of!(EncSliceParameterBufferH264, idr_pic_id) == 14); |
| 1383 | assert!(offset_of!(EncSliceParameterBufferH264, delta_pic_order_cnt_bottom) == 20); |
| 1384 | assert!(offset_of!(EncSliceParameterBufferH264, direct_spatial_mv_pred_flag) == 32); |
| 1385 | assert!(offset_of!(EncSliceParameterBufferH264, ref_pic_list0) == 36); |
| 1386 | assert!(offset_of!(EncSliceParameterBufferH264, ref_pic_list1) == 1188); |
| 1387 | assert!(offset_of!(EncSliceParameterBufferH264, luma_log2_weight_denom) == 2340); |
| 1388 | assert!(offset_of!(EncSliceParameterBufferH264, cabac_init_idc) == 3118); |
| 1389 | |
| 1390 | assert!( |
| 1391 | size_of::<EncSequenceParameterBufferHEVC>() == 116 |
| 1392 | && align_of::<EncSequenceParameterBufferHEVC>() == 4 |
| 1393 | ); |
| 1394 | assert!(offset_of!(EncSequenceParameterBufferHEVC, intra_period) == 4); |
| 1395 | assert!(offset_of!(EncSequenceParameterBufferHEVC, pic_width_in_luma_samples) == 20); |
| 1396 | assert!(offset_of!(EncSequenceParameterBufferHEVC, seq_fields) == 24); |
| 1397 | assert!( |
| 1398 | offset_of!( |
| 1399 | EncSequenceParameterBufferHEVC, |
| 1400 | log2_min_luma_coding_block_size_minus3 |
| 1401 | ) == 28 |
| 1402 | ); |
| 1403 | assert!( |
| 1404 | offset_of!( |
| 1405 | EncSequenceParameterBufferHEVC, |
| 1406 | pcm_sample_bit_depth_luma_minus1 |
| 1407 | ) == 36 |
| 1408 | ); |
| 1409 | assert!(offset_of!(EncSequenceParameterBufferHEVC, vui_parameters_present_flag) == 52); |
| 1410 | assert!(offset_of!(EncSequenceParameterBufferHEVC, vui_fields) == 56); |
| 1411 | assert!(offset_of!(EncSequenceParameterBufferHEVC, aspect_ratio_idc) == 60); |
| 1412 | assert!(offset_of!(EncSequenceParameterBufferHEVC, vui_num_units_in_tick) == 72); |
| 1413 | assert!(offset_of!(EncSequenceParameterBufferHEVC, min_spatial_segmentation_idc) == 80); |
| 1414 | assert!(offset_of!(EncSequenceParameterBufferHEVC, scc_fields) == 84); |
| 1415 | |
| 1416 | assert!( |
| 1417 | size_of::<EncPictureParameterBufferHEVC>() == 576 |
| 1418 | && align_of::<EncPictureParameterBufferHEVC>() == 4 |
| 1419 | ); |
| 1420 | assert!(offset_of!(EncPictureParameterBufferHEVC, reference_frames) == 28); |
| 1421 | assert!(offset_of!(EncPictureParameterBufferHEVC, coded_buf) == 448); |
| 1422 | assert!(offset_of!(EncPictureParameterBufferHEVC, collocated_ref_pic_index) == 452); |
| 1423 | assert!(offset_of!(EncPictureParameterBufferHEVC, column_width_minus1) == 460); |
| 1424 | assert!(offset_of!(EncPictureParameterBufferHEVC, row_height_minus1) == 479); |
| 1425 | assert!( |
| 1426 | offset_of!( |
| 1427 | EncPictureParameterBufferHEVC, |
| 1428 | log2_parallel_merge_level_minus2 |
| 1429 | ) == 500 |
| 1430 | ); |
| 1431 | assert!(offset_of!(EncPictureParameterBufferHEVC, nal_unit_type) == 505); |
| 1432 | assert!(offset_of!(EncPictureParameterBufferHEVC, pic_fields) == 508); |
| 1433 | assert!(offset_of!(EncPictureParameterBufferHEVC, hierarchical_level_plus1) == 512); |
| 1434 | assert!(offset_of!(EncPictureParameterBufferHEVC, scc_fields) == 514); |
| 1435 | |
| 1436 | assert!( |
| 1437 | size_of::<EncSliceParameterBufferHEVC>() == 1076 |
| 1438 | && align_of::<EncSliceParameterBufferHEVC>() == 4 |
| 1439 | ); |
| 1440 | assert!(offset_of!(EncSliceParameterBufferHEVC, num_ctu_in_slice) == 4); |
| 1441 | assert!(offset_of!(EncSliceParameterBufferHEVC, slice_type) == 8); |
| 1442 | assert!(offset_of!(EncSliceParameterBufferHEVC, ref_pic_list0) == 12); |
| 1443 | assert!(offset_of!(EncSliceParameterBufferHEVC, ref_pic_list1) == 432); |
| 1444 | assert!(offset_of!(EncSliceParameterBufferHEVC, luma_log2_weight_denom) == 852); |
| 1445 | assert!(offset_of!(EncSliceParameterBufferHEVC, max_num_merge_cand) == 1034); |
| 1446 | assert!(offset_of!(EncSliceParameterBufferHEVC, slice_fields) == 1040); |
| 1447 | assert!(offset_of!(EncSliceParameterBufferHEVC, pred_weight_table_bit_offset) == 1044); |
| 1448 | |
| 1449 | assert!( |
| 1450 | size_of::<EncSequenceParameterBufferAV1>() == 88 |
| 1451 | && align_of::<EncSequenceParameterBufferAV1>() == 4 |
| 1452 | ); |
| 1453 | assert!(offset_of!(EncSequenceParameterBufferAV1, intra_period) == 4); |
| 1454 | assert!(offset_of!(EncSequenceParameterBufferAV1, seq_fields) == 16); |
| 1455 | assert!(offset_of!(EncSequenceParameterBufferAV1, order_hint_bits_minus_1) == 20); |
| 1456 | |
| 1457 | assert!(size_of::<EncSegParamAV1>() == 156 && align_of::<EncSegParamAV1>() == 4); |
| 1458 | assert!(offset_of!(EncSegParamAV1, feature_data) == 2); |
| 1459 | assert!(offset_of!(EncSegParamAV1, feature_mask) == 130); |
| 1460 | |
| 1461 | assert!(size_of::<EncWarpedMotionParamsAV1>() == 56); |
| 1462 | |
| 1463 | assert!( |
| 1464 | size_of::<EncPictureParameterBufferAV1>() == 1032 |
| 1465 | && align_of::<EncPictureParameterBufferAV1>() == 4 |
| 1466 | ); |
| 1467 | assert!(offset_of!(EncPictureParameterBufferAV1, reconstructed_frame) == 4); |
| 1468 | assert!(offset_of!(EncPictureParameterBufferAV1, coded_buf) == 8); |
| 1469 | assert!(offset_of!(EncPictureParameterBufferAV1, reference_frames) == 12); |
| 1470 | assert!(offset_of!(EncPictureParameterBufferAV1, ref_frame_idx) == 44); |
| 1471 | assert!(offset_of!(EncPictureParameterBufferAV1, ref_frame_ctrl_l0) == 56); |
| 1472 | assert!(offset_of!(EncPictureParameterBufferAV1, picture_flags) == 64); |
| 1473 | assert!(offset_of!(EncPictureParameterBufferAV1, seg_id_block_size) == 68); |
| 1474 | assert!(offset_of!(EncPictureParameterBufferAV1, filter_level) == 71); |
| 1475 | assert!(offset_of!(EncPictureParameterBufferAV1, loop_filter_flags) == 75); |
| 1476 | assert!(offset_of!(EncPictureParameterBufferAV1, ref_deltas) == 78); |
| 1477 | assert!(offset_of!(EncPictureParameterBufferAV1, base_qindex) == 88); |
| 1478 | assert!(offset_of!(EncPictureParameterBufferAV1, min_base_qindex) == 94); |
| 1479 | assert!(offset_of!(EncPictureParameterBufferAV1, qmatrix_flags) == 96); |
| 1480 | assert!(offset_of!(EncPictureParameterBufferAV1, mode_control_flags) == 100); |
| 1481 | assert!(offset_of!(EncPictureParameterBufferAV1, segments) == 104); |
| 1482 | assert!(offset_of!(EncPictureParameterBufferAV1, tile_cols) == 260); |
| 1483 | assert!(offset_of!(EncPictureParameterBufferAV1, width_in_sbs_minus_1) == 264); |
| 1484 | assert!(offset_of!(EncPictureParameterBufferAV1, context_update_tile_id) == 516); |
| 1485 | assert!(offset_of!(EncPictureParameterBufferAV1, cdef_damping_minus_3) == 518); |
| 1486 | assert!(offset_of!(EncPictureParameterBufferAV1, loop_restoration_flags) == 536); |
| 1487 | assert!(offset_of!(EncPictureParameterBufferAV1, wm) == 540); |
| 1488 | assert!(offset_of!(EncPictureParameterBufferAV1, bit_offset_qindex) == 932); |
| 1489 | assert!(offset_of!(EncPictureParameterBufferAV1, tile_group_obu_hdr_info) == 960); |
| 1490 | assert!(offset_of!(EncPictureParameterBufferAV1, number_skip_frames) == 961); |
| 1491 | assert!(offset_of!(EncPictureParameterBufferAV1, skip_frames_reduced_size) == 964); |
| 1492 | |
| 1493 | assert!(size_of::<EncTileGroupBufferAV1>() == 20); |
| 1494 | }; |