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

Function ParseSliceHeaderSyntaxs

codec/decoder/core/src/decoder_core.cpp:874–1387  ·  view source on GitHub ↗

* decode_slice_header_avc * Parse slice header of bitstream in avc for storing data structure */

Source from the content-addressed store, hash-verified

872 * Parse slice header of bitstream in avc for storing data structure
873 */
874int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, const bool kbExtensionFlag) {
875 PNalUnit const kpCurNal =
876 pCtx->pAccessUnitList->pNalUnitsList[pCtx->pAccessUnitList->uiAvailUnitsNum -
877 1];
878
879 PNalUnitHeaderExt pNalHeaderExt = NULL;
880 PSliceHeader pSliceHead = NULL;
881 PSliceHeaderExt pSliceHeadExt = NULL;
882 PSubsetSps pSubsetSps = NULL;
883 PSps pSps = NULL;
884 PPps pPps = NULL;
885 EWelsNalUnitType eNalType = static_cast<EWelsNalUnitType> (0);
886 int32_t iPpsId = 0;
887 int32_t iRet = ERR_NONE;
888 uint8_t uiSliceType = 0;
889 uint8_t uiQualityId = BASE_QUALITY_ID;
890 bool bIdrFlag = false;
891 bool bSgChangeCycleInvolved = false; // involved slice group change cycle ?
892 uint32_t uiCode;
893 int32_t iCode;
894 SLogContext* pLogCtx = & (pCtx->sLogCtx);
895
896 if (kpCurNal == NULL) {
897 return ERR_INFO_OUT_OF_MEMORY;
898 }
899
900 pNalHeaderExt = &kpCurNal->sNalHeaderExt;
901 pSliceHead = &kpCurNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader;
902 eNalType = pNalHeaderExt->sNalUnitHeader.eNalUnitType;
903
904 pSliceHeadExt = &kpCurNal->sNalData.sVclNal.sSliceHeaderExt;
905
906 if (pSliceHeadExt) {
907 SRefBasePicMarking sBaseMarking;
908 const bool kbStoreRefBaseFlag = pSliceHeadExt->bStoreRefBasePicFlag;
909 memcpy (&sBaseMarking, &pSliceHeadExt->sRefBasePicMarking, sizeof (SRefBasePicMarking)); //confirmed_safe_unsafe_usage
910 memset (pSliceHeadExt, 0, sizeof (SSliceHeaderExt));
911 pSliceHeadExt->bStoreRefBasePicFlag = kbStoreRefBaseFlag;
912 memcpy (&pSliceHeadExt->sRefBasePicMarking, &sBaseMarking, sizeof (SRefBasePicMarking)); //confirmed_safe_unsafe_usage
913 }
914
915 kpCurNal->sNalData.sVclNal.bSliceHeaderExtFlag = kbExtensionFlag;
916
917 // first_mb_in_slice
918 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //first_mb_in_slice
919 WELS_CHECK_SE_UPPER_ERROR (uiCode, 36863u, "first_mb_in_slice", GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER,
920 ERR_INFO_INVALID_FIRST_MB_IN_SLICE));
921 pSliceHead->iFirstMbInSlice = uiCode;
922
923 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //slice_type
924 uiSliceType = uiCode;
925 if (uiSliceType > 9) {
926 WelsLog (pLogCtx, WELS_LOG_WARNING, "slice type too large (%d) at first_mb(%d)", uiSliceType,
927 pSliceHead->iFirstMbInSlice);
928 return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_SLICE_TYPE);
929 }
930 if (uiSliceType > 4)
931 uiSliceType -= 5;

Callers 1

ParseNalHeaderFunction · 0.85

Calls 9

BsGetUeFunction · 0.85
WelsLogFunction · 0.85
BsGetBitsFunction · 0.85
BsGetSeFunction · 0.85
BsGetOneBitFunction · 0.85
ParsePredWeightedTableFunction · 0.85
ParseDecRefPicMarkingFunction · 0.85

Tested by

no test coverage detected