Hamsalekha S | 8d3d303 | 2015-03-13 21:24:58 +0530 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Copyright (C) 2015 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 | #include <string.h> |
| 22 | |
| 23 | #include "ih264_typedefs.h" |
| 24 | #include "iv.h" |
| 25 | #include "ivd.h" |
| 26 | #include "ih264_macros.h" |
| 27 | #include "ih264_platform_macros.h" |
| 28 | #include "ih264d_debug.h" |
| 29 | #include "ih264d_defs.h" |
| 30 | #include "ih264d_defs.h" |
| 31 | #include "ih264d_structs.h" |
| 32 | #include "ih264d_deblocking.h" |
| 33 | #include "ih264d_mb_utils.h" |
| 34 | #include "ih264d_error_handler.h" |
| 35 | #include "ih264d_utils.h" |
| 36 | |
| 37 | |
| 38 | #include "ih264d_defs.h" |
| 39 | #include "ih264d_format_conv.h" |
| 40 | #include "ih264d_deblocking.h" |
| 41 | #include "ih264d_tables.h" |
| 42 | //extern UWORD8 *g_dest_y, *g_dest_uv; |
| 43 | |
| 44 | /*! |
| 45 | ************************************************************************* |
| 46 | * \file ih264d_deblocking.c |
| 47 | * |
| 48 | * \brief |
| 49 | * Decoder specific deblocking routines |
| 50 | * |
| 51 | * \author AI |
| 52 | ************************************************************************* |
| 53 | */ |
| 54 | |
| 55 | /*! |
| 56 | ************************************************************************** |
| 57 | * \if Function name : HorizonPad \endif |
| 58 | * |
| 59 | * \brief |
| 60 | * Does the Horizontal padding on a whole pic. |
| 61 | * |
| 62 | * \return |
| 63 | * None |
| 64 | ************************************************************************** |
| 65 | */ |
| 66 | |
| 67 | /*! |
| 68 | ************************************************************************** |
| 69 | * \if Function name : FilterBoundaryLeft \endif |
| 70 | * |
| 71 | * \brief |
| 72 | * Filters MacroBlock Left Boundary egdes. |
| 73 | * |
| 74 | * \return |
| 75 | * None |
| 76 | ************************************************************************** |
| 77 | */ |
| 78 | void ih264d_filter_boundary_left_nonmbaff(dec_struct_t *ps_dec, |
| 79 | tfr_ctxt_t * ps_tfr_cxt, |
| 80 | WORD8 i1_cb_qp_idx_ofst, |
| 81 | WORD8 i1_cr_qp_idx_ofst, |
| 82 | deblk_mb_t * ps_cur_mb, |
| 83 | UWORD16 i4_strd_y, |
| 84 | UWORD16 i4_strd_uv, |
| 85 | deblk_mb_t * ps_left_mb, |
| 86 | UWORD32 pu4_bs_tab[], |
| 87 | UWORD8 u1_cur_fld) |
| 88 | { |
| 89 | UWORD8 *pu1_y, *pu1_u, *pu1_v; |
| 90 | WORD32 uc_tmp, qp_avg; |
| 91 | WORD32 alpha_u = 0, beta_u = 0, alpha_v = 0, beta_v = 0; |
| 92 | WORD32 alpha_y = 0, beta_y = 0; |
| 93 | |
| 94 | WORD32 idx_b_u, idx_a_u, idx_b_v, idx_a_v; |
| 95 | WORD32 idx_b_y, idx_a_y; |
| 96 | |
| 97 | UWORD32 u4_bs_val; |
| 98 | |
| 99 | UWORD8 *pu1_cliptab_u, *pu1_cliptab_v, *pu1_cliptab_y; |
| 100 | |
| 101 | UWORD8 u1_double_cl = !ps_cur_mb->u1_single_call; |
| 102 | WORD32 ofst_a = ps_cur_mb->i1_slice_alpha_c0_offset; |
| 103 | WORD32 ofst_b = ps_cur_mb->i1_slice_beta_offset; |
| 104 | |
| 105 | PROFILE_DISABLE_DEBLK() |
| 106 | |
| 107 | pu1_y = ps_tfr_cxt->pu1_mb_y; |
| 108 | pu1_u = ps_tfr_cxt->pu1_mb_u; |
| 109 | pu1_v = ps_tfr_cxt->pu1_mb_v; |
| 110 | |
| 111 | /* LUMA values */ |
| 112 | /* Deblock rounding change */ |
| 113 | qp_avg = |
| 114 | (UWORD8)((ps_cur_mb->u1_left_mb_qp + ps_cur_mb->u1_mb_qp + 1) |
| 115 | >> 1); |
| 116 | |
| 117 | idx_a_y = qp_avg + ofst_a; |
| 118 | alpha_y = gau1_ih264d_alpha_table[12 + idx_a_y]; |
| 119 | idx_b_y = qp_avg + ofst_b; |
| 120 | beta_y = gau1_ih264d_beta_table[12 + idx_b_y]; |
| 121 | |
| 122 | /* Chroma cb values */ |
| 123 | { |
| 124 | UWORD8 u1_mb_qp1, u1_mb_qp2; |
| 125 | u1_mb_qp1 = (ps_cur_mb->u1_left_mb_qp + i1_cb_qp_idx_ofst); |
| 126 | u1_mb_qp2 = (ps_cur_mb->u1_mb_qp + i1_cb_qp_idx_ofst); |
| 127 | qp_avg = (UWORD8)((gau1_ih264d_qp_scale_cr[12 + u1_mb_qp1] |
| 128 | + gau1_ih264d_qp_scale_cr[12 + u1_mb_qp2] + 1) >> 1); |
| 129 | } |
| 130 | idx_a_u = qp_avg + ofst_a; |
| 131 | alpha_u = gau1_ih264d_alpha_table[12 + idx_a_u]; |
| 132 | idx_b_u = qp_avg + ofst_b; |
| 133 | beta_u = gau1_ih264d_beta_table[12 + idx_b_u]; |
| 134 | /* Chroma cr values */ |
| 135 | { |
| 136 | UWORD8 u1_mb_qp1, u1_mb_qp2; |
| 137 | u1_mb_qp1 = (ps_cur_mb->u1_left_mb_qp + i1_cr_qp_idx_ofst); |
| 138 | u1_mb_qp2 = (ps_cur_mb->u1_mb_qp + i1_cr_qp_idx_ofst); |
| 139 | qp_avg = (UWORD8)((gau1_ih264d_qp_scale_cr[12 + u1_mb_qp1] |
| 140 | + gau1_ih264d_qp_scale_cr[12 + u1_mb_qp2] + 1) >> 1); |
| 141 | } |
| 142 | idx_a_v = qp_avg + ofst_a; |
| 143 | alpha_v = gau1_ih264d_alpha_table[12 + idx_a_v]; |
| 144 | idx_b_v = qp_avg + ofst_b; |
| 145 | beta_v = gau1_ih264d_beta_table[12 + idx_b_v]; |
| 146 | |
| 147 | if(u1_double_cl == 0) |
| 148 | { |
| 149 | u4_bs_val = pu4_bs_tab[4]; |
| 150 | |
| 151 | if(0x04040404 == u4_bs_val) |
| 152 | { |
| 153 | ps_dec->pf_deblk_luma_vert_bs4(pu1_y, i4_strd_y, alpha_y, beta_y); |
| 154 | ps_dec->pf_deblk_chroma_vert_bs4(pu1_u, i4_strd_uv, alpha_u, |
| 155 | beta_u, alpha_v, beta_v); |
| 156 | } |
| 157 | else |
| 158 | { |
| 159 | if(u4_bs_val) |
| 160 | { |
| 161 | |
| 162 | pu1_cliptab_y = (UWORD8 *)&gau1_ih264d_clip_table[12 |
| 163 | + idx_a_y]; |
| 164 | pu1_cliptab_u = (UWORD8 *)&gau1_ih264d_clip_table[12 |
| 165 | + idx_a_u]; |
| 166 | pu1_cliptab_v = (UWORD8 *)&gau1_ih264d_clip_table[12 |
| 167 | + idx_a_v]; |
| 168 | ps_dec->pf_deblk_luma_vert_bslt4(pu1_y, i4_strd_y, alpha_y, |
| 169 | beta_y, u4_bs_val, |
| 170 | pu1_cliptab_y); |
| 171 | ps_dec->pf_deblk_chroma_vert_bslt4(pu1_u, i4_strd_uv, alpha_u, |
| 172 | beta_u, alpha_v, beta_v, |
| 173 | u4_bs_val, pu1_cliptab_u, |
| 174 | pu1_cliptab_v); |
| 175 | |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | } |
| 180 | else |
| 181 | { |
| 182 | |
| 183 | i4_strd_y <<= (!u1_cur_fld); |
| 184 | u4_bs_val = pu4_bs_tab[4]; |
| 185 | i4_strd_uv <<= (!u1_cur_fld); |
| 186 | |
| 187 | if(0x04040404 == u4_bs_val) |
| 188 | { |
| 189 | |
| 190 | ps_dec->pf_deblk_luma_vert_bs4_mbaff(pu1_y, i4_strd_y, alpha_y, |
| 191 | beta_y); |
| 192 | ps_dec->pf_deblk_chroma_vert_bs4_mbaff(pu1_u, i4_strd_uv, alpha_u, |
| 193 | beta_u, alpha_v, beta_v); |
| 194 | |
| 195 | } |
| 196 | else |
| 197 | { |
| 198 | if(u4_bs_val) |
| 199 | { |
| 200 | |
| 201 | pu1_cliptab_y = (UWORD8 *)&gau1_ih264d_clip_table[12 |
| 202 | + idx_a_y]; |
| 203 | pu1_cliptab_u = (UWORD8 *)&gau1_ih264d_clip_table[12 |
| 204 | + idx_a_u]; |
| 205 | pu1_cliptab_v = (UWORD8 *)&gau1_ih264d_clip_table[12 |
| 206 | + idx_a_v]; |
| 207 | |
| 208 | ps_dec->pf_deblk_luma_vert_bslt4_mbaff(pu1_y, i4_strd_y, |
| 209 | alpha_y, beta_y, |
| 210 | u4_bs_val, |
| 211 | pu1_cliptab_y); |
| 212 | ps_dec->pf_deblk_chroma_vert_bslt4_mbaff(pu1_u, i4_strd_uv, |
| 213 | alpha_u, beta_u, |
| 214 | alpha_v, beta_v, |
| 215 | u4_bs_val, |
| 216 | pu1_cliptab_u, |
| 217 | pu1_cliptab_v); |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | { |
| 222 | |
| 223 | UWORD16 u2_shift = (i4_strd_y >> 1) << (u1_cur_fld ? 4 : 0); |
| 224 | pu1_y += u2_shift; |
| 225 | u2_shift = (i4_strd_uv >> 1) << (u1_cur_fld ? 3 : 0); |
| 226 | pu1_u += u2_shift; |
| 227 | pu1_v += u2_shift; |
| 228 | } |
| 229 | |
| 230 | qp_avg = (((ps_left_mb + 1)->u1_mb_qp + ps_cur_mb->u1_mb_qp + 1) >> 1); |
| 231 | |
| 232 | idx_a_y = qp_avg + ofst_a; |
| 233 | alpha_y = gau1_ih264d_alpha_table[12 + idx_a_y]; |
| 234 | idx_b_y = qp_avg + ofst_b; |
| 235 | beta_y = gau1_ih264d_beta_table[12 + idx_b_y]; |
| 236 | u4_bs_val = pu4_bs_tab[9]; |
| 237 | |
| 238 | { |
| 239 | UWORD8 u1_mb_qp1, u1_mb_qp2; |
| 240 | u1_mb_qp1 = ((ps_left_mb + 1)->u1_mb_qp + i1_cb_qp_idx_ofst); |
| 241 | u1_mb_qp2 = (ps_cur_mb->u1_mb_qp + i1_cb_qp_idx_ofst); |
| 242 | qp_avg = (UWORD8)((gau1_ih264d_qp_scale_cr[12 + u1_mb_qp1] |
| 243 | + gau1_ih264d_qp_scale_cr[12 + u1_mb_qp2] + 1) >> 1); |
| 244 | } |
| 245 | idx_a_u = qp_avg + ofst_a; |
| 246 | alpha_u = gau1_ih264d_alpha_table[12 + idx_a_u]; |
| 247 | idx_b_u = qp_avg + ofst_b; |
| 248 | beta_u = gau1_ih264d_beta_table[12 + idx_b_u]; |
| 249 | u4_bs_val = pu4_bs_tab[9]; |
| 250 | { |
| 251 | UWORD8 u1_mb_qp1, u1_mb_qp2; |
| 252 | u1_mb_qp1 = ((ps_left_mb + 1)->u1_mb_qp + i1_cr_qp_idx_ofst); |
| 253 | u1_mb_qp2 = (ps_cur_mb->u1_mb_qp + i1_cr_qp_idx_ofst); |
| 254 | qp_avg = (UWORD8)((gau1_ih264d_qp_scale_cr[12 + u1_mb_qp1] |
| 255 | + gau1_ih264d_qp_scale_cr[12 + u1_mb_qp2] + 1) >> 1); |
| 256 | } |
| 257 | idx_a_v = qp_avg + ofst_a; |
| 258 | alpha_v = gau1_ih264d_alpha_table[12 + idx_a_v]; |
| 259 | idx_b_v = qp_avg + ofst_b; |
| 260 | beta_v = gau1_ih264d_beta_table[12 + idx_b_v]; |
| 261 | |
| 262 | if(0x04040404 == u4_bs_val) |
| 263 | { |
| 264 | ps_dec->pf_deblk_luma_vert_bs4_mbaff(pu1_y, i4_strd_y, alpha_y, |
| 265 | beta_y); |
| 266 | ps_dec->pf_deblk_chroma_vert_bs4_mbaff(pu1_u, i4_strd_uv, alpha_u, |
| 267 | beta_u, alpha_v, beta_v); |
| 268 | |
| 269 | } |
| 270 | else |
| 271 | { |
| 272 | if(u4_bs_val) |
| 273 | { |
| 274 | |
| 275 | pu1_cliptab_y = (UWORD8 *)&gau1_ih264d_clip_table[12 |
| 276 | + idx_a_y]; |
| 277 | pu1_cliptab_u = (UWORD8 *)&gau1_ih264d_clip_table[12 |
| 278 | + idx_a_u]; |
| 279 | pu1_cliptab_v = (UWORD8 *)&gau1_ih264d_clip_table[12 |
| 280 | + idx_a_v]; |
| 281 | |
| 282 | ps_dec->pf_deblk_luma_vert_bslt4_mbaff(pu1_y, i4_strd_y, |
| 283 | alpha_y, beta_y, |
| 284 | u4_bs_val, |
| 285 | pu1_cliptab_y); |
| 286 | ps_dec->pf_deblk_chroma_vert_bslt4_mbaff(pu1_u, i4_strd_uv, |
| 287 | alpha_u, beta_u, |
| 288 | alpha_v, beta_v, |
| 289 | u4_bs_val, |
| 290 | pu1_cliptab_u, |
| 291 | pu1_cliptab_v); |
| 292 | |
| 293 | } |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | } |
| 298 | |
| 299 | /*! |
| 300 | ************************************************************************** |
| 301 | * \if Function name : FilterBoundaryTop \endif |
| 302 | * |
| 303 | * \brief |
| 304 | * Filters MacroBlock Top Boundary egdes. |
| 305 | * |
| 306 | * \return |
| 307 | * None |
| 308 | ************************************************************************** |
| 309 | */ |
| 310 | |
| 311 | void ih264d_filter_boundary_top_nonmbaff(dec_struct_t *ps_dec, |
| 312 | tfr_ctxt_t * ps_tfr_cxt, |
| 313 | WORD8 i1_cb_qp_idx_ofst, |
| 314 | WORD8 i1_cr_qp_idx_ofst, |
| 315 | deblk_mb_t * ps_cur_mb, |
| 316 | UWORD16 i4_strd_y, |
| 317 | UWORD16 i4_strd_uv, |
| 318 | deblk_mb_t * ps_top_mb, |
| 319 | UWORD32 u4_bs) |
| 320 | { |
| 321 | UWORD8 *pu1_y, *pu1_u; |
| 322 | WORD32 alpha_u = 0, beta_u = 0, alpha_v = 0, beta_v = 0; |
| 323 | WORD32 alpha_y = 0, beta_y = 0; |
| 324 | WORD32 qp_avg; |
| 325 | WORD32 uc_QPav_Y; |
| 326 | WORD32 idx_b_u, idx_a_u, idx_b_v, idx_a_v; |
| 327 | WORD32 idx_b_y, idx_a_y; |
| 328 | UWORD16 uc_tmp; |
| 329 | |
| 330 | UWORD8 *pu1_cliptab_u, *pu1_cliptab_v, *pu1_cliptab_y; |
| 331 | WORD32 ofst_a = ps_cur_mb->i1_slice_alpha_c0_offset; |
| 332 | WORD32 ofst_b = ps_cur_mb->i1_slice_beta_offset; |
| 333 | |
| 334 | UNUSED(ps_top_mb); |
| 335 | /* LUMA values */ |
| 336 | /* Deblock rounding change */ |
| 337 | uc_tmp = ((ps_cur_mb->u1_topmb_qp + ps_cur_mb->u1_mb_qp + 1) >> 1); |
| 338 | uc_QPav_Y = (UWORD8)uc_tmp; |
| 339 | idx_a_y = uc_QPav_Y + ofst_a; |
| 340 | alpha_y = gau1_ih264d_alpha_table[12 + idx_a_y]; |
| 341 | idx_b_y = uc_QPav_Y + ofst_b; |
| 342 | beta_y = gau1_ih264d_beta_table[12 + idx_b_y]; |
| 343 | pu1_y = ps_tfr_cxt->pu1_mb_y; |
| 344 | |
| 345 | /* CHROMA cb values */ |
| 346 | { |
| 347 | UWORD8 u1_mb_qp1, u1_mb_qp2; |
| 348 | u1_mb_qp1 = (ps_cur_mb->u1_topmb_qp + i1_cb_qp_idx_ofst); |
| 349 | u1_mb_qp2 = (ps_cur_mb->u1_mb_qp + i1_cb_qp_idx_ofst); |
| 350 | qp_avg = (UWORD8)((gau1_ih264d_qp_scale_cr[12 + u1_mb_qp1] |
| 351 | + gau1_ih264d_qp_scale_cr[12 + u1_mb_qp2] + 1) >> 1); |
| 352 | } |
| 353 | |
| 354 | idx_a_u = qp_avg + ofst_a; |
| 355 | alpha_u = gau1_ih264d_alpha_table[12 + idx_a_u]; |
| 356 | idx_b_u = qp_avg + ofst_b; |
| 357 | beta_u = gau1_ih264d_beta_table[12 + idx_b_u]; |
| 358 | /* CHROMA cr values */ |
| 359 | { |
| 360 | UWORD8 u1_mb_qp1, u1_mb_qp2; |
| 361 | u1_mb_qp1 = (ps_cur_mb->u1_topmb_qp + i1_cr_qp_idx_ofst); |
| 362 | u1_mb_qp2 = (ps_cur_mb->u1_mb_qp + i1_cr_qp_idx_ofst); |
| 363 | qp_avg = (UWORD8)((gau1_ih264d_qp_scale_cr[12 + u1_mb_qp1] |
| 364 | + gau1_ih264d_qp_scale_cr[12 + u1_mb_qp2] + 1) >> 1); |
| 365 | } |
| 366 | |
| 367 | idx_a_v = qp_avg + ofst_a; |
| 368 | alpha_v = gau1_ih264d_alpha_table[12 + idx_a_v]; |
| 369 | idx_b_v = qp_avg + ofst_b; |
| 370 | beta_v = gau1_ih264d_beta_table[12 + idx_b_v]; |
| 371 | pu1_u = ps_tfr_cxt->pu1_mb_u; |
| 372 | |
| 373 | if(u4_bs == 0x04040404) |
| 374 | { |
| 375 | /* Code specific to the assembly module */ |
| 376 | |
| 377 | ps_dec->pf_deblk_luma_horz_bs4(pu1_y, i4_strd_y, alpha_y, beta_y); |
| 378 | ps_dec->pf_deblk_chroma_horz_bs4(pu1_u, i4_strd_uv, alpha_u, beta_u, |
| 379 | alpha_v, beta_v); |
| 380 | } |
| 381 | else |
| 382 | { |
| 383 | if(u4_bs) |
| 384 | { |
| 385 | |
| 386 | pu1_cliptab_y = (UWORD8 *)&gau1_ih264d_clip_table[12 + idx_a_y]; |
| 387 | pu1_cliptab_u = |
| 388 | (UWORD8 *)&gau1_ih264d_clip_table[12 + idx_a_u]; |
| 389 | pu1_cliptab_v = |
| 390 | (UWORD8 *)&gau1_ih264d_clip_table[12 + idx_a_v]; |
| 391 | |
| 392 | ps_dec->pf_deblk_luma_horz_bslt4(pu1_y, i4_strd_y, alpha_y, beta_y, |
| 393 | u4_bs, pu1_cliptab_y); |
| 394 | ps_dec->pf_deblk_chroma_horz_bslt4(pu1_u, i4_strd_uv, alpha_u, |
| 395 | beta_u, alpha_v, beta_v, |
| 396 | u4_bs, pu1_cliptab_u, |
| 397 | pu1_cliptab_v); |
| 398 | |
| 399 | } |
| 400 | } |
| 401 | |
| 402 | } |
| 403 | |
| 404 | void ih264d_deblock_mb_nonmbaff(dec_struct_t *ps_dec, |
| 405 | tfr_ctxt_t * ps_tfr_cxt, |
| 406 | WORD8 i1_cb_qp_idx_ofst, |
| 407 | WORD8 i1_cr_qp_idx_ofst, |
| 408 | deblk_mb_t * ps_cur_mb, |
| 409 | WORD32 i4_strd_y, |
| 410 | WORD32 i4_strd_uv, |
| 411 | deblk_mb_t * ps_top_mb, |
| 412 | deblk_mb_t * ps_left_mb) |
| 413 | { |
| 414 | UWORD8 *pu1_y, *pu1_u; |
| 415 | UWORD32 u4_bs; |
| 416 | |
| 417 | WORD32 alpha, beta, alpha_u, beta_u, alpha_v, beta_v; |
| 418 | |
| 419 | UWORD8 *pu1_cliptab_u; |
| 420 | UWORD8 *pu1_cliptab_v; |
| 421 | UWORD8 *pu1_cliptab_y; |
| 422 | |
| 423 | UWORD32 * pu4_bs_tab = ps_cur_mb->u4_bs_table; |
| 424 | WORD32 idx_a_y, idx_a_u, idx_a_v; |
| 425 | |
| 426 | PROFILE_DISABLE_DEBLK() |
| 427 | /* Return from here to switch off deblocking */ |
| 428 | |
| 429 | /*---------------------------------------------------------------------*/ |
| 430 | /* Filter wrt Left edge */ |
| 431 | /* except */ |
| 432 | /* - Left Egde is Picture Boundary */ |
| 433 | /* - Left Egde is part of Slice Boundary and Deblocking */ |
| 434 | /* parameters of slice disable Filtering of Slice Boundary Edges*/ |
| 435 | /*---------------------------------------------------------------------*/ |
| 436 | if(ps_left_mb) |
| 437 | ih264d_filter_boundary_left_nonmbaff(ps_dec, ps_tfr_cxt, |
| 438 | i1_cb_qp_idx_ofst, |
| 439 | i1_cr_qp_idx_ofst, ps_cur_mb, |
| 440 | i4_strd_y, i4_strd_uv, ps_left_mb, |
| 441 | pu4_bs_tab, 0); |
| 442 | |
| 443 | /*--------------------------------------------------------------------*/ |
| 444 | /* Filter wrt Other Vertical Edges */ |
| 445 | /*--------------------------------------------------------------------*/ |
| 446 | { |
| 447 | WORD32 ofst_a, ofst_b, idx_b_y, idx_b_u, |
| 448 | idx_b_v; |
| 449 | WORD32 qp_avg, qp_avg_u, qp_avg_v; |
| 450 | ofst_a = ps_cur_mb->i1_slice_alpha_c0_offset; |
| 451 | ofst_b = ps_cur_mb->i1_slice_beta_offset; |
| 452 | |
| 453 | qp_avg = ps_cur_mb->u1_mb_qp; |
| 454 | |
| 455 | idx_a_y = qp_avg + ofst_a; |
| 456 | alpha = gau1_ih264d_alpha_table[12 + idx_a_y]; |
| 457 | idx_b_y = qp_avg + ofst_b; |
| 458 | beta = gau1_ih264d_beta_table[12 + idx_b_y]; |
| 459 | |
| 460 | /* CHROMA values */ |
| 461 | /* CHROMA Cb values */ |
| 462 | qp_avg_u = (qp_avg + i1_cb_qp_idx_ofst); |
| 463 | qp_avg_u = gau1_ih264d_qp_scale_cr[12 + qp_avg_u]; |
| 464 | idx_a_u = qp_avg_u + ofst_a; |
| 465 | alpha_u = gau1_ih264d_alpha_table[12 + idx_a_u]; |
| 466 | idx_b_u = qp_avg_u + ofst_b; |
| 467 | beta_u = gau1_ih264d_beta_table[12 + idx_b_u]; |
| 468 | /* CHROMA Cr values */ |
| 469 | qp_avg_v = (qp_avg + i1_cr_qp_idx_ofst); |
| 470 | qp_avg_v = gau1_ih264d_qp_scale_cr[12 + qp_avg_v]; |
| 471 | idx_a_v = qp_avg_v + ofst_a; |
| 472 | alpha_v = gau1_ih264d_alpha_table[12 + idx_a_v]; |
| 473 | idx_b_v = qp_avg_v + ofst_b; |
| 474 | beta_v = gau1_ih264d_beta_table[12 + idx_b_v]; |
| 475 | } |
| 476 | |
| 477 | pu1_cliptab_y = (UWORD8 *)&gau1_ih264d_clip_table[12 + idx_a_y]; //this for Luma |
| 478 | pu1_cliptab_u = (UWORD8 *)&gau1_ih264d_clip_table[12 + idx_a_u]; //this for chroma |
| 479 | pu1_cliptab_v = (UWORD8 *)&gau1_ih264d_clip_table[12 + idx_a_v]; //this for chroma |
| 480 | |
| 481 | //edge=1 |
| 482 | |
| 483 | |
| 484 | u4_bs = pu4_bs_tab[5]; |
| 485 | pu1_y = ps_tfr_cxt->pu1_mb_y; |
| 486 | pu1_u = ps_tfr_cxt->pu1_mb_u; |
| 487 | |
| 488 | if(u4_bs) |
| 489 | { |
| 490 | |
| 491 | ps_dec->pf_deblk_luma_vert_bslt4(pu1_y + 4, i4_strd_y, alpha, beta, |
| 492 | u4_bs, pu1_cliptab_y); |
| 493 | |
| 494 | } |
| 495 | //edge=2 |
| 496 | |
| 497 | u4_bs = pu4_bs_tab[6]; |
| 498 | if(u4_bs) |
| 499 | { |
| 500 | ps_dec->pf_deblk_luma_vert_bslt4(pu1_y + 8, i4_strd_y, alpha, beta, |
| 501 | u4_bs, pu1_cliptab_y); |
| 502 | ps_dec->pf_deblk_chroma_vert_bslt4(pu1_u + 4 * YUV420SP_FACTOR, |
| 503 | i4_strd_uv, alpha_u, beta_u, |
| 504 | alpha_v, beta_v, u4_bs, |
| 505 | pu1_cliptab_u, pu1_cliptab_v); |
| 506 | |
| 507 | } |
| 508 | //edge=3 |
| 509 | |
| 510 | u4_bs = pu4_bs_tab[7]; |
| 511 | if(u4_bs) |
| 512 | { |
| 513 | ps_dec->pf_deblk_luma_vert_bslt4(pu1_y + 12, i4_strd_y, alpha, beta, |
| 514 | u4_bs, pu1_cliptab_y); |
| 515 | |
| 516 | } |
| 517 | |
| 518 | /*--------------------------------------------------------------------*/ |
| 519 | /* Filter wrt Top edge */ |
| 520 | /* except */ |
| 521 | /* - Top Egde is Picture Boundary */ |
| 522 | /* - Top Egde is part of Slice Boundary and Deblocking */ |
| 523 | /* parameters of slice disable Filtering of Slice Boundary Edges*/ |
| 524 | /*--------------------------------------------------------------------*/ |
| 525 | if(ps_top_mb) |
| 526 | { |
| 527 | /** if top MB and MB AFF and cur MB is frame and top is field then */ |
| 528 | /* one extra top edge needs to be deblocked */ |
| 529 | |
| 530 | ih264d_filter_boundary_top_nonmbaff(ps_dec, ps_tfr_cxt, |
| 531 | i1_cb_qp_idx_ofst, |
| 532 | i1_cr_qp_idx_ofst, ps_cur_mb, |
| 533 | i4_strd_y, i4_strd_uv, ps_top_mb, |
| 534 | pu4_bs_tab[0]); |
| 535 | |
| 536 | } |
| 537 | |
| 538 | /*--------------------------------------------------------------------*/ |
| 539 | /* Filter wrt Other Horizontal Edges */ |
| 540 | /*--------------------------------------------------------------------*/ |
| 541 | |
| 542 | //edge1 |
| 543 | u4_bs = pu4_bs_tab[1]; |
| 544 | |
| 545 | if(u4_bs) |
| 546 | { |
| 547 | ps_dec->pf_deblk_luma_horz_bslt4(pu1_y + (i4_strd_y << 2), i4_strd_y, |
| 548 | alpha, beta, u4_bs, pu1_cliptab_y); |
| 549 | |
| 550 | } |
| 551 | //edge2 |
| 552 | u4_bs = pu4_bs_tab[2]; |
| 553 | |
| 554 | if(u4_bs) |
| 555 | { |
| 556 | |
| 557 | ps_dec->pf_deblk_luma_horz_bslt4(pu1_y + (i4_strd_y << 3), i4_strd_y, |
| 558 | alpha, beta, u4_bs, pu1_cliptab_y); |
| 559 | ps_dec->pf_deblk_chroma_horz_bslt4(pu1_u + (i4_strd_uv << 2), |
| 560 | i4_strd_uv, alpha_u, beta_u, |
| 561 | alpha_v, beta_v, u4_bs, |
| 562 | pu1_cliptab_u, pu1_cliptab_v); |
| 563 | |
| 564 | } |
| 565 | //edge3 |
| 566 | u4_bs = pu4_bs_tab[3]; |
| 567 | if(u4_bs) |
| 568 | { |
| 569 | ps_dec->pf_deblk_luma_horz_bslt4( |
| 570 | (pu1_y + (i4_strd_y << 3) + (i4_strd_y << 2)), |
| 571 | i4_strd_y, alpha, beta, u4_bs, pu1_cliptab_y); |
| 572 | |
| 573 | } |
| 574 | |
| 575 | } |
| 576 | |
| 577 | /************************************************************************** |
| 578 | * |
| 579 | * Function Name : ih264d_init_deblk_tfr_ctxt |
| 580 | * |
| 581 | * Description : This function is called once per deblockpicture call |
| 582 | * This sets up the transfer address contexts |
| 583 | * |
| 584 | * Revision History: |
| 585 | * |
| 586 | * DD MM YYYY Author(s) Changes (Describe the changes made) |
| 587 | * 14 06 2005 SWRN Draft |
| 588 | **************************************************************************/ |
| 589 | void ih264d_init_deblk_tfr_ctxt(dec_struct_t * ps_dec, |
| 590 | pad_mgr_t *ps_pad_mgr, |
| 591 | tfr_ctxt_t *ps_tfr_cxt, |
| 592 | UWORD16 u2_image_wd_mb, |
| 593 | UWORD8 u1_mbaff) |
| 594 | { |
| 595 | |
| 596 | UWORD32 i4_wd_y; |
| 597 | UWORD32 i4_wd_uv; |
| 598 | UWORD8 u1_field_pic_flag = ps_dec->ps_cur_slice->u1_field_pic_flag; /*< Field u4_flag */ |
| 599 | UNUSED(u2_image_wd_mb); |
| 600 | ps_tfr_cxt->pu1_src_y = ps_dec->s_cur_pic.pu1_buf1 - 4; |
| 601 | ps_tfr_cxt->pu1_src_u = ps_dec->s_cur_pic.pu1_buf2 - 4; |
| 602 | ps_tfr_cxt->pu1_src_v = ps_dec->s_cur_pic.pu1_buf3 - 4; |
| 603 | ps_tfr_cxt->pu1_dest_y = ps_tfr_cxt->pu1_src_y; |
| 604 | ps_tfr_cxt->pu1_dest_u = ps_tfr_cxt->pu1_src_u; |
| 605 | ps_tfr_cxt->pu1_dest_v = ps_tfr_cxt->pu1_src_v; |
| 606 | |
| 607 | i4_wd_y = ps_dec->u2_frm_wd_y << u1_field_pic_flag; |
| 608 | i4_wd_uv = ps_dec->u2_frm_wd_uv << u1_field_pic_flag; |
| 609 | ps_tfr_cxt->u4_y_inc = ((i4_wd_y << u1_mbaff) * 16 |
| 610 | - (ps_dec->u2_frm_wd_in_mbs << 4)); |
| 611 | |
| 612 | ps_tfr_cxt->u4_uv_inc = (i4_wd_uv << u1_mbaff) * 8 |
| 613 | - (ps_dec->u2_frm_wd_in_mbs << 4); |
| 614 | |
| 615 | /* padding related initialisations */ |
| 616 | if(ps_dec->ps_cur_slice->u1_nal_ref_idc) |
| 617 | { |
| 618 | ps_pad_mgr->u1_vert_pad_top = !(ps_dec->ps_cur_slice->u1_field_pic_flag |
| 619 | && ps_dec->ps_cur_slice->u1_bottom_field_flag); |
| 620 | ps_pad_mgr->u1_vert_pad_bot = |
| 621 | ((!ps_dec->ps_cur_slice->u1_field_pic_flag) |
| 622 | || ps_dec->ps_cur_slice->u1_bottom_field_flag); |
| 623 | ps_pad_mgr->u1_horz_pad = 1; |
| 624 | } |
| 625 | else |
| 626 | { |
| 627 | ps_pad_mgr->u1_horz_pad = 0; |
| 628 | ps_pad_mgr->u1_vert_pad_top = 0; |
| 629 | ps_pad_mgr->u1_vert_pad_bot = 0; |
| 630 | } |
| 631 | } |
| 632 | |
| 633 | /*****************************************************************************/ |
| 634 | /* */ |
| 635 | /* Function Name : ih264d_deblock_picture_mbaff */ |
| 636 | /* */ |
| 637 | /* Description : This function carries out deblocking on a whole picture */ |
| 638 | /* with MBAFF */ |
| 639 | /* */ |
| 640 | /* Inputs : <What inputs does the function take?> */ |
| 641 | /* Processing : This functions calls deblock MB in the MB increment order*/ |
| 642 | /* */ |
| 643 | /* Outputs : Produces the deblocked picture */ |
| 644 | /* Returns : None */ |
| 645 | /* */ |
| 646 | /* Revision History: */ |
| 647 | /* */ |
| 648 | /* DD MM YYYY Author(s) Changes (Describe the changes made) */ |
| 649 | /* 17 02 2005 NS Creation */ |
| 650 | /* 14 06 2005 SWRN clean-up */ |
| 651 | /*****************************************************************************/ |
| 652 | |
| 653 | void ih264d_deblock_picture_mbaff(dec_struct_t * ps_dec) |
| 654 | { |
| 655 | WORD16 i2_mb_x, i2_mb_y; |
| 656 | deblk_mb_t *ps_cur_mb; |
| 657 | deblk_mb_t *ps_top_mb; |
| 658 | deblk_mb_t *ps_left_mb; |
| 659 | |
| 660 | UWORD8 u1_vert_pad_top = 1; |
| 661 | UWORD8 u1_cur_fld, u1_top_fld, u1_left_fld; |
| 662 | UWORD8 u1_first_row; |
| 663 | |
| 664 | UWORD8 * pu1_deb_y, *pu1_deb_u, *pu1_deb_v; |
| 665 | UWORD8 u1_deb_mode, u1_extra_top_edge; |
| 666 | WORD32 i4_wd_y, i4_wd_uv; |
| 667 | |
| 668 | UWORD8 u1_field_pic_flag = ps_dec->ps_cur_slice->u1_field_pic_flag; /*< Field u4_flag */ |
| 669 | UWORD8 u1_bottom_field_flag = ps_dec->ps_cur_slice->u1_bottom_field_flag; /*< Bottom field u4_flag*/ |
| 670 | |
| 671 | /**************************************************/ |
| 672 | /* one time loads from ps_dec which will be used */ |
| 673 | /* frequently throughout the deblocking procedure */ |
| 674 | /**************************************************/ |
| 675 | pad_mgr_t * ps_pad_mgr = &ps_dec->s_pad_mgr; |
| 676 | tfr_ctxt_t s_tfr_ctxt; |
| 677 | tfr_ctxt_t * ps_tfr_cxt = &s_tfr_ctxt; |
| 678 | |
| 679 | UWORD16 u2_image_wd_mb = ps_dec->u2_frm_wd_in_mbs; |
| 680 | UWORD16 u2_image_ht_mb = ps_dec->u2_frm_ht_in_mbs; |
| 681 | UWORD8 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag; |
| 682 | WORD8 i1_cb_qp_idx_ofst = ps_dec->ps_cur_pps->i1_chroma_qp_index_offset; |
| 683 | WORD8 i1_cr_qp_idx_ofst = |
| 684 | ps_dec->ps_cur_pps->i1_second_chroma_qp_index_offset; |
| 685 | |
| 686 | /* Set up Parameter for DMA transfer */ |
| 687 | ih264d_init_deblk_tfr_ctxt(ps_dec, ps_pad_mgr, ps_tfr_cxt, u2_image_wd_mb, |
| 688 | u1_mbaff); |
| 689 | |
| 690 | /* Pic level Initialisations */ |
| 691 | i2_mb_y = u2_image_ht_mb; |
| 692 | i2_mb_x = 0; |
| 693 | u1_extra_top_edge = 0; |
| 694 | |
| 695 | u1_first_row = 1; |
| 696 | |
| 697 | i4_wd_y = ps_dec->u2_frm_wd_y << u1_field_pic_flag; |
| 698 | i4_wd_uv = ps_dec->u2_frm_wd_uv << u1_field_pic_flag; |
| 699 | /* Initial filling of the buffers with deblocking data */ |
| 700 | |
| 701 | pu1_deb_y = ps_tfr_cxt->pu1_src_y + 4; |
| 702 | pu1_deb_u = ps_tfr_cxt->pu1_src_u + 4; |
| 703 | pu1_deb_v = ps_tfr_cxt->pu1_src_v + 4; |
| 704 | ps_cur_mb = ps_dec->ps_deblk_pic; |
| 705 | |
| 706 | if(ps_dec->u4_app_disable_deblk_frm == 0) |
| 707 | { |
| 708 | if(ps_dec->u4_mb_level_deblk == 0 || ps_dec->u4_num_cores >= 3) |
| 709 | { |
| 710 | |
| 711 | while(i2_mb_y > 0) |
| 712 | { |
| 713 | do |
| 714 | { |
| 715 | |
| 716 | u1_deb_mode = ps_cur_mb->u1_deblocking_mode; |
| 717 | if(!(u1_deb_mode & MB_DISABLE_FILTERING)) |
| 718 | { |
| 719 | ps_tfr_cxt->pu1_mb_y = pu1_deb_y; |
| 720 | ps_tfr_cxt->pu1_mb_u = pu1_deb_u; |
| 721 | ps_tfr_cxt->pu1_mb_v = pu1_deb_v; |
| 722 | |
| 723 | u1_cur_fld = (ps_cur_mb->u1_mb_type & D_FLD_MB) >> 7; |
| 724 | u1_cur_fld &= 1; |
| 725 | if(i2_mb_x) |
| 726 | { |
| 727 | ps_left_mb = ps_cur_mb - 2; |
| 728 | } |
| 729 | else |
| 730 | { |
| 731 | ps_left_mb = NULL; |
| 732 | } |
| 733 | if(!u1_first_row) |
| 734 | { |
| 735 | ps_top_mb = ps_cur_mb - (u2_image_wd_mb << 1) + 1; |
| 736 | u1_top_fld = (ps_top_mb->u1_mb_type & D_FLD_MB) |
| 737 | >> 7; |
| 738 | } |
| 739 | else |
| 740 | { |
| 741 | ps_top_mb = NULL; |
| 742 | u1_top_fld = 0; |
| 743 | } |
| 744 | |
| 745 | if((!u1_first_row) & u1_top_fld & u1_cur_fld) |
| 746 | ps_top_mb--; |
| 747 | |
| 748 | /********************************************************/ |
| 749 | /* if top MB and MB AFF and cur MB is frame and top is */ |
| 750 | /* field, then one extra top edge needs to be deblocked */ |
| 751 | /********************************************************/ |
| 752 | u1_extra_top_edge = (!u1_cur_fld) & u1_top_fld; |
| 753 | |
| 754 | if(u1_deb_mode & MB_DISABLE_LEFT_EDGE) |
| 755 | ps_left_mb = NULL; |
| 756 | if(u1_deb_mode & MB_DISABLE_TOP_EDGE) |
| 757 | ps_top_mb = NULL; |
| 758 | |
| 759 | ih264d_deblock_mb_mbaff(ps_dec, ps_tfr_cxt, |
| 760 | i1_cb_qp_idx_ofst, |
| 761 | i1_cr_qp_idx_ofst, ps_cur_mb, |
| 762 | i4_wd_y, i4_wd_uv, ps_top_mb, |
| 763 | ps_left_mb, u1_cur_fld, |
| 764 | u1_extra_top_edge); |
| 765 | } |
| 766 | |
| 767 | ps_cur_mb++; |
| 768 | |
| 769 | u1_deb_mode = ps_cur_mb->u1_deblocking_mode; |
| 770 | if(!(u1_deb_mode & MB_DISABLE_FILTERING)) |
| 771 | { |
| 772 | ps_tfr_cxt->pu1_mb_y = pu1_deb_y; |
| 773 | ps_tfr_cxt->pu1_mb_u = pu1_deb_u; |
| 774 | ps_tfr_cxt->pu1_mb_v = pu1_deb_v; |
| 775 | |
| 776 | u1_cur_fld = (ps_cur_mb->u1_mb_type & D_FLD_MB) >> 7; |
| 777 | u1_cur_fld &= 1; |
| 778 | if(i2_mb_x) |
| 779 | { |
| 780 | ps_left_mb = ps_cur_mb - 2; |
| 781 | u1_left_fld = (ps_left_mb->u1_mb_type & D_FLD_MB) |
| 782 | >> 7; |
| 783 | } |
| 784 | else |
| 785 | { |
| 786 | ps_left_mb = NULL; |
| 787 | u1_left_fld = u1_cur_fld; |
| 788 | } |
| 789 | if(!u1_first_row) |
| 790 | { |
| 791 | ps_top_mb = ps_cur_mb - (u2_image_wd_mb << 1); |
| 792 | } |
| 793 | else |
| 794 | { |
| 795 | ps_top_mb = NULL; |
| 796 | } |
| 797 | |
| 798 | { |
| 799 | UWORD8 u1_row_shift_y = 0, u1_row_shift_uv = 0; |
| 800 | if(!u1_cur_fld) |
| 801 | { |
| 802 | ps_top_mb = ps_cur_mb - 1; |
| 803 | u1_top_fld = (ps_top_mb->u1_mb_type & D_FLD_MB) |
| 804 | >> 7; |
| 805 | u1_row_shift_y = 4; |
| 806 | u1_row_shift_uv = 3; |
| 807 | } |
| 808 | ps_tfr_cxt->pu1_mb_y += i4_wd_y << u1_row_shift_y; |
| 809 | ps_tfr_cxt->pu1_mb_u += |
| 810 | (i4_wd_uv << u1_row_shift_uv); |
| 811 | ps_tfr_cxt->pu1_mb_v += i4_wd_uv << u1_row_shift_uv; |
| 812 | } |
| 813 | |
| 814 | /* point to A if top else A+1 */ |
| 815 | if(u1_left_fld ^ u1_cur_fld) |
| 816 | ps_left_mb--; |
| 817 | |
| 818 | /********************************************************/ |
| 819 | /* if top MB and MB AFF and cur MB is frame and top is */ |
| 820 | /* field, then one extra top edge needs to be deblocked */ |
| 821 | /********************************************************/ |
| 822 | u1_extra_top_edge = 0; |
| 823 | |
| 824 | if(u1_deb_mode & MB_DISABLE_LEFT_EDGE) |
| 825 | ps_left_mb = NULL; |
| 826 | if(u1_deb_mode & MB_DISABLE_TOP_EDGE) |
| 827 | ps_top_mb = NULL; |
| 828 | |
| 829 | ih264d_deblock_mb_mbaff(ps_dec, ps_tfr_cxt, |
| 830 | i1_cb_qp_idx_ofst, |
| 831 | i1_cr_qp_idx_ofst, ps_cur_mb, |
| 832 | i4_wd_y, i4_wd_uv, ps_top_mb, |
| 833 | ps_left_mb, u1_cur_fld, |
| 834 | u1_extra_top_edge); |
| 835 | } |
| 836 | |
| 837 | ps_cur_mb++; |
| 838 | i2_mb_x++; |
| 839 | |
| 840 | pu1_deb_y += 16; |
| 841 | pu1_deb_u += 8 * YUV420SP_FACTOR; |
| 842 | pu1_deb_v += 8; |
| 843 | |
| 844 | } |
| 845 | while(u2_image_wd_mb > i2_mb_x); |
| 846 | |
| 847 | pu1_deb_y += ps_tfr_cxt->u4_y_inc; |
| 848 | pu1_deb_u += ps_tfr_cxt->u4_uv_inc; |
| 849 | pu1_deb_v += ps_tfr_cxt->u4_uv_inc; |
| 850 | |
| 851 | i2_mb_x = 0; |
| 852 | i2_mb_y -= 2; |
| 853 | |
| 854 | u1_first_row = 0; |
| 855 | |
| 856 | } |
| 857 | } |
| 858 | |
| 859 | } |
| 860 | //Padd the Picture |
| 861 | //Horizontal Padd |
| 862 | |
| 863 | if(ps_pad_mgr->u1_horz_pad) |
| 864 | { |
| 865 | UWORD32 u1_field_pic_flag = ps_dec->ps_cur_slice->u1_field_pic_flag; |
| 866 | ps_dec->pf_pad_left_luma(ps_tfr_cxt->pu1_src_y + 4, |
| 867 | ps_dec->u2_frm_wd_y << u1_field_pic_flag, |
| 868 | ps_dec->u2_pic_ht >> u1_field_pic_flag, |
| 869 | PAD_LEN_Y_H); |
| 870 | ps_dec->pf_pad_right_luma( |
| 871 | ps_tfr_cxt->pu1_src_y + 4 |
| 872 | + (ps_dec->u2_frm_wd_in_mbs << 4), |
| 873 | ps_dec->u2_frm_wd_y << u1_field_pic_flag, |
| 874 | ps_dec->u2_pic_ht >> u1_field_pic_flag, PAD_LEN_Y_H); |
| 875 | |
| 876 | ps_dec->pf_pad_left_chroma(ps_tfr_cxt->pu1_src_u + 4, |
| 877 | ps_dec->u2_frm_wd_uv << u1_field_pic_flag, |
| 878 | (ps_dec->u2_pic_ht / 2) >> u1_field_pic_flag, |
| 879 | PAD_LEN_UV_H * YUV420SP_FACTOR); |
| 880 | ps_dec->pf_pad_right_chroma( |
| 881 | ps_tfr_cxt->pu1_src_u + 4 |
| 882 | + (ps_dec->u2_frm_wd_in_mbs << 4), |
| 883 | ps_dec->u2_frm_wd_uv << u1_field_pic_flag, |
| 884 | (ps_dec->u2_pic_ht / 2) >> u1_field_pic_flag, |
| 885 | PAD_LEN_UV_H * YUV420SP_FACTOR); |
| 886 | |
| 887 | } |
| 888 | |
| 889 | //Vertical Padd Top |
| 890 | if(ps_pad_mgr->u1_vert_pad_top) |
| 891 | { |
| 892 | ps_dec->pf_pad_top(ps_dec->ps_cur_pic->pu1_buf1 - PAD_LEN_Y_H, |
| 893 | ps_dec->u2_frm_wd_y, ps_dec->u2_frm_wd_y, |
| 894 | ps_pad_mgr->u1_pad_len_y_v); |
| 895 | ps_dec->pf_pad_top( |
| 896 | ps_dec->ps_cur_pic->pu1_buf2 |
| 897 | - PAD_LEN_UV_H * YUV420SP_FACTOR, |
| 898 | ps_dec->u2_frm_wd_uv, ps_dec->u2_frm_wd_uv, |
| 899 | ps_pad_mgr->u1_pad_len_cr_v); |
| 900 | ps_pad_mgr->u1_vert_pad_top = 0; |
| 901 | } |
| 902 | |
| 903 | //Vertical Padd Bottom |
| 904 | if(ps_pad_mgr->u1_vert_pad_bot) |
| 905 | { |
| 906 | |
| 907 | UWORD8 *pu1_buf; |
| 908 | pu1_buf = ps_dec->ps_cur_pic->pu1_buf1 - PAD_LEN_Y_H; |
| 909 | pu1_buf += ps_dec->u2_pic_ht * ps_dec->u2_frm_wd_y; |
| 910 | ps_dec->pf_pad_bottom(pu1_buf, ps_dec->u2_frm_wd_y, ps_dec->u2_frm_wd_y, |
| 911 | ps_pad_mgr->u1_pad_len_y_v); |
| 912 | pu1_buf = ps_dec->ps_cur_pic->pu1_buf2 - PAD_LEN_UV_H * YUV420SP_FACTOR; |
| 913 | pu1_buf += (ps_dec->u2_pic_ht >> 1) * ps_dec->u2_frm_wd_uv; |
| 914 | |
| 915 | ps_dec->pf_pad_bottom(pu1_buf, ps_dec->u2_frm_wd_uv, |
| 916 | ps_dec->u2_frm_wd_uv, |
| 917 | ps_pad_mgr->u1_pad_len_cr_v); |
| 918 | |
| 919 | } |
| 920 | } |
| 921 | |
| 922 | /*****************************************************************************/ |
| 923 | /* */ |
| 924 | /* Function Name : ih264d_deblock_picture_non_mbaff */ |
| 925 | /* */ |
| 926 | /* Description : This function carries out deblocking on a whole picture */ |
| 927 | /* without MBAFF */ |
| 928 | /* */ |
| 929 | /* Inputs : <What inputs does the function take?> */ |
| 930 | /* Processing : This functions calls deblock MB in the MB increment order*/ |
| 931 | /* */ |
| 932 | /* Outputs : Produces the deblocked picture */ |
| 933 | /* Returns : None */ |
| 934 | /* */ |
| 935 | /* Revision History: */ |
| 936 | /* */ |
| 937 | /* DD MM YYYY Author(s) Changes (Describe the changes made) */ |
| 938 | /* 17 02 2005 NS Creation */ |
| 939 | /* 14 06 2005 SWRN clean-up */ |
| 940 | /*****************************************************************************/ |
| 941 | |
| 942 | void ih264d_deblock_picture_non_mbaff(dec_struct_t * ps_dec) |
| 943 | { |
| 944 | WORD16 i2_mb_x, i2_mb_y; |
| 945 | deblk_mb_t *ps_cur_mb; |
| 946 | deblk_mb_t *ps_top_mb; |
| 947 | deblk_mb_t *ps_left_mb; |
| 948 | |
| 949 | UWORD8 u1_vert_pad_top = 1; |
| 950 | UWORD8 u1_first_row; |
| 951 | |
| 952 | UWORD8 u1_deb_mode; |
| 953 | WORD32 i4_wd_y, i4_wd_uv; |
| 954 | |
| 955 | UWORD8 u1_field_pic_flag = ps_dec->ps_cur_slice->u1_field_pic_flag; /*< Field u4_flag */ |
| 956 | UWORD8 u1_bottom_field_flag = ps_dec->ps_cur_slice->u1_bottom_field_flag; /*< Bottom field u4_flag */ |
| 957 | |
| 958 | /**************************************************/ |
| 959 | /* one time loads from ps_dec which will be used */ |
| 960 | /* frequently throughout the deblocking procedure */ |
| 961 | /**************************************************/ |
| 962 | pad_mgr_t * ps_pad_mgr = &ps_dec->s_pad_mgr; |
| 963 | tfr_ctxt_t s_tfr_ctxt; |
| 964 | tfr_ctxt_t * ps_tfr_cxt = &s_tfr_ctxt; // = &ps_dec->s_tran_addrecon; |
| 965 | |
| 966 | UWORD16 u2_image_wd_mb = ps_dec->u2_frm_wd_in_mbs; |
| 967 | UWORD16 u2_image_ht_mb = ps_dec->u2_frm_ht_in_mbs; |
| 968 | WORD8 i1_cb_qp_idx_ofst = ps_dec->ps_cur_pps->i1_chroma_qp_index_offset; |
| 969 | WORD8 i1_cr_qp_idx_ofst = |
| 970 | ps_dec->ps_cur_pps->i1_second_chroma_qp_index_offset; |
| 971 | |
| 972 | /* Set up Parameter for DMA transfer */ |
| 973 | ih264d_init_deblk_tfr_ctxt(ps_dec, ps_pad_mgr, ps_tfr_cxt, u2_image_wd_mb, |
| 974 | 0); |
| 975 | |
| 976 | /* Pic level Initialisations */ |
| 977 | i2_mb_y = u2_image_ht_mb; |
| 978 | i2_mb_x = 0; |
| 979 | |
| 980 | u1_first_row = 1; |
| 981 | |
| 982 | i4_wd_y = ps_dec->u2_frm_wd_y << u1_field_pic_flag; |
| 983 | i4_wd_uv = ps_dec->u2_frm_wd_uv << u1_field_pic_flag; |
| 984 | /* Initial filling of the buffers with deblocking data */ |
| 985 | |
| 986 | ps_tfr_cxt->pu1_mb_y = ps_tfr_cxt->pu1_src_y + 4; |
| 987 | ps_tfr_cxt->pu1_mb_u = ps_tfr_cxt->pu1_src_u + 4; |
| 988 | ps_tfr_cxt->pu1_mb_v = ps_tfr_cxt->pu1_src_v + 4; |
| 989 | ps_cur_mb = ps_dec->ps_deblk_pic; |
| 990 | |
| 991 | if(ps_dec->u4_app_disable_deblk_frm == 0) |
| 992 | { |
| 993 | if((ps_dec->u4_mb_level_deblk == 0) && (ps_dec->u4_num_cores != 3)) |
| 994 | { |
| 995 | |
| 996 | while(i2_mb_y > 0) |
| 997 | { |
| 998 | do |
| 999 | { |
| 1000 | |
| 1001 | u1_deb_mode = ps_cur_mb->u1_deblocking_mode; |
| 1002 | if(!(u1_deb_mode & MB_DISABLE_FILTERING)) |
| 1003 | { |
| 1004 | if(i2_mb_x) |
| 1005 | { |
| 1006 | ps_left_mb = ps_cur_mb - 1; |
| 1007 | } |
| 1008 | else |
| 1009 | { |
| 1010 | ps_left_mb = NULL; |
| 1011 | } |
| 1012 | if(!u1_first_row) |
| 1013 | { |
| 1014 | ps_top_mb = ps_cur_mb - (u2_image_wd_mb); |
| 1015 | } |
| 1016 | else |
| 1017 | { |
| 1018 | ps_top_mb = NULL; |
| 1019 | } |
| 1020 | |
| 1021 | if(u1_deb_mode & MB_DISABLE_LEFT_EDGE) |
| 1022 | ps_left_mb = NULL; |
| 1023 | if(u1_deb_mode & MB_DISABLE_TOP_EDGE) |
| 1024 | ps_top_mb = NULL; |
| 1025 | |
| 1026 | ih264d_deblock_mb_nonmbaff(ps_dec, ps_tfr_cxt, |
| 1027 | i1_cb_qp_idx_ofst, |
| 1028 | i1_cr_qp_idx_ofst, ps_cur_mb, |
| 1029 | i4_wd_y, i4_wd_uv, ps_top_mb, |
| 1030 | ps_left_mb); |
| 1031 | } |
| 1032 | |
| 1033 | ps_cur_mb++; |
| 1034 | i2_mb_x++; |
| 1035 | |
| 1036 | ps_tfr_cxt->pu1_mb_y += 16; |
| 1037 | ps_tfr_cxt->pu1_mb_u += 8 * YUV420SP_FACTOR; |
| 1038 | ps_tfr_cxt->pu1_mb_v += 8; |
| 1039 | |
| 1040 | } |
| 1041 | while(i2_mb_x < u2_image_wd_mb); |
| 1042 | |
| 1043 | ps_tfr_cxt->pu1_mb_y += ps_tfr_cxt->u4_y_inc; |
| 1044 | ps_tfr_cxt->pu1_mb_u += ps_tfr_cxt->u4_uv_inc; |
| 1045 | ps_tfr_cxt->pu1_mb_v += ps_tfr_cxt->u4_uv_inc; |
| 1046 | |
| 1047 | i2_mb_x = 0; |
| 1048 | i2_mb_y--; |
| 1049 | u1_first_row = 0; |
| 1050 | |
| 1051 | } |
| 1052 | } |
| 1053 | |
| 1054 | } |
| 1055 | |
| 1056 | //Padd the Picture |
| 1057 | //Horizontal Padd |
| 1058 | if(ps_pad_mgr->u1_horz_pad) |
| 1059 | { |
| 1060 | UWORD32 u1_field_pic_flag = ps_dec->ps_cur_slice->u1_field_pic_flag; |
| 1061 | ps_dec->pf_pad_left_luma(ps_tfr_cxt->pu1_src_y + 4, |
| 1062 | ps_dec->u2_frm_wd_y << u1_field_pic_flag, |
| 1063 | ps_dec->u2_pic_ht >> u1_field_pic_flag, |
| 1064 | PAD_LEN_Y_H); |
| 1065 | ps_dec->pf_pad_right_luma( |
| 1066 | ps_tfr_cxt->pu1_src_y + 4 |
| 1067 | + (ps_dec->u2_frm_wd_in_mbs << 4), |
| 1068 | ps_dec->u2_frm_wd_y << u1_field_pic_flag, |
| 1069 | ps_dec->u2_pic_ht >> u1_field_pic_flag, PAD_LEN_Y_H); |
| 1070 | |
| 1071 | ps_dec->pf_pad_left_chroma(ps_tfr_cxt->pu1_src_u + 4, |
| 1072 | ps_dec->u2_frm_wd_uv << u1_field_pic_flag, |
| 1073 | (ps_dec->u2_pic_ht / 2) >> u1_field_pic_flag, |
| 1074 | PAD_LEN_UV_H * YUV420SP_FACTOR); |
| 1075 | ps_dec->pf_pad_right_chroma( |
| 1076 | ps_tfr_cxt->pu1_src_u + 4 |
| 1077 | + (ps_dec->u2_frm_wd_in_mbs << 4), |
| 1078 | ps_dec->u2_frm_wd_uv << u1_field_pic_flag, |
| 1079 | (ps_dec->u2_pic_ht / 2) >> u1_field_pic_flag, |
| 1080 | PAD_LEN_UV_H * YUV420SP_FACTOR); |
| 1081 | |
| 1082 | } |
| 1083 | |
| 1084 | //Vertical Padd Top |
| 1085 | if(ps_pad_mgr->u1_vert_pad_top) |
| 1086 | { |
| 1087 | ps_dec->pf_pad_top(ps_dec->ps_cur_pic->pu1_buf1 - PAD_LEN_Y_H, |
| 1088 | ps_dec->u2_frm_wd_y, ps_dec->u2_frm_wd_y, |
| 1089 | ps_pad_mgr->u1_pad_len_y_v); |
| 1090 | ps_dec->pf_pad_top( |
| 1091 | ps_dec->ps_cur_pic->pu1_buf2 |
| 1092 | - PAD_LEN_UV_H * YUV420SP_FACTOR, |
| 1093 | ps_dec->u2_frm_wd_uv, ps_dec->u2_frm_wd_uv, |
| 1094 | ps_pad_mgr->u1_pad_len_cr_v); |
| 1095 | ps_pad_mgr->u1_vert_pad_top = 0; |
| 1096 | } |
| 1097 | |
| 1098 | //Vertical Padd Bottom |
| 1099 | if(ps_pad_mgr->u1_vert_pad_bot) |
| 1100 | { |
| 1101 | |
| 1102 | UWORD8 *pu1_buf; |
| 1103 | pu1_buf = ps_dec->ps_cur_pic->pu1_buf1 - PAD_LEN_Y_H; |
| 1104 | pu1_buf += ps_dec->u2_pic_ht * ps_dec->u2_frm_wd_y; |
| 1105 | ps_dec->pf_pad_bottom(pu1_buf, ps_dec->u2_frm_wd_y, ps_dec->u2_frm_wd_y, |
| 1106 | ps_pad_mgr->u1_pad_len_y_v); |
| 1107 | pu1_buf = ps_dec->ps_cur_pic->pu1_buf2 - PAD_LEN_UV_H * YUV420SP_FACTOR; |
| 1108 | pu1_buf += (ps_dec->u2_pic_ht >> 1) * ps_dec->u2_frm_wd_uv; |
| 1109 | |
| 1110 | ps_dec->pf_pad_bottom(pu1_buf, ps_dec->u2_frm_wd_uv, |
| 1111 | ps_dec->u2_frm_wd_uv, |
| 1112 | ps_pad_mgr->u1_pad_len_cr_v); |
| 1113 | |
| 1114 | } |
| 1115 | } |
| 1116 | |
| 1117 | void ih264d_deblock_picture_progressive(dec_struct_t * ps_dec) |
| 1118 | { |
| 1119 | WORD16 i2_mb_x, i2_mb_y; |
| 1120 | |
| 1121 | deblk_mb_t *ps_cur_mb; |
| 1122 | deblk_mb_t *ps_top_mb; |
| 1123 | deblk_mb_t *ps_left_mb; |
| 1124 | |
| 1125 | UWORD8 u1_vert_pad_top = 1; |
| 1126 | UWORD8 u1_mbs_next, u1_first_row; |
| 1127 | UWORD8 u1_deb_mode; |
| 1128 | WORD32 i4_wd_y, i4_wd_uv; |
| 1129 | |
| 1130 | |
| 1131 | /**************************************************/ |
| 1132 | /* one time loads from ps_dec which will be used */ |
| 1133 | /* frequently throughout the deblocking procedure */ |
| 1134 | /**************************************************/ |
| 1135 | pad_mgr_t * ps_pad_mgr = &ps_dec->s_pad_mgr; |
| 1136 | |
| 1137 | tfr_ctxt_t s_tfr_ctxt; |
| 1138 | tfr_ctxt_t * ps_tfr_cxt = &s_tfr_ctxt; // = &ps_dec->s_tran_addrecon; |
| 1139 | UWORD16 u2_image_wd_mb = ps_dec->u2_frm_wd_in_mbs; |
| 1140 | UWORD16 u2_image_ht_mb = ps_dec->u2_frm_ht_in_mbs; |
| 1141 | UWORD8 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag; |
| 1142 | |
| 1143 | WORD8 i1_cb_qp_idx_ofst = ps_dec->ps_cur_pps->i1_chroma_qp_index_offset; |
| 1144 | WORD8 i1_cr_qp_idx_ofst = |
| 1145 | ps_dec->ps_cur_pps->i1_second_chroma_qp_index_offset; |
| 1146 | |
| 1147 | /* Set up Parameter for deblocking */ |
| 1148 | ih264d_init_deblk_tfr_ctxt(ps_dec, ps_pad_mgr, ps_tfr_cxt, u2_image_wd_mb, |
| 1149 | 0); |
| 1150 | |
| 1151 | /* Pic level Initialisations */ |
| 1152 | i2_mb_y = u2_image_ht_mb; |
| 1153 | i2_mb_x = 0; |
| 1154 | |
| 1155 | u1_first_row = 1; |
| 1156 | |
| 1157 | i4_wd_y = ps_dec->u2_frm_wd_y; |
| 1158 | i4_wd_uv = ps_dec->u2_frm_wd_uv; |
| 1159 | /* Initial filling of the buffers with deblocking data */ |
| 1160 | |
| 1161 | ps_tfr_cxt->pu1_mb_y = ps_tfr_cxt->pu1_src_y + 4; |
| 1162 | ps_tfr_cxt->pu1_mb_u = ps_tfr_cxt->pu1_src_u + 4; |
| 1163 | ps_tfr_cxt->pu1_mb_v = ps_tfr_cxt->pu1_src_v + 4; |
| 1164 | ps_cur_mb = ps_dec->ps_deblk_pic; |
| 1165 | |
| 1166 | if(ps_dec->u4_app_disable_deblk_frm == 0) |
| 1167 | { |
| 1168 | |
| 1169 | if((ps_dec->u4_mb_level_deblk == 0) && (ps_dec->u4_num_cores != 3)) |
| 1170 | { |
| 1171 | |
| 1172 | while(i2_mb_y > 0) |
| 1173 | { |
| 1174 | |
| 1175 | u1_deb_mode = ps_cur_mb->u1_deblocking_mode; |
| 1176 | if(!(u1_deb_mode & MB_DISABLE_FILTERING)) |
| 1177 | { |
| 1178 | |
| 1179 | if(i2_mb_x) |
| 1180 | { |
| 1181 | ps_left_mb = ps_cur_mb - 1; |
| 1182 | |
| 1183 | } |
| 1184 | else |
| 1185 | { |
| 1186 | ps_left_mb = NULL; |
| 1187 | |
| 1188 | } |
| 1189 | if(!u1_first_row) |
| 1190 | { |
| 1191 | ps_top_mb = ps_cur_mb - (u2_image_wd_mb); |
| 1192 | } |
| 1193 | else |
| 1194 | { |
| 1195 | ps_top_mb = NULL; |
| 1196 | } |
| 1197 | |
| 1198 | if(u1_deb_mode & MB_DISABLE_LEFT_EDGE) |
| 1199 | ps_left_mb = NULL; |
| 1200 | if(u1_deb_mode & MB_DISABLE_TOP_EDGE) |
| 1201 | ps_top_mb = NULL; |
| 1202 | |
| 1203 | ih264d_deblock_mb_nonmbaff(ps_dec, ps_tfr_cxt, |
| 1204 | i1_cb_qp_idx_ofst, |
| 1205 | i1_cr_qp_idx_ofst, ps_cur_mb, |
| 1206 | i4_wd_y, i4_wd_uv, ps_top_mb, |
| 1207 | ps_left_mb); |
| 1208 | } |
| 1209 | |
| 1210 | ps_cur_mb++; |
| 1211 | i2_mb_x++; |
| 1212 | u1_mbs_next = u2_image_wd_mb - i2_mb_x; |
| 1213 | |
| 1214 | ps_tfr_cxt->pu1_mb_y += 16; |
| 1215 | ps_tfr_cxt->pu1_mb_u += 8 * YUV420SP_FACTOR; |
| 1216 | ps_tfr_cxt->pu1_mb_v += 8; |
| 1217 | |
| 1218 | if(!u1_mbs_next) |
| 1219 | { |
| 1220 | ps_tfr_cxt->pu1_mb_y += ps_tfr_cxt->u4_y_inc; |
| 1221 | ps_tfr_cxt->pu1_mb_u += ps_tfr_cxt->u4_uv_inc; |
| 1222 | ps_tfr_cxt->pu1_mb_v += ps_tfr_cxt->u4_uv_inc; |
| 1223 | |
| 1224 | i2_mb_x = 0; |
| 1225 | i2_mb_y--; |
| 1226 | u1_first_row = 0; |
| 1227 | } |
| 1228 | |
| 1229 | } |
| 1230 | } |
| 1231 | |
| 1232 | } |
| 1233 | |
| 1234 | //Padd the Picture |
| 1235 | //Horizontal Padd |
| 1236 | if(ps_pad_mgr->u1_horz_pad) |
| 1237 | { |
| 1238 | UWORD32 u1_field_pic_flag = ps_dec->ps_cur_slice->u1_field_pic_flag; |
| 1239 | ps_dec->pf_pad_left_luma(ps_tfr_cxt->pu1_src_y + 4, |
| 1240 | ps_dec->u2_frm_wd_y << u1_field_pic_flag, |
| 1241 | ps_dec->u2_pic_ht >> u1_field_pic_flag, |
| 1242 | PAD_LEN_Y_H); |
| 1243 | ps_dec->pf_pad_right_luma( |
| 1244 | ps_tfr_cxt->pu1_src_y + 4 |
| 1245 | + (ps_dec->u2_frm_wd_in_mbs << 4), |
| 1246 | ps_dec->u2_frm_wd_y << u1_field_pic_flag, |
| 1247 | ps_dec->u2_pic_ht >> u1_field_pic_flag, PAD_LEN_Y_H); |
| 1248 | |
| 1249 | ps_dec->pf_pad_left_chroma(ps_tfr_cxt->pu1_src_u + 4, |
| 1250 | ps_dec->u2_frm_wd_uv << u1_field_pic_flag, |
| 1251 | (ps_dec->u2_pic_ht / 2) >> u1_field_pic_flag, |
| 1252 | PAD_LEN_UV_H * YUV420SP_FACTOR); |
| 1253 | ps_dec->pf_pad_right_chroma( |
| 1254 | ps_tfr_cxt->pu1_src_u + 4 |
| 1255 | + (ps_dec->u2_frm_wd_in_mbs << 4), |
| 1256 | ps_dec->u2_frm_wd_uv << u1_field_pic_flag, |
| 1257 | (ps_dec->u2_pic_ht / 2) >> u1_field_pic_flag, |
| 1258 | PAD_LEN_UV_H * YUV420SP_FACTOR); |
| 1259 | |
| 1260 | } |
| 1261 | |
| 1262 | //Vertical Padd Top |
| 1263 | if(ps_pad_mgr->u1_vert_pad_top) |
| 1264 | { |
| 1265 | ps_dec->pf_pad_top(ps_dec->ps_cur_pic->pu1_buf1 - PAD_LEN_Y_H, |
| 1266 | ps_dec->u2_frm_wd_y, ps_dec->u2_frm_wd_y, |
| 1267 | ps_pad_mgr->u1_pad_len_y_v); |
| 1268 | ps_dec->pf_pad_top( |
| 1269 | ps_dec->ps_cur_pic->pu1_buf2 |
| 1270 | - PAD_LEN_UV_H * YUV420SP_FACTOR, |
| 1271 | ps_dec->u2_frm_wd_uv, ps_dec->u2_frm_wd_uv, |
| 1272 | ps_pad_mgr->u1_pad_len_cr_v); |
| 1273 | |
| 1274 | } |
| 1275 | |
| 1276 | //Vertical Padd Bottom |
| 1277 | if(ps_pad_mgr->u1_vert_pad_bot) |
| 1278 | { |
| 1279 | |
| 1280 | UWORD8 *pu1_buf; |
| 1281 | pu1_buf = ps_dec->ps_cur_pic->pu1_buf1 - PAD_LEN_Y_H; |
| 1282 | pu1_buf += ps_dec->u2_pic_ht * ps_dec->u2_frm_wd_y; |
| 1283 | ps_dec->pf_pad_bottom(pu1_buf, ps_dec->u2_frm_wd_y, ps_dec->u2_frm_wd_y, |
| 1284 | ps_pad_mgr->u1_pad_len_y_v); |
| 1285 | pu1_buf = ps_dec->ps_cur_pic->pu1_buf2 - PAD_LEN_UV_H * YUV420SP_FACTOR; |
| 1286 | pu1_buf += (ps_dec->u2_pic_ht >> 1) * ps_dec->u2_frm_wd_uv; |
| 1287 | |
| 1288 | ps_dec->pf_pad_bottom(pu1_buf, ps_dec->u2_frm_wd_uv, |
| 1289 | ps_dec->u2_frm_wd_uv, |
| 1290 | ps_pad_mgr->u1_pad_len_cr_v); |
| 1291 | |
| 1292 | } |
| 1293 | } |
| 1294 | |
| 1295 | /*! |
| 1296 | ************************************************************************** |
| 1297 | * \if Function name : ih264d_set_deblocking_parameters \endif |
| 1298 | * |
| 1299 | * \brief |
| 1300 | * Sets the deblocking parameters of the macroblock |
| 1301 | * |
| 1302 | * \return |
| 1303 | * 0 on Success and Error code otherwise |
| 1304 | * |
| 1305 | * \note |
| 1306 | * Given the neighbour availablity information, and the deblocking |
| 1307 | * parameters of the slice,this function will set the deblocking |
| 1308 | * mode of the macroblock. |
| 1309 | ************************************************************************** |
| 1310 | */ |
| 1311 | |
| 1312 | WORD8 ih264d_set_deblocking_parameters(deblk_mb_t * ps_cur_mb, |
| 1313 | dec_slice_params_t * ps_slice, |
| 1314 | UWORD8 u1_mb_ngbr_availablity, |
| 1315 | UWORD8 u1_mb_field_decoding_flag) |
| 1316 | { |
| 1317 | /*------------------------------------------------------------------*/ |
| 1318 | /* Set the deblocking parameters */ |
| 1319 | /*------------------------------------------------------------------*/ |
| 1320 | ps_cur_mb->i1_slice_alpha_c0_offset = ps_slice->i1_slice_alpha_c0_offset; |
| 1321 | ps_cur_mb->i1_slice_beta_offset = ps_slice->i1_slice_beta_offset; |
| 1322 | ps_cur_mb->u1_mb_type = (u1_mb_field_decoding_flag << 7); |
| 1323 | |
| 1324 | switch(ps_slice->u1_disable_dblk_filter_idc) |
| 1325 | { |
| 1326 | case DBLK_ENABLED: |
| 1327 | ps_cur_mb->u1_deblocking_mode = MB_ENABLE_FILTERING; |
| 1328 | break; |
| 1329 | case DBLK_DISABLED: |
| 1330 | ps_cur_mb->u1_deblocking_mode = MB_DISABLE_FILTERING; |
| 1331 | break; |
| 1332 | case SLICE_BOUNDARY_DBLK_DISABLED: |
| 1333 | { |
| 1334 | ps_cur_mb->u1_deblocking_mode = MB_ENABLE_FILTERING; |
| 1335 | if(!(u1_mb_ngbr_availablity & LEFT_MB_AVAILABLE_MASK)) |
| 1336 | ps_cur_mb->u1_deblocking_mode |= MB_DISABLE_LEFT_EDGE; |
| 1337 | if(!(u1_mb_ngbr_availablity & TOP_MB_AVAILABLE_MASK)) |
| 1338 | ps_cur_mb->u1_deblocking_mode |= MB_DISABLE_TOP_EDGE; |
| 1339 | break; |
| 1340 | } |
| 1341 | } |
| 1342 | |
| 1343 | return (0); |
| 1344 | } |
| 1345 | |
| 1346 | void ih264d_copy_intra_pred_line(dec_struct_t *ps_dec, |
| 1347 | dec_mb_info_t *ps_cur_mb_info, |
| 1348 | UWORD32 nmb_index) |
| 1349 | { |
| 1350 | UWORD8 *pu1_mb_last_row, u1_mb_field_decoding_flag; |
| 1351 | UWORD32 u4_recWidth, u4_recwidth_cr; |
| 1352 | |
| 1353 | u1_mb_field_decoding_flag = ps_cur_mb_info->u1_mb_field_decodingflag; |
| 1354 | |
| 1355 | u4_recWidth = ps_dec->u2_frm_wd_y << u1_mb_field_decoding_flag; |
| 1356 | u4_recwidth_cr = ps_dec->u2_frm_wd_uv << u1_mb_field_decoding_flag; |
| 1357 | |
| 1358 | pu1_mb_last_row = ps_dec->s_tran_addrecon.pu1_dest_y |
| 1359 | + (u4_recWidth * (MB_SIZE - 1)); |
| 1360 | pu1_mb_last_row += MB_SIZE * nmb_index; |
| 1361 | MEMCPY_16BYTES(ps_dec->pu1_cur_y_intra_pred_line, pu1_mb_last_row); |
| 1362 | |
| 1363 | pu1_mb_last_row = ps_dec->s_tran_addrecon.pu1_dest_u |
| 1364 | + (u4_recwidth_cr * (BLK8x8SIZE - 1)); |
| 1365 | pu1_mb_last_row += BLK8x8SIZE * nmb_index * YUV420SP_FACTOR; |
| 1366 | |
| 1367 | MEMCPY_16BYTES(ps_dec->pu1_cur_u_intra_pred_line, pu1_mb_last_row); |
| 1368 | |
| 1369 | ps_dec->pu1_cur_y_intra_pred_line = ps_dec->pu1_cur_y_intra_pred_line_base |
| 1370 | + (MB_SIZE * (ps_cur_mb_info->u2_mbx + 1)); |
| 1371 | ps_dec->pu1_cur_u_intra_pred_line = ps_dec->pu1_cur_u_intra_pred_line_base |
| 1372 | + (BLK8x8SIZE * (ps_cur_mb_info->u2_mbx + 1)) |
| 1373 | * YUV420SP_FACTOR; |
| 1374 | ps_dec->pu1_cur_v_intra_pred_line = ps_dec->pu1_cur_v_intra_pred_line_base |
| 1375 | + (BLK8x8SIZE * (ps_cur_mb_info->u2_mbx + 1)); |
| 1376 | |
| 1377 | if(ps_cur_mb_info->u2_mbx == (ps_dec->u2_frm_wd_in_mbs - 1)) |
| 1378 | { |
| 1379 | UWORD8* pu1_temp; |
| 1380 | |
| 1381 | ps_dec->pu1_cur_y_intra_pred_line = |
| 1382 | ps_dec->pu1_cur_y_intra_pred_line_base; |
| 1383 | ps_dec->pu1_cur_u_intra_pred_line = |
| 1384 | ps_dec->pu1_cur_u_intra_pred_line_base; |
| 1385 | ps_dec->pu1_cur_v_intra_pred_line = |
| 1386 | ps_dec->pu1_cur_v_intra_pred_line_base; |
| 1387 | |
| 1388 | /*swap current and previous rows*/ |
| 1389 | pu1_temp = ps_dec->pu1_cur_y_intra_pred_line; |
| 1390 | ps_dec->pu1_cur_y_intra_pred_line = ps_dec->pu1_prev_y_intra_pred_line; |
| 1391 | ps_dec->pu1_prev_y_intra_pred_line = pu1_temp; |
| 1392 | |
| 1393 | pu1_temp = ps_dec->pu1_cur_u_intra_pred_line; |
| 1394 | ps_dec->pu1_cur_u_intra_pred_line = ps_dec->pu1_prev_u_intra_pred_line; |
| 1395 | ps_dec->pu1_prev_u_intra_pred_line = pu1_temp; |
| 1396 | |
| 1397 | pu1_temp = ps_dec->pu1_cur_v_intra_pred_line; |
| 1398 | ps_dec->pu1_cur_v_intra_pred_line = ps_dec->pu1_prev_v_intra_pred_line; |
| 1399 | ps_dec->pu1_prev_v_intra_pred_line = pu1_temp; |
| 1400 | |
| 1401 | ps_dec->pu1_cur_y_intra_pred_line_base = |
| 1402 | ps_dec->pu1_cur_y_intra_pred_line; |
| 1403 | ps_dec->pu1_cur_u_intra_pred_line_base = |
| 1404 | ps_dec->pu1_cur_u_intra_pred_line; |
| 1405 | ps_dec->pu1_cur_v_intra_pred_line_base = |
| 1406 | ps_dec->pu1_cur_v_intra_pred_line; |
| 1407 | |
| 1408 | |
| 1409 | |
| 1410 | |
| 1411 | |
| 1412 | } |
| 1413 | |
| 1414 | } |
| 1415 | |
| 1416 | void ih264d_deblock_mb_level(dec_struct_t *ps_dec, |
| 1417 | dec_mb_info_t *ps_cur_mb_info, |
| 1418 | UWORD32 nmb_index) |
| 1419 | { |
| 1420 | UWORD8 u1_deb_mode; |
| 1421 | deblk_mb_t *ps_cur_mb, *ps_left_mb, *ps_top_mb; |
| 1422 | UWORD16 u2_image_wd_mb = ps_dec->u2_frm_wd_in_mbs; |
| 1423 | UWORD16 u2_image_ht_mb = ps_dec->u2_frm_ht_in_mbs; |
| 1424 | WORD8 i1_cb_qp_idx_ofst = ps_dec->ps_cur_pps->i1_chroma_qp_index_offset; |
| 1425 | WORD8 i1_cr_qp_idx_ofst = |
| 1426 | ps_dec->ps_cur_pps->i1_second_chroma_qp_index_offset; |
| 1427 | WORD32 i4_wd_y, i4_wd_uv; |
| 1428 | tfr_ctxt_t * ps_tfr_cxt = &ps_dec->s_tran_addrecon; |
| 1429 | WORD16 i2_mb_y, i2_mb_x; |
| 1430 | UWORD8 u1_mb_field_decoding_flag = ps_cur_mb_info->u1_mb_field_decodingflag; |
| 1431 | deblk_mb_t *ps_deblk_cur_mb; |
| 1432 | |
| 1433 | /*Copy the last row of every MB ,to be used for intra prediction f next row*/ |
| 1434 | { |
| 1435 | UWORD8 *pu1_mb_last_row, u1_mb_field_decoding_flag; |
| 1436 | UWORD32 u4_recWidth, u4_recwidth_cr; |
| 1437 | |
| 1438 | u1_mb_field_decoding_flag = ps_cur_mb_info->u1_mb_field_decodingflag; |
| 1439 | |
| 1440 | u4_recWidth = ps_dec->u2_frm_wd_y << u1_mb_field_decoding_flag; |
| 1441 | u4_recwidth_cr = ps_dec->u2_frm_wd_uv << u1_mb_field_decoding_flag; |
| 1442 | |
| 1443 | pu1_mb_last_row = ps_dec->s_tran_addrecon.pu1_dest_y |
| 1444 | + (u4_recWidth * (MB_SIZE - 1)); |
| 1445 | pu1_mb_last_row += MB_SIZE * nmb_index; |
| 1446 | MEMCPY_16BYTES(ps_dec->pu1_cur_y_intra_pred_line, pu1_mb_last_row); |
| 1447 | |
| 1448 | pu1_mb_last_row = ps_dec->s_tran_addrecon.pu1_dest_u |
| 1449 | + (u4_recwidth_cr * (BLK8x8SIZE - 1)); |
| 1450 | pu1_mb_last_row += BLK8x8SIZE * nmb_index * YUV420SP_FACTOR; |
| 1451 | |
| 1452 | MEMCPY_16BYTES(ps_dec->pu1_cur_u_intra_pred_line, pu1_mb_last_row); |
| 1453 | |
| 1454 | ps_dec->pu1_cur_y_intra_pred_line = |
| 1455 | ps_dec->pu1_cur_y_intra_pred_line_base |
| 1456 | + (MB_SIZE |
| 1457 | * (ps_cur_mb_info->u2_mbx |
| 1458 | + 1)); |
| 1459 | ps_dec->pu1_cur_u_intra_pred_line = |
| 1460 | ps_dec->pu1_cur_u_intra_pred_line_base |
| 1461 | + (BLK8x8SIZE |
| 1462 | * (ps_cur_mb_info->u2_mbx |
| 1463 | + 1)) |
| 1464 | * YUV420SP_FACTOR; |
| 1465 | ps_dec->pu1_cur_v_intra_pred_line = |
| 1466 | ps_dec->pu1_cur_v_intra_pred_line_base |
| 1467 | + (BLK8x8SIZE |
| 1468 | * (ps_cur_mb_info->u2_mbx |
| 1469 | + 1)); |
| 1470 | } |
| 1471 | |
| 1472 | i2_mb_y = ps_cur_mb_info->u2_mby; |
| 1473 | i4_wd_y = ps_dec->u2_frm_wd_y << u1_mb_field_decoding_flag; |
| 1474 | i4_wd_uv = ps_dec->u2_frm_wd_uv << u1_mb_field_decoding_flag; |
| 1475 | |
| 1476 | if(ps_cur_mb_info->u2_mbx != 0) |
| 1477 | { |
| 1478 | /*Deblock the previous MB*/ |
| 1479 | deblk_mb_t *ps_deblk_cur_mb; |
| 1480 | |
| 1481 | if(ps_dec->u1_separate_parse == 1) |
| 1482 | { |
| 1483 | ps_deblk_cur_mb = ps_dec->ps_deblk_mbn_dec_thrd + nmb_index - 1; |
| 1484 | |
| 1485 | } |
| 1486 | else |
| 1487 | { |
| 1488 | |
| 1489 | if(nmb_index == 0) |
| 1490 | /*if first mb in Nmb ,pick up the context from previous Nmb data*/ |
| 1491 | ps_deblk_cur_mb = ps_dec->ps_deblk_mbn_prev |
| 1492 | + ps_dec->u4_num_mbs_prev_nmb - 1; |
| 1493 | else |
| 1494 | ps_deblk_cur_mb = ps_dec->ps_deblk_mbn + nmb_index - 1; |
| 1495 | } |
| 1496 | |
| 1497 | ps_cur_mb = ps_deblk_cur_mb; |
| 1498 | |
| 1499 | u1_deb_mode = ps_cur_mb->u1_deblocking_mode; |
| 1500 | |
| 1501 | i2_mb_x = ps_cur_mb_info->u2_mbx - 1; |
| 1502 | |
| 1503 | if(ps_dec->u4_app_disable_deblk_frm == 1) |
| 1504 | u1_deb_mode = MB_DISABLE_FILTERING; |
| 1505 | if(!(u1_deb_mode & MB_DISABLE_FILTERING)) |
| 1506 | { |
| 1507 | |
| 1508 | if(i2_mb_x) |
| 1509 | { |
| 1510 | ps_left_mb = ps_cur_mb - 1; |
| 1511 | |
| 1512 | } |
| 1513 | else |
| 1514 | { |
| 1515 | ps_left_mb = NULL; |
| 1516 | |
| 1517 | } |
| 1518 | if(i2_mb_y) |
| 1519 | { |
| 1520 | ps_top_mb = ps_cur_mb - (u2_image_wd_mb); |
| 1521 | } |
| 1522 | else |
| 1523 | { |
| 1524 | ps_top_mb = NULL; |
| 1525 | } |
| 1526 | |
| 1527 | if(u1_deb_mode & MB_DISABLE_LEFT_EDGE) |
| 1528 | ps_left_mb = NULL; |
| 1529 | if(u1_deb_mode & MB_DISABLE_TOP_EDGE) |
| 1530 | ps_top_mb = NULL; |
| 1531 | |
| 1532 | ih264d_deblock_mb_nonmbaff(ps_dec, ps_tfr_cxt, i1_cb_qp_idx_ofst, |
| 1533 | i1_cr_qp_idx_ofst, ps_cur_mb, i4_wd_y, |
| 1534 | i4_wd_uv, ps_top_mb, ps_left_mb); |
| 1535 | } |
| 1536 | |
| 1537 | ps_tfr_cxt->pu1_mb_y += MB_SIZE; |
| 1538 | ps_tfr_cxt->pu1_mb_u += (MB_SIZE >> 1) * YUV420SP_FACTOR; |
| 1539 | ps_tfr_cxt->pu1_mb_v += (MB_SIZE >> 1); |
| 1540 | } |
| 1541 | |
| 1542 | if(ps_cur_mb_info->u2_mbx == (ps_dec->u2_frm_wd_in_mbs - 1)) |
| 1543 | { |
| 1544 | /*Deblock the previous MB*/ |
| 1545 | deblk_mb_t *ps_deblk_cur_mb; |
| 1546 | UWORD8 *pu1_temp; |
| 1547 | |
| 1548 | if(ps_dec->u1_separate_parse == 1) |
| 1549 | ps_deblk_cur_mb = ps_dec->ps_deblk_mbn_dec_thrd + nmb_index; |
| 1550 | else |
| 1551 | ps_deblk_cur_mb = ps_dec->ps_deblk_mbn + nmb_index; |
| 1552 | |
| 1553 | i2_mb_x = ps_cur_mb_info->u2_mbx; |
| 1554 | |
| 1555 | ps_cur_mb = ps_deblk_cur_mb; |
| 1556 | u1_deb_mode = ps_cur_mb->u1_deblocking_mode; |
| 1557 | |
| 1558 | if(ps_dec->u4_app_disable_deblk_frm == 1) |
| 1559 | u1_deb_mode = MB_DISABLE_FILTERING; |
| 1560 | |
| 1561 | if(!(u1_deb_mode & MB_DISABLE_FILTERING)) |
| 1562 | { |
| 1563 | |
| 1564 | if(i2_mb_x) |
| 1565 | { |
| 1566 | ps_left_mb = ps_cur_mb - 1; |
| 1567 | |
| 1568 | } |
| 1569 | else |
| 1570 | { |
| 1571 | ps_left_mb = NULL; |
| 1572 | |
| 1573 | } |
| 1574 | if(i2_mb_y) |
| 1575 | { |
| 1576 | ps_top_mb = ps_cur_mb - (u2_image_wd_mb); |
| 1577 | } |
| 1578 | else |
| 1579 | { |
| 1580 | ps_top_mb = NULL; |
| 1581 | } |
| 1582 | |
| 1583 | if(u1_deb_mode & MB_DISABLE_LEFT_EDGE) |
| 1584 | ps_left_mb = NULL; |
| 1585 | if(u1_deb_mode & MB_DISABLE_TOP_EDGE) |
| 1586 | ps_top_mb = NULL; |
| 1587 | |
| 1588 | ih264d_deblock_mb_nonmbaff(ps_dec, ps_tfr_cxt, i1_cb_qp_idx_ofst, |
| 1589 | i1_cr_qp_idx_ofst, ps_cur_mb, i4_wd_y, |
| 1590 | i4_wd_uv, ps_top_mb, ps_left_mb); |
| 1591 | } |
| 1592 | |
| 1593 | ps_dec->pu1_cur_y_intra_pred_line = |
| 1594 | ps_dec->pu1_cur_y_intra_pred_line_base; |
| 1595 | ps_dec->pu1_cur_u_intra_pred_line = |
| 1596 | ps_dec->pu1_cur_u_intra_pred_line_base; |
| 1597 | ps_dec->pu1_cur_v_intra_pred_line = |
| 1598 | ps_dec->pu1_cur_v_intra_pred_line_base; |
| 1599 | |
| 1600 | /*swap current and previous rows*/ |
| 1601 | pu1_temp = ps_dec->pu1_cur_y_intra_pred_line; |
| 1602 | ps_dec->pu1_cur_y_intra_pred_line = ps_dec->pu1_prev_y_intra_pred_line; |
| 1603 | ps_dec->pu1_prev_y_intra_pred_line = pu1_temp; |
| 1604 | |
| 1605 | pu1_temp = ps_dec->pu1_cur_u_intra_pred_line; |
| 1606 | ps_dec->pu1_cur_u_intra_pred_line = ps_dec->pu1_prev_u_intra_pred_line; |
| 1607 | ps_dec->pu1_prev_u_intra_pred_line = pu1_temp; |
| 1608 | |
| 1609 | pu1_temp = ps_dec->pu1_cur_v_intra_pred_line; |
| 1610 | ps_dec->pu1_cur_v_intra_pred_line = ps_dec->pu1_prev_v_intra_pred_line; |
| 1611 | ps_dec->pu1_prev_v_intra_pred_line = pu1_temp; |
| 1612 | |
| 1613 | ps_dec->pu1_cur_y_intra_pred_line_base = |
| 1614 | ps_dec->pu1_cur_y_intra_pred_line; |
| 1615 | ps_dec->pu1_cur_u_intra_pred_line_base = |
| 1616 | ps_dec->pu1_cur_u_intra_pred_line; |
| 1617 | ps_dec->pu1_cur_v_intra_pred_line_base = |
| 1618 | ps_dec->pu1_cur_v_intra_pred_line; |
| 1619 | |
| 1620 | } |
| 1621 | |
| 1622 | } |
| 1623 | |
| 1624 | void ih264d_filter_boundary_left_mbaff(dec_struct_t *ps_dec, |
| 1625 | tfr_ctxt_t * ps_tfr_cxt, |
| 1626 | WORD8 i1_cb_qp_idx_ofst, |
| 1627 | WORD8 i1_cr_qp_idx_ofst, |
| 1628 | deblk_mb_t * ps_cur_mb, |
| 1629 | UWORD16 i4_strd_y, |
| 1630 | UWORD16 i4_strd_uv, |
| 1631 | deblk_mb_t * ps_left_mb, /* Neighbouring MB parameters */ |
| 1632 | UWORD32 pu4_bs_tab[], /* pointer to the BsTable array */ |
| 1633 | UWORD8 u1_cur_fld) |
| 1634 | { |
| 1635 | UWORD8 *pu1_y, *pu1_u, *pu1_v; |
| 1636 | UWORD8 uc_tmp, qp_avg, uc_QPav_Y; |
| 1637 | WORD32 alpha_u = 0, beta_u = 0, alpha_v = 0, beta_v = 0; |
| 1638 | WORD32 alpha_y = 0, beta_y = 0; |
| 1639 | |
| 1640 | WORD32 idx_b_u, idx_a_u, idx_b_v, idx_a_v; |
| 1641 | WORD32 idx_b_y, idx_a_y; |
| 1642 | |
| 1643 | UWORD32 u4_bs_val; |
| 1644 | |
| 1645 | UWORD8 *pu1_cliptab_u, *pu1_cliptab_v, *pu1_cliptab_y; |
| 1646 | |
| 1647 | UWORD8 u1_double_cl = !ps_cur_mb->u1_single_call; |
| 1648 | WORD32 ofst_a = ps_cur_mb->i1_slice_alpha_c0_offset; |
| 1649 | WORD32 ofst_b = ps_cur_mb->i1_slice_beta_offset; |
| 1650 | |
| 1651 | PROFILE_DISABLE_DEBLK() |
| 1652 | |
| 1653 | pu1_y = ps_tfr_cxt->pu1_mb_y; |
| 1654 | pu1_u = ps_tfr_cxt->pu1_mb_u; |
| 1655 | pu1_v = ps_tfr_cxt->pu1_mb_v; |
| 1656 | |
| 1657 | /* LUMA values */ |
| 1658 | /* Deblock rounding change */ |
| 1659 | uc_tmp = (UWORD8)((ps_left_mb->u1_mb_qp + ps_cur_mb->u1_mb_qp + 1) >> 1); |
| 1660 | uc_QPav_Y = uc_tmp; |
| 1661 | idx_a_y = uc_QPav_Y + ofst_a; |
| 1662 | alpha_y = gau1_ih264d_alpha_table[12 + idx_a_y]; |
| 1663 | idx_b_y = uc_QPav_Y + ofst_b; |
| 1664 | beta_y = gau1_ih264d_beta_table[12 + idx_b_y]; |
| 1665 | |
| 1666 | /* Chroma cb values */ |
| 1667 | { |
| 1668 | UWORD8 u1_mb_qp1, u1_mb_qp2; |
| 1669 | u1_mb_qp1 = (ps_left_mb->u1_mb_qp + i1_cb_qp_idx_ofst); |
| 1670 | u1_mb_qp2 = (ps_cur_mb->u1_mb_qp + i1_cb_qp_idx_ofst); |
| 1671 | qp_avg = (UWORD8)((gau1_ih264d_qp_scale_cr[12 + u1_mb_qp1] |
| 1672 | + gau1_ih264d_qp_scale_cr[12 + u1_mb_qp2] + 1) >> 1); |
| 1673 | } |
| 1674 | idx_a_u = qp_avg + ofst_a; |
| 1675 | alpha_u = gau1_ih264d_alpha_table[12 + idx_a_u]; |
| 1676 | idx_b_u = qp_avg + ofst_b; |
| 1677 | beta_u = gau1_ih264d_beta_table[12 + idx_b_u]; |
| 1678 | |
| 1679 | /* Chroma cr values */ |
| 1680 | { |
| 1681 | UWORD8 u1_mb_qp1, u1_mb_qp2; |
| 1682 | u1_mb_qp1 = (ps_left_mb->u1_mb_qp + i1_cr_qp_idx_ofst); |
| 1683 | u1_mb_qp2 = (ps_cur_mb->u1_mb_qp + i1_cr_qp_idx_ofst); |
| 1684 | qp_avg = (UWORD8)((gau1_ih264d_qp_scale_cr[12 + u1_mb_qp1] |
| 1685 | + gau1_ih264d_qp_scale_cr[12 + u1_mb_qp2] + 1) >> 1); |
| 1686 | } |
| 1687 | idx_a_v = qp_avg + ofst_a; |
| 1688 | alpha_v = gau1_ih264d_alpha_table[12 + idx_a_v]; |
| 1689 | idx_b_v = qp_avg + ofst_b; |
| 1690 | beta_v = gau1_ih264d_beta_table[12 + idx_b_v]; |
| 1691 | |
| 1692 | if(u1_double_cl == 0) |
| 1693 | { |
| 1694 | u4_bs_val = pu4_bs_tab[4]; |
| 1695 | |
| 1696 | if(0x04040404 == u4_bs_val) |
| 1697 | { |
| 1698 | ps_dec->pf_deblk_luma_vert_bs4(pu1_y, i4_strd_y, alpha_y, beta_y); |
| 1699 | ps_dec->pf_deblk_chroma_vert_bs4(pu1_u, i4_strd_uv, alpha_u, |
| 1700 | beta_u, alpha_v, beta_v); |
| 1701 | |
| 1702 | } |
| 1703 | else |
| 1704 | { |
| 1705 | if(u4_bs_val) |
| 1706 | { |
| 1707 | |
| 1708 | pu1_cliptab_y = (UWORD8 *)&gau1_ih264d_clip_table[12 |
| 1709 | + idx_a_y]; |
| 1710 | pu1_cliptab_u = (UWORD8 *)&gau1_ih264d_clip_table[12 |
| 1711 | + idx_a_u]; |
| 1712 | pu1_cliptab_v = (UWORD8 *)&gau1_ih264d_clip_table[12 |
| 1713 | + idx_a_v]; |
| 1714 | |
| 1715 | ps_dec->pf_deblk_luma_vert_bslt4(pu1_y, i4_strd_y, alpha_y, |
| 1716 | beta_y, u4_bs_val, |
| 1717 | pu1_cliptab_y); |
| 1718 | ps_dec->pf_deblk_chroma_vert_bslt4(pu1_u, i4_strd_uv, alpha_u, |
| 1719 | beta_u, alpha_v, beta_v, |
| 1720 | u4_bs_val, pu1_cliptab_u, |
| 1721 | pu1_cliptab_v); |
| 1722 | |
| 1723 | } |
| 1724 | } |
| 1725 | |
| 1726 | } |
| 1727 | else |
| 1728 | { |
| 1729 | |
| 1730 | i4_strd_y <<= (!u1_cur_fld); |
| 1731 | u4_bs_val = pu4_bs_tab[4]; |
| 1732 | i4_strd_uv <<= (!u1_cur_fld); |
| 1733 | |
| 1734 | if(0x04040404 == u4_bs_val) |
| 1735 | { |
| 1736 | ps_dec->pf_deblk_luma_vert_bs4_mbaff(pu1_y, i4_strd_y, alpha_y, |
| 1737 | beta_y); |
| 1738 | ps_dec->pf_deblk_chroma_vert_bs4_mbaff(pu1_u, i4_strd_uv, alpha_u, |
| 1739 | beta_u, alpha_v, beta_v); |
| 1740 | } |
| 1741 | else |
| 1742 | { |
| 1743 | if(u4_bs_val) |
| 1744 | { |
| 1745 | |
| 1746 | pu1_cliptab_y = (UWORD8 *)&gau1_ih264d_clip_table[12 |
| 1747 | + idx_a_y]; |
| 1748 | pu1_cliptab_u = (UWORD8 *)&gau1_ih264d_clip_table[12 |
| 1749 | + idx_a_u]; |
| 1750 | pu1_cliptab_v = (UWORD8 *)&gau1_ih264d_clip_table[12 |
| 1751 | + idx_a_v]; |
| 1752 | ps_dec->pf_deblk_luma_vert_bslt4_mbaff(pu1_y, i4_strd_y, |
| 1753 | alpha_y, beta_y, |
| 1754 | u4_bs_val, |
| 1755 | pu1_cliptab_y); |
| 1756 | ps_dec->pf_deblk_chroma_vert_bslt4_mbaff(pu1_u, i4_strd_uv, |
| 1757 | alpha_u, beta_u, |
| 1758 | alpha_v, beta_v, |
| 1759 | u4_bs_val, |
| 1760 | pu1_cliptab_u, |
| 1761 | pu1_cliptab_v); |
| 1762 | |
| 1763 | } |
| 1764 | } |
| 1765 | |
| 1766 | { |
| 1767 | |
| 1768 | UWORD16 u2_shift = (i4_strd_y >> 1) << (u1_cur_fld ? 4 : 0); |
| 1769 | pu1_y += u2_shift; |
| 1770 | u2_shift = (i4_strd_uv >> 1) << (u1_cur_fld ? 3 : 0); |
| 1771 | pu1_u += u2_shift; |
| 1772 | pu1_v += u2_shift; |
| 1773 | } |
| 1774 | |
| 1775 | uc_tmp = (((ps_left_mb + 1)->u1_mb_qp + ps_cur_mb->u1_mb_qp + 1) >> 1); |
| 1776 | uc_QPav_Y = uc_tmp; |
| 1777 | idx_a_y = uc_QPav_Y + ofst_a; |
| 1778 | alpha_y = gau1_ih264d_alpha_table[12 + idx_a_y]; |
| 1779 | idx_b_y = uc_QPav_Y + ofst_b; |
| 1780 | beta_y = gau1_ih264d_beta_table[12 + idx_b_y]; |
| 1781 | u4_bs_val = pu4_bs_tab[9]; |
| 1782 | |
| 1783 | { |
| 1784 | UWORD8 u1_mb_qp1, u1_mb_qp2; |
| 1785 | u1_mb_qp1 = ((ps_left_mb + 1)->u1_mb_qp + i1_cb_qp_idx_ofst); |
| 1786 | u1_mb_qp2 = (ps_cur_mb->u1_mb_qp + i1_cb_qp_idx_ofst); |
| 1787 | qp_avg = (UWORD8)((gau1_ih264d_qp_scale_cr[12 + u1_mb_qp1] |
| 1788 | + gau1_ih264d_qp_scale_cr[12 + u1_mb_qp2] + 1) >> 1); |
| 1789 | } |
| 1790 | idx_a_u = qp_avg + ofst_a; |
| 1791 | alpha_u = gau1_ih264d_alpha_table[12 + idx_a_u]; |
| 1792 | idx_b_u = qp_avg + ofst_b; |
| 1793 | beta_u = gau1_ih264d_beta_table[12 + idx_b_u]; |
| 1794 | u4_bs_val = pu4_bs_tab[9]; |
| 1795 | { |
| 1796 | UWORD8 u1_mb_qp1, u1_mb_qp2; |
| 1797 | u1_mb_qp1 = ((ps_left_mb + 1)->u1_mb_qp + i1_cr_qp_idx_ofst); |
| 1798 | u1_mb_qp2 = (ps_cur_mb->u1_mb_qp + i1_cr_qp_idx_ofst); |
| 1799 | qp_avg = (UWORD8)((gau1_ih264d_qp_scale_cr[12 + u1_mb_qp1] |
| 1800 | + gau1_ih264d_qp_scale_cr[12 + u1_mb_qp2] + 1) >> 1); |
| 1801 | } |
| 1802 | idx_a_v = qp_avg + ofst_a; |
| 1803 | alpha_v = gau1_ih264d_alpha_table[12 + idx_a_v]; |
| 1804 | idx_b_v = qp_avg + ofst_b; |
| 1805 | beta_v = gau1_ih264d_beta_table[12 + idx_b_v]; |
| 1806 | |
| 1807 | if(0x04040404 == u4_bs_val) |
| 1808 | { |
| 1809 | ps_dec->pf_deblk_luma_vert_bs4_mbaff(pu1_y, i4_strd_y, alpha_y, |
| 1810 | beta_y); |
| 1811 | ps_dec->pf_deblk_chroma_vert_bs4_mbaff(pu1_u, i4_strd_uv, alpha_u, |
| 1812 | beta_u, alpha_v, beta_v); |
| 1813 | |
| 1814 | } |
| 1815 | else |
| 1816 | { |
| 1817 | if(u4_bs_val) |
| 1818 | { |
| 1819 | |
| 1820 | pu1_cliptab_y = (UWORD8 *)&gau1_ih264d_clip_table[12 |
| 1821 | + idx_a_y]; |
| 1822 | pu1_cliptab_u = (UWORD8 *)&gau1_ih264d_clip_table[12 |
| 1823 | + idx_a_u]; |
| 1824 | pu1_cliptab_v = (UWORD8 *)&gau1_ih264d_clip_table[12 |
| 1825 | + idx_a_v]; |
| 1826 | |
| 1827 | ps_dec->pf_deblk_luma_vert_bslt4_mbaff(pu1_y, i4_strd_y, |
| 1828 | alpha_y, beta_y, |
| 1829 | u4_bs_val, |
| 1830 | pu1_cliptab_y); |
| 1831 | ps_dec->pf_deblk_chroma_vert_bslt4_mbaff(pu1_u, i4_strd_uv, |
| 1832 | alpha_u, beta_u, |
| 1833 | alpha_v, beta_v, |
| 1834 | u4_bs_val, |
| 1835 | pu1_cliptab_u, |
| 1836 | pu1_cliptab_v); |
| 1837 | |
| 1838 | } |
| 1839 | } |
| 1840 | } |
| 1841 | |
| 1842 | } |
| 1843 | |
| 1844 | void ih264d_filter_boundary_topmbaff(dec_struct_t *ps_dec, |
| 1845 | tfr_ctxt_t * ps_tfr_cxt, |
| 1846 | WORD8 i1_cb_qp_idx_ofst, |
| 1847 | WORD8 i1_cr_qp_idx_ofst, |
| 1848 | deblk_mb_t * ps_cur_mb, |
| 1849 | UWORD16 i4_strd_y, |
| 1850 | UWORD16 i4_strd_uv, |
| 1851 | deblk_mb_t * ps_top_mb, |
| 1852 | UWORD32 u4_bs) |
| 1853 | { |
| 1854 | UWORD8 *pu1_y, *pu1_u; |
| 1855 | WORD32 alpha_u = 0, beta_u = 0, alpha_v = 0, beta_v = 0; |
| 1856 | WORD32 alpha_y = 0, beta_y = 0; |
| 1857 | WORD32 qp_avg; |
| 1858 | WORD32 uc_QPav_Y; |
| 1859 | WORD32 idx_b_u, idx_a_u, idx_b_v, idx_a_v; |
| 1860 | WORD32 idx_b_y, idx_a_y; |
| 1861 | UWORD16 uc_tmp; |
| 1862 | |
| 1863 | UWORD8 *pu1_cliptab_u, *pu1_cliptab_v, *pu1_cliptab_y; |
| 1864 | WORD32 ofst_a = ps_cur_mb->i1_slice_alpha_c0_offset; |
| 1865 | WORD32 ofst_b = ps_cur_mb->i1_slice_beta_offset; |
| 1866 | |
| 1867 | /* LUMA values */ |
| 1868 | /* Deblock rounding change */ |
| 1869 | uc_tmp = ((ps_top_mb->u1_mb_qp + ps_cur_mb->u1_mb_qp + 1) >> 1); |
| 1870 | uc_QPav_Y = (UWORD8)uc_tmp; |
| 1871 | idx_a_y = uc_QPav_Y + ofst_a; |
| 1872 | alpha_y = gau1_ih264d_alpha_table[12 + idx_a_y]; |
| 1873 | idx_b_y = uc_QPav_Y + ofst_b; |
| 1874 | beta_y = gau1_ih264d_beta_table[12 + idx_b_y]; |
| 1875 | pu1_y = ps_tfr_cxt->pu1_mb_y; |
| 1876 | |
| 1877 | /* CHROMA cb values */ |
| 1878 | { |
| 1879 | UWORD8 u1_mb_qp1, u1_mb_qp2; |
| 1880 | u1_mb_qp1 = (ps_top_mb->u1_mb_qp + i1_cb_qp_idx_ofst); |
| 1881 | u1_mb_qp2 = (ps_cur_mb->u1_mb_qp + i1_cb_qp_idx_ofst); |
| 1882 | qp_avg = (UWORD8)((gau1_ih264d_qp_scale_cr[12 + u1_mb_qp1] |
| 1883 | + gau1_ih264d_qp_scale_cr[12 + u1_mb_qp2] + 1) >> 1); |
| 1884 | } |
| 1885 | |
| 1886 | idx_a_u = qp_avg + ofst_a; |
| 1887 | alpha_u = gau1_ih264d_alpha_table[12 + idx_a_u]; |
| 1888 | idx_b_u = qp_avg + ofst_b; |
| 1889 | beta_u = gau1_ih264d_beta_table[12 + idx_b_u]; |
| 1890 | /* CHROMA cr values */ |
| 1891 | { |
| 1892 | UWORD8 u1_mb_qp1, u1_mb_qp2; |
| 1893 | u1_mb_qp1 = (ps_top_mb->u1_mb_qp + i1_cr_qp_idx_ofst); |
| 1894 | u1_mb_qp2 = (ps_cur_mb->u1_mb_qp + i1_cr_qp_idx_ofst); |
| 1895 | qp_avg = (UWORD8)((gau1_ih264d_qp_scale_cr[12 + u1_mb_qp1] |
| 1896 | + gau1_ih264d_qp_scale_cr[12 + u1_mb_qp2] + 1) >> 1); |
| 1897 | } |
| 1898 | |
| 1899 | idx_a_v = qp_avg + ofst_a; |
| 1900 | alpha_v = gau1_ih264d_alpha_table[12 + idx_a_v]; |
| 1901 | idx_b_v = qp_avg + ofst_b; |
| 1902 | beta_v = gau1_ih264d_beta_table[12 + idx_b_v]; |
| 1903 | pu1_u = ps_tfr_cxt->pu1_mb_u; |
| 1904 | |
| 1905 | if(u4_bs == 0x04040404) |
| 1906 | { |
| 1907 | /* Code specific to the assembly module */ |
| 1908 | ps_dec->pf_deblk_luma_horz_bs4(pu1_y, i4_strd_y, alpha_y, beta_y); |
| 1909 | ps_dec->pf_deblk_chroma_horz_bs4(pu1_u, i4_strd_uv, alpha_u, beta_u, |
| 1910 | alpha_v, beta_v); |
| 1911 | |
| 1912 | } |
| 1913 | else |
| 1914 | { |
| 1915 | if(u4_bs) |
| 1916 | { |
| 1917 | |
| 1918 | pu1_cliptab_y = (UWORD8 *)&gau1_ih264d_clip_table[12 + idx_a_y]; |
| 1919 | pu1_cliptab_u = |
| 1920 | (UWORD8 *)&gau1_ih264d_clip_table[12 + idx_a_u]; |
| 1921 | pu1_cliptab_v = |
| 1922 | (UWORD8 *)&gau1_ih264d_clip_table[12 + idx_a_v]; |
| 1923 | |
| 1924 | ps_dec->pf_deblk_luma_horz_bslt4(pu1_y, i4_strd_y, alpha_y, beta_y, |
| 1925 | u4_bs, pu1_cliptab_y); |
| 1926 | ps_dec->pf_deblk_chroma_horz_bslt4(pu1_u, i4_strd_uv, alpha_u, |
| 1927 | beta_u, alpha_v, beta_v, |
| 1928 | u4_bs, pu1_cliptab_u, |
| 1929 | pu1_cliptab_v); |
| 1930 | |
| 1931 | } |
| 1932 | } |
| 1933 | |
| 1934 | } |
| 1935 | |
| 1936 | void ih264d_deblock_mb_mbaff(dec_struct_t *ps_dec, |
| 1937 | tfr_ctxt_t * ps_tfr_cxt, |
| 1938 | WORD8 i1_cb_qp_idx_ofst, |
| 1939 | WORD8 i1_cr_qp_idx_ofst, |
| 1940 | deblk_mb_t * ps_cur_mb, |
| 1941 | WORD32 i4_strd_y, |
| 1942 | WORD32 i4_strd_uv, |
| 1943 | deblk_mb_t * ps_top_mb, |
| 1944 | deblk_mb_t * ps_left_mb, |
| 1945 | UWORD8 u1_cur_fld, |
| 1946 | UWORD8 u1_extra_top_edge) |
| 1947 | { |
| 1948 | UWORD8 *pu1_y, *pu1_u; |
| 1949 | UWORD32 u4_bs; |
| 1950 | // WORD8 edge; |
| 1951 | WORD32 alpha, beta, alpha_u, beta_u, alpha_v, beta_v; |
| 1952 | |
| 1953 | UWORD8 *pu1_cliptab_u; |
| 1954 | UWORD8 *pu1_cliptab_v; |
| 1955 | UWORD8 *pu1_cliptab_y; |
| 1956 | |
| 1957 | UWORD32 * pu4_bs_tab = ps_cur_mb->u4_bs_table; |
| 1958 | WORD32 idx_a_y, idx_a_u, idx_a_v; |
| 1959 | /* Return from here to switch off deblocking */ |
| 1960 | PROFILE_DISABLE_DEBLK() |
| 1961 | |
| 1962 | i4_strd_y <<= u1_cur_fld; |
| 1963 | i4_strd_uv <<= u1_cur_fld; |
| 1964 | /*--------------------------------------------------------------------*/ |
| 1965 | /* Filter wrt Left edge */ |
| 1966 | /* except */ |
| 1967 | /* - Left Egde is Picture Boundary */ |
| 1968 | /* - Left Egde is part of Slice Boundary and Deblocking */ |
| 1969 | /* parameters of slice disable Filtering of Slice Boundary Edges*/ |
| 1970 | /*--------------------------------------------------------------------*/ |
| 1971 | if(ps_left_mb) |
| 1972 | ih264d_filter_boundary_left_mbaff(ps_dec, ps_tfr_cxt, i1_cb_qp_idx_ofst, |
| 1973 | i1_cr_qp_idx_ofst, ps_cur_mb, |
| 1974 | i4_strd_y, i4_strd_uv, ps_left_mb, |
| 1975 | pu4_bs_tab, u1_cur_fld); |
| 1976 | |
| 1977 | /*--------------------------------------------------------------------*/ |
| 1978 | /* Filter wrt Other Vertical Edges */ |
| 1979 | /*--------------------------------------------------------------------*/ |
| 1980 | { |
| 1981 | WORD32 ofst_a, ofst_b, idx_b_y, idx_b_u, |
| 1982 | idx_b_v; |
| 1983 | WORD32 qp_avg, qp_avg_u, qp_avg_v; |
| 1984 | ofst_a = ps_cur_mb->i1_slice_alpha_c0_offset; |
| 1985 | ofst_b = ps_cur_mb->i1_slice_beta_offset; |
| 1986 | qp_avg = ps_cur_mb->u1_mb_qp; |
| 1987 | idx_a_y = qp_avg + ofst_a; |
| 1988 | alpha = gau1_ih264d_alpha_table[12 + idx_a_y]; |
| 1989 | idx_b_y = qp_avg + ofst_b; |
| 1990 | beta = gau1_ih264d_beta_table[12 + idx_b_y]; |
| 1991 | |
| 1992 | /* CHROMA Cb values */ |
| 1993 | qp_avg_u = (qp_avg + i1_cb_qp_idx_ofst); |
| 1994 | qp_avg_u = gau1_ih264d_qp_scale_cr[12 + qp_avg_u]; |
| 1995 | idx_a_u = qp_avg_u + ofst_a; |
| 1996 | alpha_u = gau1_ih264d_alpha_table[12 + idx_a_u]; |
| 1997 | idx_b_u = qp_avg_u + ofst_b; |
| 1998 | beta_u = gau1_ih264d_beta_table[12 + idx_b_u]; |
| 1999 | /* CHROMA Cr values */ |
| 2000 | qp_avg_v = (qp_avg + i1_cr_qp_idx_ofst); |
| 2001 | qp_avg_v = gau1_ih264d_qp_scale_cr[12 + qp_avg_v]; |
| 2002 | idx_a_v = qp_avg_v + ofst_a; |
| 2003 | alpha_v = gau1_ih264d_alpha_table[12 + idx_a_v]; |
| 2004 | idx_b_v = qp_avg_v + ofst_b; |
| 2005 | beta_v = gau1_ih264d_beta_table[12 + idx_b_v]; |
| 2006 | } |
| 2007 | |
| 2008 | //STARTL4_FILTER_VERT; |
| 2009 | |
| 2010 | pu1_cliptab_y = (UWORD8 *)&gau1_ih264d_clip_table[12 + idx_a_y]; //this for Luma |
| 2011 | pu1_cliptab_u = (UWORD8 *)&gau1_ih264d_clip_table[12 + idx_a_u]; //this for chroma |
| 2012 | pu1_cliptab_v = (UWORD8 *)&gau1_ih264d_clip_table[12 + idx_a_v]; //this for chroma |
| 2013 | |
| 2014 | //edge=1 |
| 2015 | |
| 2016 | |
| 2017 | u4_bs = pu4_bs_tab[5]; |
| 2018 | pu1_y = ps_tfr_cxt->pu1_mb_y; |
| 2019 | pu1_u = ps_tfr_cxt->pu1_mb_u; |
| 2020 | |
| 2021 | if(u4_bs) |
| 2022 | { |
| 2023 | |
| 2024 | ps_dec->pf_deblk_luma_vert_bslt4(pu1_y + 4, i4_strd_y, alpha, beta, |
| 2025 | u4_bs, pu1_cliptab_y); |
| 2026 | |
| 2027 | } |
| 2028 | //edge=2 |
| 2029 | |
| 2030 | u4_bs = pu4_bs_tab[6]; |
| 2031 | if(u4_bs) |
| 2032 | { |
| 2033 | |
| 2034 | ps_dec->pf_deblk_luma_vert_bslt4(pu1_y + 8, i4_strd_y, alpha, beta, |
| 2035 | u4_bs, pu1_cliptab_y); |
| 2036 | ps_dec->pf_deblk_chroma_vert_bslt4(pu1_u + 4 * YUV420SP_FACTOR, |
| 2037 | i4_strd_uv, alpha_u, beta_u, |
| 2038 | alpha_v, beta_v, u4_bs, |
| 2039 | pu1_cliptab_u, pu1_cliptab_v); |
| 2040 | } |
| 2041 | //edge=3 |
| 2042 | |
| 2043 | u4_bs = pu4_bs_tab[7]; |
| 2044 | if(u4_bs) |
| 2045 | { |
| 2046 | |
| 2047 | ps_dec->pf_deblk_luma_vert_bslt4(pu1_y + 12, i4_strd_y, alpha, beta, |
| 2048 | u4_bs, pu1_cliptab_y); |
| 2049 | |
| 2050 | } |
| 2051 | |
| 2052 | /*--------------------------------------------------------------------*/ |
| 2053 | /* Filter wrt Top edge */ |
| 2054 | /* except */ |
| 2055 | /* - Top Egde is Picture Boundary */ |
| 2056 | /* - Top Egde is part of Slice Boundary and Deblocking */ |
| 2057 | /* parameters of slice disable Filtering of Slice Boundary Edges*/ |
| 2058 | /*--------------------------------------------------------------------*/ |
| 2059 | if(ps_top_mb) |
| 2060 | { |
| 2061 | /** if top MB and MB AFF and cur MB is frame and top is field then */ |
| 2062 | /* one extra top edge needs to be deblocked */ |
| 2063 | if(u1_extra_top_edge) |
| 2064 | { |
| 2065 | ih264d_filter_boundary_topmbaff(ps_dec, ps_tfr_cxt, |
| 2066 | i1_cb_qp_idx_ofst, |
| 2067 | i1_cr_qp_idx_ofst, ps_cur_mb, |
| 2068 | (UWORD16)(i4_strd_y << 1), |
| 2069 | (UWORD16)(i4_strd_uv << 1), |
| 2070 | ps_top_mb - 1, pu4_bs_tab[8]); |
| 2071 | ps_tfr_cxt->pu1_mb_y += i4_strd_y; |
| 2072 | ps_tfr_cxt->pu1_mb_u += i4_strd_uv; |
| 2073 | ps_tfr_cxt->pu1_mb_v += i4_strd_uv; |
| 2074 | |
| 2075 | ih264d_filter_boundary_topmbaff(ps_dec, ps_tfr_cxt, |
| 2076 | i1_cb_qp_idx_ofst, |
| 2077 | i1_cr_qp_idx_ofst, ps_cur_mb, |
| 2078 | (UWORD16)(i4_strd_y << 1), |
| 2079 | (UWORD16)(i4_strd_uv << 1), |
| 2080 | ps_top_mb, pu4_bs_tab[0]); |
| 2081 | ps_tfr_cxt->pu1_mb_y -= i4_strd_y; |
| 2082 | ps_tfr_cxt->pu1_mb_u -= i4_strd_uv; |
| 2083 | ps_tfr_cxt->pu1_mb_v -= i4_strd_uv; |
| 2084 | } |
| 2085 | else |
| 2086 | { |
| 2087 | ih264d_filter_boundary_topmbaff(ps_dec, ps_tfr_cxt, |
| 2088 | i1_cb_qp_idx_ofst, |
| 2089 | i1_cr_qp_idx_ofst, ps_cur_mb, |
| 2090 | i4_strd_y, i4_strd_uv, ps_top_mb, |
| 2091 | pu4_bs_tab[0]); |
| 2092 | } |
| 2093 | } |
| 2094 | |
| 2095 | /*--------------------------------------------------------------------*/ |
| 2096 | /* Filter wrt Other Horizontal Edges */ |
| 2097 | /*--------------------------------------------------------------------*/ |
| 2098 | |
| 2099 | //edge1 |
| 2100 | u4_bs = pu4_bs_tab[1]; |
| 2101 | |
| 2102 | if(u4_bs) |
| 2103 | { |
| 2104 | ps_dec->pf_deblk_luma_horz_bslt4(pu1_y + (i4_strd_y << 2), i4_strd_y, |
| 2105 | alpha, beta, u4_bs, pu1_cliptab_y); |
| 2106 | |
| 2107 | } |
| 2108 | //edge2 |
| 2109 | u4_bs = pu4_bs_tab[2]; |
| 2110 | |
| 2111 | if(u4_bs) |
| 2112 | { |
| 2113 | |
| 2114 | ps_dec->pf_deblk_luma_horz_bslt4(pu1_y + (i4_strd_y << 3), i4_strd_y, |
| 2115 | alpha, beta, u4_bs, pu1_cliptab_y); |
| 2116 | ps_dec->pf_deblk_chroma_horz_bslt4(pu1_u + (i4_strd_uv << 2), |
| 2117 | i4_strd_uv, alpha_u, beta_u, |
| 2118 | alpha_v, beta_v, u4_bs, |
| 2119 | pu1_cliptab_u, pu1_cliptab_v); |
| 2120 | |
| 2121 | } |
| 2122 | //edge3 |
| 2123 | u4_bs = pu4_bs_tab[3]; |
| 2124 | if(u4_bs) |
| 2125 | { |
| 2126 | |
| 2127 | ps_dec->pf_deblk_luma_horz_bslt4( |
| 2128 | (pu1_y + (i4_strd_y << 3) + (i4_strd_y << 2)), |
| 2129 | i4_strd_y, alpha, beta, u4_bs, pu1_cliptab_y); |
| 2130 | |
| 2131 | } |
| 2132 | |
| 2133 | } |
| 2134 | |