1 /************************************************************************** 2 * 3 * Copyright 2009 Younes Manton. 4 * All Rights Reserved. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a 7 * copy of this software and associated documentation files (the 8 * "Software"), to deal in the Software without restriction, including 9 * without limitation the rights to use, copy, modify, merge, publish, 10 * distribute, sub license, and/or sell copies of the Software, and to 11 * permit persons to whom the Software is furnished to do so, subject to 12 * the following conditions: 13 * 14 * The above copyright notice and this permission notice (including the 15 * next paragraph) shall be included in all copies or substantial portions 16 * of the Software. 17 * 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 21 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 * 26 **************************************************************************/ 27 28 #ifndef PIPE_VIDEO_STATE_H 29 #define PIPE_VIDEO_STATE_H 30 31 #include "pipe/p_defines.h" 32 #include "pipe/p_format.h" 33 #include "pipe/p_state.h" 34 #include "pipe/p_screen.h" 35 #include "util/u_hash_table.h" 36 #include "util/u_inlines.h" 37 #include "util/u_rect.h" 38 39 #ifdef __cplusplus 40 extern "C" { 41 #endif 42 43 /* 44 * see table 6-12 in the spec 45 */ 46 enum pipe_mpeg12_picture_coding_type 47 { 48 PIPE_MPEG12_PICTURE_CODING_TYPE_I = 0x01, 49 PIPE_MPEG12_PICTURE_CODING_TYPE_P = 0x02, 50 PIPE_MPEG12_PICTURE_CODING_TYPE_B = 0x03, 51 PIPE_MPEG12_PICTURE_CODING_TYPE_D = 0x04 52 }; 53 54 /* 55 * see table 6-14 in the spec 56 */ 57 enum pipe_mpeg12_picture_structure 58 { 59 PIPE_MPEG12_PICTURE_STRUCTURE_RESERVED = 0x00, 60 PIPE_MPEG12_PICTURE_STRUCTURE_FIELD_TOP = 0x01, 61 PIPE_MPEG12_PICTURE_STRUCTURE_FIELD_BOTTOM = 0x02, 62 PIPE_MPEG12_PICTURE_STRUCTURE_FRAME = 0x03 63 }; 64 65 /* 66 * flags for macroblock_type, see section 6.3.17.1 in the spec 67 */ 68 enum pipe_mpeg12_macroblock_type 69 { 70 PIPE_MPEG12_MB_TYPE_QUANT = 0x01, 71 PIPE_MPEG12_MB_TYPE_MOTION_FORWARD = 0x02, 72 PIPE_MPEG12_MB_TYPE_MOTION_BACKWARD = 0x04, 73 PIPE_MPEG12_MB_TYPE_PATTERN = 0x08, 74 PIPE_MPEG12_MB_TYPE_INTRA = 0x10 75 }; 76 77 /* 78 * flags for motion_type, see table 6-17 and 6-18 in the spec 79 */ 80 enum pipe_mpeg12_motion_type 81 { 82 PIPE_MPEG12_MO_TYPE_RESERVED = 0x00, 83 PIPE_MPEG12_MO_TYPE_FIELD = 0x01, 84 PIPE_MPEG12_MO_TYPE_FRAME = 0x02, 85 PIPE_MPEG12_MO_TYPE_16x8 = 0x02, 86 PIPE_MPEG12_MO_TYPE_DUAL_PRIME = 0x03 87 }; 88 89 /* 90 * see section 6.3.17.1 and table 6-19 in the spec 91 */ 92 enum pipe_mpeg12_dct_type 93 { 94 PIPE_MPEG12_DCT_TYPE_FRAME = 0, 95 PIPE_MPEG12_DCT_TYPE_FIELD = 1 96 }; 97 98 enum pipe_mpeg12_field_select 99 { 100 PIPE_MPEG12_FS_FIRST_FORWARD = 0x01, 101 PIPE_MPEG12_FS_FIRST_BACKWARD = 0x02, 102 PIPE_MPEG12_FS_SECOND_FORWARD = 0x04, 103 PIPE_MPEG12_FS_SECOND_BACKWARD = 0x08 104 }; 105 106 enum pipe_h264_slice_type 107 { 108 PIPE_H264_SLICE_TYPE_P = 0x0, 109 PIPE_H264_SLICE_TYPE_B = 0x1, 110 PIPE_H264_SLICE_TYPE_I = 0x2, 111 PIPE_H264_SLICE_TYPE_SP = 0x3, 112 PIPE_H264_SLICE_TYPE_SI = 0x4 113 }; 114 115 /* Same enum for h264/h265 */ 116 enum pipe_h2645_enc_picture_type 117 { 118 PIPE_H2645_ENC_PICTURE_TYPE_P = 0x00, 119 PIPE_H2645_ENC_PICTURE_TYPE_B = 0x01, 120 PIPE_H2645_ENC_PICTURE_TYPE_I = 0x02, 121 PIPE_H2645_ENC_PICTURE_TYPE_IDR = 0x03, 122 PIPE_H2645_ENC_PICTURE_TYPE_SKIP = 0x04 123 }; 124 125 enum pipe_h2645_enc_rate_control_method 126 { 127 PIPE_H2645_ENC_RATE_CONTROL_METHOD_DISABLE = 0x00, 128 PIPE_H2645_ENC_RATE_CONTROL_METHOD_CONSTANT_SKIP = 0x01, 129 PIPE_H2645_ENC_RATE_CONTROL_METHOD_VARIABLE_SKIP = 0x02, 130 PIPE_H2645_ENC_RATE_CONTROL_METHOD_CONSTANT = 0x03, 131 PIPE_H2645_ENC_RATE_CONTROL_METHOD_VARIABLE = 0x04 132 }; 133 134 struct pipe_picture_desc 135 { 136 enum pipe_video_profile profile; 137 enum pipe_video_entrypoint entry_point; 138 bool protected_playback; 139 uint8_t *decrypt_key; 140 enum pipe_format input_format; 141 enum pipe_format output_format; 142 }; 143 144 struct pipe_quant_matrix 145 { 146 enum pipe_video_format codec; 147 }; 148 149 struct pipe_macroblock 150 { 151 enum pipe_video_format codec; 152 }; 153 154 struct pipe_mpeg12_picture_desc 155 { 156 struct pipe_picture_desc base; 157 158 unsigned picture_coding_type; 159 unsigned picture_structure; 160 unsigned frame_pred_frame_dct; 161 unsigned q_scale_type; 162 unsigned alternate_scan; 163 unsigned intra_vlc_format; 164 unsigned concealment_motion_vectors; 165 unsigned intra_dc_precision; 166 unsigned f_code[2][2]; 167 unsigned top_field_first; 168 unsigned full_pel_forward_vector; 169 unsigned full_pel_backward_vector; 170 unsigned num_slices; 171 172 const uint8_t *intra_matrix; 173 const uint8_t *non_intra_matrix; 174 175 struct pipe_video_buffer *ref[2]; 176 }; 177 178 struct pipe_mpeg12_macroblock 179 { 180 struct pipe_macroblock base; 181 182 /* see section 6.3.17 in the spec */ 183 unsigned short x, y; 184 185 /* see section 6.3.17.1 in the spec */ 186 unsigned char macroblock_type; 187 188 union { 189 struct { 190 /* see table 6-17 in the spec */ 191 unsigned int frame_motion_type:2; 192 193 /* see table 6-18 in the spec */ 194 unsigned int field_motion_type:2; 195 196 /* see table 6-19 in the spec */ 197 unsigned int dct_type:1; 198 } bits; 199 unsigned int value; 200 } macroblock_modes; 201 202 /* see section 6.3.17.2 in the spec */ 203 unsigned char motion_vertical_field_select; 204 205 /* see Table 7-7 in the spec */ 206 short PMV[2][2][2]; 207 208 /* see figure 6.10-12 in the spec */ 209 unsigned short coded_block_pattern; 210 211 /* see figure 6.10-12 in the spec */ 212 short *blocks; 213 214 /* Number of skipped macroblocks after this macroblock */ 215 unsigned short num_skipped_macroblocks; 216 }; 217 218 struct pipe_mpeg4_picture_desc 219 { 220 struct pipe_picture_desc base; 221 222 int32_t trd[2]; 223 int32_t trb[2]; 224 uint16_t vop_time_increment_resolution; 225 uint8_t vop_coding_type; 226 uint8_t vop_fcode_forward; 227 uint8_t vop_fcode_backward; 228 uint8_t resync_marker_disable; 229 uint8_t interlaced; 230 uint8_t quant_type; 231 uint8_t quarter_sample; 232 uint8_t short_video_header; 233 uint8_t rounding_control; 234 uint8_t alternate_vertical_scan_flag; 235 uint8_t top_field_first; 236 237 const uint8_t *intra_matrix; 238 const uint8_t *non_intra_matrix; 239 240 struct pipe_video_buffer *ref[2]; 241 }; 242 243 struct pipe_vc1_picture_desc 244 { 245 struct pipe_picture_desc base; 246 247 uint32_t slice_count; 248 uint8_t picture_type; 249 uint8_t frame_coding_mode; 250 uint8_t postprocflag; 251 uint8_t pulldown; 252 uint8_t interlace; 253 uint8_t tfcntrflag; 254 uint8_t finterpflag; 255 uint8_t psf; 256 uint8_t dquant; 257 uint8_t panscan_flag; 258 uint8_t refdist_flag; 259 uint8_t quantizer; 260 uint8_t extended_mv; 261 uint8_t extended_dmv; 262 uint8_t overlap; 263 uint8_t vstransform; 264 uint8_t loopfilter; 265 uint8_t fastuvmc; 266 uint8_t range_mapy_flag; 267 uint8_t range_mapy; 268 uint8_t range_mapuv_flag; 269 uint8_t range_mapuv; 270 uint8_t multires; 271 uint8_t syncmarker; 272 uint8_t rangered; 273 uint8_t maxbframes; 274 uint8_t deblockEnable; 275 uint8_t pquant; 276 277 struct pipe_video_buffer *ref[2]; 278 }; 279 280 struct pipe_h264_sps 281 { 282 uint8_t level_idc; 283 uint8_t chroma_format_idc; 284 uint8_t separate_colour_plane_flag; 285 uint8_t bit_depth_luma_minus8; 286 uint8_t bit_depth_chroma_minus8; 287 uint8_t seq_scaling_matrix_present_flag; 288 uint8_t ScalingList4x4[6][16]; 289 uint8_t ScalingList8x8[6][64]; 290 uint8_t log2_max_frame_num_minus4; 291 uint8_t pic_order_cnt_type; 292 uint8_t log2_max_pic_order_cnt_lsb_minus4; 293 uint8_t delta_pic_order_always_zero_flag; 294 int32_t offset_for_non_ref_pic; 295 int32_t offset_for_top_to_bottom_field; 296 uint8_t num_ref_frames_in_pic_order_cnt_cycle; 297 int32_t offset_for_ref_frame[256]; 298 uint8_t max_num_ref_frames; 299 uint8_t frame_mbs_only_flag; 300 uint8_t mb_adaptive_frame_field_flag; 301 uint8_t direct_8x8_inference_flag; 302 uint8_t MinLumaBiPredSize8x8; 303 }; 304 305 struct pipe_h264_pps 306 { 307 struct pipe_h264_sps *sps; 308 309 uint8_t entropy_coding_mode_flag; 310 uint8_t bottom_field_pic_order_in_frame_present_flag; 311 uint8_t num_slice_groups_minus1; 312 uint8_t slice_group_map_type; 313 uint8_t slice_group_change_rate_minus1; 314 uint8_t num_ref_idx_l0_default_active_minus1; 315 uint8_t num_ref_idx_l1_default_active_minus1; 316 uint8_t weighted_pred_flag; 317 uint8_t weighted_bipred_idc; 318 int8_t pic_init_qp_minus26; 319 int8_t pic_init_qs_minus26; 320 int8_t chroma_qp_index_offset; 321 uint8_t deblocking_filter_control_present_flag; 322 uint8_t constrained_intra_pred_flag; 323 uint8_t redundant_pic_cnt_present_flag; 324 uint8_t ScalingList4x4[6][16]; 325 uint8_t ScalingList8x8[6][64]; 326 uint8_t transform_8x8_mode_flag; 327 int8_t second_chroma_qp_index_offset; 328 }; 329 330 struct h264_private { 331 struct pipe_video_buffer *past_ref[16]; 332 }; 333 334 struct pipe_h264_picture_desc 335 { 336 struct pipe_picture_desc base; 337 338 struct pipe_h264_pps *pps; 339 340 /* slice header */ 341 uint32_t frame_num; 342 uint8_t field_pic_flag; 343 uint8_t bottom_field_flag; 344 uint8_t num_ref_idx_l0_active_minus1; 345 uint8_t num_ref_idx_l1_active_minus1; 346 347 uint32_t slice_count; 348 int32_t field_order_cnt[2]; 349 bool is_reference; 350 uint8_t num_ref_frames; 351 352 bool is_long_term[16]; 353 bool top_is_reference[16]; 354 bool bottom_is_reference[16]; 355 uint32_t field_order_cnt_list[16][2]; 356 uint32_t frame_num_list[16]; 357 358 struct pipe_video_buffer *ref[16]; 359 360 /* using private as a parameter name conflicts with C++ keywords */ 361 void *priv; 362 }; 363 364 struct pipe_h264_enc_rate_control 365 { 366 enum pipe_h2645_enc_rate_control_method rate_ctrl_method; 367 unsigned target_bitrate; 368 unsigned peak_bitrate; 369 unsigned frame_rate_num; 370 unsigned frame_rate_den; 371 unsigned vbv_buffer_size; 372 unsigned vbv_buf_lv; 373 unsigned target_bits_picture; 374 unsigned peak_bits_picture_integer; 375 unsigned peak_bits_picture_fraction; 376 unsigned fill_data_enable; 377 unsigned enforce_hrd; 378 }; 379 380 struct pipe_h264_enc_motion_estimation 381 { 382 unsigned motion_est_quarter_pixel; 383 unsigned enc_disable_sub_mode; 384 unsigned lsmvert; 385 unsigned enc_en_ime_overw_dis_subm; 386 unsigned enc_ime_overw_dis_subm_no; 387 unsigned enc_ime2_search_range_x; 388 unsigned enc_ime2_search_range_y; 389 }; 390 391 struct pipe_h264_enc_pic_control 392 { 393 unsigned enc_cabac_enable; 394 unsigned enc_cabac_init_idc; 395 unsigned enc_constraint_set_flags; 396 unsigned enc_frame_cropping_flag; 397 unsigned enc_frame_crop_left_offset; 398 unsigned enc_frame_crop_right_offset; 399 unsigned enc_frame_crop_top_offset; 400 unsigned enc_frame_crop_bottom_offset; 401 }; 402 403 struct h264_slice_descriptor 404 { 405 /** Starting MB address for this slice. */ 406 uint32_t macroblock_address; 407 /** Number of macroblocks in this slice. */ 408 uint32_t num_macroblocks; 409 /** slice type. */ 410 enum pipe_h264_slice_type slice_type; 411 }; 412 413 struct pipe_h264_enc_picture_desc 414 { 415 struct pipe_picture_desc base; 416 417 struct pipe_h264_enc_rate_control rate_ctrl[4]; 418 419 struct pipe_h264_enc_motion_estimation motion_est; 420 struct pipe_h264_enc_pic_control pic_ctrl; 421 422 unsigned quant_i_frames; 423 unsigned quant_p_frames; 424 unsigned quant_b_frames; 425 426 enum pipe_h2645_enc_picture_type picture_type; 427 unsigned frame_num; 428 unsigned frame_num_cnt; 429 unsigned p_remain; 430 unsigned i_remain; 431 unsigned idr_pic_id; 432 unsigned gop_cnt; 433 unsigned pic_order_cnt; 434 unsigned pic_order_cnt_type; 435 unsigned num_ref_idx_l0_active_minus1; 436 unsigned num_ref_idx_l1_active_minus1; 437 unsigned ref_idx_l0_list[32]; 438 unsigned ref_idx_l1_list[32]; 439 unsigned gop_size; 440 unsigned ref_pic_mode; 441 unsigned num_temporal_layers; 442 443 bool not_referenced; 444 bool enable_vui; 445 struct hash_table *frame_idx; 446 447 unsigned num_slice_descriptors; 448 struct h264_slice_descriptor slices_descriptors[128]; 449 }; 450 451 struct pipe_h265_enc_seq_param 452 { 453 uint8_t general_profile_idc; 454 uint8_t general_level_idc; 455 uint8_t general_tier_flag; 456 uint32_t intra_period; 457 uint16_t pic_width_in_luma_samples; 458 uint16_t pic_height_in_luma_samples; 459 uint32_t chroma_format_idc; 460 uint32_t bit_depth_luma_minus8; 461 uint32_t bit_depth_chroma_minus8; 462 bool strong_intra_smoothing_enabled_flag; 463 bool amp_enabled_flag; 464 bool sample_adaptive_offset_enabled_flag; 465 bool pcm_enabled_flag; 466 bool sps_temporal_mvp_enabled_flag; 467 uint8_t log2_min_luma_coding_block_size_minus3; 468 uint8_t log2_diff_max_min_luma_coding_block_size; 469 uint8_t log2_min_transform_block_size_minus2; 470 uint8_t log2_diff_max_min_transform_block_size; 471 uint8_t max_transform_hierarchy_depth_inter; 472 uint8_t max_transform_hierarchy_depth_intra; 473 uint8_t conformance_window_flag; 474 uint16_t conf_win_left_offset; 475 uint16_t conf_win_right_offset; 476 uint16_t conf_win_top_offset; 477 uint16_t conf_win_bottom_offset; 478 }; 479 480 struct pipe_h265_enc_pic_param 481 { 482 uint8_t log2_parallel_merge_level_minus2; 483 uint8_t nal_unit_type; 484 bool constrained_intra_pred_flag; 485 }; 486 487 struct pipe_h265_enc_slice_param 488 { 489 uint8_t max_num_merge_cand; 490 int8_t slice_cb_qp_offset; 491 int8_t slice_cr_qp_offset; 492 int8_t slice_beta_offset_div2; 493 int8_t slice_tc_offset_div2; 494 bool cabac_init_flag; 495 uint32_t slice_deblocking_filter_disabled_flag; 496 bool slice_loop_filter_across_slices_enabled_flag; 497 }; 498 499 struct pipe_h265_enc_rate_control 500 { 501 enum pipe_h2645_enc_rate_control_method rate_ctrl_method; 502 unsigned target_bitrate; 503 unsigned peak_bitrate; 504 unsigned frame_rate_num; 505 unsigned frame_rate_den; 506 unsigned quant_i_frames; 507 unsigned vbv_buffer_size; 508 unsigned vbv_buf_lv; 509 unsigned target_bits_picture; 510 unsigned peak_bits_picture_integer; 511 unsigned peak_bits_picture_fraction; 512 unsigned fill_data_enable; 513 unsigned enforce_hrd; 514 }; 515 516 struct pipe_h265_enc_picture_desc 517 { 518 struct pipe_picture_desc base; 519 520 struct pipe_h265_enc_seq_param seq; 521 struct pipe_h265_enc_pic_param pic; 522 struct pipe_h265_enc_slice_param slice; 523 struct pipe_h265_enc_rate_control rc; 524 525 enum pipe_h2645_enc_picture_type picture_type; 526 unsigned decoded_curr_pic; 527 unsigned reference_frames[16]; 528 unsigned frame_num; 529 unsigned pic_order_cnt; 530 unsigned pic_order_cnt_type; 531 unsigned ref_idx_l0; 532 unsigned ref_idx_l1; 533 bool not_referenced; 534 struct hash_table *frame_idx; 535 }; 536 537 struct pipe_h265_sps 538 { 539 uint8_t chroma_format_idc; 540 uint8_t separate_colour_plane_flag; 541 uint32_t pic_width_in_luma_samples; 542 uint32_t pic_height_in_luma_samples; 543 uint8_t bit_depth_luma_minus8; 544 uint8_t bit_depth_chroma_minus8; 545 uint8_t log2_max_pic_order_cnt_lsb_minus4; 546 uint8_t sps_max_dec_pic_buffering_minus1; 547 uint8_t log2_min_luma_coding_block_size_minus3; 548 uint8_t log2_diff_max_min_luma_coding_block_size; 549 uint8_t log2_min_transform_block_size_minus2; 550 uint8_t log2_diff_max_min_transform_block_size; 551 uint8_t max_transform_hierarchy_depth_inter; 552 uint8_t max_transform_hierarchy_depth_intra; 553 uint8_t scaling_list_enabled_flag; 554 uint8_t ScalingList4x4[6][16]; 555 uint8_t ScalingList8x8[6][64]; 556 uint8_t ScalingList16x16[6][64]; 557 uint8_t ScalingList32x32[2][64]; 558 uint8_t ScalingListDCCoeff16x16[6]; 559 uint8_t ScalingListDCCoeff32x32[2]; 560 uint8_t amp_enabled_flag; 561 uint8_t sample_adaptive_offset_enabled_flag; 562 uint8_t pcm_enabled_flag; 563 uint8_t pcm_sample_bit_depth_luma_minus1; 564 uint8_t pcm_sample_bit_depth_chroma_minus1; 565 uint8_t log2_min_pcm_luma_coding_block_size_minus3; 566 uint8_t log2_diff_max_min_pcm_luma_coding_block_size; 567 uint8_t pcm_loop_filter_disabled_flag; 568 uint8_t num_short_term_ref_pic_sets; 569 uint8_t long_term_ref_pics_present_flag; 570 uint8_t num_long_term_ref_pics_sps; 571 uint8_t sps_temporal_mvp_enabled_flag; 572 uint8_t strong_intra_smoothing_enabled_flag; 573 }; 574 575 struct pipe_h265_pps 576 { 577 struct pipe_h265_sps *sps; 578 579 uint8_t dependent_slice_segments_enabled_flag; 580 uint8_t output_flag_present_flag; 581 uint8_t num_extra_slice_header_bits; 582 uint8_t sign_data_hiding_enabled_flag; 583 uint8_t cabac_init_present_flag; 584 uint8_t num_ref_idx_l0_default_active_minus1; 585 uint8_t num_ref_idx_l1_default_active_minus1; 586 int8_t init_qp_minus26; 587 uint8_t constrained_intra_pred_flag; 588 uint8_t transform_skip_enabled_flag; 589 uint8_t cu_qp_delta_enabled_flag; 590 uint8_t diff_cu_qp_delta_depth; 591 int8_t pps_cb_qp_offset; 592 int8_t pps_cr_qp_offset; 593 uint8_t pps_slice_chroma_qp_offsets_present_flag; 594 uint8_t weighted_pred_flag; 595 uint8_t weighted_bipred_flag; 596 uint8_t transquant_bypass_enabled_flag; 597 uint8_t tiles_enabled_flag; 598 uint8_t entropy_coding_sync_enabled_flag; 599 uint8_t num_tile_columns_minus1; 600 uint8_t num_tile_rows_minus1; 601 uint8_t uniform_spacing_flag; 602 uint16_t column_width_minus1[20]; 603 uint16_t row_height_minus1[22]; 604 uint8_t loop_filter_across_tiles_enabled_flag; 605 uint8_t pps_loop_filter_across_slices_enabled_flag; 606 uint8_t deblocking_filter_control_present_flag; 607 uint8_t deblocking_filter_override_enabled_flag; 608 uint8_t pps_deblocking_filter_disabled_flag; 609 int8_t pps_beta_offset_div2; 610 int8_t pps_tc_offset_div2; 611 uint8_t lists_modification_present_flag; 612 uint8_t log2_parallel_merge_level_minus2; 613 uint8_t slice_segment_header_extension_present_flag; 614 uint16_t st_rps_bits; 615 }; 616 617 struct pipe_h265_picture_desc 618 { 619 struct pipe_picture_desc base; 620 621 struct pipe_h265_pps *pps; 622 623 uint8_t IDRPicFlag; 624 uint8_t RAPPicFlag; 625 uint8_t CurrRpsIdx; 626 uint32_t NumPocTotalCurr; 627 uint32_t NumDeltaPocsOfRefRpsIdx; 628 uint32_t NumShortTermPictureSliceHeaderBits; 629 uint32_t NumLongTermPictureSliceHeaderBits; 630 631 int32_t CurrPicOrderCntVal; 632 struct pipe_video_buffer *ref[16]; 633 int32_t PicOrderCntVal[16]; 634 uint8_t IsLongTerm[16]; 635 uint8_t NumPocStCurrBefore; 636 uint8_t NumPocStCurrAfter; 637 uint8_t NumPocLtCurr; 638 uint8_t RefPicSetStCurrBefore[8]; 639 uint8_t RefPicSetStCurrAfter[8]; 640 uint8_t RefPicSetLtCurr[8]; 641 uint8_t RefPicList[2][15]; 642 bool UseRefPicList; 643 bool UseStRpsBits; 644 }; 645 646 struct pipe_mjpeg_picture_desc 647 { 648 struct pipe_picture_desc base; 649 650 struct 651 { 652 uint16_t picture_width; 653 uint16_t picture_height; 654 655 struct { 656 uint8_t component_id; 657 uint8_t h_sampling_factor; 658 uint8_t v_sampling_factor; 659 uint8_t quantiser_table_selector; 660 } components[255]; 661 662 uint8_t num_components; 663 } picture_parameter; 664 665 struct 666 { 667 uint8_t load_quantiser_table[4]; 668 uint8_t quantiser_table[4][64]; 669 } quantization_table; 670 671 struct 672 { 673 uint8_t load_huffman_table[2]; 674 675 struct { 676 uint8_t num_dc_codes[16]; 677 uint8_t dc_values[12]; 678 uint8_t num_ac_codes[16]; 679 uint8_t ac_values[162]; 680 uint8_t pad[2]; 681 } table[2]; 682 } huffman_table; 683 684 struct 685 { 686 unsigned slice_data_size; 687 unsigned slice_data_offset; 688 unsigned slice_data_flag; 689 unsigned slice_horizontal_position; 690 unsigned slice_vertical_position; 691 692 struct { 693 uint8_t component_selector; 694 uint8_t dc_table_selector; 695 uint8_t ac_table_selector; 696 } components[4]; 697 698 uint8_t num_components; 699 700 uint16_t restart_interval; 701 unsigned num_mcus; 702 } slice_parameter; 703 }; 704 705 struct vp9_segment_parameter 706 { 707 struct { 708 uint16_t segment_reference_enabled:1; 709 uint16_t segment_reference:2; 710 uint16_t segment_reference_skipped:1; 711 } segment_flags; 712 713 bool alt_quant_enabled; 714 int16_t alt_quant; 715 716 bool alt_lf_enabled; 717 int16_t alt_lf; 718 719 uint8_t filter_level[4][2]; 720 721 int16_t luma_ac_quant_scale; 722 int16_t luma_dc_quant_scale; 723 724 int16_t chroma_ac_quant_scale; 725 int16_t chroma_dc_quant_scale; 726 }; 727 728 struct pipe_vp9_picture_desc 729 { 730 struct pipe_picture_desc base; 731 732 struct pipe_video_buffer *ref[16]; 733 734 struct { 735 uint16_t frame_width; 736 uint16_t frame_height; 737 738 struct { 739 uint32_t subsampling_x:1; 740 uint32_t subsampling_y:1; 741 uint32_t frame_type:1; 742 uint32_t show_frame:1; 743 uint32_t error_resilient_mode:1; 744 uint32_t intra_only:1; 745 uint32_t allow_high_precision_mv:1; 746 uint32_t mcomp_filter_type:3; 747 uint32_t frame_parallel_decoding_mode:1; 748 uint32_t reset_frame_context:2; 749 uint32_t refresh_frame_context:1; 750 uint32_t frame_context_idx:2; 751 uint32_t segmentation_enabled:1; 752 uint32_t segmentation_temporal_update:1; 753 uint32_t segmentation_update_map:1; 754 uint32_t last_ref_frame:3; 755 uint32_t last_ref_frame_sign_bias:1; 756 uint32_t golden_ref_frame:3; 757 uint32_t golden_ref_frame_sign_bias:1; 758 uint32_t alt_ref_frame:3; 759 uint32_t alt_ref_frame_sign_bias:1; 760 uint32_t lossless_flag:1; 761 } pic_fields; 762 763 uint8_t filter_level; 764 uint8_t sharpness_level; 765 766 uint8_t log2_tile_rows; 767 uint8_t log2_tile_columns; 768 769 uint8_t frame_header_length_in_bytes; 770 771 uint16_t first_partition_size; 772 773 uint8_t mb_segment_tree_probs[7]; 774 uint8_t segment_pred_probs[3]; 775 776 uint8_t profile; 777 778 uint8_t bit_depth; 779 780 bool mode_ref_delta_enabled; 781 bool mode_ref_delta_update; 782 783 uint8_t base_qindex; 784 int8_t y_dc_delta_q; 785 int8_t uv_ac_delta_q; 786 int8_t uv_dc_delta_q; 787 uint8_t abs_delta; 788 } picture_parameter; 789 790 struct { 791 uint32_t slice_data_size; 792 uint32_t slice_data_offset; 793 794 uint32_t slice_data_flag; 795 796 struct vp9_segment_parameter seg_param[8]; 797 } slice_parameter; 798 }; 799 800 struct pipe_av1_picture_desc 801 { 802 struct pipe_picture_desc base; 803 804 struct pipe_video_buffer *ref[16]; 805 806 struct { 807 uint8_t profile; 808 uint8_t order_hint_bits_minus_1; 809 uint8_t bit_depth_idx; 810 811 struct { 812 uint32_t use_128x128_superblock:1; 813 uint32_t enable_filter_intra:1; 814 uint32_t enable_intra_edge_filter:1; 815 uint32_t enable_interintra_compound:1; 816 uint32_t enable_masked_compound:1; 817 uint32_t enable_dual_filter:1; 818 uint32_t enable_order_hint:1; 819 uint32_t enable_jnt_comp:1; 820 uint32_t mono_chrome:1; 821 uint32_t ref_frame_mvs:1; 822 } seq_info_fields; 823 824 uint32_t current_frame_id; 825 826 uint16_t frame_width; 827 uint16_t frame_height; 828 uint16_t max_width; 829 uint16_t max_height; 830 831 uint8_t ref_frame_idx[7]; 832 uint8_t primary_ref_frame; 833 uint8_t order_hint; 834 835 struct { 836 struct { 837 uint32_t enabled:1; 838 uint32_t update_map:1; 839 uint32_t temporal_update:1; 840 } segment_info_fields; 841 842 int16_t feature_data[8][8]; 843 uint8_t feature_mask[8]; 844 } seg_info; 845 846 struct { 847 struct { 848 uint32_t apply_grain:1; 849 uint32_t chroma_scaling_from_luma:1; 850 uint32_t grain_scaling_minus_8:2; 851 uint32_t ar_coeff_lag:2; 852 uint32_t ar_coeff_shift_minus_6:2; 853 uint32_t grain_scale_shift:2; 854 uint32_t overlap_flag:1; 855 uint32_t clip_to_restricted_range:1; 856 } film_grain_info_fields; 857 858 uint16_t grain_seed; 859 uint8_t num_y_points; 860 uint8_t point_y_value[14]; 861 uint8_t point_y_scaling[14]; 862 uint8_t num_cb_points; 863 uint8_t point_cb_value[10]; 864 uint8_t point_cb_scaling[10]; 865 uint8_t num_cr_points; 866 uint8_t point_cr_value[10]; 867 uint8_t point_cr_scaling[10]; 868 int8_t ar_coeffs_y[24]; 869 int8_t ar_coeffs_cb[25]; 870 int8_t ar_coeffs_cr[25]; 871 uint8_t cb_mult; 872 uint8_t cb_luma_mult; 873 uint16_t cb_offset; 874 uint8_t cr_mult; 875 uint8_t cr_luma_mult; 876 uint16_t cr_offset; 877 } film_grain_info; 878 879 uint8_t tile_cols; 880 uint8_t tile_rows; 881 uint32_t tile_col_start_sb[65]; 882 uint32_t tile_row_start_sb[65]; 883 uint16_t context_update_tile_id; 884 885 struct { 886 uint32_t frame_type:2; 887 uint32_t show_frame:1; 888 uint32_t error_resilient_mode:1; 889 uint32_t disable_cdf_update:1; 890 uint32_t allow_screen_content_tools:1; 891 uint32_t force_integer_mv:1; 892 uint32_t allow_intrabc:1; 893 uint32_t use_superres:1; 894 uint32_t allow_high_precision_mv:1; 895 uint32_t is_motion_mode_switchable:1; 896 uint32_t use_ref_frame_mvs:1; 897 uint32_t disable_frame_end_update_cdf:1; 898 uint32_t allow_warped_motion:1; 899 } pic_info_fields; 900 901 uint8_t superres_scale_denominator; 902 903 uint8_t interp_filter; 904 uint8_t filter_level[2]; 905 uint8_t filter_level_u; 906 uint8_t filter_level_v; 907 struct { 908 uint8_t sharpness_level:3; 909 uint8_t mode_ref_delta_enabled:1; 910 uint8_t mode_ref_delta_update:1; 911 } loop_filter_info_fields; 912 913 int8_t ref_deltas[8]; 914 int8_t mode_deltas[2]; 915 916 uint8_t base_qindex; 917 int8_t y_dc_delta_q; 918 int8_t u_dc_delta_q; 919 int8_t u_ac_delta_q; 920 int8_t v_dc_delta_q; 921 int8_t v_ac_delta_q; 922 923 struct { 924 uint16_t qm_y:4; 925 uint16_t qm_u:4; 926 uint16_t qm_v:4; 927 } qmatrix_fields; 928 929 struct { 930 uint32_t delta_q_present_flag:1; 931 uint32_t log2_delta_q_res:2; 932 uint32_t delta_lf_present_flag:1; 933 uint32_t log2_delta_lf_res:2; 934 uint32_t delta_lf_multi:1; 935 uint32_t tx_mode:2; 936 uint32_t reference_select:1; 937 uint32_t reduced_tx_set_used:1; 938 uint32_t skip_mode_present:1; 939 } mode_control_fields; 940 941 uint8_t cdef_damping_minus_3; 942 uint8_t cdef_bits; 943 uint8_t cdef_y_strengths[8]; 944 uint8_t cdef_uv_strengths[8]; 945 946 struct { 947 uint16_t yframe_restoration_type:2; 948 uint16_t cbframe_restoration_type:2; 949 uint16_t crframe_restoration_type:2; 950 } loop_restoration_fields; 951 952 uint16_t lr_unit_size[3]; 953 954 struct { 955 uint32_t wmtype; 956 int32_t wmmat[8]; 957 } wm[7]; 958 959 uint32_t refresh_frame_flags; 960 } picture_parameter; 961 962 struct { 963 uint32_t slice_data_size[256]; 964 uint32_t slice_data_offset[256]; 965 } slice_parameter; 966 }; 967 968 struct pipe_vpp_blend 969 { 970 enum pipe_video_vpp_blend_mode mode; 971 /* To be used with PIPE_VIDEO_VPP_BLEND_MODE_GLOBAL_ALPHA */ 972 float global_alpha; 973 }; 974 975 struct pipe_vpp_desc 976 { 977 struct pipe_picture_desc base; 978 struct u_rect src_region; 979 struct u_rect dst_region; 980 enum pipe_video_vpp_orientation orientation; 981 struct pipe_vpp_blend blend; 982 }; 983 984 #ifdef __cplusplus 985 } 986 #endif 987 988 #endif /* PIPE_VIDEO_STATE_H */ 989