modify decoder log

This commit is contained in:
dong zhang
2015-03-02 14:43:21 +08:00
parent 7c9597c36d
commit d28970d625
6 changed files with 69 additions and 11 deletions

View File

@@ -659,7 +659,12 @@ typedef struct TagVideoDecoderStatistics {
uiFreezingIDRNum; ///< number of freezing IDR with error (partly received), under resolution change uiFreezingIDRNum; ///< number of freezing IDR with error (partly received), under resolution change
unsigned int uiFreezingNonIDRNum; ///< number of freezing non-IDR with error unsigned int uiFreezingNonIDRNum; ///< number of freezing non-IDR with error
int iAvgLumaQp; ///< average luma QP. default: -1, no correct frame outputted int iAvgLumaQp; ///< average luma QP. default: -1, no correct frame outputted
int iSpsReportErrorNum; ///< number of Sps Invalid report
int iSubSpsReportErrorNum; ///< number of SubSps Invalid report
int iPpsReportErrorNum; ///< number of Pps Invalid report
int iSpsNoExistNalNum; ///< number of Sps NoExist Nal
int iSubSpsNoExistNalNum; ///< number of SubSps NoExist Nal
int iPpsNoExistNalNum; ///< number of Pps NoExist Nal
} SDecoderStatistics; // in building, coming soon } SDecoderStatistics; // in building, coming soon
#endif//WELS_VIDEO_CODEC_APPLICATION_DEFINITION_H__ #endif//WELS_VIDEO_CODEC_APPLICATION_DEFINITION_H__

View File

@@ -335,9 +335,20 @@ bool bSpsExistAheadFlag; // whether does SPS NAL exist ahead of sequence?
bool bSubspsExistAheadFlag;// whether does Subset SPS NAL exist ahead of sequence? bool bSubspsExistAheadFlag;// whether does Subset SPS NAL exist ahead of sequence?
bool bPpsExistAheadFlag; // whether does PPS NAL exist ahead of sequence? bool bPpsExistAheadFlag; // whether does PPS NAL exist ahead of sequence?
int32_t iSpsErrorIgnored;
int32_t iSubSpsErrorIgnored;
int32_t iPpsErrorIgnored;
bool bSpsAvailFlags[MAX_SPS_COUNT]; bool bSpsAvailFlags[MAX_SPS_COUNT];
bool bSubspsAvailFlags[MAX_SPS_COUNT]; bool bSubspsAvailFlags[MAX_SPS_COUNT];
bool bPpsAvailFlags[MAX_PPS_COUNT]; bool bPpsAvailFlags[MAX_PPS_COUNT];
int32_t iPPSLastInvalidId;
int32_t iPPSInvalidNum;
int32_t iSPSLastInvalidId;
int32_t iSPSInvalidNum;
int32_t iSubSPSLastInvalidId;
int32_t iSubSPSInvalidNum;
bool bReferenceLostAtT0Flag; bool bReferenceLostAtT0Flag;
int32_t iTotalNumMbRec; //record current number of decoded MB int32_t iTotalNumMbRec; //record current number of decoded MB
#ifdef LONG_TERM_REF #ifdef LONG_TERM_REF

View File

