Merge pull request #991 from huili2/reorder_output_EC

put EC before output
This commit is contained in:
dongzha 2014-06-20 16:19:14 +08:00
commit dd5b9b89f6
2 changed files with 18 additions and 24 deletions

View File

@ -1641,11 +1641,6 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI
WelsDecodeAccessUnitEnd (pCtx);
if (!pCtx->bInstantDecFlag) {
//Do error concealment here
ImplementErrorCon (pCtx);
}
pCtx->bNewSeqBegin = false;
WriteBackActiveParameters (pCtx);
pCtx->bNewSeqBegin = pCtx->bNewSeqBegin || pCtx->bNextNewSeqBegin;
@ -1943,6 +1938,14 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf
#endif//#if !CODEC_FOR_TESTBED
if (dq_cur->uiLayerDqId == kuiTargetLayerDqId) {
if (!pCtx->bInstantDecFlag) {
//Do error concealment here
if (NeedErrorCon (pCtx)) {
ImplementErrorCon (pCtx);
pCtx->iTotalNumMbRec = pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight;
}
}
if (DecodeFrameConstruction (pCtx, ppDst, pDstInfo)) {
return ERR_NONE;
}
@ -1979,15 +1982,17 @@ bool CheckAndDoEC (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstI
if ((pCtx->iTotalNumMbRec != 0)
&& (CheckAccessUnitBoundaryExt (&pCtx->sLastNalHdrExt, &pCurNal->sNalHeaderExt, &pCtx->sLastSliceHeader,
&pCurNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader))) {
pCtx->iTotalNumMbRec = pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight;
DecodeFrameConstruction (pCtx, ppDst, pDstInfo);
PPicture pCurPic = pCtx->pDec; //temporally store current picture
//Do Error Concealment here
ImplementErrorCon (pCtx);
pCtx->pPreviousDecodedPictureInDpb = pCurPic; //save ECed pic for future use
pCtx->iPrevFrameNum = pCtx->sLastSliceHeader.iFrameNum; //save frame_num
if (pCtx->bLastHasMmco5)
pCtx->iPrevFrameNum = 0;
if (NeedErrorCon (pCtx)) { //should always be true!
ImplementErrorCon (pCtx);
pCtx->iTotalNumMbRec = pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight;
DecodeFrameConstruction (pCtx, ppDst, pDstInfo);
pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //save ECed pic for future use
MarkECFrameAsRef (pCtx);
pCtx->iPrevFrameNum = pCtx->sLastSliceHeader.iFrameNum; //save frame_num
if (pCtx->bLastHasMmco5)
pCtx->iPrevFrameNum = 0;
}
}
return ERR_NONE;
}

View File

@ -172,9 +172,6 @@ bool NeedErrorCon (PWelsDecoderContext pCtx) {
// ImplementErrorConceal
// Do actual error concealment
void ImplementErrorCon (PWelsDecoderContext pCtx) {
if (!NeedErrorCon (pCtx))
return;
if (ERROR_CON_DISABLE == pCtx->iErrorConMethod) {
pCtx->iErrorCode |= dsBitstreamError;
return;
@ -183,14 +180,6 @@ void ImplementErrorCon (PWelsDecoderContext pCtx) {
} else if (ERROR_CON_SLICE_COPY == pCtx->iErrorConMethod) {
DoErrorConSliceCopy (pCtx);
} //TODO add other EC methods here in the future
//mark the erroneous frame as Ref pic in DPB
MarkECFrameAsRef (pCtx);
//need update frame_num due current frame is well decoded
pCtx->iPrevFrameNum = pCtx->pSliceHeader->iFrameNum;
if (pCtx->bLastHasMmco5)
pCtx->iPrevFrameNum = 0;
}
} // namespace WelsDec