shithub: openh264

Download patch

ref: 6489e7b38ad852a20f87214571fac382150dee62
parent: e66cf5369e3f65fb0c259320d158a2f25ceb9021
parent: 1ec213d5a7d8a1b0ee7ca4f00c725e53c2e38e66
author: dongzha <dongzha@cisco.com>
date: Tue Jul 8 08:49:42 EDT 2014

Merge pull request #1096 from huili2/early_stop_parse_rec_bug

stop early error for parse/recon MB

--- a/codec/decoder/core/src/decode_slice.cpp
+++ b/codec/decoder/core/src/decode_slice.cpp
@@ -85,6 +85,10 @@
   }
 
   do {
+    if (iCountNumMb >= iTotalNumMb) {
+      break;
+    }
+
     if (WelsTargetMbConstruction (pCtx)) {
       WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "WelsTargetSliceConstruction():::MB(%d, %d) construction error. pCurSlice_type:%d\n",
                pCurLayer->iMbX, pCurLayer->iMbY, pCurSlice->eSliceType);
@@ -98,9 +102,6 @@
       ++pCtx->iTotalNumMbRec;
     }
 
-    if (iCountNumMb >= iTotalNumMb) {
-      break;
-    }
     if (pCtx->iTotalNumMbRec > iTotalMbTargetLayer) {
       WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "WelsTargetSliceConstruction():::pCtx->iTotalNumMbRec:%d, iTotalMbTargetLayer:%d\n",
                pCtx->iTotalNumMbRec, iTotalMbTargetLayer);
@@ -390,6 +391,10 @@
   }
 
   do {
+    if ((-1 == iNextMbXyIndex) || (iNextMbXyIndex >= kiCountNumMb)) {	// slice group boundary or end of a frame
+      break;
+    }
+
     pCurLayer->pSliceIdc[iNextMbXyIndex] = iSliceIdc;
     iRet = pDecMbCavlcFunc (pCtx,  pNalCur);
 
@@ -403,9 +408,6 @@
       iNextMbXyIndex = FmoNextMb (pFmo, iNextMbXyIndex);
     } else {
       ++iNextMbXyIndex;
-    }
-    if ((-1 == iNextMbXyIndex) || (iNextMbXyIndex >= kiCountNumMb)) {	// slice group boundary or end of a frame
-      break;
     }
 
     // check whether there is left bits to read next time in case multiple slices