Showing the changes to codec/decoder/core (1 of 1 file). Show all
Unified · Split
| @@ -837,31 +837,39 @@ bool CheckSpsActive (PWelsDecoderContext pCtx, PSps pSps, bool bUseSubsetFlag) { · 836 unmodified lines | ||
| 837 | 837 | } |
| 838 | 838 | // Pre-active, will be used soon |
| 839 | 839 | if (bUseSubsetFlag) { |
| 840 | − if (pSps->iMbWidth > 0 && pSps->iMbHeight > 0 && pCtx->bSubspsAvailFlags[pSps->iSpsId] | |
| 841 | − && pCtx->pAccessUnitList->uiAvailUnitsNum > 0) { | |
| 842 | − int i = 0, iNum = (int32_t) pCtx->pAccessUnitList->uiAvailUnitsNum; | |
| 843 | − while (i < iNum) { | |
| 844 | − PNalUnit pNalUnit = pCtx->pAccessUnitList->pNalUnitsList[i]; | |
| 845 | − if (pNalUnit->sNalData.sVclNal.bSliceHeaderExtFlag) { //ext data | |
| 846 | − PSps pNextUsedSps = pNalUnit->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader.pSps; | |
| 847 | − if (pNextUsedSps->iSpsId == pSps->iSpsId) | |
| 848 | − return true; | |
| 840 | + if (pSps->iMbWidth > 0 && pSps->iMbHeight > 0 && pCtx->bSubspsAvailFlags[pSps->iSpsId]) { | |
| 841 | + if (pCtx->iTotalNumMbRec > 0) { | |
| 842 | + return true; | |
| 843 | + } | |
| 844 | + if (pCtx->pAccessUnitList->uiAvailUnitsNum > 0) { | |
| 845 | + int i = 0, iNum = (int32_t) pCtx->pAccessUnitList->uiAvailUnitsNum; | |
| 846 | + while (i < iNum) { | |
| 847 | + PNalUnit pNalUnit = pCtx->pAccessUnitList->pNalUnitsList[i]; | |
| 848 | + if (pNalUnit->sNalData.sVclNal.bSliceHeaderExtFlag) { //ext data | |
| 849 | + PSps pNextUsedSps = pNalUnit->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader.pSps; | |
| 850 | + if (pNextUsedSps->iSpsId == pSps->iSpsId) | |
| 851 | + return true; | |
| 852 | + } | |
| 853 | + ++i; | |
| 849 | 854 | } |
| 850 | − ++i; | |
| 851 | 855 | } |
| 852 | 856 | } |
| 853 | 857 | } else { |
| 854 | − if (pSps->iMbWidth > 0 && pSps->iMbHeight > 0 && pCtx->bSpsAvailFlags[pSps->iSpsId] | |
| 855 | − && pCtx->pAccessUnitList->uiAvailUnitsNum > 0) { | |
| 856 | − int i = 0, iNum = (int32_t) pCtx->pAccessUnitList->uiAvailUnitsNum; | |
| 857 | − while (i < iNum) { | |
| 858 | − PNalUnit pNalUnit = pCtx->pAccessUnitList->pNalUnitsList[i]; | |
| 859 | − if (!pNalUnit->sNalData.sVclNal.bSliceHeaderExtFlag) { //non-ext data | |
| 860 | − PSps pNextUsedSps = pNalUnit->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader.pSps; | |
| 861 | − if (pNextUsedSps->iSpsId == pSps->iSpsId) | |
| 862 | − return true; | |
| 858 | + if (pSps->iMbWidth > 0 && pSps->iMbHeight > 0 && pCtx->bSpsAvailFlags[pSps->iSpsId]) { | |
| 859 | + if (pCtx->iTotalNumMbRec > 0) { | |
| 860 | + return true; | |
| 861 | + } | |
| 862 | + if (pCtx->pAccessUnitList->uiAvailUnitsNum > 0) { | |
| 863 | + int i = 0, iNum = (int32_t) pCtx->pAccessUnitList->uiAvailUnitsNum; | |
| 864 | + while (i < iNum) { | |
| 865 | + PNalUnit pNalUnit = pCtx->pAccessUnitList->pNalUnitsList[i]; | |
| 866 | + if (!pNalUnit->sNalData.sVclNal.bSliceHeaderExtFlag) { //non-ext data | |
| 867 | + PSps pNextUsedSps = pNalUnit->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader.pSps; | |
| 868 | + if (pNextUsedSps->iSpsId == pSps->iSpsId) | |
| 869 | + return true; | |
| 870 | + } | |
| 871 | + ++i; | |
| 863 | 872 | } |
| 864 | − ++i; | |
| 865 | 873 | } |
| 866 | 874 | } |
| 867 | 875 | } |
| @@ -1035,8 +1043,8 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 167 unmodified lines | ||
| 1035 | 1043 | pSps->bGapsInFrameNumValueAllowedFlag = !!uiCode; |
| 1036 | 1044 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_width_in_mbs_minus1 |
| 1037 | 1045 | pSps->iMbWidth = PIC_WIDTH_IN_MBS_OFFSET + uiCode; |
| 1038 | − if (pSps->iMbWidth > MAX_MB_SIZE) { | |
| 1039 | − WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "pic_width_in_mbs(%d) exceeds the maximum allowed!", pSps->iMbWidth); | |
| 1046 | + if (pSps->iMbWidth > MAX_MB_SIZE || pSps->iMbWidth == 0) { | |
| 1047 | + WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "pic_width_in_mbs(%d) invalid!", pSps->iMbWidth); | |
| 1040 | 1048 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE); |
| 1041 | 1049 | } |
| 1042 | 1050 | if (((uint64_t)pSps->iMbWidth * (uint64_t)pSps->iMbWidth) > (uint64_t) (8 * pSLevelLimits->uiMaxFS)) { |
| @@ -1045,8 +1053,8 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 2 unmodified lines | ||
| 1045 | 1053 | } |
| 1046 | 1054 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_height_in_map_units_minus1 |
| 1047 | 1055 | pSps->iMbHeight = PIC_HEIGHT_IN_MAP_UNITS_OFFSET + uiCode; |
| 1048 | − if (pSps->iMbHeight > MAX_MB_SIZE) { | |
| 1049 | − WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "pic_height_in_mbs(%d) exceeds the maximum allowed!", pSps->iMbHeight); | |
| 1056 | + if (pSps->iMbHeight > MAX_MB_SIZE || pSps->iMbHeight == 0) { | |
| 1057 | + WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "pic_height_in_mbs(%d) invalid!", pSps->iMbHeight); | |
| 1050 | 1058 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE); |
| 1051 | 1059 | } |
| 1052 | 1060 | if (((uint64_t)pSps->iMbHeight * (uint64_t)pSps->iMbHeight) > (uint64_t) (8 * pSLevelLimits->uiMaxFS)) { |