fix new sequence&EC order, and prefix parse bug
This commit is contained in:
@@ -78,6 +78,7 @@ typedef struct TagPrefixNalUnit {
|
|||||||
bool bStoreRefBasePicFlag;
|
bool bStoreRefBasePicFlag;
|
||||||
bool bPrefixNalUnitAdditionalExtFlag;
|
bool bPrefixNalUnitAdditionalExtFlag;
|
||||||
bool bPrefixNalUnitExtFlag;
|
bool bPrefixNalUnitExtFlag;
|
||||||
|
bool bPrefixNalCorrectFlag;
|
||||||
} SPrefixNalUnit, *PPrefixNalUnit;
|
} SPrefixNalUnit, *PPrefixNalUnit;
|
||||||
|
|
||||||
} // namespace WelsDec
|
} // namespace WelsDec
|
||||||
|
|||||||
@@ -188,12 +188,14 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
|
|||||||
|
|
||||||
PAccessUnit pCurAu = pCtx->pAccessUnitList;
|
PAccessUnit pCurAu = pCtx->pAccessUnitList;
|
||||||
uint32_t uiAvailNalNum = pCurAu->uiAvailUnitsNum;
|
uint32_t uiAvailNalNum = pCurAu->uiAvailUnitsNum;
|
||||||
ForceClearCurrentNal (pCurAu);
|
|
||||||
|
|
||||||
if (uiAvailNalNum > 1) {
|
if (uiAvailNalNum > 0) {
|
||||||
pCurAu->uiEndPos = uiAvailNalNum - 2;
|
pCurAu->uiEndPos = uiAvailNalNum - 1;
|
||||||
|
if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) {
|
||||||
pCtx->bAuReadyFlag = true;
|
pCtx->bAuReadyFlag = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
pCurNal->sNalData.sPrefixNal.bPrefixNalCorrectFlag = false;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,12 +206,14 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
|
|||||||
pCurNal->sNalHeaderExt.uiQualityId, pCurNal->sNalHeaderExt.bUseRefBasePicFlag);
|
pCurNal->sNalHeaderExt.uiQualityId, pCurNal->sNalHeaderExt.bUseRefBasePicFlag);
|
||||||
PAccessUnit pCurAu = pCtx->pAccessUnitList;
|
PAccessUnit pCurAu = pCtx->pAccessUnitList;
|
||||||
uint32_t uiAvailNalNum = pCurAu->uiAvailUnitsNum;
|
uint32_t uiAvailNalNum = pCurAu->uiAvailUnitsNum;
|
||||||
ForceClearCurrentNal (pCurAu);
|
|
||||||
|
|
||||||
if (uiAvailNalNum > 1) {
|
if (uiAvailNalNum > 0) {
|
||||||
pCurAu->uiEndPos = uiAvailNalNum - 2;
|
pCurAu->uiEndPos = uiAvailNalNum - 1;
|
||||||
|
if (pCtx->iErrorConMethod == ERROR_CON_DISABLE) {
|
||||||
pCtx->bAuReadyFlag = true;
|
pCtx->bAuReadyFlag = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
pCurNal->sNalData.sPrefixNal.bPrefixNalCorrectFlag = false;
|
||||||
pCtx->iErrorCode |= dsInvalidArgument;
|
pCtx->iErrorCode |= dsInvalidArgument;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -229,6 +233,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
|
|||||||
InitBits (pBs, pNal, iBitSize);
|
InitBits (pBs, pNal, iBitSize);
|
||||||
|
|
||||||
ParsePrefixNalUnit (pCtx, pBs);
|
ParsePrefixNalUnit (pCtx, pBs);
|
||||||
|
pCurNal->sNalData.sPrefixNal.bPrefixNalCorrectFlag = true;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case NAL_UNIT_CODED_SLICE_EXT:
|
case NAL_UNIT_CODED_SLICE_EXT:
|
||||||
@@ -291,8 +296,10 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade
|
|||||||
|
|
||||||
|
|
||||||
if (NAL_UNIT_PREFIX == pCtx->sPrefixNal.sNalHeaderExt.sNalUnitHeader.eNalUnitType) {
|
if (NAL_UNIT_PREFIX == pCtx->sPrefixNal.sNalHeaderExt.sNalUnitHeader.eNalUnitType) {
|
||||||
|
if (pCtx->sPrefixNal.sNalData.sPrefixNal.bPrefixNalCorrectFlag) {
|
||||||
PrefetchNalHeaderExtSyntax (pCtx, pCurNal, &pCtx->sPrefixNal);
|
PrefetchNalHeaderExtSyntax (pCtx, pCurNal, &pCtx->sPrefixNal);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pCurNal->sNalHeaderExt.bIdrFlag = (NAL_UNIT_CODED_SLICE_IDR == pNalUnitHeader->eNalUnitType) ? true :
|
pCurNal->sNalHeaderExt.bIdrFlag = (NAL_UNIT_CODED_SLICE_IDR == pNalUnitHeader->eNalUnitType) ? true :
|
||||||
false; //SHOULD update this flag for AVC if no prefix NAL
|
false; //SHOULD update this flag for AVC if no prefix NAL
|
||||||
|
|||||||
@@ -481,8 +481,6 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
|
|||||||
return pCtx->iErrorCode;
|
return pCtx->iErrorCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Do error concealment here
|
|
||||||
ImplementErrorCon (pCtx);
|
|
||||||
}
|
}
|
||||||
if (iRet) {
|
if (iRet) {
|
||||||
iRet = 0;
|
iRet = 0;
|
||||||
@@ -536,8 +534,6 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
|
|||||||
ResetParameterSetsState (pCtx);
|
ResetParameterSetsState (pCtx);
|
||||||
return pCtx->iErrorCode;
|
return pCtx->iErrorCode;
|
||||||
}
|
}
|
||||||
//Do error concealment here
|
|
||||||
ImplementErrorCon (pCtx);
|
|
||||||
}
|
}
|
||||||
if (iRet) {
|
if (iRet) {
|
||||||
iRet = 0;
|
iRet = 0;
|
||||||
@@ -573,7 +569,6 @@ int32_t WelsDecodeBs (PWelsDecoderContext pCtx, const uint8_t* kpBsBuf, const in
|
|||||||
ResetParameterSetsState (pCtx);
|
ResetParameterSetsState (pCtx);
|
||||||
return pCtx->iErrorCode;
|
return pCtx->iErrorCode;
|
||||||
}
|
}
|
||||||
ImplementErrorCon (pCtx);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1591,6 +1591,9 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI
|
|||||||
iErr = DecodeCurrentAccessUnit (pCtx, ppDst, iStride, &iWidth, &iHeight, pDstInfo);
|
iErr = DecodeCurrentAccessUnit (pCtx, ppDst, iStride, &iWidth, &iHeight, pDstInfo);
|
||||||
|
|
||||||
WelsDecodeAccessUnitEnd (pCtx);
|
WelsDecodeAccessUnitEnd (pCtx);
|
||||||
|
//Do error concealment here
|
||||||
|
ImplementErrorCon (pCtx);
|
||||||
|
|
||||||
pCtx->bNewSeqBegin = false;
|
pCtx->bNewSeqBegin = false;
|
||||||
WriteBackActiveParameters(pCtx);
|
WriteBackActiveParameters(pCtx);
|
||||||
pCtx->bNewSeqBegin = pCtx->bNewSeqBegin || pCtx->bNextNewSeqBegin;
|
pCtx->bNewSeqBegin = pCtx->bNewSeqBegin || pCtx->bNextNewSeqBegin;
|
||||||
|
|||||||
Reference in New Issue
Block a user