1 /****************************************************************************** 2 * 3 * Copyright (C) 2018 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 ihevce_me_common_defs.h 24 * 25 * @brief 26 * This file contains structures and interface prototypes for header encoding 27 * 28 * @author 29 * Ittiam 30 ****************************************************************************** 31 */ 32 33 #ifndef _IHEVCE_ME_COMMON_DEFS_H_ 34 #define _IHEVCE_ME_COMMON_DEFS_H_ 35 36 /****************************************************************************/ 37 /* Constant Macros */ 38 /****************************************************************************/ 39 /** 40 ******************************************************************************* 41 @brief We basically store an impossible and unique MV to identify intra blks 42 or CUs 43 ******************************************************************************* 44 */ 45 #define INTRA_MV 0x4000 46 /** 47 ******************************************************************************* 48 @brief MAX INT VAL is defined as follows so that adding the four candidates, 49 still will be a positive value 50 ******************************************************************************* 51 */ 52 #define MAX_INT_VAL (0x7FFFFFF) 53 54 /** 55 ******************************************************************************* 56 @brief Max number of results stored in search result str (per partition) during 57 refinement search. Needed for memory allocation purposes 58 ******************************************************************************* 59 */ 60 #define MAX_REFINE_RESULTS 4 61 62 /** 63 ******************************************************************************* 64 @brief Maximum number of partitions in a CU (NxN case) 65 ******************************************************************************* 66 */ 67 #define MAX_NUM_PARTS 4 68 69 /** As min CU size is 8, there can only be two partitions in a CU */ 70 #define MAX_NUM_INTER_PARTS 2 71 72 /* 4 for the num of REF and 2 for num_results_per_part */ 73 #define MAX_NUM_RESULTS_PER_PART_LIST 8 74 75 #define MAX_NUM_RESULTS_PER_PART 2 76 77 #define MAX_NUM_REF 12 78 79 #define NUM_BEST_ME_OUTPUTS 4 80 81 #define MAX_NUM_CLUSTERS_IN_ONE_REF_IDX 5 82 83 /* Assumption is (MAX_NUM_CANDS_BESTUNI >= MAX_NUM_CANDS_BESTALT) */ 84 #define MAX_NUM_CANDS_BESTUNI 10 85 86 #define MAX_NUM_CANDS_BESTALT 10 87 88 #define MAX_NUM_MERGE_CANDTS 4 * (3 * MAX_NUM_CLUSTERS_IN_ONE_REF_IDX + 2 * MAX_NUM_CANDS_BESTUNI) 89 90 #define MAX_NUM_CLUSTERS_16x16 8 91 92 #define MAX_NUM_CLUSTERS_32x32 10 93 94 #define MAX_NUM_CLUSTERS_64x64 10 95 96 #define MAX_DISTANCE_FROM_CENTROID_16x16 4 97 98 #define MAX_DISTANCE_FROM_CENTROID_32x32 8 99 100 #define MAX_DISTANCE_FROM_CENTROID_64x64 16 101 102 #define MAX_DISTANCE_FROM_CENTROID_16x16_B 4 103 104 #define MAX_DISTANCE_FROM_CENTROID_32x32_B 8 105 106 #define MAX_DISTANCE_FROM_CENTROID_64x64_B 16 107 108 #define MAX_NUM_CLUSTERS_IN_VALID_16x16_BLK 3 109 110 #define MAX_NUM_CLUSTERS_IN_VALID_32x32_BLK 5 111 112 #define MAX_NUM_CLUSTERS_IN_VALID_64x64_BLK 5 113 114 #define ALL_INTER_COST_DIFF_THR 10 115 116 #define MAX_INTRA_PERCENTAGE 25 117 118 #define CLUSTER_DATA_DUMP 0 119 120 #define DISABLE_INTER_CANDIDATES 0 121 122 #define ENABLE_4CTB_EVALUATION 1 123 124 #define USE_2N_NBR 1 125 126 #define USE_CLUSTER_DATA_AS_BLK_MERGE_CANDTS 0 127 128 #define MAX_REFS_SEARCHABLE MAX_NUM_REF 129 130 #define DEBUG_TRACE_ENABLE 0 131 132 #define DISABLE_INTRA_IN_BPICS 1 133 134 #define DISABLE_L0_IPE_INTRA_IN_BPICS 1 135 136 #define DISABLE_L2_IPE_INTRA_IN_BPICS 0 137 138 #define DISABLE_L2_IPE_INTRA_IN_IPBPICS 0 139 140 #define DISABLE_L1_L2_IPE_INTRA_IN_BPICS 1 141 142 #define RC_DEPENDENCY_FOR_BPIC 1 143 144 #define DISABLE_L1_L2_IPE_INTRA_IN_IPBPICS 0 145 146 #define DISABLE_L2_IPE_IN_IPB_L1_IN_B 0 147 148 #define DISABLE_L2_IPE_IN_PB_L1_IN_B 1 149 150 #define DISBLE_CHILD_CU_EVAL_L0_IPE 0 151 152 #define FORCE_NXN_MODE_BASED_ON_OL_IPE 0 153 154 #define TEMPORAL_LAYER_DISABLE 0 155 156 #define COARSE_ME_OPT 1 157 158 #define NUM_RESULTS_TO_EXPORT_MS 3 159 160 #define NUM_RESULTS_TO_EXPORT_HS NUM_BEST_ME_OUTPUTS 161 162 #define NUM_RESULTS_TO_EXPORT_XS 2 163 164 #define DISABLE_MERGE 0 165 166 #define INTERP_OUT_BUF_SIZE (64 * 64) 167 168 /* NUM_BEST_ME_OUTPUTS - Maximum possible TU Recursion candidates */ 169 /* 2 - Required for Hadamard Transform coefficients */ 170 /* 2 - Required in 'hme_compute_pred_and_evaluate_bi' */ 171 /* 5 of these are also used in 'hme_subpel_refine_cu_hs' */ 172 #define MAX_NUM_PRED_BUFS_USED_FOR_PARTTYPE_DECISIONS (NUM_BEST_ME_OUTPUTS) + 2 + 2 173 174 #define MAX_WKG_MEM_SIZE_PER_THREAD \ 175 (MAX_NUM_PRED_BUFS_USED_FOR_PARTTYPE_DECISIONS) * (INTERP_OUT_BUF_SIZE) 176 177 /** 178 ****************************************************************************** 179 * @macro OLD_XTREME_SPEED 180 * @brief Reverts the changes back to older Xtreme speed model 181 ****************************************************************************** 182 */ 183 #define OLD_XTREME_SPEED 0 184 #define OLD_HIGH_SPEED 0 185 186 /** 187 ****************************************************************************** 188 * @macro BIT_EN 189 * @brief Enables the bit at a given bit position 190 ****************************************************************************** 191 */ 192 #define BIT_EN(x) (1 << (x)) 193 194 /** 195 ****************************************************************************** 196 * @macros ENABLE_mxn 197 * @brief Enables a type or a group of partitions. ENABLE_ALL_PARTS, enables all 198 * partitions, while others enable selected partitions. These can be used 199 * to set the mask of active partitions 200 ****************************************************************************** 201 */ 202 #define ENABLE_2Nx2N (BIT_EN(PART_ID_2Nx2N)) 203 #define ENABLE_2NxN (BIT_EN(PART_ID_2NxN_T) | BIT_EN(PART_ID_2NxN_B)) 204 #define ENABLE_Nx2N (BIT_EN(PART_ID_Nx2N_L) | BIT_EN(PART_ID_Nx2N_R)) 205 #define ENABLE_NxN \ 206 (BIT_EN(PART_ID_NxN_TL) | BIT_EN(PART_ID_NxN_TR) | BIT_EN(PART_ID_NxN_BL) | \ 207 BIT_EN(PART_ID_NxN_BR)) 208 #define ENABLE_2NxnU (BIT_EN(PART_ID_2NxnU_T) | BIT_EN(PART_ID_2NxnU_B)) 209 #define ENABLE_2NxnD (BIT_EN(PART_ID_2NxnD_T) | BIT_EN(PART_ID_2NxnD_B)) 210 #define ENABLE_nLx2N (BIT_EN(PART_ID_nLx2N_L) | BIT_EN(PART_ID_nLx2N_R)) 211 #define ENABLE_nRx2N (BIT_EN(PART_ID_nRx2N_L) | BIT_EN(PART_ID_nRx2N_R)) 212 #define ENABLE_AMP ((ENABLE_2NxnU) | (ENABLE_2NxnD) | (ENABLE_nLx2N) | (ENABLE_nRx2N)) 213 #define ENABLE_ALL_PARTS \ 214 ((ENABLE_2Nx2N) | (ENABLE_NxN) | (ENABLE_2NxN) | (ENABLE_Nx2N) | (ENABLE_AMP)) 215 216 #define DISABLE_THE_CHILDREN_NODES(ps_parent_node) \ 217 { \ 218 (ps_parent_node)->ps_child_node_tl->is_node_valid = 0; \ 219 (ps_parent_node)->ps_child_node_tr->is_node_valid = 0; \ 220 (ps_parent_node)->ps_child_node_bl->is_node_valid = 0; \ 221 (ps_parent_node)->ps_child_node_br->is_node_valid = 0; \ 222 } 223 224 #define NULLIFY_THE_CHILDREN_NODES(ps_parent_node) \ 225 { \ 226 (ps_parent_node)->ps_child_node_tl = NULL; \ 227 (ps_parent_node)->ps_child_node_tr = NULL; \ 228 (ps_parent_node)->ps_child_node_bl = NULL; \ 229 (ps_parent_node)->ps_child_node_br = NULL; \ 230 } 231 232 #define DISABLE_ALL_KIN_OF_64x64_NODE(ps_tree_root) \ 233 { \ 234 DISABLE_THE_CHILDREN_NODES((ps_tree_root)); \ 235 DISABLE_THE_CHILDREN_NODES((ps_tree_root)->ps_child_node_tl); \ 236 DISABLE_THE_CHILDREN_NODES((ps_tree_root)->ps_child_node_tr); \ 237 DISABLE_THE_CHILDREN_NODES((ps_tree_root)->ps_child_node_bl); \ 238 DISABLE_THE_CHILDREN_NODES((ps_tree_root)->ps_child_node_br); \ 239 DISABLE_THE_CHILDREN_NODES((ps_tree_root)->ps_child_node_tl->ps_child_node_tl); \ 240 DISABLE_THE_CHILDREN_NODES((ps_tree_root)->ps_child_node_tl->ps_child_node_tr); \ 241 DISABLE_THE_CHILDREN_NODES((ps_tree_root)->ps_child_node_tl->ps_child_node_bl); \ 242 DISABLE_THE_CHILDREN_NODES((ps_tree_root)->ps_child_node_tl->ps_child_node_br); \ 243 DISABLE_THE_CHILDREN_NODES((ps_tree_root)->ps_child_node_tr->ps_child_node_tl); \ 244 DISABLE_THE_CHILDREN_NODES((ps_tree_root)->ps_child_node_tr->ps_child_node_tr); \ 245 DISABLE_THE_CHILDREN_NODES((ps_tree_root)->ps_child_node_tr->ps_child_node_bl); \ 246 DISABLE_THE_CHILDREN_NODES((ps_tree_root)->ps_child_node_tr->ps_child_node_br); \ 247 DISABLE_THE_CHILDREN_NODES((ps_tree_root)->ps_child_node_bl->ps_child_node_tl); \ 248 DISABLE_THE_CHILDREN_NODES((ps_tree_root)->ps_child_node_bl->ps_child_node_tr); \ 249 DISABLE_THE_CHILDREN_NODES((ps_tree_root)->ps_child_node_bl->ps_child_node_bl); \ 250 DISABLE_THE_CHILDREN_NODES((ps_tree_root)->ps_child_node_bl->ps_child_node_br); \ 251 DISABLE_THE_CHILDREN_NODES((ps_tree_root)->ps_child_node_br->ps_child_node_tl); \ 252 DISABLE_THE_CHILDREN_NODES((ps_tree_root)->ps_child_node_br->ps_child_node_tr); \ 253 DISABLE_THE_CHILDREN_NODES((ps_tree_root)->ps_child_node_br->ps_child_node_bl); \ 254 DISABLE_THE_CHILDREN_NODES((ps_tree_root)->ps_child_node_br->ps_child_node_br); \ 255 } 256 257 #define DISABLE_ALL_KIN_OF_32x32_NODE(ps_tree_root) \ 258 { \ 259 DISABLE_THE_CHILDREN_NODES((ps_tree_root)); \ 260 DISABLE_THE_CHILDREN_NODES((ps_tree_root)->ps_child_node_tl); \ 261 DISABLE_THE_CHILDREN_NODES((ps_tree_root)->ps_child_node_tr); \ 262 DISABLE_THE_CHILDREN_NODES((ps_tree_root)->ps_child_node_bl); \ 263 DISABLE_THE_CHILDREN_NODES((ps_tree_root)->ps_child_node_br); \ 264 } 265 266 #define ENABLE_THE_CHILDREN_NODES(ps_parent_node) \ 267 { \ 268 (ps_parent_node)->ps_child_node_tl->is_node_valid = 1; \ 269 (ps_parent_node)->ps_child_node_tr->is_node_valid = 1; \ 270 (ps_parent_node)->ps_child_node_bl->is_node_valid = 1; \ 271 (ps_parent_node)->ps_child_node_br->is_node_valid = 1; \ 272 } 273 274 #define CLIP_MV_WITHIN_RANGE( \ 275 x, y, range, fpel_refine_extent, hpel_refine_extent, qpel_refine_extent) \ 276 { \ 277 WORD16 i4_range_erosion_metric; \ 278 \ 279 i4_range_erosion_metric = \ 280 ((fpel_refine_extent) << 2) + ((hpel_refine_extent) << 1) + (qpel_refine_extent); \ 281 i4_range_erosion_metric += 2; \ 282 i4_range_erosion_metric >>= 2; \ 283 \ 284 if((x) > ((range)->i2_max_x - i4_range_erosion_metric)) \ 285 (x) = ((range)->i2_max_x - i4_range_erosion_metric); \ 286 if((x) < ((range)->i2_min_x + i4_range_erosion_metric)) \ 287 (x) = ((range)->i2_min_x + i4_range_erosion_metric); \ 288 if((y) > ((range)->i2_max_y - i4_range_erosion_metric)) \ 289 (y) = ((range)->i2_max_y - i4_range_erosion_metric); \ 290 if((y) < ((range)->i2_min_y + i4_range_erosion_metric)) \ 291 (y) = ((range)->i2_min_y + i4_range_erosion_metric); \ 292 } 293 294 /****************************************************************************/ 295 /* Enumerations */ 296 /****************************************************************************/ 297 /** 298 299 300 ****************************************************************************** 301 * @enum CU_SIZE_T 302 * @brief Enumerates all possible CU sizes (8x8 to 64x64) 303 ****************************************************************************** 304 */ 305 typedef enum 306 { 307 CU_INVALID = -1, 308 CU_8x8 = 0, 309 CU_16x16, 310 CU_32x32, 311 CU_64x64, 312 NUM_CU_SIZES 313 } CU_SIZE_T; 314 315 /** 316 ****************************************************************************** 317 * @enum PART_TYPE_T 318 * @brief Defines all possible partition splits within a inter CU 319 ****************************************************************************** 320 */ 321 typedef enum 322 { 323 PRT_INVALID = -1, 324 PRT_2Nx2N = 0, 325 PRT_2NxN, 326 PRT_Nx2N, 327 PRT_NxN, 328 PRT_2NxnU, 329 PRT_2NxnD, 330 PRT_nLx2N, 331 PRT_nRx2N, 332 MAX_PART_TYPES 333 } PART_TYPE_T; 334 335 /** 336 ****************************************************************************** 337 * @enum PART_ID_T 338 * @brief Defines all possible partition ids within a inter CU 339 ****************************************************************************** 340 */ 341 typedef enum 342 { 343 PART_ID_INVALID = -1, 344 PART_ID_2Nx2N = 0, 345 /* These 2 belong to 2NxN Part */ 346 PART_ID_2NxN_T = 1, 347 PART_ID_2NxN_B = 2, 348 /* These 2 belong to Nx2N */ 349 PART_ID_Nx2N_L = 3, 350 PART_ID_Nx2N_R = 4, 351 352 /* 4 partitions of NxN */ 353 PART_ID_NxN_TL = 5, 354 PART_ID_NxN_TR = 6, 355 PART_ID_NxN_BL = 7, 356 PART_ID_NxN_BR = 8, 357 358 /*************************************************************************/ 359 /* ________ */ 360 /* |________|-->2NxnU_T */ 361 /* | | */ 362 /* | |-->2NxnU_B */ 363 /* |________| */ 364 /*************************************************************************/ 365 PART_ID_2NxnU_T = 9, 366 PART_ID_2NxnU_B = 10, 367 368 /*************************************************************************/ 369 /* ________ */ 370 /* | | */ 371 /* | |-->2NxnD_T */ 372 /* |________| */ 373 /* |________|-->2NxnD_B */ 374 /*************************************************************************/ 375 PART_ID_2NxnD_T = 11, 376 PART_ID_2NxnD_B = 12, 377 378 /*************************************************************************/ 379 /* ________ */ 380 /* | | | */ 381 /* | | |-->nLx2N_R */ 382 /* | | | */ 383 /* |_|______| */ 384 /* | */ 385 /* v */ 386 /* nLx2N_L */ 387 /*************************************************************************/ 388 PART_ID_nLx2N_L = 13, 389 PART_ID_nLx2N_R = 14, 390 391 /*************************************************************************/ 392 /* ________ */ 393 /* | | | */ 394 /* | | |-->nRx2N_R */ 395 /* | | | */ 396 /* |______|_| */ 397 /* | */ 398 /* v */ 399 /* nRx2N_L */ 400 /*************************************************************************/ 401 /* AMP 12x16 and 4x16 split */ 402 PART_ID_nRx2N_L = 15, 403 PART_ID_nRx2N_R = 16, 404 TOT_NUM_PARTS = 17 405 } PART_ID_T; 406 407 /** 408 ****************************************************************************** 409 * @enum CU_POS_T 410 * @brief Position of a block wrt its parent in the CU tree 411 ****************************************************************************** 412 */ 413 typedef enum 414 { 415 POS_NA = -1, 416 POS_TL = 0, 417 POS_TR = 1, 418 POS_BL = 2, 419 POS_BR = 3 420 } CU_POS_T; 421 422 typedef CU_POS_T TU_POS_T; 423 424 /****************************************************************************/ 425 /* Structures */ 426 /****************************************************************************/ 427 428 /** 429 ****************************************************************************** 430 * @struct range_prms_t 431 * @brief Indicates valid range of MV for a given blk/cu/ctb 432 ****************************************************************************** 433 */ 434 typedef struct 435 { 436 /** Min x value possible, precision inferred from context */ 437 WORD16 i2_min_x; 438 /** Max x value possible, precision inferred from context */ 439 WORD16 i2_max_x; 440 /** Min y value possible, precision inferred from context */ 441 WORD16 i2_min_y; 442 /** Max y value possible, precision inferred from context */ 443 WORD16 i2_max_y; 444 } range_prms_t; 445 446 /** 447 ****************************************************************************** 448 * MACRO for enabling Dynamical Vertical Search Range Support 449 * Note : Should be always 1, else part is not supported 450 ****************************************************************************** 451 */ 452 #define DVSR_CHANGES 1 453 454 /** 455 ****************************************************************************** 456 * @struct dyn_range_prms_t 457 * @brief Indicates Dynamic search range for a given blk/cu/ctb 458 ****************************************************************************** 459 */ 460 typedef struct 461 { 462 /** Min x value possible */ 463 //WORD16 i2_dyn_min_x; 464 /** Max x value possible */ 465 //WORD16 i2_dyn_max_x; 466 /** Min y value possible */ 467 WORD16 i2_dyn_min_y; 468 /** Max y value possible */ 469 WORD16 i2_dyn_max_y; 470 471 /** Pic order count */ 472 WORD32 i4_poc; 473 474 } dyn_range_prms_t; 475 476 /** 477 ****************************************************************************** 478 * @macro INIT_DYN_SEARCH_PRMS 479 * @brief Initializes this dyn_range_prms_t structure. Can be used to zero 480 * out the range 481 ****************************************************************************** 482 */ 483 #define INIT_DYN_SEARCH_PRMS(x, ref_poc) \ 484 { \ 485 (x)->i2_dyn_min_y = 0; \ 486 (x)->i2_dyn_max_y = 0; \ 487 (x)->i4_poc = ref_poc; \ 488 } 489 490 typedef struct 491 { 492 WORD16 mvx; 493 494 WORD16 mvy; 495 496 /* 0=>mv is not a part of bi-pred mv */ 497 /* 1=>inverse of case 0 */ 498 UWORD8 is_uni; 499 500 WORD16 pixel_count; 501 502 WORD32 sdi; 503 504 } mv_data_t; 505 506 /** 507 ****************************************************************************** 508 * @brief This struct is stores the search result for a prediction unit (PU) 509 ****************************************************************************** 510 */ 511 512 typedef struct 513 { 514 /** 515 * PU attributes likes mvs, refids, pred mode, wdt, heigt, ctbx/y offsets etc 516 */ 517 pu_t pu; 518 519 /* mv cost for this pu */ 520 WORD32 i4_mv_cost; 521 522 /* total cost for this pu */ 523 WORD32 i4_tot_cost; 524 525 WORD32 i4_sdi; 526 } pu_result_t; 527 528 /** 529 ****************************************************************************** 530 * @brief This struct is stores the search result for partition type of CU 531 ****************************************************************************** 532 */ 533 typedef struct 534 { 535 /** part results for a part type */ 536 pu_result_t as_pu_results[MAX_NUM_INTER_PARTS]; 537 538 UWORD8 *pu1_pred; 539 540 WORD32 i4_pred_stride; 541 542 /* total cost for part type */ 543 WORD32 i4_tot_cost; 544 545 /* TU split flag : tu_split_flag[0] represents the transform splits 546 * for CU size <= 32, for 64x64 each ai4_tu_split_flag corresponds 547 * to respective 32x32 */ 548 /* For a 8x8 TU - 1 bit used to indicate split */ 549 /* For a 16x16 TU - LSB used to indicate winner between 16 and 8 TU's. 4 other bits used to indicate split in each 8x8 quadrant */ 550 /* For a 32x32 TU - See above */ 551 WORD32 ai4_tu_split_flag[4]; 552 553 /* TU early cbf : tu_early_cbf[0] represents the transform splits 554 * for CU size <= 32, for 64x64 each ai4_tu_early_cbf corresponds 555 * to respective 32x32 */ 556 WORD32 ai4_tu_early_cbf[4]; 557 558 /* Populate the tu_split flag cost for the candidates */ 559 WORD32 i4_tu_split_cost; 560 561 /** partition type : shall be one of PART_TYPE_T */ 562 UWORD8 u1_part_type; 563 } part_type_results_t; 564 565 /** 566 ****************************************************************************** 567 * @struct part_results_t 568 * @brief Basic structure used for storage of search results, specification 569 * of init candidates for search etc. This structure is complete for 570 * specification of mv and cost for a given direction of search (L0/L1) but 571 * does not carry information of what type of partition it represents. 572 ****************************************************************************** 573 */ 574 typedef struct 575 { 576 /** Motion vector X component */ 577 WORD16 i2_mv_x; 578 579 /** Motion vector Y component */ 580 WORD16 i2_mv_y; 581 582 /** Ref id, as specified in terms of Lc, unified list */ 583 WORD8 i1_ref_idx; 584 585 /** SAD / SATD stored here */ 586 WORD32 i4_sad; 587 } part_results_t; 588 589 /** 590 ****************************************************************************** 591 * @brief This struct is used for storing output of me search or block merge 592 * and also all of the intermediate results required 593 ****************************************************************************** 594 */ 595 typedef struct 596 { 597 /** 598 * X and y offsets w.r.t. CTB start in encode layers. For non encode 599 * layers, these may typically be 0 600 */ 601 UWORD8 u1_x_off; 602 603 UWORD8 u1_y_off; 604 605 /** cu size as per the CU_SIZE_T enumeration */ 606 UWORD8 u1_cu_size; 607 608 WORD32 i4_inp_offset; 609 610 /** best results of a CU sorted in increasing cost */ 611 part_type_results_t *ps_best_results; 612 613 /** active partition mask for this CU */ 614 WORD32 i4_part_mask; 615 616 /** number of best results mainted for every PU */ 617 UWORD8 u1_num_best_results; 618 619 /** Split flag to indicate whether current CU is split or not */ 620 UWORD8 u1_split_flag; 621 622 } inter_cu_results_t; 623 624 /** 625 ****************************************************************************** 626 * @brief This struct is used for storing input of me search in the form of 627 * pu_results_t structure which is given to hme_decide_part_types as i/p 628 ****************************************************************************** 629 */ 630 typedef struct 631 { 632 /** ptrs to multiple pu results of a CU. Can be seperated out as seperate structure*/ 633 pu_result_t *aps_pu_results[2][TOT_NUM_PARTS]; 634 635 /** max number of best results mainted for a partition in L0*/ 636 UWORD8 u1_num_results_per_part_l0[TOT_NUM_PARTS]; 637 638 /** max number of best results mainted for a partition in L*/ 639 UWORD8 u1_num_results_per_part_l1[TOT_NUM_PARTS]; 640 } inter_pu_results_t; 641 642 /** 643 ****************************************************************************** 644 * @struct me_results_16x16_t 645 * @brief Contains complete search result for a CU for a given type of 646 * partition split. Holds ptrs to results for each partition, with 647 * information of partition type. 648 ****************************************************************************** 649 */ 650 typedef struct 651 { 652 /** 653 * X and y offsets w.r.t. CTB start in encode layers. For non encode 654 * layers, these may typically be 0 655 */ 656 UWORD8 u1_x_off; 657 658 UWORD8 u1_y_off; 659 660 /** 661 * Type of partition that the CU is split into, for which this 662 * result is relevant 663 */ 664 PART_TYPE_T e_part_type; 665 666 /** 667 * Pointer to results of each individual partitions. Note that max 668 * number of partitions a CU can be split into is MAX_NUM_PARTS 669 * 3 => L0 best, L1 best and best across L0 and L1 670 */ 671 part_results_t as_part_result[MAX_NUM_PARTS][3]; 672 673 /* Contains the best uni dir for each partition type */ 674 /* enabled for this 16x16 block */ 675 WORD32 ai4_best_uni_dir[MAX_NUM_PARTS]; 676 677 /* Contains the best pred dir for each partition type */ 678 /* enabled for this 16x16 block */ 679 WORD32 ai4_best_pred_dir[MAX_NUM_PARTS]; 680 } me_results_16x16_t; 681 682 /** 683 ****************************************************************************** 684 * @struct me_results_8x8_t 685 * @brief Contains complete search result for a CU for a given type of 686 * partition split. Holds ptrs to results for each partition, with 687 * information of partition type. 688 * @assumptions e_part_type is always PRT_2Nx2N 689 ****************************************************************************** 690 */ 691 typedef struct 692 { 693 /** 694 * X and y offsets w.r.t. CTB start in encode layers. For non encode 695 * layers, these may typically be 0 696 */ 697 UWORD8 u1_x_off; 698 699 UWORD8 u1_y_off; 700 701 /** 702 * Type of partition that the CU is split into, for which this 703 * result is relevant 704 */ 705 PART_TYPE_T e_part_type; 706 707 /** 708 * Pointer to results of each individual partitions. Note that max 709 * number of partitions a CU can be split into is MAX_NUM_PARTS 710 * 3 => L0 best, L1 best and best across L0 and L1 711 */ 712 part_results_t as_part_result[2]; 713 714 /* Contains the best uni dir for each partition type */ 715 /* enabled for this 16x16 block */ 716 WORD32 i4_best_uni_dir; 717 718 /* Contains the best pred dir for each partition type */ 719 /* enabled for this 16x16 block */ 720 WORD32 i4_best_pred_dir; 721 } me_results_8x8_t; 722 723 /** 724 ****************************************************************************** 725 * @struct cluster_mv_list_t 726 * @brief Contains data computed by the clustering algorithm 727 ****************************************************************************** 728 */ 729 typedef struct 730 { 731 mv_t as_mv[MAX_NUM_MERGE_CANDTS]; 732 733 WORD32 num_mvs; 734 735 } cluster_mv_list_t; 736 737 /** 738 ****************************************************************************** 739 * @struct qpel_input_buf_cfg_t 740 * @brief For QPEL averaging, this descriptor (typically outcome of lookup) 741 * contains info related to the 2 fpel/hpel planes that are to be 742 * averaged along wiht the exact offsets 743 ****************************************************************************** 744 */ 745 typedef struct 746 { 747 /** id of buf1 for input of averaging: 0-3 */ 748 WORD8 i1_buf_id1; 749 750 /** 751 * x and y offset in buf 1 w.r.t. colocated input point after correcting 752 * for fpel mvx and mvy 753 */ 754 WORD8 i1_buf_xoff1; 755 WORD8 i1_buf_yoff1; 756 757 /** id of buf2 for input of averaging: 0-3 */ 758 WORD8 i1_buf_id2; 759 760 /** 761 * x and y offset in buf 2 w.r.t. colocated input point after correcting 762 * for fpel mvx and mvy 763 */ 764 WORD8 i1_buf_xoff2; 765 WORD8 i1_buf_yoff2; 766 } qpel_input_buf_cfg_t; 767 768 typedef struct 769 { 770 UWORD8 *apu1_pred_bufs[MAX_NUM_PRED_BUFS_USED_FOR_PARTTYPE_DECISIONS]; 771 772 UWORD32 u4_pred_buf_usage_indicator; 773 } hme_pred_buf_mngr_t; 774 775 #endif 776