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 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
void* pTraceHandle;

View File

@ -141,32 +141,34 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
--iNalSize;
++ (*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)
|| 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",
pNalUnitHeader->eNalUnitType);
}
pCtx->iErrorCode = dsNoParamSets;
return NULL;
}
if (! (IS_SEI_NAL (pNalUnitHeader->eNalUnitType) || IS_PARAM_SETS_NALS (pNalUnitHeader->eNalUnitType)
|| 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",
pNalUnitHeader->eNalUnitType);
}
pCtx->iErrorCode = dsNoParamSets;
return NULL;
}
if ((IS_VCL_NAL_AVC_BASE (pNalUnitHeader->eNalUnitType) && ! (pCtx->bSpsExistAheadFlag || pCtx->bPpsExistAheadFlag)) ||
(IS_NEW_INTRODUCED_SVC_NAL (pNalUnitHeader->eNalUnitType) && ! (pCtx->bSpsExistAheadFlag || pCtx->bSubspsExistAheadFlag
|| 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",
pNalUnitHeader->eNalUnitType);
}
pCtx->iErrorCode |= dsNoParamSets;
return NULL;
}
@ -244,7 +246,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
uint32_t uiAvailNalNum;
pCurNal = MemGetNextNal (&pCtx->pAccessUnitList);
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;
return NULL;
}
@ -502,9 +504,6 @@ int32_t ParseNonVclNal (PWelsDecoderContext pCtx, uint8_t* pRbsp, const int32_t
case NAL_UNIT_SUBSET_SPS:
if (iBitSize > 0)
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);
if (ERR_NONE != iErr) { // modified for pSps/pSubsetSps invalid, 12/1/2009
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:
if (iBitSize > 0)
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);
if (ERR_NONE != iErr) { // modified for pps invalid, 12/1/2009
if (pCtx->iErrorConMethod == ERROR_CON_DISABLE)

View File

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

View File

@ -63,14 +63,18 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t
#else
pCtx->bReferenceLostAtT0Flag = false; // need initialize it due new seq, 6/4/2010
#endif //LONG_TERM_REF
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.\n",
if (pCtx->iTotalNumMbRec == kiTotalNumMbInCurLayer) {
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,
pCtx->sFrameCrop.iBottomOffset);
pCtx->sFrameCrop.iBottomOffset, pCtx->iIgnoredErrorInfoPacketCount);
pCtx->iIgnoredErrorInfoPacketCount = 0;
}
}
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",
pCtx->iTotalNumMbRec, kiTotalNumMbInCurLayer, pCurDq->iMbWidth, pCurDq->iMbHeight);
bFrameCompleteFlag = false; //return later after output buffer is done

View File

@ -189,7 +189,7 @@ long CWelsDecoder::Initialize (const SDecodingParam* pParam) {
}
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;
}
@ -211,7 +211,7 @@ void CWelsDecoder::UninitDecoder (void) {
if (NULL == m_pDecContext)
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);
@ -221,7 +221,6 @@ void CWelsDecoder::UninitDecoder (void) {
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.
@ -233,7 +232,6 @@ void CWelsDecoder::InitDecoder (void) {
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->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;
} else { //decoding correct, but may have ECed status
if (m_pDecContext->bDecErrorConedFlag) {