Merge "Fix first frame error return" into mnc-dev am: cd5fc07378 am: 6a8d396574 am: de7f47bcc0 am: 6f830783d1 am: 4ced4d140b

am: 2e75afa0b6

Change-Id: Ie00024b2a42e51fed120809d3aba4a682d179a73
This commit is contained in:
Naveen Kumar P 2017-11-07 23:03:00 +00:00 committed by android-build-merger
commit 49d00a9f30
2 changed files with 22 additions and 26 deletions

View file

@ -691,14 +691,6 @@ WORD32 ihevcd_decode(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *pv_api_op)
BREAK_AFTER_SLICE_NAL();
}
if((ps_codec->u4_pic_cnt == 0) && (ret != IHEVCD_SUCCESS))
{
ps_codec->i4_error_code = ret;
ihevcd_fill_outargs(ps_codec, ps_dec_ip, ps_dec_op);
return IV_FAIL;
}
if(1 == ps_codec->i4_pic_present && 0 == ps_codec->s_parse.i4_end_of_frame)
{
slice_header_t *ps_slice_hdr_next;

View file

@ -2468,26 +2468,29 @@ IHEVCD_ERROR_T ihevcd_parse_slice_data(codec_t *ps_codec)
/*Cabac init at the beginning of a slice*/
//If the slice is a dependent slice, not present at the start of a tile
if((1 == ps_slice_hdr->i1_dependent_slice_flag) && (!((ps_codec->s_parse.i4_ctb_tile_x == 0) && (ps_codec->s_parse.i4_ctb_tile_y == 0))))
if(0 == ps_codec->i4_slice_error)
{
if((0 == ps_pps->i1_entropy_coding_sync_enabled_flag) || (ps_pps->i1_entropy_coding_sync_enabled_flag && (0 != ps_codec->s_parse.i4_ctb_x)))
if((1 == ps_slice_hdr->i1_dependent_slice_flag) && (!((ps_codec->s_parse.i4_ctb_tile_x == 0) && (ps_codec->s_parse.i4_ctb_tile_y == 0))))
{
ihevcd_cabac_reset(&ps_codec->s_parse.s_cabac,
&ps_codec->s_parse.s_bitstrm);
if((0 == ps_pps->i1_entropy_coding_sync_enabled_flag) || (ps_pps->i1_entropy_coding_sync_enabled_flag && (0 != ps_codec->s_parse.i4_ctb_x)))
{
ihevcd_cabac_reset(&ps_codec->s_parse.s_cabac,
&ps_codec->s_parse.s_bitstrm);
}
}
}
else if((0 == ps_pps->i1_entropy_coding_sync_enabled_flag) || (ps_pps->i1_entropy_coding_sync_enabled_flag && (0 != ps_codec->s_parse.i4_ctb_x)))
{
ret = ihevcd_cabac_init(&ps_codec->s_parse.s_cabac,
&ps_codec->s_parse.s_bitstrm,
slice_qp,
cabac_init_idc,
&gau1_ihevc_cab_ctxts[cabac_init_idc][slice_qp][0]);
if(ret != (IHEVCD_ERROR_T)IHEVCD_SUCCESS)
else if((0 == ps_pps->i1_entropy_coding_sync_enabled_flag) || (ps_pps->i1_entropy_coding_sync_enabled_flag && (0 != ps_codec->s_parse.i4_ctb_x)))
{
ps_codec->i4_slice_error = 1;
end_of_slice_flag = 1;
ret = (IHEVCD_ERROR_T)IHEVCD_SUCCESS;
ret = ihevcd_cabac_init(&ps_codec->s_parse.s_cabac,
&ps_codec->s_parse.s_bitstrm,
slice_qp,
cabac_init_idc,
&gau1_ihevc_cab_ctxts[cabac_init_idc][slice_qp][0]);
if(ret != (IHEVCD_ERROR_T)IHEVCD_SUCCESS)
{
ps_codec->i4_slice_error = 1;
end_of_slice_flag = 1;
ret = (IHEVCD_ERROR_T)IHEVCD_SUCCESS;
}
}
}
@ -2571,6 +2574,7 @@ IHEVCD_ERROR_T ihevcd_parse_slice_data(codec_t *ps_codec)
/* Cabac init is done unconditionally at the start of the tile irrespective
* of whether it is a dependent or an independent slice */
if(0 == ps_codec->i4_slice_error)
{
ret = ihevcd_cabac_init(&ps_codec->s_parse.s_cabac,
&ps_codec->s_parse.s_bitstrm,
@ -2634,7 +2638,7 @@ IHEVCD_ERROR_T ihevcd_parse_slice_data(codec_t *ps_codec)
if(ps_pps->i1_entropy_coding_sync_enabled_flag)
{
/*TODO Handle single CTB and top-right belonging to a different slice */
if(0 == ps_codec->s_parse.i4_ctb_x)
if(0 == ps_codec->s_parse.i4_ctb_x && 0 == ps_codec->i4_slice_error)
{
//WORD32 size = sizeof(ps_codec->s_parse.s_cabac.au1_ctxt_models);
WORD32 default_ctxt = 0;
@ -2789,7 +2793,7 @@ IHEVCD_ERROR_T ihevcd_parse_slice_data(codec_t *ps_codec)
if((ps_codec->s_parse.i4_ctb_tile_y + 1) == ps_tile->u2_ht)
end_of_tile = 1;
}
if((0 == end_of_slice_flag) &&
if((0 == end_of_slice_flag) && (0 == ps_codec->i4_slice_error) &&
((ps_pps->i1_tiles_enabled_flag && end_of_tile) ||
(ps_pps->i1_entropy_coding_sync_enabled_flag && end_of_tile_row)))
{