Showing the changes to codec/decoder/core/src/error_concealment.cpp (1 of 4 files). Show all
Unified · Split
| @@ -82,6 +82,8 @@ void DoErrorConFrameCopy (PWelsDecoderContext pCtx) { · 81 unmodified lines | |||
| 82 | uint32_t uiHeightInPixelY = (pCtx->pSps->iMbHeight) << 4; | 82 | uint32_t uiHeightInPixelY = (pCtx->pSps->iMbHeight) << 4; |
| 83 | int32_t iStrideY = pDstPic->iLinesize[0]; | 83 | int32_t iStrideY = pDstPic->iLinesize[0]; |
| 84 | int32_t iStrideUV = pDstPic->iLinesize[1]; | 84 | int32_t iStrideUV = pDstPic->iLinesize[1]; |
| 85 | pCtx->iMbNum = pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight; | ||
| 86 | pCtx->iMbEcedNum = pCtx->iMbNum; | ||
| 85 | if ((pCtx->eErrorConMethod == ERROR_CON_FRAME_COPY) && (pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt.bIdrFlag)) | 87 | if ((pCtx->eErrorConMethod == ERROR_CON_FRAME_COPY) && (pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt.bIdrFlag)) |
| 86 | pSrcPic = NULL; //no cross IDR method, should fill in data instead of copy | 88 | pSrcPic = NULL; //no cross IDR method, should fill in data instead of copy |
| 87 | if (pSrcPic == NULL) { //no ref pic, assign specific data to picture | 89 | if (pSrcPic == NULL) { //no ref pic, assign specific data to picture |
| @@ -105,10 +107,10 @@ void DoErrorConSliceCopy (PWelsDecoderContext pCtx) { · 17 unmodified lines | |||
| 105 | if ((pCtx->eErrorConMethod == ERROR_CON_SLICE_COPY) && (pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt.bIdrFlag)) | 107 | if ((pCtx->eErrorConMethod == ERROR_CON_SLICE_COPY) && (pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt.bIdrFlag)) |
| 106 | pSrcPic = NULL; //no cross IDR method, should fill in data instead of copy | 108 | pSrcPic = NULL; //no cross IDR method, should fill in data instead of copy |
| 107 | 109 | ||
| 108 | int32_t iMbNum = pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight; | 110 | pCtx->iMbNum = pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight; |
| 109 | //uint8_t *pDstData[3], *pSrcData[3]; | 111 | //uint8_t *pDstData[3], *pSrcData[3]; |
| 110 | bool* pMbCorrectlyDecodedFlag = pCtx->pCurDqLayer->pMbCorrectlyDecodedFlag; | 112 | bool* pMbCorrectlyDecodedFlag = pCtx->pCurDqLayer->pMbCorrectlyDecodedFlag; |
| 111 | int32_t iMbEcedNum = 0; | 113 | pCtx->iMbEcedNum = 0; |
| 112 | //Do slice copy late | 114 | //Do slice copy late |
| 113 | int32_t iMbXyIndex; | 115 | int32_t iMbXyIndex; |
| 114 | uint8_t* pSrcData, *pDstData; | 116 | uint8_t* pSrcData, *pDstData; |
| @@ -118,7 +120,7 @@ void DoErrorConSliceCopy (PWelsDecoderContext pCtx) { · 3 unmodified lines | |||
| 118 | for (int32_t iMbX = 0; iMbX < iMbWidth; ++iMbX) { | 120 | for (int32_t iMbX = 0; iMbX < iMbWidth; ++iMbX) { |
| 119 | iMbXyIndex = iMbY * iMbWidth + iMbX; | 121 | iMbXyIndex = iMbY * iMbWidth + iMbX; |
| 120 | if (!pMbCorrectlyDecodedFlag[iMbXyIndex]) { | 122 | if (!pMbCorrectlyDecodedFlag[iMbXyIndex]) { |
| 121 | iMbEcedNum++; | 123 | pCtx->iMbEcedNum++; |
| 122 | if (pSrcPic != NULL) { | 124 | if (pSrcPic != NULL) { |
| 123 | iSrcStride = pSrcPic->iLinesize[0]; | 125 | iSrcStride = pSrcPic->iLinesize[0]; |
| 124 | //Y component | 126 | //Y component |
| @@ -156,10 +158,6 @@ void DoErrorConSliceCopy (PWelsDecoderContext pCtx) { · 31 unmodified lines | |||
| 156 | } //!pMbCorrectlyDecodedFlag[iMbXyIndex] | 158 | } //!pMbCorrectlyDecodedFlag[iMbXyIndex] |
| 157 | } //iMbX | 159 | } //iMbX |
| 158 | } //iMbY | 160 | } //iMbY |
| 159 | |||
| 160 | if (!pCtx->bFreezeOutput) | ||
| 161 | pCtx->sDecoderStatistics.uiAvgEcRatio = (pCtx->sDecoderStatistics.uiAvgEcRatio * pCtx->sDecoderStatistics.uiEcFrameNum) | ||
| 162 | + ((iMbEcedNum * 100) / iMbNum) ; | ||
| 163 | } | 161 | } |
| 164 | 162 | ||
| 165 | //Do error concealment using slice MV copy method | 163 | //Do error concealment using slice MV copy method |
| @@ -368,9 +366,9 @@ void DoErrorConSliceMVCopy (PWelsDecoderContext pCtx) { · 202 unmodified lines | |||
| 368 | PPicture pDstPic = pCtx->pDec; | 366 | PPicture pDstPic = pCtx->pDec; |
| 369 | PPicture pSrcPic = pCtx->pPreviousDecodedPictureInDpb; | 367 | PPicture pSrcPic = pCtx->pPreviousDecodedPictureInDpb; |
| 370 | 368 | ||
| 371 | int32_t iMbNum = pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight; | 369 | pCtx->iMbNum = pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight; |
| 372 | bool* pMbCorrectlyDecodedFlag = pCtx->pCurDqLayer->pMbCorrectlyDecodedFlag; | 370 | bool* pMbCorrectlyDecodedFlag = pCtx->pCurDqLayer->pMbCorrectlyDecodedFlag; |
| 373 | int32_t iMbEcedNum = 0; | 371 | pCtx->iMbEcedNum = 0; |
| 374 | int32_t iMbXyIndex; | 372 | int32_t iMbXyIndex; |
| 375 | uint8_t* pDstData; | 373 | uint8_t* pDstData; |
| 376 | uint32_t iDstStride = pDstPic->iLinesize[0]; | 374 | uint32_t iDstStride = pDstPic->iLinesize[0]; |
| @@ -395,7 +393,7 @@ void DoErrorConSliceMVCopy (PWelsDecoderContext pCtx) { · 18 unmodified lines | |||
| 395 | for (int32_t iMbX = 0; iMbX < iMbWidth; ++iMbX) { | 393 | for (int32_t iMbX = 0; iMbX < iMbWidth; ++iMbX) { |
| 396 | iMbXyIndex = iMbY * iMbWidth + iMbX; | 394 | iMbXyIndex = iMbY * iMbWidth + iMbX; |
| 397 | if (!pMbCorrectlyDecodedFlag[iMbXyIndex]) { | 395 | if (!pMbCorrectlyDecodedFlag[iMbXyIndex]) { |
| 398 | iMbEcedNum++; | 396 | pCtx->iMbEcedNum++; |
| 399 | if (pSrcPic != NULL) { | 397 | if (pSrcPic != NULL) { |
| 400 | DoMbECMvCopy (pCtx, pDstPic, pSrcPic, iMbXyIndex, iMbX, iMbY, &sMCRefMem); | 398 | DoMbECMvCopy (pCtx, pDstPic, pSrcPic, iMbXyIndex, iMbX, iMbY, &sMCRefMem); |
| 401 | } else { //pSrcPic == NULL | 399 | } else { //pSrcPic == NULL |
| @@ -422,10 +420,6 @@ void DoErrorConSliceMVCopy (PWelsDecoderContext pCtx) { · 20 unmodified lines | |||
| 422 | } //!pMbCorrectlyDecodedFlag[iMbXyIndex] | 420 | } //!pMbCorrectlyDecodedFlag[iMbXyIndex] |
| 423 | } //iMbX | 421 | } //iMbX |
| 424 | } //iMbY | 422 | } //iMbY |
| 425 | |||
| 426 | if (!pCtx->bFreezeOutput) | ||
| 427 | pCtx->sDecoderStatistics.uiAvgEcRatio = (pCtx->sDecoderStatistics.uiAvgEcRatio * pCtx->sDecoderStatistics.uiEcFrameNum) | ||
| 428 | + ((iMbEcedNum * 100) / iMbNum) ; | ||
| 429 | } | 423 | } |
| 430 | 424 | ||
| 431 | //Mark erroneous frame as Ref Pic into DPB | 425 | //Mark erroneous frame as Ref Pic into DPB |