change au_ready status and check au number
This commit is contained in:
@@ -271,8 +271,10 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
|
|||||||
|
|
||||||
if (uiAvailNalNum > 1) {
|
if (uiAvailNalNum > 1) {
|
||||||
pCurAu->uiEndPos = uiAvailNalNum - 2;
|
pCurAu->uiEndPos = uiAvailNalNum - 2;
|
||||||
|
if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
|
||||||
pCtx->bAuReadyFlag = true;
|
pCtx->bAuReadyFlag = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
pCtx->iErrorCode |= dsBitstreamError;
|
pCtx->iErrorCode |= dsBitstreamError;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -291,8 +293,10 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
|
|||||||
|
|
||||||
if (uiAvailNalNum > 1) {
|
if (uiAvailNalNum > 1) {
|
||||||
pCurAu->uiEndPos = uiAvailNalNum - 2;
|
pCurAu->uiEndPos = uiAvailNalNum - 2;
|
||||||
|
if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
|
||||||
pCtx->bAuReadyFlag = true;
|
pCtx->bAuReadyFlag = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
pCtx->iErrorCode |= dsBitstreamError;
|
pCtx->iErrorCode |= dsBitstreamError;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -340,8 +344,10 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
|
|||||||
ForceClearCurrentNal (pCurAu);
|
ForceClearCurrentNal (pCurAu);
|
||||||
if (uiAvailNalNum > 1) {
|
if (uiAvailNalNum > 1) {
|
||||||
pCurAu->uiEndPos = uiAvailNalNum - 2;
|
pCurAu->uiEndPos = uiAvailNalNum - 2;
|
||||||
|
if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
|
||||||
pCtx->bAuReadyFlag = true;
|
pCtx->bAuReadyFlag = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
WelsLog (pLogCtx, WELS_LOG_ERROR, "NAL_UNIT_CODED_SLICE: InitBits() fail due invalid access.");
|
WelsLog (pLogCtx, WELS_LOG_ERROR, "NAL_UNIT_CODED_SLICE: InitBits() fail due invalid access.");
|
||||||
pCtx->iErrorCode |= dsBitstreamError;
|
pCtx->iErrorCode |= dsBitstreamError;
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -357,8 +363,10 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
|
|||||||
|
|
||||||
if (uiAvailNalNum > 1) {
|
if (uiAvailNalNum > 1) {
|
||||||
pCurAu->uiEndPos = uiAvailNalNum - 2;
|
pCurAu->uiEndPos = uiAvailNalNum - 2;
|
||||||
|
if (pCtx->eErrorConMethod == ERROR_CON_DISABLE) {
|
||||||
pCtx->bAuReadyFlag = true;
|
pCtx->bAuReadyFlag = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
pCtx->iErrorCode |= dsBitstreamError;
|
pCtx->iErrorCode |= dsBitstreamError;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -626,10 +626,11 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
|
|||||||
pDstNal[iDstIdx] = pDstNal[iDstIdx + 1] = pDstNal[iDstIdx + 2] = pDstNal[iDstIdx + 3] =
|
pDstNal[iDstIdx] = pDstNal[iDstIdx + 1] = pDstNal[iDstIdx + 2] = pDstNal[iDstIdx + 3] =
|
||||||
0; // set 4 reserved bytes to zero
|
0; // set 4 reserved bytes to zero
|
||||||
pNalPayload = ParseNalHeader (pCtx, &pCtx->sCurNalHead, pDstNal, iDstIdx, pSrcNal - 3, iSrcIdx + 3, &iConsumedBytes);
|
pNalPayload = ParseNalHeader (pCtx, &pCtx->sCurNalHead, pDstNal, iDstIdx, pSrcNal - 3, iSrcIdx + 3, &iConsumedBytes);
|
||||||
|
if (pNalPayload) { //parse correct
|
||||||
if (IS_VCL_NAL (pCtx->sCurNalHead.eNalUnitType, 1)) {
|
if (IS_VCL_NAL (pCtx->sCurNalHead.eNalUnitType, 1)) {
|
||||||
CheckAndFinishLastPic (pCtx, ppDst, pDstBufInfo);
|
CheckAndFinishLastPic (pCtx, ppDst, pDstBufInfo);
|
||||||
}
|
}
|
||||||
if (IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType) && pNalPayload) {
|
if (IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType)) {
|
||||||
iRet = ParseNonVclNal (pCtx, pNalPayload, iDstIdx - iConsumedBytes, pSrcNal - 3, iSrcIdx + 3);
|
iRet = ParseNonVclNal (pCtx, pNalPayload, iDstIdx - iConsumedBytes, pSrcNal - 3, iSrcIdx + 3);
|
||||||
}
|
}
|
||||||
if (pCtx->bAuReadyFlag) {
|
if (pCtx->bAuReadyFlag) {
|
||||||
@@ -646,6 +647,7 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (iRet) {
|
if (iRet) {
|
||||||
iRet = 0;
|
iRet = 0;
|
||||||
if (dsNoParamSets & pCtx->iErrorCode) {
|
if (dsNoParamSets & pCtx->iErrorCode) {
|
||||||
@@ -682,10 +684,11 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
|
|||||||
pDstNal[iDstIdx] = pDstNal[iDstIdx + 1] = pDstNal[iDstIdx + 2] = pDstNal[iDstIdx + 3] =
|
pDstNal[iDstIdx] = pDstNal[iDstIdx + 1] = pDstNal[iDstIdx + 2] = pDstNal[iDstIdx + 3] =
|
||||||
0; // set 4 reserved bytes to zero
|
0; // set 4 reserved bytes to zero
|
||||||
pNalPayload = ParseNalHeader (pCtx, &pCtx->sCurNalHead, pDstNal, iDstIdx, pSrcNal - 3, iSrcIdx + 3, &iConsumedBytes);
|
pNalPayload = ParseNalHeader (pCtx, &pCtx->sCurNalHead, pDstNal, iDstIdx, pSrcNal - 3, iSrcIdx + 3, &iConsumedBytes);
|
||||||
|
if (pNalPayload) { //parse correct
|
||||||
if (IS_VCL_NAL (pCtx->sCurNalHead.eNalUnitType, 1)) {
|
if (IS_VCL_NAL (pCtx->sCurNalHead.eNalUnitType, 1)) {
|
||||||
CheckAndFinishLastPic (pCtx, ppDst, pDstBufInfo);
|
CheckAndFinishLastPic (pCtx, ppDst, pDstBufInfo);
|
||||||
}
|
}
|
||||||
if (IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType) && pNalPayload) {
|
if (IS_PARAM_SETS_NALS (pCtx->sCurNalHead.eNalUnitType)) {
|
||||||
iRet = ParseNonVclNal (pCtx, pNalPayload, iDstIdx - iConsumedBytes, pSrcNal - 3, iSrcIdx + 3);
|
iRet = ParseNonVclNal (pCtx, pNalPayload, iDstIdx - iConsumedBytes, pSrcNal - 3, iSrcIdx + 3);
|
||||||
}
|
}
|
||||||
if (pCtx->bAuReadyFlag) {
|
if (pCtx->bAuReadyFlag) {
|
||||||
@@ -700,6 +703,7 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
|
|||||||
return pCtx->iErrorCode;
|
return pCtx->iErrorCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (iRet) {
|
if (iRet) {
|
||||||
iRet = 0;
|
iRet = 0;
|
||||||
if (dsNoParamSets & pCtx->iErrorCode) {
|
if (dsNoParamSets & pCtx->iErrorCode) {
|
||||||
|
|||||||
@@ -2140,6 +2140,8 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf
|
|||||||
|
|
||||||
bool CheckAndFinishLastPic (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstInfo) {
|
bool CheckAndFinishLastPic (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstInfo) {
|
||||||
PAccessUnit pAu = pCtx->pAccessUnitList;
|
PAccessUnit pAu = pCtx->pAccessUnitList;
|
||||||
|
if (pAu->uiAvailUnitsNum == 0)
|
||||||
|
return true;
|
||||||
PNalUnit pCurNal = pAu->pNalUnitsList[pAu->uiEndPos];
|
PNalUnit pCurNal = pAu->pNalUnitsList[pAu->uiEndPos];
|
||||||
if ((pCtx->iTotalNumMbRec != 0)
|
if ((pCtx->iTotalNumMbRec != 0)
|
||||||
&& (CheckAccessUnitBoundaryExt (&pCtx->sLastNalHdrExt, &pCurNal->sNalHeaderExt, &pCtx->sLastSliceHeader,
|
&& (CheckAccessUnitBoundaryExt (&pCtx->sLastNalHdrExt, &pCurNal->sNalHeaderExt, &pCtx->sLastSliceHeader,
|
||||||
|
|||||||
Reference in New Issue
Block a user