Showing the changes to codec/decoder (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 | // Pre-active, will be used soon | 838 | // Pre-active, will be used soon |
| 839 | if (bUseSubsetFlag) { | 839 | if (bUseSubsetFlag) { |
| 840 | if (pSps->iMbWidth > 0 && pSps->iMbHeight > 0 && pCtx->bSubspsAvailFlags[pSps->iSpsId] | 840 | if (pSps->iMbWidth > 0 && pSps->iMbHeight > 0 && pCtx->bSubspsAvailFlags[pSps->iSpsId]) { |
| 841 | && pCtx->pAccessUnitList->uiAvailUnitsNum > 0) { | 841 | if (pCtx->iTotalNumMbRec > 0) { |
| 842 | int i = 0, iNum = (int32_t) pCtx->pAccessUnitList->uiAvailUnitsNum; | 842 | return true; |
| 843 | while (i < iNum) { | 843 | } |
| 844 | PNalUnit pNalUnit = pCtx->pAccessUnitList->pNalUnitsList[i]; | 844 | if (pCtx->pAccessUnitList->uiAvailUnitsNum > 0) { |
| 845 | if (pNalUnit->sNalData.sVclNal.bSliceHeaderExtFlag) { //ext data | 845 | int i = 0, iNum = (int32_t) pCtx->pAccessUnitList->uiAvailUnitsNum; |
| 846 | PSps pNextUsedSps = pNalUnit->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader.pSps; | 846 | while (i < iNum) { |
| 847 | if (pNextUsedSps->iSpsId == pSps->iSpsId) | 847 | PNalUnit pNalUnit = pCtx->pAccessUnitList->pNalUnitsList[i]; |
| 848 | return true; | 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 | } else { | 857 | } else { |
| 854 | if (pSps->iMbWidth > 0 && pSps->iMbHeight > 0 && pCtx->bSpsAvailFlags[pSps->iSpsId] | 858 | if (pSps->iMbWidth > 0 && pSps->iMbHeight > 0 && pCtx->bSpsAvailFlags[pSps->iSpsId]) { |
| 855 | && pCtx->pAccessUnitList->uiAvailUnitsNum > 0) { | 859 | if (pCtx->iTotalNumMbRec > 0) { |
| 856 | int i = 0, iNum = (int32_t) pCtx->pAccessUnitList->uiAvailUnitsNum; | 860 | return true; |
| 857 | while (i < iNum) { | 861 | } |
| 858 | PNalUnit pNalUnit = pCtx->pAccessUnitList->pNalUnitsList[i]; | 862 | if (pCtx->pAccessUnitList->uiAvailUnitsNum > 0) { |
| 859 | if (!pNalUnit->sNalData.sVclNal.bSliceHeaderExtFlag) { //non-ext data | 863 | int i = 0, iNum = (int32_t) pCtx->pAccessUnitList->uiAvailUnitsNum; |
| 860 | PSps pNextUsedSps = pNalUnit->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader.pSps; | 864 | while (i < iNum) { |
| 861 | if (pNextUsedSps->iSpsId == pSps->iSpsId) | 865 | PNalUnit pNalUnit = pCtx->pAccessUnitList->pNalUnitsList[i]; |
| 862 | return true; | 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 | pSps->bGapsInFrameNumValueAllowedFlag = !!uiCode; | 1043 | pSps->bGapsInFrameNumValueAllowedFlag = !!uiCode; |
| 1036 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_width_in_mbs_minus1 | 1044 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_width_in_mbs_minus1 |
| 1037 | pSps->iMbWidth = PIC_WIDTH_IN_MBS_OFFSET + uiCode; | 1045 | pSps->iMbWidth = PIC_WIDTH_IN_MBS_OFFSET + uiCode; |
| 1038 | if (pSps->iMbWidth > MAX_MB_SIZE) { | 1046 | if (pSps->iMbWidth > MAX_MB_SIZE || pSps->iMbWidth == 0) { |
| 1039 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "pic_width_in_mbs(%d) exceeds the maximum allowed!", pSps->iMbWidth); | 1047 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "pic_width_in_mbs(%d) invalid!", pSps->iMbWidth); |
| 1040 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE); | 1048 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE); |
| 1041 | } | 1049 | } |
| 1042 | if (((uint64_t)pSps->iMbWidth * (uint64_t)pSps->iMbWidth) > (uint64_t) (8 * pSLevelLimits->uiMaxFS)) { | 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 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_height_in_map_units_minus1 | 1054 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_height_in_map_units_minus1 |
| 1047 | pSps->iMbHeight = PIC_HEIGHT_IN_MAP_UNITS_OFFSET + uiCode; | 1055 | pSps->iMbHeight = PIC_HEIGHT_IN_MAP_UNITS_OFFSET + uiCode; |
| 1048 | if (pSps->iMbHeight > MAX_MB_SIZE) { | 1056 | if (pSps->iMbHeight > MAX_MB_SIZE || pSps->iMbHeight == 0) { |
| 1049 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "pic_height_in_mbs(%d) exceeds the maximum allowed!", pSps->iMbHeight); | 1057 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "pic_height_in_mbs(%d) invalid!", pSps->iMbHeight); |
| 1050 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE); | 1058 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE); |
| 1051 | } | 1059 | } |
| 1052 | if (((uint64_t)pSps->iMbHeight * (uint64_t)pSps->iMbHeight) > (uint64_t) (8 * pSLevelLimits->uiMaxFS)) { | 1060 | if (((uint64_t)pSps->iMbHeight * (uint64_t)pSps->iMbHeight) > (uint64_t) (8 * pSLevelLimits->uiMaxFS)) { |