From f9d3f9af8fc113acda28e1a4e48d85736ee29c75 Mon Sep 17 00:00:00 2001 From: Hamsalekha S Date: Tue, 23 May 2017 11:53:52 +0530 Subject: Initializing reference list for every P/B slice. Reference list needs to be initialized for every P/B slice, to ensure colocated picture always points to a valid picture buffer, even in the case of error. Bug: 36279112 Change-Id: I051d7e725b0af209cc7bb333db8da3518adf78a0 --- decoder/ih264d_api.c | 2 -- decoder/ih264d_parse_bslice.c | 17 ++--------------- decoder/ih264d_parse_pslice.c | 18 +----------------- decoder/ih264d_parse_slice.c | 8 ++------ decoder/ih264d_structs.h | 2 -- 5 files changed, 5 insertions(+), 42 deletions(-) diff --git a/decoder/ih264d_api.c b/decoder/ih264d_api.c index 17486ba..e32b80b 100644 --- a/decoder/ih264d_api.c +++ b/decoder/ih264d_api.c @@ -1491,7 +1491,6 @@ void ih264d_init_decoder(void * ps_dec_params) ps_dec->ps_cur_sps = NULL; ps_dec->u1_init_dec_flag = 0; ps_dec->u1_first_slice_in_stream = 1; - ps_dec->u1_first_pb_nal_in_pic = 1; ps_dec->u1_last_pic_not_decoded = 0; ps_dec->u4_app_disp_width = 0; ps_dec->i4_header_decoded = 0; @@ -2871,7 +2870,6 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op) ps_dec->cur_dec_mb_num = 0; ps_dec->cur_recon_mb_num = 0; ps_dec->u4_first_slice_in_pic = 1; - ps_dec->u1_first_pb_nal_in_pic = 1; ps_dec->u1_slice_header_done = 0; ps_dec->u1_dangling_field = 0; diff --git a/decoder/ih264d_parse_bslice.c b/decoder/ih264d_parse_bslice.c index eb157e6..443dec2 100644 --- a/decoder/ih264d_parse_bslice.c +++ b/decoder/ih264d_parse_bslice.c @@ -1405,22 +1405,9 @@ WORD32 ih264d_parse_bslice(dec_struct_t * ps_dec, UWORD16 u2_first_mb_in_slice) ps_slice->u1_num_ref_idx_lx_active[0] = u4_temp; ps_slice->u1_num_ref_idx_lx_active[1] = ui_temp1; } - /* Initialize the Reference list once in Picture if the slice type */ - /* of first slice is between 5 to 9 defined in table 7.3 of standard */ - /* If picture contains both P & B slices then Initialize the Reference*/ - /* List only when it switches from P to B and B to P */ - { - UWORD8 init_idx_flg = (ps_dec->u1_pr_sl_type - != ps_dec->ps_cur_slice->u1_slice_type); - if(ps_dec->u1_first_pb_nal_in_pic - || (init_idx_flg & !ps_dec->u1_sl_typ_5_9) - || ps_dec->u1_num_ref_idx_lx_active_prev - != ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[0]) - ih264d_init_ref_idx_lx_b(ps_dec); - if(ps_dec->u1_first_pb_nal_in_pic & ps_dec->u1_sl_typ_5_9) - ps_dec->u1_first_pb_nal_in_pic = 0; - } + + ih264d_init_ref_idx_lx_b(ps_dec); /* Store the value for future slices in the same picture */ ps_dec->u1_num_ref_idx_lx_active_prev = ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[0]; diff --git a/decoder/ih264d_parse_pslice.c b/decoder/ih264d_parse_pslice.c index 72d9d4f..db71b6a 100644 --- a/decoder/ih264d_parse_pslice.c +++ b/decoder/ih264d_parse_pslice.c @@ -1971,23 +1971,7 @@ WORD32 ih264d_parse_pslice(dec_struct_t *ps_dec, UWORD16 u2_first_mb_in_slice) UWORD8 uc_refIdxReFlagL0 = ih264d_get_bit_h264(ps_bitstrm); COPYTHECONTEXT("SH: ref_pic_list_reordering_flag_l0",uc_refIdxReFlagL0); - /* Initialize the Reference list once in Picture if the slice type */ - /* of first slice is between 5 to 9 defined in table 7.3 of standard */ - /* If picture contains both P & B slices then Initialize the Reference*/ - /* List only when it switches from P to B and B to P */ - { - UWORD8 init_idx_flg = (ps_dec->u1_pr_sl_type - != ps_dec->ps_cur_slice->u1_slice_type); - if(ps_dec->u1_first_pb_nal_in_pic - || (init_idx_flg & !ps_dec->u1_sl_typ_5_9) - || ps_dec->u1_num_ref_idx_lx_active_prev - != ps_cur_slice->u1_num_ref_idx_lx_active[0]) - { - ih264d_init_ref_idx_lx_p(ps_dec); - } - if(ps_dec->u1_first_pb_nal_in_pic & ps_dec->u1_sl_typ_5_9) - ps_dec->u1_first_pb_nal_in_pic = 0; - } + ih264d_init_ref_idx_lx_p(ps_dec); /* Store the value for future slices in the same picture */ ps_dec->u1_num_ref_idx_lx_active_prev = ps_cur_slice->u1_num_ref_idx_lx_active[0]; diff --git a/decoder/ih264d_parse_slice.c b/decoder/ih264d_parse_slice.c index 76b0aee..e1ce100 100644 --- a/decoder/ih264d_parse_slice.c +++ b/decoder/ih264d_parse_slice.c @@ -284,10 +284,8 @@ WORD32 ih264d_start_of_pic(dec_struct_t *ps_dec, { dec_err_status_t * ps_err = ps_dec->ps_dec_err_status; - if(ps_dec->u1_sl_typ_5_9 - && ((ps_cur_slice->u1_slice_type == I_SLICE) - || (ps_cur_slice->u1_slice_type - == SI_SLICE))) + if((ps_cur_slice->u1_slice_type == I_SLICE) + || (ps_cur_slice->u1_slice_type == SI_SLICE)) ps_err->u1_cur_pic_type = PIC_TYPE_I; else ps_err->u1_cur_pic_type = PIC_TYPE_UNKNOWN; @@ -1048,14 +1046,12 @@ WORD32 ih264d_parse_decode_slice(UWORD8 u1_is_idr_slice, u1_slice_type = u4_temp; COPYTHECONTEXT("SH: slice_type",(u1_slice_type)); - ps_dec->u1_sl_typ_5_9 = 0; /* Find Out the Slice Type is 5 to 9 or not then Set the Flag */ /* u1_sl_typ_5_9 = 1 .Which tells that all the slices in the Pic*/ /* will be of same type of current */ if(u1_slice_type > 4) { u1_slice_type -= 5; - ps_dec->u1_sl_typ_5_9 = 1; } { diff --git a/decoder/ih264d_structs.h b/decoder/ih264d_structs.h index 062747b..c05e71a 100644 --- a/decoder/ih264d_structs.h +++ b/decoder/ih264d_structs.h @@ -916,11 +916,9 @@ typedef struct _DecStruct /* slice Header Simplification */ UWORD8 u1_pr_sl_type; - UWORD8 u1_sl_typ_5_9; WORD32 i4_frametype; UWORD32 u4_app_disp_width; WORD32 i4_error_code; - UWORD8 u1_first_pb_nal_in_pic; UWORD32 u4_bitoffset; /* Variables added to handle field pics */ -- cgit v1.2.3