From df015034edb066ca1e135182bea68fdfd3a15775 Mon Sep 17 00:00:00 2001 From: Venkatarama Avadhani Date: Thu, 28 Dec 2017 16:57:40 +0530 Subject: Fixing Underflow of ps_dec->u2_num_mbs_left In multi-thread decode, the decoder would try to decode without dequeueing a job in case the next slice indicated that it belongs to the same row as being decoded currently. In single thread case, there was a check to ensure that the decoder does not continue when there are no MBs left. Adding a similar check for multi-thread decode as well. Bug: 69269702 Test: manual Change-Id: Ibbe5202dbb270625e4f592b4fdb8ef0ec71a979d (cherry picked from commit 00a2482c8dfa3550bcbfa515a93a4cead5daf8e9) --- decoder/impeg2d_dec_hdr.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'decoder') diff --git a/decoder/impeg2d_dec_hdr.c b/decoder/impeg2d_dec_hdr.c index 03323a4..3dff8c2 100644 --- a/decoder/impeg2d_dec_hdr.c +++ b/decoder/impeg2d_dec_hdr.c @@ -1007,23 +1007,30 @@ void impeg2d_dec_pic_data_thread(dec_state_t *ps_dec) if(i4_continue_decode) { - /* If the slice is from the same row, then continue decoding without dequeue */ - if((temp - 1) == i4_cur_row) + if (0 != ps_dec->u2_num_mbs_left) { - i4_dequeue_job = 0; - break; - } - - if(temp < ps_dec->i4_end_mb_y) - { - i4_cur_row = ps_dec->u2_mb_y; + /* If the slice is from the same row, then continue decoding without dequeue */ + if((temp - 1) == i4_cur_row) + { + i4_dequeue_job = 0; + } + else + { + if(temp < ps_dec->i4_end_mb_y) + { + i4_cur_row = ps_dec->u2_mb_y; + } + else + { + i4_dequeue_job = 1; + } + } } else { i4_dequeue_job = 1; } break; - } else break; -- cgit v1.2.3