ref: 9d5bc6fd749f9e9352f4ff41486e8322f28b2ee0
parent: f00d3ac15fa848c9116dcf282e33b3ac1b9c685d
parent: bada2d35bfb38195d5f00086f00feaf628fab0bb
author: huili2 <huili2@cisco.com>
date: Thu Apr 24 07:02:26 EDT 2014
Merge pull request #740 from licaiguo/test fix bNewSeqBegin logic
--- a/codec/decoder/core/inc/au_parser.h
+++ b/codec/decoder/core/inc/au_parser.h
@@ -92,7 +92,7 @@
int32_t ParsePrefixNalUnit (PWelsDecoderContext pCtx, PBitStringAux pBs);
-bool CheckAccessUnitBoundary (const PWelsDecoderContext pCtx, const PNalUnit kpCurNal, const PNalUnit kpLastNal, const PSps kpSps);
+bool CheckAccessUnitBoundary (PWelsDecoderContext pCtx, const PNalUnit kpCurNal, const PNalUnit kpLastNal, const PSps kpSps);
bool CheckAccessUnitBoundaryExt (PNalUnitHeaderExt pLastNalHdrExt, PNalUnitHeaderExt pCurNalHeaderExt,
PSliceHeader pLastSliceHeader, PSliceHeader pCurSliceHeader);
/*!
--- a/codec/decoder/core/inc/decoder_context.h
+++ b/codec/decoder/core/inc/decoder_context.h
@@ -286,6 +286,7 @@
uint16_t uiCurIdrPicId;
#endif
bool bNewSeqBegin;
+ bool bNextNewSeqBegin;
int iOverwriteFlags;
int32_t iErrorConMethod; //
PPicture pPreviousDecodedPictureInDpb; //pointer to previously decoded picture in DPB for error concealment
--- a/codec/decoder/core/src/au_parser.cpp
+++ b/codec/decoder/core/src/au_parser.cpp
@@ -392,7 +392,7 @@
}
-bool CheckAccessUnitBoundary (const PWelsDecoderContext pCtx, const PNalUnit kpCurNal, const PNalUnit kpLastNal, const PSps kpSps) {
+bool CheckAccessUnitBoundary (PWelsDecoderContext pCtx, const PNalUnit kpCurNal, const PNalUnit kpLastNal, const PSps kpSps) {
const PNalUnitHeaderExt kpLastNalHeaderExt = &kpLastNal->sNalHeaderExt;
const PNalUnitHeaderExt kpCurNalHeaderExt = &kpCurNal->sNalHeaderExt;
const SSliceHeader* kpLastSliceHeader = &kpLastNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader;
@@ -405,6 +405,7 @@
if (kpLastSliceHeader->iFrameNum != kpCurSliceHeader->iFrameNum)
return true;
if (pCtx->pActiveLayerSps[kpCurNalHeaderExt->uiDependencyId] != NULL && pCtx->pActiveLayerSps[kpCurNalHeaderExt->uiDependencyId] != kpSps) {
+ pCtx->bNextNewSeqBegin = true;
return true; // the active sps changed, new sequence begins, so the current au is ready
}
// Subclause 7.4.1.2.5
--- a/codec/decoder/core/src/decoder.cpp
+++ b/codec/decoder/core/src/decoder.cpp
@@ -295,6 +295,7 @@
#else
pCtx->bReferenceLostAtT0Flag = true; // should be true to waiting IDR at incoming AU bits following, 6/4/2010
#endif //LONG_TERM_REF
+ pCtx->bNewSeqBegin = true;
}
/*!
--- a/codec/decoder/core/src/decoder_core.cpp
+++ b/codec/decoder/core/src/decoder_core.cpp
@@ -1534,7 +1534,6 @@
static void WriteBackActiveParameters(PWelsDecoderContext pCtx) {
if (pCtx->iOverwriteFlags & OVERWRITE_PPS) {
memcpy(&pCtx->sPpsBuffer[pCtx->sPpsBuffer[MAX_PPS_COUNT].iPpsId], &pCtx->sPpsBuffer[MAX_PPS_COUNT], sizeof(SPps));
- pCtx->bNewSeqBegin = true;
}
if (pCtx->iOverwriteFlags & OVERWRITE_SPS) {
memcpy(&pCtx->sSpsBuffer[pCtx->sSpsBuffer[MAX_SPS_COUNT].iSpsId], &pCtx->sSpsBuffer[MAX_SPS_COUNT], sizeof(SSps));
@@ -1542,6 +1541,7 @@
}
if (pCtx->iOverwriteFlags & OVERWRITE_SUBSETSPS) {
memcpy(&pCtx->sSubsetSpsBuffer[pCtx->sSubsetSpsBuffer[MAX_SPS_COUNT].sSps.iSpsId], &pCtx->sSubsetSpsBuffer[MAX_SPS_COUNT], sizeof(SSubsetSps));
+ pCtx->bNewSeqBegin = true;
}
pCtx->iOverwriteFlags = OVERWRITE_NONE;
}
@@ -1567,7 +1567,7 @@
pCtx->bAuReadyFlag = false;
pCtx->bLastHasMmco5 = false;
bool bTmpNewSeqBegin = CheckNewSeqBeginAndUpdateActiveLayerSps(pCtx);
- pCtx->bNewSeqBegin = pCtx->bNewSeqBegin && bTmpNewSeqBegin;
+ pCtx->bNewSeqBegin = pCtx->bNewSeqBegin || bTmpNewSeqBegin;
iErr = WelsDecodeAccessUnitStart (pCtx);
GetVclNalTemporalId (pCtx);
@@ -1599,6 +1599,10 @@
WelsDecodeAccessUnitEnd (pCtx);
pCtx->bNewSeqBegin = false;
WriteBackActiveParameters(pCtx);
+ pCtx->bNewSeqBegin = pCtx->bNewSeqBegin || pCtx->bNextNewSeqBegin;
+ pCtx->bNextNewSeqBegin = false; // reset it
+ if (pCtx->bNewSeqBegin)
+ ResetActiveSPSForEachLayer(pCtx);
if (ERR_NONE != iErr) {
WelsLog (pCtx, WELS_LOG_INFO, "returned error from decoding:[0x%x]\n", iErr);
return iErr;