ref: 5a1aedb622fa15f0d6fb9fbf8306e7cf9312972a
parent: 2da0ce64519c6648d6d4d28c8d7ee35b86fa138a
parent: 153dd0d3f505b68cd15c3ca8fdad132237da44c4
author: sijchen <[email protected]>
date: Tue Mar 3 06:01:46 EST 2015
Merge pull request #1827 from dongzha/cleanlog modify decoder log
--- a/codec/api/svc/codec_app_def.h
+++ b/codec/api/svc/codec_app_def.h
@@ -659,7 +659,12 @@
uiFreezingIDRNum; ///< number of freezing IDR with error (partly received), under resolution change
unsigned int uiFreezingNonIDRNum; ///< number of freezing non-IDR with error
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
#endif//WELS_VIDEO_CODEC_APPLICATION_DEFINITION_H__
--- a/codec/decoder/core/inc/decoder_context.h
+++ b/codec/decoder/core/inc/decoder_context.h
@@ -66,16 +66,15 @@
typedef struct SWels_Cabac_Element {
uint8_t uiState;
uint8_t uiMPS;
-}SWelsCabacCtx, *PWelsCabacCtx;
+} SWelsCabacCtx, *PWelsCabacCtx;
-typedef struct
-{
+typedef struct {
uint64_t uiRange;
uint64_t uiOffset;
int32_t iBitsLeft;
- uint8_t *pBuffStart;
- uint8_t *pBuffCurr;
- uint8_t *pBuffEnd;
+ uint8_t* pBuffStart;
+ uint8_t* pBuffCurr;
+ uint8_t* pBuffEnd;
} SWelsCabacDecEngine, *PWelsCabacDecEngine;
#define NEW_CTX_OFFSET_MB_TYPE_I 3
@@ -96,11 +95,11 @@
#define CTX_NUM_CBP 4
typedef struct TagDataBuffer {
-uint8_t* pHead;
-uint8_t* pEnd;
+ uint8_t* pHead;
+ uint8_t* pEnd;
-uint8_t* pStartPos;
-uint8_t* pCurPos;
+ uint8_t* pStartPos;
+ uint8_t* pCurPos;
} SDataBuffer;
//limit size for SPS PPS total permitted size for parse_only
@@ -134,19 +133,19 @@
/**/
typedef struct TagRefPic {
-PPicture pRefList[LIST_A][MAX_REF_PIC_COUNT]; // reference picture marking plus FIFO scheme
-PPicture pShortRefList[LIST_A][MAX_SHORT_REF_COUNT];
-PPicture pLongRefList[LIST_A][MAX_LONG_REF_COUNT];
-uint8_t uiRefCount[LIST_A];
-uint8_t uiShortRefCount[LIST_A];
-uint8_t uiLongRefCount[LIST_A]; // dependend on ref pic module
-int32_t iMaxLongTermFrameIdx;
+ PPicture pRefList[LIST_A][MAX_REF_PIC_COUNT]; // reference picture marking plus FIFO scheme
+ PPicture pShortRefList[LIST_A][MAX_SHORT_REF_COUNT];
+ PPicture pLongRefList[LIST_A][MAX_LONG_REF_COUNT];
+ uint8_t uiRefCount[LIST_A];
+ uint8_t uiShortRefCount[LIST_A];
+ uint8_t uiLongRefCount[LIST_A]; // dependend on ref pic module
+ int32_t iMaxLongTermFrameIdx;
} SRefPic, *PRefPic;
typedef void (*PCopyFunc) (uint8_t* pDst, int32_t iStrideD, uint8_t* pSrc, int32_t iStrideS);
typedef struct TagCopyFunc {
-PCopyFunc pCopyLumaFunc;
-PCopyFunc pCopyChromaFunc;
+ PCopyFunc pCopyLumaFunc;
+ PCopyFunc pCopyChromaFunc;
} SCopyFunc;
//deblock module defination
@@ -153,14 +152,14 @@
struct TagDeblockingFunc;
typedef struct tagDeblockingFilter {
-uint8_t* pCsData[3]; // pointer to reconstructed picture data
-int32_t iCsStride[2]; // Cs stride
-EWelsSliceType eSliceType;
-int8_t iSliceAlphaC0Offset;
-int8_t iSliceBetaOffset;
-int8_t iChromaQP[2];
-int8_t iLumaQP;
-struct TagDeblockingFunc* pLoopf;
+ uint8_t* pCsData[3]; // pointer to reconstructed picture data
+ int32_t iCsStride[2]; // Cs stride
+ EWelsSliceType eSliceType;
+ int8_t iSliceAlphaC0Offset;
+ int8_t iSliceBetaOffset;
+ int8_t iChromaQP[2];
+ int8_t iLumaQP;
+ struct TagDeblockingFunc* pLoopf;
} SDeblockingFilter, *PDeblockingFilter;
typedef void (*PDeblockingFilterMbFunc) (PDqLayer pCurDqLayer, PDeblockingFilter filter, int32_t boundry_flag);
@@ -171,35 +170,35 @@
int32_t iBeta, int8_t* iTc);
typedef void (*PChromaDeblockingEQ4Func) (uint8_t* iSampleCb, uint8_t* iSampleCr, int32_t iStride, int32_t iAlpha,
int32_t iBeta);
- typedef void (*PChromaDeblockingLT4Func2) (uint8_t* iSampleCbr,int32_t iStride, int32_t iAlpha,
- int32_t iBeta,int8_t* iTc);
- typedef void (*PChromaDeblockingEQ4Func2) (uint8_t* iSampleCbr,int32_t iStride, int32_t iAlpha,
+typedef void (*PChromaDeblockingLT4Func2) (uint8_t* iSampleCbr, int32_t iStride, int32_t iAlpha,
+ int32_t iBeta, int8_t* iTc);
+typedef void (*PChromaDeblockingEQ4Func2) (uint8_t* iSampleCbr, int32_t iStride, int32_t iAlpha,
int32_t iBeta);
typedef struct TagDeblockingFunc {
-PLumaDeblockingLT4Func pfLumaDeblockingLT4Ver;
-PLumaDeblockingEQ4Func pfLumaDeblockingEQ4Ver;
-PLumaDeblockingLT4Func pfLumaDeblockingLT4Hor;
-PLumaDeblockingEQ4Func pfLumaDeblockingEQ4Hor;
+ PLumaDeblockingLT4Func pfLumaDeblockingLT4Ver;
+ PLumaDeblockingEQ4Func pfLumaDeblockingEQ4Ver;
+ PLumaDeblockingLT4Func pfLumaDeblockingLT4Hor;
+ PLumaDeblockingEQ4Func pfLumaDeblockingEQ4Hor;
-PChromaDeblockingLT4Func pfChromaDeblockingLT4Ver;
-PChromaDeblockingEQ4Func pfChromaDeblockingEQ4Ver;
-PChromaDeblockingLT4Func pfChromaDeblockingLT4Hor;
-PChromaDeblockingEQ4Func pfChromaDeblockingEQ4Hor;
+ PChromaDeblockingLT4Func pfChromaDeblockingLT4Ver;
+ PChromaDeblockingEQ4Func pfChromaDeblockingEQ4Ver;
+ PChromaDeblockingLT4Func pfChromaDeblockingLT4Hor;
+ PChromaDeblockingEQ4Func pfChromaDeblockingEQ4Hor;
-PChromaDeblockingLT4Func2 pfChromaDeblockingLT4Ver2;
-PChromaDeblockingEQ4Func2 pfChromaDeblockingEQ4Ver2;
-PChromaDeblockingLT4Func2 pfChromaDeblockingLT4Hor2;
-PChromaDeblockingEQ4Func2 pfChromaDeblockingEQ4Hor2;
+ PChromaDeblockingLT4Func2 pfChromaDeblockingLT4Ver2;
+ PChromaDeblockingEQ4Func2 pfChromaDeblockingEQ4Ver2;
+ PChromaDeblockingLT4Func2 pfChromaDeblockingLT4Hor2;
+ PChromaDeblockingEQ4Func2 pfChromaDeblockingEQ4Hor2;
} SDeblockingFunc, *PDeblockingFunc;
typedef void (*PWelsNonZeroCountFunc) (int8_t* pNonZeroCount);
-typedef void (*PWelsBlockZeroFunc) (int16_t* block,int32_t stride);
+typedef void (*PWelsBlockZeroFunc) (int16_t* block, int32_t stride);
typedef struct TagBlockFunc {
-PWelsNonZeroCountFunc pWelsSetNonZeroCountFunc;
-PWelsBlockZeroFunc pWelsBlockZero16x16Func;
-PWelsBlockZeroFunc pWelsBlockZero8x8Func;
+ PWelsNonZeroCountFunc pWelsSetNonZeroCountFunc;
+ PWelsBlockZeroFunc pWelsBlockZero16x16Func;
+ PWelsBlockZeroFunc pWelsBlockZero8x8Func;
} SBlockFunc;
typedef void (*PWelsFillNeighborMbInfoIntra4x4Func) (PWelsNeighAvail pNeighAvail, uint8_t* pNonZeroCount,
@@ -211,10 +210,10 @@
typedef int32_t (*PWelsParseIntra16x16ModeFunc) (PWelsNeighAvail pNeighAvail, PBitStringAux pBs, PDqLayer pCurDqLayer);
enum {
-OVERWRITE_NONE = 0,
-OVERWRITE_PPS = 1,
-OVERWRITE_SPS = 1 << 1,
-OVERWRITE_SUBSETSPS = 1 << 2
+ OVERWRITE_NONE = 0,
+ OVERWRITE_PPS = 1,
+ OVERWRITE_SPS = 1 << 1,
+ OVERWRITE_SUBSETSPS = 1 << 2
};
/*
@@ -222,210 +221,221 @@
*/
typedef struct TagWelsDecoderContext {
-SLogContext sLogCtx;
+ SLogContext sLogCtx;
// Input
-void* pArgDec; // structured arguments for decoder, reserved here for extension in the future
+ void* pArgDec; // structured arguments for decoder, reserved here for extension in the future
-SDataBuffer sRawData;
-SDataBuffer sSavedData; //for parse only purpose
+ SDataBuffer sRawData;
+ SDataBuffer sSavedData; //for parse only purpose
// Configuration
-SDecodingParam* pParam;
-uint32_t uiCpuFlag; // CPU compatibility detected
+ SDecodingParam* pParam;
+ uint32_t uiCpuFlag; // CPU compatibility detected
-EVideoFormatType eOutputColorFormat; // 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.
-bool bHaveGotMemory; // global memory for decoder context related ever requested?
+ EVideoFormatType eOutputColorFormat; // 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.
+ 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 iImgHeightInPixel;// height of image in pixel reconstruction picture to be output
-int32_t iLastImgWidthInPixel; // width of image in last successful pixel reconstruction picture to be output
-int32_t iLastImgHeightInPixel;// height of image in last successful pixel reconstruction picture to be output
-bool bFreezeOutput; // indicating current frame freezing. Default: true
+ int32_t iImgWidthInPixel; // width of image in pixel reconstruction picture to be output
+ int32_t iImgHeightInPixel;// height of image in pixel reconstruction picture to be output
+ int32_t iLastImgWidthInPixel; // width of image in last successful pixel reconstruction picture to be output
+ int32_t iLastImgHeightInPixel;// height of image in last successful pixel reconstruction picture to be output
+ bool bFreezeOutput; // indicating current frame freezing. Default: true
// Derived common elements
-SNalUnitHeader sCurNalHead;
-EWelsSliceType eSliceType; // Slice type
-int32_t iFrameNum;
-int32_t iPrevFrameNum; // frame number of previous frame well decoded for non-truncated mode yet
-bool bLastHasMmco5; //
-int32_t iErrorCode; // error code return while decoding in case packets lost
-SFmo sFmoList[MAX_PPS_COUNT]; // list for FMO storage
-PFmo pFmo; // current fmo context after parsed slice_header
-int32_t iActiveFmoNum; // active count number of fmo context in list
+ SNalUnitHeader sCurNalHead;
+ EWelsSliceType eSliceType; // Slice type
+ int32_t iFrameNum;
+ int32_t iPrevFrameNum; // frame number of previous frame well decoded for non-truncated mode yet
+ bool bLastHasMmco5; //
+ int32_t iErrorCode; // error code return while decoding in case packets lost
+ SFmo sFmoList[MAX_PPS_COUNT]; // list for FMO storage
+ PFmo pFmo; // current fmo context after parsed slice_header
+ int32_t iActiveFmoNum; // active count number of fmo context in list
-/*needed info by decode slice level and mb level*/
-int32_t
-iDecBlockOffsetArray[24]; // address talbe for sub 4x4 block in intra4x4_mb, so no need to caculta the address every time.
+ /*needed info by decode slice level and mb level*/
+ int32_t
+ iDecBlockOffsetArray[24]; // address talbe for sub 4x4 block in intra4x4_mb, so no need to caculta the address every time.
-struct {
- int8_t* pMbType[LAYER_NUM_EXCHANGEABLE]; /* mb type */
- int16_t (*pMv[LAYER_NUM_EXCHANGEABLE][LIST_A])[MB_BLOCK4x4_NUM][MV_A]; //[LAYER_NUM_EXCHANGEABLE MB_BLOCK4x4_NUM*]
- int8_t (*pRefIndex[LAYER_NUM_EXCHANGEABLE][LIST_A])[MB_BLOCK4x4_NUM];
- int8_t* pLumaQp[LAYER_NUM_EXCHANGEABLE]; /*mb luma_qp*/
- int8_t (*pChromaQp[LAYER_NUM_EXCHANGEABLE])[2]; /*mb chroma_qp*/
- int16_t (*pMvd[LAYER_NUM_EXCHANGEABLE][LIST_A])[MB_BLOCK4x4_NUM][MV_A]; //[LAYER_NUM_EXCHANGEABLE MB_BLOCK4x4_NUM*]
- uint8_t *pCbfDc[LAYER_NUM_EXCHANGEABLE];
- int8_t (*pNzc[LAYER_NUM_EXCHANGEABLE])[24];
- int8_t (*pNzcRs[LAYER_NUM_EXCHANGEABLE])[24];
- int16_t (*pScaledTCoeff[LAYER_NUM_EXCHANGEABLE])[MB_COEFF_LIST_SIZE]; /*need be aligned*/
- int8_t (*pIntraPredMode[LAYER_NUM_EXCHANGEABLE])[8]; //0~3 top4x4 ; 4~6 left 4x4; 7 intra16x16
- int8_t (*pIntra4x4FinalMode[LAYER_NUM_EXCHANGEABLE])[MB_BLOCK4x4_NUM];
- int8_t* pChromaPredMode[LAYER_NUM_EXCHANGEABLE];
- int8_t* pCbp[LAYER_NUM_EXCHANGEABLE];
- uint8_t (*pMotionPredFlag[LAYER_NUM_EXCHANGEABLE][LIST_A])[MB_PARTITION_SIZE]; // 8x8
- int8_t (*pSubMbType[LAYER_NUM_EXCHANGEABLE])[MB_SUB_PARTITION_SIZE];
- int32_t* pSliceIdc[LAYER_NUM_EXCHANGEABLE]; // using int32_t for slice_idc
- int8_t* pResidualPredFlag[LAYER_NUM_EXCHANGEABLE];
- int8_t* pInterPredictionDoneFlag[LAYER_NUM_EXCHANGEABLE];
- bool* pMbCorrectlyDecodedFlag[LAYER_NUM_EXCHANGEABLE];
- bool* pMbRefConcealedFlag[LAYER_NUM_EXCHANGEABLE];
- uint32_t iMbWidth;
- uint32_t iMbHeight;
-} sMb;
+ struct {
+ int8_t* pMbType[LAYER_NUM_EXCHANGEABLE]; /* mb type */
+ int16_t (*pMv[LAYER_NUM_EXCHANGEABLE][LIST_A])[MB_BLOCK4x4_NUM][MV_A]; //[LAYER_NUM_EXCHANGEABLE MB_BLOCK4x4_NUM*]
+ int8_t (*pRefIndex[LAYER_NUM_EXCHANGEABLE][LIST_A])[MB_BLOCK4x4_NUM];
+ int8_t* pLumaQp[LAYER_NUM_EXCHANGEABLE]; /*mb luma_qp*/
+ int8_t (*pChromaQp[LAYER_NUM_EXCHANGEABLE])[2]; /*mb chroma_qp*/
+ int16_t (*pMvd[LAYER_NUM_EXCHANGEABLE][LIST_A])[MB_BLOCK4x4_NUM][MV_A]; //[LAYER_NUM_EXCHANGEABLE MB_BLOCK4x4_NUM*]
+ uint8_t* pCbfDc[LAYER_NUM_EXCHANGEABLE];
+ int8_t (*pNzc[LAYER_NUM_EXCHANGEABLE])[24];
+ int8_t (*pNzcRs[LAYER_NUM_EXCHANGEABLE])[24];
+ int16_t (*pScaledTCoeff[LAYER_NUM_EXCHANGEABLE])[MB_COEFF_LIST_SIZE]; /*need be aligned*/
+ int8_t (*pIntraPredMode[LAYER_NUM_EXCHANGEABLE])[8]; //0~3 top4x4 ; 4~6 left 4x4; 7 intra16x16
+ int8_t (*pIntra4x4FinalMode[LAYER_NUM_EXCHANGEABLE])[MB_BLOCK4x4_NUM];
+ int8_t* pChromaPredMode[LAYER_NUM_EXCHANGEABLE];
+ int8_t* pCbp[LAYER_NUM_EXCHANGEABLE];
+ uint8_t (*pMotionPredFlag[LAYER_NUM_EXCHANGEABLE][LIST_A])[MB_PARTITION_SIZE]; // 8x8
+ int8_t (*pSubMbType[LAYER_NUM_EXCHANGEABLE])[MB_SUB_PARTITION_SIZE];
+ int32_t* pSliceIdc[LAYER_NUM_EXCHANGEABLE]; // using int32_t for slice_idc
+ int8_t* pResidualPredFlag[LAYER_NUM_EXCHANGEABLE];
+ int8_t* pInterPredictionDoneFlag[LAYER_NUM_EXCHANGEABLE];
+ bool* pMbCorrectlyDecodedFlag[LAYER_NUM_EXCHANGEABLE];
+ bool* pMbRefConcealedFlag[LAYER_NUM_EXCHANGEABLE];
+ uint32_t iMbWidth;
+ uint32_t iMbHeight;
+ } sMb;
// reconstruction picture
-PPicture pDec; //pointer to current picture being reconstructed
+ PPicture pDec; //pointer to current picture being reconstructed
// reference pictures
-SRefPic sRefPic;
+ SRefPic sRefPic;
-SVlcTable sVlcTable; // vlc table
+ SVlcTable sVlcTable; // vlc table
-SBitStringAux sBs;
-int32_t iMaxBsBufferSizeInByte; //actual memory size for BS buffer
+ SBitStringAux sBs;
+ int32_t iMaxBsBufferSizeInByte; //actual memory size for BS buffer
-/* Global memory external */
+ /* Global memory external */
-SPosOffset sFrameCrop;
+ SPosOffset sFrameCrop;
-SSps sSpsBuffer[MAX_SPS_COUNT + 1];
-SPps sPpsBuffer[MAX_PPS_COUNT + 1];
-PSliceHeader pSliceHeader;
+ SSps sSpsBuffer[MAX_SPS_COUNT + 1];
+ SPps sPpsBuffer[MAX_PPS_COUNT + 1];
+ PSliceHeader pSliceHeader;
-PPicBuff pPicBuff[LIST_A]; // Initially allocated memory for pictures which are used in decoding.
-int32_t iPicQueueNumber;
+ PPicBuff pPicBuff[LIST_A]; // Initially allocated memory for pictures which are used in decoding.
+ int32_t iPicQueueNumber;
-SSubsetSps sSubsetSpsBuffer[MAX_SPS_COUNT + 1];
-SNalUnit sPrefixNal;
+ SSubsetSps sSubsetSpsBuffer[MAX_SPS_COUNT + 1];
+ SNalUnit sPrefixNal;
-PAccessUnit pAccessUnitList; // current access unit list to be performed
-PSps pActiveLayerSps[MAX_LAYER_NUM];
-PSps pSps; // used by current AU
-PPps pPps; // used by current AU
+ PAccessUnit pAccessUnitList; // current access unit list to be performed
+ PSps pActiveLayerSps[MAX_LAYER_NUM];
+ PSps pSps; // used by current AU
+ PPps pPps; // used by current AU
// Memory for pAccessUnitList is dynamically held till decoder destruction.
-PDqLayer pCurDqLayer; // current DQ layer representation, also carry reference base layer if applicable
-PDqLayer pDqLayersList[LAYER_NUM_EXCHANGEABLE]; // DQ layers list with memory allocated
+ PDqLayer pCurDqLayer; // current DQ layer representation, also carry reference base layer if applicable
+ PDqLayer pDqLayersList[LAYER_NUM_EXCHANGEABLE]; // DQ layers list with memory allocated
-int32_t iPicWidthReq; // picture width have requested the memory
-int32_t iPicHeightReq; // picture height have requested the memory
+ int32_t iPicWidthReq; // picture width have requested the memory
+ int32_t iPicHeightReq; // picture height have requested the memory
-uint8_t uiTargetDqId; // maximal DQ ID in current access unit, meaning target layer ID
-bool bAvcBasedFlag; // For decoding bitstream:
-bool bEndOfStreamFlag; // Flag on end of stream requested by external application layer
-bool bInstantDecFlag; // Flag for no-delay decoding
-bool bInitialDqLayersMem; // dq layers related memory is available?
+ uint8_t uiTargetDqId; // maximal DQ ID in current access unit, meaning target layer ID
+ bool bAvcBasedFlag; // For decoding bitstream:
+ bool bEndOfStreamFlag; // Flag on end of stream requested by external application layer
+ bool bInstantDecFlag; // Flag for no-delay decoding
+ bool bInitialDqLayersMem; // dq layers related memory is available?
-bool bOnlyOneLayerInCurAuFlag; //only one layer in current AU: 1
+ bool bOnlyOneLayerInCurAuFlag; //only one layer in current AU: 1
// for EC parameter sets
-bool bSpsExistAheadFlag; // whether does 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 bSpsExistAheadFlag; // whether does 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 bSpsAvailFlags[MAX_SPS_COUNT];
-bool bSubspsAvailFlags[MAX_SPS_COUNT];
-bool bPpsAvailFlags[MAX_PPS_COUNT];
-bool bReferenceLostAtT0Flag;
-int32_t iTotalNumMbRec; //record current number of decoded MB
+ int32_t iSpsErrorIgnored;
+ int32_t iSubSpsErrorIgnored;
+ int32_t iPpsErrorIgnored;
+
+ bool bSpsAvailFlags[MAX_SPS_COUNT];
+ bool bSubspsAvailFlags[MAX_SPS_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;
+ int32_t iTotalNumMbRec; //record current number of decoded MB
#ifdef LONG_TERM_REF
-bool bParamSetsLostFlag; //sps or pps do not exist or not correct
+ bool bParamSetsLostFlag; //sps or pps do not exist or not correct
-bool
-bCurAuContainLtrMarkSeFlag; //current AU has the LTR marking syntax element, mark the previous frame or self
-int32_t iFrameNumOfAuMarkedLtr; //if bCurAuContainLtrMarkSeFlag==true, SHOULD set this variable
+ bool
+ bCurAuContainLtrMarkSeFlag; //current AU has the LTR marking syntax element, mark the previous frame or self
+ int32_t iFrameNumOfAuMarkedLtr; //if bCurAuContainLtrMarkSeFlag==true, SHOULD set this variable
-uint16_t uiCurIdrPicId;
+ uint16_t uiCurIdrPicId;
#endif
-bool bNewSeqBegin;
-bool bNextNewSeqBegin;
-int iOverwriteFlags;
-ERROR_CON_IDC eErrorConMethod; //
+ bool bNewSeqBegin;
+ bool bNextNewSeqBegin;
+ int iOverwriteFlags;
+ ERROR_CON_IDC eErrorConMethod; //
//for Parse only
-bool bParseOnly;
-SSpsBsInfo sSpsBsInfo [MAX_SPS_COUNT];
-SSpsBsInfo sSubsetSpsBsInfo [MAX_PPS_COUNT];
-SPpsBsInfo sPpsBsInfo [MAX_PPS_COUNT];
-SParserBsInfo* pParserBsInfo;
+ bool bParseOnly;
+ SSpsBsInfo sSpsBsInfo [MAX_SPS_COUNT];
+ SSpsBsInfo sSubsetSpsBsInfo [MAX_PPS_COUNT];
+ SPpsBsInfo sPpsBsInfo [MAX_PPS_COUNT];
+ SParserBsInfo* pParserBsInfo;
-PPicture pPreviousDecodedPictureInDpb; //pointer to previously decoded picture in DPB for error concealment
-PGetIntraPredFunc pGetI16x16LumaPredFunc[7]; //h264_predict_copy_16x16;
-PGetIntraPredFunc pGetI4x4LumaPredFunc[14]; // h264_predict_4x4_t
-PGetIntraPredFunc pGetIChromaPredFunc[7]; // h264_predict_8x8_t
-PIdctResAddPredFunc pIdctResAddPredFunc;
-SMcFunc sMcFunc;
+ PPicture pPreviousDecodedPictureInDpb; //pointer to previously decoded picture in DPB for error concealment
+ PGetIntraPredFunc pGetI16x16LumaPredFunc[7]; //h264_predict_copy_16x16;
+ PGetIntraPredFunc pGetI4x4LumaPredFunc[14]; // h264_predict_4x4_t
+ PGetIntraPredFunc pGetIChromaPredFunc[7]; // h264_predict_8x8_t
+ PIdctResAddPredFunc pIdctResAddPredFunc;
+ SMcFunc sMcFunc;
//For error concealment
-SCopyFunc sCopyFunc;
-/* For Deblocking */
-SDeblockingFunc sDeblockingFunc;
-SExpandPicFunc sExpandPicFunc;
+ SCopyFunc sCopyFunc;
+ /* For Deblocking */
+ SDeblockingFunc sDeblockingFunc;
+ SExpandPicFunc sExpandPicFunc;
-/* For Block */
-SBlockFunc sBlockFunc;
+ /* For Block */
+ SBlockFunc sBlockFunc;
-int32_t iCurSeqIntervalTargetDependId;
-int32_t iCurSeqIntervalMaxPicWidth;
-int32_t iCurSeqIntervalMaxPicHeight;
+ int32_t iCurSeqIntervalTargetDependId;
+ int32_t iCurSeqIntervalMaxPicWidth;
+ int32_t iCurSeqIntervalMaxPicHeight;
-PWelsFillNeighborMbInfoIntra4x4Func pFillInfoCacheIntra4x4Func;
-PWelsMapNeighToSample pMap4x4NeighToSampleFunc;
-PWelsMap16NeighToSample pMap16x16NeighToSampleFunc;
+ PWelsFillNeighborMbInfoIntra4x4Func pFillInfoCacheIntra4x4Func;
+ PWelsMapNeighToSample pMap4x4NeighToSampleFunc;
+ PWelsMap16NeighToSample pMap16x16NeighToSampleFunc;
//feedback whether or not have VCL in current AU, and the temporal ID
-int32_t iFeedbackVclNalInAu;
-int32_t iFeedbackTidInAu;
+ int32_t iFeedbackVclNalInAu;
+ 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 bPrintFrameErrorTraceFlag; //true: can print info for upper layer
-int32_t iIgnoredErrorInfoPacketCount; //store the packet number with error decoding info
+ bool bPrintFrameErrorTraceFlag; //true: can print info for upper layer
+ int32_t iIgnoredErrorInfoPacketCount; //store the packet number with error decoding info
//trace handle
-void* pTraceHandle;
+ void* pTraceHandle;
//Save the last nal header info
-SNalUnitHeaderExt sLastNalHdrExt;
-SSliceHeader sLastSliceHeader;
-SWelsCabacCtx sWelsCabacContexts[4][WELS_QP_MAX + 1][WELS_CONTEXT_COUNT];
-bool bCabacInited;
-SWelsCabacCtx pCabacCtx[WELS_CONTEXT_COUNT];
-PWelsCabacDecEngine pCabacDecEngine;
-double dDecTime;
-SDecoderStatistics sDecoderStatistics;// For real time debugging
-int32_t iMbEcedNum;
-int32_t iMbEcedPropNum;
-int32_t iMbNum;
-bool bMbRefConcealed;
-bool bRPLRError;
-int32_t iECMVs[16][2];
-PPicture pECRefPic[16];
-unsigned long long uiTimeStamp;
+ SNalUnitHeaderExt sLastNalHdrExt;
+ SSliceHeader sLastSliceHeader;
+ SWelsCabacCtx sWelsCabacContexts[4][WELS_QP_MAX + 1][WELS_CONTEXT_COUNT];
+ bool bCabacInited;
+ SWelsCabacCtx pCabacCtx[WELS_CONTEXT_COUNT];
+ PWelsCabacDecEngine pCabacDecEngine;
+ double dDecTime;
+ SDecoderStatistics sDecoderStatistics;// For real time debugging
+ int32_t iMbEcedNum;
+ int32_t iMbEcedPropNum;
+ int32_t iMbNum;
+ bool bMbRefConcealed;
+ bool bRPLRError;
+ int32_t iECMVs[16][2];
+ PPicture pECRefPic[16];
+ unsigned long long uiTimeStamp;
// To support scaling list HP
-uint16_t pDequant_coeff_buffer4x4[6][52][16];
-uint16_t pDequant_coeff_buffer8x8[6][52][64];
-uint16_t (*pDequant_coeff4x4[6])[16];// 4x4 sclaing list value pointer
-uint16_t (*pDequant_coeff8x8[6])[64];//64 residual coeff ,with 6 kinds of residual type, 52 qp level
-int iDequantCoeffPpsid;//When a new pps actived, reinitialised the scaling list value
-bool bDequantCoeff4x4Init;
-bool bSpsLatePps;
-bool bUseScalingList;
+ uint16_t pDequant_coeff_buffer4x4[6][52][16];
+ uint16_t pDequant_coeff_buffer8x8[6][52][64];
+ uint16_t (*pDequant_coeff4x4[6])[16];// 4x4 sclaing list value pointer
+ uint16_t (*pDequant_coeff8x8[6])[64];//64 residual coeff ,with 6 kinds of residual type, 52 qp level
+ int iDequantCoeffPpsid;//When a new pps actived, reinitialised the scaling list value
+ bool bDequantCoeff4x4Init;
+ bool bSpsLatePps;
+ bool bUseScalingList;
} SWelsDecoderContext, *PWelsDecoderContext;
static inline void ResetActiveSPSForEachLayer (PWelsDecoderContext pCtx) {
- if ( pCtx->iTotalNumMbRec == 0 ) {
+ if (pCtx->iTotalNumMbRec == 0) {
for (int i = 0; i < MAX_LAYER_NUM; i++) {
pCtx->pActiveLayerSps[i] = NULL;
}
--- a/codec/decoder/core/inc/wels_const.h
+++ b/codec/decoder/core/inc/wels_const.h
@@ -77,11 +77,10 @@
#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_MACROBLOCK_CAPACITY 5000 //Maximal legal MB capacity, 15000 bits is enough
-
enum {
- BASE_MB = 0,
- NON_AVC_REWRITE_ENHANCE_MB =1,
- AVC_REWRITE_ENHANCE_MB = 2
+ BASE_MB = 0,
+ NON_AVC_REWRITE_ENHANCE_MB = 1,
+ AVC_REWRITE_ENHANCE_MB = 2
};
#endif//WELS_CONST_H__
--- a/codec/decoder/core/src/au_parser.cpp
+++ b/codec/decoder/core/src/au_parser.cpp
@@ -146,36 +146,47 @@
if (! (IS_SEI_NAL (pNalUnitHeader->eNalUnitType) || IS_SPS_NAL (pNalUnitHeader->eNalUnitType)
|| pCtx->bSpsExistAheadFlag)) {
- if (pCtx->bPrintFrameErrorTraceFlag) {
+ if (pCtx->bPrintFrameErrorTraceFlag && pCtx->iSpsErrorIgnored == 0) {
WelsLog (pLogCtx, WELS_LOG_WARNING,
"parse_nal(), no exist Sequence Parameter Sets ahead of sequence when try to decode NAL(type:%d).",
pNalUnitHeader->eNalUnitType);
+ } else {
+ pCtx->iSpsErrorIgnored++;
}
+ pCtx->sDecoderStatistics.iSpsNoExistNalNum++;
pCtx->iErrorCode = dsNoParamSets;
return NULL;
}
+ pCtx->iSpsErrorIgnored = 0;
if (! (IS_SEI_NAL (pNalUnitHeader->eNalUnitType) || IS_PARAM_SETS_NALS (pNalUnitHeader->eNalUnitType)
|| pCtx->bPpsExistAheadFlag)) {
- if (pCtx->bPrintFrameErrorTraceFlag) {
+ if (pCtx->bPrintFrameErrorTraceFlag && pCtx->iPpsErrorIgnored == 0) {
WelsLog (pLogCtx, WELS_LOG_WARNING,
"parse_nal(), no exist Picture Parameter Sets ahead of sequence when try to decode NAL(type:%d).",
pNalUnitHeader->eNalUnitType);
+ } else {
+ pCtx->iPpsErrorIgnored++;
}
+ pCtx->sDecoderStatistics.iPpsNoExistNalNum++;
pCtx->iErrorCode = dsNoParamSets;
return NULL;
}
+ pCtx->iPpsErrorIgnored = 0;
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))) {
- if (pCtx->bPrintFrameErrorTraceFlag) {
+ if (pCtx->bPrintFrameErrorTraceFlag && pCtx->iSubSpsErrorIgnored == 0) {
WelsLog (pLogCtx, WELS_LOG_WARNING,
"ParseNalHeader(), no exist Parameter Sets ahead of sequence when try to decode slice(type:%d).",
pNalUnitHeader->eNalUnitType);
+ } else {
+ pCtx->iSubSpsErrorIgnored++;
}
+ pCtx->sDecoderStatistics.iSubSpsNoExistNalNum++;
pCtx->iErrorCode |= dsNoParamSets;
return NULL;
}
-
+ pCtx->iSubSpsErrorIgnored = 0;
switch (pNalUnitHeader->eNalUnitType) {
case NAL_UNIT_AU_DELIMITER:
--- a/codec/decoder/core/src/decoder.cpp
+++ b/codec/decoder/core/src/decoder.cpp
@@ -311,7 +311,15 @@
pCtx->sDecoderStatistics.iAvgLumaQp = -1;
pCtx->bSpsLatePps = 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;
}
/*
@@ -993,7 +1001,7 @@
pDecStat->iAvgLumaQp = iTotalQp;
} else
pDecStat->iAvgLumaQp = (int) ((uint64_t) (pDecStat->iAvgLumaQp * pDecStat->uiDecodedFrameCount + iTotalQp) /
- (pDecStat->uiDecodedFrameCount + 1));
+ (pDecStat->uiDecodedFrameCount + 1));
//update IDR number
if (pCurDq->sLayerInfo.sNalHeaderExt.bIdrFlag) {
--- a/codec/decoder/core/src/decoder_core.cpp
+++ b/codec/decoder/core/src/decoder_core.cpp
@@ -566,10 +566,19 @@
//add check PPS available here
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;
return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_PPS_ID);
}
+ pCtx->iPPSLastInvalidId = -1;
pPps = &pCtx->sPpsBuffer[iPpsId];
@@ -583,16 +592,34 @@
pSubsetSps = &pCtx->sSubsetSpsBuffer[pPps->iSpsId];
pSps = &pSubsetSps->sSps;
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;
return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_SPS_ID);
}
+ pCtx->iSubSPSLastInvalidId = -1;
} else {
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;
return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_SPS_ID);
}
+ pCtx->iSPSLastInvalidId = -1;
pSps = &pCtx->sSpsBuffer[pPps->iSpsId];
}
pSliceHead->iPpsId = iPpsId;
@@ -1042,7 +1069,8 @@
"pCtx->sMb.pMbType[]");
pCtx->sMb.pMv[i][0] = (int16_t (*)[16][2])WelsMallocz (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (
int16_t) * MV_A * MB_BLOCK4x4_NUM, "pCtx->sMb.pMv[][]");
- pCtx->sMb.pRefIndex[i][0] = (int8_t (*)[MB_BLOCK4x4_NUM])WelsMallocz (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (
+ pCtx->sMb.pRefIndex[i][0] = (int8_t (*)[MB_BLOCK4x4_NUM])WelsMallocz (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight *
+ sizeof (
int8_t) * MB_BLOCK4x4_NUM, "pCtx->sMb.pRefIndex[][]");
pCtx->sMb.pLumaQp[i] = (int8_t*)WelsMallocz (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (int8_t),
"pCtx->sMb.pLumaQp[]");
@@ -1058,7 +1086,8 @@
"pCtx->sMb.pNzcRs[]");
pCtx->sMb.pScaledTCoeff[i] = (int16_t (*)[MB_COEFF_LIST_SIZE])WelsMallocz (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight *
sizeof (int16_t) * MB_COEFF_LIST_SIZE, "pCtx->sMb.pScaledTCoeff[]");
- pCtx->sMb.pIntraPredMode[i] = (int8_t (*)[8])WelsMallocz (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (int8_t) * 8,
+ pCtx->sMb.pIntraPredMode[i] = (int8_t (*)[8])WelsMallocz (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (
+ int8_t) * 8,
"pCtx->sMb.pIntraPredMode[]");
pCtx->sMb.pIntra4x4FinalMode[i] = (int8_t (*)[MB_BLOCK4x4_NUM])WelsMallocz (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight *
sizeof (int8_t) * MB_BLOCK4x4_NUM, "pCtx->sMb.pIntra4x4FinalMode[]");
@@ -1066,7 +1095,8 @@
"pCtx->sMb.pChromaPredMode[]");
pCtx->sMb.pCbp[i] = (int8_t*)WelsMallocz (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (int8_t),
"pCtx->sMb.pCbp[]");
- pCtx->sMb.pSubMbType[i] = (int8_t (*)[MB_PARTITION_SIZE])WelsMallocz (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (
+ pCtx->sMb.pSubMbType[i] = (int8_t (*)[MB_PARTITION_SIZE])WelsMallocz (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight *
+ sizeof (
int8_t) * MB_PARTITION_SIZE, "pCtx->sMb.pSubMbType[]");
pCtx->sMb.pSliceIdc[i] = (int32_t*) WelsMallocz (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (int32_t),
"pCtx->sMb.pSliceIdc[]"); // using int32_t for slice_idc, 4/21/2010
@@ -2051,7 +2081,7 @@
pCtx->bRPLRError = true;
bAllRefComplete = false; // RPLR error, set ref pictures complete flag false
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",
pNalCur->sNalHeaderExt.uiTemporalId);
if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {