History

make the decoder compile and run with treason

Sigrid Solveig Haflínudóttir committed 5 years ago

Commit 37423d41 parent be8e62f71 files · +961 −1217Browse files

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

Unified · Split

codec/decoder/core/src/au_parser.cpp+21−24
@@ -48,7 +48,6 @@ · 47 unmodified lines
48 48
49#define _PARSE_NALHRD_VCLHRD_PARAMS_ 149#define _PARSE_NALHRD_VCLHRD_PARAMS_ 1
50 50
51namespace WelsDec {
52/*!51/*!
53 *************************************************************************************52 *************************************************************************************
54 * \brief Start Code Prefix (0x 00 00 00 01) detection53 * \brief Start Code Prefix (0x 00 00 00 01) detection
@@ -107,13 +106,13 @@ uint8_t* DetectStartCodePrefix (const uint8_t* kpBuf, int32_t* pOffset, int32_t · 52 unmodified lines
107 */106 */
108uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeader, uint8_t* pSrcRbsp,107uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeader, uint8_t* pSrcRbsp,
109 int32_t iSrcRbspLen, uint8_t* pSrcNal, int32_t iSrcNalLen, int32_t* pConsumedBytes) {108 int32_t iSrcRbspLen, uint8_t* pSrcNal, int32_t iSrcNalLen, int32_t* pConsumedBytes) {
110 PNalUnit pCurNal = NULL;109 PNalUnit pCurNal;
111 uint8_t* pNal = pSrcRbsp;110 uint8_t* pNal = pSrcRbsp;
112 int32_t iNalSize = iSrcRbspLen;111 int32_t iNalSize = iSrcRbspLen;
113 PBitStringAux pBs = NULL;112 PBitStringAux pBs;
114 bool bExtensionFlag = false;113 bool bExtensionFlag = false;
115 int32_t iErr = ERR_NONE;114 int32_t iErr;
116 int32_t iBitSize = 0;115 int32_t iBitSize;
117 SDataBuffer* pSavedData = &pCtx->sSavedData;116 SDataBuffer* pSavedData = &pCtx->sSavedData;
118 SLogContext* pLogCtx = & (pCtx->sLogCtx);117 SLogContext* pLogCtx = & (pCtx->sLogCtx);
119 pNalUnitHeader->eNalUnitType = NAL_UNIT_UNSPEC_0;//SHOULD init it. because pCtx->sCurNalHead is common variable.118 pNalUnitHeader->eNalUnitType = NAL_UNIT_UNSPEC_0;//SHOULD init it. because pCtx->sCurNalHead is common variable.
@@ -121,7 +120,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 1 unmodified line
121 //remove the consecutive ZERO at the end of current NAL in the reverse order.--2011.6.1120 //remove the consecutive ZERO at the end of current NAL in the reverse order.--2011.6.1
122 {121 {
123 int32_t iIndex = iSrcRbspLen - 1;122 int32_t iIndex = iSrcRbspLen - 1;
124 uint8_t uiBsZero = 0;123 uint8_t uiBsZero;
125 while (iIndex >= 0) {124 while (iIndex >= 0) {
126 uiBsZero = pSrcRbsp[iIndex];125 uiBsZero = pSrcRbsp[iIndex];
127 if (0 == uiBsZero) {126 if (0 == uiBsZero) {
@@ -266,7 +265,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 138 unmodified lines
266 bExtensionFlag = true;265 bExtensionFlag = true;
267 case NAL_UNIT_CODED_SLICE:266 case NAL_UNIT_CODED_SLICE:
268 case NAL_UNIT_CODED_SLICE_IDR: {267 case NAL_UNIT_CODED_SLICE_IDR: {
269 PAccessUnit pCurAu = NULL;268 PAccessUnit pCurAu;
270 uint32_t uiAvailNalNum;269 uint32_t uiAvailNalNum;
271 pCurNal = MemGetNextNal (&pCtx->pAccessUnitList, pCtx->pMemAlign);270 pCurNal = MemGetNextNal (&pCtx->pAccessUnitList, pCtx->pMemAlign);
272 if (NULL == pCurNal) {271 if (NULL == pCurNal) {
@@ -574,11 +573,11 @@ bool CheckNextAuNewSeq (PWelsDecoderContext pCtx, const PNalUnit kpCurNal, const · 301 unmodified lines
574 */573 */
575int32_t ParseNonVclNal (PWelsDecoderContext pCtx, uint8_t* pRbsp, const int32_t kiSrcLen, uint8_t* pSrcNal,574int32_t ParseNonVclNal (PWelsDecoderContext pCtx, uint8_t* pRbsp, const int32_t kiSrcLen, uint8_t* pSrcNal,
576 const int32_t kSrcNalLen) {575 const int32_t kSrcNalLen) {
577 PBitStringAux pBs = NULL;576 PBitStringAux pBs;
578 EWelsNalUnitType eNalType = NAL_UNIT_UNSPEC_0; // make initial value as unspecified577 EWelsNalUnitType eNalType; // make initial value as unspecified
579 int32_t iPicWidth = 0;578 int32_t iPicWidth = 0;
580 int32_t iPicHeight = 0;579 int32_t iPicHeight = 0;
581 int32_t iBitSize = 0;580 int32_t iBitSize;
582 int32_t iErr = ERR_NONE;581 int32_t iErr = ERR_NONE;
583 if (kiSrcLen <= 0)582 if (kiSrcLen <= 0)
584 return iErr;583 return iErr;
@@ -720,7 +719,7 @@ int32_t ParsePrefixNalUnit (PWelsDecoderContext pCtx, PBitStringAux pBs) { · 135 unmodified lines
720 719
721 720
722int32_t DecodeSpsSvcExt (PWelsDecoderContext pCtx, PSubsetSps pSpsExt, PBitStringAux pBs) {721int32_t DecodeSpsSvcExt (PWelsDecoderContext pCtx, PSubsetSps pSpsExt, PBitStringAux pBs) {
723 PSpsSvcExt pExt = NULL;722 PSpsSvcExt pExt;
724 uint32_t uiCode;723 uint32_t uiCode;
725 int32_t iCode;724 int32_t iCode;
726 725
@@ -832,7 +831,6 @@ const SLevelLimits* GetLevelLimits (int32_t iLevelIdx, bool bConstraint3) { · 105 unmodified lines
832 default:831 default:
833 return NULL;832 return NULL;
834 }833 }
835 return NULL;
836}834}
837 835
838bool CheckSpsActive (PWelsDecoderContext pCtx, PSps pSps, bool bUseSubsetFlag) {836bool CheckSpsActive (PWelsDecoderContext pCtx, PSps pSps, bool bUseSubsetFlag) {
@@ -912,15 +910,15 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 73 unmodified lines
912 uint8_t* pSrcNal, const int32_t kSrcNalLen) {910 uint8_t* pSrcNal, const int32_t kSrcNalLen) {
913 PBitStringAux pBs = pBsAux;911 PBitStringAux pBs = pBsAux;
914 SSubsetSps sTempSubsetSps;912 SSubsetSps sTempSubsetSps;
915 PSps pSps = NULL;913 PSps pSps;
916 PSubsetSps pSubsetSps = NULL;914 PSubsetSps pSubsetSps;
917 SNalUnitHeader* pNalHead = &pCtx->sCurNalHead;915 SNalUnitHeader* pNalHead = &pCtx->sCurNalHead;
918 ProfileIdc uiProfileIdc;916 ProfileIdc uiProfileIdc;
919 uint8_t uiLevelIdc;917 uint8_t uiLevelIdc;
920 int32_t iSpsId;918 int32_t iSpsId;
921 uint32_t uiCode;919 uint32_t uiCode;
922 int32_t iCode;920 int32_t iCode;
923 int32_t iRet = ERR_NONE;921 int32_t iRet;
924 bool bConstraintSetFlags[6] = { false };922 bool bConstraintSetFlags[6] = { false };
925 const bool kbUseSubsetFlag = IS_SUBSET_SPS_NAL (pNalHead->eNalUnitType);923 const bool kbUseSubsetFlag = IS_SUBSET_SPS_NAL (pNalHead->eNalUnitType);
926 924
@@ -1185,7 +1183,7 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 258 unmodified lines
1185 SBitStringAux sSubsetSpsBs;1183 SBitStringAux sSubsetSpsBs;
1186 CMemoryAlign* pMa = pCtx->pMemAlign;1184 CMemoryAlign* pMa = pCtx->pMemAlign;
1187 1185
1188 uint8_t* pBsBuf = static_cast<uint8_t*> (pMa->WelsMallocz (SPS_PPS_BS_SIZE + 4,1186 uint8_t* pBsBuf = (uint8_t*) (pMa->WelsMallocz (SPS_PPS_BS_SIZE + 4,
1189 "Temp buffer for parse only usage.")); //to reserve 4 bytes for UVLC writing buffer1187 "Temp buffer for parse only usage.")); //to reserve 4 bytes for UVLC writing buffer
1190 if (NULL == pBsBuf) {1188 if (NULL == pBsBuf) {
1191 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "sps buffer alloc failed for parse only!");1189 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "sps buffer alloc failed for parse only!");
@@ -1258,7 +1256,7 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 66 unmodified lines
1258 1256
1259 *pPicWidth = pSps->iMbWidth << 4;1257 *pPicWidth = pSps->iMbWidth << 4;
1260 *pPicHeight = pSps->iMbHeight << 4;1258 *pPicHeight = pSps->iMbHeight << 4;
1261 PSps pTmpSps = NULL;1259 PSps pTmpSps;
1262 if (kbUseSubsetFlag) {1260 if (kbUseSubsetFlag) {
1263 pTmpSps = &pCtx->sSpsPpsCtx.sSubsetSpsBuffer[iSpsId].sSps;1261 pTmpSps = &pCtx->sSpsPpsCtx.sSubsetSpsBuffer[iSpsId].sSps;
1264 } else {1262 } else {
@@ -1325,10 +1323,10 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 60 unmodified lines
1325 */1323 */
1326int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux, uint8_t* pSrcNal,1324int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux, uint8_t* pSrcNal,
1327 const int32_t kSrcNalLen) {1325 const int32_t kSrcNalLen) {
1328 1326 USED(pPpsList);
1329 PPps pPps = NULL;1327 PPps pPps;
1330 SPps sTempPps;1328 SPps sTempPps;
1331 uint32_t uiPpsId = 0;1329 uint32_t uiPpsId;
1332 uint32_t iTmp;1330 uint32_t iTmp;
1333 uint32_t uiCode;1331 uint32_t uiCode;
1334 int32_t iCode;1332 int32_t iCode;
@@ -1545,7 +1543,7 @@ int32_t ParseVui (PWelsDecoderContext pCtx, PSps pSps, PBitStringAux pBsAux) { · 210 unmodified lines
1545 WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //timing_info_present_flag1543 WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //timing_info_present_flag
1546 pVui->bTimingInfoPresentFlag = !!uiCode;1544 pVui->bTimingInfoPresentFlag = !!uiCode;
1547 if (pVui->bTimingInfoPresentFlag) {1545 if (pVui->bTimingInfoPresentFlag) {
1548 uint32_t uiTmp = 0;1546 uint32_t uiTmp;
1549 WELS_READ_VERIFY (BsGetBits (pBsAux, 16, &uiCode)); //num_units_in_tick1547 WELS_READ_VERIFY (BsGetBits (pBsAux, 16, &uiCode)); //num_units_in_tick
1550 uiTmp = (uiCode << 16);1548 uiTmp = (uiCode << 16);
1551 WELS_READ_VERIFY (BsGetBits (pBsAux, 16, &uiCode)); //num_units_in_tick1549 WELS_READ_VERIFY (BsGetBits (pBsAux, 16, &uiCode)); //num_units_in_tick
@@ -1657,7 +1655,8 @@ int32_t ParseVui (PWelsDecoderContext pCtx, PSps pSps, PBitStringAux pBsAux) { · 105 unmodified lines
1657 */1655 */
1658int32_t ParseSei (void* pSei, PBitStringAux pBsAux) { // reserved Sei_Msg type1656int32_t ParseSei (void* pSei, PBitStringAux pBsAux) { // reserved Sei_Msg type
1659 1657
1660 1658 USED(pSei);
1659 USED(pBsAux);
1661 return ERR_NONE;1660 return ERR_NONE;
1662}1661}
1663/*1662/*
@@ -1783,5 +1782,3 @@ int32_t ResetFmoList (PWelsDecoderContext pCtx) { · 119 unmodified lines
1783 }1782 }
1784 return iCountNum;1783 return iCountNum;
1785}1784}
1786
1787} // namespace WelsDec

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