Showing the changes to codec/decoder/core/src/decoder_core.cpp (1 of 11 files). Show all
Unified · Split
| @@ -133,7 +133,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 132 unmodified lines | |||
| 133 | pCtx->pDec->bIsComplete = false; | 133 | pCtx->pDec->bIsComplete = false; |
| 134 | pCtx->bFrameFinish = false; //current frame not finished | 134 | pCtx->bFrameFinish = false; //current frame not finished |
| 135 | pCtx->iErrorCode |= dsFramePending; | 135 | pCtx->iErrorCode |= dsFramePending; |
| 136 | return -1; | 136 | return ERR_INFO_PARSEONLY_PENDING; |
| 137 | //pCtx->pParserBsInfo->iNalNum = 0; | 137 | //pCtx->pParserBsInfo->iNalNum = 0; |
| 138 | } | 138 | } |
| 139 | } else { //error | 139 | } else { //error |
| @@ -141,9 +141,9 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 1 unmodified line | |||
| 141 | pCtx->pParserBsInfo->iNalNum = 0; | 141 | pCtx->pParserBsInfo->iNalNum = 0; |
| 142 | pCtx->pParserBsInfo->iSpsWidthInPixel = 0; | 142 | pCtx->pParserBsInfo->iSpsWidthInPixel = 0; |
| 143 | pCtx->pParserBsInfo->iSpsHeightInPixel = 0; | 143 | pCtx->pParserBsInfo->iSpsHeightInPixel = 0; |
| 144 | return -1; | 144 | return ERR_INFO_PARSEONLY_ERROR; |
| 145 | } | 145 | } |
| 146 | return 0; | 146 | return ERR_NONE; |
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | if (pCtx->iTotalNumMbRec != kiTotalNumMbInCurLayer) { | 149 | if (pCtx->iTotalNumMbRec != kiTotalNumMbInCurLayer) { |
| @@ -152,7 +152,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 2 unmodified lines | |||
| 152 | pCtx->iTotalNumMbRec, kiTotalNumMbInCurLayer, pCurDq->iMbWidth, pCurDq->iMbHeight); | 152 | pCtx->iTotalNumMbRec, kiTotalNumMbInCurLayer, pCurDq->iMbWidth, pCurDq->iMbHeight); |
| 153 | bFrameCompleteFlag = false; //return later after output buffer is done | 153 | bFrameCompleteFlag = false; //return later after output buffer is done |
| 154 | if (pCtx->bInstantDecFlag) //no-delay decoding, wait for new slice | 154 | if (pCtx->bInstantDecFlag) //no-delay decoding, wait for new slice |
| 155 | return -1; | 155 | return ERR_INFO_MB_NUM_INADEQUATE; |
| 156 | } else if (pCurDq->sLayerInfo.sNalHeaderExt.bIdrFlag | 156 | } else if (pCurDq->sLayerInfo.sNalHeaderExt.bIdrFlag |
| 157 | && (pCtx->iErrorCode == dsErrorFree)) { //complete non-ECed IDR frame done | 157 | && (pCtx->iErrorCode == dsErrorFree)) { //complete non-ECed IDR frame done |
| 158 | pCtx->pDec->bIsComplete = true; | 158 | pCtx->pDec->bIsComplete = true; |
| @@ -193,7 +193,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 34 unmodified lines | |||
| 193 | if (pDstInfo->iBufferStatus == 0) { | 193 | if (pDstInfo->iBufferStatus == 0) { |
| 194 | if (!bFrameCompleteFlag) | 194 | if (!bFrameCompleteFlag) |
| 195 | pCtx->iErrorCode |= dsBitstreamError; | 195 | pCtx->iErrorCode |= dsBitstreamError; |
| 196 | return -1; | 196 | return ERR_INFO_MB_NUM_INADEQUATE; |
| 197 | } | 197 | } |
| 198 | if (pCtx->bFreezeOutput) { | 198 | if (pCtx->bFreezeOutput) { |
| 199 | pDstInfo->iBufferStatus = 0; | 199 | pDstInfo->iBufferStatus = 0; |
| @@ -206,7 +206,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 6 unmodified lines | |||
| 206 | pCtx->iMbEcedPropNum = pPic->iMbEcedPropNum; | 206 | pCtx->iMbEcedPropNum = pPic->iMbEcedPropNum; |
| 207 | UpdateDecStat (pCtx, pDstInfo->iBufferStatus != 0); | 207 | UpdateDecStat (pCtx, pDstInfo->iBufferStatus != 0); |
| 208 | 208 | ||
| 209 | return 0; | 209 | return ERR_NONE; |
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | inline bool CheckSliceNeedReconstruct (uint8_t uiLayerDqId, uint8_t uiTargetDqId) { | 212 | inline bool CheckSliceNeedReconstruct (uint8_t uiLayerDqId, uint8_t uiTargetDqId) { |
| @@ -971,7 +971,7 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 758 unmodified lines | |||
| 971 | if (pSliceHead->uiDisableDeblockingFilterIdc > 6) { | 971 | if (pSliceHead->uiDisableDeblockingFilterIdc > 6) { |
| 972 | WelsLog (pLogCtx, WELS_LOG_WARNING, "disable_deblock_filter_idc (%d) out of range [0, 6]", | 972 | WelsLog (pLogCtx, WELS_LOG_WARNING, "disable_deblock_filter_idc (%d) out of range [0, 6]", |
| 973 | pSliceHead->uiDisableDeblockingFilterIdc); | 973 | pSliceHead->uiDisableDeblockingFilterIdc); |
| 974 | return ERR_INFO_INVALID_DBLOCKING_IDC; | 974 | return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_DBLOCKING_IDC); |
| 975 | } | 975 | } |
| 976 | if (pSliceHead->uiDisableDeblockingFilterIdc != 1) { | 976 | if (pSliceHead->uiDisableDeblockingFilterIdc != 1) { |
| 977 | WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //slice_alpha_c0_offset_div2 | 977 | WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //slice_alpha_c0_offset_div2 |
| @@ -1018,7 +1018,7 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 40 unmodified lines | |||
| 1018 | if (pSliceHeadExt->uiDisableInterLayerDeblockingFilterIdc > 6) { | 1018 | if (pSliceHeadExt->uiDisableInterLayerDeblockingFilterIdc > 6) { |
| 1019 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "disable_inter_layer_deblock_filter_idc (%d) out of range [0, 6]", | 1019 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "disable_inter_layer_deblock_filter_idc (%d) out of range [0, 6]", |
| 1020 | pSliceHeadExt->uiDisableInterLayerDeblockingFilterIdc); | 1020 | pSliceHeadExt->uiDisableInterLayerDeblockingFilterIdc); |
| 1021 | return ERR_INFO_INVALID_DBLOCKING_IDC; | 1021 | return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_DBLOCKING_IDC); |
| 1022 | } | 1022 | } |
| 1023 | if (pSliceHeadExt->uiDisableInterLayerDeblockingFilterIdc != 1) { | 1023 | if (pSliceHeadExt->uiDisableInterLayerDeblockingFilterIdc != 1) { |
| 1024 | WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //inter_layer_slice_alpha_c0_offset_div2 | 1024 | WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //inter_layer_slice_alpha_c0_offset_div2 |
| @@ -1298,7 +1298,6 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid · 273 unmodified lines | |||
| 1298 | "pCtx->sMb.pSliceIdc[]"); // using int32_t for slice_idc, 4/21/2010 | 1298 | "pCtx->sMb.pSliceIdc[]"); // using int32_t for slice_idc, 4/21/2010 |
| 1299 | pCtx->sMb.pResidualPredFlag[i] = (int8_t*) pMa->WelsMallocz (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (int8_t), | 1299 | pCtx->sMb.pResidualPredFlag[i] = (int8_t*) pMa->WelsMallocz (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (int8_t), |
| 1300 | "pCtx->sMb.pResidualPredFlag[]"); | 1300 | "pCtx->sMb.pResidualPredFlag[]"); |
| 1301 | //pCtx->sMb.pMotionPredFlag[i] = (uint8_t *) pMa->WelsMallocz(pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof(uint8_t), "pCtx->sMb.pMotionPredFlag[]"); | ||
| 1302 | pCtx->sMb.pInterPredictionDoneFlag[i] = (int8_t*) pMa->WelsMallocz (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof ( | 1301 | pCtx->sMb.pInterPredictionDoneFlag[i] = (int8_t*) pMa->WelsMallocz (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof ( |
| 1303 | int8_t), "pCtx->sMb.pInterPredictionDoneFlag[]"); | 1302 | int8_t), "pCtx->sMb.pInterPredictionDoneFlag[]"); |
| 1304 | 1303 | ||
| @@ -1314,6 +1313,8 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid · 9 unmodified lines | |||
| 1314 | (NULL == pCtx->sMb.pMv[i][0]) || | 1313 | (NULL == pCtx->sMb.pMv[i][0]) || |
| 1315 | (NULL == pCtx->sMb.pRefIndex[i][0]) || | 1314 | (NULL == pCtx->sMb.pRefIndex[i][0]) || |
| 1316 | (NULL == pCtx->sMb.pLumaQp[i]) || | 1315 | (NULL == pCtx->sMb.pLumaQp[i]) || |
| 1316 | (NULL == pCtx->sMb.pNoSubMbPartSizeLessThan8x8Flag[i]) || | ||
| 1317 | (NULL == pCtx->sMb.pTransformSize8x8Flag[i]) || | ||
| 1317 | (NULL == pCtx->sMb.pChromaQp[i]) || | 1318 | (NULL == pCtx->sMb.pChromaQp[i]) || |
| 1318 | (NULL == pCtx->sMb.pMvd[i][0]) || | 1319 | (NULL == pCtx->sMb.pMvd[i][0]) || |
| 1319 | (NULL == pCtx->sMb.pCbfDc[i]) || | 1320 | (NULL == pCtx->sMb.pCbfDc[i]) || |
| @@ -1322,6 +1323,7 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid · 2 unmodified lines | |||
| 1322 | (NULL == pCtx->sMb.pScaledTCoeff[i]) || | 1323 | (NULL == pCtx->sMb.pScaledTCoeff[i]) || |
| 1323 | (NULL == pCtx->sMb.pIntraPredMode[i]) || | 1324 | (NULL == pCtx->sMb.pIntraPredMode[i]) || |
| 1324 | (NULL == pCtx->sMb.pIntra4x4FinalMode[i]) || | 1325 | (NULL == pCtx->sMb.pIntra4x4FinalMode[i]) || |
| 1326 | (NULL == pCtx->sMb.pIntraNxNAvailFlag[i]) || | ||
| 1325 | (NULL == pCtx->sMb.pChromaPredMode[i]) || | 1327 | (NULL == pCtx->sMb.pChromaPredMode[i]) || |
| 1326 | (NULL == pCtx->sMb.pCbp[i]) || | 1328 | (NULL == pCtx->sMb.pCbp[i]) || |
| 1327 | (NULL == pCtx->sMb.pSubMbType[i]) || | 1329 | (NULL == pCtx->sMb.pSubMbType[i]) || |
| @@ -2007,7 +2009,7 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 679 unmodified lines | |||
| 2007 | return iErr; | 2009 | return iErr; |
| 2008 | } | 2010 | } |
| 2009 | 2011 | ||
| 2010 | return 0; | 2012 | return ERR_NONE; |
| 2011 | } | 2013 | } |
| 2012 | 2014 | ||
| 2013 | static inline void InitDqLayerInfo (PDqLayer pDqLayer, PLayerInfo pLayerInfo, PNalUnit pNalUnit, PPicture pPicDec) { | 2015 | static inline void InitDqLayerInfo (PDqLayer pDqLayer, PLayerInfo pLayerInfo, PNalUnit pNalUnit, PPicture pPicDec) { |
| @@ -2251,7 +2253,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 237 unmodified lines | |||
| 2251 | #else | 2253 | #else |
| 2252 | pCtx->bReferenceLostAtT0Flag = true; | 2254 | pCtx->bReferenceLostAtT0Flag = true; |
| 2253 | #endif | 2255 | #endif |
| 2254 | return ERR_INFO_REFERENCE_PIC_LOST; | 2256 | return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_REFERENCE_PIC_LOST); |
| 2255 | } | 2257 | } |
| 2256 | } | 2258 | } |
| 2257 | } | 2259 | } |
| @@ -2290,9 +2292,9 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 32 unmodified lines | |||
| 2290 | } | 2292 | } |
| 2291 | 2293 | ||
| 2292 | if (bReconstructSlice) { | 2294 | if (bReconstructSlice) { |
| 2293 | if (WelsDecodeConstructSlice (pCtx, pNalCur)) { | 2295 | if ((iRet = WelsDecodeConstructSlice (pCtx, pNalCur)) != ERR_NONE) { |
| 2294 | pCtx->pDec->bIsComplete = false; // reconstruction error, directly set the flag false | 2296 | pCtx->pDec->bIsComplete = false; // reconstruction error, directly set the flag false |
| 2295 | return -1; | 2297 | return iRet; |
| 2296 | } | 2298 | } |
| 2297 | } | 2299 | } |
| 2298 | if (bAllRefComplete && pCtx->eSliceType != I_SLICE) { | 2300 | if (bAllRefComplete && pCtx->eSliceType != I_SLICE) { |
| @@ -2479,6 +2481,8 @@ bool CheckRefPicturesComplete (PWelsDecoderContext pCtx) { · 180 unmodified lines | |||
| 2479 | } | 2481 | } |
| 2480 | iRealMbIdx = (pCtx->pPps->uiNumSliceGroups > 1) ? FmoNextMb (pCtx->pFmo, iRealMbIdx) : | 2482 | iRealMbIdx = (pCtx->pPps->uiNumSliceGroups > 1) ? FmoNextMb (pCtx->pFmo, iRealMbIdx) : |
| 2481 | (pCtx->pCurDqLayer->sLayerInfo.sSliceInLayer.sSliceHeaderExt.sSliceHeader.iFirstMbInSlice + iMbIdx); | 2483 | (pCtx->pCurDqLayer->sLayerInfo.sSliceInLayer.sSliceHeaderExt.sSliceHeader.iFirstMbInSlice + iMbIdx); |
| 2484 | if (iRealMbIdx == -1) //caused by abnormal return of FmoNextMb() | ||
| 2485 | return false; | ||
| 2482 | } | 2486 | } |
| 2483 | return bAllRefComplete; | 2487 | return bAllRefComplete; |
| 2484 | } | 2488 | } |