Showing the changes to codec/decoder/core/src/decoder.cpp (1 of 1 file). Show all
Unified · Split
| @@ -165,6 +165,24 @@ static int32_t IncreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co · 164 unmodified lines | |||
| 165 | return ERR_NONE; | 165 | return ERR_NONE; |
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | static void ResetRefPicReferences (const PWelsDecoderContext& pCtx, const PPicture& inPPic) { | ||
| 169 | //seach and reset the references of deleted references. | ||
| 170 | for (int32_t list = LIST_0; list < LIST_A; ++list) { | ||
| 171 | int32_t refIdx = 0; | ||
| 172 | PPicture pPic = pCtx->sRefPic.pRefList[list][refIdx]; | ||
| 173 | while (refIdx < MAX_DPB_COUNT && pPic != NULL) { | ||
| 174 | ++refIdx; | ||
| 175 | int32_t ref = 0; | ||
| 176 | while (ref < MAX_DPB_COUNT && *pPic->pRefPic[ref] != NULL) { | ||
| 177 | if (*pPic->pRefPic[ref] == inPPic) { | ||
| 178 | *pPic->pRefPic[ref] = NULL; | ||
| 179 | } | ||
| 180 | ++ref; | ||
| 181 | } | ||
| 182 | } | ||
| 183 | } | ||
| 184 | } | ||
| 185 | |||
| 168 | static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, const int32_t kiOldSize, | 186 | static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, const int32_t kiOldSize, |
| 169 | const int32_t kiPicWidth, const int32_t kiPicHeight, const int32_t kiNewSize) { | 187 | const int32_t kiPicWidth, const int32_t kiPicHeight, const int32_t kiNewSize) { |
| 170 | PPicBuff pPicOldBuf = *ppPicBuf; | 188 | PPicBuff pPicOldBuf = *ppPicBuf; |
| @@ -212,22 +230,8 @@ static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co · 41 unmodified lines | |||
| 212 | for (iPicIdx = iDelIdx; iPicIdx < kiOldSize; iPicIdx++) { | 230 | for (iPicIdx = iDelIdx; iPicIdx < kiOldSize; iPicIdx++) { |
| 213 | if (iPrevPicIdx != iPicIdx) { | 231 | if (iPrevPicIdx != iPicIdx) { |
| 214 | if (pPicOldBuf->ppPic[iPicIdx] != NULL) { | 232 | if (pPicOldBuf->ppPic[iPicIdx] != NULL) { |
| 233 | ResetRefPicReferences (pCtx, pPicOldBuf->ppPic[iPicIdx]); | ||
| 215 | FreePicture (pPicOldBuf->ppPic[iPicIdx], pMa); | 234 | FreePicture (pPicOldBuf->ppPic[iPicIdx], pMa); |
| 216 | //seach and reset the references of deleted references. | ||
| 217 | for (int32_t list = LIST_0; list < LIST_A; ++list) { | ||
| 218 | int32_t refIdx = 0; | ||
| 219 | PPicture pPic = pCtx->sRefPic.pRefList[list][refIdx]; | ||
| 220 | while (refIdx < MAX_DPB_COUNT && pPic != NULL) { | ||
| 221 | ++refIdx; | ||
| 222 | int32_t ref = 0; | ||
| 223 | while (ref < MAX_DPB_COUNT && *pPic->pRefPic[ref] != NULL) { | ||
| 224 | if (*pPic->pRefPic[ref] == pPicOldBuf->ppPic[iPicIdx]) { | ||
| 225 | *pPic->pRefPic[ref] = NULL; | ||
| 226 | } | ||
| 227 | ++ref; | ||
| 228 | } | ||
| 229 | } | ||
| 230 | } | ||
| 231 | pPicOldBuf->ppPic[iPicIdx] = NULL; | 235 | pPicOldBuf->ppPic[iPicIdx] = NULL; |
| 232 | } | 236 | } |
| 233 | } | 237 | } |