Showing the changes to codec/decoder/core/src/decoder_core.cpp (1 of 3 files). Show all
Unified · Split
| @@ -54,7 +54,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 53 unmodified lines | ||
| 54 | 54 | const int32_t kiTotalNumMbInCurLayer = pCurDq->iMbWidth * pCurDq->iMbHeight; |
| 55 | 55 | bool bFrameCompleteFlag = true; |
| 56 | 56 | |
| 57 | − if (pCtx->bNewSeqBegin) { | |
| 57 | + if (pPic->bNewSeqBegin) { | |
| 58 | 58 | memcpy (& (pCtx->sFrameCrop), & (pCurDq->sLayerInfo.sSliceInLayer.sSliceHeaderExt.sSliceHeader.pSps->sFrameCrop), |
| 59 | 59 | sizeof (SPosOffset)); //confirmed_safe_unsafe_usage |
| 60 | 60 | #ifdef LONG_TERM_REF |
| @@ -123,7 +123,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 62 unmodified lines | ||
| 123 | 123 | } |
| 124 | 124 | if (pCtx->bFreezeOutput) { |
| 125 | 125 | pDstInfo->iBufferStatus = 0; |
| 126 | − if (pCtx->bNewSeqBegin) { | |
| 126 | + if (pPic->bNewSeqBegin) { | |
| 127 | 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 | 1929 | pCtx->iErrorCode |= dsOutOfMemory; |
| 1930 | 1930 | return ERR_INFO_REF_COUNT_OVERFLOW; |
| 1931 | 1931 | } |
| 1932 | + pCtx->pDec->bNewSeqBegin = pCtx->bNewSeqBegin; //set flag for start decoding | |
| 1932 | 1933 | } |
| 1933 | 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 | 2124 | return ERR_NONE; |
| 2124 | 2125 | } |
| 2125 | 2126 | } |
| 2127 | + pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //store latest decoded picture for EC | |
| 2126 | 2128 | if (uiNalRefIdc > 0) { |
| 2127 | − pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //store latest decoded picture for EC | |
| 2128 | 2129 | iRet = WelsMarkAsRef (pCtx); |
| 2129 | 2130 | if (iRet != ERR_NONE) { |
| 2130 | 2131 | if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) { |
| @@ -2135,12 +2136,8 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 4 unmodified lines | ||
| 2135 | 2136 | ExpandReferencingPicture (pCtx->pDec->pData, pCtx->pDec->iWidthInPixel, pCtx->pDec->iHeightInPixel, |
| 2136 | 2137 | pCtx->pDec->iLinesize, |
| 2137 | 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 | 2143 | // 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 | 2166 | pCtx->pDec->iPpsId = pCtx->pPps->iPpsId; |
| 2170 | 2167 | |
| 2171 | 2168 | DecodeFrameConstruction (pCtx, ppDst, pDstInfo); |
| 2169 | + pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //save ECed pic for future use | |
| 2172 | 2170 | if (pCtx->sLastNalHdrExt.sNalUnitHeader.uiNalRefIdc > 0) { |
| 2173 | − pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //save ECed pic for future use | |
| 2174 | 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 | 2173 | } else { |
| 2181 | − if (DecodeFrameConstruction (pCtx, ppDst, pDstInfo)) | |
| 2174 | + if (DecodeFrameConstruction (pCtx, ppDst, pDstInfo)) { | |
| 2175 | + pCtx->pDec = NULL; | |
| 2182 | 2176 | return false; |
| 2177 | + } | |
| 2183 | 2178 | } |
| 2179 | + pCtx->pDec = NULL; | |
| 2184 | 2180 | pCtx->iPrevFrameNum = pCtx->sLastSliceHeader.iFrameNum; //save frame_num |
| 2185 | 2181 | if (pCtx->bLastHasMmco5) |
| 2186 | 2182 | pCtx->iPrevFrameNum = 0; |