Merge pull request #1224 from huili2/ec_flag_modif

modify EC API name and remove useless flag
This commit is contained in:
HaiboZhu 2014-07-28 13:06:23 +08:00
commit 39d490b23d
13 changed files with 52 additions and 51 deletions

View File

@ -359,7 +359,7 @@ typedef struct TagSVCDecodingParam {
unsigned int uiCpuLoad; // CPU load unsigned int uiCpuLoad; // CPU load
unsigned char uiTargetDqLayer; // Setting target dq layer id unsigned char uiTargetDqLayer; // Setting target dq layer id
unsigned char uiEcActiveFlag; // Whether active error concealment feature in decoder ERROR_CON_IDC eEcActiveIdc; // Whether active error concealment feature in decoder
SVideoProperty sVideoProperty; SVideoProperty sVideoProperty;
} SDecodingParam, *PDecodingParam; } SDecodingParam, *PDecodingParam;

View File

@ -198,7 +198,7 @@ void H264DecodeInstance (ISVCDecoder* pDecoder, const char* kpH264FileName, cons
pDecoder->GetOption (DECODER_OPTION_VCL_NAL, &iFeedbackVclNalInAu); pDecoder->GetOption (DECODER_OPTION_VCL_NAL, &iFeedbackVclNalInAu);
int32_t iFeedbackTidInAu; int32_t iFeedbackTidInAu;
pDecoder->GetOption (DECODER_OPTION_TEMPORAL_ID, &iFeedbackTidInAu); pDecoder->GetOption (DECODER_OPTION_TEMPORAL_ID, &iFeedbackTidInAu);
int32_t iErrorConMethod = ERROR_CON_SLICE_COPY; int32_t iErrorConMethod = (int32_t) ERROR_CON_SLICE_COPY;
pDecoder->SetOption (DECODER_OPTION_ERROR_CON_IDC, &iErrorConMethod); pDecoder->SetOption (DECODER_OPTION_ERROR_CON_IDC, &iErrorConMethod);
//~end for //~end for
@ -350,8 +350,8 @@ int32_t main (int32_t iArgC, char* pArgV[]) {
sDecParam.uiTargetDqLayer = (uint8_t)atol (strTag[1].c_str()); sDecParam.uiTargetDqLayer = (uint8_t)atol (strTag[1].c_str());
} else if (strTag[0].compare ("OutColorFormat") == 0) { } else if (strTag[0].compare ("OutColorFormat") == 0) {
sDecParam.iOutputColorFormat = atoi (strTag[1].c_str()); sDecParam.iOutputColorFormat = atoi (strTag[1].c_str());
} else if (strTag[0].compare ("ErrorConcealmentFlag") == 0) { } else if (strTag[0].compare ("ErrorConcealmentIdc") == 0) {
sDecParam.uiEcActiveFlag = (uint8_t)atol (strTag[1].c_str()); sDecParam.eEcActiveIdc = (ERROR_CON_IDC)atol (strTag[1].c_str());
} else if (strTag[0].compare ("CPULoad") == 0) { } else if (strTag[0].compare ("CPULoad") == 0) {
sDecParam.uiCpuLoad = (uint32_t)atol (strTag[1].c_str()); sDecParam.uiCpuLoad = (uint32_t)atol (strTag[1].c_str());
} else if (strTag[0].compare ("VideoBitstreamType") == 0) { } else if (strTag[0].compare ("VideoBitstreamType") == 0) {
@ -368,7 +368,7 @@ int32_t main (int32_t iArgC, char* pArgV[]) {
strInputFile = pArgV[1]; strInputFile = pArgV[1];
sDecParam.iOutputColorFormat = videoFormatI420; sDecParam.iOutputColorFormat = videoFormatI420;
sDecParam.uiTargetDqLayer = (uint8_t) - 1; sDecParam.uiTargetDqLayer = (uint8_t) - 1;
sDecParam.uiEcActiveFlag = 1; sDecParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
sDecParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT; sDecParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
} }
} else { //iArgC > 2 } else { //iArgC > 2
@ -376,7 +376,7 @@ int32_t main (int32_t iArgC, char* pArgV[]) {
strOutputFile = pArgV[2]; strOutputFile = pArgV[2];
sDecParam.iOutputColorFormat = videoFormatI420; sDecParam.iOutputColorFormat = videoFormatI420;
sDecParam.uiTargetDqLayer = (uint8_t) - 1; sDecParam.uiTargetDqLayer = (uint8_t) - 1;
sDecParam.uiEcActiveFlag = 1; sDecParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
sDecParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT; sDecParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
if (iArgC > 3) { if (iArgC > 3) {
for (int i = 3; i < iArgC; i++) { for (int i = 3; i < iArgC; i++) {

View File

@ -176,7 +176,6 @@ uint32_t uiCpuFlag; // CPU compatibility detected
int32_t iOutputColorFormat; // color space format to be outputed int32_t iOutputColorFormat; // color space format to be outputed
VIDEO_BITSTREAM_TYPE eVideoType; //indicate the type of video to decide whether or not to do qp_delta error detection. VIDEO_BITSTREAM_TYPE eVideoType; //indicate the type of video to decide whether or not to do qp_delta error detection.
bool bErrorResilienceFlag; // error resilience flag
bool bHaveGotMemory; // global memory for decoder context related ever requested? bool bHaveGotMemory; // global memory for decoder context related ever requested?
int32_t iImgWidthInPixel; // width of image in pixel reconstruction picture to be output int32_t iImgWidthInPixel; // width of image in pixel reconstruction picture to be output
@ -287,7 +286,7 @@ uint16_t uiCurIdrPicId;
bool bNewSeqBegin; bool bNewSeqBegin;
bool bNextNewSeqBegin; bool bNextNewSeqBegin;
int iOverwriteFlags; int iOverwriteFlags;
int32_t iErrorConMethod; // ERROR_CON_IDC eErrorConMethod; //
PPicture pPreviousDecodedPictureInDpb; //pointer to previously decoded picture in DPB for error concealment PPicture pPreviousDecodedPictureInDpb; //pointer to previously decoded picture in DPB for error concealment
PGetIntraPredFunc pGetI16x16LumaPredFunc[7]; //h264_predict_copy_16x16; PGetIntraPredFunc pGetI16x16LumaPredFunc[7]; //h264_predict_copy_16x16;
PGetIntraPredFunc pGetI4x4LumaPredFunc[14]; // h264_predict_4x4_t PGetIntraPredFunc pGetI4x4LumaPredFunc[14]; // h264_predict_4x4_t

View File

@ -192,7 +192,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
if (uiAvailNalNum > 0) { if (uiAvailNalNum > 0) {
pCurAu->uiEndPos = uiAvailNalNum - 1; pCurAu->uiEndPos = uiAvailNalNum - 1;
if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) { if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
pCtx->bAuReadyFlag = true; pCtx->bAuReadyFlag = true;
} }
} }
@ -211,7 +211,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
if (uiAvailNalNum > 0) { if (uiAvailNalNum > 0) {
pCurAu->uiEndPos = uiAvailNalNum - 1; pCurAu->uiEndPos = uiAvailNalNum - 1;
if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) { if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
pCtx->bAuReadyFlag = true; pCtx->bAuReadyFlag = true;
} }
} }
@ -327,7 +327,8 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
return NULL; return NULL;
} }
if ((uiAvailNalNum == 1) && CheckNextAuNewSeq (pCtx, pCurNal, pCurNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader.pSps)) { if ((uiAvailNalNum == 1)
&& CheckNextAuNewSeq (pCtx, pCurNal, pCurNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader.pSps)) {
ResetActiveSPSForEachLayer (pCtx); ResetActiveSPSForEachLayer (pCtx);
} }
if ((uiAvailNalNum > 1) && if ((uiAvailNalNum > 1) &&
@ -508,7 +509,7 @@ int32_t ParseNonVclNal (PWelsDecoderContext pCtx, uint8_t* pRbsp, const int32_t
InitBits (pBs, pRbsp, iBitSize); InitBits (pBs, pRbsp, iBitSize);
iErr = ParseSps (pCtx, pBs, &iPicWidth, &iPicHeight); iErr = ParseSps (pCtx, pBs, &iPicWidth, &iPicHeight);
if (ERR_NONE != iErr) { // modified for pSps/pSubsetSps invalid, 12/1/2009 if (ERR_NONE != iErr) { // modified for pSps/pSubsetSps invalid, 12/1/2009
if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) if (pCtx->eErrorConMethod == ERROR_CON_DISABLE)
pCtx->iErrorCode |= dsNoParamSets; pCtx->iErrorCode |= dsNoParamSets;
else else
pCtx->iErrorCode |= dsBitstreamError; pCtx->iErrorCode |= dsBitstreamError;
@ -522,7 +523,7 @@ int32_t ParseNonVclNal (PWelsDecoderContext pCtx, uint8_t* pRbsp, const int32_t
InitBits (pBs, pRbsp, iBitSize); InitBits (pBs, pRbsp, iBitSize);
iErr = ParsePps (pCtx, &pCtx->sPpsBuffer[0], pBs); iErr = ParsePps (pCtx, &pCtx->sPpsBuffer[0], pBs);
if (ERR_NONE != iErr) { // modified for pps invalid, 12/1/2009 if (ERR_NONE != iErr) { // modified for pps invalid, 12/1/2009
if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) if (pCtx->eErrorConMethod == ERROR_CON_DISABLE)
pCtx->iErrorCode |= dsNoParamSets; pCtx->iErrorCode |= dsNoParamSets;
else else
pCtx->iErrorCode |= dsBitstreamError; pCtx->iErrorCode |= dsBitstreamError;

View File

@ -160,7 +160,7 @@ void WelsDecoderDefaults (PWelsDecoderContext pCtx, SLogContext* pLogCtx) {
pCtx->pPicBuff[LIST_1] = NULL; pCtx->pPicBuff[LIST_1] = NULL;
pCtx->bAvcBasedFlag = true; pCtx->bAvcBasedFlag = true;
pCtx->iErrorConMethod = ERROR_CON_SLICE_COPY; pCtx->eErrorConMethod = ERROR_CON_SLICE_COPY;
pCtx->pPreviousDecodedPictureInDpb = NULL; pCtx->pPreviousDecodedPictureInDpb = NULL;
} }
@ -332,7 +332,7 @@ int32_t DecoderConfigParam (PWelsDecoderContext pCtx, const SDecodingParam* kpPa
memcpy (pCtx->pParam, kpParam, sizeof (SDecodingParam)); memcpy (pCtx->pParam, kpParam, sizeof (SDecodingParam));
pCtx->iOutputColorFormat = pCtx->pParam->iOutputColorFormat; pCtx->iOutputColorFormat = pCtx->pParam->iOutputColorFormat;
pCtx->bErrorResilienceFlag = pCtx->pParam->uiEcActiveFlag ? true : false; pCtx->eErrorConMethod = pCtx->pParam->eEcActiveIdc;
if (VIDEO_BITSTREAM_SVC == pCtx->pParam->sVideoProperty.eVideoBsType || if (VIDEO_BITSTREAM_SVC == pCtx->pParam->sVideoProperty.eVideoBsType ||
VIDEO_BITSTREAM_AVC == pCtx->pParam->sVideoProperty.eVideoBsType) { VIDEO_BITSTREAM_AVC == pCtx->pParam->sVideoProperty.eVideoBsType) {
@ -462,7 +462,7 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
iConsumedBytes = 0; iConsumedBytes = 0;
pNalPayload = ParseNalHeader (pCtx, &pCtx->sCurNalHead, pDstNal, iDstIdx, pSrcNal - 3, iSrcIdx + 3, &iConsumedBytes); pNalPayload = ParseNalHeader (pCtx, &pCtx->sCurNalHead, pDstNal, iDstIdx, pSrcNal - 3, iSrcIdx + 3, &iConsumedBytes);
if ((pCtx->iErrorConMethod != ERROR_CON_DISABLE) && (IS_VCL_NAL (pCtx->sCurNalHead.eNalUnitType, 1))) { if ((pCtx->eErrorConMethod != ERROR_CON_DISABLE) && (IS_VCL_NAL (pCtx->sCurNalHead.eNalUnitType, 1))) {
CheckAndDoEC (pCtx, ppDst, pDstBufInfo); CheckAndDoEC (pCtx, ppDst, pDstBufInfo);
} }
if (IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType) && pNalPayload) { if (IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType) && pNalPayload) {
@ -477,7 +477,7 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
#else #else
pCtx->bReferenceLostAtT0Flag = true; pCtx->bReferenceLostAtT0Flag = true;
#endif #endif
if ((pCtx->iErrorConMethod == ERROR_CON_DISABLE) || (dsOutOfMemory & pCtx->iErrorCode)) if ((pCtx->eErrorConMethod == ERROR_CON_DISABLE) || (dsOutOfMemory & pCtx->iErrorCode))
ResetParameterSetsState (pCtx); ResetParameterSetsState (pCtx);
if (dsOutOfMemory & pCtx->iErrorCode) { if (dsOutOfMemory & pCtx->iErrorCode) {
@ -493,7 +493,7 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
#else #else
pCtx->bReferenceLostAtT0Flag = true; pCtx->bReferenceLostAtT0Flag = true;
#endif #endif
if ((pCtx->iErrorConMethod == ERROR_CON_DISABLE) || (dsOutOfMemory & pCtx->iErrorCode)) if ((pCtx->eErrorConMethod == ERROR_CON_DISABLE) || (dsOutOfMemory & pCtx->iErrorCode))
ResetParameterSetsState (pCtx); ResetParameterSetsState (pCtx);
} }
return pCtx->iErrorCode; return pCtx->iErrorCode;
@ -522,7 +522,7 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
iConsumedBytes = 0; iConsumedBytes = 0;
pNalPayload = ParseNalHeader (pCtx, &pCtx->sCurNalHead, pDstNal, iDstIdx, pSrcNal - 3, iSrcIdx + 3, &iConsumedBytes); pNalPayload = ParseNalHeader (pCtx, &pCtx->sCurNalHead, pDstNal, iDstIdx, pSrcNal - 3, iSrcIdx + 3, &iConsumedBytes);
if ((pCtx->iErrorConMethod != ERROR_CON_DISABLE) && (IS_VCL_NAL (pCtx->sCurNalHead.eNalUnitType, 1))) { if ((pCtx->eErrorConMethod != ERROR_CON_DISABLE) && (IS_VCL_NAL (pCtx->sCurNalHead.eNalUnitType, 1))) {
CheckAndDoEC (pCtx, ppDst, pDstBufInfo); CheckAndDoEC (pCtx, ppDst, pDstBufInfo);
} }
if (IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType) && pNalPayload) { if (IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType) && pNalPayload) {
@ -537,7 +537,7 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
#else #else
pCtx->bReferenceLostAtT0Flag = true; pCtx->bReferenceLostAtT0Flag = true;
#endif #endif
if ((pCtx->iErrorConMethod == ERROR_CON_DISABLE) || (dsOutOfMemory & pCtx->iErrorCode)) if ((pCtx->eErrorConMethod == ERROR_CON_DISABLE) || (dsOutOfMemory & pCtx->iErrorCode))
ResetParameterSetsState (pCtx); ResetParameterSetsState (pCtx);
return pCtx->iErrorCode; return pCtx->iErrorCode;
} }
@ -573,7 +573,7 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
#else #else
pCtx->bReferenceLostAtT0Flag = true; pCtx->bReferenceLostAtT0Flag = true;
#endif #endif
if ((pCtx->iErrorConMethod == ERROR_CON_DISABLE) || (dsOutOfMemory & pCtx->iErrorCode)) if ((pCtx->eErrorConMethod == ERROR_CON_DISABLE) || (dsOutOfMemory & pCtx->iErrorCode))
ResetParameterSetsState (pCtx); ResetParameterSetsState (pCtx);
return pCtx->iErrorCode; return pCtx->iErrorCode;
} }

View File

@ -103,7 +103,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t
ppDst[2] = ppDst[2] + pCtx->sFrameCrop.iTopOffset * pPic->iLinesize[1] + pCtx->sFrameCrop.iLeftOffset; ppDst[2] = ppDst[2] + pCtx->sFrameCrop.iTopOffset * pPic->iLinesize[1] + pCtx->sFrameCrop.iLeftOffset;
pDstInfo->iBufferStatus = 1; pDstInfo->iBufferStatus = 1;
if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) //no buffer output if EC is disabled and frame incomplete if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) //no buffer output if EC is disabled and frame incomplete
pDstInfo->iBufferStatus = (int32_t) bFrameCompleteFlag; pDstInfo->iBufferStatus = (int32_t) bFrameCompleteFlag;
if (!bFrameCompleteFlag) { if (!bFrameCompleteFlag) {
@ -129,7 +129,7 @@ inline void HandleReferenceLostL0 (PWelsDecoderContext pCtx, PNalUnit pCurNal
if (0 == pCurNal->sNalHeaderExt.uiTemporalId) { if (0 == pCurNal->sNalHeaderExt.uiTemporalId) {
pCtx->bReferenceLostAtT0Flag = true; pCtx->bReferenceLostAtT0Flag = true;
} }
if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) { if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
#ifndef LONG_TERM_REF #ifndef LONG_TERM_REF
if (pCtx->bReferenceLostAtT0Flag) { if (pCtx->bReferenceLostAtT0Flag) {
ResetParameterSetsState (pCtx); ResetParameterSetsState (pCtx);
@ -143,7 +143,7 @@ inline void HandleReferenceLost (PWelsDecoderContext pCtx, PNalUnit pCurNal)
if ((0 == pCurNal->sNalHeaderExt.uiTemporalId) || (1 == pCurNal->sNalHeaderExt.uiTemporalId)) { if ((0 == pCurNal->sNalHeaderExt.uiTemporalId) || (1 == pCurNal->sNalHeaderExt.uiTemporalId)) {
pCtx->bReferenceLostAtT0Flag = true; pCtx->bReferenceLostAtT0Flag = true;
} }
if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) { if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
#ifndef LONG_TERM_REF #ifndef LONG_TERM_REF
if (pCtx->bReferenceLostAtT0Flag) { if (pCtx->bReferenceLostAtT0Flag) {
ResetParameterSetsState (pCtx); ResetParameterSetsState (pCtx);
@ -959,7 +959,7 @@ int32_t UpdateAccessUnit (PWelsDecoderContext pCtx) {
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
"UpdateAccessUnit():::::Key frame lost.....CAN NOT find IDR from current AU.\n"); "UpdateAccessUnit():::::Key frame lost.....CAN NOT find IDR from current AU.\n");
pCtx->iErrorCode |= dsRefLost; pCtx->iErrorCode |= dsRefLost;
if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) { if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
#ifdef LONG_TERM_REF #ifdef LONG_TERM_REF
pCtx->iErrorCode |= dsNoParamSets; pCtx->iErrorCode |= dsNoParamSets;
return dsNoParamSets; return dsNoParamSets;
@ -1887,7 +1887,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf
pSh->iFrameNum); pSh->iFrameNum);
pCtx->iErrorCode |= dsRefLost; pCtx->iErrorCode |= dsRefLost;
if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) { if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
#ifdef LONG_TERM_REF #ifdef LONG_TERM_REF
pCtx->bParamSetsLostFlag = true; pCtx->bParamSetsLostFlag = true;
#else #else
@ -1906,7 +1906,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
"reference picture introduced by this frame is lost during transmission! uiTId: %d\n", "reference picture introduced by this frame is lost during transmission! uiTId: %d\n",
pNalCur->sNalHeaderExt.uiTemporalId); pNalCur->sNalHeaderExt.uiTemporalId);
if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) { if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
return iRet; return iRet;
} }
} }
@ -1920,7 +1920,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf
"DecodeCurrentAccessUnit() failed (%d) in frame: %d uiDId: %d uiQId: %d\n", "DecodeCurrentAccessUnit() failed (%d) in frame: %d uiDId: %d uiQId: %d\n",
iRet, pSh->iFrameNum, iCurrIdD, iCurrIdQ); iRet, pSh->iFrameNum, iCurrIdD, iCurrIdQ);
HandleReferenceLostL0 (pCtx, pNalCur); HandleReferenceLostL0 (pCtx, pNalCur);
if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) { if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
return iRet; return iRet;
} }
} }
@ -1976,7 +1976,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf
pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //store latest decoded picture for EC pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //store latest decoded picture for EC
iRet = WelsMarkAsRef (pCtx); iRet = WelsMarkAsRef (pCtx);
if (iRet != ERR_NONE) { if (iRet != ERR_NONE) {
if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) { if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
pCtx->pDec = NULL; pCtx->pDec = NULL;
return iRet; return iRet;
} }

