1 /****************************************************************************** 2 * 3 * Copyright (C) 2015 The Android Open Source Project 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at: 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ***************************************************************************** 18 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore 19 */ 20 21 /** 22 ******************************************************************************* 23 * @file 24 * ih264_structs.h 25 * 26 * @brief 27 * Structure definitions used in the code 28 * 29 * @author 30 * ittiam 31 * 32 * @remarks 33 * none 34 * 35 ******************************************************************************* 36 */ 37 38 #ifndef _IH264_STRUCTS_H_ 39 #define _IH264_STRUCTS_H_ 40 41 /** MB Type info for Intra MBs */ 42 typedef struct 43 { 44 UWORD32 u4_num_mbpart; 45 MBPART_PREDMODE_T e_mbpart_predmode; 46 MBMODES_I16x16 e_intra_predmode; 47 UWORD32 u4_cpb_chroma; 48 UWORD32 u4_cpb_luma; 49 }intra_mbtype_info_t; 50 51 /** MB Type info for Inter MBs */ 52 typedef struct 53 { 54 UWORD32 u4_num_mbpart; 55 MBPART_PREDMODE_T e_mbpart_predmode_0; 56 MBPART_PREDMODE_T e_mbpart_predmode_1; 57 UWORD32 u4_mbpart_wd; 58 UWORD32 u4_mbpart_ht; 59 }inter_mbtype_info_t; 60 61 62 /** Sub MB Type info for Inter MBs */ 63 typedef struct 64 { 65 UWORD32 u4_num_mbpart; 66 MBPART_PREDMODE_T e_mbpart_predmode; 67 UWORD32 u4_mbpart_wd; 68 UWORD32 u4_mbpart_ht; 69 }submbtype_info_t; 70 71 /** 72 * Picture buffer 73 */ 74 typedef struct 75 { 76 UWORD8* pu1_luma; 77 UWORD8* pu1_chroma; 78 79 WORD32 i4_abs_poc; 80 WORD32 i4_poc_lsb; 81 82 83 /** Lower 32 bit of time stamp */ 84 UWORD32 u4_timestamp_low; 85 86 /** Upper 32 bit of time stamp */ 87 UWORD32 u4_timestamp_high; 88 89 WORD32 i4_used_as_ref; 90 91 /** 92 * frame_num in the slice header 93 */ 94 WORD32 i4_frame_num; 95 96 /** 97 * Long-term frame idx 98 * TODO: store in frame_num 99 */ 100 WORD32 i4_long_term_frame_idx; 101 102 /* 103 * 0: Top Field 104 * 1: Bottom Field 105 */ 106 WORD8 i1_field_type; 107 108 /** 109 * buffer ID from frame buffer manager 110 */ 111 WORD32 i4_buf_id; 112 113 } pic_buf_t; 114 115 116 /** 117 * Reference List 118 */ 119 typedef struct 120 { 121 void *pv_pic_buf; 122 123 void *pv_mv_buf; 124 125 } ref_list_t; 126 127 128 /** 129 * Motion vector 130 */ 131 typedef struct 132 { 133 /** 134 * Horizontal Motion Vector 135 */ 136 WORD16 i2_mvx; 137 138 /** 139 * Vertical Motion Vector 140 */ 141 WORD16 i2_mvy; 142 } mv_t; 143 144 /*****************************************************************************/ 145 /* Following results in packed 48 bit structure. If mv_t included */ 146 /* ref_pic_buf_id, then 8 bits will be wasted for each mv for aligning. */ 147 /* Also using mv_t as elements directly instead of a pointer to l0 and l1 */ 148 /* mvs. Since pointer takes 4 bytes and MV itself is 4 bytes. It does not */ 149 /* really help using pointers. */ 150 /*****************************************************************************/ 151 152 /** 153 * PU Motion Vector info 154 */ 155 typedef struct 156 { 157 /** 158 * L0 Motion Vector 159 */ 160 mv_t s_l0_mv; 161 162 /** 163 * L1 Motion Vector 164 */ 165 mv_t s_l1_mv; 166 167 /** 168 * L0 Ref index 169 */ 170 WORD8 i1_l0_ref_idx; 171 172 /** 173 * L1 Ref index 174 */ 175 WORD8 i1_l1_ref_idx; 176 177 /** 178 * L0 Ref Pic Buf ID 179 */ 180 WORD8 i1_l0_ref_pic_buf_id; 181 182 /** 183 * L1 Ref Pic Buf ID 184 */ 185 WORD8 i1_l1_ref_pic_buf_id; 186 187 } pu_mv_t; 188 189 /** 190 * PU information 191 */ 192 typedef struct 193 { 194 195 /** 196 * Motion Vectors 197 */ 198 pu_mv_t s_mv; 199 200 /** 201 * PU X position in terms of min PU (4x4) units 202 */ 203 UWORD32 b2_pos_x : 2; 204 205 /** 206 * PU Y position in terms of min PU (4x4) units 207 */ 208 UWORD32 b2_pos_y : 2; 209 210 /** 211 * PU width in pixels = (b2_wd + 1) << 2 212 */ 213 UWORD32 b2_wd : 2; 214 215 /** 216 * PU height in pixels = (b2_ht + 1) << 2 217 */ 218 UWORD32 b2_ht : 2; 219 220 /** 221 * Intra or Inter flag for each partition - 0 or 1 222 */ 223 UWORD32 b1_intra_flag : 1; 224 225 /** 226 * PRED_L0, PRED_L1, PRED_BI 227 */ 228 UWORD32 b2_pred_mode : 2; 229 230 } pu_t; 231 232 233 /** 234 * MB information to be stored for entire frame 235 */ 236 typedef struct 237 { 238 /** 239 * Transform sizes 0: 4x4, 1: 8x8, 240 */ 241 UWORD32 b1_trans_size : 1; 242 243 /** 244 * CBP - 4 bits for Y, 1 for U and 1 for V 245 */ 246 UWORD32 b6_cbp: 6; 247 248 /** 249 * Intra pred sizes 0: 4x4, 1: 8x8, 2: 16x16 250 */ 251 UWORD32 b2_intra_pred_size : 2; 252 253 /** 254 * Flag to signal if the current MB is IPCM 255 */ 256 UWORD32 b1_ipcm : 1; 257 258 }mb_t; 259 260 /*****************************************************************************/ 261 /* Info from last TU row of MB is stored in a row level neighbour buffer */ 262 /* , which will be used for Boundary Strength computation */ 263 /*****************************************************************************/ 264 /** 265 * MB neighbor info 266 */ 267 typedef struct 268 { 269 /** 270 * Slice index of the mb 271 */ 272 UWORD16 u2_slice_idx; 273 274 /*************************************************************************/ 275 /* CBF of bottom TU row (replicated in 4 pixel boundary) */ 276 /* MSB contains CBF of first TU in the last row and LSB contains CBF */ 277 /* of last TU in the last row */ 278 /*************************************************************************/ 279 /** 280 * CBF of bottom TU row 281 */ 282 UWORD16 u2_packed_cbf; 283 284 /*************************************************************************/ 285 /* QP of bottom TU row (replicated at 8 pixel boundary (Since QP can */ 286 /* not change at less than min CU granularity) */ 287 /*************************************************************************/ 288 /** 289 * QP of bottom TU row 290 */ 291 UWORD8 u1_qp; 292 293 } mb_top_ny_info_t; 294 295 /** 296 * MB level context 297 */ 298 typedef struct _mb_ctxt_t 299 { 300 /*************************************************************************/ 301 /* Tile boundary can be detected by looking at tile start x and tile */ 302 /* start y. And based on the tile, slice and frame boundary the */ 303 /* following will be initialized. */ 304 /*************************************************************************/ 305 /** 306 * Pointer to left MB 307 */ 308 /* If not available, this will be set to NULL */ 309 struct _mb_ctxt_t *ps_mb_left; 310 311 /** 312 * Pointer to top-left MB 313 */ 314 /* If not available, this will be set to NULL */ 315 mb_top_ny_info_t *ps_mb_ny_topleft; 316 317 /** 318 * Pointer to top MB 319 */ 320 /* If not available, this will be set to NULL */ 321 mb_top_ny_info_t *ps_mb_ny_top; 322 323 /** 324 * Pointer to top-right MB 325 */ 326 /* If not available, this will be set to NULL */ 327 mb_top_ny_info_t *ps_mb_ny_topright; 328 329 /*************************************************************************/ 330 /* Pointer to PU data. */ 331 /* This points to a MV Bank stored at frame level. Though this */ 332 /* pointer can be derived by reading offset at frame level, it is */ 333 /* stored here for faster access. Can be removed if storage of MB */ 334 /* structure is critical */ 335 /*************************************************************************/ 336 /** 337 * Pointer to PU data 338 */ 339 pu_t *ps_pu; 340 341 /*************************************************************************/ 342 /* Pointer to a PU map stored at frame level, */ 343 /* Though this pointer can be derived by multiplying MB address with */ 344 /* number of minTUs in a MB, it is stored here for faster access. */ 345 /* Can be removed if storage of MB structure is critical */ 346 /*************************************************************************/ 347 /** 348 * Pointer to a PU map stored at frame level 349 */ 350 UWORD8 *pu1_pu_map; 351 352 /** 353 * Number of TUs filled in as_tu 354 */ 355 /*************************************************************************/ 356 /* Having the first entry as 32 bit data, helps in keeping each of */ 357 /* the structures aligned to 32 bits at MB level */ 358 /*************************************************************************/ 359 WORD32 i4_tu_cnt; 360 361 /** 362 * Pointer to transform coeff data 363 */ 364 /*************************************************************************/ 365 /* Following format is repeated for every coded TU */ 366 /* Luma Block */ 367 /* num_coeffs : 16 bits */ 368 /* zero_cols : 8 bits ( 1 bit per 4 columns) */ 369 /* sig_coeff_map : ((TU Size * TU Size) + 31) >> 5 number of WORD32s */ 370 /* coeff_data : Non zero coefficients */ 371 /* Cb Block (only for last TU in 4x4 case else for every luma TU) */ 372 /* num_coeffs : 16 bits */ 373 /* zero_cols : 8 bits ( 1 bit per 4 columns) */ 374 /* sig_coeff_map : ((TU Size * TU Size) + 31) >> 5 number of WORD32s */ 375 /* coeff_data : Non zero coefficients */ 376 /* Cr Block (only for last TU in 4x4 case else for every luma TU) */ 377 /* num_coeffs : 16 bits */ 378 /* zero_cols : 8 bits ( 1 bit per 4 columns) */ 379 /* sig_coeff_map : ((TU Size * TU Size) + 31) >> 5 number of WORD32s */ 380 /* coeff_data : Non zero coefficients */ 381 /*************************************************************************/ 382 void *pv_coeff_data; 383 384 /** 385 * Slice to which the MB belongs to 386 */ 387 WORD32 i4_slice_idx; 388 389 /** 390 * MB column position 391 */ 392 WORD32 i4_pos_x; 393 394 /** 395 * MB row position 396 */ 397 WORD32 i4_pos_y; 398 399 /** 400 * Number of PUs filled in ps_pu 401 */ 402 WORD32 i4_pu_cnt; 403 404 /** 405 * Index of current PU being processed in ps_pu 406 */ 407 /* Scratch variable set to 0 at the start of any PU processing function */ 408 WORD32 i4_pu_idx; 409 410 /** 411 * Vertical Boundary strength 412 */ 413 /* Two bits per edge. 414 Stored in format. BS[15] | BS[14] | .. |BS[0]*/ 415 UWORD32 *pu4_vert_bs; 416 417 /** 418 * Horizontal Boundary strength 419 */ 420 421 /* Two bits per edge. 422 Stored in format. BS[15] | BS[14] | .. |BS[0]*/ 423 UWORD32 *pu4_horz_bs; 424 425 /** 426 * Qp array stored for each 8x8 pixels 427 */ 428 UWORD8 *pu1_qp; 429 430 /** 431 * Pointer to current frame's pu_t array 432 */ 433 pu_t *ps_frm_pu; 434 435 /** 436 * Pointer to current frame's pu_t index array, which stores starting index 437 * of pu_t for every MB 438 */ 439 UWORD32 *pu4_frm_pu_idx; 440 441 /** 442 * Pointer to current frame's pu map array 443 */ 444 UWORD8 *pu1_frm_pu_map; 445 446 /*************************************************************************/ 447 /* Need to add encoder specific elements for identifying the order of */ 448 /* coding for CU, TU and PU if any */ 449 /*************************************************************************/ 450 } mb_ctxt_t; 451 452 /*************************************************************************/ 453 /* The following describes how each of the CU cases are handled */ 454 /*************************************************************************/ 455 456 /*************************************************************************/ 457 /* For SKIP MB */ 458 /* One Inter PU with appropriate MV */ 459 /* One TU which says CBP is zero and size is 16x16 */ 460 /*************************************************************************/ 461 462 /*************************************************************************/ 463 /* For Inter MB */ 464 /* M Inter PU with appropriate MVs (M between 1 to 4) */ 465 /* Number of TUs derived based on transform size */ 466 /*************************************************************************/ 467 468 /*************************************************************************/ 469 /* For Intra MB */ 470 /* Number of TUs derived based on transform size */ 471 /* N Intra Modes are signaled along with coeff data at the start */ 472 /*************************************************************************/ 473 474 /*************************************************************************/ 475 /* For Intra PCM MB */ 476 /* One TU which says ipcm is 1 */ 477 /*************************************************************************/ 478 479 480 481 /** 482 * Structure to hold quantization parameters of an mb 483 */ 484 typedef struct 485 { 486 487 /* 488 * mb qp 489 */ 490 UWORD8 u1_mb_qp; 491 492 /* 493 * mb qp / 6 494 */ 495 UWORD8 u1_qp_div; 496 497 /* 498 * mb qp mod 6 499 */ 500 UWORD8 u1_qp_rem; 501 502 /* 503 * QP bits 504 */ 505 UWORD8 u1_qbits; 506 507 /* 508 * forward scale matrix 509 */ 510 const UWORD16 *pu2_scale_mat; 511 512 /* 513 * threshold matrix for quantization 514 */ 515 UWORD16 *pu2_thres_mat; 516 517 /* 518 * Threshold to compare the sad with 519 */ 520 UWORD16 *pu2_sad_thrsh; 521 522 /* 523 * qp dependent rounding constant 524 */ 525 UWORD32 u4_dead_zone; 526 527 /* 528 * inverse scale matrix 529 */ 530 const UWORD16 *pu2_iscale_mat; 531 532 /* 533 * Weight matrix in iquant 534 */ 535 UWORD16 *pu2_weigh_mat; 536 537 }quant_params_t; 538 539 /** 540 * Structure to hold Profile tier level info for a given layer 541 */ 542 543 typedef struct 544 { 545 /** 546 * NAL unit type 547 */ 548 WORD8 i1_nal_unit_type; 549 550 /** 551 * NAL ref idc 552 */ 553 WORD8 i1_nal_ref_idc; 554 555 556 } nal_header_t; 557 558 /** 559 * HRD parameters Info 560 */ 561 typedef struct 562 { 563 /** 564 * Specifies the number of alternative CPB specifications in the 565 * bitstream 566 */ 567 UWORD8 u1_cpb_cnt_minus1; 568 569 /** 570 * (together with bit_rate_value_minus1) specifies the 571 * maximum input bit rate of the i-th CPB 572 */ 573 UWORD32 u4_bit_rate_scale; 574 575 /** 576 * (together with cpb_size_du_value_minus1) specifies 577 * CPB size of the i-th CPB when the CPB operates 578 * at the access unit level 579 */ 580 UWORD32 u4_cpb_size_scale; 581 582 /** 583 * (together with bit_rate_scale) specifies the 584 * maximum input bit rate for the i-th CPB 585 */ 586 UWORD32 au4_bit_rate_value_minus1[32]; 587 /** 588 * together with cpb_size_scale to specify the 589 * CPB size when the CPB operates at the access unit level. 590 */ 591 UWORD32 au4_cpb_size_value_minus1[32]; 592 593 /** 594 * if 1, specifies that the HSS operates in a constant bit rate (CBR) mode 595 * if 0, specifies that the HSS operates in a intermittent bit rate (CBR) mode 596 */ 597 UWORD8 au1_cbr_flag[32]; 598 599 600 /** 601 * specifies the length, in bits for initial cpb delay (nal/vcl)syntax in bp sei 602 */ 603 UWORD8 u1_initial_cpb_removal_delay_length_minus1; 604 605 /** 606 * specifies the length, in bits for the cpb delay syntax in pt_sei 607 */ 608 UWORD8 u1_cpb_removal_delay_length_minus1; 609 610 /** 611 * specifies the length, in bits, of the pic_dpb_output_delay syntax element in the pt SEI message 612 */ 613 UWORD8 u1_dpb_output_delay_length_minus1; 614 615 /** 616 * Specifies length of the time offset parameter 617 */ 618 UWORD8 u1_time_offset_length; 619 620 }hrd_params_t; 621 622 623 /** 624 * Structure to hold VUI parameters Info 625 */ 626 typedef struct 627 { 628 /** 629 * indicates the presence of aspect_ratio 630 */ 631 UWORD8 u1_aspect_ratio_info_present_flag; 632 633 /** 634 * specifies the aspect ratio of the luma samples 635 */ 636 UWORD8 u1_aspect_ratio_idc; 637 638 /** 639 * width of the luma samples. user dependent 640 */ 641 UWORD16 u2_sar_width; 642 643 /** 644 * Height of the luma samples. user dependent 645 */ 646 UWORD16 u2_sar_height; 647 648 /** 649 * if 1, specifies that the overscan_appropriate_flag is present 650 * if 0, the preferred display method for the video signal is unspecified 651 */ 652 UWORD8 u1_overscan_info_present_flag; 653 654 /** 655 * if 1,indicates that the cropped decoded pictures output 656 * are suitable for display using overscan 657 */ 658 UWORD8 u1_overscan_appropriate_flag; 659 660 /** 661 * if 1 specifies that video_format, video_full_range_flag and 662 * colour_description_present_flag are present 663 */ 664 UWORD8 u1_video_signal_type_present_flag; 665 666 /** 667 * pal, secam, ntsc, ... 668 */ 669 UWORD8 u1_video_format; 670 671 /** 672 * indicates the black level and range of the luma and chroma signals 673 */ 674 UWORD8 u1_video_full_range_flag; 675 676 /** 677 * if 1,to 1 specifies that colour_primaries, transfer_characteristics 678 * and matrix_coefficients are present 679 */ 680 UWORD8 u1_colour_description_present_flag; 681 682 /** 683 * indicates the chromaticity coordinates of the source primaries 684 */ 685 UWORD8 u1_colour_primaries; 686 687 /** 688 * indicates the opto-electronic transfer characteristic of the source picture 689 */ 690 UWORD8 u1_transfer_characteristics; 691 692 /** 693 * the matrix coefficients used in deriving luma and chroma signals 694 * from the green, blue, and red primaries 695 */ 696 UWORD8 u1_matrix_coefficients; 697 698 /** 699 * if 1, specifies that chroma_sample_loc_type_top_field and 700 * chroma_sample_loc_type_bottom_field are present 701 */ 702 UWORD8 u1_chroma_loc_info_present_flag; 703 704 /** 705 * location of chroma samples 706 */ 707 UWORD8 u1_chroma_sample_loc_type_top_field; 708 709 UWORD8 u1_chroma_sample_loc_type_bottom_field; 710 711 /** 712 * Indicates the presence of the 713 * num_units_in_ticks, time_scale flag 714 */ 715 UWORD8 u1_vui_timing_info_present_flag; 716 717 /** 718 * Number of units that 719 * correspond to one increment of the 720 * clock. Indicates the resolution 721 */ 722 UWORD32 u4_vui_num_units_in_tick; 723 724 /** 725 * The number of time units that pass in one second 726 */ 727 UWORD32 u4_vui_time_scale; 728 729 /** 730 * Flag indicating that time difference between two frames is a constant 731 */ 732 UWORD8 u1_fixed_frame_rate_flag; 733 734 /** 735 * Indicates the presence of NAL HRD parameters 736 */ 737 UWORD8 u1_nal_hrd_parameters_present_flag; 738 739 /** 740 * NAL level HRD parameters 741 */ 742 hrd_params_t s_nal_hrd_parameters; 743 744 /** 745 * Indicates the presence of VCL HRD parameters 746 */ 747 UWORD8 u1_vcl_hrd_parameters_present_flag; 748 749 /** 750 * VCL level HRD parameters 751 */ 752 hrd_params_t s_vcl_hrd_parameters; 753 754 /** 755 * Specifies the HRD operational mode 756 */ 757 UWORD8 u1_low_delay_hrd_flag; 758 759 /** 760 * Indicates presence of SEI messages which include pic_struct syntax element 761 */ 762 UWORD8 u1_pic_struct_present_flag; 763 764 /** 765 * 1, specifies that the following cvs bitstream restriction parameters are present 766 */ 767 UWORD8 u1_bitstream_restriction_flag; 768 769 /** 770 * if 0, indicates that no pel outside the pic boundaries and 771 * no sub-pels derived using pels outside the pic boundaries is used for inter prediction 772 */ 773 UWORD8 u1_motion_vectors_over_pic_boundaries_flag; 774 775 /** 776 * Indicates a number of bytes not exceeded by the sum of the sizes of the VCL NAL units 777 * associated with any coded picture 778 */ 779 UWORD8 u1_max_bytes_per_pic_denom; 780 781 /** 782 * Indicates an upper bound for the number of bits of coding_unit() data 783 */ 784 UWORD8 u1_max_bits_per_mb_denom; 785 786 /** 787 * Indicate the maximum absolute value of a decoded horizontal MV component 788 * in quarter-pel luma units 789 */ 790 UWORD8 u1_log2_max_mv_length_horizontal; 791 792 /** 793 * Indicate the maximum absolute value of a decoded vertical MV component 794 * in quarter-pel luma units 795 */ 796 UWORD8 u1_log2_max_mv_length_vertical; 797 798 /** 799 * Max number of frames that are not synchronized in display and decode order 800 */ 801 UWORD8 u1_num_reorder_frames; 802 803 /** 804 * specifies required size of the HRD DPB in units of frame buffers. 805 */ 806 UWORD8 u1_max_dec_frame_buffering; 807 808 } vui_t; 809 810 811 /** 812 * Structure to hold SPS info 813 */ 814 typedef struct 815 { 816 /** 817 * profile_idc 818 */ 819 UWORD8 u1_profile_idc; 820 821 /** 822 * constraint_set0_flag 823 */ 824 UWORD8 u1_constraint_set0_flag; 825 826 /** 827 * constraint_set1_flag 828 */ 829 UWORD8 u1_constraint_set1_flag; 830 831 /** 832 * constraint_set2_flag 833 */ 834 UWORD8 u1_constraint_set2_flag; 835 836 /** 837 * constraint_set3_flag 838 */ 839 UWORD8 u1_constraint_set3_flag; 840 841 /** 842 * level_idc 843 */ 844 UWORD8 u1_level_idc; 845 846 /** 847 * seq_parameter_set_id 848 */ 849 UWORD8 u1_sps_id; 850 851 852 /** 853 * chroma_format_idc 854 */ 855 UWORD8 u1_chroma_format_idc; 856 857 /** 858 * residual_colour_transform_flag 859 */ 860 WORD8 i1_residual_colour_transform_flag; 861 862 /** 863 * bit_depth_luma_minus8 864 */ 865 WORD8 i1_bit_depth_luma; 866 867 /** 868 * bit_depth_chroma_minus8 869 */ 870 WORD8 i1_bit_depth_chroma; 871 872 /** 873 * qpprime_y_zero_transform_bypass_flag 874 */ 875 WORD8 i1_qpprime_y_zero_transform_bypass_flag; 876 877 /** 878 * seq_scaling_matrix_present_flag 879 */ 880 WORD8 i1_seq_scaling_matrix_present_flag; 881 882 /** 883 * seq_scaling_list_present_flag 884 */ 885 WORD8 ai1_seq_scaling_list_present_flag[8]; 886 887 /** 888 * log2_max_frame_num_minus4 889 */ 890 WORD8 i1_log2_max_frame_num; 891 892 /** 893 * MaxFrameNum in the standard 894 * 1 << i1_log2_max_frame_num 895 */ 896 WORD32 i4_max_frame_num; 897 898 /** 899 * pic_order_cnt_type 900 */ 901 WORD8 i1_pic_order_cnt_type; 902 903 /** 904 * log2_max_pic_order_cnt_lsb_minus4 905 */ 906 WORD8 i1_log2_max_pic_order_cnt_lsb; 907 908 /** 909 * MaxPicOrderCntLsb in the standard. 910 * 1 << log2_max_pic_order_cnt_lsb_minus4 911 */ 912 WORD32 i4_max_pic_order_cnt_lsb; 913 914 /** 915 * delta_pic_order_always_zero_flag 916 */ 917 WORD8 i1_delta_pic_order_always_zero_flag; 918 919 /** 920 * offset_for_non_ref_pic 921 */ 922 WORD32 i4_offset_for_non_ref_pic; 923 924 /** 925 * offset_for_top_to_bottom_field 926 */ 927 WORD32 i4_offset_for_top_to_bottom_field; 928 929 /** 930 * num_ref_frames_in_pic_order_cnt_cycle 931 */ 932 UWORD8 u1_num_ref_frames_in_pic_order_cnt_cycle; 933 934 /** 935 * Offset_for_ref_frame 936 */ 937 WORD32 ai4_offset_for_ref_frame[256]; 938 939 /** 940 * max_num_ref_frames 941 */ 942 UWORD8 u1_max_num_ref_frames; 943 944 /** 945 * gaps_in_frame_num_value_allowed_flag 946 */ 947 WORD8 i1_gaps_in_frame_num_value_allowed_flag; 948 949 /** 950 * pic_width_in_mbs_minus1 951 */ 952 WORD16 i2_pic_width_in_mbs_minus1; 953 954 /** 955 * pic_height_in_map_units_minus1 956 */ 957 WORD16 i2_pic_height_in_map_units_minus1; 958 959 /** 960 * frame_mbs_only_flag 961 */ 962 WORD8 i1_frame_mbs_only_flag; 963 964 /** 965 * mb_adaptive_frame_field_flag 966 */ 967 WORD8 i1_mb_adaptive_frame_field_flag; 968 969 /** 970 * direct_8x8_inference_flag 971 */ 972 WORD8 i1_direct_8x8_inference_flag; 973 974 /** 975 * frame_cropping_flag 976 */ 977 WORD8 i1_frame_cropping_flag; 978 979 /** 980 * frame_crop_left_offset 981 */ 982 WORD16 i2_frame_crop_left_offset; 983 984 /** 985 * frame_crop_right_offset 986 */ 987 WORD16 i2_frame_crop_right_offset; 988 989 /** 990 * frame_crop_top_offset 991 */ 992 WORD16 i2_frame_crop_top_offset; 993 994 /** 995 * frame_crop_bottom_offset 996 */ 997 WORD16 i2_frame_crop_bottom_offset; 998 999 /** 1000 * vui_parameters_present_flag 1001 */ 1002 WORD8 i1_vui_parameters_present_flag; 1003 1004 /** 1005 * vui_parameters_Structure_info 1006 */ 1007 vui_t s_vui_parameters; 1008 1009 /** 1010 * Flag to give status of SPS structure 1011 */ 1012 WORD8 i1_sps_valid; 1013 1014 /** 1015 * Coded Picture width 1016 */ 1017 WORD32 i2_pic_wd; 1018 1019 /** 1020 * Coded Picture height 1021 */ 1022 WORD32 i2_pic_ht; 1023 1024 /** 1025 * Picture width in MB units 1026 */ 1027 1028 WORD16 i2_pic_wd_in_mb; 1029 1030 /** 1031 * Picture height in MB units 1032 */ 1033 1034 WORD16 i2_pic_ht_in_mb; 1035 1036 /** 1037 * useDefaultScalingMatrixFlag 1038 */ 1039 WORD8 ai1_use_default_scaling_matrix_flag[8]; 1040 1041 /** 1042 * 4x4 Scaling lists after inverse zig zag scan 1043 */ 1044 UWORD16 au2_4x4_weight_scale[6][16]; 1045 1046 /** 1047 * 4x4 Scaling lists after inverse zig zag scan 1048 */ 1049 UWORD16 au2_8x8_weight_scale[2][64]; 1050 1051 } sps_t; 1052 1053 1054 /** 1055 * Structure to hold PPS info 1056 */ 1057 typedef struct 1058 { 1059 /** 1060 * pic_parameter_set_id 1061 */ 1062 UWORD8 u1_pps_id; 1063 1064 /** 1065 * seq_parameter_set_id 1066 */ 1067 UWORD8 u1_sps_id; 1068 1069 /** 1070 * Entropy coding : 0-VLC; 1 - CABAC 1071 */ 1072 UWORD8 u1_entropy_coding_mode_flag; 1073 1074 /* 1075 * Pic order present flag 1076 */ 1077 UWORD8 u1_pic_order_present_flag; 1078 1079 /* 1080 * Number of slice groups 1081 */ 1082 UWORD8 u1_num_slice_groups; 1083 1084 /* 1085 * Slice group map type 1086 */ 1087 UWORD8 u1_slice_group_map_type; 1088 1089 /* 1090 * Maximum reference picture index in the reference list 0 : range [0 - 31] 1091 */ 1092 WORD8 i1_num_ref_idx_l0_default_active; 1093 1094 /* 1095 * Maximum reference picture index in the reference list 1 : range [0 - 31] 1096 */ 1097 WORD8 i1_num_ref_idx_l1_default_active; 1098 1099 /** 1100 * weighted_pred_flag 1101 */ 1102 WORD8 i1_weighted_pred_flag; 1103 1104 /** 1105 * weighted_bipred_flag 1106 */ 1107 WORD8 i1_weighted_bipred_idc; 1108 1109 /** 1110 * pic_init_qp_minus26 1111 */ 1112 WORD8 i1_pic_init_qp; 1113 1114 /** 1115 * pic_init_qs_minus26 1116 */ 1117 WORD8 i1_pic_init_qs; 1118 1119 /* 1120 * Chroma QP offset w.r.t QPY {-12,12} 1121 */ 1122 WORD8 i1_chroma_qp_index_offset; 1123 1124 /** 1125 * deblocking_filter_control_present_flag 1126 */ 1127 WORD8 i1_deblocking_filter_control_present_flag; 1128 1129 /** 1130 * constrained_intra_pred_flag 1131 */ 1132 WORD8 i1_constrained_intra_pred_flag; 1133 1134 /** 1135 * redundant_pic_cnt_present_flag 1136 */ 1137 WORD8 i1_redundant_pic_cnt_present_flag; 1138 1139 /** 1140 * transform_8x8_mode_flag 1141 */ 1142 WORD8 i1_transform_8x8_mode_flag; 1143 1144 /** 1145 * pic_scaling_matrix_present_flag 1146 */ 1147 WORD8 i1_pic_scaling_matrix_present_flag; 1148 1149 /* 1150 * Second chroma QP offset 1151 */ 1152 WORD8 i1_second_chroma_qp_index_offset; 1153 1154 1155 /** 1156 * useDefaultScalingMatrixFlag 1157 */ 1158 WORD8 ai1_use_default_scaling_matrix_flag[8]; 1159 1160 /** 1161 * 4x4 Scaling lists after inverse zig zag scan 1162 */ 1163 UWORD16 au2_4x4_weight_scale[6][16]; 1164 1165 /** 1166 * 4x4 Scaling lists after inverse zig zag scan 1167 */ 1168 UWORD16 au2_8x8_weight_scale[2][64]; 1169 1170 1171 /** 1172 * pic_scaling_list_present_flag 1173 */ 1174 WORD8 ai1_pic_scaling_list_present_flag[8]; 1175 1176 /** 1177 * Flag to give status of PPS structure 1178 */ 1179 WORD8 i1_pps_valid; 1180 1181 1182 } pps_t; 1183 1184 /** 1185 * MMCO commands and params. 1186 */ 1187 typedef struct 1188 { 1189 /* 1190 * memory management control operation command 1191 */ 1192 UWORD8 u1_memory_management_control_operation; 1193 1194 /* 1195 * Contains difference of pic nums of short-term pic/frame 1196 * 1. To signal it as "unused for reference" if mmco = 1 1197 * 2. To signal it as "used for long-term reference" if mmco = 3 1198 */ 1199 UWORD32 u4_difference_of_pic_nums_minus1; 1200 1201 /* Long-term pic num to be set as "unused for reference" */ 1202 UWORD8 u1_long_term_pic_num; 1203 1204 /* 1205 * Assign a long-term idx to a picture as follows 1206 * 1. Assign to a short-term pic if mmco = 3 1207 * 2. Assign to the current pic if mmco = 6 1208 */ 1209 UWORD8 u1_long_term_frame_idx; 1210 1211 /* 1212 * The max long-term idx. The long-term pics having idx above 1213 * are set as "unused for reference 1214 */ 1215 UWORD8 u1_max_long_term_frame_idx_plus1; 1216 1217 }mmco_prms_t; 1218 1219 /** 1220 * Structure to hold Reference picture list modification info 1221 */ 1222 typedef struct 1223 { 1224 /* 1225 * ref_pic_list_modification_flag_l0 1226 */ 1227 WORD8 i1_ref_pic_list_modification_flag_l0; 1228 1229 /* 1230 * Modification required in list0 1231 */ 1232 WORD8 i1_modification_of_pic_nums_idc_l0[MAX_MODICATION_IDC]; 1233 1234 /* 1235 * The absolute difference between the picture number of 1236 * the picture being moved to the current index in 1237 * list0 and the picture number prediction value 1238 */ 1239 UWORD32 u4_abs_diff_pic_num_minus1_l0[MAX_MODICATION_IDC]; 1240 1241 /* 1242 * The long-term picture number of the picture being moved 1243 * to the current index in list0 1244 */ 1245 UWORD8 u1_long_term_pic_num_l0[MAX_MODICATION_IDC]; 1246 1247 /* 1248 * ref_pic_list_modification_flag_l1 1249 */ 1250 WORD8 i1_ref_pic_list_modification_flag_l1; 1251 1252 /* 1253 * Modification required in list1 1254 */ 1255 WORD8 i1_modification_of_pic_nums_idc_l1[MAX_MODICATION_IDC]; 1256 1257 /* 1258 * The absolute difference between the picture number of 1259 * the picture being moved to the current index in 1260 * list1 and the picture number prediction value 1261 */ 1262 UWORD32 u4_abs_diff_pic_num_minus1_l1[MAX_MODICATION_IDC]; 1263 1264 /* 1265 * The long-term picture number of the picture being moved 1266 * to the current index in list1 1267 */ 1268 UWORD8 u1_long_term_pic_num_l1[MAX_MODICATION_IDC]; 1269 }rplm_t; 1270 1271 /** 1272 * Structure to hold Slice Header info 1273 */ 1274 typedef struct 1275 { 1276 1277 /* 1278 * nal_unit_type 1279 */ 1280 WORD8 i1_nal_unit_type; 1281 1282 /* 1283 * nal_unit_idc 1284 */ 1285 WORD8 i1_nal_unit_idc; 1286 1287 /* 1288 * first_mb_in_slice 1289 */ 1290 UWORD16 u2_first_mb_in_slice; 1291 1292 /* 1293 * slice_type 1294 */ 1295 UWORD8 u1_slice_type; 1296 1297 /* 1298 * pic_parameter_set_id 1299 */ 1300 UWORD8 u1_pps_id; 1301 1302 /* 1303 * frame_num 1304 */ 1305 WORD32 i4_frame_num; 1306 1307 /* 1308 * field_pic_flag 1309 */ 1310 WORD8 i1_field_pic_flag; 1311 1312 /* 1313 * bottom_field_flag 1314 */ 1315 WORD8 i1_bottom_field_flag; 1316 1317 /* 1318 * second_field 1319 */ 1320 WORD8 i1_second_field_flag; 1321 1322 /* 1323 * idr_pic_id 1324 */ 1325 UWORD16 u2_idr_pic_id ; 1326 1327 /* 1328 * pic_order_cnt_lsb 1329 */ 1330 UWORD16 i4_pic_order_cnt_lsb; 1331 1332 /* 1333 * delta_pic_order_cnt_bottom 1334 */ 1335 WORD32 i4_delta_pic_order_cnt_bottom; 1336 1337 /* 1338 * delta_pic_order_cnt 1339 */ 1340 WORD32 ai4_delta_pic_order_cnt[2]; 1341 1342 /* 1343 * redundant_pic_cnt 1344 */ 1345 UWORD8 u1_redundant_pic_cnt; 1346 1347 /* 1348 * direct_spatial_mv_pred_flag 1349 */ 1350 UWORD8 u1_direct_spatial_mv_pred_flag; 1351 1352 /* 1353 * num_ref_idx_active_override_flag 1354 */ 1355 UWORD8 u1_num_ref_idx_active_override_flag; 1356 1357 /* 1358 * num_ref_idx_l0_active 1359 */ 1360 WORD8 i1_num_ref_idx_l0_active; 1361 1362 /* 1363 * num_ref_idx_l1_active_minus1 1364 */ 1365 WORD8 i1_num_ref_idx_l1_active; 1366 1367 /* 1368 * ref_pic_list_reordering_flag_l0 1369 */ 1370 UWORD8 u1_ref_idx_reordering_flag_l0; 1371 1372 /* 1373 * ref_pic_list_reordering_flag_l1 1374 */ 1375 UWORD8 u1_ref_idx_reordering_flag_l1; 1376 1377 /** 1378 * Reference prediction list modification 1379 */ 1380 rplm_t s_rplm; 1381 1382 /** 1383 * L0 Reference pic lists 1384 */ 1385 ref_list_t as_ref_pic_list0[MAX_DPB_SIZE]; 1386 1387 /** 1388 * L1 Reference pic lists 1389 */ 1390 ref_list_t as_ref_pic_list1[MAX_DPB_SIZE]; 1391 1392 /* 1393 * no_output_of_prior_pics_flag 1394 */ 1395 UWORD8 u1_no_output_of_prior_pics_flag; 1396 1397 /* 1398 * long_term_reference_flag 1399 */ 1400 UWORD8 u1_long_term_reference_flag; 1401 1402 /* 1403 * adaptive_ref_pic_marking_mode_flag 1404 */ 1405 UWORD8 u1_adaptive_ref_pic_marking_mode_flag; 1406 1407 /* 1408 * Array to structures to store mmco commands 1409 * and parameters. 1410 */ 1411 mmco_prms_t as_mmco_prms[MAX_MMCO_COMMANDS]; 1412 1413 /* 1414 * entropy_coding_mode_flag 1415 */ 1416 WORD8 u1_entropy_coding_mode_flag; 1417 1418 /* 1419 * cabac_init_idc 1420 */ 1421 WORD8 i1_cabac_init_idc; 1422 1423 /* 1424 * i1_slice_qp 1425 */ 1426 WORD8 i1_slice_qp; 1427 1428 /* 1429 * sp_for_switch_flag 1430 */ 1431 UWORD8 u1_sp_for_switch_flag; 1432 1433 /* 1434 * slice_qs_delta 1435 */ 1436 UWORD8 u1_slice_qs; 1437 1438 /* 1439 * disable_deblocking_filter_idc 1440 */ 1441 WORD8 u1_disable_deblocking_filter_idc; 1442 1443 /* 1444 * slice_alpha_c0_offset_div2 1445 */ 1446 WORD8 i1_slice_alpha_c0_offset_div2; 1447 1448 /* 1449 * slice_beta_offset_div2 1450 */ 1451 WORD8 i1_slice_beta_offset_div2; 1452 1453 /* 1454 * num_slice_groups_minus1 1455 */ 1456 WORD8 u1_num_slice_groups_minus1; 1457 1458 /* 1459 * slice_group_change_cycle 1460 */ 1461 WORD8 u1_slice_group_change_cycle; 1462 1463 /** 1464 * Start MB X 1465 */ 1466 UWORD16 i2_mb_x; 1467 1468 /** 1469 * Start MB Y 1470 */ 1471 UWORD16 i2_mb_y; 1472 1473 /** 1474 * Absolute POC. Contains minimum of top and bottom POC. 1475 */ 1476 WORD32 i4_abs_pic_order_cnt; 1477 1478 /** 1479 * Absolute top POC. Contains top poc for frame or top 1480 * field. Invalid for bottom field. 1481 */ 1482 WORD32 i4_abs_top_pic_order_cnt; 1483 1484 /** 1485 * Absolute top POC. Contains bottom poc for frame or bottom 1486 * field. Invalid for top field. 1487 */ 1488 WORD32 i4_abs_bottom_pic_order_cnt; 1489 1490 /** 1491 * Flag signaling if the current slice is ref slice 1492 */ 1493 UWORD8 i1_nal_ref_idc; 1494 1495 /** 1496 * Flag to indicate if the current slice is MBAFF Frame 1497 */ 1498 UWORD8 u1_mbaff_frame_flag; 1499 1500 /** 1501 * luma_log2_weight_denom 1502 */ 1503 UWORD8 u1_luma_log2_weight_denom; 1504 1505 /** 1506 * chroma_log2_weight_denom 1507 */ 1508 UWORD8 u1_chroma_log2_weight_denom; 1509 1510 /** 1511 * luma_weight_l0_flag 1512 */ 1513 UWORD8 au1_luma_weight_l0_flag[MAX_DPB_SIZE]; 1514 1515 /** 1516 * luma_weight_l0 : (-128, 127 )is the range of weights 1517 * when weighted pred is enabled, 128 is default value 1518 */ 1519 WORD16 ai2_luma_weight_l0[MAX_DPB_SIZE]; 1520 1521 /** 1522 * luma_offset_l0 : (-128, 127 )is the range of offset 1523 * when weighted pred is enabled, 0 is default value 1524 */ 1525 WORD8 ai1_luma_offset_l0[MAX_DPB_SIZE]; 1526 1527 /** 1528 * chroma_weight_l0_flag 1529 */ 1530 UWORD8 au1_chroma_weight_l0_flag[MAX_DPB_SIZE]; 1531 1532 /** 1533 * chroma_weight_l0 : (-128, 127 )is the range of weights 1534 * when weighted pred is enabled, 128 is default value 1535 */ 1536 WORD16 ai2_chroma_weight_l0[MAX_DPB_SIZE][2]; 1537 1538 /** 1539 * chroma_offset_l0 : (-128, 127 )is the range of offset 1540 * when weighted pred is enabled, 0 is default value 1541 */ 1542 WORD8 ai1_chroma_offset_l0[MAX_DPB_SIZE][2]; 1543 1544 /** 1545 * luma_weight_l0_flag 1546 */ 1547 UWORD8 au1_luma_weight_l1_flag[MAX_DPB_SIZE]; 1548 1549 /** 1550 * luma_weight_l1 : (-128, 127 )is the range of weights 1551 * when weighted pred is enabled, 128 is default value 1552 */ 1553 WORD16 ai2_luma_weight_l1[MAX_DPB_SIZE]; 1554 1555 /** 1556 * luma_offset_l1 : (-128, 127 )is the range of offset 1557 * when weighted pred is enabled, 0 is default value 1558 */ 1559 WORD8 ai1_luma_offset_l1[MAX_DPB_SIZE]; 1560 1561 /** 1562 * chroma_weight_l1_flag 1563 */ 1564 UWORD8 au1_chroma_weight_l1_flag[MAX_DPB_SIZE]; 1565 1566 /** 1567 * chroma_weight_l1 : (-128, 127 )is the range of weights 1568 * when weighted pred is enabled, 128 is default value 1569 */ 1570 WORD16 ai2_chroma_weight_l1[MAX_DPB_SIZE][2]; 1571 1572 /** 1573 * chroma_offset_l1 :(-128, 127 )is the range of offset 1574 * when weighted pred is enabled, 0 is default value 1575 */ 1576 WORD8 ai1_chroma_offset_l1[MAX_DPB_SIZE][2]; 1577 }slice_header_t; 1578 1579 1580 /*****************************************************************************/ 1581 /* The following can be used to type cast coefficient data that is stored */ 1582 /* per subblock. Note that though i2_level is shown as an array that */ 1583 /* holds 16 coefficients, only the first few entries will be valid. Next */ 1584 /* subblocks data starts after the valid number of coefficients. Number */ 1585 /* of non-zero coefficients will be derived using number of non-zero bits */ 1586 /* in sig coeff map */ 1587 /*****************************************************************************/ 1588 1589 /** 1590 * Structure to hold coefficient info for a 2x2 chroma DC transform 1591 */ 1592 typedef struct 1593 { 1594 /** 1595 * significant coefficient map 1596 */ 1597 UWORD8 u1_sig_coeff_map; 1598 1599 /** 1600 * sub block position 1601 */ 1602 UWORD8 u1_subblk_pos; 1603 1604 /** 1605 * holds coefficients 1606 */ 1607 WORD16 ai2_level[2 * 2]; 1608 }tu_sblk2x2_coeff_data_t; 1609 1610 /** 1611 * Structure to hold coefficient info for a 4x4 transform 1612 */ 1613 typedef struct 1614 { 1615 /** 1616 * significant coefficient map 1617 */ 1618 UWORD16 u2_sig_coeff_map; 1619 1620 /** 1621 * sub block position 1622 */ 1623 UWORD16 u2_subblk_pos; 1624 1625 /** 1626 * holds coefficients 1627 */ 1628 WORD16 ai2_level[SUBBLK_COEFF_CNT]; 1629 }tu_sblk4x4_coeff_data_t; 1630 1631 /** 1632 * Structure to hold coefficient info for a 8x8 transform 1633 */ 1634 typedef struct 1635 { 1636 1637 /** 1638 * significant coefficient map 1639 */ 1640 UWORD32 au4_sig_coeff_map[2]; 1641 1642 /** 1643 * sub block position 1644 */ 1645 UWORD16 u2_subblk_pos; 1646 1647 /** 1648 * holds coefficients 1649 */ 1650 WORD16 ai2_level[TRANS_SIZE_8 * TRANS_SIZE_8]; 1651 }tu_blk8x8_coeff_data_t; 1652 1653 1654 /** 1655 * Structure to hold coefficient info for a 16x16 IPCM MB 1656 */ 1657 typedef struct 1658 { 1659 /** 1660 * holds coefficients 1661 */ 1662 UWORD8 au1_level[MB_SIZE * MB_SIZE * 3 / 2]; 1663 }tu_ipcm_coeff_data_t; 1664 1665 1666 typedef struct 1667 { 1668 /** 1669 * Transform sizes 0: 4x4, 1: 8x8, 1670 */ 1671 UWORD32 b1_trans_size : 1; 1672 1673 /** 1674 * Flag to signal if the current MB is IPCM 1675 */ 1676 UWORD32 b1_ipcm : 1; 1677 1678 /** 1679 * Intra pred sizes 0: 4x4, 1: 8x8, 2: 16x16 1680 */ 1681 UWORD32 b2_intra_pred_size : 2; 1682 1683 /** 1684 * Chroma intra mode 1685 */ 1686 UWORD32 b2_intra_chroma_pred_mode: 2; 1687 1688 /** 1689 * Number of coded subblocks in the current MB, for which 1690 * tu data is sent. Maximum of 27 subblocks in the following 1691 * order. 1692 * 1 4x4 luma DC(for intra16x16), 1693 * 16 4x4 luma, 1694 * 2 2x2 chroma DC, 1695 * 8 4x4 chroma, 1696 */ 1697 WORD32 b5_num_coded_sblks: 5; 1698 1699 /** 1700 * Flag to signal if 4x4 subblock for DC values (in INTRA 16x16 MB) 1701 * is coded 1702 */ 1703 UWORD32 b1_luma_dc_coded: 1; 1704 1705 /** 1706 * Flag to signal if 4x4 subblock for DC values (in INTRA 16x16 MB) 1707 * is coded 1708 */ 1709 UWORD32 b1_chroma_dc_coded: 1; 1710 1711 /** 1712 * CSBP - 16 bits, 1 bit for each 4x4 1713 * for intra16x16 mb_type only ac coefficients are 1714 */ 1715 UWORD32 b16_luma_csbp: 16; 1716 1717 /** 1718 * CSBP - 16 bits, 1 bit for each 4x4 1719 * for intra16x16 mb_type only ac coefficients are 1720 */ 1721 UWORD32 b8_chroma_csbp: 8; 1722 1723 /** 1724 * Luma Intra pred modes, 1725 * Based on intra pred size either 16, 4 or 1 entry will be 1726 * populated below. 1727 */ 1728 UWORD8 au1_luma_intra_modes[16]; 1729 1730 }intra_mb_t; 1731 1732 1733 typedef struct 1734 { 1735 /** 1736 * Transform sizes 0: 4x4, 1: 8x8, 1737 */ 1738 UWORD8 b1_trans_size : 1; 1739 1740 1741 /** 1742 * Skip flag 1743 */ 1744 UWORD8 b1_skip : 1; 1745 1746 1747 /** 1748 * Number of coded subblocks in the current MB, for which 1749 * tu data is sent. Maximum of 26 subblocks in the following 1750 * order. 1751 * 16 4x4 luma, 1752 * 2 2x2 chroma DC, 1753 * 8 4x4 chroma, 1754 */ 1755 WORD32 b5_num_coded_sblks: 5; 1756 1757 /** 1758 * CSBP - 16 bits, 1 bit for each 4x4 1759 * for intra16x16 mb_type only ac coefficients are 1760 */ 1761 UWORD32 b16_luma_csbp: 16; 1762 1763 /** 1764 * CSBP - 16 bits, 1 bit for each 4x4 1765 * for intra16x16 mb_type only ac coefficients are 1766 */ 1767 UWORD32 b16_chroma_csbp: 8; 1768 }inter_mb_t; 1769 1770 /** 1771 * Structure to hold Mastering Display Color Volume SEI 1772 */ 1773 typedef struct 1774 { 1775 /** 1776 * Array to store the display_primaries_x values 1777 */ 1778 UWORD16 au2_display_primaries_x[NUM_SEI_MDCV_PRIMARIES]; 1779 1780 /** 1781 * Array to store the display_primaries_y values 1782 */ 1783 UWORD16 au2_display_primaries_y[NUM_SEI_MDCV_PRIMARIES]; 1784 1785 /** 1786 * Variable to store the white point x value 1787 */ 1788 UWORD16 u2_white_point_x; 1789 1790 /** 1791 * Variable to store the white point y value 1792 */ 1793 UWORD16 u2_white_point_y; 1794 1795 /** 1796 * Variable to store the max display mastering luminance value 1797 */ 1798 UWORD32 u4_max_display_mastering_luminance; 1799 1800 /** 1801 * Variable to store the min display mastering luminance value 1802 */ 1803 UWORD32 u4_min_display_mastering_luminance; 1804 }sei_mdcv_params_t; 1805 1806 1807 /** 1808 * Structure for Content Light Level Info 1809 * 1810 */ 1811 typedef struct 1812 { 1813 /** 1814 * The maximum pixel intensity of all samples 1815 */ 1816 UWORD16 u2_max_content_light_level; 1817 1818 /** 1819 * The average pixel intensity of all samples 1820 */ 1821 UWORD16 u2_max_pic_average_light_level; 1822 }sei_cll_params_t; 1823 1824 1825 /** 1826 * Structure to hold Ambient viewing environment SEI 1827 */ 1828 typedef struct 1829 { 1830 /** 1831 * specifies the environmental illluminance of the ambient viewing environment 1832 */ 1833 UWORD32 u4_ambient_illuminance; 1834 1835 /* 1836 * specify the normalized x chromaticity coordinates of the 1837 * environmental ambient light in the nominal viewing environment 1838 */ 1839 UWORD16 u2_ambient_light_x; 1840 1841 /* 1842 * specify the normalized y chromaticity coordinates of the 1843 * environmental ambient light in the nominal viewing environment 1844 */ 1845 UWORD16 u2_ambient_light_y; 1846 }sei_ave_params_t; 1847 1848 1849 /** 1850 * Structure to hold Content color volume SEI 1851 */ 1852 typedef struct 1853 { 1854 /* 1855 * Flag used to control persistence of CCV SEI messages 1856 */ 1857 UWORD8 u1_ccv_cancel_flag; 1858 1859 /* 1860 * specifies the persistence of the CCV SEI message for the current layer 1861 */ 1862 UWORD8 u1_ccv_persistence_flag; 1863 1864 /* 1865 * specifies the presence of syntax elements ccv_primaries_x and ccv_primaries_y 1866 */ 1867 UWORD8 u1_ccv_primaries_present_flag; 1868 1869 /* 1870 * specifies that the syntax element ccv_min_luminance_value is present 1871 */ 1872 UWORD8 u1_ccv_min_luminance_value_present_flag; 1873 1874 /* 1875 * specifies that the syntax element ccv_max_luminance_value is present 1876 */ 1877 UWORD8 u1_ccv_max_luminance_value_present_flag; 1878 1879 /* 1880 * specifies that the syntax element ccv_avg_luminance_value is present 1881 */ 1882 UWORD8 u1_ccv_avg_luminance_value_present_flag; 1883 1884 /* 1885 * shall be equal to 0 in bitstreams conforming to this version. Other values 1886 * for reserved_zero_2bits are reserved for future use 1887 */ 1888 UWORD8 u1_ccv_reserved_zero_2bits; 1889 1890 /* 1891 * specify the normalized x chromaticity coordinates of the colour 1892 * primary component c of the nominal content colour volume 1893 */ 1894 WORD32 ai4_ccv_primaries_x[NUM_SEI_CCV_PRIMARIES]; 1895 1896 /* 1897 * specify the normalized y chromaticity coordinates of the colour 1898 * primary component c of the nominal content colour volume 1899 */ 1900 WORD32 ai4_ccv_primaries_y[NUM_SEI_CCV_PRIMARIES]; 1901 1902 /* 1903 * specifies the normalized minimum luminance value 1904 */ 1905 UWORD32 u4_ccv_min_luminance_value; 1906 1907 /* 1908 * specifies the normalized maximum luminance value 1909 */ 1910 UWORD32 u4_ccv_max_luminance_value; 1911 1912 /* 1913 * specifies the normalized average luminance value 1914 */ 1915 UWORD32 u4_ccv_avg_luminance_value; 1916 }sei_ccv_params_t; 1917 1918 /** 1919 * Structure to hold FGC SEI 1920 */ 1921 typedef struct 1922 { 1923 /** 1924 * Flag to control the presence of FGC SEI params 1925 */ 1926 UWORD8 u1_film_grain_characteristics_cancel_flag; 1927 1928 /** 1929 * Specifies the pic order count 1930 */ 1931 WORD32 i4_poc; 1932 1933 /** 1934 * Specifies IDR pic ID 1935 */ 1936 UWORD32 u4_idr_pic_id; 1937 1938 /** 1939 * Specifies film grain model for simulation 1940 */ 1941 UWORD8 u1_film_grain_model_id; 1942 1943 /** 1944 * Specifies separate color format for decoded samples and grain 1945 */ 1946 UWORD8 u1_separate_colour_description_present_flag; 1947 1948 /** 1949 * Specifies the bit depth used for the luma component 1950 */ 1951 UWORD8 u1_film_grain_bit_depth_luma_minus8; 1952 1953 /** 1954 * Specifies the bit depth used for the Cb and Cr components 1955 */ 1956 UWORD8 u1_film_grain_bit_depth_chroma_minus8; 1957 1958 /** 1959 * Specifies the colour space of the FGC in SEI 1960 */ 1961 UWORD8 u1_film_grain_full_range_flag; 1962 1963 /** 1964 * Specifies the colour space of the FGC in SEI 1965 */ 1966 UWORD8 u1_film_grain_colour_primaries; 1967 1968 /** 1969 * Specifies the colour space of the FGC in SEI 1970 */ 1971 UWORD8 u1_film_grain_transfer_characteristics; 1972 1973 /** 1974 * Specifies the colour space of the FGC in SEI 1975 */ 1976 UWORD8 u1_film_grain_matrix_coefficients; 1977 1978 /** 1979 * identifies the blending mode used to blend the simulated film grain with the decoded images 1980 */ 1981 UWORD8 u1_blending_mode_id; 1982 1983 /** 1984 * Specifies a scale factor used in the film grain characterization equations 1985 */ 1986 UWORD8 u1_log2_scale_factor; 1987 1988 /** 1989 * Indicates whether film grain is modelled or not on the colour component 1990 */ 1991 UWORD8 au1_comp_model_present_flag[SEI_FGC_NUM_COLOUR_COMPONENTS]; 1992 1993 /** 1994 * Specifies the number of intensity intervals for which 1995 * a specific set of model values has been estimated 1996 */ 1997 UWORD8 au1_num_intensity_intervals_minus1[SEI_FGC_NUM_COLOUR_COMPONENTS]; 1998 1999 /** 2000 * Specifies the number of model values present for each intensity interval in which 2001 * the film grain has been modelled 2002 */ 2003 UWORD8 au1_num_model_values_minus1[SEI_FGC_NUM_COLOUR_COMPONENTS]; 2004 2005 /** 2006 * Specifies the lower bound of the interval of intensity levels for which 2007 * the set of model values applies 2008 */ 2009 UWORD8 au1_intensity_interval_lower_bound[SEI_FGC_NUM_COLOUR_COMPONENTS] 2010 [SEI_FGC_MAX_NUM_INTENSITY_INTERVALS]; 2011 2012 /** 2013 * Specifies the upper bound of the interval of intensity levels for which 2014 * the set of model values applies 2015 */ 2016 UWORD8 au1_intensity_interval_upper_bound[SEI_FGC_NUM_COLOUR_COMPONENTS] 2017 [SEI_FGC_MAX_NUM_INTENSITY_INTERVALS]; 2018 2019 /** 2020 * Represents each one of the model values present for 2021 * the colour component and intensity interval 2022 */ 2023 WORD32 ai4_comp_model_value[SEI_FGC_NUM_COLOUR_COMPONENTS][SEI_FGC_MAX_NUM_INTENSITY_INTERVALS] 2024 [SEI_FGC_MAX_NUM_MODEL_VALUES]; 2025 2026 /** 2027 * Specifies the persistence of the film grain characteristics SEI message 2028 */ 2029 UWORD32 u4_film_grain_characteristics_repetition_period; 2030 2031 } sei_fgc_params_t; 2032 2033 /** 2034 * Structure to hold shutter interval info SEI 2035 */ 2036 typedef struct 2037 { 2038 /** 2039 * specifies if the sei sii is enabled 2040 */ 2041 UWORD8 u1_shutter_interval_info_present_flag; 2042 2043 /** 2044 * specifies the shutter interval temporal sub-layer index 2045 * of the current picture 2046 */ 2047 UWORD32 u4_sii_sub_layer_idx; 2048 2049 /** 2050 * specify the number of time units that pass in one second 2051 */ 2052 UWORD32 u4_sii_time_scale; 2053 2054 /** 2055 * specifies that the indicated shutter interval is the same for all 2056 * pictures in the coded video sequence 2057 */ 2058 UWORD8 u1_fixed_shutter_interval_within_cvs_flag; 2059 2060 /** 2061 * specifies the the number of time units of a clock operating at the 2062 * frequency sii_time_scale Hz that corresponds to the indicated shutter 2063 * interval of each picture in the coded video sequence 2064 */ 2065 UWORD32 u4_sii_num_units_in_shutter_interval; 2066 2067 /** 2068 * sii_max_sub_layers_minus1 plus 1 specifies the maximum number of 2069 * shutter interval temporal sub-layers indexes that may be present 2070 * in the coded video sequence 2071 */ 2072 UWORD8 u1_sii_max_sub_layers_minus1; 2073 2074 /* 2075 * specifies the number of time units of a clock operating at the 2076 * frequency sii_time_scale Hz that corresponds to the shutter 2077 * interval of each picture in the coded video sequence 2078 */ 2079 UWORD32 au4_sub_layer_num_units_in_shutter_interval[SII_MAX_SUB_LAYERS]; 2080 } sei_sii_params_t; 2081 2082 /** 2083 * Structure to hold SEI parameters Info 2084 */ 2085 typedef struct 2086 { 2087 /** 2088 * mastering display color volume info present flag 2089 */ 2090 UWORD8 u1_sei_mdcv_params_present_flag; 2091 2092 /* 2093 * MDCV parameters 2094 */ 2095 sei_mdcv_params_t s_sei_mdcv_params; 2096 2097 /** 2098 * content light level info present flag 2099 */ 2100 UWORD8 u1_sei_cll_params_present_flag; 2101 2102 /* 2103 * CLL parameters 2104 */ 2105 sei_cll_params_t s_sei_cll_params; 2106 2107 /** 2108 * ambient viewing environment info present flag 2109 */ 2110 UWORD8 u1_sei_ave_params_present_flag; 2111 2112 /* 2113 * AVE parameters 2114 */ 2115 sei_ave_params_t s_sei_ave_params; 2116 2117 /** 2118 * content color volume info present flag 2119 */ 2120 UWORD8 u1_sei_ccv_params_present_flag; 2121 2122 /* 2123 * CCV parameters 2124 */ 2125 sei_ccv_params_t s_sei_ccv_params; 2126 2127 /** 2128 * film grain characteristics info present flag 2129 */ 2130 UWORD8 u1_sei_fgc_params_present_flag; 2131 2132 /* 2133 * Film grain parameters 2134 */ 2135 sei_fgc_params_t s_sei_fgc_params; 2136 2137 /** 2138 * shutter interval info present flag 2139 */ 2140 UWORD8 u1_sei_sii_params_present_flag; 2141 2142 /* 2143 * Shutter Interval Info parameters 2144 */ 2145 sei_sii_params_t s_sei_sii_params; 2146 } sei_params_t; 2147 2148 2149 #endif /* _IH264_STRUCTS_H_ */ 2150