History

Threaded decoding enhancement:

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.

xiaotiansf committed 7 years ago

Commit e7f5f6a1 parent 033c6a014 files · +125 −104Browse files

Showing the changes to codec/decoder/core/src/decode_slice.cpp (1 of 14 files). Show all

Unified · Split

codec/decoder/core/src/decode_slice.cpp+13−9
@@ -236,7 +236,7 @@ int32_t WelsMbInterConstruction (PWelsDecoderContext pCtx, PDqLayer pCurDqLayer) · 235 unmodified lines
236236 }
237237 WelsMbInterSampleConstruction (pCtx, pCurDqLayer, pDstY, pDstCb, pDstCr, iLumaStride, iChromaStride);
238238
239− if (pCtx->pThreadCtx == NULL) {
239+ if (GetThreadCount (pCtx) <= 1) {
240240 pCtx->sBlockFunc.pWelsSetNonZeroCountFunc (
241241 pCurDqLayer->pNzc[pCurDqLayer->iMbXyIndex]); // set all none-zero nzc to 1; dbk can be opti!
242242 }
@@ -1365,7 +1365,7 @@ int32_t WelsDecodeMbCabacPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 1122 unmodified lines
13651365
13661366 pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0;
13671367 memset (pCurDqLayer->pDec->pRefIndex[0][iMbXy], 0, sizeof (int8_t) * 16);
1368− bool bIsPending = pCtx->pThreadCtx != NULL;
1368+ bool bIsPending = GetThreadCount (pCtx) > 1;
13691369 pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[0] && (ppRefPic[0]->bIsComplete
13701370 || bIsPending));
13711371 //predict mv
@@ -1421,7 +1421,7 @@ int32_t WelsDecodeMbCabacBSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 49 unmodified lines
14211421
14221422 memset (pCurDqLayer->pDirect[iMbXy], 0, sizeof (int8_t) * 16);
14231423
1424− bool bIsPending = pCtx->pThreadCtx != NULL;
1424+ bool bIsPending = GetThreadCount (pCtx) > 1;
14251425
14261426 if (uiCode) {
14271427 int16_t pMv[LIST_A][2] = { {0, 0}, { 0, 0 } };
@@ -1696,7 +1696,7 @@ int32_t WelsDecodeAndConstructSlice (PWelsDecoderContext pCtx) { · 268 unmodified lines
16961696
16971697 SDeblockingFilter pFilter;
16981698 int32_t iFilterIdc = 1;
1699− if (pCtx->pThreadCtx && pSliceHeader->uiDisableDeblockingFilterIdc != 1) {
1699+ if (pSliceHeader->uiDisableDeblockingFilterIdc != 1) {
17001700 WelsDeblockingInitFilter (pCtx, pFilter, iFilterIdc);
17011701 }
17021702
@@ -1764,11 +1764,15 @@ int32_t WelsDecodeAndConstructSlice (PWelsDecoderContext pCtx) { · 61 unmodified lines
17641764 pCurDqLayer->iMbX = iMbX;
17651765 pCurDqLayer->iMbY = iMbY;
17661766 pCurDqLayer->iMbXyIndex = iNextMbXyIndex;
1767− if ((iMbY > iLastMby) && (iLastMbx == pCurDqLayer->iMbWidth - 1)) {
1768− SET_EVENT (&pCtx->pDec->pReadyEvent[iLastMby]);
1767+ if (GetThreadCount (pCtx) > 1) {
1768+ if ((iMbY > iLastMby) && (iLastMbx == pCurDqLayer->iMbWidth - 1)) {
1769+ SET_EVENT (&pCtx->pDec->pReadyEvent[iLastMby]);
1770+ }
17691771 }
17701772 } while (1);
1771− SET_EVENT (&pCtx->pDec->pReadyEvent[pCurDqLayer->iMbY]);
1773+ if (GetThreadCount (pCtx) > 1) {
1774+ SET_EVENT (&pCtx->pDec->pReadyEvent[pCurDqLayer->iMbY]);
1775+ }
17721776 return ERR_NONE;
17731777 }
17741778
@@ -2467,7 +2471,7 @@ int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 692 unmodified lines
24672471
24682472 pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0;
24692473 memset (pCurDqLayer->pDec->pRefIndex[0][iMbXy], 0, sizeof (int8_t) * 16);
2470− bool bIsPending = pCtx->pThreadCtx != NULL;
2474+ bool bIsPending = GetThreadCount (pCtx) > 1;
24712475 pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[0] && (ppRefPic[0]->bIsComplete
24722476 || bIsPending));
24732477 //predict iMv
@@ -2564,7 +2568,7 @@ int32_t WelsDecodeMbCavlcBSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 90 unmodified lines
25642568 pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0;
25652569 memset (pCurDqLayer->pDec->pRefIndex[LIST_0][iMbXy], 0, sizeof (int8_t) * 16);
25662570 memset (pCurDqLayer->pDec->pRefIndex[LIST_1][iMbXy], 0, sizeof (int8_t) * 16);
2567− bool bIsPending = pCtx->pThreadCtx != NULL;
2571+ bool bIsPending = GetThreadCount (pCtx) > 1;
25682572 pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPicL0[0] && (ppRefPicL0[0]->bIsComplete
25692573 || bIsPending)) || ! (ppRefPicL1[0] && (ppRefPicL1[0]->bIsComplete || bIsPending));
25702574

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t