Showing the changes to codec/decoder/core/src/decode_slice.cpp (1 of 1 file). Show all
Unified · Split
| @@ -85,6 +85,10 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) { · 84 unmodified lines | |||
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | do { | 87 | do { |
| 88 | if (iCountNumMb >= iTotalNumMb) { | ||
| 89 | break; | ||
| 90 | } | ||
| 91 | |||
| 88 | if (WelsTargetMbConstruction (pCtx)) { | 92 | if (WelsTargetMbConstruction (pCtx)) { |
| 89 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "WelsTargetSliceConstruction():::MB(%d, %d) construction error. pCurSlice_type:%d\n", | 93 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "WelsTargetSliceConstruction():::MB(%d, %d) construction error. pCurSlice_type:%d\n", |
| 90 | pCurLayer->iMbX, pCurLayer->iMbY, pCurSlice->eSliceType); | 94 | pCurLayer->iMbX, pCurLayer->iMbY, pCurSlice->eSliceType); |
| @@ -98,9 +102,6 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) { · 7 unmodified lines | |||
| 98 | ++pCtx->iTotalNumMbRec; | 102 | ++pCtx->iTotalNumMbRec; |
| 99 | } | 103 | } |
| 100 | 104 | ||
| 101 | if (iCountNumMb >= iTotalNumMb) { | ||
| 102 | break; | ||
| 103 | } | ||
| 104 | if (pCtx->iTotalNumMbRec > iTotalMbTargetLayer) { | 105 | if (pCtx->iTotalNumMbRec > iTotalMbTargetLayer) { |
| 105 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "WelsTargetSliceConstruction():::pCtx->iTotalNumMbRec:%d, iTotalMbTargetLayer:%d\n", | 106 | WelsLog (&(pCtx->sLogCtx), WELS_LOG_WARNING, "WelsTargetSliceConstruction():::pCtx->iTotalNumMbRec:%d, iTotalMbTargetLayer:%d\n", |
| 106 | pCtx->iTotalNumMbRec, iTotalMbTargetLayer); | 107 | pCtx->iTotalNumMbRec, iTotalMbTargetLayer); |
| @@ -390,6 +391,10 @@ int32_t WelsDecodeSlice (PWelsDecoderContext pCtx, bool bFirstSliceInLayer, PNal · 283 unmodified lines | |||
| 390 | } | 391 | } |
| 391 | 392 | ||
| 392 | do { | 393 | do { |
| 394 | if ((-1 == iNextMbXyIndex) || (iNextMbXyIndex >= kiCountNumMb)) { // slice group boundary or end of a frame | ||
| 395 | break; | ||
| 396 | } | ||
| 397 | |||
| 393 | pCurLayer->pSliceIdc[iNextMbXyIndex] = iSliceIdc; | 398 | pCurLayer->pSliceIdc[iNextMbXyIndex] = iSliceIdc; |
| 394 | iRet = pDecMbCavlcFunc (pCtx, pNalCur); | 399 | iRet = pDecMbCavlcFunc (pCtx, pNalCur); |
| 395 | 400 | ||
| @@ -404,9 +409,6 @@ int32_t WelsDecodeSlice (PWelsDecoderContext pCtx, bool bFirstSliceInLayer, PNal · 8 unmodified lines | |||
| 404 | } else { | 409 | } else { |
| 405 | ++iNextMbXyIndex; | 410 | ++iNextMbXyIndex; |
| 406 | } | 411 | } |
| 407 | if ((-1 == iNextMbXyIndex) || (iNextMbXyIndex >= kiCountNumMb)) { // slice group boundary or end of a frame | ||
| 408 | break; | ||
| 409 | } | ||
| 410 | 412 | ||
| 411 | // check whether there is left bits to read next time in case multiple slices | 413 | // check whether there is left bits to read next time in case multiple slices |
| 412 | iUsedBits = ((pBs->pCurBuf - pBs->pStartBuf) << 3) - (16 - pBs->iLeftBits); | 414 | iUsedBits = ((pBs->pCurBuf - pBs->pStartBuf) << 3) - (16 - pBs->iLeftBits); |