Merge pull request #1599 from HaiboZhu/Debug_Add_subSPS_check

Add subSPS pre-active check in CheckActiveSPS
This commit is contained in:
huili2 2014-12-09 17:11:06 +08:00
commit 155a91406c

View File

@ -786,12 +786,21 @@ const SLevelLimits* GetLevelLimits (int32_t iLevelIdx, bool bConstraint3) {
return NULL;
}
bool CheckSpsActive (PWelsDecoderContext pCtx, PSps pSps) {
bool CheckSpsActive (PWelsDecoderContext pCtx, PSps pSps, bool bUseSubsetFlag) {
for (int i = 0; i < MAX_LAYER_NUM; i++) {
if (pCtx->pActiveLayerSps[i] == pSps)
return true;
}
// Pre-active, will be used soon
if (bUseSubsetFlag) {
if (pSps->iMbWidth > 0 && pSps->iMbHeight > 0 && pCtx->bSubspsAvailFlags[pSps->iSpsId]
&& pCtx->pAccessUnitList->uiAvailUnitsNum > 0) {
PSps pNextUsedSps =
pCtx->pAccessUnitList->pNalUnitsList[pCtx->pAccessUnitList->uiStartPos]->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader.pSps;
if (pNextUsedSps->iSpsId == pSps->iSpsId)
return true;
}
} else {
if (pSps->iMbWidth > 0 && pSps->iMbHeight > 0 && pCtx->bSpsAvailFlags[pSps->iSpsId]
&& pCtx->pAccessUnitList->uiAvailUnitsNum > 0) {
PSps pNextUsedSps =
@ -799,6 +808,7 @@ bool CheckSpsActive (PWelsDecoderContext pCtx, PSps pSps) {
if (pNextUsedSps->iSpsId == pSps->iSpsId)
return true;
}
}
return false;
}
@ -1127,7 +1137,7 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW
} else {
pTmpSps = &pCtx->sSpsBuffer[iSpsId];
}
if (CheckSpsActive (pCtx, pTmpSps)) {
if (CheckSpsActive (pCtx, pTmpSps, kbUseSubsetFlag)) {
// we are overwriting the active sps, copy a temp buffer
if (kbUseSubsetFlag) {
if (memcmp (&pCtx->sSubsetSpsBuffer[iSpsId], pSubsetSps, sizeof (SSubsetSps)) != 0) {