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 | 80 | pRef->uiSpatialId = -1; |
| 81 | 81 | pRef->iSpsId = -1; |
| 82 | 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 | 88 | for (int32_t i = 0; i < MAX_DPB_COUNT; ++i) { |
| 84 | − if (pRef->pRefPic[LIST_0][i] != NULL) { | |
| 85 | − pRef->pRefPic[LIST_0][i]->bAvailableFlag = true; | |
| 86 | − pRef->pRefPic[LIST_0][i] = NULL; | |
| 87 | − } | |
| 88 | − if (pRef->pRefPic[LIST_1][i] != NULL) { | |
| 89 | − pRef->pRefPic[LIST_1][i]->bAvailableFlag = true; | |
| 90 | − pRef->pRefPic[LIST_1][i] = NULL; | |
| 89 | + for (int32_t list = 0; list < lists; ++list) { | |
| 90 | + if (pRef->pRefPic[list][i] != NULL) { | |
| 91 | + pRef->pRefPic[list][i]->bAvailableFlag = true; | |
| 92 | + pRef->pRefPic[list][i] = NULL; | |
| 93 | + } | |
| 91 | 94 | } |
| 92 | 95 | } |
| 93 | 96 | } |
| @@ -189,6 +192,7 @@ static int32_t WelsCheckAndRecoverForFutureDecoding (PWelsDecoderContext pCtx) { · 95 unmodified lines | ||
| 189 | 192 | pRef->iFrameNum = 0; |
| 190 | 193 | pRef->iFramePoc = 0; |
| 191 | 194 | pRef->uiTemporalId = pRef->uiQualityId = 0; |
| 195 | + pRef->eSliceType = pCtx->eSliceType; | |
| 192 | 196 | ExpandReferencingPicture (pRef->pData, pRef->iWidthInPixel, pRef->iHeightInPixel, pRef->iLinesize, |
| 193 | 197 | pCtx->sExpandPicFunc.pfExpandLumaPicture, pCtx->sExpandPicFunc.pfExpandChromaPicture); |
| 194 | 198 | AddShortTermToList (&pCtx->sRefPic, pRef); |