View File

@ -41,7 +41,7 @@
namespace WelsDec { namespace WelsDec {
//Init //Init
void InitErrorCon (PWelsDecoderContext pCtx) { void InitErrorCon (PWelsDecoderContext pCtx) {
if (pCtx->iErrorConMethod == ERROR_CON_SLICE_COPY) { if (pCtx->eErrorConMethod == ERROR_CON_SLICE_COPY) {
pCtx->sCopyFunc.pCopyLumaFunc = WelsCopy16x16_c; pCtx->sCopyFunc.pCopyLumaFunc = WelsCopy16x16_c;
pCtx->sCopyFunc.pCopyChromaFunc = WelsCopy8x8_c; pCtx->sCopyFunc.pCopyChromaFunc = WelsCopy8x8_c;
@ -64,8 +64,8 @@ void InitErrorCon (PWelsDecoderContext pCtx) {
#if defined(HAVE_NEON_AARCH64) #if defined(HAVE_NEON_AARCH64)
if (pCtx->uiCpuFlag & WELS_CPU_NEON) { if (pCtx->uiCpuFlag & WELS_CPU_NEON) {
pCtx->sCopyFunc.pCopyLumaFunc = WelsCopy16x16_AArch64_neon; //aligned pCtx->sCopyFunc.pCopyLumaFunc = WelsCopy16x16_AArch64_neon; //aligned
pCtx->sCopyFunc.pCopyChromaFunc = WelsCopy8x8_AArch64_neon; //aligned pCtx->sCopyFunc.pCopyChromaFunc = WelsCopy8x8_AArch64_neon; //aligned
} }
#endif //HAVE_NEON_AARCH64 #endif //HAVE_NEON_AARCH64
} //TODO add more methods here } //TODO add more methods here
@ -180,12 +180,12 @@ bool NeedErrorCon (PWelsDecoderContext pCtx) {
// ImplementErrorConceal // ImplementErrorConceal
// Do actual error concealment // Do actual error concealment
void ImplementErrorCon (PWelsDecoderContext pCtx) { void ImplementErrorCon (PWelsDecoderContext pCtx) {
if (ERROR_CON_DISABLE == pCtx->iErrorConMethod) { if (ERROR_CON_DISABLE == pCtx->eErrorConMethod) {
pCtx->iErrorCode |= dsBitstreamError; pCtx->iErrorCode |= dsBitstreamError;
return; return;
} else if (ERROR_CON_FRAME_COPY == pCtx->iErrorConMethod) { } else if (ERROR_CON_FRAME_COPY == pCtx->eErrorConMethod) {
DoErrorConFrameCopy (pCtx); DoErrorConFrameCopy (pCtx);
} else if (ERROR_CON_SLICE_COPY == pCtx->iErrorConMethod) { } else if (ERROR_CON_SLICE_COPY == pCtx->eErrorConMethod) {
DoErrorConSliceCopy (pCtx); DoErrorConSliceCopy (pCtx);
} //TODO add other EC methods here in the future } //TODO add other EC methods here in the future
pCtx->iErrorCode |= dsDataErrorConcealed; pCtx->iErrorCode |= dsDataErrorConcealed;

View File

@ -112,7 +112,7 @@ int32_t WelsInitRefList (PWelsDecoderContext pCtx, int32_t iPoc) {
if ((pCtx->sRefPic.uiShortRefCount[LIST_0] + pCtx->sRefPic.uiLongRefCount[LIST_0] <= 0) && (pCtx->eSliceType != I_SLICE if ((pCtx->sRefPic.uiShortRefCount[LIST_0] + pCtx->sRefPic.uiLongRefCount[LIST_0] <= 0) && (pCtx->eSliceType != I_SLICE
&& pCtx->eSliceType != SI_SLICE)) { && pCtx->eSliceType != SI_SLICE)) {
if (pCtx->iErrorConMethod != ERROR_CON_DISABLE) { //IDR lost!, recover it for future decoding with data all set to 0 if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) { //IDR lost!, recover it for future decoding with data all set to 0
PPicture pRef = PrefetchPic (pCtx->pPicBuff[0]); PPicture pRef = PrefetchPic (pCtx->pPicBuff[0]);
if (pRef != NULL) { if (pRef != NULL) {
memset (pRef->pData[0], 128, pRef->iLinesize[0] * pRef->iHeightInPixel); memset (pRef->pData[0], 128, pRef->iLinesize[0] * pRef->iHeightInPixel);
@ -259,7 +259,7 @@ int32_t WelsMarkAsRef (PWelsDecoderContext pCtx) {
if (pRefPicMarking->bAdaptiveRefPicMarkingModeFlag) { if (pRefPicMarking->bAdaptiveRefPicMarkingModeFlag) {
iRet = MMCO (pCtx, pRefPicMarking); iRet = MMCO (pCtx, pRefPicMarking);
if (iRet != ERR_NONE) { if (iRet != ERR_NONE) {
if (pCtx->iErrorConMethod != ERROR_CON_DISABLE) { if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
iRet = RemainOneBufferInDpbForEC (pCtx); iRet = RemainOneBufferInDpbForEC (pCtx);
} else { } else {
return iRet; return iRet;
@ -274,7 +274,7 @@ int32_t WelsMarkAsRef (PWelsDecoderContext pCtx) {
} else { } else {
iRet = SlidingWindow (pCtx); iRet = SlidingWindow (pCtx);
if (iRet != ERR_NONE) { if (iRet != ERR_NONE) {
if (pCtx->iErrorConMethod != ERROR_CON_DISABLE) { if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
iRet = RemainOneBufferInDpbForEC (pCtx); iRet = RemainOneBufferInDpbForEC (pCtx);
} else { } else {
return iRet; return iRet;
@ -285,7 +285,7 @@ int32_t WelsMarkAsRef (PWelsDecoderContext pCtx) {
if (!pCtx->pDec->bIsLongRef) { if (!pCtx->pDec->bIsLongRef) {
if (pRefPic->uiLongRefCount[LIST_0] + pRefPic->uiShortRefCount[LIST_0] >= WELS_MAX (1, pCtx->pSps->iNumRefFrames)) { if (pRefPic->uiLongRefCount[LIST_0] + pRefPic->uiShortRefCount[LIST_0] >= WELS_MAX (1, pCtx->pSps->iNumRefFrames)) {
if (pCtx->iErrorConMethod != ERROR_CON_DISABLE) { if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
iRet = RemainOneBufferInDpbForEC (pCtx); iRet = RemainOneBufferInDpbForEC (pCtx);
} else { } else {
return ERR_INFO_INVALID_MMCO_REF_NUM_OVERFLOW; return ERR_INFO_INVALID_MMCO_REF_NUM_OVERFLOW;

View File

@ -1003,7 +1003,7 @@ int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][M
// Security check: iRefIdx should be in range 0 to num_ref_idx_l0_active_minus1, includsive // Security check: iRefIdx should be in range 0 to num_ref_idx_l0_active_minus1, includsive
// ref to standard section 7.4.5.1. iRefCount[0] is 1 + num_ref_idx_l0_active_minus1. // 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 if ((iRefIdx < 0) || (iRefIdx >= iRefCount[0]) || (ppRefPic[iRefIdx] == NULL)) { //error ref_idx
if (pCtx->iErrorConMethod != ERROR_CON_DISABLE) { if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
iRefIdx = 0; iRefIdx = 0;
pCtx->iErrorCode |= dsBitstreamError; pCtx->iErrorCode |= dsBitstreamError;
} else { } else {
@ -1041,7 +1041,7 @@ int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][M
WELS_READ_VERIFY (BsGetTe0 (pBs, iRefCount[0], &uiCode)); //ref_idx_l0[ mbPartIdx ] WELS_READ_VERIFY (BsGetTe0 (pBs, iRefCount[0], &uiCode)); //ref_idx_l0[ mbPartIdx ]
iRefIdx[i] = uiCode; iRefIdx[i] = uiCode;
if ((iRefIdx[i] < 0) || (iRefIdx[i] >= iRefCount[0]) || (ppRefPic[iRefIdx[i]] == NULL)) { //error ref_idx if ((iRefIdx[i] < 0) || (iRefIdx[i] >= iRefCount[0]) || (ppRefPic[iRefIdx[i]] == NULL)) { //error ref_idx
if (pCtx->iErrorConMethod != ERROR_CON_DISABLE) { if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
iRefIdx[i] = 0; iRefIdx[i] = 0;
pCtx->iErrorCode |= dsBitstreamError; pCtx->iErrorCode |= dsBitstreamError;
} else { } else {
@ -1075,7 +1075,7 @@ int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][M
WELS_READ_VERIFY (BsGetTe0 (pBs, iRefCount[0], &uiCode)); //ref_idx_l0[ mbPartIdx ] WELS_READ_VERIFY (BsGetTe0 (pBs, iRefCount[0], &uiCode)); //ref_idx_l0[ mbPartIdx ]
iRefIdx[i] = uiCode; iRefIdx[i] = uiCode;
if ((iRefIdx[i] < 0) || (iRefIdx[i] >= iRefCount[0]) || (ppRefPic[iRefIdx[i]] == NULL)) { //error ref_idx if ((iRefIdx[i] < 0) || (iRefIdx[i] >= iRefCount[0]) || (ppRefPic[iRefIdx[i]] == NULL)) { //error ref_idx
if (pCtx->iErrorConMethod != ERROR_CON_DISABLE) { if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
iRefIdx[i] = 0; iRefIdx[i] = 0;
pCtx->iErrorCode |= dsBitstreamError; pCtx->iErrorCode |= dsBitstreamError;
} else { } else {
@ -1141,7 +1141,7 @@ int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][M
WELS_READ_VERIFY (BsGetTe0 (pBs, iRefCount[0], &uiCode)); //ref_idx_l0[ mbPartIdx ] WELS_READ_VERIFY (BsGetTe0 (pBs, iRefCount[0], &uiCode)); //ref_idx_l0[ mbPartIdx ]
iRefIdx[i] = uiCode; iRefIdx[i] = uiCode;
if ((iRefIdx[i] < 0) || (iRefIdx[i] >= iRefCount[0]) || (ppRefPic[iRefIdx[i]] == NULL)) { //error ref_idx if ((iRefIdx[i] < 0) || (iRefIdx[i] >= iRefCount[0]) || (ppRefPic[iRefIdx[i]] == NULL)) { //error ref_idx
if (pCtx->iErrorConMethod != ERROR_CON_DISABLE) { if (pCtx->eErrorConMethod != ERROR_CON_DISABLE) {
iRefIdx[i] = 0; iRefIdx[i] = 0;
pCtx->iErrorCode |= dsBitstreamError; pCtx->iErrorCode |= dsBitstreamError;
} else { } else {

View File

@ -211,7 +211,8 @@ void CWelsDecoder::UninitDecoder (void) {
if (NULL == m_pDecContext) if (NULL == m_pDecContext)
return; return;
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::uninit_decoder(), openh264 codec version = %s.", VERSION_NUMBER); WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::uninit_decoder(), openh264 codec version = %s.",
VERSION_NUMBER);
WelsEndDecoder (m_pDecContext); WelsEndDecoder (m_pDecContext);
@ -265,7 +266,7 @@ long CWelsDecoder::SetOption (DECODER_OPTION eOptID, void* pOption) {
iVal = ERROR_CON_SLICE_COPY; iVal = ERROR_CON_SLICE_COPY;
else else
iVal = * ((int*)pOption); //EC method iVal = * ((int*)pOption); //EC method
m_pDecContext->iErrorConMethod = iVal; m_pDecContext->eErrorConMethod = (ERROR_CON_IDC) iVal;
return cmResultSuccess; return cmResultSuccess;
} else if (eOptID == DECODER_OPTION_TRACE_LEVEL) { } else if (eOptID == DECODER_OPTION_TRACE_LEVEL) {
if (m_pWelsTrace) { if (m_pWelsTrace) {
@ -339,7 +340,7 @@ long CWelsDecoder::GetOption (DECODER_OPTION eOptID, void* pOption) {
* ((int*)pOption) = iVal; * ((int*)pOption) = iVal;
return cmResultSuccess; return cmResultSuccess;
} else if (DECODER_OPTION_ERROR_CON_IDC == eOptID) { } else if (DECODER_OPTION_ERROR_CON_IDC == eOptID) {
iVal = m_pDecContext->iErrorConMethod; iVal = (int) m_pDecContext->eErrorConMethod;
* ((int*)pOption) = iVal; * ((int*)pOption) = iVal;
return cmResultSuccess; return cmResultSuccess;
} }
@ -399,7 +400,7 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc,
//for AVC bitstream (excluding AVC with temporal scalability, including TP), as long as error occur, SHOULD notify upper layer key frame loss. //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) || if ((IS_PARAM_SETS_NALS (eNalType) || NAL_UNIT_CODED_SLICE_IDR == eNalType) ||
(VIDEO_BITSTREAM_AVC == m_pDecContext->eVideoType)) { (VIDEO_BITSTREAM_AVC == m_pDecContext->eVideoType)) {
if (m_pDecContext->iErrorConMethod == ERROR_CON_DISABLE) { if (m_pDecContext->eErrorConMethod == ERROR_CON_DISABLE) {
#ifdef LONG_TERM_REF #ifdef LONG_TERM_REF
m_pDecContext->bParamSetsLostFlag = true; m_pDecContext->bParamSetsLostFlag = true;
#else #else

View File

@ -574,7 +574,7 @@ class OpenH264VideoDecoder : public GMPVideoDecoder {
memset (&param, 0, sizeof (param)); memset (&param, 0, sizeof (param));
param.iOutputColorFormat = videoFormatI420; param.iOutputColorFormat = videoFormatI420;
param.uiTargetDqLayer = UCHAR_MAX; // Default value param.uiTargetDqLayer = UCHAR_MAX; // Default value
param.uiEcActiveFlag = 1; // Error concealment on. param.eEcActiveIdc = ERROR_CON_SLICE_COPY; // Error concealment on.
param.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT; param.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
if (decoder_->Initialize (&param)) { if (decoder_->Initialize (&param)) {

View File

@ -55,7 +55,7 @@ void BaseDecoderTest::SetUp() {
memset (&decParam, 0, sizeof (SDecodingParam)); memset (&decParam, 0, sizeof (SDecodingParam));
decParam.iOutputColorFormat = videoFormatI420; decParam.iOutputColorFormat = videoFormatI420;
decParam.uiTargetDqLayer = UCHAR_MAX; decParam.uiTargetDqLayer = UCHAR_MAX;
decParam.uiEcActiveFlag = 1; decParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
decParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT; decParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
rv = decoder_->Initialize (&decParam); rv = decoder_->Initialize (&decParam);

View File

@ -231,7 +231,7 @@ TEST (ErrorConTest, DoErrorConFrameCopy) {
return; return;
} }
pECCtx->pCtx->iErrorConMethod = ERROR_CON_FRAME_COPY; pECCtx->pCtx->eErrorConMethod = ERROR_CON_FRAME_COPY;
InitECCopyData (pECCtx); InitECCopyData (pECCtx);
//case 1: no reference picture //case 1: no reference picture
pECCtx->pCtx->pPreviousDecodedPictureInDpb = NULL; pECCtx->pCtx->pPreviousDecodedPictureInDpb = NULL;
@ -263,7 +263,7 @@ TEST (ErrorConTest, DoErrorConSliceCopy) {
FreeInputData (pECCtx); FreeInputData (pECCtx);
return; return;
} }
pECCtx->pCtx->iErrorConMethod = ERROR_CON_SLICE_COPY; pECCtx->pCtx->eErrorConMethod = ERROR_CON_SLICE_COPY;
InitECCopyData (pECCtx); InitECCopyData (pECCtx);
//case 1: no reference picture //case 1: no reference picture
pECCtx->pCtx->pPreviousDecodedPictureInDpb = NULL; pECCtx->pCtx->pPreviousDecodedPictureInDpb = NULL;