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/pic_queue.cpp (1 of 14 files). Show all
Unified · Split
| @@ -106,12 +106,14 @@ PPicture AllocPicture (PWelsDecoderContext pCtx, const int32_t kiPicWidth, const · 105 unmodified lines | ||
| 106 | 106 | pPic->iWidthInPixel = kiPicWidth; |
| 107 | 107 | pPic->iHeightInPixel = kiPicHeight; |
| 108 | 108 | pPic->iFrameNum = -1; |
| 109 | − pPic->bAvailableFlag = true; | |
| 109 | + pPic->iRefCount = 0; | |
| 110 | 110 | |
| 111 | 111 | uint32_t uiMbWidth = (kiPicWidth + 15) >> 4; |
| 112 | 112 | uint32_t uiMbHeight = (kiPicHeight + 15) >> 4; |
| 113 | 113 | uint32_t uiMbCount = uiMbWidth * uiMbHeight; |
| 114 | + | |
| 114 | 115 | pPic->pMbCorrectlyDecodedFlag = (bool*)pMa->WelsMallocz (uiMbCount * sizeof (bool), "pPic->pMbCorrectlyDecodedFlag"); |
| 116 | + | |
| 115 | 117 | pPic->pMbType = (uint32_t*)pMa->WelsMallocz (uiMbCount * sizeof (uint32_t), "pPic->pMbType"); |
| 116 | 118 | pPic->pMv[LIST_0] = (int16_t (*)[16][2])pMa->WelsMallocz (uiMbCount * sizeof ( |
| 117 | 119 | int16_t) * MV_A * MB_BLOCK4x4_NUM, "pPic->pMv[]"); |
| @@ -182,8 +184,8 @@ PPicture PrefetchPic (PPicBuff pPicBuf) { · 64 unmodified lines | ||
| 182 | 184 | } |
| 183 | 185 | |
| 184 | 186 | for (iPicIdx = pPicBuf->iCurrentIdx + 1; iPicIdx < pPicBuf->iCapacity ; ++iPicIdx) { |
| 185 | − if (pPicBuf->ppPic[iPicIdx] != NULL && pPicBuf->ppPic[iPicIdx]->bAvailableFlag | |
| 186 | − && !pPicBuf->ppPic[iPicIdx]->bUsedAsRef) { | |
| 187 | + if (pPicBuf->ppPic[iPicIdx] != NULL && !pPicBuf->ppPic[iPicIdx]->bUsedAsRef | |
| 188 | + && pPicBuf->ppPic[iPicIdx]->iRefCount <= 0) { | |
| 187 | 189 | pPic = pPicBuf->ppPic[iPicIdx]; |
| 188 | 190 | break; |
| 189 | 191 | } |
| @@ -194,8 +196,8 @@ PPicture PrefetchPic (PPicBuff pPicBuf) { · 4 unmodified lines | ||
| 194 | 196 | return pPic; |
| 195 | 197 | } |
| 196 | 198 | for (iPicIdx = 0 ; iPicIdx <= pPicBuf->iCurrentIdx ; ++iPicIdx) { |
| 197 | − if (pPicBuf->ppPic[iPicIdx] != NULL && pPicBuf->ppPic[iPicIdx]->bAvailableFlag | |
| 198 | − && !pPicBuf->ppPic[iPicIdx]->bUsedAsRef) { | |
| 199 | + if (pPicBuf->ppPic[iPicIdx] != NULL && !pPicBuf->ppPic[iPicIdx]->bUsedAsRef | |
| 200 | + && pPicBuf->ppPic[iPicIdx]->iRefCount <= 0) { | |
| 199 | 201 | pPic = pPicBuf->ppPic[iPicIdx]; |
| 200 | 202 | break; |
| 201 | 203 | } |