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