From 6dd54b9e180c838c82767878d10c9615af2c5866 Mon Sep 17 00:00:00 2001 From: Harish Mahendrakar Date: Mon, 30 Dec 2019 16:56:12 -0800 Subject: [PATCH 1/2] decoder: Fix in detecting dangling fields When decoder is expecting to decode a field, ensure current slice being decoded is a field and frame number matches with previous slice's frame number. Bug: 144687080 Test: poc in bug Change-Id: I89d9d7b6fc26797de0420ecb0ca7e66b066aa908 --- decoder/ih264d_parse_slice.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/decoder/ih264d_parse_slice.c b/decoder/ih264d_parse_slice.c index 8d50f9a..198ef63 100644 --- a/decoder/ih264d_parse_slice.c +++ b/decoder/ih264d_parse_slice.c @@ -1307,7 +1307,12 @@ WORD32 ih264d_parse_decode_slice(UWORD8 u1_is_idr_slice, if(i1_is_end_of_poc || ps_dec->u1_first_slice_in_stream) { - if(u2_frame_num != ps_dec->u2_prv_frame_num + /* If the current slice is not a field or frame number of the current + * slice doesn't match with previous slice, and decoder is expecting + * to decode a field i.e. ps_dec->u1_top_bottom_decoded is not 0 and + * is not (TOP_FIELD_ONLY | BOT_FIELD_ONLY), treat it as a dangling + * field */ + if((u1_field_pic_flag == 0 || u2_frame_num != ps_dec->u2_prv_frame_num) && ps_dec->u1_top_bottom_decoded != 0 && ps_dec->u1_top_bottom_decoded != (TOP_FIELD_ONLY | BOT_FIELD_ONLY)) From f80afe5b98e6752ed89aef10b97863ad5db2401f Mon Sep 17 00:00:00 2001 From: Harish Mahendrakar Date: Mon, 30 Dec 2019 17:23:38 -0800 Subject: [PATCH 2/2] decoder: Fix lt_ref increment in ih264d_fix_error_in_dpb When removing common nodes from short term list if it present in long term reference list, number of long term buffers was wrongly incremented. Only decrement of short term buffer count is needed in such a case. Bug: 140561484 Bug: 140566606 Bug: 140699853 Bug: 144980954 Bug: 145859214 Test: poc in bug Change-Id: Iebf7ee7ed65e7b2097a899577982806b03fc6e5d --- decoder/ih264d_parse_slice.c | 1 - 1 file changed, 1 deletion(-) diff --git a/decoder/ih264d_parse_slice.c b/decoder/ih264d_parse_slice.c index 8d50f9a..4401e8e 100644 --- a/decoder/ih264d_parse_slice.c +++ b/decoder/ih264d_parse_slice.c @@ -1029,7 +1029,6 @@ WORD32 ih264d_fix_error_in_dpb(dec_struct_t *ps_dec) ps_st_next_dpb->ps_prev_short = ps_st_curr_dpb->ps_prev_short; } ps_dec->ps_dpb_mgr->u1_num_st_ref_bufs--; - ps_dec->ps_dpb_mgr->u1_num_lt_ref_bufs++; no_of_nodes_deleted++; break; }