Showing the changes to codec/decoder/core/src/au_parser.cpp (1 of 3 files). Show all
Unified · Split
| @@ -871,8 +871,6 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 870 unmodified lines | |||
| 871 | } else pSps->pSLevelLimits = pSLevelLimits; | 871 | } else pSps->pSLevelLimits = pSLevelLimits; |
| 872 | // syntax elements in default | 872 | // syntax elements in default |
| 873 | pSps->uiChromaFormatIdc = 1; | 873 | pSps->uiChromaFormatIdc = 1; |
| 874 | pSps->uiBitDepthLuma = | ||
| 875 | pSps->uiBitDepthChroma = 8; | ||
| 876 | 874 | ||
| 877 | pSps->uiProfileIdc = uiProfileIdc; | 875 | pSps->uiProfileIdc = uiProfileIdc; |
| 878 | pSps->uiLevelIdc = uiLevelIdc; | 876 | pSps->uiLevelIdc = uiLevelIdc; |
| @@ -895,14 +893,14 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 16 unmodified lines | |||
| 895 | WelsLog (pCtx, WELS_LOG_WARNING, "ParseSps(): bit_depth_luma (%d) Only 8 bit supported.\n", 8 + uiCode); | 893 | WelsLog (pCtx, WELS_LOG_WARNING, "ParseSps(): bit_depth_luma (%d) Only 8 bit supported.\n", 8 + uiCode); |
| 896 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); | 894 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); |
| 897 | } | 895 | } |
| 898 | pSps->uiBitDepthLuma = 8 + uiCode; | 896 | pSps->uiBitDepthLuma = 8; |
| 899 | 897 | ||
| 900 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //bit_depth_chroma_minus8 | 898 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //bit_depth_chroma_minus8 |
| 901 | if (uiCode != 0) { | 899 | if (uiCode != 0) { |
| 902 | WelsLog (pCtx, WELS_LOG_WARNING, "ParseSps(): bit_depth_chroma (%d). Only 8 bit supported.\n", 8 + uiCode); | 900 | WelsLog (pCtx, WELS_LOG_WARNING, "ParseSps(): bit_depth_chroma (%d). Only 8 bit supported.\n", 8 + uiCode); |
| 903 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); | 901 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE); |
| 904 | } | 902 | } |
| 905 | pSps->uiBitDepthChroma = 8 + uiCode; | 903 | pSps->uiBitDepthChroma = 8; |
| 906 | 904 | ||
| 907 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //qpprime_y_zero_transform_bypass_flag | 905 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //qpprime_y_zero_transform_bypass_flag |
| 908 | pSps->bQpPrimeYZeroTransfBypassFlag = !!uiCode; | 906 | pSps->bQpPrimeYZeroTransfBypassFlag = !!uiCode; |
| @@ -958,18 +956,27 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 49 unmodified lines | |||
| 958 | pSps->bGapsInFrameNumValueAllowedFlag = !!uiCode; | 956 | pSps->bGapsInFrameNumValueAllowedFlag = !!uiCode; |
| 959 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_width_in_mbs_minus1 | 957 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_width_in_mbs_minus1 |
| 960 | pSps->iMbWidth = PIC_WIDTH_IN_MBS_OFFSET + uiCode; | 958 | pSps->iMbWidth = PIC_WIDTH_IN_MBS_OFFSET + uiCode; |
| 961 | if ((uint64_t) (pSps->iMbWidth * pSps->iMbWidth) > (8 * pSLevelLimits->iMaxFS)) { | 959 | if (pSps->iMbWidth > MAX_MB_SIZE) { |
| 960 | WelsLog (pCtx, WELS_LOG_ERROR, "pic_width_in_mbs(%d) exceeds the maximum allowed!\n", pSps->iMbWidth); | ||
| 961 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE); | ||
| 962 | } | ||
| 963 | if (((uint64_t)pSps->iMbWidth * (uint64_t)pSps->iMbWidth) > (8 * pSLevelLimits->iMaxFS)) { | ||
| 962 | WelsLog (pCtx, WELS_LOG_WARNING, " the pic_width_in_mbs exceeds the level limits!\n"); | 964 | WelsLog (pCtx, WELS_LOG_WARNING, " the pic_width_in_mbs exceeds the level limits!\n"); |
| 963 | } | 965 | } |
| 964 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_height_in_map_units_minus1 | 966 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_height_in_map_units_minus1 |
| 965 | pSps->iMbHeight = PIC_HEIGHT_IN_MAP_UNITS_OFFSET + uiCode; | 967 | pSps->iMbHeight = PIC_HEIGHT_IN_MAP_UNITS_OFFSET + uiCode; |
| 966 | if ((uint64_t) (pSps->iMbHeight * pSps->iMbHeight) > (8 * pSLevelLimits->iMaxFS)) { | 968 | if (pSps->iMbHeight > MAX_MB_SIZE) { |
| 969 | WelsLog (pCtx, WELS_LOG_ERROR, "pic_height_in_mbs(%d) exceeds the maximum allowed!\n", pSps->iMbHeight); | ||
| 970 | return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE); | ||
| 971 | } | ||
| 972 | if (((uint64_t)pSps->iMbHeight * (uint64_t)pSps->iMbHeight) > (8 * pSLevelLimits->iMaxFS)) { | ||
| 967 | WelsLog (pCtx, WELS_LOG_WARNING, " the pic_height_in_mbs exceeds the level limits!\n"); | 973 | WelsLog (pCtx, WELS_LOG_WARNING, " the pic_height_in_mbs exceeds the level limits!\n"); |
| 968 | } | 974 | } |
| 969 | pSps->uiTotalMbCount = pSps->iMbWidth * pSps->iMbHeight; | 975 | uint64_t uiTmp64 = (uint64_t)pSps->iMbWidth * (uint64_t)pSps->iMbHeight; |
| 970 | if (pSps->uiTotalMbCount > (uint32_t)pSLevelLimits->iMaxFS) { | 976 | if (uiTmp64 > (uint32_t)pSLevelLimits->iMaxFS) { |
| 971 | WelsLog (pCtx, WELS_LOG_WARNING, " the total count of mb exceeds the level limits!\n"); | 977 | WelsLog (pCtx, WELS_LOG_WARNING, " the total count of mb exceeds the level limits!\n"); |
| 972 | } | 978 | } |
| 979 | pSps->uiTotalMbCount = uiTmp64; | ||
| 973 | WELS_CHECK_SE_UPPER_ERROR (pSps->iNumRefFrames, SPS_MAX_NUM_REF_FRAMES_MAX, "max_num_ref_frames", | 980 | WELS_CHECK_SE_UPPER_ERROR (pSps->iNumRefFrames, SPS_MAX_NUM_REF_FRAMES_MAX, "max_num_ref_frames", |
| 974 | GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_NUM_REF_FRAMES)); | 981 | GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_NUM_REF_FRAMES)); |
| 975 | // here we check max_num_ref_frames | 982 | // here we check max_num_ref_frames |