History

re-structure SWelsDecoderContext and others and prepare for the support of multi-threading support.

xiaotiansf committed 7 years ago

Commit 2f5ecec1 parent 9ed97c729 files · +2285 −1568Browse files

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

Unified · Split

codec/decoder/core/src/error_concealment.cpp+33−33
@@ -83,7 +83,7 @@ void InitErrorCon (PWelsDecoderContext pCtx) { · 82 unmodified lines
83//Do error concealment using frame copy method83//Do error concealment using frame copy method
84void DoErrorConFrameCopy (PWelsDecoderContext pCtx) {84void DoErrorConFrameCopy (PWelsDecoderContext pCtx) {
85 PPicture pDstPic = pCtx->pDec;85 PPicture pDstPic = pCtx->pDec;
86 PPicture pSrcPic = pCtx->pPreviousDecodedPictureInDpb;86 PPicture pSrcPic = pCtx->pLastDecPicInfo->pPreviousDecodedPictureInDpb;
87 uint32_t uiHeightInPixelY = (pCtx->pSps->iMbHeight) << 4;87 uint32_t uiHeightInPixelY = (pCtx->pSps->iMbHeight) << 4;
88 int32_t iStrideY = pDstPic->iLinesize[0];88 int32_t iStrideY = pDstPic->iLinesize[0];
89 int32_t iStrideUV = pDstPic->iLinesize[1];89 int32_t iStrideUV = pDstPic->iLinesize[1];
@@ -109,7 +109,7 @@ void DoErrorConSliceCopy (PWelsDecoderContext pCtx) { · 19 unmodified lines
109 int32_t iMbWidth = (int32_t) pCtx->pSps->iMbWidth;109 int32_t iMbWidth = (int32_t) pCtx->pSps->iMbWidth;
110 int32_t iMbHeight = (int32_t) pCtx->pSps->iMbHeight;110 int32_t iMbHeight = (int32_t) pCtx->pSps->iMbHeight;
111 PPicture pDstPic = pCtx->pDec;111 PPicture pDstPic = pCtx->pDec;
112 PPicture pSrcPic = pCtx->pPreviousDecodedPictureInDpb;112 PPicture pSrcPic = pCtx->pLastDecPicInfo->pPreviousDecodedPictureInDpb;
113 if ((pCtx->pParam->eEcActiveIdc == ERROR_CON_SLICE_COPY) && (pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt.bIdrFlag))113 if ((pCtx->pParam->eEcActiveIdc == ERROR_CON_SLICE_COPY) && (pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt.bIdrFlag))
114 pSrcPic = NULL; //no cross IDR method, should fill in data instead of copy114 pSrcPic = NULL; //no cross IDR method, should fill in data instead of copy
115 115
@@ -266,40 +266,40 @@ void GetAvilInfoFromCorrectMb (PWelsDecoderContext pCtx) { · 150 unmodified lines
266 for (int32_t iMbY = 0; iMbY < iMbHeight; ++iMbY) {266 for (int32_t iMbY = 0; iMbY < iMbHeight; ++iMbY) {
267 for (int32_t iMbX = 0; iMbX < iMbWidth; ++iMbX) {267 for (int32_t iMbX = 0; iMbX < iMbWidth; ++iMbX) {
268 iMbXyIndex = iMbY * iMbWidth + iMbX;268 iMbXyIndex = iMbY * iMbWidth + iMbX;
269 if (pMbCorrectlyDecodedFlag[iMbXyIndex] && IS_INTER (pCurDqLayer->pMbType[iMbXyIndex])) {269 if (pMbCorrectlyDecodedFlag[iMbXyIndex] && IS_INTER (pCurDqLayer->pDec->pMbType[iMbXyIndex])) {
270 uint32_t iMBType = pCurDqLayer->pMbType[iMbXyIndex];270 uint32_t iMBType = pCurDqLayer->pDec->pMbType[iMbXyIndex];
271 switch (iMBType) {271 switch (iMBType) {
272 case MB_TYPE_SKIP:272 case MB_TYPE_SKIP:
273 case MB_TYPE_16x16:273 case MB_TYPE_16x16:
274 iRefIdx = pCurDqLayer->pRefIndex[0][iMbXyIndex][0];274 iRefIdx = pCurDqLayer->pDec->pRefIndex[0][iMbXyIndex][0];
275 pCtx->iECMVs[iRefIdx][0] += pCurDqLayer->pMv[0][iMbXyIndex][0][0];275 pCtx->iECMVs[iRefIdx][0] += pCurDqLayer->pDec->pMv[0][iMbXyIndex][0][0];
276 pCtx->iECMVs[iRefIdx][1] += pCurDqLayer->pMv[0][iMbXyIndex][0][1];276 pCtx->iECMVs[iRefIdx][1] += pCurDqLayer->pDec->pMv[0][iMbXyIndex][0][1];
277 pCtx->pECRefPic[iRefIdx] = pCtx->sRefPic.pRefList[LIST_0][iRefIdx];277 pCtx->pECRefPic[iRefIdx] = pCtx->sRefPic.pRefList[LIST_0][iRefIdx];
278 iInterMbCorrectNum[iRefIdx]++;278 iInterMbCorrectNum[iRefIdx]++;
279 break;279 break;
280 case MB_TYPE_16x8:280 case MB_TYPE_16x8:
281 iRefIdx = pCurDqLayer->pRefIndex[0][iMbXyIndex][0];281 iRefIdx = pCurDqLayer->pDec->pRefIndex[0][iMbXyIndex][0];
282 pCtx->iECMVs[iRefIdx][0] += pCurDqLayer->pMv[0][iMbXyIndex][0][0];282 pCtx->iECMVs[iRefIdx][0] += pCurDqLayer->pDec->pMv[0][iMbXyIndex][0][0];
283 pCtx->iECMVs[iRefIdx][1] += pCurDqLayer->pMv[0][iMbXyIndex][0][1];283 pCtx->iECMVs[iRefIdx][1] += pCurDqLayer->pDec->pMv[0][iMbXyIndex][0][1];
284 pCtx->pECRefPic[iRefIdx] = pCtx->sRefPic.pRefList[LIST_0][iRefIdx];284 pCtx->pECRefPic[iRefIdx] = pCtx->sRefPic.pRefList[LIST_0][iRefIdx];
285 iInterMbCorrectNum[iRefIdx]++;285 iInterMbCorrectNum[iRefIdx]++;
286 286
287 iRefIdx = pCurDqLayer->pRefIndex[0][iMbXyIndex][8];287 iRefIdx = pCurDqLayer->pDec->pRefIndex[0][iMbXyIndex][8];
288 pCtx->iECMVs[iRefIdx][0] += pCurDqLayer->pMv[0][iMbXyIndex][8][0];288 pCtx->iECMVs[iRefIdx][0] += pCurDqLayer->pDec->pMv[0][iMbXyIndex][8][0];
289 pCtx->iECMVs[iRefIdx][1] += pCurDqLayer->pMv[0][iMbXyIndex][8][1];289 pCtx->iECMVs[iRefIdx][1] += pCurDqLayer->pDec->pMv[0][iMbXyIndex][8][1];
290 pCtx->pECRefPic[iRefIdx] = pCtx->sRefPic.pRefList[LIST_0][iRefIdx];290 pCtx->pECRefPic[iRefIdx] = pCtx->sRefPic.pRefList[LIST_0][iRefIdx];
291 iInterMbCorrectNum[iRefIdx]++;291 iInterMbCorrectNum[iRefIdx]++;
292 break;292 break;
293 case MB_TYPE_8x16:293 case MB_TYPE_8x16:
294 iRefIdx = pCurDqLayer->pRefIndex[0][iMbXyIndex][0];294 iRefIdx = pCurDqLayer->pDec->pRefIndex[0][iMbXyIndex][0];
295 pCtx->iECMVs[iRefIdx][0] += pCurDqLayer->pMv[0][iMbXyIndex][0][0];295 pCtx->iECMVs[iRefIdx][0] += pCurDqLayer->pDec->pMv[0][iMbXyIndex][0][0];
296 pCtx->iECMVs[iRefIdx][1] += pCurDqLayer->pMv[0][iMbXyIndex][0][1];296 pCtx->iECMVs[iRefIdx][1] += pCurDqLayer->pDec->pMv[0][iMbXyIndex][0][1];
297 pCtx->pECRefPic[iRefIdx] = pCtx->sRefPic.pRefList[LIST_0][iRefIdx];297 pCtx->pECRefPic[iRefIdx] = pCtx->sRefPic.pRefList[LIST_0][iRefIdx];
298 iInterMbCorrectNum[iRefIdx]++;298 iInterMbCorrectNum[iRefIdx]++;
299 299
300 iRefIdx = pCurDqLayer->pRefIndex[0][iMbXyIndex][2];300 iRefIdx = pCurDqLayer->pDec->pRefIndex[0][iMbXyIndex][2];
301 pCtx->iECMVs[iRefIdx][0] += pCurDqLayer->pMv[0][iMbXyIndex][2][0];301 pCtx->iECMVs[iRefIdx][0] += pCurDqLayer->pDec->pMv[0][iMbXyIndex][2][0];
302 pCtx->iECMVs[iRefIdx][1] += pCurDqLayer->pMv[0][iMbXyIndex][2][1];302 pCtx->iECMVs[iRefIdx][1] += pCurDqLayer->pDec->pMv[0][iMbXyIndex][2][1];
303 pCtx->pECRefPic[iRefIdx] = pCtx->sRefPic.pRefList[LIST_0][iRefIdx];303 pCtx->pECRefPic[iRefIdx] = pCtx->sRefPic.pRefList[LIST_0][iRefIdx];
304 iInterMbCorrectNum[iRefIdx]++;304 iInterMbCorrectNum[iRefIdx]++;
305 break;305 break;
@@ -311,39 +311,39 @@ void GetAvilInfoFromCorrectMb (PWelsDecoderContext pCtx) { · 5 unmodified lines
311 for (i = 0; i < 4; i++) {311 for (i = 0; i < 4; i++) {
312 iSubMBType = pCurDqLayer->pSubMbType[iMbXyIndex][i];312 iSubMBType = pCurDqLayer->pSubMbType[iMbXyIndex][i];
313 iIIdx = ((i >> 1) << 3) + ((i & 1) << 1);313 iIIdx = ((i >> 1) << 3) + ((i & 1) << 1);
314 iRefIdx = pCurDqLayer->pRefIndex[0][iMbXyIndex][iIIdx];314 iRefIdx = pCurDqLayer->pDec->pRefIndex[0][iMbXyIndex][iIIdx];
315 pCtx->pECRefPic[iRefIdx] = pCtx->sRefPic.pRefList[LIST_0][iRefIdx];315 pCtx->pECRefPic[iRefIdx] = pCtx->sRefPic.pRefList[LIST_0][iRefIdx];
316 switch (iSubMBType) {316 switch (iSubMBType) {
317 case SUB_MB_TYPE_8x8:317 case SUB_MB_TYPE_8x8:
318 pCtx->iECMVs[iRefIdx][0] += pCurDqLayer->pMv[0][iMbXyIndex][iIIdx][0];318 pCtx->iECMVs[iRefIdx][0] += pCurDqLayer->pDec->pMv[0][iMbXyIndex][iIIdx][0];
319 pCtx->iECMVs[iRefIdx][1] += pCurDqLayer->pMv[0][iMbXyIndex][iIIdx][1];319 pCtx->iECMVs[iRefIdx][1] += pCurDqLayer->pDec->pMv[0][iMbXyIndex][iIIdx][1];
320 iInterMbCorrectNum[iRefIdx]++;320 iInterMbCorrectNum[iRefIdx]++;
321 321
322 break;322 break;
323 case SUB_MB_TYPE_8x4:323 case SUB_MB_TYPE_8x4:
324 pCtx->iECMVs[iRefIdx][0] += pCurDqLayer->pMv[0][iMbXyIndex][iIIdx][0];324 pCtx->iECMVs[iRefIdx][0] += pCurDqLayer->pDec->pMv[0][iMbXyIndex][iIIdx][0];
325 pCtx->iECMVs[iRefIdx][1] += pCurDqLayer->pMv[0][iMbXyIndex][iIIdx][1];325 pCtx->iECMVs[iRefIdx][1] += pCurDqLayer->pDec->pMv[0][iMbXyIndex][iIIdx][1];
326 326
327 327
328 pCtx->iECMVs[iRefIdx][0] += pCurDqLayer->pMv[0][iMbXyIndex][iIIdx + 4][0];328 pCtx->iECMVs[iRefIdx][0] += pCurDqLayer->pDec->pMv[0][iMbXyIndex][iIIdx + 4][0];
329 pCtx->iECMVs[iRefIdx][1] += pCurDqLayer->pMv[0][iMbXyIndex][iIIdx + 4][1];329 pCtx->iECMVs[iRefIdx][1] += pCurDqLayer->pDec->pMv[0][iMbXyIndex][iIIdx + 4][1];
330 iInterMbCorrectNum[iRefIdx] += 2;330 iInterMbCorrectNum[iRefIdx] += 2;
331 331
332 break;332 break;
333 case SUB_MB_TYPE_4x8:333 case SUB_MB_TYPE_4x8:
334 pCtx->iECMVs[iRefIdx][0] += pCurDqLayer->pMv[0][iMbXyIndex][iIIdx][0];334 pCtx->iECMVs[iRefIdx][0] += pCurDqLayer->pDec->pMv[0][iMbXyIndex][iIIdx][0];
335 pCtx->iECMVs[iRefIdx][1] += pCurDqLayer->pMv[0][iMbXyIndex][iIIdx][1];335 pCtx->iECMVs[iRefIdx][1] += pCurDqLayer->pDec->pMv[0][iMbXyIndex][iIIdx][1];
336 336
337 337
338 pCtx->iECMVs[iRefIdx][0] += pCurDqLayer->pMv[0][iMbXyIndex][iIIdx + 1][0];338 pCtx->iECMVs[iRefIdx][0] += pCurDqLayer->pDec->pMv[0][iMbXyIndex][iIIdx + 1][0];
339 pCtx->iECMVs[iRefIdx][1] += pCurDqLayer->pMv[0][iMbXyIndex][iIIdx + 1][1];339 pCtx->iECMVs[iRefIdx][1] += pCurDqLayer->pDec->pMv[0][iMbXyIndex][iIIdx + 1][1];
340 iInterMbCorrectNum[iRefIdx] += 2;340 iInterMbCorrectNum[iRefIdx] += 2;
341 break;341 break;
342 case SUB_MB_TYPE_4x4: {342 case SUB_MB_TYPE_4x4: {
343 for (j = 0; j < 4; j++) {343 for (j = 0; j < 4; j++) {
344 iJIdx = ((j >> 1) << 2) + (j & 1);344 iJIdx = ((j >> 1) << 2) + (j & 1);
345 pCtx->iECMVs[iRefIdx][0] += pCurDqLayer->pMv[0][iMbXyIndex][iIIdx + iJIdx][0];345 pCtx->iECMVs[iRefIdx][0] += pCurDqLayer->pDec->pMv[0][iMbXyIndex][iIIdx + iJIdx][0];
346 pCtx->iECMVs[iRefIdx][1] += pCurDqLayer->pMv[0][iMbXyIndex][iIIdx + iJIdx][1];346 pCtx->iECMVs[iRefIdx][1] += pCurDqLayer->pDec->pMv[0][iMbXyIndex][iIIdx + iJIdx][1];
347 }347 }
348 iInterMbCorrectNum[iRefIdx] += 4;348 iInterMbCorrectNum[iRefIdx] += 4;
349 }349 }
@@ -372,7 +372,7 @@ void DoErrorConSliceMVCopy (PWelsDecoderContext pCtx) { · 22 unmodified lines
372 int32_t iMbWidth = (int32_t) pCtx->pSps->iMbWidth;372 int32_t iMbWidth = (int32_t) pCtx->pSps->iMbWidth;
373 int32_t iMbHeight = (int32_t) pCtx->pSps->iMbHeight;373 int32_t iMbHeight = (int32_t) pCtx->pSps->iMbHeight;
374 PPicture pDstPic = pCtx->pDec;374 PPicture pDstPic = pCtx->pDec;
375 PPicture pSrcPic = pCtx->pPreviousDecodedPictureInDpb;375 PPicture pSrcPic = pCtx->pLastDecPicInfo->pPreviousDecodedPictureInDpb;
376 376
377 bool* pMbCorrectlyDecodedFlag = pCtx->pCurDqLayer->pMbCorrectlyDecodedFlag;377 bool* pMbCorrectlyDecodedFlag = pCtx->pCurDqLayer->pMbCorrectlyDecodedFlag;
378 int32_t iMbXyIndex;378 int32_t iMbXyIndex;

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