Showing the changes to codec/decoder (5 of 5 files). Show all
Unified · Split
| @@ -92,7 +92,7 @@ int32_t ParseRefBasePicMarking (PBitStringAux pBs, PRefBasePicMarking pRefBasePi · 91 unmodified lines | |||
| 92 | 92 | ||
| 93 | int32_t ParsePrefixNalUnit (PWelsDecoderContext pCtx, PBitStringAux pBs); | 93 | int32_t ParsePrefixNalUnit (PWelsDecoderContext pCtx, PBitStringAux pBs); |
| 94 | 94 | ||
| 95 | bool CheckAccessUnitBoundary (const PWelsDecoderContext pCtx, const PNalUnit kpCurNal, const PNalUnit kpLastNal, const PSps kpSps); | 95 | bool CheckAccessUnitBoundary (PWelsDecoderContext pCtx, const PNalUnit kpCurNal, const PNalUnit kpLastNal, const PSps kpSps); |
| 96 | bool CheckAccessUnitBoundaryExt (PNalUnitHeaderExt pLastNalHdrExt, PNalUnitHeaderExt pCurNalHeaderExt, | 96 | bool CheckAccessUnitBoundaryExt (PNalUnitHeaderExt pLastNalHdrExt, PNalUnitHeaderExt pCurNalHeaderExt, |
| 97 | PSliceHeader pLastSliceHeader, PSliceHeader pCurSliceHeader); | 97 | PSliceHeader pLastSliceHeader, PSliceHeader pCurSliceHeader); |
| 98 | /*! | 98 | /*! |
| @@ -286,6 +286,7 @@ typedef struct TagWelsDecoderContext { · 285 unmodified lines | |||
| 286 | uint16_t uiCurIdrPicId; | 286 | uint16_t uiCurIdrPicId; |
| 287 | #endif | 287 | #endif |
| 288 | bool bNewSeqBegin; | 288 | bool bNewSeqBegin; |
| 289 | bool bNextNewSeqBegin; | ||
| 289 | int iOverwriteFlags; | 290 | int iOverwriteFlags; |
| 290 | int32_t iErrorConMethod; // | 291 | int32_t iErrorConMethod; // |
| 291 | PPicture pPreviousDecodedPictureInDpb; //pointer to previously decoded picture in DPB for error concealment | 292 | PPicture pPreviousDecodedPictureInDpb; //pointer to previously decoded picture in DPB for error concealment |
| @@ -392,7 +392,7 @@ bool CheckAccessUnitBoundaryExt (PNalUnitHeaderExt pLastNalHdrExt, PNalUnitHeade · 391 unmodified lines | |||
| 392 | } | 392 | } |
| 393 | 393 | ||
| 394 | 394 | ||
| 395 | bool CheckAccessUnitBoundary (const PWelsDecoderContext pCtx, const PNalUnit kpCurNal, const PNalUnit kpLastNal, const PSps kpSps) { | 395 | bool CheckAccessUnitBoundary (PWelsDecoderContext pCtx, const PNalUnit kpCurNal, const PNalUnit kpLastNal, const PSps kpSps) { |
| 396 | const PNalUnitHeaderExt kpLastNalHeaderExt = &kpLastNal->sNalHeaderExt; | 396 | const PNalUnitHeaderExt kpLastNalHeaderExt = &kpLastNal->sNalHeaderExt; |
| 397 | const PNalUnitHeaderExt kpCurNalHeaderExt = &kpCurNal->sNalHeaderExt; | 397 | const PNalUnitHeaderExt kpCurNalHeaderExt = &kpCurNal->sNalHeaderExt; |
| 398 | const SSliceHeader* kpLastSliceHeader = &kpLastNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader; | 398 | const SSliceHeader* kpLastSliceHeader = &kpLastNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader; |
| @@ -405,6 +405,7 @@ bool CheckAccessUnitBoundary (const PWelsDecoderContext pCtx, const PNalUnit kpC · 6 unmodified lines | |||
| 405 | if (kpLastSliceHeader->iFrameNum != kpCurSliceHeader->iFrameNum) | 405 | if (kpLastSliceHeader->iFrameNum != kpCurSliceHeader->iFrameNum) |
| 406 | return true; | 406 | return true; |
| 407 | if (pCtx->pActiveLayerSps[kpCurNalHeaderExt->uiDependencyId] != NULL && pCtx->pActiveLayerSps[kpCurNalHeaderExt->uiDependencyId] != kpSps) { | 407 | if (pCtx->pActiveLayerSps[kpCurNalHeaderExt->uiDependencyId] != NULL && pCtx->pActiveLayerSps[kpCurNalHeaderExt->uiDependencyId] != kpSps) { |
| 408 | pCtx->bNextNewSeqBegin = true; | ||
| 408 | return true; // the active sps changed, new sequence begins, so the current au is ready | 409 | return true; // the active sps changed, new sequence begins, so the current au is ready |
| 409 | } | 410 | } |
| 410 | // Subclause 7.4.1.2.5 | 411 | // Subclause 7.4.1.2.5 |
| @@ -295,6 +295,7 @@ void WelsOpenDecoder (PWelsDecoderContext pCtx) { · 294 unmodified lines | |||
| 295 | #else | 295 | #else |
| 296 | pCtx->bReferenceLostAtT0Flag = true; // should be true to waiting IDR at incoming AU bits following, 6/4/2010 | 296 | pCtx->bReferenceLostAtT0Flag = true; // should be true to waiting IDR at incoming AU bits following, 6/4/2010 |
| 297 | #endif //LONG_TERM_REF | 297 | #endif //LONG_TERM_REF |
| 298 | pCtx->bNewSeqBegin = true; | ||
| 298 | } | 299 | } |
| 299 | 300 | ||
| 300 | /*! | 301 | /*! |
| @@ -1534,7 +1534,6 @@ static bool CheckNewSeqBeginAndUpdateActiveLayerSps(PWelsDecoderContext pCtx) { · 1533 unmodified lines | |||
| 1534 | static void WriteBackActiveParameters(PWelsDecoderContext pCtx) { | 1534 | static void WriteBackActiveParameters(PWelsDecoderContext pCtx) { |
| 1535 | if (pCtx->iOverwriteFlags & OVERWRITE_PPS) { | 1535 | if (pCtx->iOverwriteFlags & OVERWRITE_PPS) { |
| 1536 | memcpy(&pCtx->sPpsBuffer[pCtx->sPpsBuffer[MAX_PPS_COUNT].iPpsId], &pCtx->sPpsBuffer[MAX_PPS_COUNT], sizeof(SPps)); | 1536 | memcpy(&pCtx->sPpsBuffer[pCtx->sPpsBuffer[MAX_PPS_COUNT].iPpsId], &pCtx->sPpsBuffer[MAX_PPS_COUNT], sizeof(SPps)); |
| 1537 | pCtx->bNewSeqBegin = true; | ||
| 1538 | } | 1537 | } |
| 1539 | if (pCtx->iOverwriteFlags & OVERWRITE_SPS) { | 1538 | if (pCtx->iOverwriteFlags & OVERWRITE_SPS) { |
| 1540 | memcpy(&pCtx->sSpsBuffer[pCtx->sSpsBuffer[MAX_SPS_COUNT].iSpsId], &pCtx->sSpsBuffer[MAX_SPS_COUNT], sizeof(SSps)); | 1539 | memcpy(&pCtx->sSpsBuffer[pCtx->sSpsBuffer[MAX_SPS_COUNT].iSpsId], &pCtx->sSpsBuffer[MAX_SPS_COUNT], sizeof(SSps)); |
| @@ -1542,6 +1541,7 @@ static void WriteBackActiveParameters(PWelsDecoderContext pCtx) { · 1 unmodified line | |||
| 1542 | } | 1541 | } |
| 1543 | if (pCtx->iOverwriteFlags & OVERWRITE_SUBSETSPS) { | 1542 | if (pCtx->iOverwriteFlags & OVERWRITE_SUBSETSPS) { |
| 1544 | memcpy(&pCtx->sSubsetSpsBuffer[pCtx->sSubsetSpsBuffer[MAX_SPS_COUNT].sSps.iSpsId], &pCtx->sSubsetSpsBuffer[MAX_SPS_COUNT], sizeof(SSubsetSps)); | 1543 | memcpy(&pCtx->sSubsetSpsBuffer[pCtx->sSubsetSpsBuffer[MAX_SPS_COUNT].sSps.iSpsId], &pCtx->sSubsetSpsBuffer[MAX_SPS_COUNT], sizeof(SSubsetSps)); |
| 1544 | pCtx->bNewSeqBegin = true; | ||
| 1545 | } | 1545 | } |
| 1546 | pCtx->iOverwriteFlags = OVERWRITE_NONE; | 1546 | pCtx->iOverwriteFlags = OVERWRITE_NONE; |
| 1547 | } | 1547 | } |
| @@ -1567,7 +1567,7 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 19 unmodified lines | |||
| 1567 | pCtx->bAuReadyFlag = false; | 1567 | pCtx->bAuReadyFlag = false; |
| 1568 | pCtx->bLastHasMmco5 = false; | 1568 | pCtx->bLastHasMmco5 = false; |
| 1569 | bool bTmpNewSeqBegin = CheckNewSeqBeginAndUpdateActiveLayerSps(pCtx); | 1569 | bool bTmpNewSeqBegin = CheckNewSeqBeginAndUpdateActiveLayerSps(pCtx); |
| 1570 | pCtx->bNewSeqBegin = pCtx->bNewSeqBegin && bTmpNewSeqBegin; | 1570 | pCtx->bNewSeqBegin = pCtx->bNewSeqBegin || bTmpNewSeqBegin; |
| 1571 | iErr = WelsDecodeAccessUnitStart (pCtx); | 1571 | iErr = WelsDecodeAccessUnitStart (pCtx); |
| 1572 | GetVclNalTemporalId (pCtx); | 1572 | GetVclNalTemporalId (pCtx); |
| 1573 | 1573 | ||
| @@ -1599,6 +1599,10 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 25 unmodified lines | |||
| 1599 | WelsDecodeAccessUnitEnd (pCtx); | 1599 | WelsDecodeAccessUnitEnd (pCtx); |
| 1600 | pCtx->bNewSeqBegin = false; | 1600 | pCtx->bNewSeqBegin = false; |
| 1601 | WriteBackActiveParameters(pCtx); | 1601 | WriteBackActiveParameters(pCtx); |
| 1602 | pCtx->bNewSeqBegin = pCtx->bNewSeqBegin || pCtx->bNextNewSeqBegin; | ||
| 1603 | pCtx->bNextNewSeqBegin = false; // reset it | ||
| 1604 | if (pCtx->bNewSeqBegin) | ||
| 1605 | ResetActiveSPSForEachLayer(pCtx); | ||
| 1602 | if (ERR_NONE != iErr) { | 1606 | if (ERR_NONE != iErr) { |
| 1603 | WelsLog (pCtx, WELS_LOG_INFO, "returned error from decoding:[0x%x]\n", iErr); | 1607 | WelsLog (pCtx, WELS_LOG_INFO, "returned error from decoding:[0x%x]\n", iErr); |
| 1604 | return iErr; | 1608 | return iErr; |