Showing the changes to codec/decoder/core/src/pic_queue.cpp (1 of 22 files). Show all
Unified · Split
| @@ -121,6 +121,15 @@ PPicture AllocPicture (PWelsDecoderContext pCtx, const int32_t kiPicWidth, const · 120 unmodified lines | ||
| 121 | 121 | int8_t) * MB_BLOCK4x4_NUM, "pCtx->sMb.pRefIndex[]"); |
| 122 | 122 | pPic->pRefIndex[LIST_1] = (int8_t (*)[16])pMa->WelsMallocz (uiMbCount * sizeof ( |
| 123 | 123 | int8_t) * MB_BLOCK4x4_NUM, "pCtx->sMb.pRefIndex[]"); |
| 124 | + if (pCtx->pThreadCtx != NULL) { | |
| 125 | + pPic->pReadyEvent = (SWelsDecEvent*)pMa->WelsMallocz (uiMbHeight * sizeof (SWelsDecEvent), "pPic->pReadyEvent"); | |
| 126 | + for (uint32_t i = 0; i < uiMbHeight; ++i) { | |
| 127 | + CREATE_EVENT (&pPic->pReadyEvent[i], 1, 0, NULL); | |
| 128 | + } | |
| 129 | + } else { | |
| 130 | + pPic->pReadyEvent = NULL; | |
| 131 | + } | |
| 132 | + | |
| 124 | 133 | return pPic; |
| 125 | 134 | } |
| 126 | 135 | |
| @@ -147,6 +156,14 @@ void FreePicture (PPicture pPic, CMemoryAlign* pMa) { · 20 unmodified lines | ||
| 147 | 156 | pPic->pRefIndex[listIdx] = NULL; |
| 148 | 157 | } |
| 149 | 158 | } |
| 159 | + if (pPic->pReadyEvent != NULL) { | |
| 160 | + uint32_t uiMbHeight = (pPic->iHeightInPixel + 15) >> 4; | |
| 161 | + for (uint32_t i = 0; i < uiMbHeight; ++i) { | |
| 162 | + CLOSE_EVENT (&pPic->pReadyEvent[i]); | |
| 163 | + } | |
| 164 | + pMa->WelsFree (pPic->pReadyEvent, "pPic->pReadyEvent"); | |
| 165 | + pPic->pReadyEvent = NULL; | |
| 166 | + } | |
| 150 | 167 | pMa->WelsFree (pPic, "pPic"); |
| 151 | 168 | pPic = NULL; |
| 152 | 169 | } |
| @@ -186,4 +203,18 @@ PPicture PrefetchPic (PPicBuff pPicBuf) { · 33 unmodified lines | ||
| 186 | 203 | return pPic; |
| 187 | 204 | } |
| 188 | 205 | |
| 206 | +PPicture PrefetchPicForThread (PPicBuff pPicBuf) { | |
| 207 | + PPicture pPic = NULL; | |
| 208 | + | |
| 209 | + if (pPicBuf->iCapacity == 0) { | |
| 210 | + return NULL; | |
| 211 | + } | |
| 212 | + pPic = pPicBuf->ppPic[pPicBuf->iCurrentIdx]; | |
| 213 | + pPic->iPicBuffIdx = pPicBuf->iCurrentIdx; | |
| 214 | + if (++pPicBuf->iCurrentIdx >= pPicBuf->iCapacity) { | |
| 215 | + pPicBuf->iCurrentIdx = 0; | |
| 216 | + } | |
| 217 | + return pPic; | |
| 218 | +} | |
| 219 | + | |
| 189 | 220 | } // namespace WelsDec |