Showing the changes to codec/decoder (2 of 2 files). Show all
Unified · Split
| @@ -1641,11 +1641,6 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 1640 unmodified lines | ||
| 1641 | 1641 | |
| 1642 | 1642 | WelsDecodeAccessUnitEnd (pCtx); |
| 1643 | 1643 | |
| 1644 | − if (!pCtx->bInstantDecFlag) { | |
| 1645 | − //Do error concealment here | |
| 1646 | − ImplementErrorCon (pCtx); | |
| 1647 | − } | |
| 1648 | − | |
| 1649 | 1644 | pCtx->bNewSeqBegin = false; |
| 1650 | 1645 | WriteBackActiveParameters (pCtx); |
| 1651 | 1646 | pCtx->bNewSeqBegin = pCtx->bNewSeqBegin || pCtx->bNextNewSeqBegin; |
| @@ -1943,6 +1938,14 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 291 unmodified lines | ||
| 1943 | 1938 | #endif//#if !CODEC_FOR_TESTBED |
| 1944 | 1939 | |
| 1945 | 1940 | if (dq_cur->uiLayerDqId == kuiTargetLayerDqId) { |
| 1941 | + if (!pCtx->bInstantDecFlag) { | |
| 1942 | + //Do error concealment here | |
| 1943 | + if (NeedErrorCon (pCtx)) { | |
| 1944 | + ImplementErrorCon (pCtx); | |
| 1945 | + pCtx->iTotalNumMbRec = pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight; | |
| 1946 | + } | |
| 1947 | + } | |
| 1948 | + | |
| 1946 | 1949 | if (DecodeFrameConstruction (pCtx, ppDst, pDstInfo)) { |
| 1947 | 1950 | return ERR_NONE; |
| 1948 | 1951 | } |
| @@ -1979,15 +1982,17 @@ bool CheckAndDoEC (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstI · 30 unmodified lines | ||
| 1979 | 1982 | if ((pCtx->iTotalNumMbRec != 0) |
| 1980 | 1983 | && (CheckAccessUnitBoundaryExt (&pCtx->sLastNalHdrExt, &pCurNal->sNalHeaderExt, &pCtx->sLastSliceHeader, |
| 1981 | 1984 | &pCurNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader))) { |
| 1982 | − pCtx->iTotalNumMbRec = pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight; | |
| 1983 | − DecodeFrameConstruction (pCtx, ppDst, pDstInfo); | |
| 1984 | − PPicture pCurPic = pCtx->pDec; //temporally store current picture | |
| 1985 | 1985 | //Do Error Concealment here |
| 1986 | − ImplementErrorCon (pCtx); | |
| 1987 | − pCtx->pPreviousDecodedPictureInDpb = pCurPic; //save ECed pic for future use | |
| 1988 | − pCtx->iPrevFrameNum = pCtx->sLastSliceHeader.iFrameNum; //save frame_num | |
| 1989 | − if (pCtx->bLastHasMmco5) | |
| 1990 | − pCtx->iPrevFrameNum = 0; | |
| 1986 | + if (NeedErrorCon (pCtx)) { //should always be true! | |
| 1987 | + ImplementErrorCon (pCtx); | |
| 1988 | + pCtx->iTotalNumMbRec = pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight; | |
| 1989 | + DecodeFrameConstruction (pCtx, ppDst, pDstInfo); | |
| 1990 | + pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //save ECed pic for future use | |
| 1991 | + MarkECFrameAsRef (pCtx); | |
| 1992 | + pCtx->iPrevFrameNum = pCtx->sLastSliceHeader.iFrameNum; //save frame_num | |
| 1993 | + if (pCtx->bLastHasMmco5) | |
| 1994 | + pCtx->iPrevFrameNum = 0; | |
| 1995 | + } | |
| 1991 | 1996 | } |
| 1992 | 1997 | return ERR_NONE; |
| 1993 | 1998 | } |
| @@ -172,9 +172,6 @@ bool NeedErrorCon (PWelsDecoderContext pCtx) { · 171 unmodified lines | ||
| 172 | 172 | // ImplementErrorConceal |
| 173 | 173 | // Do actual error concealment |
| 174 | 174 | void ImplementErrorCon (PWelsDecoderContext pCtx) { |
| 175 | − if (!NeedErrorCon (pCtx)) | |
| 176 | − return; | |
| 177 | − | |
| 178 | 175 | if (ERROR_CON_DISABLE == pCtx->iErrorConMethod) { |
| 179 | 176 | pCtx->iErrorCode |= dsBitstreamError; |
| 180 | 177 | return; |
| @@ -183,14 +180,6 @@ void ImplementErrorCon (PWelsDecoderContext pCtx) { · 2 unmodified lines | ||
| 183 | 180 | } else if (ERROR_CON_SLICE_COPY == pCtx->iErrorConMethod) { |
| 184 | 181 | DoErrorConSliceCopy (pCtx); |
| 185 | 182 | } //TODO add other EC methods here in the future |
| 186 | − | |
| 187 | − //mark the erroneous frame as Ref pic in DPB | |
| 188 | − MarkECFrameAsRef (pCtx); | |
| 189 | − //need update frame_num due current frame is well decoded | |
| 190 | − pCtx->iPrevFrameNum = pCtx->pSliceHeader->iFrameNum; | |
| 191 | − if (pCtx->bLastHasMmco5) | |
| 192 | − pCtx->iPrevFrameNum = 0; | |
| 193 | − | |
| 194 | 183 | } |
| 195 | 184 | |
| 196 | 185 | } // namespace WelsDec |