History

Merge pull request #1115 from huili2/dec_log_decrease

decrease dec log size

huili2 committed 12 years ago

Commit 0dbdbfb2 parents 5f88226 581f8fd5 files · +36 −23Browse files

Unified · Split

5 files
  1. codec/decoder/core/inc/decoder_context.h +2 −0
  2. codec/decoder/core/src/au_parser.cpp +10 −14
  3. codec/decoder/core/src/decoder.cpp +4 −0
  4. codec/decoder/core/src/decoder_core.cpp +8 −4
  5. codec/decoder/plus/src/welsDecoderExt.cpp +12 −5
codec/decoder/core/inc/decoder_context.h+2−0
@@ -319,6 +319,8 @@ int32_t iFeedbackTidInAu; · 318 unmodified lines
319bool bAuReadyFlag; // true: one au is ready for decoding; false: default value319bool bAuReadyFlag; // true: one au is ready for decoding; false: default value
320bool bDecErrorConedFlag; //true: current decoder is error coned320bool bDecErrorConedFlag; //true: current decoder is error coned
321 321
322bool bPrintFrameErrorTraceFlag; //true: can print info for upper layer
323int32_t iIgnoredErrorInfoPacketCount; //store the packet number with error decoding info
322//trace handle324//trace handle
323void* pTraceHandle;325void* pTraceHandle;
324 326
codec/decoder/core/src/au_parser.cpp+10−14
@@ -141,32 +141,34 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 140 unmodified lines
141 --iNalSize;141 --iNalSize;
142 ++ (*pConsumedBytes);142 ++ (*pConsumedBytes);
143 143
144#ifdef DEBUG_PARSE_INFO
145 WelsLog (pLogCtx, WELS_LOG_INFO, "nal type: %d \n", pNalUnitHeader->eNalUnitType);
146#endif
147
148 if (! (IS_SEI_NAL (pNalUnitHeader->eNalUnitType) || IS_SPS_NAL (pNalUnitHeader->eNalUnitType)144 if (! (IS_SEI_NAL (pNalUnitHeader->eNalUnitType) || IS_SPS_NAL (pNalUnitHeader->eNalUnitType)
149 || pCtx->bSpsExistAheadFlag)) {145 || pCtx->bSpsExistAheadFlag)) {
150 WelsLog (pLogCtx, WELS_LOG_WARNING,146 if (pCtx->bPrintFrameErrorTraceFlag) {
147 WelsLog (pLogCtx, WELS_LOG_WARNING,
151 "parse_nal(), no exist Sequence Parameter Sets ahead of sequence when try to decode NAL(type:%d).\n",148 "parse_nal(), no exist Sequence Parameter Sets ahead of sequence when try to decode NAL(type:%d).\n",
152 pNalUnitHeader->eNalUnitType);149 pNalUnitHeader->eNalUnitType);
150 }
153 pCtx->iErrorCode = dsNoParamSets;151 pCtx->iErrorCode = dsNoParamSets;
154 return NULL;152 return NULL;
155 }153 }
156 if (! (IS_SEI_NAL (pNalUnitHeader->eNalUnitType) || IS_PARAM_SETS_NALS (pNalUnitHeader->eNalUnitType)154 if (! (IS_SEI_NAL (pNalUnitHeader->eNalUnitType) || IS_PARAM_SETS_NALS (pNalUnitHeader->eNalUnitType)
157 || pCtx->bPpsExistAheadFlag)) {155 || pCtx->bPpsExistAheadFlag)) {
158 WelsLog (pLogCtx, WELS_LOG_WARNING,156 if (pCtx->bPrintFrameErrorTraceFlag) {
157 WelsLog (pLogCtx, WELS_LOG_WARNING,
159 "parse_nal(), no exist Picture Parameter Sets ahead of sequence when try to decode NAL(type:%d).\n",158 "parse_nal(), no exist Picture Parameter Sets ahead of sequence when try to decode NAL(type:%d).\n",
160 pNalUnitHeader->eNalUnitType);159 pNalUnitHeader->eNalUnitType);
160 }
161 pCtx->iErrorCode = dsNoParamSets;161 pCtx->iErrorCode = dsNoParamSets;
162 return NULL;162 return NULL;
163 }163 }
164 if ((IS_VCL_NAL_AVC_BASE (pNalUnitHeader->eNalUnitType) && ! (pCtx->bSpsExistAheadFlag || pCtx->bPpsExistAheadFlag)) ||164 if ((IS_VCL_NAL_AVC_BASE (pNalUnitHeader->eNalUnitType) && ! (pCtx->bSpsExistAheadFlag || pCtx->bPpsExistAheadFlag)) ||
165 (IS_NEW_INTRODUCED_SVC_NAL (pNalUnitHeader->eNalUnitType) && ! (pCtx->bSpsExistAheadFlag || pCtx->bSubspsExistAheadFlag165 (IS_NEW_INTRODUCED_SVC_NAL (pNalUnitHeader->eNalUnitType) && ! (pCtx->bSpsExistAheadFlag || pCtx->bSubspsExistAheadFlag
166 || pCtx->bPpsExistAheadFlag))) {166 || pCtx->bPpsExistAheadFlag))) {
167 WelsLog (pLogCtx, WELS_LOG_WARNING,167 if (pCtx->bPrintFrameErrorTraceFlag) {
168 WelsLog (pLogCtx, WELS_LOG_WARNING,
168 "ParseNalHeader(), no exist Parameter Sets ahead of sequence when try to decode slice(type:%d).\n",169 "ParseNalHeader(), no exist Parameter Sets ahead of sequence when try to decode slice(type:%d).\n",
169 pNalUnitHeader->eNalUnitType);170 pNalUnitHeader->eNalUnitType);
171 }
170 pCtx->iErrorCode |= dsNoParamSets;172 pCtx->iErrorCode |= dsNoParamSets;
171 return NULL;173 return NULL;
172 }174 }
@@ -244,7 +246,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 71 unmodified lines
244 uint32_t uiAvailNalNum;246 uint32_t uiAvailNalNum;
245 pCurNal = MemGetNextNal (&pCtx->pAccessUnitList);247 pCurNal = MemGetNextNal (&pCtx->pAccessUnitList);
246 if (NULL == pCurNal) {248 if (NULL == pCurNal) {
247 WelsLog (pLogCtx, WELS_LOG_WARNING, "MemGetNextNal() fail due out of memory.\n");249 WelsLog (pLogCtx, WELS_LOG_ERROR, "MemGetNextNal() fail due out of memory.\n");
248 pCtx->iErrorCode |= dsOutOfMemory;250 pCtx->iErrorCode |= dsOutOfMemory;
249 return NULL;251 return NULL;
250 }252 }
@@ -502,9 +504,6 @@ int32_t ParseNonVclNal (PWelsDecoderContext pCtx, uint8_t* pRbsp, const int32_t · 251 unmodified lines
502 case NAL_UNIT_SUBSET_SPS:504 case NAL_UNIT_SUBSET_SPS:
503 if (iBitSize > 0)505 if (iBitSize > 0)
504 InitBits (pBs, pRbsp, iBitSize);506 InitBits (pBs, pRbsp, iBitSize);
505#ifdef DEBUG_PARSE_INFO
506 WelsLog (&(pCtx->sLogCtx), WELS_LOG_INFO, "parsing nal: %d \n", eNalType);
507#endif
508 iErr = ParseSps (pCtx, pBs, &iPicWidth, &iPicHeight);507 iErr = ParseSps (pCtx, pBs, &iPicWidth, &iPicHeight);
509 if (ERR_NONE != iErr) { // modified for pSps/pSubsetSps invalid, 12/1/2009508 if (ERR_NONE != iErr) { // modified for pSps/pSubsetSps invalid, 12/1/2009
510 if (pCtx->iErrorConMethod == ERROR_CON_DISABLE)509 if (pCtx->iErrorConMethod == ERROR_CON_DISABLE)
@@ -517,9 +516,6 @@ int32_t ParseNonVclNal (PWelsDecoderContext pCtx, uint8_t* pRbsp, const int32_t · 6 unmodified lines
517 case NAL_UNIT_PPS:516 case NAL_UNIT_PPS:
518 if (iBitSize > 0)517 if (iBitSize > 0)
519 InitBits (pBs, pRbsp, iBitSize);518 InitBits (pBs, pRbsp, iBitSize);
520#ifdef DEBUG_PARSE_INFO
521 WelsLog (&(pCtx->sLogCtx), WELS_LOG_INFO, "parsing nal: %d \n", eNalType);
522#endif
523 iErr = ParsePps (pCtx, &pCtx->sPpsBuffer[0], pBs);519 iErr = ParsePps (pCtx, &pCtx->sPpsBuffer[0], pBs);
524 if (ERR_NONE != iErr) { // modified for pps invalid, 12/1/2009520 if (ERR_NONE != iErr) { // modified for pps invalid, 12/1/2009
525 if (pCtx->iErrorConMethod == ERROR_CON_DISABLE)521 if (pCtx->iErrorConMethod == ERROR_CON_DISABLE)
codec/decoder/core/src/decoder.cpp+4−0
@@ -295,6 +295,8 @@ void WelsOpenDecoder (PWelsDecoderContext pCtx) { · 294 unmodified lines
295#endif //LONG_TERM_REF295#endif //LONG_TERM_REF
296 pCtx->bNewSeqBegin = true;296 pCtx->bNewSeqBegin = true;
297 pCtx->bDecErrorConedFlag = false; //default: decoder normal status297 pCtx->bDecErrorConedFlag = false; //default: decoder normal status
298 pCtx->bPrintFrameErrorTraceFlag = true;
299 pCtx->iIgnoredErrorInfoPacketCount = 0;
298}300}
299 301
300/*!302/*!
@@ -312,6 +314,8 @@ void WelsCloseDecoder (PWelsDecoderContext pCtx) { · 11 unmodified lines
312#else314#else
313 pCtx->bReferenceLostAtT0Flag = false;315 pCtx->bReferenceLostAtT0Flag = false;
314#endif316#endif
317 pCtx->bNewSeqBegin = false;
318 pCtx->bPrintFrameErrorTraceFlag = false;
315}319}
316 320
317/*!321/*!
codec/decoder/core/src/decoder_core.cpp+8−4
@@ -63,14 +63,18 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 62 unmodified lines
63#else63#else
64 pCtx->bReferenceLostAtT0Flag = false; // need initialize it due new seq, 6/4/201064 pCtx->bReferenceLostAtT0Flag = false; // need initialize it due new seq, 6/4/2010
65#endif //LONG_TERM_REF65#endif //LONG_TERM_REF
66 WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO,66 if (pCtx->iTotalNumMbRec == kiTotalNumMbInCurLayer) {
67 "DecodeFrameConstruction()::::output first frame of new sequence, %d x %d, crop_left:%d, crop_right:%d, crop_top:%d, crop_bottom:%d.\n",67 pCtx->bPrintFrameErrorTraceFlag = true;
68 WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO,
69 "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",
68 kiWidth, kiHeight, pCtx->sFrameCrop.iLeftOffset, pCtx->sFrameCrop.iRightOffset, pCtx->sFrameCrop.iTopOffset,70 kiWidth, kiHeight, pCtx->sFrameCrop.iLeftOffset, pCtx->sFrameCrop.iRightOffset, pCtx->sFrameCrop.iTopOffset,
69 pCtx->sFrameCrop.iBottomOffset);71 pCtx->sFrameCrop.iBottomOffset, pCtx->iIgnoredErrorInfoPacketCount);
72 pCtx->iIgnoredErrorInfoPacketCount = 0;
73 }
70 }74 }
71 75
72 if (pCtx->iTotalNumMbRec != kiTotalNumMbInCurLayer) {76 if (pCtx->iTotalNumMbRec != kiTotalNumMbInCurLayer) {
73 WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,77 WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,
74 "DecodeFrameConstruction():::iTotalNumMbRec:%d, total_num_mb_sps:%d, cur_layer_mb_width:%d, cur_layer_mb_height:%d \n",78 "DecodeFrameConstruction():::iTotalNumMbRec:%d, total_num_mb_sps:%d, cur_layer_mb_width:%d, cur_layer_mb_height:%d \n",
75 pCtx->iTotalNumMbRec, kiTotalNumMbInCurLayer, pCurDq->iMbWidth, pCurDq->iMbHeight);79 pCtx->iTotalNumMbRec, kiTotalNumMbInCurLayer, pCurDq->iMbWidth, pCurDq->iMbHeight);
76 bFrameCompleteFlag = false; //return later after output buffer is done80 bFrameCompleteFlag = false; //return later after output buffer is done
codec/decoder/plus/src/welsDecoderExt.cpp+12−5
@@ -189,7 +189,7 @@ long CWelsDecoder::Initialize (const SDecodingParam* pParam) { · 188 unmodified lines
189 }189 }
190 190
191 if (pParam == NULL) {191 if (pParam == NULL) {
192 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::Initialize(), invalid input argument.");192 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "CWelsDecoder::Initialize(), invalid input argument.");
193 return cmInitParaError;193 return cmInitParaError;
194 }194 }
195 195
@@ -211,7 +211,7 @@ void CWelsDecoder::UninitDecoder (void) { · 15 unmodified lines
211 if (NULL == m_pDecContext)211 if (NULL == m_pDecContext)
212 return;212 return;
213 213
214 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "into CWelsDecoder::uninit_decoder()..");214 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::uninit_decoder()..");
215 215
216 WelsEndDecoder (m_pDecContext);216 WelsEndDecoder (m_pDecContext);
217 217
@@ -221,7 +221,6 @@ void CWelsDecoder::UninitDecoder (void) { · 3 unmodified lines
221 m_pDecContext = NULL;221 m_pDecContext = NULL;
222 }222 }
223 223
224 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "left CWelsDecoder::uninit_decoder()..");
225}224}
226 225
227// the return value of this function is not suitable, it need report failure info to upper layer.226// 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) { · 5 unmodified lines
233 232
234 WelsInitDecoder (m_pDecContext, &m_pWelsTrace->m_sLogCtx);233 WelsInitDecoder (m_pDecContext, &m_pWelsTrace->m_sLogCtx);
235 234
236 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "CWelsDecoder::init_decoder().. left");
237}235}
238 236
239/*237/*
@@ -411,8 +409,17 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc, · 171 unmodified lines
411 }409 }
412 }410 }
413 411
414 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "decode failed, failure type:%d \n",412 if (m_pDecContext->bPrintFrameErrorTraceFlag) {
413 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, "decode failed, failure type:%d \n",
415 m_pDecContext->iErrorCode);414 m_pDecContext->iErrorCode);
415 m_pDecContext->bPrintFrameErrorTraceFlag = false;
416 } else {
417 m_pDecContext->iIgnoredErrorInfoPacketCount ++;
418 if (m_pDecContext->iIgnoredErrorInfoPacketCount == INT_MAX) {
419 WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING, "continuous error reached INT_MAX! Restart as 0.");
420 m_pDecContext->iIgnoredErrorInfoPacketCount = 0;
421 }
422 }
416 return (DECODING_STATE)m_pDecContext->iErrorCode;423 return (DECODING_STATE)m_pDecContext->iErrorCode;
417 } else { //decoding correct, but may have ECed status424 } else { //decoding correct, but may have ECed status
418 if (m_pDecContext->bDecErrorConedFlag) {425 if (m_pDecContext->bDecErrorConedFlag) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t