Showing the changes to codec/decoder/core/src/decode_slice.cpp (1 of 2 files). Show all
Unified · Split
| @@ -56,6 +56,22 @@ extern void FreePicture (PPicture pPic, CMemoryAlign* pMa); · 55 unmodified lines | |||
| 56 | 56 | ||
| 57 | extern PPicture AllocPicture (PWelsDecoderContext pCtx, const int32_t kiPicWidth, const int32_t kiPicHeight); | 57 | extern PPicture AllocPicture (PWelsDecoderContext pCtx, const int32_t kiPicWidth, const int32_t kiPicHeight); |
| 58 | 58 | ||
| 59 | static bool CheckRefPics (const PWelsDecoderContext& pCtx) { | ||
| 60 | int32_t listCount = 1; | ||
| 61 | if (pCtx->eSliceType == B_SLICE) { | ||
| 62 | ++listCount; | ||
| 63 | } | ||
| 64 | for (int32_t list = LIST_0; list < listCount; ++list) { | ||
| 65 | int32_t refCount = pCtx->sRefPic.uiRefCount[list]; | ||
| 66 | for (int32_t refIdx = 0; refIdx < refCount; ++refIdx) { | ||
| 67 | if (!pCtx->sRefPic.pRefList[list][refIdx]) { | ||
| 68 | return false; | ||
| 69 | } | ||
| 70 | } | ||
| 71 | } | ||
| 72 | return true; | ||
| 73 | } | ||
| 74 | |||
| 59 | int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) { | 75 | int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) { |
| 60 | PDqLayer pCurLayer = pCtx->pCurDqLayer; | 76 | PDqLayer pCurLayer = pCtx->pCurDqLayer; |
| 61 | PSlice pCurSlice = &pCurLayer->sLayerInfo.sSliceInLayer; | 77 | PSlice pCurSlice = &pCurLayer->sLayerInfo.sSliceInLayer; |
| @@ -318,7 +334,10 @@ int32_t WelsTargetMbConstruction (PWelsDecoderContext pCtx) { · 256 unmodified lines | |||
| 318 | WelsMbIntraPredictionConstruction (pCtx, pCurLayer, 1); | 334 | WelsMbIntraPredictionConstruction (pCtx, pCurLayer, 1); |
| 319 | } else if (IS_INTER (pCurLayer->pMbType[pCurLayer->iMbXyIndex])) { //InterMB | 335 | } else if (IS_INTER (pCurLayer->pMbType[pCurLayer->iMbXyIndex])) { //InterMB |
| 320 | if (0 == pCurLayer->pCbp[pCurLayer->iMbXyIndex]) { //uiCbp==0 include SKIP | 336 | if (0 == pCurLayer->pCbp[pCurLayer->iMbXyIndex]) { //uiCbp==0 include SKIP |
| 321 | WelsMbInterPrediction (pCtx, pCurLayer); | 337 | if (!CheckRefPics (pCtx)) { |
| 338 | return ERR_INFO_MB_RECON_FAIL; | ||
| 339 | } | ||
| 340 | return WelsMbInterPrediction (pCtx, pCurLayer); | ||
| 322 | } else { | 341 | } else { |
| 323 | WelsMbInterConstruction (pCtx, pCurLayer); | 342 | WelsMbInterConstruction (pCtx, pCurLayer); |
| 324 | } | 343 | } |
| @@ -2783,7 +2802,7 @@ int32_t WelsActualDecodeMbCavlcBSlice (PWelsDecoderContext pCtx) { · 2458 unmodified lines | |||
| 2783 | return ERR_NONE; | 2802 | return ERR_NONE; |
| 2784 | } | 2803 | } |
| 2785 | 2804 | ||
| 2786 | void WelsBlockFuncInit (SBlockFunc* pFunc, int32_t iCpu) { | 2805 | void WelsBlockFuncInit (SBlockFunc* pFunc, int32_t iCpu) { |
| 2787 | pFunc->pWelsSetNonZeroCountFunc = WelsNonZeroCount_c; | 2806 | pFunc->pWelsSetNonZeroCountFunc = WelsNonZeroCount_c; |
| 2788 | pFunc->pWelsBlockZero16x16Func = WelsBlockZero16x16_c; | 2807 | pFunc->pWelsBlockZero16x16Func = WelsBlockZero16x16_c; |
| 2789 | pFunc->pWelsBlockZero8x8Func = WelsBlockZero8x8_c; | 2808 | pFunc->pWelsBlockZero8x8Func = WelsBlockZero8x8_c; |