MCPcopy Create free account
hub / github.com/cisco/openh264 / CheckIntegrityNalUnitsList

Function CheckIntegrityNalUnitsList

codec/decoder/core/src/decoder_core.cpp:1983–2100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1981}
1982
1983bool CheckIntegrityNalUnitsList (PWelsDecoderContext pCtx) {
1984 PAccessUnit pCurAu = pCtx->pAccessUnitList;
1985 const int32_t kiEndPos = pCurAu->uiEndPos;
1986 int32_t iIdxNoInterLayerPred = 0;
1987
1988 if (!pCurAu->bCompletedAuFlag)
1989 return false;
1990
1991 if (pCtx->bNewSeqBegin) {
1992 pCurAu->uiStartPos = 0;
1993 //step1: search the pNalUnit whose iNoInterLayerPredFlag equal to 1 backwards (from uiEndPos to 0)
1994 iIdxNoInterLayerPred = kiEndPos;
1995 while (iIdxNoInterLayerPred >= 0) {
1996 if (pCurAu->pNalUnitsList[iIdxNoInterLayerPred]->sNalHeaderExt.iNoInterLayerPredFlag) {
1997 break;
1998 }
1999 --iIdxNoInterLayerPred;
2000 }
2001 if (iIdxNoInterLayerPred < 0) {
2002 //can not find the Nal Unit whose no_inter_pred_falg equal to 1, MUST STOP decode
2003 return false;
2004 }
2005
2006 //step2: support multi-slice, to include all base layer slice
2007 RefineIdxNoInterLayerPred (pCurAu, &iIdxNoInterLayerPred);
2008 pCurAu->uiStartPos = iIdxNoInterLayerPred;
2009 CheckAvailNalUnitsListContinuity (pCtx, iIdxNoInterLayerPred, kiEndPos);
2010
2011 if (!CheckPocOfCurValidNalUnits (pCurAu, iIdxNoInterLayerPred)) {
2012 return false;
2013 }
2014
2015 pCtx->iCurSeqIntervalTargetDependId = pCurAu->pNalUnitsList[pCurAu->uiEndPos]->sNalHeaderExt.uiDependencyId;
2016 pCtx->iCurSeqIntervalMaxPicWidth =
2017 pCurAu->pNalUnitsList[pCurAu->uiEndPos]->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader.iMbWidth << 4;
2018 pCtx->iCurSeqIntervalMaxPicHeight =
2019 pCurAu->pNalUnitsList[pCurAu->uiEndPos]->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader.iMbHeight << 4;
2020 } else { //P_SLICE
2021 //step 1: search uiDependencyId equal to pCtx->cur_seq_interval_target_dependency_id
2022 bool bGetDependId = false;
2023 int32_t iIdxDependId = 0;
2024
2025 iIdxDependId = kiEndPos;
2026 while (iIdxDependId >= 0) {
2027 if (pCtx->iCurSeqIntervalTargetDependId == pCurAu->pNalUnitsList[iIdxDependId]->sNalHeaderExt.uiDependencyId) {
2028 bGetDependId = true;
2029 break;
2030 } else {
2031 --iIdxDependId;
2032 }
2033 }
2034
2035 //step 2: switch according to whether or not find the index of pNalUnit whose uiDependencyId equal to iCurSeqIntervalTargetDependId
2036 if (bGetDependId) { //get the index of pNalUnit whose uiDependencyId equal to iCurSeqIntervalTargetDependId
2037 bool bGetNoInterPredFront = false;
2038 //step 2a: search iNoInterLayerPredFlag [0....iIdxDependId]
2039 iIdxNoInterLayerPred = iIdxDependId;
2040 while (iIdxNoInterLayerPred >= 0) {

Callers 1

Tested by

no test coverage detected