ref: 3bf69ad5bbb66cf8fed3adf9ef3d5eca8c487c6c
parent: 579a5bc6c255edfde90a3ea5e376fc59c7b2e49b
author: xiaotiansf <[email protected]>
date: Fri Mar 15 11:09:51 EDT 2019
try to use decoder error conditions to determine how to continue instead of trying to loacate deleted references.
--- a/codec/decoder/core/src/decoder.cpp
+++ b/codec/decoder/core/src/decoder.cpp
@@ -165,27 +165,6 @@
return ERR_NONE;
}
-static void ResetRefPicReferences (const PWelsDecoderContext& pCtx, const PPicture& inPPic) {
- //seach and reset the references of deleted references.
- int32_t list_count = pCtx->eSliceType == B_SLICE ? 2 : 1;
- for (int32_t list = LIST_0; list < list_count; ++list) {
- int32_t refIdx = 0;
- PPicture pPic = pCtx->sRefPic.pRefList[list][refIdx];
- while (refIdx < MAX_DPB_COUNT && pPic != NULL) {
- ++refIdx;
- for (int32_t i = LIST_0; i < LIST_A; ++i) {
- int32_t ref = 0;
- while (ref < MAX_DPB_COUNT && pPic->pRefPic[i][ref] != NULL) {
- if (pPic->pRefPic[i][ref] == inPPic) {
- pPic->pRefPic[i][ref] = NULL;
- }
- ++ref;
- }
- }
- }
- }
-}
-
static int32_t DecreasePicBuff (PWelsDecoderContext pCtx, PPicBuff* ppPicBuf, const int32_t kiOldSize,
const int32_t kiPicWidth, const int32_t kiPicHeight, const int32_t kiNewSize) {
PPicBuff pPicOldBuf = *ppPicBuf;
@@ -233,7 +212,6 @@
for (iPicIdx = iDelIdx; iPicIdx < kiOldSize; iPicIdx++) {
if (iPrevPicIdx != iPicIdx) {
if (pPicOldBuf->ppPic[iPicIdx] != NULL) {
- ResetRefPicReferences (pCtx, pPicOldBuf->ppPic[iPicIdx]);
FreePicture (pPicOldBuf->ppPic[iPicIdx], pMa);
pPicOldBuf->ppPic[iPicIdx] = NULL;
}
--- a/codec/decoder/core/src/mv_pred.cpp
+++ b/codec/decoder/core/src/mv_pred.cpp
@@ -1104,6 +1104,10 @@
}
int8_t MapColToList0 (PWelsDecoderContext& pCtx, const int8_t& colocRefIndexL0,
const int32_t& ref0Count) { //ISO/IEC 14496-10:2009(E) (8-193)
+ //When reference is lost, this function must be skipped.
+ if ((pCtx->iErrorCode & dsRefLost) == dsRefLost) {
+ return 0;
+ }
PPicture pic1 = pCtx->sRefPic.pRefList[LIST_1][0];
if (pic1 && pic1->pRefPic[LIST_0][colocRefIndexL0]) {
const int32_t iFramePoc = pic1->pRefPic[LIST_0][colocRefIndexL0]->iFramePoc;