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
54 const int32_t kiTotalNumMbInCurLayer = pCurDq->iMbWidth * pCurDq->iMbHeight;54 const int32_t kiTotalNumMbInCurLayer = pCurDq->iMbWidth * pCurDq->iMbHeight;
55 bool bFrameCompleteFlag = true;55 bool bFrameCompleteFlag = true;
56 56
57 if (pCtx->bNewSeqBegin) {57 if (pPic->bNewSeqBegin) {
58 memcpy (& (pCtx->sFrameCrop), & (pCurDq->sLayerInfo.sSliceInLayer.sSliceHeaderExt.sSliceHeader.pSps->sFrameCrop),58 memcpy (& (pCtx->sFrameCrop), & (pCurDq->sLayerInfo.sSliceInLayer.sSliceHeaderExt.sSliceHeader.pSps->sFrameCrop),
59 sizeof (SPosOffset)); //confirmed_safe_unsafe_usage59 sizeof (SPosOffset)); //confirmed_safe_unsafe_usage
60#ifdef LONG_TERM_REF60#ifdef LONG_TERM_REF
@@ -123,7 +123,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 62 unmodified lines
123 }123 }
124 if (pCtx->bFreezeOutput) {124 if (pCtx->bFreezeOutput) {
125 pDstInfo->iBufferStatus = 0;125 pDstInfo->iBufferStatus = 0;
126 if (pCtx->bNewSeqBegin) {126 if (pPic->bNewSeqBegin) {
127 WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO, "DecodeFrameConstruction():New sequence detected, but freezed.");127 WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO, "DecodeFrameConstruction():New sequence detected, but freezed.");
128 }128 }
129 }129 }
@@ -1929,6 +1929,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 1799 unmodified lines
1929 pCtx->iErrorCode |= dsOutOfMemory;1929 pCtx->iErrorCode |= dsOutOfMemory;
1930 return ERR_INFO_REF_COUNT_OVERFLOW;1930 return ERR_INFO_REF_COUNT_OVERFLOW;
1931 }1931 }
1932 pCtx->pDec->bNewSeqBegin = pCtx->bNewSeqBegin; //set flag for start decoding
1932 }1933 }
1933 pCtx->pDec->uiTimeStamp = pNalCur->uiTimeStamp;1934 pCtx->pDec->uiTimeStamp = pNalCur->uiTimeStamp;
1934 1935
@@ -2123,8 +2124,8 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 188 unmodified lines
2123 return ERR_NONE;2124 return ERR_NONE;
2124 }2125 }
2125 }2126 }
2127 pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //store latest decoded picture for EC
2126 if (uiNalRefIdc > 0) {2128 if (uiNalRefIdc > 0) {
2127 pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //store latest decoded picture for EC
2128 iRet = WelsMarkAsRef (pCtx);2129 iRet = WelsMarkAsRef (pCtx);
2129 if (iRet != ERR_NONE) {2130 if (iRet != ERR_NONE) {
2130 if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {2131 if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
@@ -2135,12 +2136,8 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 4 unmodified lines
2135 ExpandReferencingPicture (pCtx->pDec->pData, pCtx->pDec->iWidthInPixel, pCtx->pDec->iHeightInPixel,2136 ExpandReferencingPicture (pCtx->pDec->pData, pCtx->pDec->iWidthInPixel, pCtx->pDec->iHeightInPixel,
2136 pCtx->pDec->iLinesize,2137 pCtx->pDec->iLinesize,
2137 pCtx->sExpandPicFunc.pfExpandLumaPicture, pCtx->sExpandPicFunc.pfExpandChromaPicture);2138 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;
2143 }2139 }
2140 pCtx->pDec = NULL; //after frame decoding, always set to NULL
2144 }2141 }
2145 2142
2146 // need update frame_num due current frame is well decoded2143 // 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
2169 pCtx->pDec->iPpsId = pCtx->pPps->iPpsId;2166 pCtx->pDec->iPpsId = pCtx->pPps->iPpsId;
2170 2167
2171 DecodeFrameConstruction (pCtx, ppDst, pDstInfo);2168 DecodeFrameConstruction (pCtx, ppDst, pDstInfo);
2169 pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //save ECed pic for future use
2172 if (pCtx->sLastNalHdrExt.sNalUnitHeader.uiNalRefIdc > 0) {2170 if (pCtx->sLastNalHdrExt.sNalUnitHeader.uiNalRefIdc > 0) {
2173 pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //save ECed pic for future use
2174 MarkECFrameAsRef (pCtx);2171 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;
2179 }2172 }
2180 } else {2173 } else {
2181 if (DecodeFrameConstruction (pCtx, ppDst, pDstInfo))2174 if (DecodeFrameConstruction (pCtx, ppDst, pDstInfo)) {
2175 pCtx->pDec = NULL;
2182 return false;2176 return false;
2177 }
2183 }2178 }
2179 pCtx->pDec = NULL;
2184 pCtx->iPrevFrameNum = pCtx->sLastSliceHeader.iFrameNum; //save frame_num2180 pCtx->iPrevFrameNum = pCtx->sLastSliceHeader.iFrameNum; //save frame_num
2185 if (pCtx->bLastHasMmco5)2181 if (pCtx->bLastHasMmco5)
2186 pCtx->iPrevFrameNum = 0;2182 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