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 #ifndef _ISVCD_MODE_MV_RESAMPLE_H_ 21 #define _ISVCD_MODE_MV_RESAMPLE_H_ 22 23 /** 24 ******************************************************************************* 25 * @file 26 * isvcd_mode_mv_resamp.h 27 * 28 * @brief 29 * Contains routines that resample for SVC resampling 30 * 31 * @author 32 * Kishore 33 * 34 * @remarks 35 * None 36 * 37 ******************************************************************************* 38 */ 39 40 #include "ih264_typedefs.h" 41 #include "ih264_macros.h" 42 #include "ih264_platform_macros.h" 43 #include "isvcd_structs.h" 44 45 #define MAX_NEIGHBORS 3 /*!< left top and top right neighbours */ 46 47 #define LEFT \ 48 0 /*!<Index for accessing the left MB in the \ 49 MV predictor array */ 50 51 #define TOP \ 52 1 /*!< Index for accessing the top MB in the \ 53 MV predictor array */ 54 55 #define TOP_R \ 56 2 /*!< Index for accessing the top right MB \ 57 in the MV predictor array */ 58 59 #define MB_SKIP 255 60 61 typedef void ftype_comp_mode_mv_mb(void *pv_comp_mode_mv_hdl, void *pv_mb_params, 62 void *pv_curr_mb_motion_mem_elements, 63 void *pv_top_mb_motion_mem_elements, WORD32 i4_lyr_id); 64 65 typedef void(ftype_pred_direct)(void *pv_comp_mode_mv_ctxt, void *pv_top_mb_motion_l0, 66 void *pv_top_mb_motion_l1, void *pv_curr_part_motion_pred_l0, 67 void *pv_curr_part_motion_pred_l1, 68 void *pv_curr_part_motion_params_l0, 69 void *pv_curr_part_motion_params_l1, 70 WORD32 i4_curr_mb_motion_stride, WORD32 i4_availability, 71 WORD32 i4_part_width, WORD32 i4_num_mb_parts, 72 UWORD16 u2_col_zero_flag); 73 74 typedef WORD32 ftype_inter_lyr_motion_pred(void *pv_comp_mode_mv_ctxt, void *pv_mb_params, 75 void *pv_svc_mb_params, void *ps_dec, 76 void *ps_mb_part_info, void *pv_part); 77 78 WORD32 isvcd_interlyr_motion_mode_pred_dyadic(void *pv_comp_mode_mv_ctxt, void *pv_mb_params, 79 void *pv_svc_mb_params, void *ps_dec, 80 void *ps_mb_part_info, void *pv_part); 81 82 WORD32 isvcd_compute_interlyr_motion_mode(void *pv_comp_mode_mv_ctxt, void *pv_mb_params, 83 void *pv_svc_mb_params, void *ps_dec, 84 void *ps_mb_part_info, void *pv_part); 85 86 WORD32 isvcd_comp_mode_mv_res_init(void *pv_svc_dec); 87 typedef struct 88 { 89 res_prms_t *ps_curr_lyr_res_prms; /*!< pointer to current layer 90 resolution parameters */ 91 92 WORD32 i4_offset_x; /*!< scaled ref layer left offset. will 93 be used during mv calculation for crop window change case */ 94 95 WORD32 i4_offset_y; /*!< scaled ref layer top offset. will 96 be used during mv calculation for crop window change case */ 97 98 WORD32 i4_scale_mv_x; /*!< scale factor x for motion upscaling*/ 99 100 WORD32 i4_scale_mv_y; /*!< scale factor y for motion upscaling*/ 101 102 WORD32 i4_dyadic_flag; /*!< flag inidcates the 103 dyadic upscaling or non - dyadic upscaling */ 104 105 /* projected location pointers */ 106 WORD16 *pi2_ref_loc_x; /*!< pointer to the bufer having the 107 projected locations on horizontal direction.This used as look up 108 during calculation of reference locations */ 109 110 WORD16 *pi2_ref_loc_y; /*!< pointer to the bufer having the 111 projected locations on vertical direction.This used as look up 112 during calculation of reference locations */ 113 114 ref_lyr_scaled_offset_t *ps_ref_pic_lyr_offsets; /*!< 115 array of structure pointer for MAX_NUM_RES - 1 to hold the scaled ref 116 offset of reference picture for each resolution */ 117 118 WORD32 i4_ref_width; /*!< reference layer width in 119 terms of luma samples */ 120 121 WORD32 i4_ref_height; /*!< reference layer height in 122 terms of luma samples */ 123 124 ftype_inter_lyr_motion_pred *pf_inter_lyr_pred; /*!< function pointer 125 for dyadic optimization*/ 126 127 void *pv_ref_mv_bank_l0; /*!< pointer to reference layer MV bank List 0*/ 128 129 mem_element_t s_ref_mb_mode; /*!< pointer to reference layer mb mode */ 130 131 } mode_motion_lyr_ctxt; 132 133 typedef struct 134 { 135 mv_pred_t *ps_motion_pred_struct; /*!< temporary motion structure 136 array for 16 sub partitions used in both inter layer and spatial 137 MV prediction */ 138 139 UWORD8 u1_direct_8x8_inference_flag; 140 /*!< flag to indicate 141 the corner mv have to be inherited in B slice */ 142 143 WORD32 i4_listx; /*!< number of lists to be procesed. this 144 is set on B_SLICE or PSLICE */ 145 146 /* array to store the ref layer part idc */ 147 WORD32 ai4_ref_part_idc[4][4]; /*!< reference layer partition 148 identifications stored of all 16 sub partitions */ 149 150 /*!< default mv pred used to store 151 default motion params for intra cases in motion map */ 152 153 mode_motion_lyr_ctxt as_res_lyr_mem[MAX_NUM_RES_LYRS]; /*!< array of 154 strcuture each structure for a pair of resolution except the base layer */ 155 156 WORD32 i4_res_id; /*!< resolution ID used to access the 157 Layer presistant memory */ 158 159 WORD32 i4_ref_width; /*!< reference layer width in 160 terms luma samples */ 161 162 WORD32 i4_ref_height; /*!< reference layer height in 163 terms luma samples */ 164 165 WORD32 ai4_dqid[MAX_NUM_LYRS_IN_RES]; /*! Array of DQID of all the layers in 166 the resolution */ 167 168 } mode_motion_ctxt_t; 169 170 #endif /* _ISVCD_MODE_MV_RESAMPLE_H_ */ 171