1*495ae853SAndroid Build Coastguard Worker /****************************************************************************** 2*495ae853SAndroid Build Coastguard Worker * 3*495ae853SAndroid Build Coastguard Worker * Copyright (C) 2022 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 * isvcd_process_pslice.h 24*495ae853SAndroid Build Coastguard Worker * 25*495ae853SAndroid Build Coastguard Worker * @brief 26*495ae853SAndroid Build Coastguard Worker * Contains routines that resample for SVC resampling 27*495ae853SAndroid Build Coastguard Worker * 28*495ae853SAndroid Build Coastguard Worker * @author 29*495ae853SAndroid Build Coastguard Worker * Kishore 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 _ISVCD_RESAMP_SVC_H_ 38*495ae853SAndroid Build Coastguard Worker #define _ISVCD_RESAMP_SVC_H_ 39*495ae853SAndroid Build Coastguard Worker 40*495ae853SAndroid Build Coastguard Worker #include "ih264_typedefs.h" 41*495ae853SAndroid Build Coastguard Worker #include "ih264_macros.h" 42*495ae853SAndroid Build Coastguard Worker #include "ih264_platform_macros.h" 43*495ae853SAndroid Build Coastguard Worker #include "ih264d_structs.h" 44*495ae853SAndroid Build Coastguard Worker 45*495ae853SAndroid Build Coastguard Worker #define SVCD_FALSE 0 46*495ae853SAndroid Build Coastguard Worker #define SVCD_TRUE 1 47*495ae853SAndroid Build Coastguard Worker 48*495ae853SAndroid Build Coastguard Worker #define MAP_BUFF_WIDTH 48 49*495ae853SAndroid Build Coastguard Worker #define MAP_BUFF_HEIGHT 48 50*495ae853SAndroid Build Coastguard Worker #define INTERMEDIATE_BUFF_WIDTH 48 51*495ae853SAndroid Build Coastguard Worker #define INTERMEDIATE_BUFF_HEIGHT (MB_HEIGHT + 4) 52*495ae853SAndroid Build Coastguard Worker 53*495ae853SAndroid Build Coastguard Worker #define MAX_REF_ARR_WD_HT 48 54*495ae853SAndroid Build Coastguard Worker 55*495ae853SAndroid Build Coastguard Worker #define MAX_REF_IDX_ARRAY (MAX_REF_ARR_WD_HT + MB_WIDTH) 56*495ae853SAndroid Build Coastguard Worker #define DYADIC_REF_W_Y 20 57*495ae853SAndroid Build Coastguard Worker #define DYADIC_REF_H_Y 20 58*495ae853SAndroid Build Coastguard Worker #define DYADIC_REF_W_C 10 59*495ae853SAndroid Build Coastguard Worker #define DYADIC_REF_H_C 10 60*495ae853SAndroid Build Coastguard Worker 61*495ae853SAndroid Build Coastguard Worker #define SUB_BLOCK_WIDTH 4 62*495ae853SAndroid Build Coastguard Worker #define SUB_BLOCK_HEIGHT 4 63*495ae853SAndroid Build Coastguard Worker #define SUB_BLOCK_SIZE (SUB_BLOCK_WIDTH * SUB_BLOCK_HEIGHT) 64*495ae853SAndroid Build Coastguard Worker #define BLOCK_WIDTH 8 65*495ae853SAndroid Build Coastguard Worker #define BLOCK_HEIGHT 8 66*495ae853SAndroid Build Coastguard Worker #define BLOCK_SIZE (BLOCK_WIDTH * BLOCK_HEIGHT) 67*495ae853SAndroid Build Coastguard Worker #define MB_WIDTH 16 68*495ae853SAndroid Build Coastguard Worker #define MB_HEIGHT 16 69*495ae853SAndroid Build Coastguard Worker #define CLIPUCHAR(x) CLIP3(0, 255, (x)) 70*495ae853SAndroid Build Coastguard Worker #define MB_WIDTH_SHIFT 4 71*495ae853SAndroid Build Coastguard Worker #define MB_HEIGHT_SHIFT 4 72*495ae853SAndroid Build Coastguard Worker 73*495ae853SAndroid Build Coastguard Worker #define REF_ARRAY_WIDTH 48 74*495ae853SAndroid Build Coastguard Worker #define REF_ARRAY_HEIGHT 48 75*495ae853SAndroid Build Coastguard Worker #define MAX_PIX_FILL_LUMA 4 76*495ae853SAndroid Build Coastguard Worker #define MAX_PIX_FILL_CHROMA 2 77*495ae853SAndroid Build Coastguard Worker 78*495ae853SAndroid Build Coastguard Worker typedef void (*pf_vert_interpol_chroma_dyadic)(UWORD8 *pu1_inp_buf, WORD16 *pi2_tmp_filt_buf, 79*495ae853SAndroid Build Coastguard Worker WORD32 i4_phase_0, WORD32 i4_phase_1); 80*495ae853SAndroid Build Coastguard Worker 81*495ae853SAndroid Build Coastguard Worker typedef void (*pf_horz_interpol_chroma_dyadic)(WORD16 *pi2_tmp_filt_buf, UWORD8 *pu1_out_buf, 82*495ae853SAndroid Build Coastguard Worker WORD32 i4_out_stride, WORD32 i4_phase_0, 83*495ae853SAndroid Build Coastguard Worker WORD32 i4_phase_1); 84*495ae853SAndroid Build Coastguard Worker 85*495ae853SAndroid Build Coastguard Worker typedef struct 86*495ae853SAndroid Build Coastguard Worker { 87*495ae853SAndroid Build Coastguard Worker void *pv_buffer; /*!< Buffer pointer */ 88*495ae853SAndroid Build Coastguard Worker WORD32 i4_element_size; /*!< size of the structure or unit */ 89*495ae853SAndroid Build Coastguard Worker WORD32 i4_num_element_stride; /*!< Stride of buffer in terms of number of elements */ 90*495ae853SAndroid Build Coastguard Worker } mem_element_t; 91*495ae853SAndroid Build Coastguard Worker 92*495ae853SAndroid Build Coastguard Worker typedef struct 93*495ae853SAndroid Build Coastguard Worker { 94*495ae853SAndroid Build Coastguard Worker UWORD8 u1_seg_dim; /*!< describes segment dimension */ 95*495ae853SAndroid Build Coastguard Worker UWORD8 u1_seg_off; /*!< describes offset from start */ 96*495ae853SAndroid Build Coastguard Worker UWORD8 u1_mb_adjoin; /*!< describes whether mb is adjoining 97*495ae853SAndroid Build Coastguard Worker the segment 0 => not adjoining 98*495ae853SAndroid Build Coastguard Worker 1 => adjoining */ 99*495ae853SAndroid Build Coastguard Worker 100*495ae853SAndroid Build Coastguard Worker WORD8 i1_dist_idx; /*!< distance to nearest MB */ 101*495ae853SAndroid Build Coastguard Worker 102*495ae853SAndroid Build Coastguard Worker WORD8 i1_nearst_mb_bdry; /*!< describes the nearest mb boundary 103*495ae853SAndroid Build Coastguard Worker +1 => rightMB/bottomMB 104*495ae853SAndroid Build Coastguard Worker -1 => leftMB/topMB */ 105*495ae853SAndroid Build Coastguard Worker } seg_description_t; 106*495ae853SAndroid Build Coastguard Worker 107*495ae853SAndroid Build Coastguard Worker typedef struct 108*495ae853SAndroid Build Coastguard Worker { 109*495ae853SAndroid Build Coastguard Worker UWORD8 u1_num_segments; /*!< place holder to store the number of segments */ 110*495ae853SAndroid Build Coastguard Worker 111*495ae853SAndroid Build Coastguard Worker UWORD8 u4_start_pos; /*!< this variable indicates where is 112*495ae853SAndroid Build Coastguard Worker start locatiion of the segment with 113*495ae853SAndroid Build Coastguard Worker respect to less the block_width or 114*495ae853SAndroid Build Coastguard Worker greater than block width */ 115*495ae853SAndroid Build Coastguard Worker 116*495ae853SAndroid Build Coastguard Worker seg_description_t s_segments[4]; /*!< place holder to store per segment description */ 117*495ae853SAndroid Build Coastguard Worker } seg_lookup_desc_t; 118*495ae853SAndroid Build Coastguard Worker typedef struct 119*495ae853SAndroid Build Coastguard Worker { 120*495ae853SAndroid Build Coastguard Worker WORD16 i2_min_pos; /*!< place holder to store the projected 121*495ae853SAndroid Build Coastguard Worker MIN referecne position for a MB in 122*495ae853SAndroid Build Coastguard Worker current layer. can be used to store 123*495ae853SAndroid Build Coastguard Worker either horizontal or vertical positions 124*495ae853SAndroid Build Coastguard Worker */ 125*495ae853SAndroid Build Coastguard Worker WORD16 i2_max_pos; /*!< place holder to store the projected 126*495ae853SAndroid Build Coastguard Worker MAX referecne position for a MB in 127*495ae853SAndroid Build Coastguard Worker current layer. can be used to store 128*495ae853SAndroid Build Coastguard Worker either horizontal or vertical positions 129*495ae853SAndroid Build Coastguard Worker */ 130*495ae853SAndroid Build Coastguard Worker } ref_min_max_map_t; 131*495ae853SAndroid Build Coastguard Worker 132*495ae853SAndroid Build Coastguard Worker typedef struct 133*495ae853SAndroid Build Coastguard Worker { 134*495ae853SAndroid Build Coastguard Worker WORD16 i2_left; /*!< Horizontal offset of upper left luma sample 135*495ae853SAndroid Build Coastguard Worker after resampling process on reference 136*495ae853SAndroid Build Coastguard Worker layer with respect to upper left luma 137*495ae853SAndroid Build Coastguard Worker sample of current layer. 138*495ae853SAndroid Build Coastguard Worker */ 139*495ae853SAndroid Build Coastguard Worker WORD16 i2_top; /*!< Vertical offset of upper left luma pixel 140*495ae853SAndroid Build Coastguard Worker after resampling process on reference 141*495ae853SAndroid Build Coastguard Worker layer 142*495ae853SAndroid Build Coastguard Worker */ 143*495ae853SAndroid Build Coastguard Worker WORD16 i2_rt; /*!< Horizontal offset of bottom right luma 144*495ae853SAndroid Build Coastguard Worker sample after resampling process on 145*495ae853SAndroid Build Coastguard Worker reference layer with respect to bottom 146*495ae853SAndroid Build Coastguard Worker right luma sample. 147*495ae853SAndroid Build Coastguard Worker */ 148*495ae853SAndroid Build Coastguard Worker WORD16 i2_bot; /*!< Vertical offset of bottom right luma 149*495ae853SAndroid Build Coastguard Worker pixel after resampling process on 150*495ae853SAndroid Build Coastguard Worker reference layer 151*495ae853SAndroid Build Coastguard Worker */ 152*495ae853SAndroid Build Coastguard Worker } ref_lyr_scaled_offset_t; 153*495ae853SAndroid Build Coastguard Worker 154*495ae853SAndroid Build Coastguard Worker typedef struct 155*495ae853SAndroid Build Coastguard Worker { 156*495ae853SAndroid Build Coastguard Worker UWORD8 i2_ref_pos; /*!< place holder to store the projected 157*495ae853SAndroid Build Coastguard Worker referecne position for a pixel in 158*495ae853SAndroid Build Coastguard Worker current layer. can be used to store 159*495ae853SAndroid Build Coastguard Worker either horizontal or vertical positions 160*495ae853SAndroid Build Coastguard Worker */ 161*495ae853SAndroid Build Coastguard Worker UWORD8 i2_phase; /*!< place holder to store the projected 162*495ae853SAndroid Build Coastguard Worker phase for a pixel in current layer. 163*495ae853SAndroid Build Coastguard Worker can be used to store either 164*495ae853SAndroid Build Coastguard Worker horizontal or vertical phase 165*495ae853SAndroid Build Coastguard Worker */ 166*495ae853SAndroid Build Coastguard Worker } ref_pixel_map_t; 167*495ae853SAndroid Build Coastguard Worker 168*495ae853SAndroid Build Coastguard Worker typedef struct 169*495ae853SAndroid Build Coastguard Worker { 170*495ae853SAndroid Build Coastguard Worker WORD16 i2_offset; /*!< place holder to store the projected 171*495ae853SAndroid Build Coastguard Worker start point of reference window 172*495ae853SAndroid Build Coastguard Worker for each MB in current layer.can be 173*495ae853SAndroid Build Coastguard Worker used to store either horizontal or 174*495ae853SAndroid Build Coastguard Worker vertical offset 175*495ae853SAndroid Build Coastguard Worker */ 176*495ae853SAndroid Build Coastguard Worker WORD16 i2_length; /*!< place holder to store reference array 177*495ae853SAndroid Build Coastguard Worker length of the reference window 178*495ae853SAndroid Build Coastguard Worker for each MB in current layer.can be 179*495ae853SAndroid Build Coastguard Worker used to store either horizontal width 180*495ae853SAndroid Build Coastguard Worker or vertical height 181*495ae853SAndroid Build Coastguard Worker */ 182*495ae853SAndroid Build Coastguard Worker } ref_mb_map_t; 183*495ae853SAndroid Build Coastguard Worker 184*495ae853SAndroid Build Coastguard Worker typedef struct 185*495ae853SAndroid Build Coastguard Worker { 186*495ae853SAndroid Build Coastguard Worker /* used for mapping purpose */ 187*495ae853SAndroid Build Coastguard Worker ref_pixel_map_t *ps_x_pos_phase; /*!< buffers to store the projected 188*495ae853SAndroid Build Coastguard Worker referecne X and phase X for each 189*495ae853SAndroid Build Coastguard Worker pixel in current layer in 190*495ae853SAndroid Build Coastguard Worker horizontal direction 191*495ae853SAndroid Build Coastguard Worker */ 192*495ae853SAndroid Build Coastguard Worker ref_pixel_map_t *ps_y_pos_phase; /*!< buffers to store the projected 193*495ae853SAndroid Build Coastguard Worker referecne Y and phase Y for each 194*495ae853SAndroid Build Coastguard Worker pixel in current layer in 195*495ae853SAndroid Build Coastguard Worker vertical direction 196*495ae853SAndroid Build Coastguard Worker */ 197*495ae853SAndroid Build Coastguard Worker ref_mb_map_t *ps_x_offset_length; /*!< buffers to store the projected 198*495ae853SAndroid Build Coastguard Worker start point of reference window and 199*495ae853SAndroid Build Coastguard Worker reference array width in 200*495ae853SAndroid Build Coastguard Worker horizontal direction for each MB in 201*495ae853SAndroid Build Coastguard Worker current layer 202*495ae853SAndroid Build Coastguard Worker */ 203*495ae853SAndroid Build Coastguard Worker ref_mb_map_t *ps_y_offset_length; /*!< buffers to store the projected 204*495ae853SAndroid Build Coastguard Worker start point of reference window and 205*495ae853SAndroid Build Coastguard Worker reference array height in 206*495ae853SAndroid Build Coastguard Worker vertical direction for each MB in 207*495ae853SAndroid Build Coastguard Worker current layer 208*495ae853SAndroid Build Coastguard Worker */ 209*495ae853SAndroid Build Coastguard Worker } residual_samp_map_ctxt_t; 210*495ae853SAndroid Build Coastguard Worker 211*495ae853SAndroid Build Coastguard Worker typedef struct 212*495ae853SAndroid Build Coastguard Worker { 213*495ae853SAndroid Build Coastguard Worker residual_samp_map_ctxt_t s_luma_map_ctxt; /*!< map structure for luma 214*495ae853SAndroid Build Coastguard Worker projected locations 215*495ae853SAndroid Build Coastguard Worker for curr resolution layer 216*495ae853SAndroid Build Coastguard Worker */ 217*495ae853SAndroid Build Coastguard Worker residual_samp_map_ctxt_t s_chroma_map_ctxt; /*!< map structure for chroma 218*495ae853SAndroid Build Coastguard Worker projected locations 219*495ae853SAndroid Build Coastguard Worker for curr resolution layer 220*495ae853SAndroid Build Coastguard Worker */ 221*495ae853SAndroid Build Coastguard Worker WORD32 i4_ref_width; /*!< reference layer width in 222*495ae853SAndroid Build Coastguard Worker terms luma samples 223*495ae853SAndroid Build Coastguard Worker */ 224*495ae853SAndroid Build Coastguard Worker WORD32 i4_ref_height; /*!< reference layer height in 225*495ae853SAndroid Build Coastguard Worker terms luma samples 226*495ae853SAndroid Build Coastguard Worker */ 227*495ae853SAndroid Build Coastguard Worker WORD32 i4_curr_width; /*!< current layer width in 228*495ae853SAndroid Build Coastguard Worker terms luma samples 229*495ae853SAndroid Build Coastguard Worker */ 230*495ae853SAndroid Build Coastguard Worker WORD32 i4_curr_height; /*!< current layer height in 231*495ae853SAndroid Build Coastguard Worker terms luma samples 232*495ae853SAndroid Build Coastguard Worker */ 233*495ae853SAndroid Build Coastguard Worker WORD32 i4_dyadic_flag; /*!< flag to indicate whether 234*495ae853SAndroid Build Coastguard Worker the upscaling factor is 2 235*495ae853SAndroid Build Coastguard Worker in both directions 236*495ae853SAndroid Build Coastguard Worker 237*495ae853SAndroid Build Coastguard Worker /* following variables are for Dyadic cases only */ 238*495ae853SAndroid Build Coastguard Worker WORD32 i4_chrm_alt_proc; /*!< Alternate processing 239*495ae853SAndroid Build Coastguard Worker for chroma for specific 240*495ae853SAndroid Build Coastguard Worker values of phases 241*495ae853SAndroid Build Coastguard Worker */ 242*495ae853SAndroid Build Coastguard Worker 243*495ae853SAndroid Build Coastguard Worker WORD32 i4_chrm_vert_int_mode; /*!< Chroma horizontal 244*495ae853SAndroid Build Coastguard Worker interpolation alternate 245*495ae853SAndroid Build Coastguard Worker mode 246*495ae853SAndroid Build Coastguard Worker */ 247*495ae853SAndroid Build Coastguard Worker 248*495ae853SAndroid Build Coastguard Worker WORD32 i4_chrm_horz_int_mode; /*!<Chroma vertical 249*495ae853SAndroid Build Coastguard Worker interpolation alternate 250*495ae853SAndroid Build Coastguard Worker modes 251*495ae853SAndroid Build Coastguard Worker */ 252*495ae853SAndroid Build Coastguard Worker } res_lyr_ctxt; 253*495ae853SAndroid Build Coastguard Worker 254*495ae853SAndroid Build Coastguard Worker typedef struct 255*495ae853SAndroid Build Coastguard Worker { 256*495ae853SAndroid Build Coastguard Worker res_lyr_ctxt as_res_lyrs[MAX_NUM_RES_LYRS]; /*!< Array of resolutoin layer 257*495ae853SAndroid Build Coastguard Worker ctxt.The first strcuture in the 258*495ae853SAndroid Build Coastguard Worker array will be used for storing 259*495ae853SAndroid Build Coastguard Worker the "second resolution" map in 260*495ae853SAndroid Build Coastguard Worker an access unit w.r.t to its 261*495ae853SAndroid Build Coastguard Worker base resolution, and for base 262*495ae853SAndroid Build Coastguard Worker resolution nothing will be 263*495ae853SAndroid Build Coastguard Worker computed or stored 264*495ae853SAndroid Build Coastguard Worker */ 265*495ae853SAndroid Build Coastguard Worker void *ps_sps; /*!< pointer to array of SPS 266*495ae853SAndroid Build Coastguard Worker */ 267*495ae853SAndroid Build Coastguard Worker 268*495ae853SAndroid Build Coastguard Worker WORD16 *pi2_refarray_buffer; /*!< buffer to store the reference 269*495ae853SAndroid Build Coastguard Worker layer data before residual 270*495ae853SAndroid Build Coastguard Worker sampling 271*495ae853SAndroid Build Coastguard Worker */ 272*495ae853SAndroid Build Coastguard Worker 273*495ae853SAndroid Build Coastguard Worker UWORD8 *pu1_ref_x_ptr_incr; /*!< buffer to store the reference 274*495ae853SAndroid Build Coastguard Worker array ptr increments for 275*495ae853SAndroid Build Coastguard Worker operand 2 of interpolation 276*495ae853SAndroid Build Coastguard Worker */ 277*495ae853SAndroid Build Coastguard Worker UWORD8 *pu1_ref_y_ptr_incr; /*!< buffer to store the reference 278*495ae853SAndroid Build Coastguard Worker array ptr increments for 279*495ae853SAndroid Build Coastguard Worker operand 2 of interpolation 280*495ae853SAndroid Build Coastguard Worker */ 281*495ae853SAndroid Build Coastguard Worker 282*495ae853SAndroid Build Coastguard Worker WORD32 i4_res_lyr_id; /*!< resolution id of the layer 283*495ae853SAndroid Build Coastguard Worker which is to be processed 284*495ae853SAndroid Build Coastguard Worker */ 285*495ae853SAndroid Build Coastguard Worker WORD32 i4_ref_width; /*!< reference layer width in 286*495ae853SAndroid Build Coastguard Worker terms luma samples 287*495ae853SAndroid Build Coastguard Worker */ 288*495ae853SAndroid Build Coastguard Worker 289*495ae853SAndroid Build Coastguard Worker WORD32 i4_ref_height; /*!< reference layer height in 290*495ae853SAndroid Build Coastguard Worker terms luma samples 291*495ae853SAndroid Build Coastguard Worker */ 292*495ae853SAndroid Build Coastguard Worker } residual_sampling_ctxt_t; 293*495ae853SAndroid Build Coastguard Worker 294*495ae853SAndroid Build Coastguard Worker typedef struct 295*495ae853SAndroid Build Coastguard Worker { 296*495ae853SAndroid Build Coastguard Worker WORD32 i4_res_width; /*!< Frame width of top most layer in the 297*495ae853SAndroid Build Coastguard Worker resolution. It's expressed in terms 298*495ae853SAndroid Build Coastguard Worker of luma samples. 299*495ae853SAndroid Build Coastguard Worker */ 300*495ae853SAndroid Build Coastguard Worker WORD32 i4_res_height; /*!< Frame height of top most layer in the 301*495ae853SAndroid Build Coastguard Worker resolution. It's expressed in terms 302*495ae853SAndroid Build Coastguard Worker of luma samples. 303*495ae853SAndroid Build Coastguard Worker */ 304*495ae853SAndroid Build Coastguard Worker ref_lyr_scaled_offset_t s_ref_lyr_scaled_offset; /*!< Scaled offset 305*495ae853SAndroid Build Coastguard Worker parameters of reference layer considering 306*495ae853SAndroid Build Coastguard Worker bottom most layer of the resolution as 307*495ae853SAndroid Build Coastguard Worker current layer. Offsets are with respect 308*495ae853SAndroid Build Coastguard Worker to upper left luma samples in top most 309*495ae853SAndroid Build Coastguard Worker layer in the resolution. 310*495ae853SAndroid Build Coastguard Worker */ 311*495ae853SAndroid Build Coastguard Worker UWORD16 u2_scaled_ref_width; /*!< Considering bottom most layer of the 312*495ae853SAndroid Build Coastguard Worker resolution as current layer, scaled 313*495ae853SAndroid Build Coastguard Worker width of reference layer in terms of 314*495ae853SAndroid Build Coastguard Worker luma pixels. It's inferred parameter 315*495ae853SAndroid Build Coastguard Worker based on reference layer offsets. 316*495ae853SAndroid Build Coastguard Worker */ 317*495ae853SAndroid Build Coastguard Worker UWORD16 u2_scaled_ref_height; /*!< Considering bottom most layer of the 318*495ae853SAndroid Build Coastguard Worker resolution as current layer, scaled 319*495ae853SAndroid Build Coastguard Worker height of reference layer in terms of 320*495ae853SAndroid Build Coastguard Worker luma pixels. It's inferred parameter 321*495ae853SAndroid Build Coastguard Worker based on reference layer offsets. 322*495ae853SAndroid Build Coastguard Worker */ 323*495ae853SAndroid Build Coastguard Worker UWORD8 u1_rstrct_res_change_flag; /*!< restrictedResolutionChangeFlag for 324*495ae853SAndroid Build Coastguard Worker bottom most layer of the resolution. It's 325*495ae853SAndroid Build Coastguard Worker a inferred parameter. 326*495ae853SAndroid Build Coastguard Worker */ 327*495ae853SAndroid Build Coastguard Worker UWORD8 u1_cropping_change_flag; /*!< croppingChangeFlag for bottom most 328*495ae853SAndroid Build Coastguard Worker layer of the resolution. It's a inferred 329*495ae853SAndroid Build Coastguard Worker parameter. 330*495ae853SAndroid Build Coastguard Worker */ 331*495ae853SAndroid Build Coastguard Worker UWORD8 u1_disable_inter_lyr_dblk_filter_idc; /*!< Mode of operation for 332*495ae853SAndroid Build Coastguard Worker inter layer de-blocking. It shall be 333*495ae853SAndroid Build Coastguard Worker set for bottom most layer of the top 334*495ae853SAndroid Build Coastguard Worker resolution. By top resolution, it 335*495ae853SAndroid Build Coastguard Worker referes to the resolution just above 336*495ae853SAndroid Build Coastguard Worker the current spatial resolution. This 337*495ae853SAndroid Build Coastguard Worker shall be valid for all resolutions 338*495ae853SAndroid Build Coastguard Worker except target resolution. 339*495ae853SAndroid Build Coastguard Worker */ 340*495ae853SAndroid Build Coastguard Worker WORD8 i1_inter_lyr_alpha_c0_offset; /*!< specifies the offset used in 341*495ae853SAndroid Build Coastguard Worker accessing the alpha and tC0 deblocking 342*495ae853SAndroid Build Coastguard Worker filter tables for filtering operations 343*495ae853SAndroid Build Coastguard Worker in inter layer de-blocking. Applicable 344*495ae853SAndroid Build Coastguard Worker for bottom most layer of the top 345*495ae853SAndroid Build Coastguard Worker resolution. By top resolution, it referes 346*495ae853SAndroid Build Coastguard Worker to the resolution just above the current 347*495ae853SAndroid Build Coastguard Worker spatial resolution. This shall be valid 348*495ae853SAndroid Build Coastguard Worker for resolutions except target resolution. 349*495ae853SAndroid Build Coastguard Worker */ 350*495ae853SAndroid Build Coastguard Worker WORD8 i1_inter_lyr_beta_offset; /*!< specifies the offset used in 351*495ae853SAndroid Build Coastguard Worker accessing the beta deblocking filter table 352*495ae853SAndroid Build Coastguard Worker for filtering operations in inter layer 353*495ae853SAndroid Build Coastguard Worker de-blocking. Applicable for bottom most 354*495ae853SAndroid Build Coastguard Worker layer of the top resolution. By top 355*495ae853SAndroid Build Coastguard Worker resolution, it referes to the resolution 356*495ae853SAndroid Build Coastguard Worker just above the current spatial resolution. 357*495ae853SAndroid Build Coastguard Worker This shall be valid for resolutions 358*495ae853SAndroid Build Coastguard Worker except target resolution. 359*495ae853SAndroid Build Coastguard Worker */ 360*495ae853SAndroid Build Coastguard Worker WORD8 i1_constrained_intra_rsmpl_flag; /*!< Constrained intra resampling 361*495ae853SAndroid Build Coastguard Worker flag. Range is [0,1]. 362*495ae853SAndroid Build Coastguard Worker */ 363*495ae853SAndroid Build Coastguard Worker WORD8 i1_ref_lyr_chroma_phase_x_plus1_flag; /*!< specifies the horizontal 364*495ae853SAndroid Build Coastguard Worker phase shift of the chroma components in 365*495ae853SAndroid Build Coastguard Worker units of half luma samples of a layer 366*495ae853SAndroid Build Coastguard Worker frame for the layer pictures that may be 367*495ae853SAndroid Build Coastguard Worker used for inter-layer prediction 368*495ae853SAndroid Build Coastguard Worker */ 369*495ae853SAndroid Build Coastguard Worker 370*495ae853SAndroid Build Coastguard Worker WORD8 i1_ref_lyr_chroma_phase_y_plus1; /*!< specifies the vertical phase 371*495ae853SAndroid Build Coastguard Worker shift of the chroma components in units of 372*495ae853SAndroid Build Coastguard Worker half luma samples of a layer frame for the 373*495ae853SAndroid Build Coastguard Worker layer pictures that may be used for 374*495ae853SAndroid Build Coastguard Worker inter-layer prediction 375*495ae853SAndroid Build Coastguard Worker */ 376*495ae853SAndroid Build Coastguard Worker UWORD8 u1_direct_8x8_inference_flag; /*!< Direct 8x8 inference flag 377*495ae853SAndroid Build Coastguard Worker . Range is [0,1]. 378*495ae853SAndroid Build Coastguard Worker */ 379*495ae853SAndroid Build Coastguard Worker 380*495ae853SAndroid Build Coastguard Worker UWORD8 u1_remap_req_flag; /*!< this flag signifies to the 381*495ae853SAndroid Build Coastguard Worker upsampling modules whether the Map 382*495ae853SAndroid Build Coastguard Worker buffers have to recomputed for current 383*495ae853SAndroid Build Coastguard Worker access unit or to retain the previous 384*495ae853SAndroid Build Coastguard Worker access units values 385*495ae853SAndroid Build Coastguard Worker */ 386*495ae853SAndroid Build Coastguard Worker UWORD8 u1_dyadic_flag; /*!< this flag signifies the scaling 387*495ae853SAndroid Build Coastguard Worker ratios are 2 in both directions 388*495ae853SAndroid Build Coastguard Worker and the cropping is MB aligned 389*495ae853SAndroid Build Coastguard Worker */ 390*495ae853SAndroid Build Coastguard Worker } res_prms_t; 391*495ae853SAndroid Build Coastguard Worker 392*495ae853SAndroid Build Coastguard Worker typedef struct 393*495ae853SAndroid Build Coastguard Worker { 394*495ae853SAndroid Build Coastguard Worker ref_pixel_map_t *ps_x_pos_phase; /*!< buffers to store the projected 395*495ae853SAndroid Build Coastguard Worker referecne X and phase X for each 396*495ae853SAndroid Build Coastguard Worker pixel in current layer in 397*495ae853SAndroid Build Coastguard Worker horizontal direction 398*495ae853SAndroid Build Coastguard Worker */ 399*495ae853SAndroid Build Coastguard Worker ref_pixel_map_t *ps_y_pos_phase; /*!< buffers to store the projected 400*495ae853SAndroid Build Coastguard Worker referecne Y and phase Y for each 401*495ae853SAndroid Build Coastguard Worker pixel in current layer in 402*495ae853SAndroid Build Coastguard Worker vertical direction 403*495ae853SAndroid Build Coastguard Worker */ 404*495ae853SAndroid Build Coastguard Worker ref_mb_map_t *ps_x_offset_length; /*!< buffers to store the projected 405*495ae853SAndroid Build Coastguard Worker start point of reference window and 406*495ae853SAndroid Build Coastguard Worker reference array width in 407*495ae853SAndroid Build Coastguard Worker horizontal direction for each MB in 408*495ae853SAndroid Build Coastguard Worker current layer 409*495ae853SAndroid Build Coastguard Worker */ 410*495ae853SAndroid Build Coastguard Worker ref_mb_map_t *ps_y_offset_length; /*!< buffers to store the projected 411*495ae853SAndroid Build Coastguard Worker start point of reference window and 412*495ae853SAndroid Build Coastguard Worker reference array height in 413*495ae853SAndroid Build Coastguard Worker vertical direction for each MB in 414*495ae853SAndroid Build Coastguard Worker current layer 415*495ae853SAndroid Build Coastguard Worker */ 416*495ae853SAndroid Build Coastguard Worker ref_min_max_map_t *ps_x_min_max; 417*495ae853SAndroid Build Coastguard Worker /*!< Buffer to store the projected 418*495ae853SAndroid Build Coastguard Worker MIN and MAX referecne position for a 419*495ae853SAndroid Build Coastguard Worker MB in current layer in 420*495ae853SAndroid Build Coastguard Worker horizontal direction 421*495ae853SAndroid Build Coastguard Worker */ 422*495ae853SAndroid Build Coastguard Worker 423*495ae853SAndroid Build Coastguard Worker ref_min_max_map_t *ps_y_min_max; 424*495ae853SAndroid Build Coastguard Worker /*!< Buffer to store the projected 425*495ae853SAndroid Build Coastguard Worker MIN and MAX referecne position for a 426*495ae853SAndroid Build Coastguard Worker MB in current layer in 427*495ae853SAndroid Build Coastguard Worker Vertical direction 428*495ae853SAndroid Build Coastguard Worker */ 429*495ae853SAndroid Build Coastguard Worker 430*495ae853SAndroid Build Coastguard Worker WORD16 *pi2_xd_index; /*!< buffers to store the projected 431*495ae853SAndroid Build Coastguard Worker XD for each pixel in an MB 432*495ae853SAndroid Build Coastguard Worker */ 433*495ae853SAndroid Build Coastguard Worker WORD16 *pi2_yd_index; /*!< buffers to store the projected 434*495ae853SAndroid Build Coastguard Worker YD for each pixel in an MB 435*495ae853SAndroid Build Coastguard Worker */ 436*495ae853SAndroid Build Coastguard Worker WORD16 *pi2_ya_index; /*!< buffers to store the projected 437*495ae853SAndroid Build Coastguard Worker YA for each pixel in an MB 438*495ae853SAndroid Build Coastguard Worker */ 439*495ae853SAndroid Build Coastguard Worker 440*495ae853SAndroid Build Coastguard Worker seg_lookup_desc_t *ps_seg_lookup_horz; /*!< buffers to store lookup for 441*495ae853SAndroid Build Coastguard Worker horizontal segment description */ 442*495ae853SAndroid Build Coastguard Worker 443*495ae853SAndroid Build Coastguard Worker seg_lookup_desc_t *ps_seg_lookup_vert; /*!< buffers to store lookup for 444*495ae853SAndroid Build Coastguard Worker vertical segment description */ 445*495ae853SAndroid Build Coastguard Worker 446*495ae853SAndroid Build Coastguard Worker UWORD8 *pu1_refarray_x_idx; /*!< buffers to store lookup for 447*495ae853SAndroid Build Coastguard Worker x indexes to get availability 448*495ae853SAndroid Build Coastguard Worker from 4x4 availability grid */ 449*495ae853SAndroid Build Coastguard Worker 450*495ae853SAndroid Build Coastguard Worker UWORD8 *pu1_refarray_y_idx; /*!< buffers to store lookup for 451*495ae853SAndroid Build Coastguard Worker y indexes to get availability 452*495ae853SAndroid Build Coastguard Worker from 4x4 availability grid */ 453*495ae853SAndroid Build Coastguard Worker } intra_samp_map_ctxt_t; 454*495ae853SAndroid Build Coastguard Worker 455*495ae853SAndroid Build Coastguard Worker typedef struct 456*495ae853SAndroid Build Coastguard Worker { 457*495ae853SAndroid Build Coastguard Worker intra_samp_map_ctxt_t s_luma_map_ctxt; /*!< map structure for luma 458*495ae853SAndroid Build Coastguard Worker projected locations 459*495ae853SAndroid Build Coastguard Worker for curr resolution layer 460*495ae853SAndroid Build Coastguard Worker */ 461*495ae853SAndroid Build Coastguard Worker intra_samp_map_ctxt_t s_chroma_map_ctxt; /*!< map structure for chroma 462*495ae853SAndroid Build Coastguard Worker projected locations 463*495ae853SAndroid Build Coastguard Worker for curr resolution layer 464*495ae853SAndroid Build Coastguard Worker */ 465*495ae853SAndroid Build Coastguard Worker WORD32 i4_ref_width; /*!< reference layer width in 466*495ae853SAndroid Build Coastguard Worker terms luma samples 467*495ae853SAndroid Build Coastguard Worker */ 468*495ae853SAndroid Build Coastguard Worker WORD32 i4_ref_height; /*!< reference layer height in 469*495ae853SAndroid Build Coastguard Worker terms luma samples 470*495ae853SAndroid Build Coastguard Worker */ 471*495ae853SAndroid Build Coastguard Worker WORD32 i4_curr_width; /*!< current layer width in 472*495ae853SAndroid Build Coastguard Worker terms luma samples 473*495ae853SAndroid Build Coastguard Worker */ 474*495ae853SAndroid Build Coastguard Worker WORD32 i4_curr_height; /*!< current layer height in 475*495ae853SAndroid Build Coastguard Worker terms luma samples 476*495ae853SAndroid Build Coastguard Worker */ 477*495ae853SAndroid Build Coastguard Worker WORD8 i1_constrained_intra_rsmpl_flag; /*!< Constrained intra resampling 478*495ae853SAndroid Build Coastguard Worker flag. Range is [0,1]. 479*495ae853SAndroid Build Coastguard Worker */ 480*495ae853SAndroid Build Coastguard Worker WORD32 i4_x_phase_0; /*!< Chroma xPhase for even 481*495ae853SAndroid Build Coastguard Worker values of x for dyadic cases 482*495ae853SAndroid Build Coastguard Worker */ 483*495ae853SAndroid Build Coastguard Worker WORD32 i4_x_phase_1; /*!< Chroma xPhase for odd 484*495ae853SAndroid Build Coastguard Worker values of x for dyadic cases 485*495ae853SAndroid Build Coastguard Worker */ 486*495ae853SAndroid Build Coastguard Worker WORD32 i4_y_phase_0; /*!< Chroma yPhase for even 487*495ae853SAndroid Build Coastguard Worker values of y for dyadic cases 488*495ae853SAndroid Build Coastguard Worker */ 489*495ae853SAndroid Build Coastguard Worker WORD32 i4_y_phase_1; /*!< Chroma yPhase for odd 490*495ae853SAndroid Build Coastguard Worker values of y for dyadic cases 491*495ae853SAndroid Build Coastguard Worker */ 492*495ae853SAndroid Build Coastguard Worker pf_vert_interpol_chroma_dyadic pf_vert_chroma_interpol; 493*495ae853SAndroid Build Coastguard Worker /*!< Vertical interpolation 494*495ae853SAndroid Build Coastguard Worker function for chroma 495*495ae853SAndroid Build Coastguard Worker */ 496*495ae853SAndroid Build Coastguard Worker pf_horz_interpol_chroma_dyadic pf_horz_chroma_interpol; 497*495ae853SAndroid Build Coastguard Worker /*!< Horizontal interpolation 498*495ae853SAndroid Build Coastguard Worker function for chroma 499*495ae853SAndroid Build Coastguard Worker */ 500*495ae853SAndroid Build Coastguard Worker } intra_samp_lyr_ctxt; 501*495ae853SAndroid Build Coastguard Worker typedef struct 502*495ae853SAndroid Build Coastguard Worker { 503*495ae853SAndroid Build Coastguard Worker intra_samp_lyr_ctxt as_res_lyrs[MAX_NUM_RES_LYRS]; /*!< Array of resolution 504*495ae853SAndroid Build Coastguard Worker layer ctxt. 505*495ae853SAndroid Build Coastguard Worker The first strcuture in the 506*495ae853SAndroid Build Coastguard Worker array will be used for storing 507*495ae853SAndroid Build Coastguard Worker the "second resolution" map in 508*495ae853SAndroid Build Coastguard Worker an access unit w.r.t to its 509*495ae853SAndroid Build Coastguard Worker base resolution, and for base 510*495ae853SAndroid Build Coastguard Worker resolution nothing will be 511*495ae853SAndroid Build Coastguard Worker computed or stored 512*495ae853SAndroid Build Coastguard Worker */ 513*495ae853SAndroid Build Coastguard Worker void *ps_sps; /*!< pointer to array of SPS 514*495ae853SAndroid Build Coastguard Worker */ 515*495ae853SAndroid Build Coastguard Worker 516*495ae853SAndroid Build Coastguard Worker UWORD8 *pu1_refarray_buffer; /*!< buffer to store the reference 517*495ae853SAndroid Build Coastguard Worker layer data before intra 518*495ae853SAndroid Build Coastguard Worker sampling 519*495ae853SAndroid Build Coastguard Worker */ 520*495ae853SAndroid Build Coastguard Worker UWORD8 *pu1_refarray_cb; /*!< buffer to hold the reference 521*495ae853SAndroid Build Coastguard Worker layer Cb data before intra 522*495ae853SAndroid Build Coastguard Worker resampling (used for dyadic 523*495ae853SAndroid Build Coastguard Worker cases only) 524*495ae853SAndroid Build Coastguard Worker */ 525*495ae853SAndroid Build Coastguard Worker UWORD8 *pu1_refarray_cr; /*!< buffer to hold the reference 526*495ae853SAndroid Build Coastguard Worker layer Cr data before intra 527*495ae853SAndroid Build Coastguard Worker resampling (used for dyadic 528*495ae853SAndroid Build Coastguard Worker cases only) 529*495ae853SAndroid Build Coastguard Worker */ 530*495ae853SAndroid Build Coastguard Worker WORD32 *pi4_temp_interpolation_buffer; /*!< intermideate buffer 531*495ae853SAndroid Build Coastguard Worker for interpolation 532*495ae853SAndroid Build Coastguard Worker */ 533*495ae853SAndroid Build Coastguard Worker 534*495ae853SAndroid Build Coastguard Worker WORD32 i4_res_lyr_id; /*!< resolution id of the layer 535*495ae853SAndroid Build Coastguard Worker which is to be processed 536*495ae853SAndroid Build Coastguard Worker */ 537*495ae853SAndroid Build Coastguard Worker WORD32 i4_ref_width; /*!< reference layer width in 538*495ae853SAndroid Build Coastguard Worker terms luma samples 539*495ae853SAndroid Build Coastguard Worker */ 540*495ae853SAndroid Build Coastguard Worker 541*495ae853SAndroid Build Coastguard Worker WORD32 i4_refarray_stride; /*!< reference layer width in 542*495ae853SAndroid Build Coastguard Worker terms luma samples 543*495ae853SAndroid Build Coastguard Worker */ 544*495ae853SAndroid Build Coastguard Worker 545*495ae853SAndroid Build Coastguard Worker WORD32 i4_ref_height; /*!< reference layer height in 546*495ae853SAndroid Build Coastguard Worker terms luma samples 547*495ae853SAndroid Build Coastguard Worker */ 548*495ae853SAndroid Build Coastguard Worker res_prms_t *ps_res_prms; /*!< Current resolution params 549*495ae853SAndroid Build Coastguard Worker */ 550*495ae853SAndroid Build Coastguard Worker } intra_sampling_ctxt_t; 551*495ae853SAndroid Build Coastguard Worker 552*495ae853SAndroid Build Coastguard Worker void svcd_intra_samp_mb_dyadic(void *pv_intra_samp_ctxt, mem_element_t *ps_ref_luma, 553*495ae853SAndroid Build Coastguard Worker mem_element_t *ps_ref_chroma, mem_element_t *ps_ref_mb_mode_map, 554*495ae853SAndroid Build Coastguard Worker mem_element_t *ps_curr_luma, mem_element_t *ps_curr_chroma, 555*495ae853SAndroid Build Coastguard Worker UWORD16 u2_mb_x, UWORD16 u2_mb_y, void *ps_dec); 556*495ae853SAndroid Build Coastguard Worker 557*495ae853SAndroid Build Coastguard Worker void svcd_residual_samp_mb_dyadic(void *pv_residual_samp_ctxt, mem_element_t *ps_ref_luma, 558*495ae853SAndroid Build Coastguard Worker mem_element_t *ps_ref_chroma, mem_element_t *ps_ref_luma_bitmap, 559*495ae853SAndroid Build Coastguard Worker mem_element_t *ps_ref_chroma_bitmap, 560*495ae853SAndroid Build Coastguard Worker mem_element_t *ps_ref_mb_mode, mem_element_t *ps_out_luma, 561*495ae853SAndroid Build Coastguard Worker mem_element_t *ps_out_chroma, UWORD16 u2_mb_x, UWORD16 u2_mb_y); 562*495ae853SAndroid Build Coastguard Worker 563*495ae853SAndroid Build Coastguard Worker void svcd_intra_samp_populate_res_prms(void *ps_dec); 564*495ae853SAndroid Build Coastguard Worker 565*495ae853SAndroid Build Coastguard Worker void svcd_intra_samp_res_init(void *pv_intra_samp_ctxt, res_prms_t *ps_curr_lyr_res_prms, 566*495ae853SAndroid Build Coastguard Worker ref_mb_map_t **pps_luma_map_horz, ref_mb_map_t **pps_chroma_map_horz, 567*495ae853SAndroid Build Coastguard Worker ref_mb_map_t **pps_luma_map_vert, ref_mb_map_t **pps_chroma_map_vert, 568*495ae853SAndroid Build Coastguard Worker void *ps_dec); 569*495ae853SAndroid Build Coastguard Worker 570*495ae853SAndroid Build Coastguard Worker #endif /* _ISVCD_RESAMP_SVC_H_ */ 571