It also fix SetUnRef crashing which should only loop for LIST_1 if ref pic is B_SLICE.
Showing the changes to codec/decoder/core/src/manage_dec_ref.cpp (1 of 8 files). Show all
Unified · Split
| @@ -80,14 +80,17 @@ static void SetUnRef (PPicture pRef) { · 79 unmodified lines | |||
| 80 | pRef->uiSpatialId = -1; | 80 | pRef->uiSpatialId = -1; |
| 81 | pRef->iSpsId = -1; | 81 | pRef->iSpsId = -1; |
| 82 | pRef->bIsComplete = false; | 82 | pRef->bIsComplete = false; |
| 83 | |||
| 84 | if (pRef->eSliceType == I_SLICE) { | ||
| 85 | return; | ||
| 86 | } | ||
| 87 | int32_t lists = pRef->eSliceType == P_SLICE ? 1 : 2; | ||
| 83 | for (int32_t i = 0; i < MAX_DPB_COUNT; ++i) { | 88 | for (int32_t i = 0; i < MAX_DPB_COUNT; ++i) { |
| 84 | if (pRef->pRefPic[LIST_0][i] != NULL) { | 89 | for (int32_t list = 0; list < lists; ++list) { |
| 85 | pRef->pRefPic[LIST_0][i]->bAvailableFlag = true; | 90 | if (pRef->pRefPic[list][i] != NULL) { |
| 86 | pRef->pRefPic[LIST_0][i] = NULL; | 91 | pRef->pRefPic[list][i]->bAvailableFlag = true; |
| 87 | } | 92 | pRef->pRefPic[list][i] = NULL; |
| 88 | if (pRef->pRefPic[LIST_1][i] != NULL) { | 93 | } |
| 89 | pRef->pRefPic[LIST_1][i]->bAvailableFlag = true; | ||
| 90 | pRef->pRefPic[LIST_1][i] = NULL; | ||
| 91 | } | 94 | } |
| 92 | } | 95 | } |
| 93 | } | 96 | } |
| @@ -189,6 +192,7 @@ static int32_t WelsCheckAndRecoverForFutureDecoding (PWelsDecoderContext pCtx) { · 95 unmodified lines | |||
| 189 | pRef->iFrameNum = 0; | 192 | pRef->iFrameNum = 0; |
| 190 | pRef->iFramePoc = 0; | 193 | pRef->iFramePoc = 0; |
| 191 | pRef->uiTemporalId = pRef->uiQualityId = 0; | 194 | pRef->uiTemporalId = pRef->uiQualityId = 0; |
| 195 | pRef->eSliceType = pCtx->eSliceType; | ||
| 192 | ExpandReferencingPicture (pRef->pData, pRef->iWidthInPixel, pRef->iHeightInPixel, pRef->iLinesize, | 196 | ExpandReferencingPicture (pRef->pData, pRef->iWidthInPixel, pRef->iHeightInPixel, pRef->iLinesize, |
| 193 | pCtx->sExpandPicFunc.pfExpandLumaPicture, pCtx->sExpandPicFunc.pfExpandChromaPicture); | 197 | pCtx->sExpandPicFunc.pfExpandLumaPicture, pCtx->sExpandPicFunc.pfExpandChromaPicture); |
| 194 | AddShortTermToList (&pCtx->sRefPic, pRef); | 198 | AddShortTermToList (&pCtx->sRefPic, pRef); |