1 /****************************************************************************** 2 * 3 * Copyright (C) 2022 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 * isvce_structs.h 25 * 26 * @brief 27 * Contains struct definition used for SVC encoding 28 * 29 * @author 30 * ittiam 31 * 32 * @remarks 33 * None 34 * 35 ******************************************************************************* 36 */ 37 38 #ifndef _ISVCE_STRUCTS_H_ 39 #define _ISVCE_STRUCTS_H_ 40 41 #include "ih264_typedefs.h" 42 #include "iv2.h" 43 #include "ive2.h" 44 #include "ih264_defs.h" 45 #include "ih264_deblk_edge_filters.h" 46 #include "isvc_inter_pred_filters.h" 47 #include "ithread.h" 48 #include "isvc_defs.h" 49 #include "isvc_mem_fns.h" 50 #include "isvc_cabac_tables.h" 51 #include "isvc_trans_quant_itrans_iquant.h" 52 53 /* Dependencies of ime_structs.h */ 54 #include "ime_defs.h" 55 #include "ime_distortion_metrics.h" 56 57 /* Dependencies of ih264e_cabac_structs.h */ 58 #include "ih264_cabac_tables.h" 59 60 /* Dependencies of ih264e_structs.h */ 61 #include "ih264e_error.h" 62 #include "ih264_trans_quant_itrans_iquant.h" 63 #include "ih264_inter_pred_filters.h" 64 #include "ih264e_bitstream.h" 65 #include "ih264e_cabac_structs.h" 66 #include "ih264e_defs.h" 67 #include "ime_structs.h" 68 69 /* Dependencies of 'irc_picture_type.h' */ 70 #include "irc_cntrl_param.h" 71 #include "irc_frame_info_collector.h" 72 #include "irc_mem_req_and_acq.h" 73 74 /* Dependencies of 'irc_rate_control_api_structs' */ 75 #include "irc_picture_type.h" 76 #include "irc_rd_model.h" 77 #include "irc_vbr_storage_vbv.h" 78 #include "irc_est_sad.h" 79 #include "irc_bit_allocation.h" 80 #include "irc_mb_model_based.h" 81 #include "irc_cbr_buffer_control.h" 82 #include "irc_vbr_str_prms.h" 83 #include "irc_common.h" 84 #include "irc_rate_control_api_structs.h" 85 86 #include "ih264e_structs.h" 87 #include "isvce_cabac_structs.h" 88 #include "isvce_defs.h" 89 #include "isvce_downscaler.h" 90 #include "isvce_interface_structs.h" 91 #include "isvce_nalu_stat_aggregator.h" 92 #include "isvce_pred_structs.h" 93 #include "isvce_rc_utils.h" 94 95 typedef struct svc_params_t 96 { 97 /** 98 * Num Temporal Layers 99 */ 100 UWORD8 u1_num_temporal_layers; 101 102 /** 103 * Num Spatial Layers 104 */ 105 UWORD8 u1_num_spatial_layers; 106 107 /** 108 * Resolution ration b/w spatial layers 109 */ 110 DOUBLE d_spatial_res_ratio; 111 112 } svc_params_t; 113 114 typedef struct svc_layer_data_t 115 { 116 /** 117 * Array of structs that contain mode_info per MB for every MB per layer 118 */ 119 isvce_mb_info_t *ps_mb_info; 120 121 UWORD32 *pu4_num_pus_in_mb; 122 123 } svc_layer_data_t; 124 125 typedef struct svc_au_data_t 126 { 127 /** 128 * Array of structs that contain layer-wise data used for svc prediction 129 */ 130 svc_layer_data_t *ps_svc_layer_data; 131 132 /** 133 * Absolute POC for the current MV Bank 134 */ 135 WORD32 i4_abs_poc; 136 137 /** 138 * Buffer Id 139 */ 140 WORD32 i4_buf_id; 141 142 } svc_au_data_t; 143 144 typedef struct isvce_inp_buf_t 145 { 146 /* App's buffer */ 147 isvce_raw_inp_buf_t s_inp_props; 148 149 /* A copy of SVC parameters */ 150 svc_params_t s_svc_params; 151 152 /** 153 * Array of structs that contain properties of the buffers used for storing 154 * layer-wise YUV data 155 */ 156 yuv_buf_props_t as_layer_yuv_buf_props[MAX_NUM_SPATIAL_LAYERS]; 157 158 } isvce_inp_buf_t; 159 160 typedef struct mb_intra_modes_t 161 { 162 UWORD8 au1_intra_modes[MAX_PU_IN_MB]; 163 } mb_intra_modes_t; 164 165 typedef struct nbr_info_t 166 { 167 isvce_mb_info_t *ps_top_row_mb_info; 168 169 isvce_mb_info_t *ps_left_mb_info; 170 171 mb_intra_modes_t *ps_top_mb_intra_modes; 172 173 mb_intra_modes_t *ps_left_mb_intra_modes; 174 175 } nbr_info_t; 176 177 typedef struct svc_nbr_info_t 178 { 179 /** 180 * Array of structs that contain properties of the buffers used for storing 181 * layer-wise neighbour info 182 */ 183 nbr_info_t *ps_layer_nbr_info; 184 } svc_nbr_info_t; 185 186 typedef struct layer_resampler_props_t 187 { 188 UWORD32 u4_shift_x; 189 190 UWORD32 u4_shift_y; 191 192 UWORD32 u4_scale_x; 193 194 UWORD32 u4_scale_y; 195 196 WORD32 i4_offset_x; 197 198 WORD32 i4_offset_y; 199 200 WORD32 i4_add_x; 201 202 WORD32 i4_add_y; 203 204 WORD32 i4_delta_x; 205 206 WORD32 i4_delta_y; 207 208 WORD32 i4_refphase_x; 209 210 WORD32 i4_refphase_y; 211 212 WORD32 i4_phase_x; 213 214 WORD32 i4_phase_y; 215 216 UWORD32 u4_sub_wd; 217 218 UWORD32 u4_sub_ht; 219 220 UWORD32 u4_mb_wd; 221 222 UWORD32 u4_mb_ht; 223 224 } layer_resampler_props_t; 225 226 typedef struct svc_ilp_data_t 227 { 228 /* Pointer to current AU buf */ 229 svc_au_data_t *ps_svc_au_data; 230 231 /* Array of bufs corresponding to numSpatialLayers */ 232 layer_resampler_props_t *aps_layer_resampler_props[NUM_SP_COMPONENTS]; 233 234 /* Array of bufs corresponding to numSpatialLayers */ 235 yuv_buf_props_t *ps_intra_recon_bufs; 236 237 /* Array of bufs corresponding to numSpatialLayers */ 238 yuv_buf_props_t *ps_residual_bufs; 239 } svc_ilp_data_t; 240 241 typedef struct ilp_mv_t 242 { 243 isvce_enc_pu_mv_t as_mv[ENC_MAX_PU_IN_MB][NUM_PRED_DIRS]; 244 245 MBTYPES_T e_mb_type; 246 247 PRED_MODE_T ae_pred_mode[ENC_MAX_PU_IN_MB]; 248 } ilp_mv_t; 249 250 typedef struct ilp_me_cands_t 251 { 252 isvce_enc_pu_mv_t as_mv[MAX_PU_IN_MB + MAX_ILP_MV_IN_NBR_RGN][NUM_PRED_DIRS]; 253 254 MBTYPES_T e_mb_type[MAX_PU_IN_MB + MAX_ILP_MV_IN_NBR_RGN]; 255 256 PRED_MODE_T ae_pred_mode[MAX_PU_IN_MB + MAX_ILP_MV_IN_NBR_RGN]; 257 258 UWORD32 u4_num_ilp_mvs; 259 260 UWORD32 u4_num_ilp_mvs_incl_nbrs; 261 } ilp_me_cands_t; 262 263 typedef struct isvce_cfg_params_t 264 { 265 /** maximum width for which codec should request memory requirements */ 266 UWORD32 u4_max_wd; 267 268 /** maximum height for which codec should request memory requirements */ 269 UWORD32 u4_max_ht; 270 271 /** Maximum number of reference frames */ 272 UWORD32 u4_max_ref_cnt; 273 274 /** Maximum number of reorder frames */ 275 UWORD32 u4_max_reorder_cnt; 276 277 /** Maximum level supported */ 278 UWORD32 u4_max_level; 279 280 /** Input color format */ 281 IV_COLOR_FORMAT_T e_inp_color_fmt; 282 283 /** Flag to enable/disable - To be used only for debugging/testing */ 284 UWORD32 u4_enable_recon; 285 286 /** Recon color format */ 287 IV_COLOR_FORMAT_T e_recon_color_fmt; 288 289 /** Encoder Speed preset - Value between 0 (slowest) and 100 (fastest) */ 290 IVE_SPEED_CONFIG u4_enc_speed_preset; 291 292 /** Rate control mode */ 293 IVE_RC_MODE_T e_rc_mode; 294 295 /** Maximum frame rate to be supported */ 296 UWORD32 u4_max_framerate; 297 298 /** Maximum bitrate to be supported */ 299 UWORD32 au4_max_bitrate[MAX_NUM_SPATIAL_LAYERS]; 300 301 /** Maximum number of consecutive B frames */ 302 UWORD32 u4_num_bframes; 303 304 /** Content type Interlaced/Progressive */ 305 IV_CONTENT_TYPE_T e_content_type; 306 307 /** Maximum search range to be used in X direction */ 308 UWORD32 u4_max_srch_rng_x; 309 310 /** Maximum search range to be used in Y direction */ 311 UWORD32 u4_max_srch_rng_y; 312 313 /** Slice Mode */ 314 IVE_SLICE_MODE_T e_slice_mode; 315 316 /** Slice parameter */ 317 UWORD32 u4_slice_param; 318 319 /** Processor architecture */ 320 IV_ARCH_T e_arch; 321 322 /** SOC details */ 323 IV_SOC_T e_soc; 324 325 /** Input width to be sent in bitstream */ 326 UWORD32 u4_disp_wd; 327 328 /** Input height to be sent in bitstream */ 329 UWORD32 u4_disp_ht; 330 331 /** Input width */ 332 UWORD32 u4_wd; 333 334 /** Input height */ 335 UWORD32 u4_ht; 336 337 /** Input stride */ 338 UWORD32 u4_strd; 339 340 /** Source frame rate */ 341 UWORD32 u4_src_frame_rate; 342 343 /** Target frame rate */ 344 UWORD32 u4_tgt_frame_rate; 345 346 /** Target bitrate in kilobits per second */ 347 UWORD32 au4_target_bitrate[MAX_NUM_SPATIAL_LAYERS]; 348 349 /** Force current frame type */ 350 IV_PICTURE_CODING_TYPE_T e_frame_type; 351 352 /** Encoder mode */ 353 IVE_ENC_MODE_T e_enc_mode; 354 355 /** Set initial Qp for I pictures */ 356 UWORD32 au4_i_qp[MAX_NUM_SPATIAL_LAYERS]; 357 358 /** Set initial Qp for P pictures */ 359 UWORD32 au4_p_qp[MAX_NUM_SPATIAL_LAYERS]; 360 361 /** Set initial Qp for B pictures */ 362 UWORD32 au4_b_qp[MAX_NUM_SPATIAL_LAYERS]; 363 364 /** Set minimum Qp for I pictures */ 365 UWORD32 au4_i_qp_min[MAX_NUM_SPATIAL_LAYERS]; 366 367 /** Set maximum Qp for I pictures */ 368 UWORD32 au4_i_qp_max[MAX_NUM_SPATIAL_LAYERS]; 369 370 /** Set minimum Qp for P pictures */ 371 UWORD32 au4_p_qp_min[MAX_NUM_SPATIAL_LAYERS]; 372 373 /** Set maximum Qp for P pictures */ 374 UWORD32 au4_p_qp_max[MAX_NUM_SPATIAL_LAYERS]; 375 376 /** Set minimum Qp for B pictures */ 377 UWORD32 au4_b_qp_min[MAX_NUM_SPATIAL_LAYERS]; 378 379 /** Set maximum Qp for B pictures */ 380 UWORD32 au4_b_qp_max[MAX_NUM_SPATIAL_LAYERS]; 381 382 /** Adaptive intra refresh mode */ 383 IVE_AIR_MODE_T e_air_mode; 384 385 /** Adaptive intra refresh period in frames */ 386 UWORD32 u4_air_refresh_period; 387 388 /** VBV buffer delay */ 389 UWORD32 au4_vbv_buffer_delay[MAX_NUM_SPATIAL_LAYERS]; 390 391 /** Number of cores to be used */ 392 UWORD32 u4_num_cores; 393 394 /** ME speed preset - Value between 0 (slowest) and 100 (fastest) */ 395 UWORD32 u4_me_speed_preset; 396 397 /** Flag to enable/disable half pel motion estimation */ 398 UWORD32 u4_enable_hpel; 399 400 /** Flag to enable/disable quarter pel motion estimation */ 401 UWORD32 u4_enable_qpel; 402 403 /** Flag to enable/disable intra 4x4 analysis */ 404 UWORD32 u4_enable_intra_4x4; 405 406 /** Flag to enable/disable intra 8x8 analysis */ 407 UWORD32 u4_enable_intra_8x8; 408 409 /** Flag to enable/disable intra 16x16 analysis */ 410 UWORD32 u4_enable_intra_16x16; 411 412 /** Flag to enable/disable fast SAD approximation */ 413 UWORD32 u4_enable_fast_sad; 414 415 /*flag to enable/disable alternate reference frames */ 416 UWORD32 u4_enable_alt_ref; 417 418 /*Flag to enable/disable computation of SATDQ in ME*/ 419 UWORD32 u4_enable_satqd; 420 421 /*Minimum SAD to search for*/ 422 WORD32 i4_min_sad; 423 424 /** Maximum search range in X direction for farthest reference */ 425 UWORD32 u4_srch_rng_x; 426 427 /** Maximum search range in Y direction for farthest reference */ 428 UWORD32 u4_srch_rng_y; 429 430 /** I frame interval */ 431 UWORD32 u4_i_frm_interval; 432 433 /** IDR frame interval */ 434 UWORD32 u4_idr_frm_interval; 435 436 /** Disable deblock level (0: Enable completely, 3: Disable completely */ 437 UWORD32 u4_disable_deblock_level; 438 439 /** Profile */ 440 IV_PROFILE_T e_profile; 441 442 /** Lower 32bits of time stamp corresponding to input buffer, 443 * from which this command takes effect */ 444 UWORD32 u4_timestamp_low; 445 446 /** Upper 32bits of time stamp corresponding to input buffer, 447 * from which this command takes effect */ 448 UWORD32 u4_timestamp_high; 449 450 /** Flag to say if the current config parameter set is valid 451 * Will be zero to start with and will be set to 1, when configured 452 * Once encoder uses the parameter set, this will be set to zero */ 453 UWORD32 u4_is_valid; 454 455 /** Command associated with this config param set */ 456 ISVCE_CONTROL_API_COMMAND_TYPE_T e_cmd; 457 458 /** Input width in mbs */ 459 UWORD32 i4_wd_mbs; 460 461 /** Input height in mbs */ 462 UWORD32 i4_ht_mbs; 463 464 /** entropy coding mode flag */ 465 UWORD32 u4_entropy_coding_mode; 466 467 /** enable weighted prediction */ 468 UWORD32 u4_weighted_prediction; 469 470 /** Pic info type */ 471 UWORD32 u4_pic_info_type; 472 /** 473 * MB info type 474 */ 475 UWORD32 u4_isvce_mb_info_type; 476 477 /** VUI structure */ 478 vui_t s_vui; 479 480 /** SEI structure */ 481 sei_params_t s_sei; 482 483 /** Flag to enable/disable VUI from header */ 484 UWORD32 u4_disable_vui; 485 486 /** SVC params */ 487 svc_params_t s_svc_params; 488 489 bool b_nalu_info_export_enable; 490 491 } isvce_cfg_params_t; 492 493 typedef struct mb_qp_ctxt_t 494 { 495 UWORD8 u1_cur_mb_qp; 496 497 } mb_qp_ctxt_t; 498 499 typedef struct isvce_entropy_ctxt_t 500 { 501 /** 502 * Pointer to the cabac context 503 */ 504 isvce_cabac_ctxt_t *ps_cabac; 505 506 mb_qp_ctxt_t *ps_mb_qp_ctxt; 507 508 /** 509 * start of frame / start of slice flag 510 */ 511 WORD32 i4_sof; 512 513 /** 514 * end of frame / end of slice flag 515 */ 516 WORD32 i4_eof; 517 518 /** 519 * generate header upon request 520 */ 521 WORD32 i4_gen_header; 522 523 WORD32 i4_gen_subset_sps; 524 525 /** 526 * Pointer to base of sequence parameter set structure array 527 */ 528 sps_t *ps_sps_base; 529 530 /** 531 * Pointer to base of Picture parameter set structure array 532 */ 533 pps_t *ps_pps_base; 534 535 /** 536 * Current slice idx 537 */ 538 WORD32 i4_cur_slice_idx; 539 540 /** 541 * Points to the array of slice indices which is used to identify the 542 * independent slice to which each MB in a frame belongs. 543 */ 544 UWORD8 *pu1_slice_idx; 545 546 /** 547 * Pointer to base of svc_nalu_ext structure array 548 */ 549 svc_nalu_ext_t *ps_svc_nalu_ext_base; 550 551 /** 552 * Pointer to base of subset sequence parameter set structure array 553 */ 554 subset_sps_t *ps_subset_sps_base; 555 556 /** 557 * Pointer to base of slice header structure array 558 */ 559 slice_header_t *ps_slice_hdr_base; 560 561 /** 562 * Pointer to base of SVC slice header structure array 563 */ 564 svc_slice_header_t *ps_svc_slice_hdr_base; 565 566 /** 567 * entropy status 568 */ 569 UWORD8 *pu1_entropy_map; 570 571 /** 572 * MB's x position within a picture in raster scan in MB units 573 */ 574 WORD32 i4_mb_x; 575 576 /** 577 * MB's y position within a picture in raster scan in MB units 578 */ 579 WORD32 i4_mb_y; 580 581 /** 582 * MB start address 583 */ 584 WORD32 i4_mb_cnt; 585 586 /** 587 * MB start address 588 */ 589 WORD32 i4_mb_start_add; 590 591 /** 592 * MB end address 593 */ 594 WORD32 i4_mb_end_add; 595 596 /** 597 * Input width in mbs 598 */ 599 WORD32 i4_wd_mbs; 600 601 /** 602 * Input height in mbs 603 */ 604 WORD32 i4_ht_mbs; 605 606 /** 607 * Bitstream structure 608 */ 609 bitstrm_t *ps_bitstrm; 610 611 #if ENABLE_RE_ENC_AS_SKIP 612 bitstrm_t *ps_bitstrm_after_slice_hdr; 613 #endif 614 615 /** 616 * transform_8x8_mode_flag 617 */ 618 WORD8 i1_transform_8x8_mode_flag; 619 620 /** 621 * entropy_coding_mode_flag 622 */ 623 WORD8 u1_entropy_coding_mode_flag; 624 625 /** 626 * Pointer to the top row nnz for luma 627 */ 628 UWORD8 (*pu1_top_nnz_luma)[4]; 629 630 /** 631 * left nnz for luma 632 */ 633 UWORD32 u4_left_nnz_luma; 634 635 /** 636 * Pointer to zero runs before for the mb 637 */ 638 UWORD8 au1_zero_run[16]; 639 640 /** 641 * Pointer to the top row nnz for chroma 642 */ 643 UWORD8 (*pu1_top_nnz_cbcr)[4]; 644 645 /** 646 * left nnz for chroma 647 */ 648 UWORD8 u4_left_nnz_cbcr; 649 650 /** 651 * Pointer frame level mb subblock coeff data 652 */ 653 void *pv_pic_mb_coeff_data; 654 655 /** 656 * Pointer to mb subblock coeff data and number of subblocks and scan idx 657 * Incremented each time a coded subblock is processed 658 */ 659 void *pv_mb_coeff_data; 660 661 /** 662 * Pointer frame level mb header data 663 */ 664 void *pv_pic_mb_header_data; 665 666 /** 667 * Pointer to mb header data and 668 * incremented each time a coded mb is encoded 669 */ 670 void *pv_mb_header_data; 671 672 /** 673 * Error code during parse stage 674 */ 675 IH264E_ERROR_T i4_error_code; 676 677 /** 678 * Void pointer to job context 679 */ 680 void *pv_proc_jobq, *pv_entropy_jobq; 681 682 /** 683 * Flag to signal end of frame 684 */ 685 WORD32 i4_end_of_frame; 686 687 /** 688 * Abs POC count of the frame 689 */ 690 WORD32 i4_abs_pic_order_cnt; 691 692 /** 693 * mb skip run 694 */ 695 WORD32 *pi4_mb_skip_run; 696 697 /** 698 * Flag to signal end of sequence 699 */ 700 UWORD32 u4_is_last; 701 702 /** 703 * Lower 32bits of time-stamp corresponding to the buffer being encoded 704 */ 705 UWORD32 u4_timestamp_low; 706 707 /** 708 * Upper 32bits of time-stamp corresponding to the buffer being encoded 709 */ 710 UWORD32 u4_timestamp_high; 711 712 /** 713 * Current Picture count - used for synchronization 714 */ 715 WORD32 i4_pic_cnt; 716 717 /** 718 * Number of bits consumed by header for I and P mb types 719 */ 720 UWORD32 u4_header_bits[MAX_MB_TYPE]; 721 722 /** 723 * Number of bits consumed by residue for I and P mb types 724 */ 725 UWORD32 u4_residue_bits[MAX_MB_TYPE]; 726 727 UWORD8 u1_spatial_layer_id; 728 729 } isvce_entropy_ctxt_t; 730 731 /** 732 ****************************************************************************** 733 * @brief Rate control related variables 734 ****************************************************************************** 735 */ 736 typedef struct isvce_rate_control_ctxt_t 737 { 738 rate_control_api_t *apps_rate_control_api[MAX_NUM_SPATIAL_LAYERS]; 739 740 void *pps_frame_time; 741 742 void *pps_time_stamp; 743 744 void *pps_pd_frm_rate; 745 746 /** 747 * frame rate pull down 748 */ 749 WORD32 pre_encode_skip[MAX_CTXT_SETS]; 750 751 /** 752 * skip frame (cbr) 753 */ 754 WORD32 post_encode_skip[MAX_CTXT_SETS]; 755 756 /** 757 * rate control type 758 */ 759 rc_type_e e_rc_type; 760 761 /** 762 * pic type 763 */ 764 picture_type_e e_pic_type; 765 766 /** 767 * rc utils context 768 */ 769 svc_rc_utils_ctxt_t s_rc_utils; 770 771 /** 772 * intra cnt in previous frame 773 */ 774 WORD32 ai4_num_intra_in_prev_frame[MAX_NUM_SPATIAL_LAYERS]; 775 776 /** 777 * avg activity of prev frame 778 */ 779 WORD32 ai4_avg_activity[MAX_NUM_SPATIAL_LAYERS]; 780 781 } isvce_rate_control_ctxt_t; 782 783 typedef struct 784 { 785 /** 786 * mb type and mode 787 */ 788 UWORD8 u1_mb_type_mode; 789 790 /** 791 * CBP 792 */ 793 UWORD8 u1_cbp; 794 795 /** 796 * MB qp delta 797 */ 798 UWORD8 u1_mb_qp; 799 800 /** 801 * Element to align structure to 2 byte boundary 802 */ 803 UWORD8 u1_pad; 804 805 UWORD8 u1_base_mode_flag; 806 807 UWORD8 u1_residual_prediction_flag; 808 809 } isvce_mb_hdr_common_t; 810 811 /** 812 ****************************************************************************** 813 * @brief macro block info for I4x4 MB 814 ****************************************************************************** 815 */ 816 typedef struct 817 { 818 /** 819 * Common MB header params 820 */ 821 isvce_mb_hdr_common_t common; 822 823 /** 824 * Sub block modes, 2 modes per byte 825 */ 826 UWORD8 au1_sub_blk_modes[8]; 827 } isvce_mb_hdr_i4x4_t; 828 829 /** 830 ****************************************************************************** 831 * @brief macro block info for I8x8 MB 832 ****************************************************************************** 833 */ 834 typedef struct 835 { 836 /** 837 * Common MB header params 838 */ 839 isvce_mb_hdr_common_t common; 840 841 /** 842 * Sub block modes, 2 modes per byte 843 */ 844 UWORD8 au1_sub_blk_modes[2]; 845 } isvce_mb_hdr_i8x8_t; 846 847 /** 848 ****************************************************************************** 849 * @brief macro block info for I16x16 MB 850 ****************************************************************************** 851 */ 852 typedef struct 853 { 854 /** 855 * Common MB header params 856 */ 857 isvce_mb_hdr_common_t common; 858 859 } isvce_mb_hdr_i16x16_t; 860 861 /** 862 ****************************************************************************** 863 * @brief macro block info for P16x16 MB 864 ****************************************************************************** 865 */ 866 typedef struct 867 { 868 /** 869 * Common MB header params 870 */ 871 isvce_mb_hdr_common_t common; 872 873 /** 874 * MV 875 */ 876 WORD16 ai2_mvd[2]; 877 878 UWORD8 u1_mvp_idx; 879 } isvce_mb_hdr_p16x16_t; 880 881 /** 882 ****************************************************************************** 883 * @brief macro block info for PSKIP MB 884 ****************************************************************************** 885 */ 886 typedef struct 887 { 888 /** 889 * Common MB header params 890 */ 891 isvce_mb_hdr_common_t common; 892 893 } isvce_mb_hdr_pskip_t; 894 895 /** 896 ****************************************************************************** 897 * @brief macro block info for B16x16 MB 898 ****************************************************************************** 899 */ 900 typedef struct 901 { 902 /** 903 * Common MB header params 904 */ 905 isvce_mb_hdr_common_t common; 906 907 /** 908 * MV 909 */ 910 WORD16 ai2_mvd[NUM_PRED_DIRS][2]; 911 912 UWORD8 au1_mvp_idx[NUM_PRED_DIRS]; 913 } isvce_mb_hdr_b16x16_t; 914 915 /** 916 ****************************************************************************** 917 * @brief macro block info for BDIRECT MB 918 ****************************************************************************** 919 */ 920 typedef struct 921 { 922 /** 923 * Common MB header params 924 */ 925 isvce_mb_hdr_common_t common; 926 927 } isvce_mb_hdr_bdirect_t; 928 929 /** 930 ****************************************************************************** 931 * @brief macro block info for PSKIP MB 932 ****************************************************************************** 933 */ 934 typedef struct 935 { 936 /** 937 * Common MB header params 938 */ 939 isvce_mb_hdr_common_t common; 940 941 } isvce_mb_hdr_bskip_t; 942 943 /** 944 ****************************************************************************** 945 * @brief macro block info for IBL MB 946 ****************************************************************************** 947 */ 948 typedef struct isvce_mb_hdr_base_mode_t 949 { 950 /** 951 * Common MB header params 952 */ 953 isvce_mb_hdr_common_t common; 954 955 } isvce_mb_hdr_base_mode_t; 956 957 /** 958 ****************************************************************************** 959 * @brief Union of mb_hdr structures for size calculation 960 * and to access first few common elements 961 ****************************************************************************** 962 */ 963 964 typedef union isvce_mb_hdr_t 965 { 966 isvce_mb_hdr_i4x4_t mb_hdr_i4x4; 967 isvce_mb_hdr_i8x8_t mb_hdr_i8x8; 968 isvce_mb_hdr_i16x16_t mb_hdr_i16x16; 969 isvce_mb_hdr_p16x16_t mb_hdr_p16x16; 970 isvce_mb_hdr_pskip_t mb_hdr_pskip; 971 isvce_mb_hdr_b16x16_t mb_hdr_b16x16; 972 isvce_mb_hdr_bdirect_t mb_hdr_bdirect; 973 isvce_mb_hdr_bskip_t mb_hdr_bskip; 974 isvce_mb_hdr_base_mode_t mb_hdr_base_mode; 975 } isvce_mb_hdr_t; 976 977 typedef struct isvce_bs_ctxt_t 978 { 979 /** 980 * MB's x position within a picture in raster scan in MB units 981 */ 982 WORD32 i4_mb_x; 983 984 /** 985 * MB's y position within a picture in raster scan in MB units 986 */ 987 WORD32 i4_mb_y; 988 989 /** 990 * MB's x position within a Slice in raster scan in MB units 991 */ 992 WORD32 i4_mb_slice_x; 993 994 /** 995 * MB's y position within a Slice in raster scan in MB units 996 */ 997 WORD32 i4_mb_slice_y; 998 999 /** 1000 * Vertical strength, Two bits per edge. 1001 * Stored in format. BS[15] | BS[14] | .. |BS[0] 1002 */ 1003 UWORD32 *pu4_pic_vert_bs; 1004 1005 UWORD32 *pu4_intra_base_vert_bs; 1006 1007 /** 1008 * Boundary strength, Two bits per edge. 1009 * Stored in format. BS[15] | BS[14] | .. |BS[0] 1010 */ 1011 UWORD32 *pu4_pic_horz_bs; 1012 1013 UWORD32 *pu4_intra_base_horz_bs; 1014 1015 /** 1016 * Qp array stored for each mb 1017 */ 1018 UWORD8 *pu1_pic_qp; 1019 1020 } isvce_bs_ctxt_t; 1021 1022 typedef struct isvce_deblk_ctxt_t 1023 { 1024 /** 1025 * MB's x position within a picture in raster scan in MB units 1026 */ 1027 WORD32 i4_mb_x; 1028 1029 /** 1030 * MB's y position within a picture in raster scan in MB units 1031 */ 1032 WORD32 i4_mb_y; 1033 1034 /** 1035 * structure that contains BS and QP frame level arrays 1036 */ 1037 isvce_bs_ctxt_t s_bs_ctxt; 1038 1039 /* 1040 * Recon Buffers 1041 */ 1042 yuv_buf_props_t s_rec_pic_buf_props; 1043 1044 /** 1045 * Points to the array of slice indices which is used to identify the slice 1046 * to which each MB in a frame belongs. 1047 */ 1048 UWORD8 *pu1_slice_idx; 1049 1050 } isvce_deblk_ctxt_t; 1051 1052 /** 1053 ************************************************************************** 1054 * @brief isvce_me_ctxt_t 1055 * 1056 * Structure encapsulating the parameters used in the motion estimation 1057 * context 1058 ************************************************************************** 1059 */ 1060 typedef struct isvce_me_ctxt_t 1061 { 1062 /** 1063 * Ref pointer to current MB luma for each ref list 1064 */ 1065 UWORD8 *apu1_ref_buf_luma[MAX_NUM_REFLIST]; 1066 1067 /** 1068 * Src pointer to current MB luma 1069 */ 1070 UWORD8 *pu1_src_buf_luma; 1071 1072 /** 1073 * source stride 1074 * (strides for luma and chroma are the same) 1075 */ 1076 WORD32 i4_src_strd; 1077 1078 /** 1079 * recon stride 1080 * (strides for luma and chroma are the same) 1081 */ 1082 WORD32 ai4_rec_strd[MAX_NUM_REFLIST]; 1083 1084 /** 1085 * Offset for half pel x plane from the pic buf 1086 */ 1087 UWORD32 u4_half_x_offset; 1088 1089 /** 1090 * Offset for half pel y plane from half x plane 1091 */ 1092 UWORD32 u4_half_y_offset; 1093 1094 /** 1095 * Offset for half pel xy plane from half y plane 1096 */ 1097 UWORD32 u4_half_xy_offset; 1098 1099 /** 1100 * Search range in the X, Y axis in terms of pixels 1101 */ 1102 WORD32 ai2_srch_boundaries[2]; 1103 1104 /** 1105 * Search range in the north direction in terms of pixels 1106 */ 1107 WORD32 i4_srch_range_n; 1108 1109 /** 1110 * Search range in the south direction in terms of pixels 1111 */ 1112 WORD32 i4_srch_range_s; 1113 1114 /** 1115 * Search range in the east direction in terms of pixels 1116 */ 1117 WORD32 i4_srch_range_e; 1118 1119 /** 1120 * Search range in the west direction in terms of pixels 1121 */ 1122 WORD32 i4_srch_range_w; 1123 1124 /** 1125 * left mb motion vector 1126 */ 1127 ime_mv_t s_left_mv; 1128 1129 /** 1130 * top left mb motion vector 1131 */ 1132 ime_mv_t s_top_left_mv; 1133 1134 /* 1135 * ilp MVs for ME candidates * 1136 */ 1137 ilp_me_cands_t *ps_ilp_me_cands; 1138 1139 /** 1140 * Number of valid candidates for the Initial search position 1141 */ 1142 UWORD32 u4_num_candidates[MAX_NUM_REFLIST + 1]; 1143 1144 /** 1145 * Motion vector predictors derived from neighboring 1146 * blocks for each of the six block partitions 1147 */ 1148 ime_mv_t as_mv_init_search[MAX_NUM_REFLIST + 1][MAX_FPEL_SEARCH_CANDIDATES]; 1149 1150 /** 1151 * mv bits 1152 */ 1153 UWORD8 *pu1_mv_bits; 1154 1155 /** 1156 * lambda (lagrange multiplier for cost computation) 1157 */ 1158 UWORD32 u4_lambda_motion; 1159 1160 /** 1161 * enabled fast sad computation 1162 */ 1163 UWORD32 u4_enable_fast_sad; 1164 1165 /* 1166 * Enable SKIP block prediction based on SATQD 1167 */ 1168 UWORD32 u4_enable_stat_sad; 1169 1170 /* 1171 * Minimum distortion to search for 1172 * */ 1173 WORD32 i4_min_sad; 1174 1175 /* 1176 * Signal that minimum sad has been reached in ME 1177 * */ 1178 UWORD32 u4_min_sad_reached; 1179 1180 /** 1181 * Flag to enable/disbale half pel motion estimation 1182 */ 1183 UWORD32 u4_enable_hpel; 1184 1185 /** 1186 * Diamond search Iteration Max Cnt 1187 */ 1188 UWORD32 u4_num_layers; 1189 1190 /** 1191 * encoder me speed 1192 */ 1193 UWORD32 u4_me_speed_preset; 1194 1195 UWORD32 u4_left_is_intra; 1196 1197 UWORD32 u4_left_is_skip; 1198 1199 /* skip_type can be PREDL0, PREDL1 or BIPRED */ 1200 WORD32 i4_skip_type; 1201 1202 /* Biasing given for skip prediction */ 1203 WORD32 i4_skip_bias[2]; 1204 1205 /** 1206 * Structure to store the MB partition info 1207 * We need 1(L0)+1(L1)+1(bi) 1208 */ 1209 mb_part_ctxt as_mb_part[MAX_NUM_REFLIST + 1]; 1210 /* 1211 * Threshold to compare the sad with 1212 */ 1213 UWORD16 *pu2_sad_thrsh; 1214 1215 /** 1216 * fn ptrs for compute sad routines 1217 */ 1218 ime_compute_sad_ft *pf_ime_compute_sad_16x16[2]; 1219 ime_compute_sad_ft *pf_ime_compute_sad_16x8; 1220 ime_compute_sad4_diamond *pf_ime_compute_sad4_diamond; 1221 ime_compute_sad3_diamond *pf_ime_compute_sad3_diamond; 1222 ime_compute_sad2_diamond *pf_ime_compute_sad2_diamond; 1223 ime_sub_pel_compute_sad_16x16_ft *pf_ime_sub_pel_compute_sad_16x16; 1224 1225 /* 1226 * Function poitners for SATQD 1227 */ 1228 ime_compute_sad_stat *pf_ime_compute_sad_stat_luma_16x16; 1229 1230 /** 1231 * Qp 1232 */ 1233 UWORD8 u1_mb_qp; 1234 1235 /* 1236 * Buffers for holding subpel and bipred temp buffers 1237 */ 1238 UWORD8 *apu1_subpel_buffs[SUBPEL_BUFF_CNT]; 1239 1240 WORD32 u4_subpel_buf_strd; 1241 1242 /* 1243 * Buffers to store the best halfpel plane* 1244 */ 1245 UWORD8 *pu1_hpel_buf; 1246 1247 } isvce_me_ctxt_t; 1248 1249 typedef struct isvce_mb_info_nmb_t 1250 { 1251 UWORD32 u4_mb_type; 1252 UWORD32 u4_min_sad; 1253 UWORD32 u4_min_sad_reached; 1254 WORD32 i4_mb_cost; 1255 WORD32 i4_mb_distortion; 1256 1257 isvce_enc_pu_mv_t as_skip_mv[4]; 1258 1259 isvce_enc_pu_mv_t as_pred_mv[2]; 1260 1261 block_neighbors_t s_ngbr_avbl; 1262 1263 /* 1264 * Buffer to hold best subpel buffer in each MB of NMB 1265 */ 1266 UWORD8 *pu1_best_sub_pel_buf; 1267 1268 /* 1269 * Stride for subpel buffer 1270 */ 1271 UWORD32 u4_bst_spel_buf_strd; 1272 1273 } isvce_mb_info_nmb_t; 1274 1275 typedef struct isvce_process_ctxt_t 1276 { 1277 svc_params_t s_svc_params; 1278 1279 /* Resolves circular dependency with svc_ilp_mv_ctxt_t */ 1280 void *ps_svc_ilp_mv_ctxt; 1281 1282 /* Resolves circular dependency with svc_res_pred_ctxt_t */ 1283 void *ps_res_pred_ctxt; 1284 1285 /* Resolves circular dependency with svc_intra_pred_ctxt_t */ 1286 void *ps_intra_pred_ctxt; 1287 1288 /* Resolves circular dependency with svc_sub_pic_rc_ctxt_t */ 1289 void *ps_sub_pic_rc_ctxt; 1290 1291 yuv_buf_props_t *ps_mb_pred_buf; 1292 1293 yuv_buf_props_t *ps_mb_res_buf; 1294 1295 ilp_mv_t *ps_ilp_mv; 1296 1297 /** 1298 * entropy context 1299 */ 1300 isvce_entropy_ctxt_t s_entropy; 1301 1302 /** 1303 * me context 1304 */ 1305 isvce_me_ctxt_t s_me_ctxt; 1306 1307 /* Resolves circular dependency with isvce_codec_t */ 1308 void *ps_codec; 1309 1310 /** 1311 * N mb process contest 1312 */ 1313 n_mb_process_ctxt_t s_n_mb_ctxt; 1314 1315 /* 1316 * Src Buffers 1317 */ 1318 yuv_buf_props_t s_src_buf_props; 1319 1320 /* 1321 * Recon Buffers 1322 */ 1323 yuv_buf_props_t s_rec_buf_props; 1324 1325 /* 1326 * Reference Frame Buffers 1327 */ 1328 yuv_buf_props_t as_ref_buf_props[MAX_REF_PIC_CNT]; 1329 1330 /* 1331 * Src Buffers 1332 */ 1333 yuv_buf_props_t s_src_pic_buf_props; 1334 1335 /* 1336 * Recon Buffers 1337 */ 1338 yuv_buf_props_t s_rec_pic_buf_props; 1339 1340 /* 1341 * Reference Frame Buffers 1342 */ 1343 yuv_buf_props_t as_ref_pic_buf_props[MAX_REF_PIC_CNT]; 1344 1345 /** 1346 * Pointer to ME NMB info 1347 */ 1348 isvce_mb_info_nmb_t *ps_nmb_info; 1349 1350 isvce_mb_info_nmb_t *ps_cur_mb; 1351 1352 /** 1353 * Offset for half pel x plane from the pic buf 1354 */ 1355 UWORD32 u4_half_x_offset; 1356 1357 /** 1358 * Offset for half pel y plane from half x plane 1359 */ 1360 UWORD32 u4_half_y_offset; 1361 1362 /** 1363 * Offset for half pel xy plane from half y plane 1364 */ 1365 UWORD32 u4_half_xy_offset; 1366 1367 /** 1368 * pred buffer pointer (temp buffer 1) 1369 */ 1370 UWORD8 *pu1_pred_mb; 1371 1372 /** 1373 * pred buffer pointer (prediction buffer for intra 16x16 1374 */ 1375 UWORD8 *pu1_pred_mb_intra_16x16; 1376 1377 /** 1378 * pred buffer pointer (prediction buffer for intra 16x16_plane 1379 */ 1380 UWORD8 *pu1_pred_mb_intra_16x16_plane; 1381 1382 /** 1383 * pred buffer pointer (prediction buffer for intra chroma 1384 */ 1385 UWORD8 *pu1_pred_mb_intra_chroma; 1386 1387 /** 1388 * pred buffer pointer (prediction buffer for intra chroma plane 1389 */ 1390 UWORD8 *pu1_pred_mb_intra_chroma_plane; 1391 1392 /** 1393 * temp. reference buffer ptr for intra 4x4 when rdopt is on 1394 */ 1395 UWORD8 *pu1_ref_mb_intra_4x4; 1396 1397 /** 1398 * prediction buffer stride 1399 */ 1400 WORD32 i4_pred_strd; 1401 1402 /** 1403 * transform buffer pointer (temp buffer 2) 1404 */ 1405 WORD16 *pi2_res_buf; 1406 1407 /** 1408 * temp. transform buffer ptr for intra 4x4 when rdopt is on 1409 */ 1410 WORD16 *pi2_res_buf_intra_4x4; 1411 1412 /** 1413 * transform buffer stride 1414 */ 1415 WORD32 i4_res_strd; 1416 1417 /** 1418 * scratch buffer for inverse transform (temp buffer 3) 1419 */ 1420 void *pv_scratch_buff; 1421 1422 /** 1423 * frame num 1424 */ 1425 WORD32 i4_frame_num; 1426 1427 /** 1428 * start address of frame / sub-frame 1429 */ 1430 WORD32 i4_frame_strt_add; 1431 1432 /** 1433 * IDR pic 1434 */ 1435 UWORD32 u4_is_idr; 1436 1437 /** 1438 * idr_pic_id 1439 */ 1440 UWORD32 u4_idr_pic_id; 1441 1442 /** 1443 * Input width in mbs 1444 */ 1445 WORD32 i4_wd_mbs; 1446 1447 /** 1448 * Input height in mbs 1449 */ 1450 WORD32 i4_ht_mbs; 1451 1452 /** 1453 * slice_type 1454 */ 1455 WORD32 i4_slice_type; 1456 1457 /** 1458 * Current slice idx 1459 */ 1460 WORD32 i4_cur_slice_idx; 1461 1462 /** 1463 * MB's x position within a picture in raster scan in MB units 1464 */ 1465 WORD32 i4_mb_x; 1466 1467 /** 1468 * MB's y position within a picture in raster scan in MB units 1469 */ 1470 WORD32 i4_mb_y; 1471 1472 /** 1473 * MB's x position within a Slice in raster scan in MB units 1474 */ 1475 WORD32 i4_mb_slice_x; 1476 1477 /** 1478 * MB's y position within a Slice in raster scan in MB units 1479 */ 1480 WORD32 i4_mb_slice_y; 1481 1482 /** 1483 * mb neighbor availability pointer 1484 */ 1485 block_neighbors_t *ps_ngbr_avbl; 1486 1487 /** 1488 * lambda (lagrange multiplier for cost computation) 1489 */ 1490 UWORD32 u4_lambda; 1491 1492 /** 1493 * mb distortion 1494 */ 1495 WORD32 i4_mb_distortion; 1496 1497 /** 1498 * mb cost 1499 */ 1500 WORD32 i4_mb_cost; 1501 1502 /********************************************************************/ 1503 /* i4_ngbr_avbl_mb_16 - ngbr avbl of curr mb */ 1504 /* i4_ngbr_avbl_sb_8 - ngbr avbl of all 8x8 sub blocks of curr mb */ 1505 /* i4_ngbr_avbl_sb_4 - ngbr avbl of all 4x4 sub blocks of curr mb */ 1506 /* i4_ngbr_avbl_mb_c - chroma ngbr avbl of curr mb */ 1507 /********************************************************************/ 1508 WORD32 i4_ngbr_avbl_16x16_mb; 1509 WORD32 ai4_neighbor_avail_8x8_subblks[4]; 1510 UWORD8 au1_ngbr_avbl_4x4_subblks[16]; 1511 WORD32 i4_chroma_neighbor_avail_8x8_mb; 1512 1513 /** 1514 * array to store the mode of mb sub blocks 1515 */ 1516 UWORD8 au1_intra_luma_mb_4x4_modes[16]; 1517 1518 /** 1519 * array to store the predicted mode of mb sub blks 1520 */ 1521 UWORD8 au1_predicted_intra_luma_mb_4x4_modes[16]; 1522 1523 /** 1524 * macro block intra 16x16 mode 1525 */ 1526 UWORD8 u1_l_i16_mode; 1527 1528 /** 1529 * array to store the mode of the macro block intra 8x8 4 modes 1530 */ 1531 UWORD8 au1_intra_luma_mb_8x8_modes[4]; 1532 1533 /** 1534 * intra chroma mb mode 1535 */ 1536 UWORD8 u1_c_i8_mode; 1537 1538 /********************************************************************/ 1539 /* array to store pixels from the neighborhood for intra prediction */ 1540 /* i16 - 16 left pels + 1 top left pel + 16 top pels = 33 pels */ 1541 /* i8 - 8 lpels + 1 tlpels + 8 tpels + 8 tr pels = 25 pels */ 1542 /* i4 - 4 lpels + 1 tlpels + 4 tpels + 4 tr pels = 13 pels */ 1543 /* ic - 8 left pels + 1 top left pel + 8 top pels )*2 */ 1544 /********************************************************************/ 1545 UWORD8 au1_ngbr_pels[34]; 1546 1547 /** 1548 * array for 8x8 intra pels filtering (temp buff 4) 1549 */ 1550 UWORD8 au1_neighbor_pels_i8x8_unfiltered[25]; 1551 1552 /** 1553 * Number of sub partitons in the inter pred MB 1554 */ 1555 UWORD32 u4_num_sub_partitions; 1556 1557 /** 1558 * Pointer to hold num PUs each MB in a picture 1559 */ 1560 UWORD32 *pu4_mb_pu_cnt; 1561 1562 /** 1563 * Pointer to the array of structures having motion vectors, size 1564 * and position of sub partitions 1565 */ 1566 isvce_mb_info_t *ps_mb_info; 1567 1568 /** 1569 * Pointer to the pu of current co-located MB in list 1 1570 */ 1571 isvce_mb_info_t *ps_col_mb; 1572 1573 /** 1574 * predicted motion vector 1575 */ 1576 isvce_enc_pu_mv_t *ps_skip_mv; 1577 1578 /** 1579 * predicted motion vector 1580 */ 1581 isvce_enc_pu_mv_t *ps_pred_mv; 1582 1583 /** 1584 * top row mb syntax information base 1585 * In normal working scenarios, for a given context set, 1586 * the mb syntax info pointer is identical across all process threads. 1587 * But when the hard bound on slices are enabled, in multi core, frame 1588 * is partitioned in to sections equal to set number of cores and each 1589 * partition is run independently. In this scenario, a ctxt set will alone 1590 * appear to run multiple frames at a time. For this to occur, the common 1591 * pointers across the proc ctxt should disappear. 1592 * 1593 * This is done by allocating MAX_PROCESS_THREADS memory and distributing 1594 * across individual ctxts when byte bnd per slice is enabled. 1595 */ 1596 svc_nbr_info_t s_nbr_info_base; 1597 1598 nbr_info_t s_nbr_info; 1599 1600 /** 1601 * mb neighbor availability pointer 1602 */ 1603 block_neighbors_t s_ngbr_avbl; 1604 1605 /** 1606 * coded block pattern 1607 */ 1608 UWORD32 u4_cbp; 1609 1610 /** 1611 * number of non zero coeffs 1612 */ 1613 UWORD32 au4_nnz[5]; 1614 1615 UWORD8 au1_chroma_nnz[2 * (NUM_4x4_IN_8x8 + 1)]; 1616 1617 /** 1618 * number of non zero coeffs for intra 4x4 when rdopt is on 1619 */ 1620 UWORD32 au4_nnz_intra_4x4[4]; 1621 1622 /** 1623 * frame qp & mb qp 1624 */ 1625 UWORD8 u1_frame_qp; 1626 1627 UWORD8 u1_mb_qp; 1628 1629 /** 1630 * quantization parameters for luma & chroma planes 1631 */ 1632 quant_params_t *ps_qp_params[3]; 1633 1634 /** 1635 * Pointer frame level mb subblock coeff data 1636 */ 1637 void *pv_pic_mb_coeff_data; 1638 1639 /** 1640 * Pointer to mb subblock coeff data and number of subblocks and scan idx 1641 * Incremented each time a coded subblock is processed 1642 */ 1643 void *pv_mb_coeff_data; 1644 1645 /** 1646 * Pointer frame level mb header data 1647 */ 1648 void *pv_pic_mb_header_data; 1649 1650 /** 1651 * Pointer to mb header data and 1652 * incremented each time a coded mb is encoded 1653 */ 1654 void *pv_mb_header_data; 1655 1656 /** 1657 * Signal that pic_init is called first time 1658 */ 1659 WORD32 i4_first_pic_init; 1660 1661 /** 1662 * Current MV Bank's buffer ID 1663 */ 1664 WORD32 i4_cur_mv_bank_buf_id; 1665 1666 /** 1667 * Void pointer to job context 1668 */ 1669 void *pv_proc_jobq, *pv_entropy_jobq; 1670 1671 /** 1672 * Number of MBs to be processed in the current Job 1673 */ 1674 WORD32 i4_mb_cnt; 1675 1676 /** 1677 * ID for the current context - Used for debugging 1678 */ 1679 WORD32 i4_id; 1680 1681 /** 1682 * Pointer to current picture buffer structure 1683 */ 1684 svc_au_buf_t *ps_cur_pic; 1685 1686 /** 1687 * Pointer to current picture's mv buffer structure 1688 */ 1689 svc_au_data_t *ps_cur_mv_buf; 1690 1691 /** 1692 * Flag to indicate if ps_proc was initialized at least once in a frame. 1693 * This is needed to handle cases where a core starts to handle format 1694 * conversion jobs directly 1695 */ 1696 WORD32 i4_init_done; 1697 1698 /** 1699 * Process status: one byte per MB 1700 */ 1701 UWORD8 *pu1_proc_map; 1702 1703 /** 1704 * Deblk status: one byte per MB 1705 */ 1706 UWORD8 *pu1_deblk_map; 1707 1708 /** 1709 * Process status: one byte per MB 1710 */ 1711 UWORD8 *pu1_me_map; 1712 1713 /* 1714 * Intra refresh mask. 1715 * Indicates if an Mb is coded in intra mode within the current AIR interval 1716 * NOTE Refreshes after each AIR period 1717 * NOTE The map is shared between process 1718 */ 1719 UWORD8 *pu1_is_intra_coded; 1720 1721 /** 1722 * Disable deblock level (0: Enable completely, 3: Disable completely 1723 */ 1724 UWORD32 u4_disable_deblock_level; 1725 1726 /** 1727 * Pointer to the structure that contains deblock context 1728 */ 1729 isvce_deblk_ctxt_t s_deblk_ctxt; 1730 1731 /** 1732 * Points to the array of slice indices which is used to identify the 1733 * independent slice to which each MB in a frame belongs. 1734 */ 1735 UWORD8 *pu1_slice_idx; 1736 1737 /** 1738 * Pointer to base of svc_nalu_ext structure array 1739 */ 1740 svc_nalu_ext_t *ps_svc_nalu_ext_base; 1741 1742 /** 1743 * Pointer to base of subset sequence parameter set structure array 1744 */ 1745 subset_sps_t *ps_subset_sps_base; 1746 1747 /** 1748 * Pointer to base of slice header structure array 1749 */ 1750 slice_header_t *ps_slice_hdr_base; 1751 1752 /** 1753 * Pointer to base of SVC slice header structure array 1754 */ 1755 svc_slice_header_t *ps_svc_slice_hdr_base; 1756 1757 /** 1758 * Number of mb's to process in one loop 1759 */ 1760 WORD32 i4_nmb_ntrpy; 1761 1762 /** 1763 * Number of mb's to process in one loop 1764 */ 1765 UWORD32 u4_nmb_me; 1766 1767 /** 1768 * Structure for current input buffer 1769 */ 1770 isvce_inp_buf_t s_inp_buf; 1771 1772 /** 1773 * api call cnt 1774 */ 1775 WORD32 i4_encode_api_call_cnt; 1776 1777 /** 1778 * Current Picture count - used for synchronization 1779 */ 1780 WORD32 i4_pic_cnt; 1781 1782 /** 1783 * Intermediate buffer for interpred leaf level functions 1784 */ 1785 WORD32 ai16_pred1[HP_BUFF_WD * HP_BUFF_HT]; 1786 1787 /** 1788 * Reference picture for the current picture 1789 * TODO: Only 2 reference assumed currently 1790 */ 1791 svc_au_buf_t *aps_ref_pic[MAX_REF_PIC_CNT]; 1792 1793 /** 1794 * Reference MV buff for the current picture 1795 */ 1796 svc_au_data_t *aps_mv_buf[MAX_REF_PIC_CNT]; 1797 1798 /** 1799 * frame info used by RC 1800 */ 1801 frame_info_t s_frame_info; 1802 1803 /* 1804 * NOTE NOT PERSISTANT INSIDE FUNCTIONS 1805 * Min sad for current MB 1806 * will be populated initially 1807 * Once a sad less than eq to u4_min_sad is reached, the value will be copied 1808 * to the cariable 1809 */ 1810 UWORD32 u4_min_sad; 1811 1812 /* 1813 * indicates weather we have rached minimum sa or not 1814 */ 1815 UWORD32 u4_min_sad_reached; 1816 1817 /** 1818 * Current error code 1819 */ 1820 WORD32 i4_error_code; 1821 1822 /* 1823 * Enables or disables computation of recon 1824 */ 1825 UWORD32 u4_compute_recon; 1826 1827 /* 1828 * Temporary buffers to be used for subpel computation 1829 */ 1830 UWORD8 *apu1_subpel_buffs[SUBPEL_BUFF_CNT]; 1831 1832 /* 1833 * Buffer holding best sub pel values 1834 */ 1835 UWORD8 *pu1_best_subpel_buf; 1836 1837 /* 1838 * Stride for buffer holding best sub pel 1839 */ 1840 UWORD32 u4_bst_spel_buf_strd; 1841 1842 /* 1843 * SVC spatial layer ID 1844 */ 1845 UWORD8 u1_spatial_layer_id; 1846 } isvce_process_ctxt_t; 1847 1848 typedef UWORD8 FT_CORE_CODING(isvce_process_ctxt_t *ps_proc); 1849 1850 typedef WORD32 FT_FIND_SKIP_PARAMS(isvce_process_ctxt_t *, WORD32); 1851 1852 typedef void FT_ME_ALGORITHM(isvce_process_ctxt_t *); 1853 1854 typedef struct enc_loop_fxns_t 1855 { 1856 /** 1857 * luma core coding function pointer 1858 */ 1859 FT_CORE_CODING *apf_luma_energy_compaction[MAX_MBTYPES]; 1860 1861 /** 1862 * chroma core coding function pointer 1863 */ 1864 FT_CORE_CODING *apf_chroma_energy_compaction[2]; 1865 1866 /** 1867 * forward transform for intra blk of mb type 16x16 1868 */ 1869 FT_LUMA_16X16_RESI_TRANS_DCTRANS_QUANT 1870 *pf_resi_trans_dctrans_quant_16x16; 1871 1872 /** 1873 * inverse transform for intra blk of mb type 16x16 1874 */ 1875 FT_LUMA_16X16_IDCTRANS_IQUANT_ITRANS_RECON 1876 *pf_idctrans_iquant_itrans_recon_16x16; 1877 1878 /** 1879 * forward transform for 4x4 blk luma 1880 */ 1881 FT_RESI_TRANS_QUANT *apf_resi_trans_quant_4x4[NUM_RESI_TRANS_QUANT_VARIANTS]; 1882 1883 /** 1884 * forward transform for 4x4 blk luma 1885 */ 1886 FT_RESI_TRANS_QUANT 1887 *apf_resi_trans_quant_chroma_4x4[NUM_RESI_TRANS_QUANT_VARIANTS]; 1888 1889 /* 1890 * hadamard transform and quant for a 4x4 block 1891 */ 1892 FT_HADAMARD_QUANT *pf_hadamard_quant_4x4; 1893 1894 /* 1895 * hadamard transform and quant for a 4x4 block 1896 */ 1897 FT_HADAMARD_QUANT *pf_hadamard_quant_2x2_uv; 1898 1899 /** 1900 * inverse transform for 4x4 blk 1901 */ 1902 FT_IQ_IT_RECON *apf_iquant_itrans_recon_4x4[NUM_IQ_IT_RECON_VARIANTS]; 1903 1904 /** 1905 * inverse transform for chroma 4x4 blk 1906 */ 1907 FT_IQ_IT_RECON *apf_iquant_itrans_recon_chroma_4x4[NUM_IQ_IT_RECON_VARIANTS]; 1908 1909 /** 1910 * inverse transform for 4x4 blk with only single dc coeff 1911 */ 1912 FT_IQ_IT_RECON *apf_iquant_itrans_recon_4x4_dc[NUM_IQ_IT_RECON_VARIANTS]; 1913 1914 /** 1915 * inverse transform for chroma 4x4 blk with only single dc coeff 1916 */ 1917 FT_IQ_IT_RECON 1918 *apf_iquant_itrans_recon_chroma_4x4_dc[NUM_IQ_IT_RECON_VARIANTS]; 1919 1920 /* 1921 * Inverse hadamard transform and iquant for a 4x4 block 1922 */ 1923 FT_IHADAMARD_SCALING *pf_ihadamard_scaling_4x4; 1924 1925 /* 1926 * Inverse hadamard transform and iquant for a 4x4 block 1927 */ 1928 FT_IHADAMARD_SCALING *pf_ihadamard_scaling_2x2_uv; 1929 1930 /** 1931 * forward transform for 8x8 blk 1932 */ 1933 FT_RESI_TRANS_QUANT *apf_resi_trans_quant_8x8[NUM_RESI_TRANS_QUANT_VARIANTS]; 1934 1935 /** 1936 * inverse transform for 8x8 blk 1937 */ 1938 FT_IQ_IT_RECON *apf_iquant_itrans_recon_8x8[NUM_IQ_IT_RECON_VARIANTS]; 1939 1940 FT_IQ_IT_RECON *pf_zcbf_iquant_itrans_recon_4x4; 1941 1942 FT_IQ_IT_RECON *pf_chroma_zcbf_iquant_itrans_recon_4x4; 1943 1944 } enc_loop_fxns_t; 1945 1946 typedef struct inter_pred_fxns_t 1947 { 1948 FT_INTER_PRED_LUMA *pf_inter_pred_luma_copy; 1949 1950 FT_INTER_PRED_LUMA *pf_inter_pred_luma_horz; 1951 1952 FT_INTER_PRED_LUMA *pf_inter_pred_luma_vert; 1953 1954 FT_INTER_PRED_LUMA_BILINEAR *pf_inter_pred_luma_bilinear; 1955 1956 FT_INTER_PRED_CHROMA *pf_inter_pred_chroma; 1957 } inter_pred_fxns_t; 1958 1959 typedef struct mem_fxns_t 1960 { 1961 FT_MEMCPY *pf_mem_cpy_mul8; 1962 1963 FT_MEMSET *pf_mem_set_mul8; 1964 1965 FT_COPY_2D *pf_copy_2d; 1966 1967 FT_MEMSET_2D *pf_memset_2d; 1968 1969 FT_NONZERO_CHECKER *pf_nonzero_checker; 1970 1971 } mem_fxns_t; 1972 1973 typedef struct isa_dependent_fxns_t 1974 { 1975 enc_loop_fxns_t s_enc_loop_fxns; 1976 1977 inter_pred_fxns_t s_inter_pred_fxns; 1978 1979 mem_fxns_t s_mem_fxns; 1980 } isa_dependent_fxns_t; 1981 1982 /** 1983 * Reference set containing pointers to MV buf and pic buf 1984 */ 1985 typedef struct 1986 { 1987 /** Picture count */ 1988 WORD32 i4_pic_cnt; 1989 1990 /** POC */ 1991 WORD32 i4_poc; 1992 1993 /** picture buffer */ 1994 svc_au_buf_t *ps_pic_buf; 1995 1996 /** mv buffer */ 1997 svc_au_data_t *ps_svc_au_data; 1998 1999 } isvce_ref_set_t; 2000 2001 typedef struct isvce_codec_t 2002 { 2003 /** 2004 * downscaler context 2005 */ 2006 downscaler_ctxt_t s_scaler; 2007 2008 svc_ilp_data_t s_svc_ilp_data; 2009 2010 nalu_descriptors_t as_nalu_descriptors[MAX_NUM_SPATIAL_LAYERS]; 2011 2012 isa_dependent_fxns_t s_isa_dependent_fxns; 2013 2014 #if ENABLE_MODE_STAT_VISUALISER 2015 /* Resolves circular dependency with mode_stat_visualiser_t */ 2016 void *ps_mode_stat_visualiser; 2017 #endif 2018 2019 /** enable constrained intra prediction */ 2020 UWORD32 au4_constrained_intra_pred[MAX_NUM_SPATIAL_LAYERS]; 2021 2022 /** 2023 * Id of current pic (input order) 2024 */ 2025 WORD32 i4_poc; 2026 2027 /** 2028 * Number of encode frame API calls made 2029 * This variable must only be used for context selection [Read only] 2030 */ 2031 WORD32 i4_encode_api_call_cnt; 2032 2033 /** 2034 * Number of pictures encoded 2035 */ 2036 WORD32 i4_pic_cnt; 2037 2038 /** 2039 * Number of threads created 2040 */ 2041 WORD32 i4_proc_thread_cnt; 2042 2043 /** 2044 * Mutex used to keep the control calls thread-safe 2045 */ 2046 void *pv_ctl_mutex; 2047 2048 /** 2049 * Current active config parameters 2050 */ 2051 isvce_cfg_params_t s_cfg; 2052 2053 /** 2054 * Array containing the config parameter sets 2055 */ 2056 isvce_cfg_params_t as_cfg[MAX_ACTIVE_CONFIG_PARAMS]; 2057 2058 /** 2059 * Color format used by encoder internally 2060 */ 2061 IV_COLOR_FORMAT_T e_codec_color_format; 2062 2063 /** 2064 * recon stride 2065 * (strides for luma and chroma are the same) 2066 */ 2067 WORD32 i4_rec_strd; 2068 2069 /** 2070 * Flag to enable/disable deblocking of a frame 2071 */ 2072 WORD32 u4_disable_deblock_level; 2073 2074 /** 2075 * Number of continuous frames where deblocking was disabled 2076 */ 2077 WORD32 u4_disable_deblock_level_cnt; 2078 2079 /** 2080 * frame type 2081 */ 2082 PIC_TYPE_T pic_type; 2083 2084 /** 2085 * frame qp 2086 */ 2087 UWORD32 au4_frame_qp[MAX_NUM_SPATIAL_LAYERS]; 2088 2089 /** 2090 * Enable inital QP calculation based on BPP and GPP 2091 */ 2092 UWORD8 u1_enable_init_qp; 2093 2094 /** 2095 * frame num 2096 */ 2097 WORD32 i4_frame_num; 2098 2099 /** 2100 * slice_type 2101 */ 2102 WORD32 i4_slice_type; 2103 2104 /* 2105 * Force current frame to specific type 2106 */ 2107 IV_PICTURE_CODING_TYPE_T force_curr_frame_type; 2108 2109 /** 2110 * IDR pic 2111 */ 2112 UWORD32 u4_is_idr; 2113 2114 /** 2115 * idr_pic_id 2116 */ 2117 WORD32 i4_idr_pic_id; 2118 2119 /** 2120 * Flush mode 2121 */ 2122 WORD32 i4_flush_mode; 2123 2124 /** 2125 * Encode header mode 2126 */ 2127 WORD32 i4_header_mode; 2128 2129 /** 2130 * Flag to indicate if header has already 2131 * been generated when i4_api_call_cnt 0 2132 */ 2133 UWORD32 u4_header_generated; 2134 2135 /** 2136 * Encode generate header 2137 */ 2138 WORD32 i4_gen_header; 2139 2140 /** 2141 * To signal successful completion of init 2142 */ 2143 WORD32 i4_init_done; 2144 2145 /** 2146 * To signal that at least one picture was decoded 2147 */ 2148 WORD32 i4_first_pic_done; 2149 2150 /** 2151 * Reset flag - Codec is reset if this flag is set 2152 */ 2153 WORD32 i4_reset_flag; 2154 2155 /** 2156 * Current error code 2157 */ 2158 WORD32 i4_error_code; 2159 2160 /** 2161 * threshold residue 2162 */ 2163 WORD32 u4_thres_resi; 2164 2165 /** 2166 * disable intra inter gating 2167 */ 2168 UWORD32 u4_inter_gate; 2169 2170 /** 2171 * Holds mem records passed during init. 2172 * This will be used to return the mem records during retrieve call 2173 */ 2174 iv_mem_rec_t *ps_mem_rec_backup; 2175 2176 /** 2177 * Flag to determine if the entropy thread is active 2178 */ 2179 volatile ISVCE_ENTROPY_THREAD_STATES_T ae_entropy_thread_exit_state[MAX_CTXT_SETS]; 2180 2181 /** 2182 * Mutex used to keep the entropy calls thread-safe 2183 */ 2184 void *pv_entropy_mutex; 2185 2186 /** 2187 * Job queue buffer base 2188 */ 2189 void *pv_proc_jobq_buf, *pv_entropy_jobq_buf; 2190 2191 /** 2192 * Job Queue mem tab size 2193 */ 2194 WORD32 i4_proc_jobq_buf_size, i4_entropy_jobq_buf_size; 2195 2196 /** 2197 * Memory for svc_au_data buffer manager 2198 */ 2199 void *pv_svc_au_data_store_mgr_base; 2200 2201 /** 2202 * svc_au_data buffer manager 2203 */ 2204 void *pv_svc_au_data_store_mgr; 2205 2206 /** 2207 * Pointer to svc_au_data structure array 2208 */ 2209 svc_au_data_t *ps_svc_au_data; 2210 2211 /** 2212 * Base address for svc_au_data 2213 */ 2214 svc_au_data_t *ps_svc_au_data_base; 2215 2216 /** 2217 * svc_au_data size 2218 */ 2219 WORD32 i4_svc_au_data_size; 2220 2221 /** 2222 * Memory for Picture buffer manager for reference pictures 2223 */ 2224 void *pv_ref_buf_mgr_base; 2225 2226 /** 2227 * Picture buffer manager for reference pictures 2228 */ 2229 void *pv_ref_buf_mgr; 2230 2231 /** 2232 * Number of reference buffers added to the buffer manager 2233 */ 2234 WORD32 i4_ref_buf_cnt; 2235 2236 /** 2237 * Pointer to Pic Buf structure array 2238 */ 2239 svc_au_buf_t *ps_pic_buf; 2240 2241 /** 2242 * Base address for Picture buffer 2243 */ 2244 svc_au_buf_t *ps_pic_buf_base; 2245 2246 /** 2247 * Total pic buffer size allocated 2248 */ 2249 WORD32 i4_total_pic_buf_size; 2250 2251 /** 2252 * Memory for Buffer manager for output buffers 2253 */ 2254 void *pv_out_buf_mgr_base; 2255 2256 /** 2257 * Buffer manager for output buffers 2258 */ 2259 void *pv_out_buf_mgr; 2260 2261 /** 2262 * Current output buffer's buffer ID 2263 */ 2264 WORD32 i4_out_buf_id; 2265 2266 /** 2267 * Number of output buffers added to the buffer manager 2268 */ 2269 WORD32 i4_out_buf_cnt; 2270 2271 /** 2272 * Memory for Picture buffer manager for input buffers 2273 */ 2274 void *pv_inp_buf_mgr_base; 2275 2276 /** 2277 * Picture buffer manager for input buffers 2278 */ 2279 void *pv_inp_buf_mgr; 2280 2281 /** 2282 * Current input buffer's buffer ID 2283 */ 2284 WORD32 i4_inp_buf_id; 2285 2286 /** 2287 * Number of input buffers added to the buffer manager 2288 */ 2289 WORD32 i4_inp_buf_cnt; 2290 2291 /** 2292 * Pointer to dpb manager structure 2293 */ 2294 void *pv_dpb_mgr; 2295 2296 /** 2297 * Pointer to base of Sequence parameter set structure array 2298 */ 2299 sps_t *ps_sps_base; 2300 2301 /** 2302 * Pointer to base of Picture parameter set structure array 2303 */ 2304 pps_t *ps_pps_base; 2305 2306 /** 2307 * Pointer to base of svc_nalu_ext structure array 2308 */ 2309 svc_nalu_ext_t *ps_svc_nalu_ext_base; 2310 2311 /** 2312 * Pointer to base of subset sequence parameter set structure array 2313 */ 2314 subset_sps_t *ps_subset_sps_base; 2315 2316 /** 2317 * Pointer to base of slice header structure array 2318 */ 2319 slice_header_t *ps_slice_hdr_base; 2320 2321 /** 2322 * Pointer to base of SVC slice header structure array 2323 */ 2324 svc_slice_header_t *ps_svc_slice_hdr_base; 2325 2326 /** 2327 * packed residue coeff data size for 1 row of mbs 2328 */ 2329 UWORD32 u4_size_coeff_data; 2330 2331 /** 2332 * packed header data size for 1 row of mbs 2333 */ 2334 UWORD32 u4_size_header_data; 2335 2336 /** 2337 * Processing context - One for each processing thread 2338 * Create two sets, each set used for alternate frames 2339 */ 2340 isvce_process_ctxt_t as_process[MAX_PROCESS_CTXT]; 2341 2342 /** 2343 * Thread handle for each of the processing threads 2344 */ 2345 void *apv_proc_thread_handle[MAX_PROCESS_THREADS]; 2346 2347 /** 2348 * Thread created flag for each of the processing threads 2349 */ 2350 WORD32 ai4_process_thread_created[MAX_PROCESS_THREADS]; 2351 2352 /** 2353 * Void pointer to process job context 2354 */ 2355 void *pv_proc_jobq, *pv_entropy_jobq; 2356 2357 /** 2358 * Number of MBs processed together for better instruction cache handling 2359 */ 2360 WORD32 i4_proc_nmb; 2361 2362 /** 2363 * Previous POC lsb 2364 */ 2365 WORD32 i4_prev_poc_lsb; 2366 2367 /** 2368 * Previous POC msb 2369 */ 2370 WORD32 i4_prev_poc_msb; 2371 2372 /** 2373 * Max POC lsb that has arrived till now 2374 */ 2375 WORD32 i4_max_prev_poc_lsb; 2376 2377 /** 2378 * Context for format conversion 2379 */ 2380 fmt_conv_t s_fmt_conv; 2381 2382 /** 2383 * Absolute pic order count 2384 */ 2385 WORD32 i4_abs_pic_order_cnt; 2386 2387 /** 2388 * Pic order count of lsb 2389 */ 2390 WORD32 i4_pic_order_cnt_lsb; 2391 2392 /** 2393 * Array giving current picture being processed in each context set 2394 */ 2395 WORD32 ai4_pic_cnt[MAX_CTXT_SETS]; 2396 2397 /* 2398 * Min sad to search for 2399 */ 2400 UWORD32 u4_min_sad; 2401 2402 /** 2403 * Reference picture set 2404 */ 2405 isvce_ref_set_t as_ref_set[MAX_DPB_SIZE + MAX_CTXT_SETS]; 2406 2407 /* 2408 * Air pic cnt 2409 * Contains the number of pictures that have been encoded with air 2410 * This value is moudulo air refresh period 2411 */ 2412 WORD32 i4_air_pic_cnt; 2413 2414 /* 2415 * Intra refresh map 2416 * Stores the frames at which intra refresh should occur for a MB 2417 */ 2418 UWORD16 *pu2_intr_rfrsh_map; 2419 2420 /* 2421 * Indicates if the current frame is used as a reference frame 2422 */ 2423 UWORD32 u4_is_curr_frm_ref; 2424 2425 /* 2426 * Indicates if there can be non reference frames in the stream 2427 */ 2428 WORD32 i4_non_ref_frames_in_stream; 2429 2430 /* 2431 * Memory for color space conversion for luma plane 2432 */ 2433 UWORD8 *pu1_y_csc_buf_base; 2434 2435 /* 2436 * Memory for color space conversion foe chroma plane 2437 */ 2438 UWORD8 *pu1_uv_csc_buf_base; 2439 2440 /** 2441 * Function pointers for intra pred leaf level functions luma 2442 */ 2443 pf_intra_pred apf_intra_pred_16_l[MAX_I16x16]; 2444 pf_intra_pred apf_intra_pred_8_l[MAX_I8x8]; 2445 pf_intra_pred apf_intra_pred_4_l[MAX_I4x4]; 2446 2447 /** 2448 * Function pointers for intra pred leaf level functions chroma 2449 */ 2450 pf_intra_pred apf_intra_pred_c[MAX_CH_I8x8]; 2451 2452 /** 2453 * deblock vertical luma edge with blocking strength 4 2454 */ 2455 ih264_deblk_edge_bs4_ft *pf_deblk_luma_vert_bs4; 2456 2457 /** 2458 * deblock vertical chroma edge with blocking strength 4 2459 */ 2460 ih264_deblk_chroma_edge_bs4_ft *pf_deblk_chroma_vert_bs4; 2461 2462 /** 2463 * deblock vertical luma edge with blocking strength less than 4 2464 */ 2465 ih264_deblk_edge_bslt4_ft *pf_deblk_luma_vert_bslt4; 2466 2467 /** 2468 * deblock vertical chroma edge with blocking strength less than 4 2469 */ 2470 ih264_deblk_chroma_edge_bslt4_ft *pf_deblk_chroma_vert_bslt4; 2471 2472 /** 2473 * deblock horizontal luma edge with blocking strength 4 2474 */ 2475 ih264_deblk_edge_bs4_ft *pf_deblk_luma_horz_bs4; 2476 2477 /** 2478 * deblock horizontal chroma edge with blocking strength 4 2479 */ 2480 ih264_deblk_chroma_edge_bs4_ft *pf_deblk_chroma_horz_bs4; 2481 2482 /** 2483 * deblock horizontal luma edge with blocking strength less than 4 2484 */ 2485 ih264_deblk_edge_bslt4_ft *pf_deblk_luma_horz_bslt4; 2486 2487 /** 2488 * deblock horizontal chroma edge with blocking strength less than 4 2489 */ 2490 ih264_deblk_chroma_edge_bslt4_ft *pf_deblk_chroma_horz_bslt4; 2491 2492 /** 2493 * functions for padding 2494 */ 2495 pf_pad pf_pad_top; 2496 pf_pad pf_pad_bottom; 2497 pf_pad pf_pad_left_luma; 2498 pf_pad pf_pad_left_chroma; 2499 pf_pad pf_pad_right_luma; 2500 pf_pad pf_pad_right_chroma; 2501 2502 /** 2503 * fn ptrs for compute sad routines 2504 */ 2505 ime_compute_sad_ft *apf_compute_sad_16x16[2]; 2506 ime_compute_sad_ft *pf_compute_sad_16x8; 2507 2508 /** 2509 * Function pointer for computing ME 2510 * 1 for PSLICE and 1 for BSLICE 2511 */ 2512 FT_ME_ALGORITHM *apf_compute_me[2]; 2513 2514 /** 2515 * Function pointers for computing SKIP parameters 2516 */ 2517 FT_FIND_SKIP_PARAMS *apf_find_skip_params_me[2]; 2518 2519 /** 2520 * intra mode eval -encoder level function 2521 */ 2522 pf_evaluate_intra_modes pf_ih264e_evaluate_intra16x16_modes; 2523 pf_evaluate_intra_modes pf_ih264e_evaluate_intra_chroma_modes; 2524 pf_evaluate_intra_4x4_modes pf_ih264e_evaluate_intra_4x4_modes; 2525 2526 /* Half pel generation function - encoder level 2527 * 2528 */ 2529 pf_sixtapfilter_horz pf_ih264e_sixtapfilter_horz; 2530 pf_sixtap_filter_2dvh_vert pf_ih264e_sixtap_filter_2dvh_vert; 2531 2532 /** 2533 * color space conversion from YUV 420P to YUV 420Sp 2534 */ 2535 pf_fmt_conv_420p_to_420sp pf_ih264e_conv_420p_to_420sp; 2536 2537 /** 2538 * color space conversion from YUV 420P to YUV 420Sp 2539 */ 2540 pf_fmt_conv_422ile_to_420sp pf_ih264e_fmt_conv_422i_to_420sp; 2541 2542 /** 2543 * write mb layer for a given slice I, P, B 2544 */ 2545 IH264E_ERROR_T (*pf_write_mb_syntax_layer[2][3])(isvce_entropy_ctxt_t *ps_ent_ctxt); 2546 2547 /** 2548 * Output buffer 2549 */ 2550 isvce_out_buf_t as_out_buf[MAX_CTXT_SETS]; 2551 2552 /** 2553 * recon buffer 2554 */ 2555 isvce_rec_buf_t as_rec_buf[MAX_CTXT_SETS]; 2556 2557 /** 2558 * rate control context 2559 */ 2560 isvce_rate_control_ctxt_t s_rate_control; 2561 2562 /** 2563 * input buffer queue 2564 */ 2565 isvce_inp_buf_t as_inp_list[SVC_MAX_NUM_INP_FRAMES]; 2566 2567 /** 2568 * Flag to indicate if any IDR requests are pending 2569 */ 2570 WORD32 i4_pending_idr_flag; 2571 2572 /** 2573 *Flag to indicate if we have recived the last input frame 2574 */ 2575 WORD32 i4_last_inp_buff_received; 2576 2577 /* 2578 * Max num reference frames to be signaled in SPS 2579 */ 2580 WORD32 i4_max_num_reference_frames; 2581 2582 /** 2583 * backup sei params for comparison 2584 */ 2585 sei_params_t s_sei; 2586 } isvce_codec_t; 2587 2588 #endif 2589