@@ -77,7 +77,6 @@
#define MAX_BUFFERED_NUM 3 //mamixum stored number of AU|packet to prevent overwrite #define MAX_BUFFERED_NUM 3 //mamixum stored number of AU|packet to prevent overwrite
#define MAX_ACCESS_UNIT_CAPACITY 7077888 //Maximum AU size in bytes for level 5.2 for single frame #define MAX_ACCESS_UNIT_CAPACITY 7077888 //Maximum AU size in bytes for level 5.2 for single frame
#define MAX_MACROBLOCK_CAPACITY 5000 //Maximal legal MB capacity, 15000 bits is enough #define MAX_MACROBLOCK_CAPACITY 5000 //Maximal legal MB capacity, 15000 bits is enough
enum { enum {
BASE_MB = 0, BASE_MB = 0,
NON_AVC_REWRITE_ENHANCE_MB =1, NON_AVC_REWRITE_ENHANCE_MB =1,

View File

@@ -146,36 +146,47 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
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)) {
if (pCtx->bPrintFrameErrorTraceFlag) { if (pCtx->bPrintFrameErrorTraceFlag && pCtx->iSpsErrorIgnored == 0) {
WelsLog (pLogCtx, WELS_LOG_WARNING, WelsLog (pLogCtx, WELS_LOG_WARNING,
"parse_nal(), no exist Sequence Parameter Sets ahead of sequence when try to decode NAL(type:%d).", "parse_nal(), no exist Sequence Parameter Sets ahead of sequence when try to decode NAL(type:%d).",
pNalUnitHeader->eNalUnitType); pNalUnitHeader->eNalUnitType);
} else {
pCtx->iSpsErrorIgnored++;
} }
pCtx->sDecoderStatistics.iSpsNoExistNalNum++;
pCtx->iErrorCode = dsNoParamSets; pCtx->iErrorCode = dsNoParamSets;
return NULL; return NULL;
} }
pCtx->iSpsErrorIgnored = 0;
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)) {
if (pCtx->bPrintFrameErrorTraceFlag) { if (pCtx->bPrintFrameErrorTraceFlag && pCtx->iPpsErrorIgnored == 0) {
WelsLog (pLogCtx, WELS_LOG_WARNING, WelsLog (pLogCtx, WELS_LOG_WARNING,
"parse_nal(), no exist Picture Parameter Sets ahead of sequence when try to decode NAL(type:%d).", "parse_nal(), no exist Picture Parameter Sets ahead of sequence when try to decode NAL(type:%d).",
pNalUnitHeader->eNalUnitType); pNalUnitHeader->eNalUnitType);
} else {
pCtx->iPpsErrorIgnored++;
} }
pCtx->sDecoderStatistics.iPpsNoExistNalNum++;
pCtx->iErrorCode = dsNoParamSets; pCtx->iErrorCode = dsNoParamSets;
return NULL; return NULL;
} }
pCtx->iPpsErrorIgnored = 0;
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))) {
if (pCtx->bPrintFrameErrorTraceFlag) { if (pCtx->bPrintFrameErrorTraceFlag && pCtx->iSubSpsErrorIgnored == 0) {
WelsLog (pLogCtx, WELS_LOG_WARNING, WelsLog (pLogCtx, WELS_LOG_WARNING,
"ParseNalHeader(), no exist Parameter Sets ahead of sequence when try to decode slice(type:%d).", "ParseNalHeader(), no exist Parameter Sets ahead of sequence when try to decode slice(type:%d).",
pNalUnitHeader->eNalUnitType); pNalUnitHeader->eNalUnitType);
} else {
pCtx->iSubSpsErrorIgnored++;
} }
pCtx->sDecoderStatistics.iSubSpsNoExistNalNum++;
pCtx->iErrorCode |= dsNoParamSets; pCtx->iErrorCode |= dsNoParamSets;
return NULL; return NULL;
} }
pCtx->iSubSpsErrorIgnored = 0;
switch (pNalUnitHeader->eNalUnitType) { switch (pNalUnitHeader->eNalUnitType) {
case NAL_UNIT_AU_DELIMITER: case NAL_UNIT_AU_DELIMITER:

View File

@@ -311,7 +311,15 @@ void WelsDecoderDefaults (PWelsDecoderContext pCtx, SLogContext* pLogCtx) {
pCtx->sDecoderStatistics.iAvgLumaQp = -1; pCtx->sDecoderStatistics.iAvgLumaQp = -1;
pCtx->bSpsLatePps = false; pCtx->bSpsLatePps = false;
pCtx->bUseScalingList = false; pCtx->bUseScalingList = false;
pCtx->iSpsErrorIgnored = 0;
pCtx->iSubSpsErrorIgnored = 0;
pCtx->iPpsErrorIgnored = 0;
pCtx->iPPSInvalidNum = 0;
pCtx->iPPSLastInvalidId = -1;
pCtx->iSPSInvalidNum = 0;
pCtx->iSPSLastInvalidId = -1;
pCtx->iSubSPSInvalidNum = 0;
pCtx->iSubSPSLastInvalidId = -1;
} }
/* /*

View File

@@ -566,10 +566,18 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co
//add check PPS available here //add check PPS available here
if (pCtx->bPpsAvailFlags[iPpsId] == false) { if (pCtx->bPpsAvailFlags[iPpsId] == false) {
WelsLog (pLogCtx, WELS_LOG_ERROR, "PPS id is invalid!"); pCtx->sDecoderStatistics.iPpsReportErrorNum++;
if (pCtx->iPPSLastInvalidId != iPpsId) {
WelsLog (pLogCtx, WELS_LOG_ERROR, "PPS id (%d) is invalid, previous id (%d) error ignored (%d)!", iPpsId, pCtx->iPPSLastInvalidId, pCtx->iPPSInvalidNum);
pCtx->iPPSLastInvalidId = iPpsId;
pCtx->iPPSInvalidNum = 0;
} else {
pCtx->iPPSInvalidNum++;
}
pCtx->iErrorCode |= dsNoParamSets; pCtx->iErrorCode |= dsNoParamSets;
return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_PPS_ID); return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_PPS_ID);
} }
pCtx->iPPSLastInvalidId = -1;
pPps = &pCtx->sPpsBuffer[iPpsId]; pPps = &pCtx->sPpsBuffer[iPpsId];
@@ -583,16 +591,32 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co
pSubsetSps = &pCtx->sSubsetSpsBuffer[pPps->iSpsId]; pSubsetSps = &pCtx->sSubsetSpsBuffer[pPps->iSpsId];
pSps = &pSubsetSps->sSps; pSps = &pSubsetSps->sSps;
if (pCtx->bSubspsAvailFlags[pPps->iSpsId] == false) { if (pCtx->bSubspsAvailFlags[pPps->iSpsId] == false) {
WelsLog (pLogCtx, WELS_LOG_ERROR, "SPS id is invalid!"); pCtx->sDecoderStatistics.iSubSpsReportErrorNum++;
if (pCtx->iSubSPSLastInvalidId != pPps->iSpsId) {
WelsLog (pLogCtx, WELS_LOG_ERROR, "Sub SPS id (%d) is invalid, previous id (%d) error ignored (%d)!", pPps->iSpsId, pCtx->iSubSPSLastInvalidId, pCtx->iSubSPSInvalidNum);
pCtx->iSubSPSLastInvalidId = pPps->iSpsId;
pCtx->iSubSPSInvalidNum = 0;
} else {
pCtx->iSubSPSInvalidNum++;
}
pCtx->iErrorCode |= dsNoParamSets; pCtx->iErrorCode |= dsNoParamSets;
return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_SPS_ID); return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_SPS_ID);
} }
pCtx->iSubSPSLastInvalidId = -1;
} else { } else {
if (pCtx->bSpsAvailFlags[pPps->iSpsId] == false) { if (pCtx->bSpsAvailFlags[pPps->iSpsId] == false) {
WelsLog (pLogCtx, WELS_LOG_ERROR, "SPS id is invalid!"); pCtx->sDecoderStatistics.iSpsReportErrorNum++;
if (pCtx->iSPSLastInvalidId != pPps->iSpsId) {
WelsLog (pLogCtx, WELS_LOG_ERROR, "SPS id (%d) is invalid, previous id (%d) error ignored (%d)!", pPps->iSpsId, pCtx->iSPSLastInvalidId, pCtx->iSPSInvalidNum);
pCtx->iSPSLastInvalidId = pPps->iSpsId;
pCtx->iSPSInvalidNum = 0;
} else {
pCtx->iSPSInvalidNum++;
}
pCtx->iErrorCode |= dsNoParamSets; pCtx->iErrorCode |= dsNoParamSets;
return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_SPS_ID); return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_SPS_ID);
} }
pCtx->iSPSLastInvalidId = -1;
pSps = &pCtx->sSpsBuffer[pPps->iSpsId]; pSps = &pCtx->sSpsBuffer[pPps->iSpsId];
} }
pSliceHead->iPpsId = iPpsId; pSliceHead->iPpsId = iPpsId;
@@ -2051,7 +2075,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf
pCtx->bRPLRError = true; pCtx->bRPLRError = true;
bAllRefComplete = false; // RPLR error, set ref pictures complete flag false bAllRefComplete = false; // RPLR error, set ref pictures complete flag false
HandleReferenceLost (pCtx, pNalCur); HandleReferenceLost (pCtx, pNalCur);
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,
"reference picture introduced by this frame is lost during transmission! uiTId: %d", "reference picture introduced by this frame is lost during transmission! uiTId: %d",
pNalCur->sNalHeaderExt.uiTemporalId); pNalCur->sNalHeaderExt.uiTemporalId);
if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) { if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {