Merge pull request #1115 from huili2/dec_log_decrease

decrease dec log size
This commit is contained in:
huili2 2014-07-09 10:59:56 +08:00
commit 0dbdbfb53b
5 changed files with 36 additions and 23 deletions

View File

@ -319,6 +319,8 @@ int32_t iFeedbackTidInAu;
bool bAuReadyFlag; // true: one au is ready for decoding; false: default value bool bAuReadyFlag; // true: one au is ready for decoding; false: default value
bool bDecErrorConedFlag; //true: current decoder is error coned bool bDecErrorConedFlag; //true: current decoder is error coned
bool bPrintFrameErrorTraceFlag; //true: can print info for upper layer
int32_t iIgnoredErrorInfoPacketCount; //store the packet number with error decoding info
//trace handle //trace handle
void* pTraceHandle; void* pTraceHandle;

View File

@ -141,32 +141,34 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
--iNalSize; --iNalSize;
++ (*pConsumedBytes); ++ (*pConsumedBytes);
#ifdef DEBUG_PARSE_INFO
WelsLog (pLogCtx, WELS_LOG_INFO, "nal type: %d \n", pNalUnitHeader->eNalUnitType);
#endif
if (! (IS_SEI_NAL (pNalUnitHeader->eNalUnitType) || IS_SPS_NAL (pNalUnitHeader->eNalUnitType) if (! (IS_SEI_NAL (pNalUnitHeader->eNalUnitType) || IS_SPS_NAL (pNalUnitHeader->eNalUnitType)
|| pCtx->bSpsExistAheadFlag)) { || pCtx->bSpsExistAheadFlag)) {
WelsLog (pLogCtx, WELS_LOG_WARNING, if (pCtx->bPrintFrameErrorTraceFlag) {
WelsLog (pLogCtx, WELS_LOG_WARNING,
"parse_nal(), no exist Sequence Parameter Sets ahead of sequence when try to decode NAL(type:%d).\n", "parse_nal(), no exist Sequence Parameter Sets ahead of sequence when try to decode NAL(type:%d).\n",
pNalUnitHeader->eNalUnitType); pNalUnitHeader->eNalUnitType);
}
pCtx->iErrorCode = dsNoParamSets; pCtx->iErrorCode = dsNoParamSets;
return NULL; return NULL;
} }
if (! (IS_SEI_NAL (pNalUnitHeader->eNalUnitType) || IS_PARAM_SETS_NALS (pNalUnitHeader->eNalUnitType) if (! (IS_SEI_NAL (pNalUnitHeader->eNalUnitType) || IS_PARAM_SETS_NALS (pNalUnitHeader->eNalUnitType)
|| pCtx->bPpsExistAheadFlag)) { || pCtx->bPpsExistAheadFlag)) {
WelsLog (pLogCtx, WELS_LOG_WARNING, if (pCtx->bPrintFrameErrorTraceFlag) {
WelsLog (pLogCtx, WELS_LOG_WARNING,
"parse_nal(), no exist Picture Parameter Sets ahead of sequence when try to decode NAL(type:%d).\n", "parse_nal(), no exist Picture Parameter Sets ahead of sequence when try to decode NAL(type:%d).\n",
pNalUnitHeader->eNalUnitType); pNalUnitHeader->eNalUnitType);
}
pCtx->iErrorCode = dsNoParamSets; pCtx->iErrorCode = dsNoParamSets;
return NULL; return NULL;
} }
if ((IS_VCL_NAL_AVC_BASE (pNalUnitHeader->eNalUnitType) && ! (pCtx->bSpsExistAheadFlag || pCtx->bPpsExistAheadFlag)) || if ((IS_VCL_NAL_AVC_BASE (pNalUnitHeader->eNalUnitType) && ! (pCtx->bSpsExistAheadFlag || pCtx->bPpsExistAheadFlag)) ||
(IS_NEW_INTRODUCED_SVC_NAL (pNalUnitHeader->eNalUnitType) && ! (pCtx->bSpsExistAheadFlag || pCtx->bSubspsExistAheadFlag (IS_NEW_INTRODUCED_SVC_NAL (pNalUnitHeader->eNalUnitType) && ! (pCtx->bSpsExistAheadFlag || pCtx->bSubspsExistAheadFlag
|| pCtx->bPpsExistAheadFlag))) { || pCtx->bPpsExistAheadFlag))) {
WelsLog (pLogCtx, WELS_LOG_WARNING, if (pCtx->bPrintFrameErrorTraceFlag) {
WelsLog (pLogCtx, WELS_LOG_WARNING,
"ParseNalHeader(), no exist Parameter Sets ahead of sequence when try to decode slice(type:%d).\n", "ParseNalHeader(), no exist Parameter Sets ahead of sequence when try to decode slice(type:%d).\n",
pNalUnitHeader->eNalUnitType); pNalUnitHeader->eNalUnitType);
}
pCtx->iErrorCode |= dsNoParamSets; pCtx->iErrorCode |= dsNoParamSets;
return NULL; return NULL;
} }
@ -244,7 +246,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
uint32_t uiAvailNalNum; uint32_t uiAvailNalNum;
pCurNal = MemGetNextNal (&pCtx->pAccessUnitList); pCurNal = MemGetNextNal (&pCtx->pAccessUnitList);
if (NULL == pCurNal) { if (NULL == pCurNal) {
WelsLog (pLogCtx, WELS_LOG_WARNING, "MemGetNextNal() fail due out of memory.\n"); WelsLog (pLogCtx, WELS_LOG_ERROR, "MemGetNextNal() fail due out of memory.\n");
pCtx->iErrorCode |= dsOutOfMemory; pCtx->iErrorCode |= dsOutOfMemory;
return NULL; return NULL;
} }
@ -502,9 +504,6 @@ int32_t ParseNonVclNal (PWelsDecoderContext pCtx, uint8_t* pRbsp, const int32_t
case NAL_UNIT_SUBSET_SPS: case NAL_UNIT_SUBSET_SPS:
if (iBitSize > 0) if (iBitSize > 0)
InitBits (pBs, pRbsp, iBitSize); InitBits (pBs, pRbsp, iBitSize);
#ifdef DEBUG_PARSE_INFO
WelsLog (&(pCtx->sLogCtx), WELS_LOG_INFO, "parsing nal: %d \n", eNalType);
#endif
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->iErrorConMethod == ERROR_CON_DISABLE)
@ -517,9 +516,6 @@ int32_t ParseNonVclNal (PWelsDecoderContext pCtx, uint8_t* pRbsp, const int32_t
case NAL_UNIT_PPS: case NAL_UNIT_PPS:
if (iBitSize > 0) if (iBitSize > 0)
InitBits (pBs, pRbsp, iBitSize); InitBits (pBs, pRbsp, iBitSize);
#ifdef DEBUG_PARSE_INFO
WelsLog (&(pCtx->sLogCtx), WELS_LOG_INFO, "parsing nal: %d \n", eNalType);
#endif
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->iErrorConMethod == ERROR_CON_DISABLE)

View File

@ -295,6 +295,8 @@ void WelsOpenDecoder (PWelsDecoderContext pCtx) {
#endif //LONG_TERM_REF #endif //LONG_TERM_REF
pCtx->bNewSeqBegin = true; pCtx->bNewSeqBegin = true;
pCtx->bDecErrorConedFlag = false; //default: decoder normal status pCtx->bDecErrorConedFlag = false; //default: decoder normal status
pCtx->bPrintFrameErrorTraceFlag = true;
pCtx->iIgnoredErrorInfoPacketCount = 0;
} }
/*! /*!
@ -312,6 +314,8 @@ void WelsCloseDecoder (PWelsDecoderContext pCtx) {
#else #else
pCtx->bReferenceLostAtT0Flag = false; pCtx->bReferenceLostAtT0Flag = false;
#endif #endif
pCtx->bNewSeqBegin = false;
pCtx->bPrintFrameErrorTraceFlag = false;
} }
/*! /*!

View File

@ -63,14 +63,18 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t
#else #else
pCtx->bReferenceLostAtT0Flag = false; // need initialize it due new seq, 6/4/2010 pCtx->bReferenceLostAtT0Flag = false; // need initialize it due new seq, 6/4/2010
#endif //LONG_TERM_REF #endif //LONG_TERM_REF
WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO, if (pCtx->iTotalNumMbRec == kiTotalNumMbInCurLayer) {
"DecodeFrameConstruction()::::output first frame of new sequence, %d x %d, crop_left:%d, crop_right:%d, crop_top:%d, crop_bottom:%d.\n", pCtx->bPrintFrameErrorTraceFlag = true;
WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO,
"DecodeFrameConstruction()::::output first frame of new sequence, %d x %d, crop_left:%d, crop_right:%d, crop_top:%d, crop_bottom:%d, ignored error packet:%d.\n",
kiWidth, kiHeight, pCtx->sFrameCrop.iLeftOffset, pCtx->sFrameCrop.iRightOffset, pCtx->sFrameCrop.iTopOffset, kiWidth, kiHeight, pCtx->sFrameCrop.iLeftOffset, pCtx->sFrameCrop.iRightOffset, pCtx->sFrameCrop.iTopOffset,
pCtx->sFrameCrop.iBottomOffset); pCtx->sFrameCrop.iBottomOffset, pCtx->iIgnoredErrorInfoPacketCount);
pCtx->iIgnoredErrorInfoPacketCount = 0;
}
} }
if (pCtx->iTotalNumMbRec != kiTotalNumMbInCurLayer) { if (pCtx->iTotalNumMbRec != kiTotalNumMbInCurLayer) {
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,
"DecodeFrameConstruction():::iTotalNumMbRec:%d, total_num_mb_sps:%d, cur_layer_mb_width:%d, cur_layer_mb_height:%d \n", "DecodeFrameConstruction():::iTotalNumMbRec:%d, total_num_mb_sps:%d, cur_layer_mb_width:%d, cur_layer_mb_height:%d \n",
pCtx->iTotalNumMbRec, kiTotalNumMbInCurLayer, pCurDq->iMbWidth, pCurDq->iMbHeight); pCtx->iTotalNumMbRec, kiTotalNumMbInCurLayer, pCurDq->iMbWidth, pCurDq->iMbHeight);
bFrameCompleteFlag = false; //return later after output buffer is done bFrameCompleteFlag = false; //return later after output buffer is done

View File

@ -189,7 +189,7 @@ long CWelsDecoder::Initialize (const SDecodingParam* pParam) {
} }
if (pParam == NULL) { if (pParam == NULL) {
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::Initialize(), invalid input argument."); WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "CWelsDecoder::Initialize(), invalid input argument.");
return cmInitParaError; return cmInitParaError;
} }
@ -211,7 +211,7 @@ void CWelsDecoder::UninitDecoder (void) {
if (NULL == m_pDecContext) if (NULL == m_pDecContext)
return; return;
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "into CWelsDecoder::uninit_decoder().."); WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::uninit_decoder()..");
WelsEndDecoder (m_pDecContext); WelsEndDecoder (m_pDecContext);
@ -221,7 +221,6 @@ void CWelsDecoder::UninitDecoder (void) {
m_pDecContext = NULL; m_pDecContext = NULL;
} }
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "left CWelsDecoder::uninit_decoder()..");
} }
// the return value of this function is not suitable, it need report failure info to upper layer. // the return value of this function is not suitable, it need report failure info to upper layer.
@ -233,7 +232,6 @@ void CWelsDecoder::InitDecoder (void) {
WelsInitDecoder (m_pDecContext, &m_pWelsTrace->m_sLogCtx); WelsInitDecoder (m_pDecContext, &m_pWelsTrace->m_sLogCtx);
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::init_decoder().. left");
} }
/* /*
@ -411,8 +409,17 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc,
} }
} }
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "decode failed, failure type:%d \n", if (m_pDecContext->bPrintFrameErrorTraceFlag) {
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "decode failed, failure type:%d \n",
m_pDecContext->iErrorCode); m_pDecContext->iErrorCode);
m_pDecContext->bPrintFrameErrorTraceFlag = false;
} else {
m_pDecContext->iIgnoredErrorInfoPacketCount ++;
if (m_pDecContext->iIgnoredErrorInfoPacketCount == INT_MAX) {
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING, "continuous error reached INT_MAX! Restart as 0.");
m_pDecContext->iIgnoredErrorInfoPacketCount = 0;
}
}
return (DECODING_STATE)m_pDecContext->iErrorCode; return (DECODING_STATE)m_pDecContext->iErrorCode;
} else { //decoding correct, but may have ECed status } else { //decoding correct, but may have ECed status
if (m_pDecContext->bDecErrorConedFlag) { if (m_pDecContext->bDecErrorConedFlag) {