History

finish syntax checks in ParseSps

Licai Guo committed 12 years ago

Commit fee0f141 parent 4e0b8d43 files · +18 −8Browse files

Showing the changes to codec/decoder/core/src/au_parser.cpp (1 of 3 files). Show all

Unified · Split

codec/decoder/core/src/au_parser.cpp+15−8
@@ -871,8 +871,6 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 870 unmodified lines
871871 } else pSps->pSLevelLimits = pSLevelLimits;
872872 // syntax elements in default
873873 pSps->uiChromaFormatIdc = 1;
874− pSps->uiBitDepthLuma =
875− pSps->uiBitDepthChroma = 8;
876874
877875 pSps->uiProfileIdc = uiProfileIdc;
878876 pSps->uiLevelIdc = uiLevelIdc;
@@ -895,14 +893,14 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 16 unmodified lines
895893 WelsLog (pCtx, WELS_LOG_WARNING, "ParseSps(): bit_depth_luma (%d) Only 8 bit supported.\n", 8 + uiCode);
896894 return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE);
897895 }
898− pSps->uiBitDepthLuma = 8 + uiCode;
896+ pSps->uiBitDepthLuma = 8;
899897
900898 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //bit_depth_chroma_minus8
901899 if (uiCode != 0) {
902900 WelsLog (pCtx, WELS_LOG_WARNING, "ParseSps(): bit_depth_chroma (%d). Only 8 bit supported.\n", 8 + uiCode);
903901 return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE);
904902 }
905− pSps->uiBitDepthChroma = 8 + uiCode;
903+ pSps->uiBitDepthChroma = 8;
906904
907905 WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //qpprime_y_zero_transform_bypass_flag
908906 pSps->bQpPrimeYZeroTransfBypassFlag = !!uiCode;
@@ -958,18 +956,27 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 49 unmodified lines
958956 pSps->bGapsInFrameNumValueAllowedFlag = !!uiCode;
959957 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_width_in_mbs_minus1
960958 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)) {
962964 WelsLog (pCtx, WELS_LOG_WARNING, " the pic_width_in_mbs exceeds the level limits!\n");
963965 }
964966 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_height_in_map_units_minus1
965967 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)) {
967973 WelsLog (pCtx, WELS_LOG_WARNING, " the pic_height_in_mbs exceeds the level limits!\n");
968974 }
969− pSps->uiTotalMbCount = pSps->iMbWidth * pSps->iMbHeight;
970− if (pSps->uiTotalMbCount > (uint32_t)pSLevelLimits->iMaxFS) {
975+ uint64_t uiTmp64 = (uint64_t)pSps->iMbWidth * (uint64_t)pSps->iMbHeight;
976+ if (uiTmp64 > (uint32_t)pSLevelLimits->iMaxFS) {
971977 WelsLog (pCtx, WELS_LOG_WARNING, " the total count of mb exceeds the level limits!\n");
972978 }
979+ pSps->uiTotalMbCount = uiTmp64;
973980 WELS_CHECK_SE_UPPER_ERROR (pSps->iNumRefFrames, SPS_MAX_NUM_REF_FRAMES_MAX, "max_num_ref_frames",
974981 GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_NUM_REF_FRAMES));
975982 // here we check max_num_ref_frames

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t