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)
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 @@
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;