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/decoder_core.cpp (1 of 71 files). Show all

Unified · Split

codec/decoder/core/src/decoder_core.cpp+52−54
@@ -43,7 +43,6 @@ · 42 unmodified lines
43#include "memory_align.h"43#include "memory_align.h"
44#include "error_concealment.h"44#include "error_concealment.h"
45 45
46namespace WelsDec {
47static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstInfo) {46static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstInfo) {
48 PDqLayer pCurDq = pCtx->pCurDqLayer;47 PDqLayer pCurDq = pCtx->pCurDqLayer;
49 PPicture pPic = pCtx->pDec;48 PPicture pPic = pCtx->pDec;
@@ -90,9 +89,9 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 40 unmodified lines
90 PAccessUnit pCurAu = pCtx->pAccessUnitList;89 PAccessUnit pCurAu = pCtx->pAccessUnitList;
91 if (dsErrorFree == pCtx->iErrorCode) { //correct decoding, add to data buffer90 if (dsErrorFree == pCtx->iErrorCode) { //correct decoding, add to data buffer
92 SParserBsInfo* pParser = pCtx->pParserBsInfo;91 SParserBsInfo* pParser = pCtx->pParserBsInfo;
93 SNalUnit* pCurNal = NULL;92 SNalUnit* pCurNal;
94 int32_t iTotalNalLen = 0;93 int32_t iTotalNalLen = 0;
95 int32_t iNalLen = 0;94 int32_t iNalLen;
96 int32_t iNum = 0;95 int32_t iNum = 0;
97 while (iNum < pParser->iNalNum) {96 while (iNum < pParser->iNalNum) {
98 iTotalNalLen += pParser->pNalLenInByte[iNum++];97 iTotalNalLen += pParser->pNalLenInByte[iNum++];
@@ -100,7 +99,7 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 1 unmodified line
100 uint8_t* pDstBuf = pParser->pDstBuff + iTotalNalLen;99 uint8_t* pDstBuf = pParser->pDstBuff + iTotalNalLen;
101 int32_t iIdx = pCurAu->uiStartPos;100 int32_t iIdx = pCurAu->uiStartPos;
102 int32_t iEndIdx = pCurAu->uiEndPos;101 int32_t iEndIdx = pCurAu->uiEndPos;
103 uint8_t* pNalBs = NULL;102 uint8_t* pNalBs;
104 pParser->uiOutBsTimeStamp = (pCurAu->pNalUnitsList [iIdx]) ? pCurAu->pNalUnitsList [iIdx]->uiTimeStamp : 0;103 pParser->uiOutBsTimeStamp = (pCurAu->pNalUnitsList [iIdx]) ? pCurAu->pNalUnitsList [iIdx]->uiTimeStamp : 0;
105 //pParser->iNalNum = 0;104 //pParser->iNalNum = 0;
106 pParser->iSpsWidthInPixel = (pCtx->pSps->iMbWidth << 4) - ((pCtx->pSps->sFrameCrop.iLeftOffset +105 pParser->iSpsWidthInPixel = (pCtx->pSps->iMbWidth << 4) - ((pCtx->pSps->sFrameCrop.iLeftOffset +
@@ -117,8 +116,8 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 10 unmodified lines
117 WELS_VERIFY_RETURN_IF (ERR_INFO_OUT_OF_MEMORY, ExpandBsLenBuffer (pCtx, pParser->iNalNum + 2))116 WELS_VERIFY_RETURN_IF (ERR_INFO_OUT_OF_MEMORY, ExpandBsLenBuffer (pCtx, pParser->iNalNum + 2))
118 }117 }
119 bool bSubSps = (NAL_UNIT_CODED_SLICE_EXT == pCurAu->pNalUnitsList [iIdx]->sNalHeaderExt.sNalUnitHeader.eNalUnitType);118 bool bSubSps = (NAL_UNIT_CODED_SLICE_EXT == pCurAu->pNalUnitsList [iIdx]->sNalHeaderExt.sNalUnitHeader.eNalUnitType);
120 SSpsBsInfo* pSpsBs = NULL;119 SSpsBsInfo* pSpsBs;
121 SPpsBsInfo* pPpsBs = NULL;120 SPpsBsInfo* pPpsBs;
122 int32_t iSpsId = pCtx->pSps->iSpsId;121 int32_t iSpsId = pCtx->pSps->iSpsId;
123 int32_t iPpsId = pCtx->pPps->iPpsId;122 int32_t iPpsId = pCtx->pPps->iPpsId;
124 pCtx->bParamSetsLostFlag = false;123 pCtx->bParamSetsLostFlag = false;
@@ -323,12 +322,12 @@ int32_t ParsePredWeightedTable (PBitStringAux pBs, PSliceHeader pSh) { · 198 unmodified lines
323 int32_t iCode;322 int32_t iCode;
324 323
325 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode));324 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode));
326 WELS_CHECK_SE_BOTH_ERROR_NOLOG (uiCode, 0, 7, "luma_log2_weight_denom",325 WELS_CHECK_SE_BOTH_ERROR_NOLOG ((int)uiCode, 0, 7, "luma_log2_weight_denom",
327 GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_LUMA_LOG2_WEIGHT_DENOM));326 GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_LUMA_LOG2_WEIGHT_DENOM));
328 pSh->sPredWeightTable.uiLumaLog2WeightDenom = uiCode;327 pSh->sPredWeightTable.uiLumaLog2WeightDenom = uiCode;
329 if (pSh->pSps->uiChromaArrayType != 0) {328 if (pSh->pSps->uiChromaArrayType != 0) {
330 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode));329 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode));
331 WELS_CHECK_SE_BOTH_ERROR_NOLOG (uiCode, 0, 7, "chroma_log2_weight_denom",330 WELS_CHECK_SE_BOTH_ERROR_NOLOG ((int)uiCode, 0, 7, "chroma_log2_weight_denom",
332 GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_CHROMA_LOG2_WEIGHT_DENOM));331 GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_CHROMA_LOG2_WEIGHT_DENOM));
333 pSh->sPredWeightTable.uiChromaLog2WeightDenom = uiCode;332 pSh->sPredWeightTable.uiChromaLog2WeightDenom = uiCode;
334 }333 }
@@ -544,7 +543,7 @@ int32_t ParseDecRefPicMarking (PWelsDecoderContext pCtx, PBitStringAux pBs, PSli · 209 unmodified lines
544 bMmco4Exist = true;543 bMmco4Exist = true;
545 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //max_long_term_frame_idx_plus1544 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //max_long_term_frame_idx_plus1
546 int32_t iMaxLongTermFrameIdx = -1 + uiCode;545 int32_t iMaxLongTermFrameIdx = -1 + uiCode;
547 if (iMaxLongTermFrameIdx > int32_t (pSps->uiLog2MaxFrameNum)) {546 if (iMaxLongTermFrameIdx > (int32_t) (pSps->uiLog2MaxFrameNum)) {
548 //ISO/IEC 14496-10:2009(E) 7.4.3.3 Decoded reference picture marking semantics page 96547 //ISO/IEC 14496-10:2009(E) 7.4.3.3 Decoded reference picture marking semantics page 96
549 return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_REF_MARKING);548 return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_REF_MARKING);
550 }549 }
@@ -609,26 +608,26 @@ int32_t InitBsBuffer (PWelsDecoderContext pCtx) { · 58 unmodified lines
609 CMemoryAlign* pMa = pCtx->pMemAlign;608 CMemoryAlign* pMa = pCtx->pMemAlign;
610 609
611 pCtx->iMaxBsBufferSizeInByte = MIN_ACCESS_UNIT_CAPACITY * MAX_BUFFERED_NUM;610 pCtx->iMaxBsBufferSizeInByte = MIN_ACCESS_UNIT_CAPACITY * MAX_BUFFERED_NUM;
612 if ((pCtx->sRawData.pHead = static_cast<uint8_t*> (pMa->WelsMallocz (pCtx->iMaxBsBufferSizeInByte,611 if ((pCtx->sRawData.pHead = (uint8_t*) (pMa->WelsMallocz (pCtx->iMaxBsBufferSizeInByte,
613 "pCtx->sRawData.pHead"))) == NULL) {612 "pCtx->sRawData.pHead"))) == NULL) {
614 return ERR_INFO_OUT_OF_MEMORY;613 return ERR_INFO_OUT_OF_MEMORY;
615 }614 }
616 pCtx->sRawData.pStartPos = pCtx->sRawData.pCurPos = pCtx->sRawData.pHead;615 pCtx->sRawData.pStartPos = pCtx->sRawData.pCurPos = pCtx->sRawData.pHead;
617 pCtx->sRawData.pEnd = pCtx->sRawData.pHead + pCtx->iMaxBsBufferSizeInByte;616 pCtx->sRawData.pEnd = pCtx->sRawData.pHead + pCtx->iMaxBsBufferSizeInByte;
618 if (pCtx->pParam->bParseOnly) {617 if (pCtx->pParam->bParseOnly) {
619 pCtx->pParserBsInfo = static_cast<SParserBsInfo*> (pMa->WelsMallocz (sizeof (SParserBsInfo), "pCtx->pParserBsInfo"));618 pCtx->pParserBsInfo = (SParserBsInfo*) (pMa->WelsMallocz (sizeof (SParserBsInfo), "pCtx->pParserBsInfo"));
620 if (pCtx->pParserBsInfo == NULL) {619 if (pCtx->pParserBsInfo == NULL) {
621 return ERR_INFO_OUT_OF_MEMORY;620 return ERR_INFO_OUT_OF_MEMORY;
622 }621 }
623 memset (pCtx->pParserBsInfo, 0, sizeof (SParserBsInfo));622 memset (pCtx->pParserBsInfo, 0, sizeof (SParserBsInfo));
624 pCtx->pParserBsInfo->pDstBuff = static_cast<uint8_t*> (pMa->WelsMallocz (MAX_ACCESS_UNIT_CAPACITY * sizeof (uint8_t),623 pCtx->pParserBsInfo->pDstBuff = (uint8_t*) (pMa->WelsMallocz (MAX_ACCESS_UNIT_CAPACITY * sizeof (uint8_t),
625 "pCtx->pParserBsInfo->pDstBuff"));624 "pCtx->pParserBsInfo->pDstBuff"));
626 if (pCtx->pParserBsInfo->pDstBuff == NULL) {625 if (pCtx->pParserBsInfo->pDstBuff == NULL) {
627 return ERR_INFO_OUT_OF_MEMORY;626 return ERR_INFO_OUT_OF_MEMORY;
628 }627 }
629 memset (pCtx->pParserBsInfo->pDstBuff, 0, MAX_ACCESS_UNIT_CAPACITY * sizeof (uint8_t));628 memset (pCtx->pParserBsInfo->pDstBuff, 0, MAX_ACCESS_UNIT_CAPACITY * sizeof (uint8_t));
630 629
631 if ((pCtx->sSavedData.pHead = static_cast<uint8_t*> (pMa->WelsMallocz (pCtx->iMaxBsBufferSizeInByte,630 if ((pCtx->sSavedData.pHead = (uint8_t*) (pMa->WelsMallocz (pCtx->iMaxBsBufferSizeInByte,
632 "pCtx->sSavedData.pHead"))) == NULL) {631 "pCtx->sSavedData.pHead"))) == NULL) {
633 return ERR_INFO_OUT_OF_MEMORY;632 return ERR_INFO_OUT_OF_MEMORY;
634 }633 }
@@ -636,7 +635,7 @@ int32_t InitBsBuffer (PWelsDecoderContext pCtx) { · 1 unmodified line
636 pCtx->sSavedData.pEnd = pCtx->sSavedData.pHead + pCtx->iMaxBsBufferSizeInByte;635 pCtx->sSavedData.pEnd = pCtx->sSavedData.pHead + pCtx->iMaxBsBufferSizeInByte;
637 636
638 pCtx->iMaxNalNum = MAX_NAL_UNITS_IN_LAYER + 2; //2 reserved for SPS+PPS637 pCtx->iMaxNalNum = MAX_NAL_UNITS_IN_LAYER + 2; //2 reserved for SPS+PPS
639 pCtx->pParserBsInfo->pNalLenInByte = static_cast<int*> (pMa->WelsMallocz (pCtx->iMaxNalNum * sizeof (int),638 pCtx->pParserBsInfo->pNalLenInByte = (int*) (pMa->WelsMallocz (pCtx->iMaxNalNum * sizeof (int),
640 "pCtx->pParserBsInfo->pNalLenInByte"));639 "pCtx->pParserBsInfo->pNalLenInByte"));
641 if (pCtx->pParserBsInfo->pNalLenInByte == NULL) {640 if (pCtx->pParserBsInfo->pNalLenInByte == NULL) {
642 return ERR_INFO_OUT_OF_MEMORY;641 return ERR_INFO_OUT_OF_MEMORY;
@@ -654,7 +653,7 @@ int32_t ExpandBsBuffer (PWelsDecoderContext pCtx, const int kiSrcLen) { · 11 unmodified lines
654 CMemoryAlign* pMa = pCtx->pMemAlign;653 CMemoryAlign* pMa = pCtx->pMemAlign;
655 654
656 //Realloc sRawData655 //Realloc sRawData
657 uint8_t* pNewBsBuff = static_cast<uint8_t*> (pMa->WelsMallocz (iNewBuffLen, "pCtx->sRawData.pHead"));656 uint8_t* pNewBsBuff = (uint8_t*) (pMa->WelsMallocz (iNewBuffLen, "pCtx->sRawData.pHead"));
658 if (pNewBsBuff == NULL) {657 if (pNewBsBuff == NULL) {
659 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "ExpandBsBuffer() Failed for malloc pNewBsBuff (%d)", iNewBuffLen);658 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "ExpandBsBuffer() Failed for malloc pNewBsBuff (%d)", iNewBuffLen);
660 pCtx->iErrorCode |= dsOutOfMemory;659 pCtx->iErrorCode |= dsOutOfMemory;
@@ -679,7 +678,7 @@ int32_t ExpandBsBuffer (PWelsDecoderContext pCtx, const int kiSrcLen) { · 18 unmodified lines
679 678
680 if (pCtx->pParam->bParseOnly) {679 if (pCtx->pParam->bParseOnly) {
681 //Realloc sSavedData680 //Realloc sSavedData
682 uint8_t* pNewSavedBsBuff = static_cast<uint8_t*> (pMa->WelsMallocz (iNewBuffLen, "pCtx->sSavedData.pHead"));681 uint8_t* pNewSavedBsBuff = (uint8_t*) (pMa->WelsMallocz (iNewBuffLen, "pCtx->sSavedData.pHead"));
683 if (pNewSavedBsBuff == NULL) {682 if (pNewSavedBsBuff == NULL) {
684 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "ExpandBsBuffer() Failed for malloc pNewSavedBsBuff (%d)", iNewBuffLen);683 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "ExpandBsBuffer() Failed for malloc pNewSavedBsBuff (%d)", iNewBuffLen);
685 pCtx->iErrorCode |= dsOutOfMemory;684 pCtx->iErrorCode |= dsOutOfMemory;
@@ -704,7 +703,7 @@ int32_t ExpandBsLenBuffer (PWelsDecoderContext pCtx, const int kiCurrLen) { · 18 unmodified lines
704 if (!pParser->pNalLenInByte)703 if (!pParser->pNalLenInByte)
705 return ERR_INFO_INVALID_ACCESS;704 return ERR_INFO_INVALID_ACCESS;
706 705
707 int iNewLen = kiCurrLen;706 int iNewLen;
708 if (kiCurrLen >= MAX_MB_SIZE + 2) { //exceeds the max MB number of level 5.2707 if (kiCurrLen >= MAX_MB_SIZE + 2) { //exceeds the max MB number of level 5.2
709 WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "Current nal num (%d) exceededs %d.", kiCurrLen, MAX_MB_SIZE);708 WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "Current nal num (%d) exceededs %d.", kiCurrLen, MAX_MB_SIZE);
710 pCtx->iErrorCode |= dsOutOfMemory;709 pCtx->iErrorCode |= dsOutOfMemory;
@@ -715,7 +714,7 @@ int32_t ExpandBsLenBuffer (PWelsDecoderContext pCtx, const int kiCurrLen) { · 4 unmodified lines
715 }714 }
716 715
717 CMemoryAlign* pMa = pCtx->pMemAlign;716 CMemoryAlign* pMa = pCtx->pMemAlign;
718 int* pNewLenBuffer = static_cast<int*> (pMa->WelsMallocz (iNewLen * sizeof (int),717 int* pNewLenBuffer = (int*) (pMa->WelsMallocz (iNewLen * sizeof (int),
719 "pCtx->pParserBsInfo->pNalLenInByte"));718 "pCtx->pParserBsInfo->pNalLenInByte"));
720 if (pNewLenBuffer == NULL) {719 if (pNewLenBuffer == NULL) {
721 pCtx->iErrorCode |= dsOutOfMemory;720 pCtx->iErrorCode |= dsOutOfMemory;
@@ -854,7 +853,7 @@ void UpdateDecoderStatisticsForActiveParaset (SDecoderStatistics* pDecoderStatis · 132 unmodified lines
854 pDecoderStatistics->iCurrentActiveSpsId = pSps->iSpsId;853 pDecoderStatistics->iCurrentActiveSpsId = pSps->iSpsId;
855 854
856 pDecoderStatistics->iCurrentActivePpsId = pPps->iPpsId;855 pDecoderStatistics->iCurrentActivePpsId = pPps->iPpsId;
857 pDecoderStatistics->uiProfile = static_cast<unsigned int> (pSps->uiProfileIdc);856 pDecoderStatistics->uiProfile = (unsigned int) (pSps->uiProfileIdc);
858 pDecoderStatistics->uiLevel = pSps->uiLevelIdc;857 pDecoderStatistics->uiLevel = pSps->uiLevelIdc;
859}858}
860 859
@@ -876,19 +875,19 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 15 unmodified lines
876 pCtx->pAccessUnitList->pNalUnitsList[pCtx->pAccessUnitList->uiAvailUnitsNum -875 pCtx->pAccessUnitList->pNalUnitsList[pCtx->pAccessUnitList->uiAvailUnitsNum -
877 1];876 1];
878 877
879 PNalUnitHeaderExt pNalHeaderExt = NULL;878 PNalUnitHeaderExt pNalHeaderExt;
880 PSliceHeader pSliceHead = NULL;879 PSliceHeader pSliceHead;
881 PSliceHeaderExt pSliceHeadExt = NULL;880 PSliceHeaderExt pSliceHeadExt;
882 PSubsetSps pSubsetSps = NULL;881 PSubsetSps pSubsetSps = NULL;
883 PSps pSps = NULL;882 PSps pSps;
884 PPps pPps = NULL;883 PPps pPps;
885 EWelsNalUnitType eNalType = static_cast<EWelsNalUnitType> (0);884 EWelsNalUnitType eNalType;
886 int32_t iPpsId = 0;885 int32_t iPpsId;
887 int32_t iRet = ERR_NONE;886 int32_t iRet;
888 uint8_t uiSliceType = 0;887 uint8_t uiSliceType;
889 uint8_t uiQualityId = BASE_QUALITY_ID;888 uint8_t uiQualityId = BASE_QUALITY_ID;
890 bool bIdrFlag = false;889 bool bIdrFlag;
891 bool bSgChangeCycleInvolved = false; // involved slice group change cycle ?890 bool bSgChangeCycleInvolved; // involved slice group change cycle ?
892 uint32_t uiCode;891 uint32_t uiCode;
893 int32_t iCode;892 int32_t iCode;
894 SLogContext* pLogCtx = & (pCtx->sLogCtx);893 SLogContext* pLogCtx = & (pCtx->sLogCtx);
@@ -942,7 +941,7 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 47 unmodified lines
942 }941 }
943 }942 }
944 943
945 pSliceHead->eSliceType = static_cast <EWelsSliceType> (uiSliceType);944 pSliceHead->eSliceType = (EWelsSliceType) (uiSliceType);
946 945
947 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_parameter_set_id946 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //pic_parameter_set_id
948 WELS_CHECK_SE_UPPER_ERROR (uiCode, (MAX_PPS_COUNT - 1), "iPpsId out of range",947 WELS_CHECK_SE_UPPER_ERROR (uiCode, (MAX_PPS_COUNT - 1), "iPpsId out of range",
@@ -1253,7 +1252,7 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 304 unmodified lines
1253 bSgChangeCycleInvolved = (bSgChangeCycleInvolved && (uiQualityId == BASE_QUALITY_ID));1252 bSgChangeCycleInvolved = (bSgChangeCycleInvolved && (uiQualityId == BASE_QUALITY_ID));
1254 if (bSgChangeCycleInvolved) {1253 if (bSgChangeCycleInvolved) {
1255 if (pPps->uiSliceGroupChangeRate > 0) {1254 if (pPps->uiSliceGroupChangeRate > 0) {
1256 const int32_t kiNumBits = (int32_t)WELS_CEIL (log (static_cast<double> (1 + pPps->uiPicSizeInMapUnits /1255 const int32_t kiNumBits = (int32_t)WELS_CEIL (log ((double) (1 + pPps->uiPicSizeInMapUnits /
1257 pPps->uiSliceGroupChangeRate)));1256 pPps->uiSliceGroupChangeRate)));
1258 WELS_READ_VERIFY (BsGetBits (pBs, kiNumBits, &uiCode)); //lice_group_change_cycle1257 WELS_READ_VERIFY (BsGetBits (pBs, kiNumBits, &uiCode)); //lice_group_change_cycle
1259 pSliceHead->iSliceGroupChangeCycle = uiCode;1258 pSliceHead->iSliceGroupChangeCycle = uiCode;
@@ -1392,11 +1391,11 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 132 unmodified lines
1392 * ppDst: succeeded VCL NAL based AVC (I/P Slice)1391 * ppDst: succeeded VCL NAL based AVC (I/P Slice)
1393 */1392 */
1394bool PrefetchNalHeaderExtSyntax (PWelsDecoderContext pCtx, PNalUnit const kppDst, PNalUnit const kpSrc) {1393bool PrefetchNalHeaderExtSyntax (PWelsDecoderContext pCtx, PNalUnit const kppDst, PNalUnit const kpSrc) {
1395 PNalUnitHeaderExt pNalHdrExtD = NULL, pNalHdrExtS = NULL;1394 PNalUnitHeaderExt pNalHdrExtD, pNalHdrExtS;
1396 PSliceHeaderExt pShExtD = NULL;1395 PSliceHeaderExt pShExtD ;
1397 PPrefixNalUnit pPrefixS = NULL;1396 PPrefixNalUnit pPrefixS;
1398 PSps pSps = NULL;1397 PSps pSps;
1399 int32_t iIdx = 0;1398 int32_t iIdx;
1400 1399
1401 if (kppDst == NULL || kpSrc == NULL)1400 if (kppDst == NULL || kpSrc == NULL)
1402 return false;1401 return false;
@@ -1792,7 +1791,6 @@ void UninitialDqLayersContext (PWelsDecoderContext pCtx) { · 389 unmodified lines
1792 }1791 }
1793 pMa->WelsFree (pDq, "pDq");1792 pMa->WelsFree (pDq, "pDq");
1794 1793
1795 pDq = NULL;
1796 pCtx->pDqLayersList[i] = NULL;1794 pCtx->pDqLayersList[i] = NULL;
1797 1795
1798 ++ i;1796 ++ i;
@@ -1880,7 +1878,7 @@ void CheckAvailNalUnitsListContinuity (PWelsDecoderContext pCtx, int32_t iStartI · 81 unmodified lines
1880 uint8_t uiLastNuDependencyId, uiLastNuLayerDqId;1878 uint8_t uiLastNuDependencyId, uiLastNuLayerDqId;
1881 uint8_t uiCurNuDependencyId, uiCurNuQualityId, uiCurNuLayerDqId, uiCurNuRefLayerDqId;1879 uint8_t uiCurNuDependencyId, uiCurNuQualityId, uiCurNuLayerDqId, uiCurNuRefLayerDqId;
1882 1880
1883 int32_t iCurNalUnitIdx = 0;1881 int32_t iCurNalUnitIdx;
1884 1882
1885 //check the continuity of pNalUnitsList forwards (from pIdxNoInterLayerPred to end_postion)1883 //check the continuity of pNalUnitsList forwards (from pIdxNoInterLayerPred to end_postion)
1886 uiLastNuDependencyId = pCurAu->pNalUnitsList[iStartIdx]->sNalHeaderExt.uiDependencyId;//starting nal unit1884 uiLastNuDependencyId = pCurAu->pNalUnitsList[iStartIdx]->sNalHeaderExt.uiDependencyId;//starting nal unit
@@ -2020,7 +2018,7 @@ bool CheckIntegrityNalUnitsList (PWelsDecoderContext pCtx) { · 133 unmodified lines
2020 } else { //P_SLICE2018 } else { //P_SLICE
2021 //step 1: search uiDependencyId equal to pCtx->cur_seq_interval_target_dependency_id2019 //step 1: search uiDependencyId equal to pCtx->cur_seq_interval_target_dependency_id
2022 bool bGetDependId = false;2020 bool bGetDependId = false;
2023 int32_t iIdxDependId = 0;2021 int32_t iIdxDependId;
2024 2022
2025 iIdxDependId = kiEndPos;2023 iIdxDependId = kiEndPos;
2026 while (iIdxDependId >= 0) {2024 while (iIdxDependId >= 0) {
@@ -2256,7 +2254,7 @@ void DecodeFinishUpdate (PWelsDecoderContext pCtx) { · 229 unmodified lines
2256* 0 - success; otherwise returned error_no defined in error_no.h2254* 0 - success; otherwise returned error_no defined in error_no.h
2257*/2255*/
2258int32_t WelsDecodeInitAccessUnitStart (PWelsDecoderContext pCtx, SBufferInfo* pDstInfo) {2256int32_t WelsDecodeInitAccessUnitStart (PWelsDecoderContext pCtx, SBufferInfo* pDstInfo) {
2259 int32_t iErr = ERR_NONE;2257 int32_t iErr;
2260 PAccessUnit pCurAu = pCtx->pAccessUnitList;2258 PAccessUnit pCurAu = pCtx->pAccessUnitList;
2261 pCtx->bAuReadyFlag = false;2259 pCtx->bAuReadyFlag = false;
2262 pCtx->pLastDecPicInfo->bLastHasMmco5 = false;2260 pCtx->pLastDecPicInfo->bLastHasMmco5 = false;
@@ -2313,7 +2311,7 @@ int32_t AllocPicBuffOnNewSeqBegin (PWelsDecoderContext pCtx) { · 50 unmodified lines
2313* 0 - success; otherwise returned error_no defined in error_no.h2311* 0 - success; otherwise returned error_no defined in error_no.h
2314*/2312*/
2315int32_t InitConstructAccessUnit (PWelsDecoderContext pCtx, SBufferInfo* pDstInfo) {2313int32_t InitConstructAccessUnit (PWelsDecoderContext pCtx, SBufferInfo* pDstInfo) {
2316 int32_t iErr = ERR_NONE;2314 int32_t iErr;
2317 2315
2318 iErr = WelsDecodeInitAccessUnitStart (pCtx, pDstInfo);2316 iErr = WelsDecodeInitAccessUnitStart (pCtx, pDstInfo);
2319 if (ERR_NONE != iErr) {2317 if (ERR_NONE != iErr) {
@@ -2342,7 +2340,7 @@ int32_t InitConstructAccessUnit (PWelsDecoderContext pCtx, SBufferInfo* pDstInfo · 22 unmodified lines
2342 * 0 - success; otherwise returned error_no defined in error_no.h2340 * 0 - success; otherwise returned error_no defined in error_no.h
2343 */2341 */
2344int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstInfo) {2342int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstInfo) {
2345 int32_t iErr = ERR_NONE;2343 int32_t iErr;
2346 if (GetThreadCount (pCtx) <= 1) {2344 if (GetThreadCount (pCtx) <= 1) {
2347 iErr = InitConstructAccessUnit (pCtx, pDstInfo);2345 iErr = InitConstructAccessUnit (pCtx, pDstInfo);
2348 if (ERR_NONE != iErr) {2346 if (ERR_NONE != iErr) {
@@ -2425,7 +2423,8 @@ void WelsDqLayerDecodeStart (PWelsDecoderContext pCtx, PNalUnit pCurNal, PSps pS · 76 unmodified lines
2425}2423}
2426 2424
2427int32_t InitRefPicList (PWelsDecoderContext pCtx, const uint8_t kuiNRi, int32_t iPoc) {2425int32_t InitRefPicList (PWelsDecoderContext pCtx, const uint8_t kuiNRi, int32_t iPoc) {
2428 int32_t iRet = ERR_NONE;2426 USED(kuiNRi);
2427 int32_t iRet;
2429 if (pCtx->eSliceType == B_SLICE) {2428 if (pCtx->eSliceType == B_SLICE) {
2430 iRet = WelsInitBSliceRefList (pCtx, iPoc);2429 iRet = WelsInitBSliceRefList (pCtx, iPoc);
2431 CreateImplicitWeightTable (pCtx);2430 CreateImplicitWeightTable (pCtx);
@@ -2480,8 +2479,9 @@ void InitCurDqLayerData (PWelsDecoderContext pCtx, PDqLayer pCurDq) { · 48 unmodified lines
2480 * Decode current access unit when current AU is completed.2479 * Decode current access unit when current AU is completed.
2481 */2480 */
2482int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstInfo) {2481int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstInfo) {
2483 PNalUnit pNalCur = pCtx->pNalCur = NULL;2482 PNalUnit pNalCur;
2484 PAccessUnit pCurAu = pCtx->pAccessUnitList;2483 PAccessUnit pCurAu = pCtx->pAccessUnitList;
2484 pCtx->pNalCur = NULL;
2485 2485
2486 int32_t iIdx = pCurAu->uiStartPos;2486 int32_t iIdx = pCurAu->uiStartPos;
2487 int32_t iEndIdx = pCurAu->uiEndPos;2487 int32_t iEndIdx = pCurAu->uiEndPos;
@@ -2501,18 +2501,16 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 13 unmodified lines
2501 }2501 }
2502 }2502 }
2503 int32_t iThreadCount = GetThreadCount (pCtx);2503 int32_t iThreadCount = GetThreadCount (pCtx);
2504 int32_t iPpsId = 0;2504 int32_t iPpsId;
2505 int32_t iRet = ERR_NONE;2505 int32_t iRet;
2506
2507 bool bAllRefComplete = true; // Assume default all ref picutres are complete2506 bool bAllRefComplete = true; // Assume default all ref picutres are complete
2508 2507
2509 const uint8_t kuiTargetLayerDqId = GetTargetDqId (pCtx->uiTargetDqId, pCtx->pParam);2508 const uint8_t kuiTargetLayerDqId = GetTargetDqId (pCtx->uiTargetDqId, pCtx->pParam);
2510 const uint8_t kuiDependencyIdMax = (kuiTargetLayerDqId & 0x7F) >> 4;2509 const uint8_t kuiDependencyIdMax = (kuiTargetLayerDqId & 0x7F) >> 4;
2511 int16_t iLastIdD = -1, iLastIdQ = -1;2510 int16_t iLastIdD = -1, iLastIdQ = -1;
2512 int16_t iCurrIdD = 0, iCurrIdQ = 0;2511 int16_t iCurrIdD, iCurrIdQ;
2513 pCtx->uiNalRefIdc = 0;2512 pCtx->uiNalRefIdc = 0;
2514 bool bFreshSliceAvailable =2513 bool bFreshSliceAvailable; // Another fresh slice comingup for given dq layer, for multiple slices in case of header parts of slices sometimes loss over error-prone channels, 8/14/2008
2515 true; // Another fresh slice comingup for given dq layer, for multiple slices in case of header parts of slices sometimes loss over error-prone channels, 8/14/2008
2516 2514
2517 //update pCurDqLayer at the starting of AU decoding2515 //update pCurDqLayer at the starting of AU decoding
2518 if (pCtx->bInitialDqLayersMem || pCtx->pCurDqLayer == NULL) {2516 if (pCtx->bInitialDqLayersMem || pCtx->pCurDqLayer == NULL) {
@@ -2525,7 +2523,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 6 unmodified lines
2525 while (iIdx <= iEndIdx) {2523 while (iIdx <= iEndIdx) {
2526 PDqLayer dq_cur = pCtx->pCurDqLayer;2524 PDqLayer dq_cur = pCtx->pCurDqLayer;
2527 SLayerInfo pLayerInfo;2525 SLayerInfo pLayerInfo;
2528 PSliceHeaderExt pShExt = NULL;2526 PSliceHeaderExt pShExt;
2529 PSliceHeader pSh = NULL;2527 PSliceHeader pSh = NULL;
2530 bool isNewFrame = true;2528 bool isNewFrame = true;
2531 if (iThreadCount > 1) {2529 if (iThreadCount > 1) {
@@ -2723,6 +2721,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 191 unmodified lines
2723 SET_EVENT (&pThreadCtx->sSliceDecodeStart);2721 SET_EVENT (&pThreadCtx->sSliceDecodeStart);
2724 }2722 }
2725 iRet = WelsDecodeAndConstructSlice (pCtx);2723 iRet = WelsDecodeAndConstructSlice (pCtx);
2724fprint(2, "WelsDecodeAndConstructSlice %d\n", iRet);
2726 } else {2725 } else {
2727 iRet = WelsDecodeSlice (pCtx, bFreshSliceAvailable, pNalCur);2726 iRet = WelsDecodeSlice (pCtx, bFreshSliceAvailable, pNalCur);
2728 }2727 }
@@ -2834,7 +2833,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 105 unmodified lines
2834 ++i;2833 ++i;
2835 }2834 }
2836 }2835 }
2837 iRet = WelsMarkAsRef (pCtx);2836 iRet = WelsMarkAsRef (pCtx, NULL);
2838 if (iRet != ERR_NONE) {2837 if (iRet != ERR_NONE) {
2839 if (iRet == ERR_INFO_DUPLICATE_FRAME_NUM)2838 if (iRet == ERR_INFO_DUPLICATE_FRAME_NUM)
2840 pCtx->iErrorCode |= dsBitstreamError;2839 pCtx->iErrorCode |= dsBitstreamError;
@@ -2997,4 +2996,3 @@ bool CheckRefPicturesComplete (PWelsDecoderContext pCtx) { · 156 unmodified lines
2997 2996
2998 return bAllRefComplete;2997 return bAllRefComplete;
2999}2998}
3000} // 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