ref: bc42fa186153ddba65c398eb0d0aea0b6eea7da3
parent: 3de2103d69d2d833c0a311cb318723745c8fd8c9
parent: d5e304fd9f90039b80b31dba32d5bc0b42f793de
author: ruil2 <[email protected]>
date: Tue Nov 29 09:18:35 EST 2016
Merge pull request #2609 from huili2/remove_duplicate_ECmethod_in_DecContext remove duplipate eErrorConMethod in decContext compared with pParam"
--- a/codec/decoder/core/inc/decoder_context.h
+++ b/codec/decoder/core/inc/decoder_context.h
@@ -373,7 +373,6 @@
bool bNewSeqBegin;
bool bNextNewSeqBegin;
int iOverwriteFlags;
- ERROR_CON_IDC eErrorConMethod; //
//for Parse only
bool bFramePending;
--- a/codec/decoder/core/src/au_parser.cpp
+++ b/codec/decoder/core/src/au_parser.cpp
@@ -208,7 +208,7 @@
if (uiAvailNalNum > 0) {
pCurAu->uiEndPos = uiAvailNalNum - 1;
- if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
+ if (pCtx->pParam->eEcActiveIdc == ERROR_CON_DISABLE) {
pCtx->bAuReadyFlag = true;
}
}
@@ -227,7 +227,7 @@
if (uiAvailNalNum > 0) {
pCurAu->uiEndPos = uiAvailNalNum - 1;
- if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
+ if (pCtx->pParam->eEcActiveIdc == ERROR_CON_DISABLE) {
pCtx->bAuReadyFlag = true;
}
}
@@ -284,7 +284,7 @@
if (uiAvailNalNum > 1) {
pCurAu->uiEndPos = uiAvailNalNum - 2;
- if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
+ if (pCtx->pParam->eEcActiveIdc == ERROR_CON_DISABLE) {
pCtx->bAuReadyFlag = true;
}
}
@@ -306,7 +306,7 @@
if (uiAvailNalNum > 1) {
pCurAu->uiEndPos = uiAvailNalNum - 2;
- if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
+ if (pCtx->pParam->eEcActiveIdc == ERROR_CON_DISABLE) {
pCtx->bAuReadyFlag = true;
}
}
@@ -381,7 +381,7 @@
ForceClearCurrentNal (pCurAu);
if (uiAvailNalNum > 1) {
pCurAu->uiEndPos = uiAvailNalNum - 2;
- if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
+ if (pCtx->pParam->eEcActiveIdc == ERROR_CON_DISABLE) {
pCtx->bAuReadyFlag = true;
}
}
@@ -400,7 +400,7 @@
if (uiAvailNalNum > 1) {
pCurAu->uiEndPos = uiAvailNalNum - 2;
- if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
+ if (pCtx->pParam->eEcActiveIdc == ERROR_CON_DISABLE) {
pCtx->bAuReadyFlag = true;
}
}
@@ -589,7 +589,7 @@
if (iBitSize > 0) {
iErr = DecInitBits (pBs, pRbsp, iBitSize);
if (ERR_NONE != iErr) {
- if (pCtx->eErrorConMethod == ERROR_CON_DISABLE)
+ if (pCtx->pParam->eEcActiveIdc == ERROR_CON_DISABLE)
pCtx->iErrorCode |= dsNoParamSets;
else
pCtx->iErrorCode |= dsBitstreamError;
@@ -598,7 +598,7 @@
}
iErr = ParseSps (pCtx, pBs, &iPicWidth, &iPicHeight, pSrcNal, kSrcNalLen);
if (ERR_NONE != iErr) { // modified for pSps/pSubsetSps invalid, 12/1/2009
- if (pCtx->eErrorConMethod == ERROR_CON_DISABLE)
+ if (pCtx->pParam->eEcActiveIdc == ERROR_CON_DISABLE)
pCtx->iErrorCode |= dsNoParamSets;
else
pCtx->iErrorCode |= dsBitstreamError;
@@ -611,7 +611,7 @@
if (iBitSize > 0) {
iErr = DecInitBits (pBs, pRbsp, iBitSize);
if (ERR_NONE != iErr) {
- if (pCtx->eErrorConMethod == ERROR_CON_DISABLE)
+ if (pCtx->pParam->eEcActiveIdc == ERROR_CON_DISABLE)
pCtx->iErrorCode |= dsNoParamSets;
else
pCtx->iErrorCode |= dsBitstreamError;
@@ -620,7 +620,7 @@
}
iErr = ParsePps (pCtx, &pCtx->sPpsBuffer[0], pBs, pSrcNal, kSrcNalLen);
if (ERR_NONE != iErr) { // modified for pps invalid, 12/1/2009
- if (pCtx->eErrorConMethod == ERROR_CON_DISABLE)
+ if (pCtx->pParam->eEcActiveIdc == ERROR_CON_DISABLE)
pCtx->iErrorCode |= dsNoParamSets;
else
pCtx->iErrorCode |= dsBitstreamError;
--- a/codec/decoder/core/src/decoder.cpp
+++ b/codec/decoder/core/src/decoder.cpp
@@ -310,7 +310,6 @@
pCtx->pPicBuff[LIST_1] = NULL;
pCtx->bAvcBasedFlag = true;
- pCtx->eErrorConMethod = ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE;
pCtx->pPreviousDecodedPictureInDpb = NULL;
pCtx->sDecoderStatistics.iAvgLumaQp = -1;
pCtx->bSpsLatePps = false;
@@ -534,10 +533,9 @@
ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE);
pCtx->pParam->eEcActiveIdc = ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE;
}
- pCtx->eErrorConMethod = pCtx->pParam->eEcActiveIdc;
if (pCtx->pParam->bParseOnly) //parse only, disable EC method
- pCtx->eErrorConMethod = ERROR_CON_DISABLE;
+ pCtx->pParam->eEcActiveIdc = ERROR_CON_DISABLE;
InitErrorCon (pCtx);
if (VIDEO_BITSTREAM_SVC == pCtx->pParam->sVideoProperty.eVideoBsType ||
--- a/codec/decoder/core/src/decoder_core.cpp
+++ b/codec/decoder/core/src/decoder_core.cpp
@@ -199,11 +199,11 @@
|| (pCtx->iLastImgHeightInPixel != pDstInfo->UsrData.sSystemBuffer.iHeight);
pCtx->iLastImgWidthInPixel = pDstInfo->UsrData.sSystemBuffer.iWidth;
pCtx->iLastImgHeightInPixel = pDstInfo->UsrData.sSystemBuffer.iHeight;
- if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) //no buffer output if EC is disabled and frame incomplete
+ if (pCtx->pParam->eEcActiveIdc == ERROR_CON_DISABLE) //no buffer output if EC is disabled and frame incomplete
pDstInfo->iBufferStatus = (int32_t) (bFrameCompleteFlag
&& pPic->bIsComplete); // When EC disable, ECed picture not output
- else if ((pCtx->eErrorConMethod == ERROR_CON_SLICE_COPY_CROSS_IDR_FREEZE_RES_CHANGE
- || pCtx->eErrorConMethod == ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE)
+ else if ((pCtx->pParam->eEcActiveIdc == ERROR_CON_SLICE_COPY_CROSS_IDR_FREEZE_RES_CHANGE
+ || pCtx->pParam->eEcActiveIdc == ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE)
&& pCtx->iErrorCode && bOutResChange)
pCtx->bFreezeOutput = true;
@@ -1247,7 +1247,7 @@
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
"UpdateAccessUnit():::::Key frame lost.....CAN NOT find IDR from current AU.");
pCtx->iErrorCode |= dsRefLost;
- if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
+ if (pCtx->pParam->eEcActiveIdc == ERROR_CON_DISABLE) {
#ifdef LONG_TERM_REF
pCtx->iErrorCode |= dsNoParamSets;
return dsNoParamSets;
@@ -2283,7 +2283,7 @@
bAllRefComplete = false;
pCtx->iErrorCode |= dsRefLost;
- if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
+ if (pCtx->pParam->eEcActiveIdc == ERROR_CON_DISABLE) {
#ifdef LONG_TERM_REF
pCtx->bParamSetsLostFlag = true;
#else
@@ -2303,7 +2303,7 @@
WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,
"reference picture introduced by this frame is lost during transmission! uiTId: %d",
pNalCur->sNalHeaderExt.uiTemporalId);
- if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
+ if (pCtx->pParam->eEcActiveIdc == ERROR_CON_DISABLE) {
if (pCtx->iTotalNumMbRec == 0)
pCtx->pDec = NULL;
return iRet;
@@ -2320,7 +2320,7 @@
iRet, pSh->iFrameNum, iCurrIdD, iCurrIdQ);
bAllRefComplete = false;
HandleReferenceLostL0 (pCtx, pNalCur);
- if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
+ if (pCtx->pParam->eEcActiveIdc == ERROR_CON_DISABLE) {
if (pCtx->iTotalNumMbRec == 0)
pCtx->pDec = NULL;
return iRet;
@@ -2380,7 +2380,7 @@
if (!pCtx->bInstantDecFlag) {
if (!pCtx->pParam->bParseOnly) {
//Do error concealment here
- if ((NeedErrorCon (pCtx)) && (pCtx->eErrorConMethod != ERROR_CON_DISABLE)) {
+ if ((NeedErrorCon (pCtx)) && (pCtx->pParam->eEcActiveIdc != ERROR_CON_DISABLE)) {
ImplementErrorCon (pCtx);
pCtx->iTotalNumMbRec = pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight;
pCtx->pDec->iSpsId = pCtx->pSps->iSpsId;
@@ -2399,7 +2399,7 @@
if (iRet != ERR_NONE) {
if (iRet == ERR_INFO_DUPLICATE_FRAME_NUM)
pCtx->iErrorCode |= dsBitstreamError;
- if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
+ if (pCtx->pParam->eEcActiveIdc == ERROR_CON_DISABLE) {
pCtx->pDec = NULL;
return iRet;
}
@@ -2449,7 +2449,7 @@
//Do Error Concealment here
if (bAuBoundaryFlag && (pCtx->iTotalNumMbRec != 0) && NeedErrorCon (pCtx)) { //AU ready but frame not completely reconed
- if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
+ if (pCtx->pParam->eEcActiveIdc != ERROR_CON_DISABLE) {
ImplementErrorCon (pCtx);
pCtx->iTotalNumMbRec = pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight;
pCtx->pDec->iSpsId = pCtx->pSps->iSpsId;
--- a/codec/decoder/core/src/error_concealment.cpp
+++ b/codec/decoder/core/src/error_concealment.cpp
@@ -41,12 +41,13 @@
namespace WelsDec {
//Init
void InitErrorCon (PWelsDecoderContext pCtx) {
- if ((pCtx->eErrorConMethod == ERROR_CON_SLICE_COPY) || (pCtx->eErrorConMethod == ERROR_CON_SLICE_COPY_CROSS_IDR)
- || (pCtx->eErrorConMethod == ERROR_CON_SLICE_MV_COPY_CROSS_IDR)
- || (pCtx->eErrorConMethod == ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE)
- || (pCtx->eErrorConMethod == ERROR_CON_SLICE_COPY_CROSS_IDR_FREEZE_RES_CHANGE)) {
- if ((pCtx->eErrorConMethod != ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE)
- && (pCtx->eErrorConMethod != ERROR_CON_SLICE_COPY_CROSS_IDR_FREEZE_RES_CHANGE)) {
+ if ((pCtx->pParam->eEcActiveIdc == ERROR_CON_SLICE_COPY)
+ || (pCtx->pParam->eEcActiveIdc == ERROR_CON_SLICE_COPY_CROSS_IDR)
+ || (pCtx->pParam->eEcActiveIdc == ERROR_CON_SLICE_MV_COPY_CROSS_IDR)
+ || (pCtx->pParam->eEcActiveIdc == ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE)
+ || (pCtx->pParam->eEcActiveIdc == ERROR_CON_SLICE_COPY_CROSS_IDR_FREEZE_RES_CHANGE)) {
+ if ((pCtx->pParam->eEcActiveIdc != ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE)
+ && (pCtx->pParam->eEcActiveIdc != ERROR_CON_SLICE_COPY_CROSS_IDR_FREEZE_RES_CHANGE)) {
pCtx->bFreezeOutput = false;
}
pCtx->sCopyFunc.pCopyLumaFunc = WelsCopy16x16_c;
@@ -87,7 +88,7 @@
int32_t iStrideY = pDstPic->iLinesize[0];
int32_t iStrideUV = pDstPic->iLinesize[1];
pCtx->pDec->iMbEcedNum = pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight;
- if ((pCtx->eErrorConMethod == ERROR_CON_FRAME_COPY) && (pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt.bIdrFlag))
+ if ((pCtx->pParam->eEcActiveIdc == ERROR_CON_FRAME_COPY) && (pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt.bIdrFlag))
pSrcPic = NULL; //no cross IDR method, should fill in data instead of copy
if (pSrcPic == NULL) { //no ref pic, assign specific data to picture
memset (pDstPic->pData[0], 128, uiHeightInPixelY * iStrideY);
@@ -109,7 +110,7 @@
int32_t iMbHeight = (int32_t) pCtx->pSps->iMbHeight;
PPicture pDstPic = pCtx->pDec;
PPicture pSrcPic = pCtx->pPreviousDecodedPictureInDpb;
- if ((pCtx->eErrorConMethod == ERROR_CON_SLICE_COPY) && (pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt.bIdrFlag))
+ if ((pCtx->pParam->eEcActiveIdc == ERROR_CON_SLICE_COPY) && (pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt.bIdrFlag))
pSrcPic = NULL; //no cross IDR method, should fill in data instead of copy
//uint8_t *pDstData[3], *pSrcData[3];
@@ -457,18 +458,18 @@
// ImplementErrorConceal
// Do actual error concealment
void ImplementErrorCon (PWelsDecoderContext pCtx) {
- if (ERROR_CON_DISABLE == pCtx->eErrorConMethod) {
+ if (ERROR_CON_DISABLE == pCtx->pParam->eEcActiveIdc) {
pCtx->iErrorCode |= dsBitstreamError;
return;
- } else if ((ERROR_CON_FRAME_COPY == pCtx->eErrorConMethod)
- || (ERROR_CON_FRAME_COPY_CROSS_IDR == pCtx->eErrorConMethod)) {
+ } else if ((ERROR_CON_FRAME_COPY == pCtx->pParam->eEcActiveIdc)
+ || (ERROR_CON_FRAME_COPY_CROSS_IDR == pCtx->pParam->eEcActiveIdc)) {
DoErrorConFrameCopy (pCtx);
- } else if ((ERROR_CON_SLICE_COPY == pCtx->eErrorConMethod)
- || (ERROR_CON_SLICE_COPY_CROSS_IDR == pCtx->eErrorConMethod)
- || (ERROR_CON_SLICE_COPY_CROSS_IDR_FREEZE_RES_CHANGE == pCtx->eErrorConMethod)) {
+ } else if ((ERROR_CON_SLICE_COPY == pCtx->pParam->eEcActiveIdc)
+ || (ERROR_CON_SLICE_COPY_CROSS_IDR == pCtx->pParam->eEcActiveIdc)
+ || (ERROR_CON_SLICE_COPY_CROSS_IDR_FREEZE_RES_CHANGE == pCtx->pParam->eEcActiveIdc)) {
DoErrorConSliceCopy (pCtx);
- } else if ((ERROR_CON_SLICE_MV_COPY_CROSS_IDR == pCtx->eErrorConMethod)
- || (ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE == pCtx->eErrorConMethod)) {
+ } else if ((ERROR_CON_SLICE_MV_COPY_CROSS_IDR == pCtx->pParam->eEcActiveIdc)
+ || (ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE == pCtx->pParam->eEcActiveIdc)) {
GetAvilInfoFromCorrectMb (pCtx);
DoErrorConSliceMVCopy (pCtx);
} //TODO add other EC methods here in the future
--- a/codec/decoder/core/src/manage_dec_ref.cpp
+++ b/codec/decoder/core/src/manage_dec_ref.cpp
@@ -114,7 +114,8 @@
if ((pCtx->sRefPic.uiShortRefCount[LIST_0] + pCtx->sRefPic.uiLongRefCount[LIST_0] <= 0) && (pCtx->eSliceType != I_SLICE
&& pCtx->eSliceType != SI_SLICE)) {
- if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) { //IDR lost!, recover it for future decoding with data all set to 0
+ if (pCtx->pParam->eEcActiveIdc !=
+ ERROR_CON_DISABLE) { //IDR lost!, recover it for future decoding with data all set to 0
PPicture pRef = PrefetchPic (pCtx->pPicBuff[0]);
if (pRef != NULL) {
// IDR lost, set new
@@ -122,11 +123,11 @@
pRef->iSpsId = pCtx->pSps->iSpsId;
pRef->iPpsId = pCtx->pPps->iPpsId;
pCtx->iErrorCode |= dsDataErrorConcealed;
- bool bCopyPrevious = ((ERROR_CON_FRAME_COPY_CROSS_IDR == pCtx->eErrorConMethod)
- || (ERROR_CON_SLICE_COPY_CROSS_IDR == pCtx->eErrorConMethod)
- || (ERROR_CON_SLICE_COPY_CROSS_IDR_FREEZE_RES_CHANGE == pCtx->eErrorConMethod)
- || (ERROR_CON_SLICE_MV_COPY_CROSS_IDR == pCtx->eErrorConMethod)
- || (ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE == pCtx->eErrorConMethod))
+ bool bCopyPrevious = ((ERROR_CON_FRAME_COPY_CROSS_IDR == pCtx->pParam->eEcActiveIdc)
+ || (ERROR_CON_SLICE_COPY_CROSS_IDR == pCtx->pParam->eEcActiveIdc)
+ || (ERROR_CON_SLICE_COPY_CROSS_IDR_FREEZE_RES_CHANGE == pCtx->pParam->eEcActiveIdc)
+ || (ERROR_CON_SLICE_MV_COPY_CROSS_IDR == pCtx->pParam->eEcActiveIdc)
+ || (ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE == pCtx->pParam->eEcActiveIdc))
&& (NULL != pCtx->pPreviousDecodedPictureInDpb);
bCopyPrevious = bCopyPrevious && (pRef->iWidthInPixel == pCtx->pPreviousDecodedPictureInDpb->iWidthInPixel)
&& (pRef->iHeightInPixel == pCtx->pPreviousDecodedPictureInDpb->iHeightInPixel);
@@ -292,7 +293,7 @@
if (pRefPicMarking->bAdaptiveRefPicMarkingModeFlag) {
iRet = MMCO (pCtx, pRefPicMarking);
if (iRet != ERR_NONE) {
- if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
+ if (pCtx->pParam->eEcActiveIdc != ERROR_CON_DISABLE) {
iRet = RemainOneBufferInDpbForEC (pCtx);
WELS_VERIFY_RETURN_IF (iRet, iRet);
} else {
@@ -308,7 +309,7 @@
} else {
iRet = SlidingWindow (pCtx);
if (iRet != ERR_NONE) {
- if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
+ if (pCtx->pParam->eEcActiveIdc != ERROR_CON_DISABLE) {
iRet = RemainOneBufferInDpbForEC (pCtx);
WELS_VERIFY_RETURN_IF (iRet, iRet);
} else {
@@ -320,7 +321,7 @@
if (!pCtx->pDec->bIsLongRef) {
if (pRefPic->uiLongRefCount[LIST_0] + pRefPic->uiShortRefCount[LIST_0] >= WELS_MAX (1, pCtx->pSps->iNumRefFrames)) {
- if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
+ if (pCtx->pParam->eEcActiveIdc != ERROR_CON_DISABLE) {
iRet = RemainOneBufferInDpbForEC (pCtx);
WELS_VERIFY_RETURN_IF (iRet, iRet);
} else {
--- a/codec/decoder/core/src/parse_mb_syn_cabac.cpp
+++ b/codec/decoder/core/src/parse_mb_syn_cabac.cpp
@@ -397,7 +397,7 @@
iRef[0]));
if ((iRef[0] < 0) || (iRef[0] >= pRefCount[0]) || (ppRefPic[iRef[0]] == NULL)) { //error ref_idx
pCtx->bMbRefConcealed = true;
- if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
+ if (pCtx->pParam->eEcActiveIdc != ERROR_CON_DISABLE) {
iRef[0] = 0;
pCtx->iErrorCode |= dsBitstreamError;
} else {
@@ -423,7 +423,7 @@
iRef[i]));
if ((iRef[i] < 0) || (iRef[i] >= pRefCount[0]) || (ppRefPic[iRef[i]] == NULL)) { //error ref_idx
pCtx->bMbRefConcealed = true;
- if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
+ if (pCtx->pParam->eEcActiveIdc != ERROR_CON_DISABLE) {
iRef[i] = 0;
pCtx->iErrorCode |= dsBitstreamError;
} else {
@@ -453,7 +453,7 @@
iRef[i]));
if ((iRef[i] < 0) || (iRef[i] >= pRefCount[0]) || (ppRefPic[iRef[i]] == NULL)) { //error ref_idx
pCtx->bMbRefConcealed = true;
- if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
+ if (pCtx->pParam->eEcActiveIdc != ERROR_CON_DISABLE) {
iRef[i] = 0;
pCtx->iErrorCode |= dsBitstreamError;
} else {
@@ -501,7 +501,7 @@
pRefIdx[i]));
if ((pRefIdx[i] < 0) || (pRefIdx[i] >= pRefCount[0]) || (ppRefPic[pRefIdx[i]] == NULL)) { //error ref_idx
pCtx->bMbRefConcealed = true;
- if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
+ if (pCtx->pParam->eEcActiveIdc != ERROR_CON_DISABLE) {
pRefIdx[i] = 0;
pCtx->iErrorCode |= dsBitstreamError;
} else {
--- a/codec/decoder/core/src/parse_mb_syn_cavlc.cpp
+++ b/codec/decoder/core/src/parse_mb_syn_cavlc.cpp
@@ -1022,7 +1022,7 @@
// ref to standard section 7.4.5.1. iRefCount[0] is 1 + num_ref_idx_l0_active_minus1.
if ((iRefIdx < 0) || (iRefIdx >= iRefCount[0]) || (ppRefPic[iRefIdx] == NULL)) { //error ref_idx
pCtx->bMbRefConcealed = true;
- if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
+ if (pCtx->pParam->eEcActiveIdc != ERROR_CON_DISABLE) {
iRefIdx = 0;
pCtx->iErrorCode |= dsBitstreamError;
} else {
@@ -1063,7 +1063,7 @@
iRefIdx[i] = uiCode;
if ((iRefIdx[i] < 0) || (iRefIdx[i] >= iRefCount[0]) || (ppRefPic[iRefIdx[i]] == NULL)) { //error ref_idx
pCtx->bMbRefConcealed = true;
- if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
+ if (pCtx->pParam->eEcActiveIdc != ERROR_CON_DISABLE) {
iRefIdx[i] = 0;
pCtx->iErrorCode |= dsBitstreamError;
} else {
@@ -1100,7 +1100,7 @@
iRefIdx[i] = uiCode;
if ((iRefIdx[i] < 0) || (iRefIdx[i] >= iRefCount[0]) || (ppRefPic[iRefIdx[i]] == NULL)) { //error ref_idx
pCtx->bMbRefConcealed = true;
- if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
+ if (pCtx->pParam->eEcActiveIdc != ERROR_CON_DISABLE) {
iRefIdx[i] = 0;
pCtx->iErrorCode |= dsBitstreamError;
} else {
@@ -1172,7 +1172,7 @@
iRefIdx[i] = uiCode;
if ((iRefIdx[i] < 0) || (iRefIdx[i] >= iRefCount[0]) || (ppRefPic[iRefIdx[i]] == NULL)) { //error ref_idx
pCtx->bMbRefConcealed = true;
- if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
+ if (pCtx->pParam->eEcActiveIdc != ERROR_CON_DISABLE) {
iRefIdx[i] = 0;
pCtx->iErrorCode |= dsBitstreamError;
} else {
--- a/codec/decoder/plus/src/welsDecoderExt.cpp
+++ b/codec/decoder/plus/src/welsDecoderExt.cpp
@@ -314,7 +314,7 @@
return cmInitParaError;
}
- m_pDecContext->pParam->eEcActiveIdc = m_pDecContext->eErrorConMethod = (ERROR_CON_IDC) iVal;
+ m_pDecContext->pParam->eEcActiveIdc = (ERROR_CON_IDC) iVal;
InitErrorCon (m_pDecContext);
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
"CWelsDecoder::SetOption for ERROR_CON_IDC = %d.", iVal);
@@ -398,7 +398,7 @@
* ((int*)pOption) = iVal;
return cmResultSuccess;
} else if (DECODER_OPTION_ERROR_CON_IDC == eOptID) {
- iVal = (int) m_pDecContext->eErrorConMethod;
+ iVal = (int) m_pDecContext->pParam->eEcActiveIdc;
* ((int*)pOption) = iVal;
return cmResultSuccess;
} else if (DECODER_OPTION_GET_STATISTICS == eOptID) { // get decoder statistics info for real time debugging
@@ -535,7 +535,7 @@
//for AVC bitstream (excluding AVC with temporal scalability, including TP), as long as error occur, SHOULD notify upper layer key frame loss.
if ((IS_PARAM_SETS_NALS (eNalType) || NAL_UNIT_CODED_SLICE_IDR == eNalType) ||
(VIDEO_BITSTREAM_AVC == m_pDecContext->eVideoType)) {
- if (m_pDecContext->eErrorConMethod == ERROR_CON_DISABLE) {
+ if (m_pDecContext->pParam->eEcActiveIdc == ERROR_CON_DISABLE) {
#ifdef LONG_TERM_REF
m_pDecContext->bParamSetsLostFlag = true;
#else
@@ -555,7 +555,7 @@
m_pDecContext->iIgnoredErrorInfoPacketCount = 0;
}
}
- if ((m_pDecContext->eErrorConMethod != ERROR_CON_DISABLE) && (pDstInfo->iBufferStatus == 1)) {
+ if ((m_pDecContext->pParam->eEcActiveIdc != ERROR_CON_DISABLE) && (pDstInfo->iBufferStatus == 1)) {
//TODO after dec status updated
m_pDecContext->iErrorCode |= dsDataErrorConcealed;
@@ -650,7 +650,7 @@
}
m_pDecContext->iErrorCode = dsErrorFree; //initialize at the starting of AU decoding.
- m_pDecContext->eErrorConMethod = ERROR_CON_DISABLE; //add protection to disable EC here.
+ m_pDecContext->pParam->eEcActiveIdc = ERROR_CON_DISABLE; //add protection to disable EC here.
if (!m_pDecContext->bFramePending) { //frame complete
m_pDecContext->pParserBsInfo->iNalNum = 0;
memset (m_pDecContext->pParserBsInfo->iNalLenInByte, 0, MAX_NAL_UNITS_IN_LAYER);
--- a/test/decoder/DecUT_ErrorConcealment.cpp
+++ b/test/decoder/DecUT_ErrorConcealment.cpp
@@ -26,6 +26,7 @@
void FreeInputData (PECInputCtx pECCtx) {
if (pECCtx != NULL) {
if (pECCtx->pCtx != NULL) {
+ WELS_SAFE_FREE (pECCtx->pCtx->pParam, "pECCtx->pCtx->pParam");
WELS_SAFE_FREE (pECCtx->pCtx->pSps, "pECCtx->pCtx->pSps");
WELS_SAFE_FREE (pECCtx->pCtx, "pECCtx->pCtx");
}
@@ -95,6 +96,9 @@
return 1;
pECCtx->pCtx->pSps->iMbWidth = pECCtx->iMbWidth;
pECCtx->pCtx->pSps->iMbHeight = pECCtx->iMbHeight;
+ pECCtx->pCtx->pParam = (PDecodingParam) WelsMallocz (sizeof (SDecodingParam), "pECCtx->pCtx->pParam");
+ if (pECCtx->pCtx->pParam == NULL)
+ return 1;
return 0;
}
@@ -121,7 +125,7 @@
int32_t iMbHeight = (int32_t) pECCtx->iMbHeight;
PPicture pDstPic = &pECCtx->sAncPic;
PPicture pSrcPic = pECCtx->pCtx->pPreviousDecodedPictureInDpb;
- if ((pECCtx->pCtx->eErrorConMethod == ERROR_CON_SLICE_COPY)
+ if ((pECCtx->pCtx->pParam->eEcActiveIdc == ERROR_CON_SLICE_COPY)
&& (pECCtx->pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt.bIdrFlag))
pSrcPic = NULL;
@@ -235,7 +239,7 @@
}
for (int iEC = 0; iEC < 2; ++ iEC) { //ERROR_CON_FRAME_COPY, ERROR_CON_FRAME_COPY_CROSS_IDR
- pECCtx->pCtx->eErrorConMethod = iEC > 0 ? ERROR_CON_FRAME_COPY_CROSS_IDR : ERROR_CON_FRAME_COPY;
+ pECCtx->pCtx->pParam->eEcActiveIdc = iEC > 0 ? ERROR_CON_FRAME_COPY_CROSS_IDR : ERROR_CON_FRAME_COPY;
InitECCopyData (pECCtx);
int32_t iLumaSize = pECCtx->iMbWidth * pECCtx->iMbHeight * 256;
@@ -246,7 +250,7 @@
//Do reference code method
DoErrorConFrameCopy (pECCtx->pCtx);
//Do anchor method
- if (iRef && ! ((pECCtx->pCtx->eErrorConMethod == ERROR_CON_FRAME_COPY)
+ if (iRef && ! ((pECCtx->pCtx->pParam->eEcActiveIdc == ERROR_CON_FRAME_COPY)
&& (pECCtx->pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt.bIdrFlag)))
memcpy (pECCtx->sAncPic.pData[0], pECCtx->sSrcPic.pData[0], iLumaSize * 3 / 2);
else
@@ -272,7 +276,7 @@
}
for (int iEC = 0; iEC < 2; ++ iEC) { //ERROR_CON_SLICE_COPY, ERROR_CON_SLICE_COPY_CROSS_IDR
- pECCtx->pCtx->eErrorConMethod = iEC > 0 ? ERROR_CON_SLICE_COPY_CROSS_IDR : ERROR_CON_SLICE_COPY;
+ pECCtx->pCtx->pParam->eEcActiveIdc = iEC > 0 ? ERROR_CON_SLICE_COPY_CROSS_IDR : ERROR_CON_SLICE_COPY;
InitECCopyData (pECCtx);
for (int iRef = 0; iRef < 2; ++ iRef) { //no ref, with ref
pECCtx->pCtx->pPreviousDecodedPictureInDpb = iRef ? &pECCtx->sSrcPic : NULL;