History

second commit for threaded decoding support: Add function WelsDecodeAndConstructSlice (and add associted functions) which combines decoding->reconstructing->deblocking in single MB loop so that it allows multile frames to decode MBs in parallel.

xiaotiansf committed 7 years ago

Commit fd42f041 parent 2f5ecec22 files · +924 −190Browse files

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

Unified · Split

codec/decoder/core/src/pic_queue.cpp+31−0
@@ -121,6 +121,15 @@ PPicture AllocPicture (PWelsDecoderContext pCtx, const int32_t kiPicWidth, const · 120 unmodified lines
121 int8_t) * MB_BLOCK4x4_NUM, "pCtx->sMb.pRefIndex[]");121 int8_t) * MB_BLOCK4x4_NUM, "pCtx->sMb.pRefIndex[]");
122 pPic->pRefIndex[LIST_1] = (int8_t (*)[16])pMa->WelsMallocz (uiMbCount * sizeof (122 pPic->pRefIndex[LIST_1] = (int8_t (*)[16])pMa->WelsMallocz (uiMbCount * sizeof (
123 int8_t) * MB_BLOCK4x4_NUM, "pCtx->sMb.pRefIndex[]");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 return pPic;133 return pPic;
125}134}
126 135
@@ -147,6 +156,14 @@ void FreePicture (PPicture pPic, CMemoryAlign* pMa) { · 20 unmodified lines
147 pPic->pRefIndex[listIdx] = NULL;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 pMa->WelsFree (pPic, "pPic");167 pMa->WelsFree (pPic, "pPic");
151 pPic = NULL;168 pPic = NULL;
152 }169 }
@@ -186,4 +203,18 @@ PPicture PrefetchPic (PPicBuff pPicBuf) { · 33 unmodified lines
186 return pPic;203 return pPic;
187}204}
188 205
206PPicture 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} // namespace WelsDec220} // namespace WelsDec

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