MCPcopy Create free account
hub / github.com/cisco/openh264 / ParseSps

Function ParseSps

codec/decoder/core/src/au_parser.cpp:911–1310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

909 */
910
911int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicWidth, int32_t* pPicHeight,
912 uint8_t* pSrcNal, const int32_t kSrcNalLen) {
913 PBitStringAux pBs = pBsAux;
914 SSubsetSps sTempSubsetSps;
915 PSps pSps = NULL;
916 PSubsetSps pSubsetSps = NULL;
917 SNalUnitHeader* pNalHead = &pCtx->sCurNalHead;
918 ProfileIdc uiProfileIdc;
919 uint8_t uiLevelIdc;
920 int32_t iSpsId;
921 uint32_t uiCode;
922 int32_t iCode;
923 int32_t iRet = ERR_NONE;
924 bool bConstraintSetFlags[6] = { false };
925 const bool kbUseSubsetFlag = IS_SUBSET_SPS_NAL (pNalHead->eNalUnitType);
926
927 WELS_READ_VERIFY (BsGetBits (pBs, 8, &uiCode)); //profile_idc
928 uiProfileIdc = uiCode;
929 if (uiProfileIdc != PRO_BASELINE && uiProfileIdc != PRO_MAIN && uiProfileIdc != PRO_SCALABLE_BASELINE
930 && uiProfileIdc != PRO_SCALABLE_HIGH
931 && uiProfileIdc != PRO_EXTENDED && uiProfileIdc != PRO_HIGH) {
932 WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "SPS ID can not be supported!\n");
933 return false;
934 }
935 WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //constraint_set0_flag
936 bConstraintSetFlags[0] = !!uiCode;
937 WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //constraint_set1_flag
938 bConstraintSetFlags[1] = !!uiCode;
939 WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //constraint_set2_flag
940 bConstraintSetFlags[2] = !!uiCode;
941 WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //constraint_set3_flag
942 bConstraintSetFlags[3] = !!uiCode;
943 WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //constraint_set4_flag
944 bConstraintSetFlags[4] = !!uiCode;
945 WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //constraint_set5_flag
946 bConstraintSetFlags[5] = !!uiCode;
947 WELS_READ_VERIFY (BsGetBits (pBs, 2, &uiCode)); // reserved_zero_2bits, equal to 0
948 WELS_READ_VERIFY (BsGetBits (pBs, 8, &uiCode)); // level_idc
949 uiLevelIdc = uiCode;
950 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //seq_parameter_set_id
951 if (uiCode >= MAX_SPS_COUNT) { // Modified to check invalid negative iSpsId, 12/1/2009
952 WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, " iSpsId is out of range! \n");
953 return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_SPS_ID_OVERFLOW);
954 }
955 iSpsId = uiCode;
956 pSubsetSps = &sTempSubsetSps;
957 pSps = &sTempSubsetSps.sSps;
958 memset (pSubsetSps, 0, sizeof (SSubsetSps));
959 // Use the level 5.2 for compatibility
960 const SLevelLimits* pSMaxLevelLimits = GetLevelLimits (52, false);
961 const SLevelLimits* pSLevelLimits = GetLevelLimits (uiLevelIdc, bConstraintSetFlags[3]);
962 if (NULL == pSLevelLimits) {
963 WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "ParseSps(): level_idx (%d).\n", uiLevelIdc);
964 return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE);
965 } else pSps->pSLevelLimits = pSLevelLimits;
966 // syntax elements in default
967 pSps->uiChromaFormatIdc = 1;
968 pSps->uiChromaArrayType = 1;

Callers 1

ParseNonVclNalFunction · 0.85

Calls 15

BsGetBitsFunction · 0.85
WelsLogFunction · 0.85
BsGetOneBitFunction · 0.85
BsGetUeFunction · 0.85
GetLevelLimitsFunction · 0.85
ParseScalingListFunction · 0.85
BsGetSeFunction · 0.85
ParseVuiFunction · 0.85
InitBitsFunction · 0.85
BsWriteBitsFunction · 0.85
BsWriteOneBitFunction · 0.85
BsWriteUEFunction · 0.85

Tested by

no test coverage detected