Merge pull request #1589 from huili2/fix_fmo_sliceskip

fix crash issue of sliceskip and inf-loop in fmo
This commit is contained in:
HaiboZhu 2014-12-04 15:36:51 +08:00
commit 60b6ce1454
5 changed files with 5 additions and 28 deletions

View File

@ -154,6 +154,7 @@ ERR_INFO_UNSUPPORTED_SPSI,
ERR_INFO_UNSUPPORTED_MGS,
ERR_INFO_UNSUPPORTED_BIPRED,
ERR_INFO_UNSUPPORTED_WP,
ERR_INFO_UNSUPPORTED_SLICESKIP,
ERR_INFO_FRAMES_LOST,
ERR_INFO_DEPENDENCY_SPATIAL_LAYER_LOST,

View File

@ -146,7 +146,6 @@ typedef struct TagSliceHeaderExt {
SSliceHeader sSliceHeader;
PSubsetSps pSubsetSps;
uint32_t uiNumMbsInSlice;
uint32_t uiDisableInterLayerDeblockingFilterIdc;
int32_t iInterLayerSliceAlphaC0Offset;
int32_t iInterLayerSliceBetaOffset;

View File

@ -893,7 +893,7 @@ int32_t WelsDecodeMbCabacPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin
int32_t WelsDecodeSlice (PWelsDecoderContext pCtx, bool bFirstSliceInLayer, PNalUnit pNalCur) {
PDqLayer pCurLayer = pCtx->pCurDqLayer;
PFmo pFmo = pCtx->pFmo;
int32_t i, iRet;
int32_t iRet;
int32_t iNextMbXyIndex, iSliceIdc;
PSlice pSlice = &pCurLayer->sLayerInfo.sSliceInLayer;
@ -957,29 +957,6 @@ int32_t WelsDecodeSlice (PWelsDecoderContext pCtx, bool bFirstSliceInLayer, PNal
pCurLayer->iMbY = iMbY;
pCurLayer->iMbXyIndex = iNextMbXyIndex;
if (pSliceHeaderExt->bSliceSkipFlag == 1) {
for (i = 0; i < (int32_t)pSliceHeaderExt->uiNumMbsInSlice; i++) {
pCurLayer->pSliceIdc[iNextMbXyIndex] = iSliceIdc;
pCurLayer->pResidualPredFlag[iNextMbXyIndex] = 1;
if (pSliceHeaderExt->sSliceHeader.pPps->uiNumSliceGroups > 1) {
iNextMbXyIndex = FmoNextMb (pFmo, iNextMbXyIndex);
} else {
++iNextMbXyIndex;
}
iMbX = iNextMbXyIndex % pCurLayer->iMbWidth;
iMbY = iNextMbXyIndex % pCurLayer->iMbHeight;
pCurLayer->iMbX = iMbX;
pCurLayer->iMbY = iMbY;
pCurLayer->iMbXyIndex = iNextMbXyIndex;
}
return 0;
}
do {
if ((-1 == iNextMbXyIndex) || (iNextMbXyIndex >= kiCountNumMb)) { // slice group boundary or end of a frame
break;

View File

@ -865,8 +865,8 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co
WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //slice_skip_flag
pSliceHeadExt->bSliceSkipFlag = !!uiCode;
if (pSliceHeadExt->bSliceSkipFlag) {
WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //num_mbs_in_slice_minus1
pSliceHeadExt->uiNumMbsInSlice = 1 + uiCode;
WelsLog (pLogCtx, WELS_LOG_WARNING, "bSliceSkipFlag == 1 not supported.");
return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_UNSUPPORTED_SLICESKIP);
} else {
WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //adaptive_base_mode_flag
pSliceHeadExt->bAdaptiveBaseModeFlag = !!uiCode;

View File

@ -90,7 +90,7 @@ static inline int32_t FmoGenerateMbAllocMapType0 (PFmo pFmo, PPps pPps) {
static inline int32_t FmoGenerateMbAllocMapType1 (PFmo pFmo, PPps pPps, const int32_t kiMbWidth) {
uint32_t uiNumSliceGroups = 0;
int32_t iMbNum = 0;
int16_t i = 0;
int32_t i = 0;
WELS_VERIFY_RETURN_IF (1, (NULL == pFmo || NULL == pPps))
uiNumSliceGroups = pPps->uiNumSliceGroups;
iMbNum = pFmo->iCountMbNum;