[automerger skipped] Merge Android 12 QPR1 am: 58baa890fb -s ours am: baaad6e229 -s ours

am skip reason: Merged-In I404ee8c2afe5ca547526c29b0aa6e079db15bc1d with SHA-1 18ec440913 is already in history

Original change: https://android-review.googlesource.com/c/platform/external/libavc/+/1921894

Change-Id: I8e4226bee38d695473e7013803d4b40ea2a802cd
diff --git a/decoder/ih264d_parse_slice.c b/decoder/ih264d_parse_slice.c
index 266c69b..ad033be 100644
--- a/decoder/ih264d_parse_slice.c
+++ b/decoder/ih264d_parse_slice.c
@@ -1435,23 +1435,6 @@
         i1_is_end_of_poc = 0;
     }
 
-    /* Increment only if the current slice has atleast 1 more MB */
-    if (ps_dec->u4_first_slice_in_pic == 0 &&
-        (ps_dec->ps_parse_cur_slice->u4_first_mb_in_slice <
-        (UWORD32)(ps_dec->u2_total_mbs_coded >> ps_dec->ps_cur_slice->u1_mbaff_frame_flag)))
-    {
-        ps_dec->ps_parse_cur_slice++;
-        ps_dec->u2_cur_slice_num++;
-        // in the case of single core increment ps_decode_cur_slice
-        if(ps_dec->u1_separate_parse == 0)
-        {
-            ps_dec->ps_decode_cur_slice++;
-        }
-    }
-
-    ps_dec->u1_slice_header_done = 0;
-
-
     if(u1_field_pic_flag)
     {
         ps_dec->u2_prv_frame_num = u2_frame_num;
@@ -1519,6 +1502,22 @@
         }
     }
 
+    /* Increment only if the current slice has atleast 1 more MB */
+    if (ps_dec->u4_first_slice_in_pic == 0 &&
+        (ps_dec->ps_parse_cur_slice->u4_first_mb_in_slice <
+        (UWORD32)(ps_dec->u2_total_mbs_coded >> ps_dec->ps_cur_slice->u1_mbaff_frame_flag)))
+    {
+        ps_dec->ps_parse_cur_slice++;
+        ps_dec->u2_cur_slice_num++;
+        // in the case of single core increment ps_decode_cur_slice
+        if(ps_dec->u1_separate_parse == 0)
+        {
+            ps_dec->ps_decode_cur_slice++;
+        }
+    }
+
+    ps_dec->u1_slice_header_done = 0;
+
     /*--------------------------------------------------------------------*/
     /* Copy the values read from the bitstream to the slice header and then*/
     /* If the slice is first slice in picture, then do Start of Picture   */