Showing the changes to codec/decoder/core/src/decoder_core.cpp (1 of 11 files). Show all
Unified · Split
| @@ -127,6 +127,9 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 126 unmodified lines | |||
| 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 | } |
| 130 | pCtx->iMbEcedNum = pPic->iMbEcedNum; | ||
| 131 | pCtx->iMbNum = pPic->iMbNum; | ||
| 132 | pCtx->iMbEcedPropNum = pPic->iMbEcedPropNum; | ||
| 130 | UpdateDecStat (pCtx, pDstInfo->iBufferStatus != 0); | 133 | UpdateDecStat (pCtx, pDstInfo->iBufferStatus != 0); |
| 131 | 134 | ||
| 132 | return 0; | 135 | return 0; |
| @@ -1079,6 +1082,8 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid · 946 unmodified lines | |||
| 1079 | 1082 | ||
| 1080 | pCtx->sMb.pMbCorrectlyDecodedFlag[i] = (bool*) WelsMalloc (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (bool), | 1083 | pCtx->sMb.pMbCorrectlyDecodedFlag[i] = (bool*) WelsMalloc (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (bool), |
| 1081 | "pCtx->sMb.pMbCorrectlyDecodedFlag[]"); | 1084 | "pCtx->sMb.pMbCorrectlyDecodedFlag[]"); |
| 1085 | pCtx->sMb.pMbRefConcealedFlag[i] = (bool*) WelsMalloc (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (bool), | ||
| 1086 | "pCtx->pMbRefConcealedFlag[]"); | ||
| 1082 | 1087 | ||
| 1083 | // check memory block valid due above allocated.. | 1088 | // check memory block valid due above allocated.. |
| 1084 | WELS_VERIFY_RETURN_IF (ERR_INFO_OUT_OF_MEMORY, | 1089 | WELS_VERIFY_RETURN_IF (ERR_INFO_OUT_OF_MEMORY, |
| @@ -1100,6 +1105,7 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid · 15 unmodified lines | |||
| 1100 | (NULL == pCtx->sMb.pSliceIdc[i]) || | 1105 | (NULL == pCtx->sMb.pSliceIdc[i]) || |
| 1101 | (NULL == pCtx->sMb.pResidualPredFlag[i]) || | 1106 | (NULL == pCtx->sMb.pResidualPredFlag[i]) || |
| 1102 | (NULL == pCtx->sMb.pInterPredictionDoneFlag[i]) || | 1107 | (NULL == pCtx->sMb.pInterPredictionDoneFlag[i]) || |
| 1108 | (NULL == pCtx->sMb.pMbRefConcealedFlag[i]) || | ||
| 1103 | (NULL == pCtx->sMb.pMbCorrectlyDecodedFlag[i]) | 1109 | (NULL == pCtx->sMb.pMbCorrectlyDecodedFlag[i]) |
| 1104 | ) | 1110 | ) |
| 1105 | ) | 1111 | ) |
| @@ -1243,6 +1249,10 @@ void UninitialDqLayersContext (PWelsDecoderContext pCtx) { · 137 unmodified lines | |||
| 1243 | pCtx->sMb.pMbCorrectlyDecodedFlag[i] = NULL; | 1249 | pCtx->sMb.pMbCorrectlyDecodedFlag[i] = NULL; |
| 1244 | } | 1250 | } |
| 1245 | 1251 | ||
| 1252 | if (pCtx->sMb.pMbRefConcealedFlag[i]) { | ||
| 1253 | WelsFree (pCtx->sMb.pMbRefConcealedFlag[i], "pCtx->sMb.pMbRefConcealedFlag[]"); | ||
| 1254 | pCtx->sMb.pMbRefConcealedFlag[i] = NULL; | ||
| 1255 | } | ||
| 1246 | WelsFree (pDq, "pDq"); | 1256 | WelsFree (pDq, "pDq"); |
| 1247 | 1257 | ||
| 1248 | pDq = NULL; | 1258 | pDq = NULL; |
| @@ -1683,8 +1693,6 @@ static void WriteBackActiveParameters (PWelsDecoderContext pCtx) { · 434 unmodified lines | |||
| 1683 | int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstInfo) { | 1693 | int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstInfo) { |
| 1684 | int32_t iErr; | 1694 | int32_t iErr; |
| 1685 | PAccessUnit pCurAu = pCtx->pAccessUnitList; | 1695 | PAccessUnit pCurAu = pCtx->pAccessUnitList; |
| 1686 | pCtx->iMbEcedNum = 0; | ||
| 1687 | pCtx->iMbNum = 0; | ||
| 1688 | pCtx->bAuReadyFlag = false; | 1696 | pCtx->bAuReadyFlag = false; |
| 1689 | pCtx->bLastHasMmco5 = false; | 1697 | pCtx->bLastHasMmco5 = false; |
| 1690 | bool bTmpNewSeqBegin = CheckNewSeqBeginAndUpdateActiveLayerSps (pCtx); | 1698 | bool bTmpNewSeqBegin = CheckNewSeqBeginAndUpdateActiveLayerSps (pCtx); |
| @@ -1858,6 +1866,7 @@ void InitCurDqLayerData (PWelsDecoderContext pCtx, PDqLayer pCurDq) { · 167 unmodified lines | |||
| 1858 | pCurDq->pInterPredictionDoneFlag = pCtx->sMb.pInterPredictionDoneFlag[0]; | 1866 | pCurDq->pInterPredictionDoneFlag = pCtx->sMb.pInterPredictionDoneFlag[0]; |
| 1859 | pCurDq->pResidualPredFlag = pCtx->sMb.pResidualPredFlag[0]; | 1867 | pCurDq->pResidualPredFlag = pCtx->sMb.pResidualPredFlag[0]; |
| 1860 | pCurDq->pMbCorrectlyDecodedFlag = pCtx->sMb.pMbCorrectlyDecodedFlag[0]; | 1868 | pCurDq->pMbCorrectlyDecodedFlag = pCtx->sMb.pMbCorrectlyDecodedFlag[0]; |
| 1869 | pCurDq->pMbRefConcealedFlag = pCtx->sMb.pMbRefConcealedFlag[0]; | ||
| 1861 | } | 1870 | } |
| 1862 | } | 1871 | } |
| 1863 | 1872 | ||
| @@ -1916,8 +1925,13 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 52 unmodified lines | |||
| 1916 | if (pCtx->iTotalNumMbRec == 0) { //Picture start to decode | 1925 | if (pCtx->iTotalNumMbRec == 0) { //Picture start to decode |
| 1917 | for (int32_t i = 0; i < LAYER_NUM_EXCHANGEABLE; ++ i) | 1926 | for (int32_t i = 0; i < LAYER_NUM_EXCHANGEABLE; ++ i) |
| 1918 | memset (pCtx->sMb.pSliceIdc[i], 0xff, (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (int32_t))); | 1927 | memset (pCtx->sMb.pSliceIdc[i], 0xff, (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (int32_t))); |
| 1919 | memset (pCtx->pCurDqLayer->pMbCorrectlyDecodedFlag, 0, pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight); | 1928 | memset (pCtx->pCurDqLayer->pMbCorrectlyDecodedFlag, 0, pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight * sizeof (bool)); |
| 1929 | memset (pCtx->pCurDqLayer->pMbRefConcealedFlag, 0, pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight * sizeof (bool)); | ||
| 1930 | pCtx->pDec->iMbNum = pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight; | ||
| 1931 | pCtx->pDec->iMbEcedNum = 0; | ||
| 1932 | pCtx->pDec->iMbEcedPropNum = 0; | ||
| 1920 | } | 1933 | } |
| 1934 | pCtx->bRPLRError = false; | ||
| 1921 | GetI4LumaIChromaAddrTable (pCtx->iDecBlockOffsetArray, pCtx->pDec->iLinesize[0], pCtx->pDec->iLinesize[1]); | 1935 | GetI4LumaIChromaAddrTable (pCtx->iDecBlockOffsetArray, pCtx->pDec->iLinesize[0], pCtx->pDec->iLinesize[1]); |
| 1922 | 1936 | ||
| 1923 | if (pNalCur->sNalHeaderExt.uiLayerDqId > kuiTargetLayerDqId) { // confirmed pNalCur will never be NULL | 1937 | if (pNalCur->sNalHeaderExt.uiLayerDqId > kuiTargetLayerDqId) { // confirmed pNalCur will never be NULL |
| @@ -1935,7 +1949,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 11 unmodified lines | |||
| 1935 | iCurrIdD = pNalCur->sNalHeaderExt.uiDependencyId; | 1949 | iCurrIdD = pNalCur->sNalHeaderExt.uiDependencyId; |
| 1936 | pSh = &pNalCur->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader; | 1950 | pSh = &pNalCur->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader; |
| 1937 | pShExt = &pNalCur->sNalData.sVclNal.sSliceHeaderExt; | 1951 | pShExt = &pNalCur->sNalData.sVclNal.sSliceHeaderExt; |
| 1938 | 1952 | pCtx->bRPLRError = false; | |
| 1939 | bReconstructSlice = CheckSliceNeedReconstruct (pNalCur->sNalHeaderExt.uiLayerDqId, kuiTargetLayerDqId); | 1953 | bReconstructSlice = CheckSliceNeedReconstruct (pNalCur->sNalHeaderExt.uiLayerDqId, kuiTargetLayerDqId); |
| 1940 | 1954 | ||
| 1941 | memcpy (&pLayerInfo.sNalHeaderExt, &pNalCur->sNalHeaderExt, sizeof (SNalUnitHeaderExt)); //confirmed_safe_unsafe_usage | 1955 | memcpy (&pLayerInfo.sNalHeaderExt, &pNalCur->sNalHeaderExt, sizeof (SNalUnitHeaderExt)); //confirmed_safe_unsafe_usage |
| @@ -2006,6 +2020,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 64 unmodified lines | |||
| 2006 | if (iCurrIdD == kuiDependencyIdMax && iCurrIdQ == BASE_QUALITY_ID) { | 2020 | if (iCurrIdD == kuiDependencyIdMax && iCurrIdQ == BASE_QUALITY_ID) { |
| 2007 | iRet = InitRefPicList (pCtx, uiNalRefIdc, pSh->iPicOrderCntLsb); | 2021 | iRet = InitRefPicList (pCtx, uiNalRefIdc, pSh->iPicOrderCntLsb); |
| 2008 | if (iRet) { | 2022 | if (iRet) { |
| 2023 | pCtx->bRPLRError = true; | ||
| 2009 | bAllRefComplete = false; // RPLR error, set ref pictures complete flag false | 2024 | bAllRefComplete = false; // RPLR error, set ref pictures complete flag false |
| 2010 | HandleReferenceLost (pCtx, pNalCur); | 2025 | HandleReferenceLost (pCtx, pNalCur); |
| 2011 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, | 2026 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, |