1. Distinguish non-threaded decoding with m_iThreadCount = 0 from one-thread decoding with m_iThreadCount=1. 2. Removed the use of bAvailable of PPicture and replaced by the use of iRefCount to more preciously represent the picture's being-use counts in both threaded and non-threaded mode.
Showing the changes to codec/decoder/core/src/decode_slice.cpp (1 of 14 files). Show all
Unified · Split
| @@ -236,7 +236,7 @@ int32_t WelsMbInterConstruction (PWelsDecoderContext pCtx, PDqLayer pCurDqLayer) · 235 unmodified lines | |||
| 236 | } | 236 | } |
| 237 | WelsMbInterSampleConstruction (pCtx, pCurDqLayer, pDstY, pDstCb, pDstCr, iLumaStride, iChromaStride); | 237 | WelsMbInterSampleConstruction (pCtx, pCurDqLayer, pDstY, pDstCb, pDstCr, iLumaStride, iChromaStride); |
| 238 | 238 | ||
| 239 | if (pCtx->pThreadCtx == NULL) { | 239 | if (GetThreadCount (pCtx) <= 1) { |
| 240 | pCtx->sBlockFunc.pWelsSetNonZeroCountFunc ( | 240 | pCtx->sBlockFunc.pWelsSetNonZeroCountFunc ( |
| 241 | pCurDqLayer->pNzc[pCurDqLayer->iMbXyIndex]); // set all none-zero nzc to 1; dbk can be opti! | 241 | pCurDqLayer->pNzc[pCurDqLayer->iMbXyIndex]); // set all none-zero nzc to 1; dbk can be opti! |
| 242 | } | 242 | } |
| @@ -1365,7 +1365,7 @@ int32_t WelsDecodeMbCabacPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 1122 unmodified lines | |||
| 1365 | 1365 | ||
| 1366 | pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0; | 1366 | pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0; |
| 1367 | memset (pCurDqLayer->pDec->pRefIndex[0][iMbXy], 0, sizeof (int8_t) * 16); | 1367 | memset (pCurDqLayer->pDec->pRefIndex[0][iMbXy], 0, sizeof (int8_t) * 16); |
| 1368 | bool bIsPending = pCtx->pThreadCtx != NULL; | 1368 | bool bIsPending = GetThreadCount (pCtx) > 1; |
| 1369 | pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[0] && (ppRefPic[0]->bIsComplete | 1369 | pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[0] && (ppRefPic[0]->bIsComplete |
| 1370 | || bIsPending)); | 1370 | || bIsPending)); |
| 1371 | //predict mv | 1371 | //predict mv |
| @@ -1421,7 +1421,7 @@ int32_t WelsDecodeMbCabacBSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 49 unmodified lines | |||
| 1421 | 1421 | ||
| 1422 | memset (pCurDqLayer->pDirect[iMbXy], 0, sizeof (int8_t) * 16); | 1422 | memset (pCurDqLayer->pDirect[iMbXy], 0, sizeof (int8_t) * 16); |
| 1423 | 1423 | ||
| 1424 | bool bIsPending = pCtx->pThreadCtx != NULL; | 1424 | bool bIsPending = GetThreadCount (pCtx) > 1; |
| 1425 | 1425 | ||
| 1426 | if (uiCode) { | 1426 | if (uiCode) { |
| 1427 | int16_t pMv[LIST_A][2] = { {0, 0}, { 0, 0 } }; | 1427 | int16_t pMv[LIST_A][2] = { {0, 0}, { 0, 0 } }; |
| @@ -1696,7 +1696,7 @@ int32_t WelsDecodeAndConstructSlice (PWelsDecoderContext pCtx) { · 268 unmodified lines | |||
| 1696 | 1696 | ||
| 1697 | SDeblockingFilter pFilter; | 1697 | SDeblockingFilter pFilter; |
| 1698 | int32_t iFilterIdc = 1; | 1698 | int32_t iFilterIdc = 1; |
| 1699 | if (pCtx->pThreadCtx && pSliceHeader->uiDisableDeblockingFilterIdc != 1) { | 1699 | if (pSliceHeader->uiDisableDeblockingFilterIdc != 1) { |
| 1700 | WelsDeblockingInitFilter (pCtx, pFilter, iFilterIdc); | 1700 | WelsDeblockingInitFilter (pCtx, pFilter, iFilterIdc); |
| 1701 | } | 1701 | } |
| 1702 | 1702 | ||
| @@ -1764,11 +1764,15 @@ int32_t WelsDecodeAndConstructSlice (PWelsDecoderContext pCtx) { · 61 unmodified lines | |||
| 1764 | pCurDqLayer->iMbX = iMbX; | 1764 | pCurDqLayer->iMbX = iMbX; |
| 1765 | pCurDqLayer->iMbY = iMbY; | 1765 | pCurDqLayer->iMbY = iMbY; |
| 1766 | pCurDqLayer->iMbXyIndex = iNextMbXyIndex; | 1766 | pCurDqLayer->iMbXyIndex = iNextMbXyIndex; |
| 1767 | if ((iMbY > iLastMby) && (iLastMbx == pCurDqLayer->iMbWidth - 1)) { | 1767 | if (GetThreadCount (pCtx) > 1) { |
| 1768 | SET_EVENT (&pCtx->pDec->pReadyEvent[iLastMby]); | 1768 | if ((iMbY > iLastMby) && (iLastMbx == pCurDqLayer->iMbWidth - 1)) { |
| 1769 | SET_EVENT (&pCtx->pDec->pReadyEvent[iLastMby]); | ||
| 1770 | } | ||
| 1769 | } | 1771 | } |
| 1770 | } while (1); | 1772 | } while (1); |
| 1771 | SET_EVENT (&pCtx->pDec->pReadyEvent[pCurDqLayer->iMbY]); | 1773 | if (GetThreadCount (pCtx) > 1) { |
| 1774 | SET_EVENT (&pCtx->pDec->pReadyEvent[pCurDqLayer->iMbY]); | ||
| 1775 | } | ||
| 1772 | return ERR_NONE; | 1776 | return ERR_NONE; |
| 1773 | } | 1777 | } |
| 1774 | 1778 | ||
| @@ -2467,7 +2471,7 @@ int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 692 unmodified lines | |||
| 2467 | 2471 | ||
| 2468 | pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0; | 2472 | pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0; |
| 2469 | memset (pCurDqLayer->pDec->pRefIndex[0][iMbXy], 0, sizeof (int8_t) * 16); | 2473 | memset (pCurDqLayer->pDec->pRefIndex[0][iMbXy], 0, sizeof (int8_t) * 16); |
| 2470 | bool bIsPending = pCtx->pThreadCtx != NULL; | 2474 | bool bIsPending = GetThreadCount (pCtx) > 1; |
| 2471 | pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[0] && (ppRefPic[0]->bIsComplete | 2475 | pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[0] && (ppRefPic[0]->bIsComplete |
| 2472 | || bIsPending)); | 2476 | || bIsPending)); |
| 2473 | //predict iMv | 2477 | //predict iMv |
| @@ -2564,7 +2568,7 @@ int32_t WelsDecodeMbCavlcBSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 90 unmodified lines | |||
| 2564 | pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0; | 2568 | pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0; |
| 2565 | memset (pCurDqLayer->pDec->pRefIndex[LIST_0][iMbXy], 0, sizeof (int8_t) * 16); | 2569 | memset (pCurDqLayer->pDec->pRefIndex[LIST_0][iMbXy], 0, sizeof (int8_t) * 16); |
| 2566 | memset (pCurDqLayer->pDec->pRefIndex[LIST_1][iMbXy], 0, sizeof (int8_t) * 16); | 2570 | memset (pCurDqLayer->pDec->pRefIndex[LIST_1][iMbXy], 0, sizeof (int8_t) * 16); |
| 2567 | bool bIsPending = pCtx->pThreadCtx != NULL; | 2571 | bool bIsPending = GetThreadCount (pCtx) > 1; |
| 2568 | pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPicL0[0] && (ppRefPicL0[0]->bIsComplete | 2572 | pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPicL0[0] && (ppRefPicL0[0]->bIsComplete |
| 2569 | || bIsPending)) || ! (ppRefPicL1[0] && (ppRefPicL1[0]->bIsComplete || bIsPending)); | 2573 | || bIsPending)) || ! (ppRefPicL1[0] && (ppRefPicL1[0]->bIsComplete || bIsPending)); |
| 2570 | 2574 | ||