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/decoder.cpp (1 of 14 files). Show all

Unified · Split

codec/decoder/core/src/decoder.cpp+5−7
@@ -151,8 +151,7 @@ static int32_t IncreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co · 150 unmodified lines
151151 for (int32_t i = 0; i < pPicNewBuf->iCapacity; i++) {
152152 pPicNewBuf->ppPic[i]->bUsedAsRef = false;
153153 pPicNewBuf->ppPic[i]->bIsLongRef = false;
154− pPicNewBuf->ppPic[i]->uiRefCount = 0;
155− pPicNewBuf->ppPic[i]->bAvailableFlag = true;
154+ pPicNewBuf->ppPic[i]->iRefCount = 0;
156155 pPicNewBuf->ppPic[i]->bIsComplete = false;
157156 }
158157 // remove old PicBuf
@@ -240,8 +239,7 @@ static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co · 81 unmodified lines
240239 for (int32_t i = 0; i < pPicNewBuf->iCapacity; i++) {
241240 pPicNewBuf->ppPic[i]->bUsedAsRef = false;
242241 pPicNewBuf->ppPic[i]->bIsLongRef = false;
243− pPicNewBuf->ppPic[i]->uiRefCount = 0;
244− pPicNewBuf->ppPic[i]->bAvailableFlag = true;
242+ pPicNewBuf->ppPic[i]->iRefCount = 0;
245243 pPicNewBuf->ppPic[i]->bIsComplete = false;
246244 }
247245 // remove old PicBuf
@@ -440,7 +438,7 @@ static inline int32_t GetTargetRefListSize (PWelsDecoderContext pCtx) { · 192 unmodified lines
440438 iNumRefFrames = MAX_REF_PIC_COUNT + 2;
441439 } else {
442440 iNumRefFrames = pCtx->pSps->iNumRefFrames + 2;
443− if (pCtx->pThreadCtx != NULL) {
441+ if (GetThreadCount (pCtx) > 1) {
444442 iNumRefFrames = MAX_REF_PIC_COUNT + 1;
445443 }
446444 }
@@ -484,7 +482,7 @@ int32_t WelsRequestMem (PWelsDecoderContext pCtx, const int32_t kiMbWidth, const · 37 unmodified lines
484482 && kiPicHeight == pCtx->iImgHeightInPixel) && (!bNeedChangePicQueue)) // have same scaled buffer
485483
486484 // sync update pRefList
487− if (pCtx->pThreadCtx == NULL) {
485+ if (GetThreadCount (pCtx) <= 1) {
488486 WelsResetRefPic (pCtx); // added to sync update ref list due to pictures are free
489487 }
490488
@@ -562,7 +560,7 @@ void WelsFreeDynamicMemory (PWelsDecoderContext pCtx) { · 71 unmodified lines
562560 if (NULL != pPicBuff && NULL != *pPicBuff) {
563561 DestroyPicBuff (pCtx, pPicBuff, pMa);
564562 }
565− if (pCtx->pThreadCtx != NULL) {
563+ if (GetThreadCount (pCtx) > 1) {
566564 //prevent from double destruction of PPicBuff
567565 PWelsDecoderThreadCTX pThreadCtx = (PWelsDecoderThreadCTX) (pCtx->pThreadCtx);
568566 int32_t threadCount = pThreadCtx->sThreadInfo.uiThrMaxNum;

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