History

use picture-level new seq begin detection for output functions

huili2 committed 11 years ago

Commit b8ce2eb1 parent 4db34bd3 files · +11 −16Browse files

Showing the changes to codec/decoder/core/src/decoder_core.cpp (1 of 3 files). Show all

Unified · Split

codec/decoder/core/src/decoder_core.cpp+10−14
@@ -54,7 +54,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 53 unmodified lines
5454 const int32_t kiTotalNumMbInCurLayer = pCurDq->iMbWidth * pCurDq->iMbHeight;
5555 bool bFrameCompleteFlag = true;
5656
57− if (pCtx->bNewSeqBegin) {
57+ if (pPic->bNewSeqBegin) {
5858 memcpy (& (pCtx->sFrameCrop), & (pCurDq->sLayerInfo.sSliceInLayer.sSliceHeaderExt.sSliceHeader.pSps->sFrameCrop),
5959 sizeof (SPosOffset)); //confirmed_safe_unsafe_usage
6060 #ifdef LONG_TERM_REF
@@ -123,7 +123,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 62 unmodified lines
123123 }
124124 if (pCtx->bFreezeOutput) {
125125 pDstInfo->iBufferStatus = 0;
126− if (pCtx->bNewSeqBegin) {
126+ if (pPic->bNewSeqBegin) {
127127 WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO, "DecodeFrameConstruction():New sequence detected, but freezed.");
128128 }
129129 }
@@ -1929,6 +1929,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 1799 unmodified lines
19291929 pCtx->iErrorCode |= dsOutOfMemory;
19301930 return ERR_INFO_REF_COUNT_OVERFLOW;
19311931 }
1932+ pCtx->pDec->bNewSeqBegin = pCtx->bNewSeqBegin; //set flag for start decoding
19321933 }
19331934 pCtx->pDec->uiTimeStamp = pNalCur->uiTimeStamp;
19341935
@@ -2123,8 +2124,8 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 188 unmodified lines
21232124 return ERR_NONE;
21242125 }
21252126 }
2127+ pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //store latest decoded picture for EC
21262128 if (uiNalRefIdc > 0) {
2127− pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //store latest decoded picture for EC
21282129 iRet = WelsMarkAsRef (pCtx);
21292130 if (iRet != ERR_NONE) {
21302131 if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
@@ -2135,12 +2136,8 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 4 unmodified lines
21352136 ExpandReferencingPicture (pCtx->pDec->pData, pCtx->pDec->iWidthInPixel, pCtx->pDec->iHeightInPixel,
21362137 pCtx->pDec->iLinesize,
21372138 pCtx->sExpandPicFunc.pfExpandLumaPicture, pCtx->sExpandPicFunc.pfExpandChromaPicture);
2138− pCtx->pDec = NULL;
2139− } else if (pCtx->eErrorConMethod == ERROR_CON_SLICE_MV_COPY_CROSS_IDR
2140− || pCtx->eErrorConMethod == ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE) {
2141− pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //store latest decoded picture for MV Copy EC
2142− pCtx->pDec = NULL;
21432139 }
2140+ pCtx->pDec = NULL; //after frame decoding, always set to NULL
21442141 }
21452142
21462143 // need update frame_num due current frame is well decoded
@@ -2169,18 +2166,17 @@ bool CheckAndFinishLastPic (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferIn · 22 unmodified lines
21692166 pCtx->pDec->iPpsId = pCtx->pPps->iPpsId;
21702167
21712168 DecodeFrameConstruction (pCtx, ppDst, pDstInfo);
2169+ pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //save ECed pic for future use
21722170 if (pCtx->sLastNalHdrExt.sNalUnitHeader.uiNalRefIdc > 0) {
2173− pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //save ECed pic for future use
21742171 MarkECFrameAsRef (pCtx);
2175− } else if (pCtx->eErrorConMethod == ERROR_CON_SLICE_MV_COPY_CROSS_IDR
2176− || pCtx->eErrorConMethod == ERROR_CON_SLICE_MV_COPY_CROSS_IDR_FREEZE_RES_CHANGE) {
2177− pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //save ECed pic for future MV Copy use
2178− pCtx->pDec = NULL;
21792172 }
21802173 } else {
2181− if (DecodeFrameConstruction (pCtx, ppDst, pDstInfo))
2174+ if (DecodeFrameConstruction (pCtx, ppDst, pDstInfo)) {
2175+ pCtx->pDec = NULL;
21822176 return false;
2177+ }
21832178 }
2179+ pCtx->pDec = NULL;
21842180 pCtx->iPrevFrameNum = pCtx->sLastSliceHeader.iFrameNum; //save frame_num
21852181 if (pCtx->bLastHasMmco5)
21862182 pCtx->iPrevFrameNum = 0;

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