History

(1) Fix the level limit check wrong condition (2) Fix the FMO return value overflow bug

Haibo Zhu committed 10 years ago

Commit e4a4fb61 parent 22d6a942 files · +16 −7Browse files

Showing the changes to codec/decoder (2 of 2 files). Show all

Unified · Split

2 files
  1. codec/decoder/core/inc/fmo.h +1 −1
  2. codec/decoder/core/src/au_parser.cpp +15 −6
codec/decoder/core/inc/fmo.h+1−1
@@ -48,7 +48,7 @@ · 47 unmodified lines
4848 namespace WelsDec {
4949
5050 #ifndef MB_XY_T
51−#define MB_XY_T int16_t
51+#define MB_XY_T int32_t
5252 #endif//MB_XY_T
5353
5454 /*!
codec/decoder/core/src/au_parser.cpp+15−6
@@ -1057,9 +1057,11 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 1056 unmodified lines
10571057 return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE);
10581058 }
10591059 if (((uint64_t)pSps->iMbWidth * (uint64_t)pSps->iMbWidth) > (uint64_t) (8 * pSLevelLimits->uiMaxFS)) {
1060− WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, " the pic_width_in_mbs exceeds the level limits!");
10611060 if (((uint64_t)pSps->iMbWidth * (uint64_t)pSps->iMbWidth) > (uint64_t) (8 * pSMaxLevelLimits->uiMaxFS)) {
1061+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "the pic_width_in_mbs exceeds the level limits!");
10621062 return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE);
1063+ } else {
1064+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "the pic_width_in_mbs exceeds the level limits!");
10631065 }
10641066 }
10651067 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_height_in_map_units_minus1
@@ -1069,16 +1071,23 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 3 unmodified lines
10691071 return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE);
10701072 }
10711073 if (((uint64_t)pSps->iMbHeight * (uint64_t)pSps->iMbHeight) > (uint64_t) (8 * pSLevelLimits->uiMaxFS)) {
1072− WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, " the pic_height_in_mbs exceeds the level limits!");
10731074 if (((uint64_t)pSps->iMbHeight * (uint64_t)pSps->iMbHeight) > (uint64_t) (8 * pSMaxLevelLimits->uiMaxFS)) {
1075+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "the pic_height_in_mbs exceeds the level limits!");
10741076 return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE);
1077+ } else {
1078+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "the pic_height_in_mbs exceeds the level limits!");
10751079 }
10761080 }
1077− uint32_t uiTmp32 = pSps->iMbWidth * pSps->iMbHeight;
1078− if (uiTmp32 > (uint32_t)pSLevelLimits->uiMaxFS) {
1079− WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, " the total count of mb exceeds the level limits!");
1081+ uint64_t uiTmp64 = (uint64_t)pSps->iMbWidth * (uint64_t)pSps->iMbHeight;
1082+ if (uiTmp64 > (uint64_t)pSLevelLimits->uiMaxFS) {
1083+ if (uiTmp64 > (uint64_t)pSMaxLevelLimits->uiMaxFS) {
1084+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "the total count of mb exceeds the level limits!");
1085+ return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_MB_SIZE);
1086+ } else {
1087+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "the total count of mb exceeds the level limits!");
1088+ }
10801089 }
1081− pSps->uiTotalMbCount = uiTmp32;
1090+ pSps->uiTotalMbCount = (uint32_t)uiTmp64;
10821091 WELS_CHECK_SE_UPPER_ERROR (pSps->iNumRefFrames, SPS_MAX_NUM_REF_FRAMES_MAX, "max_num_ref_frames",
10831092 GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MAX_NUM_REF_FRAMES));
10841093 // 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