Showing the changes to codec/decoder/core/src/decoder_core.cpp (1 of 2 files). Show all
Unified · Split
| @@ -866,9 +866,9 @@ int32_t UpdateAccessUnit (PWelsDecoderContext pCtx) { · 865 unmodified lines | |||
| 866 | 866 | ||
| 867 | // Added for mosaic avoidance, 11/19/2009 | 867 | // Added for mosaic avoidance, 11/19/2009 |
| 868 | #ifdef LONG_TERM_REF | 868 | #ifdef LONG_TERM_REF |
| 869 | if (pCtx->bParamSetsLostFlag) | 869 | if (pCtx->bParamSetsLostFlag || pCtx->bNewSeqBegin) |
| 870 | #else | 870 | #else |
| 871 | if (pCtx->bReferenceLostAtT0Flag) | 871 | if (pCtx->bReferenceLostAtT0Flag || pCtx->bNewSeqBegin) |
| 872 | #endif | 872 | #endif |
| 873 | { | 873 | { |
| 874 | uint32_t uiActualIdx = 0; | 874 | uint32_t uiActualIdx = 0; |
| @@ -1458,8 +1458,51 @@ void WelsDecodeAccessUnitEnd (PWelsDecoderContext pCtx) { · 583 unmodified lines | |||
| 1458 | ResetCurrentAccessUnit (pCtx); | 1458 | ResetCurrentAccessUnit (pCtx); |
| 1459 | } | 1459 | } |
| 1460 | 1460 | ||
| 1461 | 1461 | /* CheckNewSeqBeginAndUpdateActiveLayerSps | |
| 1462 | 1462 | * return: | |
| 1463 | * true - the AU to be construct is the start of new sequence; false - not | ||
| 1464 | */ | ||
| 1465 | static bool CheckNewSeqBeginAndUpdateActiveLayerSps(PWelsDecoderContext pCtx) { | ||
| 1466 | bool bNewSeq = false; | ||
| 1467 | PAccessUnit pCurAu = pCtx->pAccessUnitList; | ||
| 1468 | PSps pTmpLayerSps[MAX_LAYER_NUM]; | ||
| 1469 | for(int i = 0; i < MAX_LAYER_NUM; i++) { | ||
| 1470 | pTmpLayerSps[i] = NULL; | ||
| 1471 | } | ||
| 1472 | // track the layer sps for the current au | ||
| 1473 | for(int i = pCurAu->uiStartPos; i <= pCurAu->uiEndPos; i++) { | ||
| 1474 | uint32_t uiDid = pCurAu->pNalUnitsList[i]->sNalHeaderExt.uiDependencyId; | ||
| 1475 | pTmpLayerSps[uiDid] = pCurAu->pNalUnitsList[i]->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader.pSps; | ||
| 1476 | } | ||
| 1477 | int iMaxActiveLayer, iMaxCurrentLayer; | ||
| 1478 | for(int i = MAX_LAYER_NUM - 1; i >= 0; i--) { | ||
| 1479 | if (pCtx->pActiveLayerSps[i] != NULL) { | ||
| 1480 | iMaxActiveLayer = i; | ||
| 1481 | break; | ||
| 1482 | } | ||
| 1483 | } | ||
| 1484 | for(int i = MAX_LAYER_NUM - 1; i >= 0; i--) { | ||
| 1485 | if (pTmpLayerSps[i] != NULL) { | ||
| 1486 | iMaxCurrentLayer = i; | ||
| 1487 | break; | ||
| 1488 | } | ||
| 1489 | } | ||
| 1490 | if (iMaxCurrentLayer != iMaxActiveLayer) { | ||
| 1491 | bNewSeq = true; | ||
| 1492 | } | ||
| 1493 | // fill active sps if the current sps is not null while active layer is null | ||
| 1494 | if (!bNewSeq) { | ||
| 1495 | for(int i = 0; i < MAX_LAYER_NUM; i++) { | ||
| 1496 | if (pCtx->pActiveLayerSps[i] == NULL && pTmpLayerSps[i] != NULL) { | ||
| 1497 | pCtx->pActiveLayerSps[i] = pTmpLayerSps[i]; | ||
| 1498 | } | ||
| 1499 | } | ||
| 1500 | } else { | ||
| 1501 | // UpdateActiveLayerSps if new sequence start | ||
| 1502 | memcpy(&pCtx->pActiveLayerSps[0], &pTmpLayerSps[0], MAX_LAYER_NUM * sizeof(PSps)); | ||
| 1503 | } | ||
| 1504 | return bNewSeq; | ||
| 1505 | } | ||
| 1463 | 1506 | ||
| 1464 | /* | 1507 | /* |
| 1465 | * ConstructAccessUnit | 1508 | * ConstructAccessUnit |
| @@ -1483,7 +1526,7 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 17 unmodified lines | |||
| 1483 | 1526 | ||
| 1484 | pCtx->bAuReadyFlag = false; | 1527 | pCtx->bAuReadyFlag = false; |
| 1485 | pCtx->bLastHasMmco5 = false; | 1528 | pCtx->bLastHasMmco5 = false; |
| 1486 | 1529 | pCtx->bNewSeqBegin = CheckNewSeqBeginAndUpdateActiveLayerSps(pCtx); | |
| 1487 | iErr = WelsDecodeAccessUnitStart (pCtx); | 1530 | iErr = WelsDecodeAccessUnitStart (pCtx); |
| 1488 | GetVclNalTemporalId (pCtx); | 1531 | GetVclNalTemporalId (pCtx); |
| 1489 | 1532 | ||
| @@ -1512,7 +1555,7 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 22 unmodified lines | |||
| 1512 | iErr = DecodeCurrentAccessUnit (pCtx, ppDst, iStride, &iWidth, &iHeight, pDstInfo); | 1555 | iErr = DecodeCurrentAccessUnit (pCtx, ppDst, iStride, &iWidth, &iHeight, pDstInfo); |
| 1513 | 1556 | ||
| 1514 | WelsDecodeAccessUnitEnd (pCtx); | 1557 | WelsDecodeAccessUnitEnd (pCtx); |
| 1515 | 1558 | pCtx->bNewSeqBegin = false; | |
| 1516 | if (ERR_NONE != iErr) { | 1559 | if (ERR_NONE != iErr) { |
| 1517 | WelsLog (pCtx, WELS_LOG_INFO, "returned error from decoding:[0x%x]\n", iErr); | 1560 | WelsLog (pCtx, WELS_LOG_INFO, "returned error from decoding:[0x%x]\n", iErr); |
| 1518 | 1561 | ||