summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVenkatarama Avadhani <venkatarama.avadhani@ittiam.com>2017-12-28 16:57:40 +0530
committerTim Schumacher <timschumi@gmx.de>2018-03-08 22:37:55 +0100
commitdf015034edb066ca1e135182bea68fdfd3a15775 (patch)
treef9d10f2245059512e310285b70b90ddc576227ce
parentf4d3e28ca141f22b2576a4884f5bb11bf4527fa8 (diff)
downloadandroid_external_libmpeg2-df015034edb066ca1e135182bea68fdfd3a15775.tar.gz
android_external_libmpeg2-df015034edb066ca1e135182bea68fdfd3a15775.tar.bz2
android_external_libmpeg2-df015034edb066ca1e135182bea68fdfd3a15775.zip
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)
-rw-r--r--decoder/impeg2d_dec_hdr.c27
1 files changed, 17 insertions, 10 deletions
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;