History

refine checks in ParseSps

Licai Guo committed 12 years ago

Commit 4e0b8d41 parent 2bdf6d31 file · +9 −16Browse files

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

Unified · Split

codec/decoder/core/src/au_parser.cpp+9−16
@@ -833,11 +833,11 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 832 unmodified lines
833 WELS_READ_VERIFY (BsGetBits (pBs, 8, &uiCode)); // level_idc833 WELS_READ_VERIFY (BsGetBits (pBs, 8, &uiCode)); // level_idc
834 uiLevelIdc = uiCode;834 uiLevelIdc = uiCode;
835 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //seq_parameter_set_id835 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //seq_parameter_set_id
836 iSpsId = uiCode;836 if (uiCode >= MAX_SPS_COUNT) { // Modified to check invalid negative iSpsId, 12/1/2009
837 if (iSpsId >= MAX_SPS_COUNT || iSpsId < 0) { // Modified to check invalid negative iSpsId, 12/1/2009
838 WelsLog (pCtx, WELS_LOG_WARNING, " iSpsId is out of range! \n");837 WelsLog (pCtx, WELS_LOG_WARNING, " iSpsId is out of range! \n");
839 return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_SPS_ID_OVERFLOW);838 return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_SPS_ID_OVERFLOW);
840 }839 }
840 iSpsId = uiCode;
841 841
842 if (kbUseSubsetFlag) {842 if (kbUseSubsetFlag) {
843#ifdef MOSAIC_AVOID_BASED_ON_SPS_PPS_ID843#ifdef MOSAIC_AVOID_BASED_ON_SPS_PPS_ID
@@ -891,18 +891,19 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 47 unmodified lines
891 }891 }
892 pSps->uiChromaArrayType = pSps->uiChromaFormatIdc;892 pSps->uiChromaArrayType = pSps->uiChromaFormatIdc;
893 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //bit_depth_luma_minus8893 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //bit_depth_luma_minus8
894 pSps->uiBitDepthLuma = 8 + uiCode;894 if (uiCode != 0) {
895 if (pSps->uiBitDepthLuma != 8) {895 WelsLog (pCtx, WELS_LOG_WARNING, "ParseSps(): bit_depth_luma (%d) Only 8 bit supported.\n", 8 + uiCode);
896 WelsLog (pCtx, WELS_LOG_WARNING, "ParseSps(): bit_depth_luma (%d) Only 8 bit supported.\n", pSps->uiBitDepthLuma);
897 return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE);896 return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE);
898 }897 }
898 pSps->uiBitDepthLuma = 8 + uiCode;
899 899
900 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //bit_depth_chroma_minus8900 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //bit_depth_chroma_minus8
901 pSps->uiBitDepthChroma = 8 + uiCode;901 if (uiCode != 0) {
902 if (pSps->uiBitDepthChroma != 8) {902 WelsLog (pCtx, WELS_LOG_WARNING, "ParseSps(): bit_depth_chroma (%d). Only 8 bit supported.\n", 8 + uiCode);
903 WelsLog (pCtx, WELS_LOG_WARNING, "ParseSps(): bit_depth_chroma (%d). Only 8 bit supported.\n", pSps->uiBitDepthChroma);
904 return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE);903 return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE);
905 }904 }
905 pSps->uiBitDepthChroma = 8 + uiCode;
906
906 WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //qpprime_y_zero_transform_bypass_flag907 WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //qpprime_y_zero_transform_bypass_flag
907 pSps->bQpPrimeYZeroTransfBypassFlag = !!uiCode;908 pSps->bQpPrimeYZeroTransfBypassFlag = !!uiCode;
908 WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //seq_scaling_matrix_present_flag909 WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //seq_scaling_matrix_present_flag
@@ -956,19 +957,11 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 47 unmodified lines
956 WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //gaps_in_frame_num_value_allowed_flag957 WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //gaps_in_frame_num_value_allowed_flag
957 pSps->bGapsInFrameNumValueAllowedFlag = !!uiCode;958 pSps->bGapsInFrameNumValueAllowedFlag = !!uiCode;
958 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_width_in_mbs_minus1959 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_width_in_mbs_minus1
959 if (uiCode == 0xffffffff) {
960 WelsLog (pCtx, WELS_LOG_ERROR, " pic_width_in_mbs read error!\n");
961 return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MB_SIZE_INFO);
962 }
963 pSps->iMbWidth = PIC_WIDTH_IN_MBS_OFFSET + uiCode;960 pSps->iMbWidth = PIC_WIDTH_IN_MBS_OFFSET + uiCode;
964 if ((uint64_t) (pSps->iMbWidth * pSps->iMbWidth) > (8 * pSLevelLimits->iMaxFS)) {961 if ((uint64_t) (pSps->iMbWidth * pSps->iMbWidth) > (8 * pSLevelLimits->iMaxFS)) {
965 WelsLog (pCtx, WELS_LOG_WARNING, " the pic_width_in_mbs exceeds the level limits!\n");962 WelsLog (pCtx, WELS_LOG_WARNING, " the pic_width_in_mbs exceeds the level limits!\n");
966 }963 }
967 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_height_in_map_units_minus1964 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_height_in_map_units_minus1
968 if (uiCode == 0xffffffff) {
969 WelsLog (pCtx, WELS_LOG_ERROR, " pic_height_in_mbs read error!\n");
970 return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_INVALID_MB_SIZE_INFO);
971 }
972 pSps->iMbHeight = PIC_HEIGHT_IN_MAP_UNITS_OFFSET + uiCode;965 pSps->iMbHeight = PIC_HEIGHT_IN_MAP_UNITS_OFFSET + uiCode;
973 if ((uint64_t) (pSps->iMbHeight * pSps->iMbHeight) > (8 * pSLevelLimits->iMaxFS)) {966 if ((uint64_t) (pSps->iMbHeight * pSps->iMbHeight) > (8 * pSLevelLimits->iMaxFS)) {
974 WelsLog (pCtx, WELS_LOG_WARNING, " the pic_height_in_mbs exceeds the level limits!\n");967 WelsLog (pCtx, WELS_LOG_WARNING, " the pic_height_in_mbs exceeds the level limits!\n");

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