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 | /*! |
| 22 | ************************************************************************** |
| 23 | * \file ih264d_parse_pslice.c |
| 24 | * |
| 25 | * \brief |
| 26 | * Contains routines that decode a I slice type |
| 27 | * |
| 28 | * Detailed_description |
| 29 | * |
| 30 | * \date |
| 31 | * 07/07/2003 |
| 32 | * |
| 33 | * \author NS |
| 34 | ************************************************************************** |
| 35 | */ |
| 36 | |
| 37 | #include <string.h> |
| 38 | #include "ih264d_bitstrm.h" |
| 39 | #include "ih264d_defs.h" |
| 40 | #include "ih264d_debug.h" |
| 41 | #include "ih264d_tables.h" |
| 42 | #include "ih264d_structs.h" |
| 43 | #include "ih264d_defs.h" |
| 44 | #include "ih264d_parse_cavlc.h" |
| 45 | #include "ih264d_mb_utils.h" |
| 46 | #include "ih264d_parse_slice.h" |
| 47 | #include "ih264d_mvpred.h" |
| 48 | #include "ih264d_parse_islice.h" |
| 49 | #include "ih264d_process_intra_mb.h" |
| 50 | #include "ih264d_inter_pred.h" |
| 51 | #include "ih264d_process_pslice.h" |
| 52 | #include "ih264d_deblocking.h" |
| 53 | #include "ih264d_cabac.h" |
| 54 | #include "ih264d_parse_mb_header.h" |
| 55 | #include "ih264d_error_handler.h" |
| 56 | #include "ih264d_defs.h" |
| 57 | #include "ih264d_format_conv.h" |
| 58 | #include "ih264d_quant_scaling.h" |
| 59 | #include "ih264d_thread_parse_decode.h" |
| 60 | #include "ih264d_process_bslice.h" |
| 61 | #include "ithread.h" |
| 62 | #include "ih264d_utils.h" |
| 63 | #include "ih264d_format_conv.h" |
| 64 | |
| 65 | void ih264d_init_cabac_contexts(UWORD8 u1_slice_type, dec_struct_t * ps_dec); |
| 66 | void ih264d_deblock_mb_level(dec_struct_t *ps_dec, |
| 67 | dec_mb_info_t *ps_cur_mb_info, |
| 68 | UWORD32 nmb_index); |
| 69 | |
| 70 | /*! |
| 71 | ************************************************************************** |
| 72 | * \if Function name : ih264d_parse_pmb_cavlc \endif |
| 73 | * |
| 74 | * \brief |
| 75 | * This function parses CAVLC syntax of a P MB. |
| 76 | * |
| 77 | * \return |
| 78 | * 0 on Success and Error code otherwise |
| 79 | ************************************************************************** |
| 80 | */ |
| 81 | WORD32 ih264d_parse_pmb_cavlc(dec_struct_t * ps_dec, |
| 82 | dec_mb_info_t * ps_cur_mb_info, |
| 83 | UWORD8 u1_mb_num, |
| 84 | UWORD8 u1_num_mbsNby2) |
| 85 | { |
| 86 | UWORD32 u1_num_mb_part; |
| 87 | UWORD32 uc_sub_mb; |
| 88 | dec_bit_stream_t * const ps_bitstrm = ps_dec->ps_bitstrm; |
| 89 | UWORD32 * const pu4_bitstrm_buf = ps_bitstrm->pu4_buffer; |
| 90 | UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst; |
| 91 | |
| 92 | parse_pmbarams_t * ps_parse_mb_data = ps_dec->ps_parse_mb_data |
| 93 | + u1_num_mbsNby2; |
| 94 | WORD8 * pi1_ref_idx = ps_parse_mb_data->i1_ref_idx[0]; |
| 95 | const UWORD8 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag; |
| 96 | const UWORD8 * pu1_num_mb_part = (const UWORD8 *)gau1_ih264d_num_mb_part; |
| 97 | UWORD8 * pu1_col_info = ps_parse_mb_data->u1_col_info; |
| 98 | |
| 99 | UWORD32 u1_mb_type = ps_cur_mb_info->u1_mb_type; |
| 100 | UWORD32 u4_sum_mb_mode_pack = 0; |
| 101 | WORD32 ret; |
| 102 | |
| 103 | UWORD8 u1_no_submb_part_size_lt8x8_flag = 1; |
| 104 | ps_cur_mb_info->u1_tran_form8x8 = 0; |
| 105 | ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = 0; |
| 106 | |
| 107 | ps_cur_mb_info->u1_yuv_dc_block_flag = 0; |
| 108 | |
| 109 | ps_cur_mb_info->u1_mb_mc_mode = u1_mb_type; |
| 110 | uc_sub_mb = ((u1_mb_type == PRED_8x8) | (u1_mb_type == PRED_8x8R0)); |
| 111 | |
| 112 | /* Reading the subMB type */ |
| 113 | if(uc_sub_mb) |
| 114 | { |
| 115 | WORD32 i; |
| 116 | UWORD8 u1_colz = (PRED_8x8 << 6); |
| 117 | |
| 118 | for(i = 0; i < 4; i++) |
| 119 | { |
| 120 | UWORD32 ui_sub_mb_mode; |
| 121 | |
| 122 | //Inlined ih264d_uev |
| 123 | UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst; |
| 124 | UWORD32 u4_word, u4_ldz; |
| 125 | |
| 126 | /***************************************************************/ |
| 127 | /* Find leading zeros in next 32 bits */ |
| 128 | /***************************************************************/ |
| 129 | NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf); |
| 130 | u4_ldz = CLZ(u4_word); |
| 131 | /* Flush the ps_bitstrm */ |
| 132 | u4_bitstream_offset += (u4_ldz + 1); |
| 133 | /* Read the suffix from the ps_bitstrm */ |
| 134 | u4_word = 0; |
| 135 | if(u4_ldz) |
| 136 | GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, |
| 137 | u4_ldz); |
| 138 | *pu4_bitstrm_ofst = u4_bitstream_offset; |
| 139 | ui_sub_mb_mode = ((1 << u4_ldz) + u4_word - 1); |
| 140 | //Inlined ih264d_uev |
| 141 | |
| 142 | if(ui_sub_mb_mode > 3) |
| 143 | { |
| 144 | return ERROR_SUB_MB_TYPE; |
| 145 | } |
| 146 | else |
| 147 | { |
| 148 | u4_sum_mb_mode_pack = (u4_sum_mb_mode_pack << 8) | ui_sub_mb_mode; |
| 149 | /* Storing collocated information */ |
| 150 | *pu1_col_info++ = u1_colz | (UWORD8)(ui_sub_mb_mode << 4); |
| 151 | |
| 152 | COPYTHECONTEXT("sub_mb_type", ui_sub_mb_mode); |
| 153 | } |
| 154 | |
| 155 | /* check if Motion compensation is done below 8x8 */ |
| 156 | if(ui_sub_mb_mode != P_L0_8x8) |
| 157 | { |
| 158 | u1_no_submb_part_size_lt8x8_flag = 0; |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | // |
| 163 | u1_num_mb_part = 4; |
| 164 | } |
| 165 | else |
| 166 | { |
| 167 | *pu1_col_info++ = (u1_mb_type << 6); |
| 168 | if(u1_mb_type) |
| 169 | *pu1_col_info++ = (u1_mb_type << 6); |
| 170 | u1_num_mb_part = pu1_num_mb_part[u1_mb_type]; |
| 171 | |
| 172 | } |
| 173 | |
| 174 | /* Decoding reference index 0: For simple profile the following */ |
| 175 | /* conditions are always true (mb_field_decoding_flag == 0); */ |
| 176 | /* (MbPartPredMode != PredL1) */ |
| 177 | |
| 178 | { |
| 179 | |
| 180 | UWORD8 uc_field = ps_cur_mb_info->u1_mb_field_decodingflag; |
| 181 | UWORD8 uc_num_ref_idx_l0_active_minus1 = |
| 182 | (ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[0] |
| 183 | << (u1_mbaff & uc_field)) - 1; |
| 184 | |
| 185 | if((uc_num_ref_idx_l0_active_minus1 > 0) & (u1_mb_type != PRED_8x8R0)) |
| 186 | { |
| 187 | if(1 == uc_num_ref_idx_l0_active_minus1) |
| 188 | ih264d_parse_pmb_ref_index_cavlc_range1( |
| 189 | u1_num_mb_part, ps_bitstrm, pi1_ref_idx, |
| 190 | uc_num_ref_idx_l0_active_minus1); |
| 191 | else |
| 192 | { |
| 193 | ret = ih264d_parse_pmb_ref_index_cavlc( |
| 194 | u1_num_mb_part, ps_bitstrm, pi1_ref_idx, |
| 195 | uc_num_ref_idx_l0_active_minus1); |
| 196 | if(ret != OK) |
| 197 | return ret; |
| 198 | } |
| 199 | } |
| 200 | else |
| 201 | { |
| 202 | /* When there exists only a single frame to predict from */ |
| 203 | UWORD8 uc_i; |
| 204 | for(uc_i = 0; uc_i < u1_num_mb_part; uc_i++) |
| 205 | /* Storing Reference Idx Information */ |
| 206 | pi1_ref_idx[uc_i] = 0; |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | { |
| 211 | UWORD8 u1_p_idx, uc_i; |
| 212 | parse_part_params_t * ps_part = ps_dec->ps_part; |
| 213 | UWORD8 u1_sub_mb_mode, u1_num_subpart, u1_mb_part_width, u1_mb_part_height; |
| 214 | UWORD8 u1_sub_mb_num; |
| 215 | const UWORD8 * pu1_top_left_sub_mb_indx; |
| 216 | mv_pred_t * ps_mv, *ps_mv_start = ps_dec->ps_mv_cur + (u1_mb_num << 4); |
| 217 | /* Loading the table pointers */ |
| 218 | const UWORD8 * pu1_mb_partw = (const UWORD8 *)gau1_ih264d_mb_partw; |
| 219 | const UWORD8 * pu1_mb_parth = (const UWORD8 *)gau1_ih264d_mb_parth; |
| 220 | const UWORD8 * pu1_sub_mb_indx_mod = |
| 221 | (const UWORD8 *)(gau1_ih264d_submb_indx_mod) |
| 222 | + (uc_sub_mb * 6); |
| 223 | const UWORD8 * pu1_sub_mb_partw = (const UWORD8 *)gau1_ih264d_submb_partw; |
| 224 | const UWORD8 * pu1_sub_mb_parth = (const UWORD8 *)gau1_ih264d_submb_parth; |
| 225 | const UWORD8 * pu1_num_sub_mb_part = |
| 226 | (const UWORD8 *)gau1_ih264d_num_submb_part; |
| 227 | |
| 228 | UWORD16 u2_sub_mb_num = 0x028A; |
| 229 | |
| 230 | /*********************************************************/ |
| 231 | /* default initialisations for condition (uc_sub_mb == 0) */ |
| 232 | /* i.e. all are subpartitions of 8x8 */ |
| 233 | /*********************************************************/ |
| 234 | u1_sub_mb_mode = 0; |
| 235 | u1_num_subpart = 1; |
| 236 | u1_mb_part_width = pu1_mb_partw[u1_mb_type]; |
| 237 | u1_mb_part_height = pu1_mb_parth[u1_mb_type]; |
| 238 | pu1_top_left_sub_mb_indx = pu1_sub_mb_indx_mod + (u1_mb_type << 1); |
| 239 | u1_sub_mb_num = 0; |
| 240 | |
| 241 | /* Loop on number of partitions */ |
| 242 | for(uc_i = 0, u1_p_idx = 0; uc_i < u1_num_mb_part; uc_i++) |
| 243 | { |
| 244 | UWORD8 uc_j; |
| 245 | if(uc_sub_mb) |
| 246 | { |
| 247 | u1_sub_mb_mode = u4_sum_mb_mode_pack >> 24; |
| 248 | u1_num_subpart = pu1_num_sub_mb_part[u1_sub_mb_mode]; |
| 249 | u1_mb_part_width = pu1_sub_mb_partw[u1_sub_mb_mode]; |
| 250 | u1_mb_part_height = pu1_sub_mb_parth[u1_sub_mb_mode]; |
| 251 | pu1_top_left_sub_mb_indx = pu1_sub_mb_indx_mod + (u1_sub_mb_mode << 1); |
| 252 | u1_sub_mb_num = u2_sub_mb_num >> 12; |
| 253 | u4_sum_mb_mode_pack <<= 8; |
| 254 | u2_sub_mb_num <<= 4; |
| 255 | } |
| 256 | |
| 257 | /* Loop on Number of sub-partitions */ |
| 258 | for(uc_j = 0; uc_j < u1_num_subpart; uc_j++, pu1_top_left_sub_mb_indx++) |
| 259 | { |
| 260 | WORD16 i2_mvx, i2_mvy; |
| 261 | u1_sub_mb_num += *pu1_top_left_sub_mb_indx; |
| 262 | ps_mv = ps_mv_start + u1_sub_mb_num; |
| 263 | |
| 264 | /* Reading the differential Mv from the bitstream */ |
| 265 | //i2_mvx = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf); |
| 266 | //inlining ih264d_sev |
| 267 | { |
| 268 | UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst; |
| 269 | UWORD32 u4_word, u4_ldz, u4_abs_val; |
| 270 | |
| 271 | /***************************************************************/ |
| 272 | /* Find leading zeros in next 32 bits */ |
| 273 | /***************************************************************/ |
| 274 | NEXTBITS_32(u4_word, u4_bitstream_offset, |
| 275 | pu4_bitstrm_buf); |
| 276 | u4_ldz = CLZ(u4_word); |
| 277 | |
| 278 | /* Flush the ps_bitstrm */ |
| 279 | u4_bitstream_offset += (u4_ldz + 1); |
| 280 | |
| 281 | /* Read the suffix from the ps_bitstrm */ |
| 282 | u4_word = 0; |
| 283 | if(u4_ldz) |
| 284 | GETBITS(u4_word, u4_bitstream_offset, |
| 285 | pu4_bitstrm_buf, u4_ldz); |
| 286 | |
| 287 | *pu4_bitstrm_ofst = u4_bitstream_offset; |
| 288 | u4_abs_val = ((1 << u4_ldz) + u4_word) >> 1; |
| 289 | |
| 290 | if(u4_word & 0x1) |
| 291 | i2_mvx = (-(WORD32)u4_abs_val); |
| 292 | else |
| 293 | i2_mvx = (u4_abs_val); |
| 294 | } |
| 295 | //inlinined ih264d_sev |
| 296 | COPYTHECONTEXT("MVD", i2_mvx); |
| 297 | i2_mvy = ih264d_sev(pu4_bitstrm_ofst, |
| 298 | pu4_bitstrm_buf); |
| 299 | COPYTHECONTEXT("MVD", i2_mvy); |
| 300 | |
| 301 | /* Storing Info for partitions */ |
| 302 | ps_part->u1_is_direct = PART_NOT_DIRECT; |
| 303 | ps_part->u1_sub_mb_num = u1_sub_mb_num; |
| 304 | ps_part->u1_partheight = u1_mb_part_height; |
| 305 | ps_part->u1_partwidth = u1_mb_part_width; |
| 306 | |
| 307 | /* Storing Mv residuals */ |
| 308 | ps_mv->i2_mv[0] = i2_mvx; |
| 309 | ps_mv->i2_mv[1] = i2_mvy; |
| 310 | |
| 311 | /* Increment partition Index */ |
| 312 | u1_p_idx++; |
| 313 | ps_part++; |
| 314 | } |
| 315 | } |
| 316 | ps_parse_mb_data->u1_num_part = u1_p_idx; |
| 317 | ps_dec->ps_part = ps_part; |
| 318 | } |
| 319 | |
| 320 | { |
| 321 | UWORD32 u4_cbp; |
| 322 | |
| 323 | /* Read the Coded block pattern */ |
| 324 | UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst; |
| 325 | UWORD32 u4_word, u4_ldz; |
| 326 | |
| 327 | /***************************************************************/ |
| 328 | /* Find leading zeros in next 32 bits */ |
| 329 | /***************************************************************/ |
| 330 | NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf); |
| 331 | u4_ldz = CLZ(u4_word); |
| 332 | /* Flush the ps_bitstrm */ |
| 333 | u4_bitstream_offset += (u4_ldz + 1); |
| 334 | /* Read the suffix from the ps_bitstrm */ |
| 335 | u4_word = 0; |
| 336 | if(u4_ldz) |
| 337 | GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, u4_ldz); |
| 338 | *pu4_bitstrm_ofst = u4_bitstream_offset; |
| 339 | u4_cbp = ((1 << u4_ldz) + u4_word - 1); |
| 340 | |
| 341 | if(u4_cbp > 47) |
| 342 | return ERROR_CBP; |
| 343 | |
| 344 | u4_cbp = *((UWORD8*)gau1_ih264d_cbp_inter + u4_cbp); |
| 345 | COPYTHECONTEXT("coded_block_pattern", u4_cbp); |
| 346 | ps_cur_mb_info->u1_cbp = u4_cbp; |
| 347 | |
| 348 | /* Read the transform8x8 u4_flag if present */ |
| 349 | if((ps_dec->s_high_profile.u1_transform8x8_present) && (u4_cbp & 0xf) |
| 350 | && u1_no_submb_part_size_lt8x8_flag) |
| 351 | { |
| 352 | ps_cur_mb_info->u1_tran_form8x8 = ih264d_get_bit_h264(ps_bitstrm); |
| 353 | COPYTHECONTEXT("transform_size_8x8_flag", ps_cur_mb_info->u1_tran_form8x8); |
| 354 | ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = ps_cur_mb_info->u1_tran_form8x8; |
| 355 | } |
| 356 | |
| 357 | /* Read mb_qp_delta */ |
| 358 | if(u4_cbp) |
| 359 | { |
| 360 | WORD32 i_temp; |
| 361 | |
| 362 | UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst; |
| 363 | UWORD32 u4_word, u4_ldz, u4_abs_val; |
| 364 | |
| 365 | /***************************************************************/ |
| 366 | /* Find leading zeros in next 32 bits */ |
| 367 | /***************************************************************/ |
| 368 | NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf); |
| 369 | u4_ldz = CLZ(u4_word); |
| 370 | |
| 371 | /* Flush the ps_bitstrm */ |
| 372 | u4_bitstream_offset += (u4_ldz + 1); |
| 373 | |
| 374 | /* Read the suffix from the ps_bitstrm */ |
| 375 | u4_word = 0; |
| 376 | if(u4_ldz) |
| 377 | GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, |
| 378 | u4_ldz); |
| 379 | |
| 380 | *pu4_bitstrm_ofst = u4_bitstream_offset; |
| 381 | u4_abs_val = ((1 << u4_ldz) + u4_word) >> 1; |
| 382 | |
| 383 | if(u4_word & 0x1) |
| 384 | i_temp = (-(WORD32)u4_abs_val); |
| 385 | else |
| 386 | i_temp = (u4_abs_val); |
| 387 | |
| 388 | if((i_temp < -26) || (i_temp > 25)) |
| 389 | return ERROR_INV_RANGE_QP_T; |
| 390 | //inlinined ih264d_sev |
| 391 | |
| 392 | COPYTHECONTEXT("mb_qp_delta", i_temp); |
| 393 | if(i_temp) |
| 394 | { |
| 395 | ret = ih264d_update_qp(ps_dec, (WORD8)i_temp); |
| 396 | if(ret != OK) |
| 397 | return ret; |
| 398 | } |
| 399 | |
| 400 | ret = ih264d_parse_residual4x4_cavlc(ps_dec, ps_cur_mb_info, 0); |
| 401 | if(ret != OK) |
| 402 | return ret; |
| 403 | if(EXCEED_OFFSET(ps_bitstrm)) |
| 404 | return ERROR_EOB_TERMINATE_T; |
| 405 | } |
| 406 | else |
| 407 | { |
| 408 | ih264d_update_nnz_for_skipmb(ps_dec, ps_cur_mb_info, CAVLC); |
| 409 | } |
| 410 | |
| 411 | |
| 412 | |
| 413 | } |
| 414 | |
| 415 | return OK; |
| 416 | } |
| 417 | |
| 418 | /*! |
| 419 | ************************************************************************** |
| 420 | * \if Function name : ih264d_parse_pmb_cabac \endif |
| 421 | * |
| 422 | * \brief |
| 423 | * This function parses CABAC syntax of a P MB. |
| 424 | * |
| 425 | * \return |
| 426 | * 0 on Success and Error code otherwise |
| 427 | ************************************************************************** |
| 428 | */ |
| 429 | WORD32 ih264d_parse_pmb_cabac(dec_struct_t * ps_dec, |
| 430 | dec_mb_info_t * ps_cur_mb_info, |
| 431 | UWORD8 u1_mb_num, |
| 432 | UWORD8 u1_num_mbsNby2) |
| 433 | { |
| 434 | UWORD32 u1_num_mb_part; |
| 435 | UWORD32 uc_sub_mb; |
| 436 | parse_pmbarams_t * ps_parse_mb_data = ps_dec->ps_parse_mb_data |
| 437 | + u1_num_mbsNby2; |
| 438 | WORD8 * pi1_ref_idx = ps_parse_mb_data->i1_ref_idx[0]; |
| 439 | const UWORD8 * pu1_num_mb_part = (const UWORD8 *)gau1_ih264d_num_mb_part; |
| 440 | const UWORD32 u1_mb_type = ps_cur_mb_info->u1_mb_type; |
| 441 | UWORD8 * pu1_col_info = ps_parse_mb_data->u1_col_info; |
| 442 | UWORD32 u1_mb_mc_mode = u1_mb_type; |
| 443 | ctxt_inc_mb_info_t * p_curr_ctxt = ps_dec->ps_curr_ctxt_mb_info; |
| 444 | decoding_envirnoment_t * ps_cab_env = &ps_dec->s_cab_dec_env; |
| 445 | dec_bit_stream_t * ps_bitstrm = ps_dec->ps_bitstrm; |
| 446 | UWORD32 u4_sub_mb_pack = 0; |
| 447 | WORD32 ret; |
| 448 | |
| 449 | UWORD8 u1_no_submb_part_size_lt8x8_flag = 1; |
| 450 | ps_cur_mb_info->u1_tran_form8x8 = 0; |
| 451 | ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = 0; |
| 452 | |
| 453 | ps_cur_mb_info->u1_yuv_dc_block_flag = 0; |
| 454 | |
| 455 | p_curr_ctxt->u1_mb_type = CAB_P; |
| 456 | ps_cur_mb_info->u1_mb_mc_mode = u1_mb_type; |
| 457 | uc_sub_mb = ((u1_mb_type == PRED_8x8) | (u1_mb_type == PRED_8x8R0)); |
| 458 | |
| 459 | /* Reading the subMB type */ |
| 460 | if(uc_sub_mb) |
| 461 | { |
| 462 | |
| 463 | UWORD8 u1_colz = (PRED_8x8 << 6); |
| 464 | u1_mb_mc_mode = 0; |
| 465 | |
| 466 | { |
| 467 | UWORD8 u1_sub_mb_mode; |
| 468 | u1_sub_mb_mode = ih264d_parse_submb_type_cabac( |
| 469 | 0, ps_cab_env, ps_bitstrm, |
| 470 | ps_dec->p_sub_mb_type_t); |
| 471 | if(u1_sub_mb_mode > 3) |
| 472 | return ERROR_SUB_MB_TYPE; |
| 473 | |
| 474 | u4_sub_mb_pack = (u4_sub_mb_pack << 8) | u1_sub_mb_mode; |
| 475 | /* Storing collocated information */ |
| 476 | *pu1_col_info++ = u1_colz | ((UWORD8)(u1_sub_mb_mode << 4)); |
| 477 | COPYTHECONTEXT("sub_mb_type", u1_sub_mb_mode); |
| 478 | /* check if Motion compensation is done below 8x8 */ |
| 479 | if(u1_sub_mb_mode != P_L0_8x8) |
| 480 | { |
| 481 | u1_no_submb_part_size_lt8x8_flag = 0; |
| 482 | } |
| 483 | } |
| 484 | { |
| 485 | UWORD8 u1_sub_mb_mode; |
| 486 | u1_sub_mb_mode = ih264d_parse_submb_type_cabac( |
| 487 | 0, ps_cab_env, ps_bitstrm, |
| 488 | ps_dec->p_sub_mb_type_t); |
| 489 | if(u1_sub_mb_mode > 3) |
| 490 | return ERROR_SUB_MB_TYPE; |
| 491 | |
| 492 | u4_sub_mb_pack = (u4_sub_mb_pack << 8) | u1_sub_mb_mode; |
| 493 | /* Storing collocated information */ |
| 494 | *pu1_col_info++ = u1_colz | ((UWORD8)(u1_sub_mb_mode << 4)); |
| 495 | COPYTHECONTEXT("sub_mb_type", u1_sub_mb_mode); |
| 496 | /* check if Motion compensation is done below 8x8 */ |
| 497 | if(u1_sub_mb_mode != P_L0_8x8) |
| 498 | { |
| 499 | u1_no_submb_part_size_lt8x8_flag = 0; |
| 500 | } |
| 501 | } |
| 502 | { |
| 503 | UWORD8 u1_sub_mb_mode; |
| 504 | u1_sub_mb_mode = ih264d_parse_submb_type_cabac( |
| 505 | 0, ps_cab_env, ps_bitstrm, |
| 506 | ps_dec->p_sub_mb_type_t); |
| 507 | if(u1_sub_mb_mode > 3) |
| 508 | return ERROR_SUB_MB_TYPE; |
| 509 | |
| 510 | u4_sub_mb_pack = (u4_sub_mb_pack << 8) | u1_sub_mb_mode; |
| 511 | /* Storing collocated information */ |
| 512 | *pu1_col_info++ = u1_colz | ((UWORD8)(u1_sub_mb_mode << 4)); |
| 513 | COPYTHECONTEXT("sub_mb_type", u1_sub_mb_mode); |
| 514 | /* check if Motion compensation is done below 8x8 */ |
| 515 | if(u1_sub_mb_mode != P_L0_8x8) |
| 516 | { |
| 517 | u1_no_submb_part_size_lt8x8_flag = 0; |
| 518 | } |
| 519 | } |
| 520 | { |
| 521 | UWORD8 u1_sub_mb_mode; |
| 522 | u1_sub_mb_mode = ih264d_parse_submb_type_cabac( |
| 523 | 0, ps_cab_env, ps_bitstrm, |
| 524 | ps_dec->p_sub_mb_type_t); |
| 525 | if(u1_sub_mb_mode > 3) |
| 526 | return ERROR_SUB_MB_TYPE; |
| 527 | |
| 528 | u4_sub_mb_pack = (u4_sub_mb_pack << 8) | u1_sub_mb_mode; |
| 529 | /* Storing collocated information */ |
| 530 | *pu1_col_info++ = u1_colz | ((UWORD8)(u1_sub_mb_mode << 4)); |
| 531 | COPYTHECONTEXT("sub_mb_type", u1_sub_mb_mode); |
| 532 | /* check if Motion compensation is done below 8x8 */ |
| 533 | if(u1_sub_mb_mode != P_L0_8x8) |
| 534 | { |
| 535 | u1_no_submb_part_size_lt8x8_flag = 0; |
| 536 | } |
| 537 | } |
| 538 | u1_num_mb_part = 4; |
| 539 | } |
| 540 | else |
| 541 | { |
| 542 | u1_num_mb_part = pu1_num_mb_part[u1_mb_type]; |
| 543 | /* Storing collocated Mb and SubMb mode information */ |
| 544 | *pu1_col_info++ = (u1_mb_type << 6); |
| 545 | if(u1_mb_type) |
| 546 | *pu1_col_info++ = (u1_mb_type << 6); |
| 547 | } |
| 548 | /* Decoding reference index 0: For simple profile the following */ |
| 549 | /* conditions are always true (mb_field_decoding_flag == 0); */ |
| 550 | /* (MbPartPredMode != PredL1) */ |
| 551 | { |
| 552 | WORD8 * pi1_top_ref_idx_ctx_inc_arr = p_curr_ctxt->i1_ref_idx; |
| 553 | WORD8 * pi1_left_ref_idx_ctxt_inc = ps_dec->pi1_left_ref_idx_ctxt_inc; |
| 554 | UWORD8 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag; |
| 555 | UWORD8 uc_field = ps_cur_mb_info->u1_mb_field_decodingflag; |
| 556 | UWORD8 uc_num_ref_idx_l0_active_minus1 = |
| 557 | (ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[0] |
| 558 | << (u1_mbaff & uc_field)) - 1; |
| 559 | |
| 560 | if((uc_num_ref_idx_l0_active_minus1 > 0) & (u1_mb_type != PRED_8x8R0)) |
| 561 | { |
| 562 | /* force the routine to decode ref idx for each partition */ |
| 563 | *((UWORD32 *)pi1_ref_idx) = 0x01010101; |
| 564 | ret = ih264d_parse_ref_idx_cabac(u1_num_mb_part, 0, |
| 565 | uc_num_ref_idx_l0_active_minus1, |
| 566 | u1_mb_mc_mode, pi1_ref_idx, |
| 567 | pi1_left_ref_idx_ctxt_inc, |
| 568 | pi1_top_ref_idx_ctx_inc_arr, ps_cab_env, |
| 569 | ps_bitstrm, ps_dec->p_ref_idx_t); |
| 570 | if(ret != OK) |
| 571 | return ret; |
| 572 | } |
| 573 | else |
| 574 | { |
| 575 | /* When there exists only a single frame to predict from */ |
| 576 | pi1_left_ref_idx_ctxt_inc[0] = 0; |
| 577 | pi1_left_ref_idx_ctxt_inc[1] = 0; |
| 578 | pi1_top_ref_idx_ctx_inc_arr[0] = 0; |
| 579 | pi1_top_ref_idx_ctx_inc_arr[1] = 0; |
| 580 | *((UWORD32 *)pi1_ref_idx) = 0; |
| 581 | } |
| 582 | } |
| 583 | |
| 584 | { |
| 585 | UWORD8 u1_p_idx, uc_i; |
| 586 | parse_part_params_t * ps_part = ps_dec->ps_part; |
| 587 | UWORD8 u1_sub_mb_mode, u1_num_subpart, u1_mb_part_width, u1_mb_part_height; |
| 588 | UWORD8 u1_sub_mb_num; |
| 589 | const UWORD8 * pu1_top_left_sub_mb_indx; |
| 590 | mv_pred_t *ps_mv_start = ps_dec->ps_mv_cur + (u1_mb_num << 4); |
| 591 | UWORD16 u2_sub_mb_num_pack = 0x028A; |
| 592 | |
| 593 | /* Loading the table pointers */ |
| 594 | const UWORD8 * pu1_mb_partw = (const UWORD8 *)gau1_ih264d_mb_partw; |
| 595 | const UWORD8 * pu1_mb_parth = (const UWORD8 *)gau1_ih264d_mb_parth; |
| 596 | const UWORD8 * pu1_sub_mb_indx_mod = |
| 597 | (const UWORD8 *)(gau1_ih264d_submb_indx_mod) |
| 598 | + (uc_sub_mb * 6); |
| 599 | const UWORD8 * pu1_sub_mb_partw = (const UWORD8 *)gau1_ih264d_submb_partw; |
| 600 | const UWORD8 * pu1_sub_mb_parth = (const UWORD8 *)gau1_ih264d_submb_parth; |
| 601 | const UWORD8 * pu1_num_sub_mb_part = |
| 602 | (const UWORD8 *)gau1_ih264d_num_submb_part; |
| 603 | |
| 604 | /*********************************************************/ |
| 605 | /* default initialisations for condition (uc_sub_mb == 0) */ |
| 606 | /* i.e. all are subpartitions of 8x8 */ |
| 607 | /*********************************************************/ |
| 608 | u1_sub_mb_mode = 0; |
| 609 | u1_num_subpart = 1; |
| 610 | u1_mb_part_width = pu1_mb_partw[u1_mb_type]; |
| 611 | u1_mb_part_height = pu1_mb_parth[u1_mb_type]; |
| 612 | pu1_top_left_sub_mb_indx = pu1_sub_mb_indx_mod + (u1_mb_type << 1); |
| 613 | u1_sub_mb_num = 0; |
| 614 | |
| 615 | /* Loop on number of partitions */ |
| 616 | for(uc_i = 0, u1_p_idx = 0; uc_i < u1_num_mb_part; uc_i++) |
| 617 | { |
| 618 | UWORD8 uc_j; |
| 619 | if(uc_sub_mb) |
| 620 | { |
| 621 | u1_sub_mb_mode = u4_sub_mb_pack >> 24; |
| 622 | u1_num_subpart = pu1_num_sub_mb_part[u1_sub_mb_mode]; |
| 623 | u1_mb_part_width = pu1_sub_mb_partw[u1_sub_mb_mode]; |
| 624 | u1_mb_part_height = pu1_sub_mb_parth[u1_sub_mb_mode]; |
| 625 | pu1_top_left_sub_mb_indx = pu1_sub_mb_indx_mod + (u1_sub_mb_mode << 1); |
| 626 | u1_sub_mb_num = u2_sub_mb_num_pack >> 12; |
| 627 | u4_sub_mb_pack <<= 8; |
| 628 | u2_sub_mb_num_pack <<= 4; |
| 629 | } |
| 630 | /* Loop on Number of sub-partitions */ |
| 631 | for(uc_j = 0; uc_j < u1_num_subpart; uc_j++, pu1_top_left_sub_mb_indx++) |
| 632 | { |
| 633 | mv_pred_t * ps_mv; |
| 634 | |
| 635 | u1_sub_mb_num += *pu1_top_left_sub_mb_indx; |
| 636 | ps_mv = ps_mv_start + u1_sub_mb_num; |
| 637 | |
| 638 | /* Storing Info for partitions */ |
| 639 | ps_part->u1_is_direct = PART_NOT_DIRECT; |
| 640 | ps_part->u1_sub_mb_num = u1_sub_mb_num; |
| 641 | ps_part->u1_partheight = u1_mb_part_height; |
| 642 | ps_part->u1_partwidth = u1_mb_part_width; |
| 643 | |
| 644 | /* Increment partition Index */ |
| 645 | u1_p_idx++; |
| 646 | ps_part++; |
| 647 | |
| 648 | ih264d_get_mvd_cabac(u1_sub_mb_num, 0, u1_mb_part_width, |
| 649 | u1_mb_part_height, 1, ps_dec, ps_mv); |
| 650 | } |
| 651 | } |
| 652 | ps_parse_mb_data->u1_num_part = u1_p_idx; |
| 653 | ps_dec->ps_part = ps_part; |
| 654 | } |
| 655 | { |
| 656 | UWORD8 u1_cbp; |
| 657 | |
| 658 | /* Read the Coded block pattern */ |
| 659 | u1_cbp = (WORD8)ih264d_parse_ctx_cbp_cabac(ps_dec); |
| 660 | COPYTHECONTEXT("coded_block_pattern", u1_cbp); |
| 661 | ps_cur_mb_info->u1_cbp = u1_cbp; |
| 662 | p_curr_ctxt->u1_cbp = u1_cbp; |
| 663 | p_curr_ctxt->u1_intra_chroma_pred_mode = 0; |
| 664 | p_curr_ctxt->u1_yuv_dc_csbp &= 0xFE; |
| 665 | ps_dec->pu1_left_yuv_dc_csbp[0] &= 0x6; |
| 666 | |
| 667 | if(u1_cbp > 47) |
| 668 | return ERROR_CBP; |
| 669 | |
| 670 | ps_cur_mb_info->u1_tran_form8x8 = 0; |
| 671 | ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = 0; |
| 672 | |
| 673 | /* Read the transform8x8 u4_flag if present */ |
| 674 | if((ps_dec->s_high_profile.u1_transform8x8_present) && (u1_cbp & 0xf) |
| 675 | && u1_no_submb_part_size_lt8x8_flag) |
| 676 | { |
| 677 | ps_cur_mb_info->u1_tran_form8x8 = ih264d_parse_transform8x8flag_cabac( |
| 678 | ps_dec, ps_cur_mb_info); |
| 679 | COPYTHECONTEXT("transform_size_8x8_flag", ps_cur_mb_info->u1_tran_form8x8); |
| 680 | p_curr_ctxt->u1_transform8x8_ctxt = ps_cur_mb_info->u1_tran_form8x8; |
| 681 | ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = ps_cur_mb_info->u1_tran_form8x8; |
| 682 | |
| 683 | } |
| 684 | else |
| 685 | { |
| 686 | p_curr_ctxt->u1_transform8x8_ctxt = 0; |
| 687 | } |
| 688 | |
| 689 | /* Read mb_qp_delta */ |
| 690 | if(u1_cbp) |
| 691 | { |
| 692 | WORD8 c_temp; |
| 693 | ret = ih264d_parse_mb_qp_delta_cabac(ps_dec, &c_temp); |
| 694 | if(ret != OK) |
| 695 | return ret; |
| 696 | COPYTHECONTEXT("mb_qp_delta", c_temp); |
| 697 | if(c_temp != 0) |
| 698 | { |
| 699 | ret = ih264d_update_qp(ps_dec, c_temp); |
| 700 | if(ret != OK) |
| 701 | return ret; |
| 702 | } |
| 703 | } |
| 704 | else |
| 705 | ps_dec->i1_prev_mb_qp_delta = 0; |
| 706 | |
| 707 | |
| 708 | |
| 709 | ih264d_parse_residual4x4_cabac(ps_dec, ps_cur_mb_info, 0); |
| 710 | if(EXCEED_OFFSET(ps_dec->ps_bitstrm)) |
| 711 | return ERROR_EOB_TERMINATE_T; |
| 712 | } |
| 713 | return OK; |
| 714 | } |
| 715 | |
| 716 | /*! |
| 717 | ************************************************************************** |
| 718 | * \if Function name : parsePSliceData \endif |
| 719 | * |
| 720 | * \brief |
| 721 | * This function parses CAVLC syntax of N MB's of a P slice. |
| 722 | * 1. After parsing syntax of N MB's, for those N MB's (less than N, incase |
| 723 | * of end of slice or end of row), MB is decoded. This process is carried |
| 724 | * for one complete MB row or till end of slice. |
| 725 | * 2. Bottom one row of current MB is copied to IntraPredLine buffers. |
| 726 | * IntraPredLine buffers are used for Intra prediction of next row. |
| 727 | * 3. Current MB row along with previous 4 rows of Luma (and 2 of Chroma) are |
| 728 | * deblocked. |
| 729 | * 4. 4 rows (2 for Chroma) previous row and 12 rows (6 for Chroma) are |
| 730 | * DMA'ed to picture buffers. |
| 731 | * |
| 732 | * \return |
| 733 | * 0 on Success and Error code otherwise |
| 734 | ************************************************************************** |
| 735 | */ |
| 736 | |
| 737 | /*! |
| 738 | ************************************************************************** |
| 739 | * \if Function name : ih264d_update_nnz_for_skipmb \endif |
| 740 | * |
| 741 | * \brief |
| 742 | * |
| 743 | * \return |
| 744 | * None |
| 745 | * |
| 746 | ************************************************************************** |
| 747 | */ |
| 748 | void ih264d_update_nnz_for_skipmb(dec_struct_t * ps_dec, |
| 749 | dec_mb_info_t * ps_cur_mb_info, |
| 750 | UWORD8 u1_entrpy) |
| 751 | { |
| 752 | UWORD32 *pu4_buf; |
| 753 | UWORD8 *pu1_buf; |
| 754 | UNUSED(u1_entrpy); |
| 755 | pu1_buf = ps_dec->pu1_left_nnz_y; |
| 756 | pu4_buf = (UWORD32 *)pu1_buf; |
| 757 | *pu4_buf = 0; |
| 758 | pu1_buf = ps_dec->pu1_left_nnz_uv; |
| 759 | pu4_buf = (UWORD32 *)pu1_buf; |
| 760 | *pu4_buf = 0; |
| 761 | pu1_buf = ps_cur_mb_info->ps_curmb->pu1_nnz_y; |
| 762 | pu4_buf = (UWORD32 *)pu1_buf; |
| 763 | *pu4_buf = 0; |
| 764 | pu1_buf = ps_cur_mb_info->ps_curmb->pu1_nnz_uv; |
| 765 | pu4_buf = (UWORD32 *)pu1_buf; |
| 766 | *pu4_buf = 0; |
| 767 | ps_cur_mb_info->ps_curmb->u2_luma_csbp = 0; |
| 768 | ps_cur_mb_info->u2_luma_csbp = 0; |
| 769 | ps_cur_mb_info->u2_chroma_csbp = 0; |
| 770 | } |
| 771 | |
| 772 | |
| 773 | |
| 774 | /*****************************************************************************/ |
| 775 | /* */ |
| 776 | /* Function Name : ih264d_parse_inter_slice_data_cabac */ |
| 777 | /* */ |
| 778 | /* Description : This function parses cabac syntax of a inter slice on */ |
| 779 | /* N MB basis. */ |
| 780 | /* */ |
| 781 | /* Inputs : ps_dec */ |
| 782 | /* sliceparams */ |
| 783 | /* firstMbInSlice */ |
| 784 | /* */ |
| 785 | /* Processing : 1. After parsing syntax for N MBs those N MBs are */ |
| 786 | /* decoded till the end of slice. */ |
| 787 | /* 2. MV prediction and DMA happens on a N/2 MB basis. */ |
| 788 | /* */ |
| 789 | /* Returns : 0 */ |
| 790 | /* */ |
| 791 | /* Issues : <List any issues or problems with this function> */ |
| 792 | /* */ |
| 793 | /* Revision History: */ |
| 794 | /* */ |
| 795 | /* DD MM YYYY Author(s) Changes (Describe the changes made) */ |
| 796 | /* 13 07 2002 Jay Draft */ |
| 797 | /* */ |
| 798 | /*****************************************************************************/ |
| 799 | WORD32 ih264d_parse_inter_slice_data_cabac(dec_struct_t * ps_dec, |
| 800 | dec_slice_params_t * ps_slice, |
| 801 | UWORD16 u2_first_mb_in_slice) |
| 802 | { |
| 803 | UWORD32 uc_more_data_flag; |
| 804 | WORD32 i2_cur_mb_addr; |
| 805 | UWORD32 u1_num_mbs, u1_num_mbsNby2, u1_mb_idx; |
| 806 | UWORD32 u1_mbaff; |
| 807 | UWORD32 u1_num_mbs_next, u1_end_of_row; |
| 808 | const UWORD16 i2_pic_wdin_mbs = ps_dec->u2_frm_wd_in_mbs; |
| 809 | UWORD32 u1_slice_end = 0; |
| 810 | UWORD32 u1_tfr_n_mb = 0; |
| 811 | UWORD32 u1_decode_nmb = 0; |
| 812 | |
| 813 | |
| 814 | deblk_mb_t *ps_cur_deblk_mb; |
| 815 | dec_mb_info_t *ps_cur_mb_info; |
| 816 | |
| 817 | parse_pmbarams_t *ps_parse_mb_data = ps_dec->ps_parse_mb_data; |
| 818 | UWORD32 u1_inter_mb_skip_type; |
| 819 | UWORD32 u1_inter_mb_type; |
| 820 | UWORD32 u1_deblk_mb_type; |
| 821 | UWORD32 u1_mb_threshold; |
| 822 | dec_bit_stream_t * const ps_bitstrm = ps_dec->ps_bitstrm; |
| 823 | WORD32 ret; |
| 824 | |
| 825 | /******************************************************/ |
| 826 | /* Initialisations specific to B or P slice */ |
| 827 | /******************************************************/ |
| 828 | if(ps_slice->u1_slice_type == P_SLICE) |
| 829 | { |
| 830 | u1_inter_mb_skip_type = CAB_P_SKIP; |
| 831 | u1_inter_mb_type = P_MB; |
| 832 | u1_deblk_mb_type = D_INTER_MB; |
| 833 | u1_mb_threshold = 5; |
| 834 | } |
| 835 | else // B_SLICE |
| 836 | { |
| 837 | u1_inter_mb_skip_type = CAB_B_SKIP; |
| 838 | u1_inter_mb_type = B_MB; |
| 839 | u1_deblk_mb_type = D_B_SLICE; |
| 840 | u1_mb_threshold = 23; |
| 841 | } |
| 842 | |
| 843 | /******************************************************/ |
| 844 | /* Slice Level Initialisations */ |
| 845 | /******************************************************/ |
| 846 | i2_cur_mb_addr = u2_first_mb_in_slice; |
| 847 | ps_dec->u1_qp = ps_slice->u1_slice_qp; |
| 848 | ret = ih264d_update_qp(ps_dec, 0); |
| 849 | if(ret != OK) |
| 850 | return ret; |
| 851 | u1_mb_idx = ps_dec->u1_mb_idx; |
| 852 | u1_num_mbs = u1_mb_idx; |
| 853 | u1_num_mbsNby2 = 0; |
| 854 | u1_mbaff = ps_slice->u1_mbaff_frame_flag; |
| 855 | i2_cur_mb_addr = u2_first_mb_in_slice << u1_mbaff; |
| 856 | uc_more_data_flag = 1; |
| 857 | |
| 858 | /* Initialisations specific to cabac */ |
| 859 | if(ps_bitstrm->u4_ofst & 0x07) |
| 860 | { |
| 861 | ps_bitstrm->u4_ofst += 8; |
| 862 | ps_bitstrm->u4_ofst &= 0xFFFFFFF8; |
| 863 | } |
| 864 | |
| 865 | ret = ih264d_init_cabac_dec_envirnoment(&(ps_dec->s_cab_dec_env), ps_bitstrm); |
| 866 | if(ret != OK) |
| 867 | return ret; |
| 868 | |
| 869 | ps_dec->i1_prev_mb_qp_delta = 0; |
| 870 | |
| 871 | while(!u1_slice_end) |
| 872 | { |
| 873 | UWORD8 u1_mb_type; |
| 874 | UWORD32 u4_mb_skip; |
| 875 | |
| 876 | |
| 877 | ps_cur_mb_info = ps_dec->ps_nmb_info + u1_num_mbs; |
| 878 | |
| 879 | ps_cur_mb_info->u1_Mux = 0; |
| 880 | ps_dec->u4_num_pmbair = (u1_num_mbs >> u1_mbaff); |
| 881 | ps_cur_deblk_mb = ps_dec->ps_deblk_mbn + u1_num_mbs; |
| 882 | |
| 883 | ps_cur_mb_info->u1_end_of_slice = 0; |
| 884 | |
| 885 | /* Storing Default partition info */ |
| 886 | ps_parse_mb_data->u1_num_part = 1; |
| 887 | ps_parse_mb_data->u1_isI_mb = 0; |
| 888 | |
| 889 | /***************************************************************/ |
| 890 | /* Get the required information for decoding of MB */ |
| 891 | /* mb_x, mb_y , neighbour availablity, */ |
| 892 | /***************************************************************/ |
| 893 | u4_mb_skip = ps_dec->pf_get_mb_info(ps_dec, i2_cur_mb_addr, ps_cur_mb_info, 1); |
| 894 | |
| 895 | /*********************************************************************/ |
| 896 | /* initialize u1_tran_form8x8 to zero to aviod uninitialized accesses */ |
| 897 | /*********************************************************************/ |
| 898 | ps_cur_mb_info->u1_tran_form8x8 = 0; |
| 899 | ps_cur_mb_info->ps_curmb->u1_tran_form8x8 = 0; |
| 900 | |
| 901 | /***************************************************************/ |
| 902 | /* Set the deblocking parameters for this MB */ |
| 903 | /***************************************************************/ |
| 904 | if(ps_dec->u4_app_disable_deblk_frm == 0) |
| 905 | ih264d_set_deblocking_parameters(ps_cur_deblk_mb, ps_slice, |
| 906 | ps_dec->u1_mb_ngbr_availablity, |
| 907 | ps_dec->u1_cur_mb_fld_dec_flag); |
| 908 | |
| 909 | if(u4_mb_skip) |
| 910 | { |
| 911 | |
| 912 | /* Set appropriate flags in ps_cur_mb_info and ps_dec */ |
| 913 | memset(ps_dec->ps_curr_ctxt_mb_info, 0, sizeof(ctxt_inc_mb_info_t)); |
| 914 | ps_dec->ps_curr_ctxt_mb_info->u1_mb_type = u1_inter_mb_skip_type; |
| 915 | |
| 916 | MEMSET_16BYTES(&ps_dec->pu1_left_mv_ctxt_inc[0][0], 0); |
| 917 | |
| 918 | *((UWORD32 *)ps_dec->pi1_left_ref_idx_ctxt_inc) = 0; |
| 919 | *(ps_dec->pu1_left_yuv_dc_csbp) = 0; |
| 920 | |
| 921 | ps_dec->i1_prev_mb_qp_delta = 0; |
| 922 | ps_cur_mb_info->u1_mb_type = MB_SKIP; |
| 923 | ps_cur_mb_info->u1_cbp = 0; |
| 924 | |
| 925 | { |
| 926 | /* Storing Skip partition info */ |
| 927 | parse_part_params_t *ps_part_info = ps_dec->ps_part; |
| 928 | ps_part_info->u1_is_direct = PART_DIRECT_16x16; |
| 929 | ps_part_info->u1_sub_mb_num = 0; |
| 930 | ps_dec->ps_part++; |
| 931 | } |
| 932 | |
| 933 | /* Update Nnzs */ |
| 934 | ih264d_update_nnz_for_skipmb(ps_dec, ps_cur_mb_info, CABAC); |
| 935 | |
| 936 | ps_cur_mb_info->ps_curmb->u1_mb_type = u1_inter_mb_type; |
| 937 | ps_cur_deblk_mb->u1_mb_type |= u1_deblk_mb_type; |
| 938 | ps_cur_deblk_mb->u1_mb_qp = ps_dec->u1_qp; |
| 939 | |
| 940 | } |
| 941 | else |
| 942 | { |
| 943 | |
| 944 | /* Macroblock Layer Begins */ |
| 945 | /* Decode the u1_mb_type */ |
| 946 | u1_mb_type = ih264d_parse_mb_type_cabac(ps_dec); |
| 947 | ps_cur_mb_info->u1_mb_type = u1_mb_type; |
| 948 | if(u1_mb_type > (25 + u1_mb_threshold)) |
| 949 | return ERROR_MB_TYPE; |
| 950 | |
| 951 | /* Parse Macroblock Data */ |
| 952 | if(u1_mb_type < u1_mb_threshold) |
| 953 | { |
| 954 | ps_cur_mb_info->ps_curmb->u1_mb_type = u1_inter_mb_type; |
| 955 | *(ps_dec->pu1_left_yuv_dc_csbp) &= 0x6; |
| 956 | |
| 957 | ret = ps_dec->pf_parse_inter_mb(ps_dec, ps_cur_mb_info, u1_num_mbs, |
| 958 | u1_num_mbsNby2); |
| 959 | if(ret != OK) |
| 960 | return ret; |
| 961 | ps_cur_deblk_mb->u1_mb_qp = ps_dec->u1_qp; |
| 962 | ps_cur_deblk_mb->u1_mb_type |= u1_deblk_mb_type; |
| 963 | } |
| 964 | else |
| 965 | { |
| 966 | /* Storing Intra partition info */ |
| 967 | ps_parse_mb_data->u1_num_part = 0; |
| 968 | ps_parse_mb_data->u1_isI_mb = 1; |
| 969 | |
| 970 | if((25 + u1_mb_threshold) == u1_mb_type) |
| 971 | { |
| 972 | /* I_PCM_MB */ |
| 973 | ps_cur_mb_info->ps_curmb->u1_mb_type = I_PCM_MB; |
| 974 | ret = ih264d_parse_ipcm_mb(ps_dec, ps_cur_mb_info, u1_num_mbs); |
| 975 | if(ret != OK) |
| 976 | return ret; |
| 977 | ps_cur_deblk_mb->u1_mb_qp = 0; |
| 978 | } |
| 979 | else |
| 980 | { |
| 981 | if(u1_mb_type == u1_mb_threshold) |
| 982 | ps_cur_mb_info->ps_curmb->u1_mb_type = I_4x4_MB; |
| 983 | else |
| 984 | ps_cur_mb_info->ps_curmb->u1_mb_type = I_16x16_MB; |
| 985 | |
| 986 | ret = ih264d_parse_imb_cabac( |
| 987 | ps_dec, ps_cur_mb_info, |
| 988 | (UWORD8)(u1_mb_type - u1_mb_threshold)); |
| 989 | if(ret != OK) |
| 990 | return ret; |
| 991 | ps_cur_deblk_mb->u1_mb_qp = ps_dec->u1_qp; |
| 992 | } |
| 993 | ps_cur_deblk_mb->u1_mb_type |= D_INTRA_MB; |
| 994 | |
| 995 | } |
| 996 | |
| 997 | } |
| 998 | |
| 999 | if(u1_mbaff) |
| 1000 | { |
| 1001 | ih264d_update_mbaff_left_nnz(ps_dec, ps_cur_mb_info); |
| 1002 | } |
| 1003 | /* Next macroblock information */ |
| 1004 | if(i2_cur_mb_addr > ps_dec->ps_cur_sps->u2_max_mb_addr) |
| 1005 | return ERROR_MB_ADDRESS_T; |
| 1006 | i2_cur_mb_addr++; |
| 1007 | |
| 1008 | if(ps_cur_mb_info->u1_topmb && u1_mbaff) |
| 1009 | uc_more_data_flag = 1; |
| 1010 | else |
| 1011 | { |
| 1012 | uc_more_data_flag = ih264d_decode_terminate(&ps_dec->s_cab_dec_env, |
| 1013 | ps_bitstrm); |
| 1014 | uc_more_data_flag = !uc_more_data_flag; |
| 1015 | COPYTHECONTEXT("Decode Sliceterm",!uc_more_data_flag); |
| 1016 | } |
| 1017 | |
| 1018 | u1_num_mbs++; |
| 1019 | ps_dec->u2_total_mbs_coded++; |
| 1020 | u1_num_mbsNby2++; |
| 1021 | ps_parse_mb_data++; |
| 1022 | |
| 1023 | /****************************************************************/ |
| 1024 | /* Check for End Of Row and other flags that determine when to */ |
| 1025 | /* do DMA setup for N/2-Mb, Decode for N-Mb, and Transfer for */ |
| 1026 | /* N-Mb */ |
| 1027 | /****************************************************************/ |
| 1028 | u1_num_mbs_next = i2_pic_wdin_mbs - ps_dec->u2_mbx - 1; |
| 1029 | u1_end_of_row = (!u1_num_mbs_next) && (!(u1_mbaff && (u1_num_mbs & 0x01))); |
| 1030 | u1_slice_end = !uc_more_data_flag; |
| 1031 | u1_tfr_n_mb = (u1_num_mbs == ps_dec->u1_recon_mb_grp) || u1_end_of_row |
| 1032 | || u1_slice_end; |
| 1033 | u1_decode_nmb = u1_tfr_n_mb || u1_slice_end; |
| 1034 | ps_cur_mb_info->u1_end_of_slice = u1_slice_end; |
| 1035 | /*u1_dma_nby2mb = u1_decode_nmb || |
| 1036 | (u1_num_mbsNby2 == ps_dec->u1_recon_mb_grp_pair);*/ |
| 1037 | |
| 1038 | //if(u1_dma_nby2mb) |
| 1039 | if(u1_decode_nmb) |
| 1040 | { |
| 1041 | |
| 1042 | ret = ps_dec->pf_mvpred_ref_tfr_nby2mb(ps_dec, u1_mb_idx, u1_num_mbs); |
| 1043 | if(ret != OK) |
| 1044 | return ret; |
| 1045 | u1_num_mbsNby2 = 0; |
| 1046 | |
| 1047 | { |
| 1048 | ps_parse_mb_data = ps_dec->ps_parse_mb_data; |
| 1049 | ps_dec->ps_part = ps_dec->ps_parse_part_params; |
| 1050 | } |
| 1051 | } |
| 1052 | |
| 1053 | /*H264_DEC_DEBUG_PRINT("Pic: %d Mb_X=%d Mb_Y=%d", |
| 1054 | ps_slice->i4_poc >> ps_slice->u1_field_pic_flag, |
| 1055 | ps_dec->u2_mbx,ps_dec->u2_mby + (1 - ps_cur_mb_info->u1_topmb)); |
| 1056 | H264_DEC_DEBUG_PRINT("u1_decode_nmb: %d, u1_num_mbs: %d", u1_decode_nmb, u1_num_mbs);*/ |
| 1057 | if(u1_decode_nmb) |
| 1058 | { |
| 1059 | |
| 1060 | if(ps_dec->u1_separate_parse) |
| 1061 | { |
| 1062 | ih264d_parse_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs, |
| 1063 | u1_num_mbs_next, u1_tfr_n_mb, u1_end_of_row); |
| 1064 | ps_dec->ps_nmb_info += u1_num_mbs; |
| 1065 | } |
| 1066 | else |
| 1067 | { |
| 1068 | ret = ih264d_decode_recon_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs, |
| 1069 | u1_num_mbs_next, u1_tfr_n_mb, |
| 1070 | u1_end_of_row); |
| 1071 | if(ret != OK) |
| 1072 | return ret; |
| 1073 | } |
| 1074 | |
| 1075 | if(u1_tfr_n_mb) |
| 1076 | u1_num_mbs = 0; |
| 1077 | u1_mb_idx = u1_num_mbs; |
| 1078 | ps_dec->u1_mb_idx = u1_num_mbs; |
| 1079 | |
| 1080 | } |
| 1081 | } |
| 1082 | |
| 1083 | if(ps_dec->u1_separate_parse) |
| 1084 | { |
| 1085 | ps_dec->ps_parse_cur_slice->end_of_slice = 1; |
| 1086 | ps_dec->ps_cur_slice->u4_mbs_in_slice = i2_cur_mb_addr |
| 1087 | - (u2_first_mb_in_slice << u1_mbaff); |
| 1088 | } |
| 1089 | return OK; |
| 1090 | } |
| 1091 | |
| 1092 | /*****************************************************************************/ |
| 1093 | /* */ |
| 1094 | /* Function Name : ih264d_parse_inter_slice_data_cavlc */ |
| 1095 | /* */ |
| 1096 | /* Description : This function parses cavlc syntax of a inter slice on */ |
| 1097 | /* N MB basis. */ |
| 1098 | /* */ |
| 1099 | /* Inputs : ps_dec */ |
| 1100 | /* sliceparams */ |
| 1101 | /* firstMbInSlice */ |
| 1102 | /* */ |
| 1103 | /* Processing : 1. After parsing syntax for N MBs those N MBs are */ |
| 1104 | /* decoded till the end of slice. */ |
| 1105 | /* 2. MV prediction and DMA happens on a N/2 MB basis. */ |
| 1106 | /* */ |
| 1107 | /* Returns : 0 */ |
| 1108 | /* */ |
| 1109 | /* Issues : <List any issues or problems with this function> */ |
| 1110 | /* */ |
| 1111 | /* Revision History: */ |
| 1112 | /* */ |
| 1113 | /* DD MM YYYY Author(s) Changes (Describe the changes made) */ |
| 1114 | /* 13 07 2002 Jay Draft */ |
| 1115 | /* */ |
| 1116 | /*****************************************************************************/ |
| 1117 | |
| 1118 | WORD32 ih264d_parse_inter_slice_data_cavlc(dec_struct_t * ps_dec, |
| 1119 | dec_slice_params_t * ps_slice, |
| 1120 | UWORD16 u2_first_mb_in_slice) |
| 1121 | { |
| 1122 | UWORD32 uc_more_data_flag; |
| 1123 | WORD32 i2_cur_mb_addr; |
| 1124 | UWORD32 u1_num_mbs, u1_num_mbsNby2, u1_mb_idx; |
| 1125 | UWORD32 i2_mb_skip_run; |
| 1126 | UWORD32 u1_read_mb_type; |
| 1127 | |
| 1128 | UWORD32 u1_mbaff; |
| 1129 | UWORD32 u1_num_mbs_next, u1_end_of_row; |
| 1130 | const UWORD32 i2_pic_wdin_mbs = ps_dec->u2_frm_wd_in_mbs; |
| 1131 | UWORD32 u1_slice_end = 0; |
| 1132 | UWORD32 u1_tfr_n_mb = 0; |
| 1133 | UWORD32 u1_decode_nmb = 0; |
| 1134 | |
| 1135 | dec_bit_stream_t * const ps_bitstrm = ps_dec->ps_bitstrm; |
| 1136 | UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer; |
| 1137 | UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst; |
| 1138 | deblk_mb_t *ps_cur_deblk_mb; |
| 1139 | dec_mb_info_t *ps_cur_mb_info; |
| 1140 | parse_pmbarams_t *ps_parse_mb_data = ps_dec->ps_parse_mb_data; |
| 1141 | UWORD32 u1_inter_mb_type; |
| 1142 | UWORD32 u1_deblk_mb_type; |
| 1143 | UWORD32 u1_mb_threshold; |
| 1144 | WORD32 ret; |
| 1145 | |
| 1146 | /******************************************************/ |
| 1147 | /* Initialisations specific to B or P slice */ |
| 1148 | /******************************************************/ |
| 1149 | |
| 1150 | if(ps_slice->u1_slice_type == P_SLICE) |
| 1151 | { |
| 1152 | u1_inter_mb_type = P_MB; |
| 1153 | u1_deblk_mb_type = D_INTER_MB; |
| 1154 | u1_mb_threshold = 5; |
| 1155 | } |
| 1156 | else // B_SLICE |
| 1157 | { |
| 1158 | u1_inter_mb_type = B_MB; |
| 1159 | u1_deblk_mb_type = D_B_SLICE; |
| 1160 | u1_mb_threshold = 23; |
| 1161 | } |
| 1162 | /******************************************************/ |
| 1163 | /* Slice Level Initialisations */ |
| 1164 | /******************************************************/ |
| 1165 | i2_cur_mb_addr = u2_first_mb_in_slice; |
| 1166 | ps_dec->u1_qp = ps_slice->u1_slice_qp; |
| 1167 | ret = ih264d_update_qp(ps_dec, 0); |
| 1168 | if(ret != OK) |
| 1169 | return ret; |
| 1170 | u1_mb_idx = ps_dec->u1_mb_idx; |
| 1171 | u1_num_mbs = u1_mb_idx; |
| 1172 | |
| 1173 | u1_num_mbsNby2 = 0; |
| 1174 | u1_mbaff = ps_slice->u1_mbaff_frame_flag; |
| 1175 | i2_cur_mb_addr = u2_first_mb_in_slice << u1_mbaff; |
| 1176 | i2_mb_skip_run = 0; |
| 1177 | uc_more_data_flag = 1; |
| 1178 | u1_read_mb_type = 0; |
| 1179 | |
| 1180 | while(!u1_slice_end) |
| 1181 | { |
| 1182 | UWORD8 u1_mb_type; |
| 1183 | |
| 1184 | if(i2_cur_mb_addr > ps_dec->ps_cur_sps->u2_max_mb_addr) |
| 1185 | { |
| 1186 | |
| 1187 | break; |
| 1188 | } |
| 1189 | |
| 1190 | |
| 1191 | ps_cur_mb_info = ps_dec->ps_nmb_info + u1_num_mbs; |
| 1192 | |
| 1193 | ps_cur_mb_info->u1_Mux = 0; |
| 1194 | ps_dec->u4_num_pmbair = (u1_num_mbs >> u1_mbaff); |
| 1195 | ps_cur_deblk_mb = ps_dec->ps_deblk_mbn + u1_num_mbs; |
| 1196 | |
| 1197 | ps_cur_mb_info->u1_end_of_slice = 0; |
| 1198 | |
| 1199 | /* Storing Default partition info */ |
| 1200 | ps_parse_mb_data->u1_num_part = 1; |
| 1201 | ps_parse_mb_data->u1_isI_mb = 0; |
| 1202 | |
| 1203 | if((!i2_mb_skip_run) && (!u1_read_mb_type)) |
| 1204 | { |
| 1205 | |
| 1206 | //Inlined ih264d_uev |
| 1207 | UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst; |
| 1208 | UWORD32 u4_word, u4_ldz; |
| 1209 | |
| 1210 | /***************************************************************/ |
| 1211 | /* Find leading zeros in next 32 bits */ |
| 1212 | /***************************************************************/ |
| 1213 | NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf); |
| 1214 | |
| 1215 | u4_ldz = CLZ(u4_word); |
| 1216 | |
| 1217 | /* Flush the ps_bitstrm */ |
| 1218 | u4_bitstream_offset += (u4_ldz + 1); |
| 1219 | /* Read the suffix from the ps_bitstrm */ |
| 1220 | u4_word = 0; |
| 1221 | if(u4_ldz) |
| 1222 | { |
| 1223 | GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, |
| 1224 | u4_ldz); |
| 1225 | } |
| 1226 | *pu4_bitstrm_ofst = u4_bitstream_offset; |
| 1227 | i2_mb_skip_run = ((1 << u4_ldz) + u4_word - 1); |
| 1228 | //Inlined ih264d_uev |
| 1229 | COPYTHECONTEXT("mb_skip_run", i2_mb_skip_run); |
| 1230 | uc_more_data_flag = MORE_RBSP_DATA(ps_bitstrm); |
| 1231 | u1_read_mb_type = uc_more_data_flag; |
| 1232 | } |
| 1233 | |
| 1234 | /***************************************************************/ |
| 1235 | /* Get the required information for decoding of MB */ |
| 1236 | /* mb_x, mb_y , neighbour availablity, */ |
| 1237 | /***************************************************************/ |
| 1238 | ps_dec->pf_get_mb_info(ps_dec, i2_cur_mb_addr, ps_cur_mb_info, i2_mb_skip_run); |
| 1239 | |
| 1240 | /***************************************************************/ |
| 1241 | /* Set the deblocking parameters for this MB */ |
| 1242 | /***************************************************************/ |
| 1243 | if(ps_dec->u4_app_disable_deblk_frm == 0) |
| 1244 | ih264d_set_deblocking_parameters(ps_cur_deblk_mb, ps_slice, |
| 1245 | ps_dec->u1_mb_ngbr_availablity, |
| 1246 | ps_dec->u1_cur_mb_fld_dec_flag); |
| 1247 | |
| 1248 | if(i2_mb_skip_run) |
| 1249 | { |
| 1250 | /* Set appropriate flags in ps_cur_mb_info and ps_dec */ |
| 1251 | ps_dec->i1_prev_mb_qp_delta = 0; |
| 1252 | ps_dec->u1_sub_mb_num = 0; |
| 1253 | ps_cur_mb_info->u1_mb_type = MB_SKIP; |
| 1254 | ps_cur_mb_info->u1_mb_mc_mode = PRED_16x16; |
| 1255 | ps_cur_mb_info->u1_cbp = 0; |
| 1256 | |
| 1257 | { |
| 1258 | /* Storing Skip partition info */ |
| 1259 | parse_part_params_t *ps_part_info = ps_dec->ps_part; |
| 1260 | ps_part_info->u1_is_direct = PART_DIRECT_16x16; |
| 1261 | ps_part_info->u1_sub_mb_num = 0; |
| 1262 | ps_dec->ps_part++; |
| 1263 | } |
| 1264 | |
| 1265 | /* Update Nnzs */ |
| 1266 | ih264d_update_nnz_for_skipmb(ps_dec, ps_cur_mb_info, CAVLC); |
| 1267 | |
| 1268 | ps_cur_mb_info->ps_curmb->u1_mb_type = u1_inter_mb_type; |
| 1269 | ps_cur_deblk_mb->u1_mb_type |= u1_deblk_mb_type; |
| 1270 | |
| 1271 | i2_mb_skip_run--; |
| 1272 | } |
| 1273 | else |
| 1274 | { |
| 1275 | u1_read_mb_type = 0; |
| 1276 | /**************************************************************/ |
| 1277 | /* Macroblock Layer Begins, Decode the u1_mb_type */ |
| 1278 | /**************************************************************/ |
| 1279 | { |
| 1280 | UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst; |
| 1281 | UWORD32 u4_word, u4_ldz, u4_temp; |
| 1282 | |
| 1283 | |
| 1284 | //Inlined ih264d_uev |
| 1285 | /***************************************************************/ |
| 1286 | /* Find leading zeros in next 32 bits */ |
| 1287 | /***************************************************************/ |
| 1288 | NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf); |
| 1289 | u4_ldz = CLZ(u4_word); |
| 1290 | /* Flush the ps_bitstrm */ |
| 1291 | u4_bitstream_offset += (u4_ldz + 1); |
| 1292 | /* Read the suffix from the ps_bitstrm */ |
| 1293 | u4_word = 0; |
| 1294 | if(u4_ldz) |
| 1295 | GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, |
| 1296 | u4_ldz); |
| 1297 | *pu4_bitstrm_ofst = u4_bitstream_offset; |
| 1298 | u4_temp = ((1 << u4_ldz) + u4_word - 1); |
| 1299 | //Inlined ih264d_uev |
| 1300 | if(u4_temp > (UWORD32)(25 + u1_mb_threshold)) |
| 1301 | return ERROR_MB_TYPE; |
| 1302 | u1_mb_type = u4_temp; |
| 1303 | COPYTHECONTEXT("u1_mb_type", u1_mb_type); |
| 1304 | } |
| 1305 | ps_cur_mb_info->u1_mb_type = u1_mb_type; |
| 1306 | |
| 1307 | /**************************************************************/ |
| 1308 | /* Parse Macroblock data */ |
| 1309 | /**************************************************************/ |
| 1310 | if(u1_mb_type < u1_mb_threshold) |
| 1311 | { |
| 1312 | ps_cur_mb_info->ps_curmb->u1_mb_type = u1_inter_mb_type; |
| 1313 | |
| 1314 | ret = ps_dec->pf_parse_inter_mb(ps_dec, ps_cur_mb_info, u1_num_mbs, |
| 1315 | u1_num_mbsNby2); |
| 1316 | if(ret != OK) |
| 1317 | return ret; |
| 1318 | ps_cur_deblk_mb->u1_mb_type |= u1_deblk_mb_type; |
| 1319 | } |
| 1320 | else |
| 1321 | { |
| 1322 | /* Storing Intra partition info */ |
| 1323 | ps_parse_mb_data->u1_num_part = 0; |
| 1324 | ps_parse_mb_data->u1_isI_mb = 1; |
| 1325 | |
| 1326 | if((25 + u1_mb_threshold) == u1_mb_type) |
| 1327 | { |
| 1328 | /* I_PCM_MB */ |
| 1329 | ps_cur_mb_info->ps_curmb->u1_mb_type = I_PCM_MB; |
| 1330 | ret = ih264d_parse_ipcm_mb(ps_dec, ps_cur_mb_info, u1_num_mbs); |
| 1331 | if(ret != OK) |
| 1332 | return ret; |
| 1333 | ps_dec->u1_qp = 0; |
| 1334 | } |
| 1335 | else |
| 1336 | { |
| 1337 | ret = ih264d_parse_imb_cavlc( |
| 1338 | ps_dec, ps_cur_mb_info, u1_num_mbs, |
| 1339 | (UWORD8)(u1_mb_type - u1_mb_threshold)); |
| 1340 | if(ret != OK) |
| 1341 | return ret; |
| 1342 | } |
| 1343 | |
| 1344 | ps_cur_deblk_mb->u1_mb_type |= D_INTRA_MB; |
| 1345 | } |
| 1346 | uc_more_data_flag = MORE_RBSP_DATA(ps_bitstrm); |
| 1347 | } |
| 1348 | ps_cur_deblk_mb->u1_mb_qp = ps_dec->u1_qp; |
| 1349 | |
| 1350 | if(u1_mbaff) |
| 1351 | { |
| 1352 | ih264d_update_mbaff_left_nnz(ps_dec, ps_cur_mb_info); |
| 1353 | } |
| 1354 | /**************************************************************/ |
| 1355 | /* Get next Macroblock address */ |
| 1356 | /**************************************************************/ |
| 1357 | i2_cur_mb_addr++; |
| 1358 | |
| 1359 | u1_num_mbs++; |
| 1360 | ps_dec->u2_total_mbs_coded++; |
| 1361 | u1_num_mbsNby2++; |
| 1362 | ps_parse_mb_data++; |
| 1363 | |
| 1364 | /****************************************************************/ |
| 1365 | /* Check for End Of Row and other flags that determine when to */ |
| 1366 | /* do DMA setup for N/2-Mb, Decode for N-Mb, and Transfer for */ |
| 1367 | /* N-Mb */ |
| 1368 | /****************************************************************/ |
| 1369 | u1_num_mbs_next = i2_pic_wdin_mbs - ps_dec->u2_mbx - 1; |
| 1370 | u1_end_of_row = (!u1_num_mbs_next) && (!(u1_mbaff && (u1_num_mbs & 0x01))); |
| 1371 | u1_slice_end = (!(uc_more_data_flag || i2_mb_skip_run)); |
| 1372 | u1_tfr_n_mb = (u1_num_mbs == ps_dec->u1_recon_mb_grp) || u1_end_of_row |
| 1373 | || u1_slice_end; |
| 1374 | u1_decode_nmb = u1_tfr_n_mb || u1_slice_end; |
| 1375 | ps_cur_mb_info->u1_end_of_slice = u1_slice_end; |
| 1376 | |
| 1377 | /*u1_dma_nby2mb = u1_decode_nmb || |
| 1378 | (u1_num_mbsNby2 == ps_dec->u1_recon_mb_grp_pair);*/ |
| 1379 | |
| 1380 | //if(u1_dma_nby2mb) |
| 1381 | if(u1_decode_nmb) |
| 1382 | { |
| 1383 | |
| 1384 | ret = ps_dec->pf_mvpred_ref_tfr_nby2mb(ps_dec, u1_mb_idx, u1_num_mbs); |
| 1385 | if(ret != OK) |
| 1386 | return ret; |
| 1387 | u1_num_mbsNby2 = 0; |
| 1388 | |
| 1389 | { |
| 1390 | ps_parse_mb_data = ps_dec->ps_parse_mb_data; |
| 1391 | ps_dec->ps_part = ps_dec->ps_parse_part_params; |
| 1392 | } |
| 1393 | } |
| 1394 | |
| 1395 | /*H264_DEC_DEBUG_PRINT("Pic: %d Mb_X=%d Mb_Y=%d", |
| 1396 | ps_slice->i4_poc >> ps_slice->u1_field_pic_flag, |
| 1397 | ps_dec->u2_mbx,ps_dec->u2_mby + (1 - ps_cur_mb_info->u1_topmb)); |
| 1398 | H264_DEC_DEBUG_PRINT("u1_decode_nmb: %d", u1_decode_nmb);*/ |
| 1399 | if(u1_decode_nmb) |
| 1400 | { |
| 1401 | |
| 1402 | |
| 1403 | |
| 1404 | if(ps_dec->u1_separate_parse) |
| 1405 | { |
| 1406 | ih264d_parse_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs, |
| 1407 | u1_num_mbs_next, u1_tfr_n_mb, u1_end_of_row); |
| 1408 | ps_dec->ps_nmb_info += u1_num_mbs; |
| 1409 | } |
| 1410 | else |
| 1411 | { |
| 1412 | ret = ih264d_decode_recon_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs, |
| 1413 | u1_num_mbs_next, u1_tfr_n_mb, |
| 1414 | u1_end_of_row); |
| 1415 | if(ret != OK) |
| 1416 | return ret; |
| 1417 | } |
| 1418 | |
| 1419 | if(u1_tfr_n_mb) |
| 1420 | u1_num_mbs = 0; |
| 1421 | u1_mb_idx = u1_num_mbs; |
| 1422 | ps_dec->u1_mb_idx = u1_num_mbs; |
| 1423 | |
| 1424 | } |
| 1425 | //ps_dec->ps_pred++; |
| 1426 | } |
| 1427 | |
| 1428 | if(ps_dec->u1_separate_parse) |
| 1429 | { |
| 1430 | ps_dec->ps_parse_cur_slice->end_of_slice = 1; |
| 1431 | ps_dec->ps_cur_slice->u4_mbs_in_slice = i2_cur_mb_addr |
| 1432 | - (u2_first_mb_in_slice << u1_mbaff); |
| 1433 | } |
| 1434 | |
| 1435 | |
| 1436 | return OK; |
| 1437 | } |
| 1438 | |
| 1439 | /*! |
| 1440 | ************************************************************************** |
| 1441 | * \if Function name : ih264d_decode_pslice \endif |
| 1442 | * |
| 1443 | * \brief |
| 1444 | * Decodes a P Slice |
| 1445 | * |
| 1446 | * |
| 1447 | * \return |
| 1448 | * 0 on Success and Error code otherwise |
| 1449 | ************************************************************************** |
| 1450 | */ |
| 1451 | WORD32 ih264d_parse_pslice(dec_struct_t *ps_dec, UWORD16 u2_first_mb_in_slice) |
| 1452 | { |
| 1453 | dec_pic_params_t * ps_pps = ps_dec->ps_cur_pps; |
| 1454 | dec_slice_params_t * ps_cur_slice = ps_dec->ps_cur_slice; |
| 1455 | dec_bit_stream_t *ps_bitstrm = ps_dec->ps_bitstrm; |
| 1456 | UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer; |
| 1457 | UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst; |
| 1458 | UWORD8 u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag; //ps_dec->ps_cur_sps->u1_mb_aff_flag; |
| 1459 | UWORD8 u1_field_pic_flag = ps_cur_slice->u1_field_pic_flag; |
| 1460 | |
| 1461 | UWORD32 u4_temp; |
| 1462 | WORD32 i_temp; |
| 1463 | WORD32 ret; |
| 1464 | |
| 1465 | /*--------------------------------------------------------------------*/ |
| 1466 | /* Read remaining contents of the slice header */ |
| 1467 | /*--------------------------------------------------------------------*/ |
| 1468 | { |
| 1469 | WORD8 *pi1_buf; |
| 1470 | WORD16 *pi2_mv = ps_dec->s_default_mv_pred.i2_mv; |
| 1471 | WORD32 *pi4_mv = (WORD32*)pi2_mv; |
| 1472 | WORD16 *pi16_refFrame; |
| 1473 | |
| 1474 | pi1_buf = ps_dec->s_default_mv_pred.i1_ref_frame; |
| 1475 | pi16_refFrame = (WORD16*)pi1_buf; |
| 1476 | *pi4_mv = 0; |
| 1477 | *(pi4_mv + 1) = 0; |
| 1478 | *pi16_refFrame = OUT_OF_RANGE_REF; |
| 1479 | ps_dec->s_default_mv_pred.u1_col_ref_pic_idx = (UWORD8)-1; |
| 1480 | ps_dec->s_default_mv_pred.u1_pic_type = (UWORD8)-1; |
| 1481 | } |
| 1482 | |
| 1483 | ps_cur_slice->u1_num_ref_idx_active_override_flag = ih264d_get_bit_h264( |
| 1484 | ps_bitstrm); |
| 1485 | |
| 1486 | COPYTHECONTEXT("SH: num_ref_idx_override_flag", |
| 1487 | ps_cur_slice->u1_num_ref_idx_active_override_flag); |
| 1488 | |
| 1489 | u4_temp = ps_dec->ps_cur_pps->u1_num_ref_idx_lx_active[0]; |
| 1490 | if(ps_cur_slice->u1_num_ref_idx_active_override_flag) |
| 1491 | { |
| 1492 | u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf) + 1; |
| 1493 | } |
| 1494 | |
| 1495 | { |
| 1496 | |
| 1497 | |
| 1498 | |
| 1499 | UWORD8 u1_max_ref_idx = MAX_FRAMES << u1_field_pic_flag; |
| 1500 | if(u4_temp > u1_max_ref_idx) |
| 1501 | { |
| 1502 | return ERROR_NUM_REF; |
| 1503 | } |
| 1504 | ps_cur_slice->u1_num_ref_idx_lx_active[0] = u4_temp; |
| 1505 | COPYTHECONTEXT("SH: num_ref_idx_l0_active_minus1", |
| 1506 | ps_cur_slice->u1_num_ref_idx_lx_active[0] - 1); |
| 1507 | |
| 1508 | } |
| 1509 | |
| 1510 | { |
| 1511 | UWORD8 uc_refIdxReFlagL0 = ih264d_get_bit_h264(ps_bitstrm); |
| 1512 | COPYTHECONTEXT("SH: ref_pic_list_reordering_flag_l0",uc_refIdxReFlagL0); |
| 1513 | |
| 1514 | /* Initialize the Reference list once in Picture if the slice type */ |
| 1515 | /* of first slice is between 5 to 9 defined in table 7.3 of standard */ |
| 1516 | /* If picture contains both P & B slices then Initialize the Reference*/ |
| 1517 | /* List only when it switches from P to B and B to P */ |
| 1518 | { |
| 1519 | UWORD8 init_idx_flg = (ps_dec->u1_pr_sl_type |
| 1520 | != ps_dec->ps_cur_slice->u1_slice_type); |
| 1521 | if(ps_dec->u1_first_pb_nal_in_pic |
| 1522 | || (init_idx_flg & !ps_dec->u1_sl_typ_5_9) |
| 1523 | || ps_dec->u1_num_ref_idx_lx_active_prev |
| 1524 | != ps_cur_slice->u1_num_ref_idx_lx_active[0]) |
| 1525 | { |
| 1526 | ih264d_init_ref_idx_lx_p(ps_dec); |
| 1527 | } |
| 1528 | if(ps_dec->u1_first_pb_nal_in_pic & ps_dec->u1_sl_typ_5_9) |
| 1529 | ps_dec->u1_first_pb_nal_in_pic = 0; |
| 1530 | } |
| 1531 | /* Store the value for future slices in the same picture */ |
| 1532 | ps_dec->u1_num_ref_idx_lx_active_prev = |
| 1533 | ps_cur_slice->u1_num_ref_idx_lx_active[0]; |
| 1534 | |
| 1535 | /* Modified temporarily */ |
| 1536 | if(uc_refIdxReFlagL0) |
| 1537 | { |
| 1538 | WORD8 ret; |
| 1539 | ps_dec->ps_ref_pic_buf_lx[0] = ps_dec->ps_dpb_mgr->ps_mod_dpb[0]; |
| 1540 | ret = ih264d_ref_idx_reordering(ps_dec, 0); |
| 1541 | if(ret == -1) |
| 1542 | return ERROR_REFIDX_ORDER_T; |
| 1543 | ps_dec->ps_ref_pic_buf_lx[0] = ps_dec->ps_dpb_mgr->ps_mod_dpb[0]; |
| 1544 | } |
| 1545 | else |
| 1546 | ps_dec->ps_ref_pic_buf_lx[0] = |
| 1547 | ps_dec->ps_dpb_mgr->ps_init_dpb[0]; |
| 1548 | } |
| 1549 | /* Create refIdx to POC mapping */ |
| 1550 | { |
| 1551 | void **pui_map_ref_idx_to_poc_lx0, **pui_map_ref_idx_to_poc_lx1; |
| 1552 | WORD8 idx; |
| 1553 | struct pic_buffer_t *ps_pic; |
| 1554 | |
| 1555 | pui_map_ref_idx_to_poc_lx0 = ps_dec->ppv_map_ref_idx_to_poc + FRM_LIST_L0; |
| 1556 | pui_map_ref_idx_to_poc_lx0[0] = 0; //For ref_idx = -1 |
| 1557 | pui_map_ref_idx_to_poc_lx0++; |
| 1558 | for(idx = 0; idx < ps_cur_slice->u1_num_ref_idx_lx_active[0]; idx++) |
| 1559 | { |
| 1560 | ps_pic = ps_dec->ps_ref_pic_buf_lx[0][idx]; |
| 1561 | pui_map_ref_idx_to_poc_lx0[idx] = (ps_pic->pu1_buf1); |
| 1562 | } |
| 1563 | |
| 1564 | /* Bug Fix Deblocking */ |
| 1565 | pui_map_ref_idx_to_poc_lx1 = ps_dec->ppv_map_ref_idx_to_poc + FRM_LIST_L1; |
| 1566 | pui_map_ref_idx_to_poc_lx1[0] = 0; |
| 1567 | |
| 1568 | if(u1_mbaff) |
| 1569 | { |
| 1570 | void **ppv_map_ref_idx_to_poc_lx_t, **ppv_map_ref_idx_to_poc_lx_b; |
| 1571 | void **ppv_map_ref_idx_to_poc_lx_t1, **ppv_map_ref_idx_to_poc_lx_b1; |
| 1572 | ppv_map_ref_idx_to_poc_lx_t = ps_dec->ppv_map_ref_idx_to_poc |
| 1573 | + TOP_LIST_FLD_L0; |
| 1574 | ppv_map_ref_idx_to_poc_lx_b = ps_dec->ppv_map_ref_idx_to_poc |
| 1575 | + BOT_LIST_FLD_L0; |
| 1576 | |
| 1577 | ppv_map_ref_idx_to_poc_lx_t[0] = 0; // For ref_idx = -1 |
| 1578 | ppv_map_ref_idx_to_poc_lx_t++; |
| 1579 | ppv_map_ref_idx_to_poc_lx_b[0] = 0; // For ref_idx = -1 |
| 1580 | ppv_map_ref_idx_to_poc_lx_b++; |
| 1581 | |
| 1582 | idx = 0; |
| 1583 | for(idx = 0; idx < ps_cur_slice->u1_num_ref_idx_lx_active[0]; idx++) |
| 1584 | { |
| 1585 | ps_pic = ps_dec->ps_ref_pic_buf_lx[0][idx]; |
| 1586 | ppv_map_ref_idx_to_poc_lx_t[0] = (ps_pic->pu1_buf1); |
| 1587 | ppv_map_ref_idx_to_poc_lx_b[1] = (ps_pic->pu1_buf1); |
| 1588 | |
| 1589 | ppv_map_ref_idx_to_poc_lx_b[0] = (ps_pic->pu1_buf1) + 1; |
| 1590 | ppv_map_ref_idx_to_poc_lx_t[1] = (ps_pic->pu1_buf1) + 1; |
| 1591 | |
| 1592 | ppv_map_ref_idx_to_poc_lx_t += 2; |
| 1593 | ppv_map_ref_idx_to_poc_lx_b += 2; |
| 1594 | } |
| 1595 | ppv_map_ref_idx_to_poc_lx_t1 = ps_dec->ppv_map_ref_idx_to_poc |
| 1596 | + TOP_LIST_FLD_L1; |
| 1597 | ppv_map_ref_idx_to_poc_lx_t1[0] = 0; |
| 1598 | ppv_map_ref_idx_to_poc_lx_b1 = ps_dec->ppv_map_ref_idx_to_poc |
| 1599 | + BOT_LIST_FLD_L1; |
| 1600 | ppv_map_ref_idx_to_poc_lx_b1[0] = 0; |
| 1601 | |
| 1602 | } |
| 1603 | |
| 1604 | if(ps_dec->u4_num_cores >= 3) |
| 1605 | { |
| 1606 | WORD32 num_entries; |
| 1607 | WORD32 size; |
| 1608 | |
| 1609 | num_entries = MIN(MAX_FRAMES, ps_dec->u4_num_ref_frames_at_init); |
| 1610 | num_entries = 2 * ((2 * num_entries) + 1); |
| 1611 | |
| 1612 | size = num_entries * sizeof(void *); |
| 1613 | size += PAD_MAP_IDX_POC * sizeof(void *); |
| 1614 | |
| 1615 | memcpy((void *)ps_dec->ps_parse_cur_slice->ppv_map_ref_idx_to_poc, |
| 1616 | ps_dec->ppv_map_ref_idx_to_poc, |
| 1617 | size); |
| 1618 | } |
| 1619 | |
| 1620 | |
| 1621 | } |
| 1622 | if(ps_pps->u1_wted_pred_flag) |
| 1623 | { |
| 1624 | ret = ih264d_parse_pred_weight_table(ps_cur_slice, ps_bitstrm); |
| 1625 | if(ret != OK) |
| 1626 | return ret; |
| 1627 | ih264d_form_pred_weight_matrix(ps_dec); |
| 1628 | ps_dec->pu4_wt_ofsts = ps_dec->pu4_wts_ofsts_mat; |
| 1629 | } |
| 1630 | else |
| 1631 | { |
| 1632 | ps_dec->ps_cur_slice->u2_log2Y_crwd = 0; |
| 1633 | ps_dec->pu4_wt_ofsts = ps_dec->pu4_wts_ofsts_mat; |
| 1634 | } |
| 1635 | |
| 1636 | ps_dec->ps_parse_cur_slice->u2_log2Y_crwd = |
| 1637 | ps_dec->ps_cur_slice->u2_log2Y_crwd; |
| 1638 | |
| 1639 | if(u1_mbaff && (u1_field_pic_flag == 0)) |
| 1640 | { |
| 1641 | ih264d_convert_frm_mbaff_list(ps_dec); |
| 1642 | } |
| 1643 | |
| 1644 | /* G050 */ |
| 1645 | if(ps_cur_slice->u1_nal_ref_idc != 0) |
| 1646 | { |
| 1647 | if(!ps_dec->ps_dpb_cmds->u1_dpb_commands_read) |
| 1648 | ps_dec->u4_bitoffset = ih264d_read_mmco_commands(ps_dec); |
| 1649 | else |
| 1650 | ps_bitstrm->u4_ofst += ps_dec->u4_bitoffset; |
| 1651 | |
| 1652 | } |
| 1653 | /* G050 */ |
| 1654 | |
| 1655 | if(ps_pps->u1_entropy_coding_mode == CABAC) |
| 1656 | { |
| 1657 | u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf); |
| 1658 | |
| 1659 | if(u4_temp > MAX_CABAC_INIT_IDC) |
| 1660 | { |
| 1661 | return ERROR_INV_SLICE_HDR_T; |
| 1662 | } |
| 1663 | ps_cur_slice->u1_cabac_init_idc = u4_temp; |
| 1664 | COPYTHECONTEXT("SH: cabac_init_idc",ps_cur_slice->u1_cabac_init_idc); |
| 1665 | } |
| 1666 | |
| 1667 | /* Read slice_qp_delta */ |
| 1668 | i_temp = ps_pps->u1_pic_init_qp |
| 1669 | + ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf); |
| 1670 | if((i_temp < 0) || (i_temp > 51)) |
| 1671 | { |
| 1672 | return ERROR_INV_RANGE_QP_T; |
| 1673 | } |
| 1674 | ps_cur_slice->u1_slice_qp = i_temp; |
| 1675 | COPYTHECONTEXT("SH: slice_qp_delta", |
| 1676 | (WORD8)(ps_cur_slice->u1_slice_qp - ps_pps->u1_pic_init_qp)); |
| 1677 | |
| 1678 | if(ps_pps->u1_deblocking_filter_parameters_present_flag == 1) |
| 1679 | { |
| 1680 | u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf); |
| 1681 | if(u4_temp > SLICE_BOUNDARY_DBLK_DISABLED) |
| 1682 | { |
| 1683 | return ERROR_INV_SLICE_HDR_T; |
| 1684 | } |
| 1685 | |
| 1686 | COPYTHECONTEXT("SH: disable_deblocking_filter_idc", u4_temp); |
| 1687 | ps_cur_slice->u1_disable_dblk_filter_idc = u4_temp; |
| 1688 | if(u4_temp != 1) |
| 1689 | { |
| 1690 | i_temp = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf) |
| 1691 | << 1; |
| 1692 | if((MIN_DBLK_FIL_OFF > i_temp) || (i_temp > MAX_DBLK_FIL_OFF)) |
| 1693 | { |
| 1694 | return ERROR_INV_SLICE_HDR_T; |
| 1695 | } |
| 1696 | ps_cur_slice->i1_slice_alpha_c0_offset = i_temp; |
| 1697 | COPYTHECONTEXT("SH: slice_alpha_c0_offset_div2", |
| 1698 | ps_cur_slice->i1_slice_alpha_c0_offset >> 1); |
| 1699 | |
| 1700 | i_temp = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf) |
| 1701 | << 1; |
| 1702 | if((MIN_DBLK_FIL_OFF > i_temp) || (i_temp > MAX_DBLK_FIL_OFF)) |
| 1703 | { |
| 1704 | return ERROR_INV_SLICE_HDR_T; |
| 1705 | } |
| 1706 | ps_cur_slice->i1_slice_beta_offset = i_temp; |
| 1707 | COPYTHECONTEXT("SH: slice_beta_offset_div2", |
| 1708 | ps_cur_slice->i1_slice_beta_offset >> 1); |
| 1709 | } |
| 1710 | else |
| 1711 | { |
| 1712 | ps_cur_slice->i1_slice_alpha_c0_offset = 0; |
| 1713 | ps_cur_slice->i1_slice_beta_offset = 0; |
| 1714 | } |
| 1715 | } |
| 1716 | else |
| 1717 | { |
| 1718 | ps_cur_slice->u1_disable_dblk_filter_idc = 0; |
| 1719 | ps_cur_slice->i1_slice_alpha_c0_offset = 0; |
| 1720 | ps_cur_slice->i1_slice_beta_offset = 0; |
| 1721 | } |
| 1722 | |
| 1723 | DATA_SYNC(); |
| 1724 | ps_dec->ps_parse_cur_slice->slice_header_done = 2; |
| 1725 | |
| 1726 | if(ps_pps->u1_entropy_coding_mode) |
| 1727 | { |
| 1728 | SWITCHOFFTRACE; SWITCHONTRACECABAC; |
| 1729 | ps_dec->pf_parse_inter_slice = ih264d_parse_inter_slice_data_cabac; |
| 1730 | if(ps_dec->ps_parse_cur_slice->u2_error_flag == 1) |
| 1731 | return 0; |
| 1732 | ps_dec->pf_parse_inter_mb = ih264d_parse_pmb_cabac; |
| 1733 | ih264d_init_cabac_contexts(P_SLICE, ps_dec); |
| 1734 | |
| 1735 | if(ps_dec->ps_cur_slice->u1_mbaff_frame_flag) |
| 1736 | ps_dec->pf_get_mb_info = ih264d_get_mb_info_cabac_mbaff; |
| 1737 | else |
| 1738 | ps_dec->pf_get_mb_info = ih264d_get_mb_info_cabac_nonmbaff; |
| 1739 | } |
| 1740 | else |
| 1741 | { |
| 1742 | SWITCHONTRACE; SWITCHOFFTRACECABAC; |
| 1743 | ps_dec->pf_parse_inter_slice = ih264d_parse_inter_slice_data_cavlc; |
| 1744 | ps_dec->pf_parse_inter_mb = ih264d_parse_pmb_cavlc; |
| 1745 | if(ps_dec->ps_cur_slice->u1_mbaff_frame_flag) |
| 1746 | { |
| 1747 | ps_dec->pf_get_mb_info = ih264d_get_mb_info_cavlc_mbaff; |
| 1748 | } |
| 1749 | else |
| 1750 | ps_dec->pf_get_mb_info = ih264d_get_mb_info_cavlc_nonmbaff; |
| 1751 | } |
| 1752 | |
| 1753 | ps_dec->u1_B = 0; |
| 1754 | ps_dec->pf_mvpred_ref_tfr_nby2mb = ih264d_mv_pred_ref_tfr_nby2_pmb; |
| 1755 | ret = ps_dec->pf_parse_inter_slice(ps_dec, ps_cur_slice, u2_first_mb_in_slice); |
| 1756 | if(ret != OK) |
| 1757 | return ret; |
| 1758 | // ps_dec->curr_slice_in_error = 0 ; |
| 1759 | return OK; |
| 1760 | } |