Showing the changes to codec/decoder/core/src/decoder.cpp (1 of 1 file). Show all
Unified · Split
| @@ -212,21 +212,20 @@ static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co · 211 unmodified lines | ||
| 212 | 212 | //update references due to allocation changes |
| 213 | 213 | for (int32_t i = 0; i < kiNewSize; i++) { |
| 214 | 214 | for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) { |
| 215 | − for (int32_t j = 0; j < MAX_DPB_COUNT; j++) { | |
| 216 | − if (pPicNewBuf->ppPic[i]->pRefPic[listIdx][j] != NULL) { | |
| 217 | − unsigned long long uiTimeStamp = pPicNewBuf->ppPic[i]->pRefPic[listIdx][j]->uiTimeStamp; | |
| 218 | − bool foundThePic = false; | |
| 219 | − for (int32_t k = 0; k < kiNewSize; k++) { | |
| 220 | − if (pPicNewBuf->ppPic[k]->uiTimeStamp == uiTimeStamp) { | |
| 221 | − pPicNewBuf->ppPic[i]->pRefPic[listIdx][j] = pPicNewBuf->ppPic[k]; | |
| 222 | − foundThePic = true; | |
| 223 | − break; | |
| 224 | − } | |
| 225 | − } | |
| 226 | − if (!foundThePic) { | |
| 227 | − pPicNewBuf->ppPic[i]->pRefPic[listIdx][j] = NULL; | |
| 215 | + int32_t j = -1; | |
| 216 | + while (++j < MAX_DPB_COUNT && pPicNewBuf->ppPic[i]->pRefPic[listIdx][j] != NULL) { | |
| 217 | + unsigned long long uiTimeStamp = pPicNewBuf->ppPic[i]->pRefPic[listIdx][j]->uiTimeStamp; | |
| 218 | + bool foundThePic = false; | |
| 219 | + for (int32_t k = 0; k < kiNewSize; k++) { | |
| 220 | + if (pPicNewBuf->ppPic[k]->uiTimeStamp == uiTimeStamp) { | |
| 221 | + pPicNewBuf->ppPic[i]->pRefPic[listIdx][j] = pPicNewBuf->ppPic[k]; | |
| 222 | + foundThePic = true; | |
| 223 | + break; | |
| 228 | 224 | } |
| 229 | 225 | } |
| 226 | + if (!foundThePic) { | |
| 227 | + pPicNewBuf->ppPic[i]->pRefPic[listIdx][j] = NULL; | |
| 228 | + } | |
| 230 | 229 | } |
| 231 | 230 | } |
| 232 | 231 | } |
| @@ -242,7 +241,7 @@ static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, co · 9 unmodified lines | ||
| 242 | 241 | |
| 243 | 242 | // initialize context in queue |
| 244 | 243 | pPicNewBuf->iCapacity = kiNewSize; |
| 245 | − *ppPicBuf = pPicNewBuf; | |
| 244 | + * ppPicBuf = pPicNewBuf; | |
| 246 | 245 | |
| 247 | 246 | for (int32_t i = 0; i < pPicNewBuf->iCapacity; i++) { |
| 248 | 247 | pPicNewBuf->ppPic[i]->bUsedAsRef = false; |