1*495ae853SAndroid Build Coastguard Worker /****************************************************************************** 2*495ae853SAndroid Build Coastguard Worker * 3*495ae853SAndroid Build Coastguard Worker * Copyright (C) 2015 The Android Open Source Project 4*495ae853SAndroid Build Coastguard Worker * 5*495ae853SAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 6*495ae853SAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 7*495ae853SAndroid Build Coastguard Worker * You may obtain a copy of the License at: 8*495ae853SAndroid Build Coastguard Worker * 9*495ae853SAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 10*495ae853SAndroid Build Coastguard Worker * 11*495ae853SAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 12*495ae853SAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 13*495ae853SAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14*495ae853SAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 15*495ae853SAndroid Build Coastguard Worker * limitations under the License. 16*495ae853SAndroid Build Coastguard Worker * 17*495ae853SAndroid Build Coastguard Worker ***************************************************************************** 18*495ae853SAndroid Build Coastguard Worker * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore 19*495ae853SAndroid Build Coastguard Worker */ 20*495ae853SAndroid Build Coastguard Worker /** 21*495ae853SAndroid Build Coastguard Worker ******************************************************************************* 22*495ae853SAndroid Build Coastguard Worker * @file 23*495ae853SAndroid Build Coastguard Worker * ime_structs.h 24*495ae853SAndroid Build Coastguard Worker * 25*495ae853SAndroid Build Coastguard Worker * @brief 26*495ae853SAndroid Build Coastguard Worker * Structure definitions used in the code 27*495ae853SAndroid Build Coastguard Worker * 28*495ae853SAndroid Build Coastguard Worker * @author 29*495ae853SAndroid Build Coastguard Worker * Ittiam 30*495ae853SAndroid Build Coastguard Worker * 31*495ae853SAndroid Build Coastguard Worker * @remarks 32*495ae853SAndroid Build Coastguard Worker * None 33*495ae853SAndroid Build Coastguard Worker * 34*495ae853SAndroid Build Coastguard Worker ******************************************************************************* 35*495ae853SAndroid Build Coastguard Worker */ 36*495ae853SAndroid Build Coastguard Worker 37*495ae853SAndroid Build Coastguard Worker #ifndef _IME_STRUCTS_H_ 38*495ae853SAndroid Build Coastguard Worker #define _IME_STRUCTS_H_ 39*495ae853SAndroid Build Coastguard Worker 40*495ae853SAndroid Build Coastguard Worker /** 41*495ae853SAndroid Build Coastguard Worker * Motion vector 42*495ae853SAndroid Build Coastguard Worker */ 43*495ae853SAndroid Build Coastguard Worker typedef struct 44*495ae853SAndroid Build Coastguard Worker { 45*495ae853SAndroid Build Coastguard Worker /** 46*495ae853SAndroid Build Coastguard Worker * Horizontal Motion Vector 47*495ae853SAndroid Build Coastguard Worker */ 48*495ae853SAndroid Build Coastguard Worker WORD16 i2_mvx; 49*495ae853SAndroid Build Coastguard Worker 50*495ae853SAndroid Build Coastguard Worker /** 51*495ae853SAndroid Build Coastguard Worker * Vertical Motion Vector 52*495ae853SAndroid Build Coastguard Worker */ 53*495ae853SAndroid Build Coastguard Worker WORD16 i2_mvy; 54*495ae853SAndroid Build Coastguard Worker } ime_mv_t; 55*495ae853SAndroid Build Coastguard Worker 56*495ae853SAndroid Build Coastguard Worker 57*495ae853SAndroid Build Coastguard Worker /** 58*495ae853SAndroid Build Coastguard Worker ************************************************************************** 59*495ae853SAndroid Build Coastguard Worker * @brief mb_part_ctxt 60*495ae853SAndroid Build Coastguard Worker * 61*495ae853SAndroid Build Coastguard Worker * Structure that would hold the information for individual MB partitions 62*495ae853SAndroid Build Coastguard Worker * gathered during the full pel ME stage 63*495ae853SAndroid Build Coastguard Worker ************************************************************************** 64*495ae853SAndroid Build Coastguard Worker */ 65*495ae853SAndroid Build Coastguard Worker typedef struct 66*495ae853SAndroid Build Coastguard Worker { 67*495ae853SAndroid Build Coastguard Worker /** 68*495ae853SAndroid Build Coastguard Worker * best mvs 69*495ae853SAndroid Build Coastguard Worker */ 70*495ae853SAndroid Build Coastguard Worker ime_mv_t s_mv_curr; 71*495ae853SAndroid Build Coastguard Worker 72*495ae853SAndroid Build Coastguard Worker /** 73*495ae853SAndroid Build Coastguard Worker * mv predictor 74*495ae853SAndroid Build Coastguard Worker */ 75*495ae853SAndroid Build Coastguard Worker ime_mv_t s_mv_pred; 76*495ae853SAndroid Build Coastguard Worker 77*495ae853SAndroid Build Coastguard Worker /** 78*495ae853SAndroid Build Coastguard Worker * SAD associated with the MB partition 79*495ae853SAndroid Build Coastguard Worker */ 80*495ae853SAndroid Build Coastguard Worker WORD32 i4_mb_distortion; 81*495ae853SAndroid Build Coastguard Worker 82*495ae853SAndroid Build Coastguard Worker /** 83*495ae853SAndroid Build Coastguard Worker * cost for the MB partition 84*495ae853SAndroid Build Coastguard Worker */ 85*495ae853SAndroid Build Coastguard Worker WORD32 i4_mb_cost; 86*495ae853SAndroid Build Coastguard Worker 87*495ae853SAndroid Build Coastguard Worker /** 88*495ae853SAndroid Build Coastguard Worker * Search position for least cost among the list of candidates 89*495ae853SAndroid Build Coastguard Worker */ 90*495ae853SAndroid Build Coastguard Worker WORD32 i4_srch_pos_idx; 91*495ae853SAndroid Build Coastguard Worker 92*495ae853SAndroid Build Coastguard Worker /** 93*495ae853SAndroid Build Coastguard Worker * Search position for least cost among the list of candidates 94*495ae853SAndroid Build Coastguard Worker */ 95*495ae853SAndroid Build Coastguard Worker UWORD32 u4_exit; 96*495ae853SAndroid Build Coastguard Worker 97*495ae853SAndroid Build Coastguard Worker /** 98*495ae853SAndroid Build Coastguard Worker * Buffer corresponding to best half pel cost 99*495ae853SAndroid Build Coastguard Worker */ 100*495ae853SAndroid Build Coastguard Worker UWORD8 *pu1_best_hpel_buf; 101*495ae853SAndroid Build Coastguard Worker 102*495ae853SAndroid Build Coastguard Worker } mb_part_ctxt; 103*495ae853SAndroid Build Coastguard Worker 104*495ae853SAndroid Build Coastguard Worker 105*495ae853SAndroid Build Coastguard Worker /** 106*495ae853SAndroid Build Coastguard Worker ************************************************************************** 107*495ae853SAndroid Build Coastguard Worker * @brief me_ctxt_t 108*495ae853SAndroid Build Coastguard Worker * 109*495ae853SAndroid Build Coastguard Worker * Structure encapsulating the parameters used in the motion estimation 110*495ae853SAndroid Build Coastguard Worker * context 111*495ae853SAndroid Build Coastguard Worker ************************************************************************** 112*495ae853SAndroid Build Coastguard Worker */ 113*495ae853SAndroid Build Coastguard Worker typedef struct 114*495ae853SAndroid Build Coastguard Worker { 115*495ae853SAndroid Build Coastguard Worker /** 116*495ae853SAndroid Build Coastguard Worker * Ref pointer to current MB luma for each ref list 117*495ae853SAndroid Build Coastguard Worker */ 118*495ae853SAndroid Build Coastguard Worker UWORD8 *apu1_ref_buf_luma[MAX_NUM_REFLIST]; 119*495ae853SAndroid Build Coastguard Worker 120*495ae853SAndroid Build Coastguard Worker /** 121*495ae853SAndroid Build Coastguard Worker * Src pointer to current MB luma 122*495ae853SAndroid Build Coastguard Worker */ 123*495ae853SAndroid Build Coastguard Worker UWORD8 *pu1_src_buf_luma; 124*495ae853SAndroid Build Coastguard Worker 125*495ae853SAndroid Build Coastguard Worker /** 126*495ae853SAndroid Build Coastguard Worker * source stride 127*495ae853SAndroid Build Coastguard Worker * (strides for luma and chroma are the same) 128*495ae853SAndroid Build Coastguard Worker */ 129*495ae853SAndroid Build Coastguard Worker WORD32 i4_src_strd; 130*495ae853SAndroid Build Coastguard Worker 131*495ae853SAndroid Build Coastguard Worker /** 132*495ae853SAndroid Build Coastguard Worker * recon stride 133*495ae853SAndroid Build Coastguard Worker * (strides for luma and chroma are the same) 134*495ae853SAndroid Build Coastguard Worker */ 135*495ae853SAndroid Build Coastguard Worker WORD32 i4_rec_strd; 136*495ae853SAndroid Build Coastguard Worker 137*495ae853SAndroid Build Coastguard Worker /** 138*495ae853SAndroid Build Coastguard Worker * Offset for half pel x plane from the pic buf 139*495ae853SAndroid Build Coastguard Worker */ 140*495ae853SAndroid Build Coastguard Worker UWORD32 u4_half_x_offset; 141*495ae853SAndroid Build Coastguard Worker 142*495ae853SAndroid Build Coastguard Worker /** 143*495ae853SAndroid Build Coastguard Worker * Offset for half pel y plane from half x plane 144*495ae853SAndroid Build Coastguard Worker */ 145*495ae853SAndroid Build Coastguard Worker UWORD32 u4_half_y_offset; 146*495ae853SAndroid Build Coastguard Worker 147*495ae853SAndroid Build Coastguard Worker /** 148*495ae853SAndroid Build Coastguard Worker * Offset for half pel xy plane from half y plane 149*495ae853SAndroid Build Coastguard Worker */ 150*495ae853SAndroid Build Coastguard Worker UWORD32 u4_half_xy_offset; 151*495ae853SAndroid Build Coastguard Worker 152*495ae853SAndroid Build Coastguard Worker /** 153*495ae853SAndroid Build Coastguard Worker * Search range in the X, Y axis in terms of pixels 154*495ae853SAndroid Build Coastguard Worker */ 155*495ae853SAndroid Build Coastguard Worker WORD32 ai2_srch_boundaries[2]; 156*495ae853SAndroid Build Coastguard Worker 157*495ae853SAndroid Build Coastguard Worker /** 158*495ae853SAndroid Build Coastguard Worker * Search range in the north direction in terms of pixels 159*495ae853SAndroid Build Coastguard Worker */ 160*495ae853SAndroid Build Coastguard Worker WORD32 i4_srch_range_n; 161*495ae853SAndroid Build Coastguard Worker 162*495ae853SAndroid Build Coastguard Worker /** 163*495ae853SAndroid Build Coastguard Worker * Search range in the south direction in terms of pixels 164*495ae853SAndroid Build Coastguard Worker */ 165*495ae853SAndroid Build Coastguard Worker WORD32 i4_srch_range_s; 166*495ae853SAndroid Build Coastguard Worker 167*495ae853SAndroid Build Coastguard Worker /** 168*495ae853SAndroid Build Coastguard Worker * Search range in the east direction in terms of pixels 169*495ae853SAndroid Build Coastguard Worker */ 170*495ae853SAndroid Build Coastguard Worker WORD32 i4_srch_range_e; 171*495ae853SAndroid Build Coastguard Worker 172*495ae853SAndroid Build Coastguard Worker /** 173*495ae853SAndroid Build Coastguard Worker * Search range in the west direction in terms of pixels 174*495ae853SAndroid Build Coastguard Worker */ 175*495ae853SAndroid Build Coastguard Worker WORD32 i4_srch_range_w; 176*495ae853SAndroid Build Coastguard Worker 177*495ae853SAndroid Build Coastguard Worker /** 178*495ae853SAndroid Build Coastguard Worker * left mb motion vector 179*495ae853SAndroid Build Coastguard Worker */ 180*495ae853SAndroid Build Coastguard Worker ime_mv_t s_left_mv; 181*495ae853SAndroid Build Coastguard Worker 182*495ae853SAndroid Build Coastguard Worker /** 183*495ae853SAndroid Build Coastguard Worker * top left mb motion vector 184*495ae853SAndroid Build Coastguard Worker */ 185*495ae853SAndroid Build Coastguard Worker ime_mv_t s_top_left_mv; 186*495ae853SAndroid Build Coastguard Worker 187*495ae853SAndroid Build Coastguard Worker /** 188*495ae853SAndroid Build Coastguard Worker * Number of valid candidates for the Initial search position 189*495ae853SAndroid Build Coastguard Worker */ 190*495ae853SAndroid Build Coastguard Worker UWORD32 u4_num_candidates[MAX_NUM_REFLIST + 1]; 191*495ae853SAndroid Build Coastguard Worker 192*495ae853SAndroid Build Coastguard Worker /** 193*495ae853SAndroid Build Coastguard Worker * Motion vector predictors derived from neighboring 194*495ae853SAndroid Build Coastguard Worker * blocks for each of the six block partitions 195*495ae853SAndroid Build Coastguard Worker */ 196*495ae853SAndroid Build Coastguard Worker ime_mv_t as_mv_init_search[MAX_NUM_REFLIST + 1][6]; 197*495ae853SAndroid Build Coastguard Worker 198*495ae853SAndroid Build Coastguard Worker /** 199*495ae853SAndroid Build Coastguard Worker * mv bits 200*495ae853SAndroid Build Coastguard Worker */ 201*495ae853SAndroid Build Coastguard Worker UWORD8 *pu1_mv_bits; 202*495ae853SAndroid Build Coastguard Worker 203*495ae853SAndroid Build Coastguard Worker /** 204*495ae853SAndroid Build Coastguard Worker * lambda (lagrange multiplier for cost computation) 205*495ae853SAndroid Build Coastguard Worker */ 206*495ae853SAndroid Build Coastguard Worker UWORD32 u4_lambda_motion; 207*495ae853SAndroid Build Coastguard Worker 208*495ae853SAndroid Build Coastguard Worker /** 209*495ae853SAndroid Build Coastguard Worker * enabled fast sad computation 210*495ae853SAndroid Build Coastguard Worker */ 211*495ae853SAndroid Build Coastguard Worker UWORD32 u4_enable_fast_sad; 212*495ae853SAndroid Build Coastguard Worker 213*495ae853SAndroid Build Coastguard Worker /* 214*495ae853SAndroid Build Coastguard Worker * Enable SKIP block prediction based on SATQD 215*495ae853SAndroid Build Coastguard Worker */ 216*495ae853SAndroid Build Coastguard Worker UWORD32 u4_enable_stat_sad; 217*495ae853SAndroid Build Coastguard Worker 218*495ae853SAndroid Build Coastguard Worker /* 219*495ae853SAndroid Build Coastguard Worker * Minimum distortion to search for 220*495ae853SAndroid Build Coastguard Worker */ 221*495ae853SAndroid Build Coastguard Worker WORD32 i4_min_sad; 222*495ae853SAndroid Build Coastguard Worker 223*495ae853SAndroid Build Coastguard Worker /** 224*495ae853SAndroid Build Coastguard Worker * Signal that minimum sad has been reached in ME 225*495ae853SAndroid Build Coastguard Worker */ 226*495ae853SAndroid Build Coastguard Worker UWORD32 u4_min_sad_reached; 227*495ae853SAndroid Build Coastguard Worker 228*495ae853SAndroid Build Coastguard Worker /** 229*495ae853SAndroid Build Coastguard Worker * Flag to enable/disbale half pel motion estimation 230*495ae853SAndroid Build Coastguard Worker */ 231*495ae853SAndroid Build Coastguard Worker UWORD32 u4_enable_hpel; 232*495ae853SAndroid Build Coastguard Worker 233*495ae853SAndroid Build Coastguard Worker /** 234*495ae853SAndroid Build Coastguard Worker * Diamond search Iteration Max Cnt 235*495ae853SAndroid Build Coastguard Worker */ 236*495ae853SAndroid Build Coastguard Worker UWORD32 u4_num_layers; 237*495ae853SAndroid Build Coastguard Worker 238*495ae853SAndroid Build Coastguard Worker /** 239*495ae853SAndroid Build Coastguard Worker * encoder me speed 240*495ae853SAndroid Build Coastguard Worker */ 241*495ae853SAndroid Build Coastguard Worker UWORD32 u4_me_speed_preset; 242*495ae853SAndroid Build Coastguard Worker 243*495ae853SAndroid Build Coastguard Worker /** 244*495ae853SAndroid Build Coastguard Worker * Is left mb intra 245*495ae853SAndroid Build Coastguard Worker */ 246*495ae853SAndroid Build Coastguard Worker UWORD32 u4_left_is_intra; 247*495ae853SAndroid Build Coastguard Worker 248*495ae853SAndroid Build Coastguard Worker /** 249*495ae853SAndroid Build Coastguard Worker * Is left mb skip 250*495ae853SAndroid Build Coastguard Worker */ 251*495ae853SAndroid Build Coastguard Worker UWORD32 u4_left_is_skip; 252*495ae853SAndroid Build Coastguard Worker 253*495ae853SAndroid Build Coastguard Worker /** 254*495ae853SAndroid Build Coastguard Worker * skip_type can be PREDL0, PREDL1 or BIPRED 255*495ae853SAndroid Build Coastguard Worker */ 256*495ae853SAndroid Build Coastguard Worker WORD32 i4_skip_type; 257*495ae853SAndroid Build Coastguard Worker 258*495ae853SAndroid Build Coastguard Worker /** 259*495ae853SAndroid Build Coastguard Worker * Biasing given for skip prediction 260*495ae853SAndroid Build Coastguard Worker */ 261*495ae853SAndroid Build Coastguard Worker WORD32 i4_skip_bias[2]; 262*495ae853SAndroid Build Coastguard Worker 263*495ae853SAndroid Build Coastguard Worker /** 264*495ae853SAndroid Build Coastguard Worker * Structure to store the MB partition info 265*495ae853SAndroid Build Coastguard Worker * We need 1(L0)+1(L1)+1(bi) 266*495ae853SAndroid Build Coastguard Worker */ 267*495ae853SAndroid Build Coastguard Worker mb_part_ctxt as_mb_part[MAX_NUM_REFLIST + 1]; 268*495ae853SAndroid Build Coastguard Worker 269*495ae853SAndroid Build Coastguard Worker /** 270*495ae853SAndroid Build Coastguard Worker * Threshold to compare the sad with 271*495ae853SAndroid Build Coastguard Worker */ 272*495ae853SAndroid Build Coastguard Worker UWORD16 *pu2_sad_thrsh; 273*495ae853SAndroid Build Coastguard Worker 274*495ae853SAndroid Build Coastguard Worker /** 275*495ae853SAndroid Build Coastguard Worker * fn ptrs for compute sad routines 276*495ae853SAndroid Build Coastguard Worker */ 277*495ae853SAndroid Build Coastguard Worker ime_compute_sad_ft *pf_ime_compute_sad_16x16[2]; 278*495ae853SAndroid Build Coastguard Worker ime_compute_sad_ft *pf_ime_compute_sad_16x8; 279*495ae853SAndroid Build Coastguard Worker ime_compute_sad4_diamond *pf_ime_compute_sad4_diamond; 280*495ae853SAndroid Build Coastguard Worker ime_compute_sad3_diamond *pf_ime_compute_sad3_diamond; 281*495ae853SAndroid Build Coastguard Worker ime_compute_sad2_diamond *pf_ime_compute_sad2_diamond; 282*495ae853SAndroid Build Coastguard Worker ime_sub_pel_compute_sad_16x16_ft *pf_ime_sub_pel_compute_sad_16x16; 283*495ae853SAndroid Build Coastguard Worker 284*495ae853SAndroid Build Coastguard Worker /** 285*495ae853SAndroid Build Coastguard Worker * Function poitners for SATQD 286*495ae853SAndroid Build Coastguard Worker */ 287*495ae853SAndroid Build Coastguard Worker ime_compute_sad_stat *pf_ime_compute_sad_stat_luma_16x16; 288*495ae853SAndroid Build Coastguard Worker 289*495ae853SAndroid Build Coastguard Worker /** 290*495ae853SAndroid Build Coastguard Worker * Qp 291*495ae853SAndroid Build Coastguard Worker */ 292*495ae853SAndroid Build Coastguard Worker UWORD8 u1_mb_qp; 293*495ae853SAndroid Build Coastguard Worker 294*495ae853SAndroid Build Coastguard Worker /** 295*495ae853SAndroid Build Coastguard Worker * Buffers for holding subpel and bipred temp buffers 296*495ae853SAndroid Build Coastguard Worker */ 297*495ae853SAndroid Build Coastguard Worker UWORD8 *apu1_subpel_buffs[SUBPEL_BUFF_CNT]; 298*495ae853SAndroid Build Coastguard Worker 299*495ae853SAndroid Build Coastguard Worker WORD32 u4_subpel_buf_strd; 300*495ae853SAndroid Build Coastguard Worker 301*495ae853SAndroid Build Coastguard Worker /** 302*495ae853SAndroid Build Coastguard Worker * Buffers to store the best halfpel plane* 303*495ae853SAndroid Build Coastguard Worker */ 304*495ae853SAndroid Build Coastguard Worker UWORD8 *pu1_hpel_buf; 305*495ae853SAndroid Build Coastguard Worker 306*495ae853SAndroid Build Coastguard Worker } me_ctxt_t; 307*495ae853SAndroid Build Coastguard Worker 308*495ae853SAndroid Build Coastguard Worker 309*495ae853SAndroid Build Coastguard Worker #endif /* _IME_STRUCTS_H_ */ 310*495ae853SAndroid Build Coastguard Worker 311