History

re-structure SWelsDecoderContext and others and prepare for the support of multi-threading support.

xiaotiansf committed 7 years ago

Commit 2f5ecec1 parent 9ed97c729 files · +2285 −1568Browse files

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

Unified · Split

codec/decoder/core/src/decoder_core.cpp+121−114
@@ -77,11 +77,11 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 76 unmodified lines
77 77
78 78
79 if (pCtx->pParam->eEcActiveIdc == ERROR_CON_DISABLE) {79 if (pCtx->pParam->eEcActiveIdc == ERROR_CON_DISABLE) {
80 if ((pCtx->sDecoderStatistics.uiWidth != (unsigned int) kiActualWidth)80 if ((pCtx->pDecoderStatistics->uiWidth != (unsigned int) kiActualWidth)
81 || (pCtx->sDecoderStatistics.uiHeight != (unsigned int) kiActualHeight)) {81 || (pCtx->pDecoderStatistics->uiHeight != (unsigned int) kiActualHeight)) {
82 pCtx->sDecoderStatistics.uiResolutionChangeTimes++;82 pCtx->pDecoderStatistics->uiResolutionChangeTimes++;
83 pCtx->sDecoderStatistics.uiWidth = kiActualWidth;83 pCtx->pDecoderStatistics->uiWidth = kiActualWidth;
84 pCtx->sDecoderStatistics.uiHeight = kiActualHeight;84 pCtx->pDecoderStatistics->uiHeight = kiActualHeight;
85 }85 }
86 UpdateDecStatNoFreezingInfo (pCtx);86 UpdateDecStatNoFreezingInfo (pCtx);
87 }87 }
@@ -250,11 +250,11 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t · 162 unmodified lines
250 pCtx->iMbNum = pPic->iMbNum;250 pCtx->iMbNum = pPic->iMbNum;
251 pCtx->iMbEcedPropNum = pPic->iMbEcedPropNum;251 pCtx->iMbEcedPropNum = pPic->iMbEcedPropNum;
252 if (pCtx->pParam->eEcActiveIdc != ERROR_CON_DISABLE) {252 if (pCtx->pParam->eEcActiveIdc != ERROR_CON_DISABLE) {
253 if (pDstInfo->iBufferStatus && ((pCtx->sDecoderStatistics.uiWidth != (unsigned int) kiActualWidth)253 if (pDstInfo->iBufferStatus && ((pCtx->pDecoderStatistics->uiWidth != (unsigned int) kiActualWidth)
254 || (pCtx->sDecoderStatistics.uiHeight != (unsigned int) kiActualHeight))) {254 || (pCtx->pDecoderStatistics->uiHeight != (unsigned int) kiActualHeight))) {
255 pCtx->sDecoderStatistics.uiResolutionChangeTimes++;255 pCtx->pDecoderStatistics->uiResolutionChangeTimes++;
256 pCtx->sDecoderStatistics.uiWidth = kiActualWidth;256 pCtx->pDecoderStatistics->uiWidth = kiActualWidth;
257 pCtx->sDecoderStatistics.uiHeight = kiActualHeight;257 pCtx->pDecoderStatistics->uiHeight = kiActualHeight;
258 }258 }
259 UpdateDecStat (pCtx, pDstInfo->iBufferStatus != 0);259 UpdateDecStat (pCtx, pDstInfo->iBufferStatus != 0);
260 }260 }
@@ -527,8 +527,8 @@ int32_t ParseDecRefPicMarking (PWelsDecoderContext pCtx, PBitStringAux pBs, PSli · 266 unmodified lines
527 WELS_VERIFY_RETURN_IF (-1, (!bAllowMmco5 || bMmco5Exist));527 WELS_VERIFY_RETURN_IF (-1, (!bAllowMmco5 || bMmco5Exist));
528 bMmco5Exist = true;528 bMmco5Exist = true;
529 529
530 pCtx->iPrevPicOrderCntLsb = 0;530 pCtx->pLastDecPicInfo->iPrevPicOrderCntLsb = 0;
531 pCtx->iPrevPicOrderCntMsb = 0;531 pCtx->pLastDecPicInfo->iPrevPicOrderCntMsb = 0;
532 pSh->iPicOrderCntLsb = 0;532 pSh->iPicOrderCntLsb = 0;
533 if (pCtx->pSliceHeader)533 if (pCtx->pSliceHeader)
534 pCtx->pSliceHeader->iPicOrderCntLsb = 0;534 pCtx->pSliceHeader->iPicOrderCntLsb = 0;
@@ -924,22 +924,22 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 389 unmodified lines
924 iPpsId = uiCode;924 iPpsId = uiCode;
925 925
926 //add check PPS available here926 //add check PPS available here
927 if (pCtx->bPpsAvailFlags[iPpsId] == false) {927 if (pCtx->sSpsPpsCtx.bPpsAvailFlags[iPpsId] == false) {
928 pCtx->sDecoderStatistics.iPpsReportErrorNum++;928 pCtx->pDecoderStatistics->iPpsReportErrorNum++;
929 if (pCtx->iPPSLastInvalidId != iPpsId) {929 if (pCtx->sSpsPpsCtx.iPPSLastInvalidId != iPpsId) {
930 WelsLog (pLogCtx, WELS_LOG_ERROR, "PPS id (%d) is invalid, previous id (%d) error ignored (%d)!", iPpsId,930 WelsLog (pLogCtx, WELS_LOG_ERROR, "PPS id (%d) is invalid, previous id (%d) error ignored (%d)!", iPpsId,
931 pCtx->iPPSLastInvalidId, pCtx->iPPSInvalidNum);931 pCtx->sSpsPpsCtx.iPPSLastInvalidId, pCtx->sSpsPpsCtx.iPPSInvalidNum);
932 pCtx->iPPSLastInvalidId = iPpsId;932 pCtx->sSpsPpsCtx.iPPSLastInvalidId = iPpsId;
933 pCtx->iPPSInvalidNum = 0;933 pCtx->sSpsPpsCtx.iPPSInvalidNum = 0;
934 } else {934 } else {
935 pCtx->iPPSInvalidNum++;935 pCtx->sSpsPpsCtx.iPPSInvalidNum++;
936 }936 }
937 pCtx->iErrorCode |= dsNoParamSets;937 pCtx->iErrorCode |= dsNoParamSets;
938 return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_PPS_ID);938 return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_PPS_ID);
939 }939 }
940 pCtx->iPPSLastInvalidId = -1;940 pCtx->sSpsPpsCtx.iPPSLastInvalidId = -1;
941 941
942 pPps = &pCtx->sPpsBuffer[iPpsId];942 pPps = &pCtx->sSpsPpsCtx.sPpsBuffer[iPpsId];
943 943
944 if (pPps->uiNumSliceGroups == 0) {944 if (pPps->uiNumSliceGroups == 0) {
945 WelsLog (pLogCtx, WELS_LOG_WARNING, "Invalid PPS referenced");945 WelsLog (pLogCtx, WELS_LOG_WARNING, "Invalid PPS referenced");
@@ -948,38 +948,38 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 2 unmodified lines
948 }948 }
949 949
950 if (kbExtensionFlag) {950 if (kbExtensionFlag) {
951 pSubsetSps = &pCtx->sSubsetSpsBuffer[pPps->iSpsId];951 pSubsetSps = &pCtx->sSpsPpsCtx.sSubsetSpsBuffer[pPps->iSpsId];
952 pSps = &pSubsetSps->sSps;952 pSps = &pSubsetSps->sSps;
953 if (pCtx->bSubspsAvailFlags[pPps->iSpsId] == false) {953 if (pCtx->sSpsPpsCtx.bSubspsAvailFlags[pPps->iSpsId] == false) {
954 pCtx->sDecoderStatistics.iSubSpsReportErrorNum++;954 pCtx->pDecoderStatistics->iSubSpsReportErrorNum++;
955 if (pCtx->iSubSPSLastInvalidId != pPps->iSpsId) {955 if (pCtx->sSpsPpsCtx.iSubSPSLastInvalidId != pPps->iSpsId) {
956 WelsLog (pLogCtx, WELS_LOG_ERROR, "Sub SPS id (%d) is invalid, previous id (%d) error ignored (%d)!", pPps->iSpsId,956 WelsLog (pLogCtx, WELS_LOG_ERROR, "Sub SPS id (%d) is invalid, previous id (%d) error ignored (%d)!", pPps->iSpsId,
957 pCtx->iSubSPSLastInvalidId, pCtx->iSubSPSInvalidNum);957 pCtx->sSpsPpsCtx.iSubSPSLastInvalidId, pCtx->sSpsPpsCtx.iSubSPSInvalidNum);
958 pCtx->iSubSPSLastInvalidId = pPps->iSpsId;958 pCtx->sSpsPpsCtx.iSubSPSLastInvalidId = pPps->iSpsId;
959 pCtx->iSubSPSInvalidNum = 0;959 pCtx->sSpsPpsCtx.iSubSPSInvalidNum = 0;
960 } else {960 } else {
961 pCtx->iSubSPSInvalidNum++;961 pCtx->sSpsPpsCtx.iSubSPSInvalidNum++;
962 }962 }
963 pCtx->iErrorCode |= dsNoParamSets;963 pCtx->iErrorCode |= dsNoParamSets;
964 return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_SPS_ID);964 return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_SPS_ID);
965 }965 }
966 pCtx->iSubSPSLastInvalidId = -1;966 pCtx->sSpsPpsCtx.iSubSPSLastInvalidId = -1;
967 } else {967 } else {
968 if (pCtx->bSpsAvailFlags[pPps->iSpsId] == false) {968 if (pCtx->sSpsPpsCtx.bSpsAvailFlags[pPps->iSpsId] == false) {
969 pCtx->sDecoderStatistics.iSpsReportErrorNum++;969 pCtx->pDecoderStatistics->iSpsReportErrorNum++;
970 if (pCtx->iSPSLastInvalidId != pPps->iSpsId) {970 if (pCtx->sSpsPpsCtx.iSPSLastInvalidId != pPps->iSpsId) {
971 WelsLog (pLogCtx, WELS_LOG_ERROR, "SPS id (%d) is invalid, previous id (%d) error ignored (%d)!", pPps->iSpsId,971 WelsLog (pLogCtx, WELS_LOG_ERROR, "SPS id (%d) is invalid, previous id (%d) error ignored (%d)!", pPps->iSpsId,
972 pCtx->iSPSLastInvalidId, pCtx->iSPSInvalidNum);972 pCtx->sSpsPpsCtx.iSPSLastInvalidId, pCtx->sSpsPpsCtx.iSPSInvalidNum);
973 pCtx->iSPSLastInvalidId = pPps->iSpsId;973 pCtx->sSpsPpsCtx.iSPSLastInvalidId = pPps->iSpsId;
974 pCtx->iSPSInvalidNum = 0;974 pCtx->sSpsPpsCtx.iSPSInvalidNum = 0;
975 } else {975 } else {
976 pCtx->iSPSInvalidNum++;976 pCtx->sSpsPpsCtx.iSPSInvalidNum++;
977 }977 }
978 pCtx->iErrorCode |= dsNoParamSets;978 pCtx->iErrorCode |= dsNoParamSets;
979 return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_SPS_ID);979 return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_SPS_ID);
980 }980 }
981 pCtx->iSPSLastInvalidId = -1;981 pCtx->sSpsPpsCtx.iSPSLastInvalidId = -1;
982 pSps = &pCtx->sSpsBuffer[pPps->iSpsId];982 pSps = &pCtx->sSpsPpsCtx.sSpsBuffer[pPps->iSpsId];
983 }983 }
984 pSliceHead->iPpsId = iPpsId;984 pSliceHead->iPpsId = iPpsId;
985 pSliceHead->iSpsId = pPps->iSpsId;985 pSliceHead->iSpsId = pPps->iSpsId;
@@ -1049,16 +1049,18 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 63 unmodified lines
1049 //Calculate poc if necessary1049 //Calculate poc if necessary
1050 int32_t pocLsb = pSliceHead->iPicOrderCntLsb;1050 int32_t pocLsb = pSliceHead->iPicOrderCntLsb;
1051 if (pSliceHead->bIdrFlag || kpCurNal->sNalHeaderExt.sNalUnitHeader.eNalUnitType == NAL_UNIT_CODED_SLICE_IDR) {1051 if (pSliceHead->bIdrFlag || kpCurNal->sNalHeaderExt.sNalUnitHeader.eNalUnitType == NAL_UNIT_CODED_SLICE_IDR) {
1052 pCtx->iPrevPicOrderCntMsb = 0;1052 pCtx->pLastDecPicInfo->iPrevPicOrderCntMsb = 0;
1053 pCtx->iPrevPicOrderCntLsb = 0;1053 pCtx->pLastDecPicInfo->iPrevPicOrderCntLsb = 0;
1054 }1054 }
1055 int32_t pocMsb;1055 int32_t pocMsb;
1056 if (pocLsb < pCtx->iPrevPicOrderCntLsb && pCtx->iPrevPicOrderCntLsb - pocLsb >= iMaxPocLsb / 2)1056 if (pocLsb < pCtx->pLastDecPicInfo->iPrevPicOrderCntLsb
1057 pocMsb = pCtx->iPrevPicOrderCntMsb + iMaxPocLsb;1057 && pCtx->pLastDecPicInfo->iPrevPicOrderCntLsb - pocLsb >= iMaxPocLsb / 2)
1058 else if (pocLsb > pCtx->iPrevPicOrderCntLsb && pocLsb - pCtx->iPrevPicOrderCntLsb > iMaxPocLsb / 2)1058 pocMsb = pCtx->pLastDecPicInfo->iPrevPicOrderCntMsb + iMaxPocLsb;
1059 pocMsb = pCtx->iPrevPicOrderCntMsb - iMaxPocLsb;1059 else if (pocLsb > pCtx->pLastDecPicInfo->iPrevPicOrderCntLsb
1060 && pocLsb - pCtx->pLastDecPicInfo->iPrevPicOrderCntLsb > iMaxPocLsb / 2)
1061 pocMsb = pCtx->pLastDecPicInfo->iPrevPicOrderCntMsb - iMaxPocLsb;
1060 else1062 else
1061 pocMsb = pCtx->iPrevPicOrderCntMsb;1063 pocMsb = pCtx->pLastDecPicInfo->iPrevPicOrderCntMsb;
1062 pSliceHead->iPicOrderCntLsb = pocMsb + pocLsb;1064 pSliceHead->iPicOrderCntLsb = pocMsb + pocLsb;
1063 1065
1064 if (pPps->bPicOrderPresentFlag && !pSliceHead->bFieldPicFlag) {1066 if (pPps->bPicOrderPresentFlag && !pSliceHead->bFieldPicFlag) {
@@ -1066,8 +1068,8 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 1 unmodified line
1066 }1068 }
1067 1069
1068 if (kpCurNal->sNalHeaderExt.sNalUnitHeader.uiNalRefIdc != 0) {1070 if (kpCurNal->sNalHeaderExt.sNalUnitHeader.uiNalRefIdc != 0) {
1069 pCtx->iPrevPicOrderCntLsb = pocLsb;1071 pCtx->pLastDecPicInfo->iPrevPicOrderCntLsb = pocLsb;
1070 pCtx->iPrevPicOrderCntMsb = pocMsb;1072 pCtx->pLastDecPicInfo->iPrevPicOrderCntMsb = pocMsb;
1071 }1073 }
1072 //End of Calculating poc1074 //End of Calculating poc
1073 } else if (pSps->uiPocType == 1 && !pSps->bDeltaPicOrderAlwaysZeroFlag) {1075 } else if (pSps->uiPocType == 1 && !pSps->bDeltaPicOrderAlwaysZeroFlag) {
@@ -1376,7 +1378,7 @@ bool PrefetchNalHeaderExtSyntax (PWelsDecoderContext pCtx, PNalUnit const kppDst · 302 unmodified lines
1376 pNalHdrExtS = &kpSrc->sNalHeaderExt;1378 pNalHdrExtS = &kpSrc->sNalHeaderExt;
1377 pShExtD = &kppDst->sNalData.sVclNal.sSliceHeaderExt;1379 pShExtD = &kppDst->sNalData.sVclNal.sSliceHeaderExt;
1378 pPrefixS = &kpSrc->sNalData.sPrefixNal;1380 pPrefixS = &kpSrc->sNalData.sPrefixNal;
1379 pSps = &pCtx->sSpsBuffer[pCtx->sPpsBuffer[pShExtD->sSliceHeader.iPpsId].iSpsId];1381 pSps = &pCtx->sSpsPpsCtx.sSpsBuffer[pCtx->sSpsPpsCtx.sPpsBuffer[pShExtD->sSliceHeader.iPpsId].iSpsId];
1380 1382
1381 pNalHdrExtD->uiDependencyId = pNalHdrExtS->uiDependencyId;1383 pNalHdrExtD->uiDependencyId = pNalHdrExtS->uiDependencyId;
1382 pNalHdrExtD->uiQualityId = pNalHdrExtS->uiQualityId;1384 pNalHdrExtD->uiQualityId = pNalHdrExtS->uiQualityId;
@@ -1438,7 +1440,7 @@ int32_t UpdateAccessUnit (PWelsDecoderContext pCtx) { · 55 unmodified lines
1438 if (uiActualIdx ==1440 if (uiActualIdx ==
1439 pCurAu->uiActualUnitsNum) { // no found IDR nal within incoming AU, need exit to avoid mosaic issue, 11/19/20091441 pCurAu->uiActualUnitsNum) { // no found IDR nal within incoming AU, need exit to avoid mosaic issue, 11/19/2009
1440 1442
1441 pCtx->sDecoderStatistics.uiIDRLostNum++;1443 pCtx->pDecoderStatistics->uiIDRLostNum++;
1442 if (!pCtx->bParamSetsLostFlag)1444 if (!pCtx->bParamSetsLostFlag)
1443 WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,1445 WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
1444 "UpdateAccessUnit():::::Key frame lost.....CAN NOT find IDR from current AU.");1446 "UpdateAccessUnit():::::Key frame lost.....CAN NOT find IDR from current AU.");
@@ -1825,9 +1827,9 @@ void ForceClearCurrentNal (PAccessUnit pAu) { · 380 unmodified lines
1825}1827}
1826 1828
1827void ForceResetParaSetStatusAndAUList (PWelsDecoderContext pCtx) {1829void ForceResetParaSetStatusAndAUList (PWelsDecoderContext pCtx) {
1828 pCtx->bSpsExistAheadFlag = false;1830 pCtx->sSpsPpsCtx.bSpsExistAheadFlag = false;
1829 pCtx->bSubspsExistAheadFlag = false;1831 pCtx->sSpsPpsCtx.bSubspsExistAheadFlag = false;
1830 pCtx->bPpsExistAheadFlag = false;1832 pCtx->sSpsPpsCtx.bPpsExistAheadFlag = false;
1831 1833
1832 // Force clear the AU list1834 // Force clear the AU list
1833 pCtx->pAccessUnitList->uiAvailUnitsNum = 0;1835 pCtx->pAccessUnitList->uiAvailUnitsNum = 0;
@@ -2101,14 +2103,14 @@ int32_t WelsDecodeAccessUnitStart (PWelsDecoderContext pCtx) { · 267 unmodified lines
2101 return iRet;2103 return iRet;
2102 2104
2103 pCtx->pAccessUnitList->uiStartPos = 0;2105 pCtx->pAccessUnitList->uiStartPos = 0;
2104 if (!pCtx->bAvcBasedFlag && !CheckIntegrityNalUnitsList (pCtx)) {2106 if (!pCtx->sSpsPpsCtx.bAvcBasedFlag && !CheckIntegrityNalUnitsList (pCtx)) {
2105 pCtx->iErrorCode |= dsBitstreamError;2107 pCtx->iErrorCode |= dsBitstreamError;
2106 return dsBitstreamError;2108 return dsBitstreamError;
2107 }2109 }
2108 2110
2109 //check current AU has only one layer or not2111 //check current AU has only one layer or not
2110 //If YES, can use deblocking based on AVC2112 //If YES, can use deblocking based on AVC
2111 if (!pCtx->bAvcBasedFlag) {2113 if (!pCtx->sSpsPpsCtx.bAvcBasedFlag) {
2112 CheckOnlyOneLayerInAu (pCtx);2114 CheckOnlyOneLayerInAu (pCtx);
2113 }2115 }
2114 2116
@@ -2119,8 +2121,8 @@ void WelsDecodeAccessUnitEnd (PWelsDecoderContext pCtx) { · 4 unmodified lines
2119 //save previous header info2121 //save previous header info
2120 PAccessUnit pCurAu = pCtx->pAccessUnitList;2122 PAccessUnit pCurAu = pCtx->pAccessUnitList;
2121 PNalUnit pCurNal = pCurAu->pNalUnitsList[pCurAu->uiEndPos];2123 PNalUnit pCurNal = pCurAu->pNalUnitsList[pCurAu->uiEndPos];
2122 memcpy (&pCtx->sLastNalHdrExt, &pCurNal->sNalHeaderExt, sizeof (SNalUnitHeaderExt));2124 memcpy (&pCtx->pLastDecPicInfo->sLastNalHdrExt, &pCurNal->sNalHeaderExt, sizeof (SNalUnitHeaderExt));
2123 memcpy (&pCtx->sLastSliceHeader,2125 memcpy (&pCtx->pLastDecPicInfo->sLastSliceHeader,
2124 &pCurNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader, sizeof (SSliceHeader));2126 &pCurNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader, sizeof (SSliceHeader));
2125 // uninitialize context of current access unit and rbsp buffer clean2127 // uninitialize context of current access unit and rbsp buffer clean
2126 ResetCurrentAccessUnit (pCtx);2128 ResetCurrentAccessUnit (pCtx);
@@ -2147,7 +2149,7 @@ static bool CheckNewSeqBeginAndUpdateActiveLayerSps (PWelsDecoderContext pCtx) { · 20 unmodified lines
2147 }2149 }
2148 int iMaxActiveLayer = 0, iMaxCurrentLayer = 0;2150 int iMaxActiveLayer = 0, iMaxCurrentLayer = 0;
2149 for (int i = MAX_LAYER_NUM - 1; i >= 0; i--) {2151 for (int i = MAX_LAYER_NUM - 1; i >= 0; i--) {
2150 if (pCtx->pActiveLayerSps[i] != NULL) {2152 if (pCtx->sSpsPpsCtx.pActiveLayerSps[i] != NULL) {
2151 iMaxActiveLayer = i;2153 iMaxActiveLayer = i;
2152 break;2154 break;
2153 }2155 }
@@ -2159,37 +2161,39 @@ static bool CheckNewSeqBeginAndUpdateActiveLayerSps (PWelsDecoderContext pCtx) { · 5 unmodified lines
2159 }2161 }
2160 }2162 }
2161 if ((iMaxCurrentLayer != iMaxActiveLayer)2163 if ((iMaxCurrentLayer != iMaxActiveLayer)
2162 || (pTmpLayerSps[iMaxCurrentLayer] != pCtx->pActiveLayerSps[iMaxActiveLayer])) {2164 || (pTmpLayerSps[iMaxCurrentLayer] != pCtx->sSpsPpsCtx.pActiveLayerSps[iMaxActiveLayer])) {
2163 bNewSeq = true;2165 bNewSeq = true;
2164 }2166 }
2165 // fill active sps if the current sps is not null while active layer is null2167 // fill active sps if the current sps is not null while active layer is null
2166 if (!bNewSeq) {2168 if (!bNewSeq) {
2167 for (int i = 0; i < MAX_LAYER_NUM; i++) {2169 for (int i = 0; i < MAX_LAYER_NUM; i++) {
2168 if (pCtx->pActiveLayerSps[i] == NULL && pTmpLayerSps[i] != NULL) {2170 if (pCtx->sSpsPpsCtx.pActiveLayerSps[i] == NULL && pTmpLayerSps[i] != NULL) {
2169 pCtx->pActiveLayerSps[i] = pTmpLayerSps[i];2171 pCtx->sSpsPpsCtx.pActiveLayerSps[i] = pTmpLayerSps[i];
2170 }2172 }
2171 }2173 }
2172 } else {2174 } else {
2173 // UpdateActiveLayerSps if new sequence start2175 // UpdateActiveLayerSps if new sequence start
2174 memcpy (&pCtx->pActiveLayerSps[0], &pTmpLayerSps[0], MAX_LAYER_NUM * sizeof (PSps));2176 memcpy (&pCtx->sSpsPpsCtx.pActiveLayerSps[0], &pTmpLayerSps[0], MAX_LAYER_NUM * sizeof (PSps));
2175 }2177 }
2176 return bNewSeq;2178 return bNewSeq;
2177}2179}
2178 2180
2179static void WriteBackActiveParameters (PWelsDecoderContext pCtx) {2181static void WriteBackActiveParameters (PWelsDecoderContext pCtx) {
2180 if (pCtx->iOverwriteFlags & OVERWRITE_PPS) {2182 if (pCtx->sSpsPpsCtx.iOverwriteFlags & OVERWRITE_PPS) {
2181 memcpy (&pCtx->sPpsBuffer[pCtx->sPpsBuffer[MAX_PPS_COUNT].iPpsId], &pCtx->sPpsBuffer[MAX_PPS_COUNT], sizeof (SPps));2183 memcpy (&pCtx->sSpsPpsCtx.sPpsBuffer[pCtx->sSpsPpsCtx.sPpsBuffer[MAX_PPS_COUNT].iPpsId],
2184 &pCtx->sSpsPpsCtx.sPpsBuffer[MAX_PPS_COUNT], sizeof (SPps));
2182 }2185 }
2183 if (pCtx->iOverwriteFlags & OVERWRITE_SPS) {2186 if (pCtx->sSpsPpsCtx.iOverwriteFlags & OVERWRITE_SPS) {
2184 memcpy (&pCtx->sSpsBuffer[pCtx->sSpsBuffer[MAX_SPS_COUNT].iSpsId], &pCtx->sSpsBuffer[MAX_SPS_COUNT], sizeof (SSps));2187 memcpy (&pCtx->sSpsPpsCtx.sSpsBuffer[pCtx->sSpsPpsCtx.sSpsBuffer[MAX_SPS_COUNT].iSpsId],
2188 &pCtx->sSpsPpsCtx.sSpsBuffer[MAX_SPS_COUNT], sizeof (SSps));
2185 pCtx->bNewSeqBegin = true;2189 pCtx->bNewSeqBegin = true;
2186 }2190 }
2187 if (pCtx->iOverwriteFlags & OVERWRITE_SUBSETSPS) {2191 if (pCtx->sSpsPpsCtx.iOverwriteFlags & OVERWRITE_SUBSETSPS) {
2188 memcpy (&pCtx->sSubsetSpsBuffer[pCtx->sSubsetSpsBuffer[MAX_SPS_COUNT].sSps.iSpsId],2192 memcpy (&pCtx->sSpsPpsCtx.sSubsetSpsBuffer[pCtx->sSpsPpsCtx.sSubsetSpsBuffer[MAX_SPS_COUNT].sSps.iSpsId],
2189 &pCtx->sSubsetSpsBuffer[MAX_SPS_COUNT], sizeof (SSubsetSps));2193 &pCtx->sSpsPpsCtx.sSubsetSpsBuffer[MAX_SPS_COUNT], sizeof (SSubsetSps));
2190 pCtx->bNewSeqBegin = true;2194 pCtx->bNewSeqBegin = true;
2191 }2195 }
2192 pCtx->iOverwriteFlags = OVERWRITE_NONE;2196 pCtx->sSpsPpsCtx.iOverwriteFlags = OVERWRITE_NONE;
2193}2197}
2194 2198
2195/*2199/*
@@ -2223,7 +2227,7 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 27 unmodified lines
2223 int32_t iErr;2227 int32_t iErr;
2224 PAccessUnit pCurAu = pCtx->pAccessUnitList;2228 PAccessUnit pCurAu = pCtx->pAccessUnitList;
2225 pCtx->bAuReadyFlag = false;2229 pCtx->bAuReadyFlag = false;
2226 pCtx->bLastHasMmco5 = false;2230 pCtx->pLastDecPicInfo->bLastHasMmco5 = false;
2227 bool bTmpNewSeqBegin = CheckNewSeqBeginAndUpdateActiveLayerSps (pCtx);2231 bool bTmpNewSeqBegin = CheckNewSeqBeginAndUpdateActiveLayerSps (pCtx);
2228 pCtx->bNewSeqBegin = pCtx->bNewSeqBegin || bTmpNewSeqBegin;2232 pCtx->bNewSeqBegin = pCtx->bNewSeqBegin || bTmpNewSeqBegin;
2229 iErr = WelsDecodeAccessUnitStart (pCtx);2233 iErr = WelsDecodeAccessUnitStart (pCtx);
@@ -2320,8 +2324,7 @@ void WelsDqLayerDecodeStart (PWelsDecoderContext pCtx, PNalUnit pCurNal, PSps pS · 90 unmodified lines
2320 pCtx->bUsedAsRef = false;2324 pCtx->bUsedAsRef = false;
2321 2325
2322 pCtx->iFrameNum = pSh->iFrameNum;2326 pCtx->iFrameNum = pSh->iFrameNum;
2323 UpdateDecoderStatisticsForActiveParaset (& (pCtx->sDecoderStatistics),2327 UpdateDecoderStatisticsForActiveParaset (pCtx->pDecoderStatistics, pSps, pPps);
2324 pSps, pPps);
2325}2328}
2326 2329
2327int32_t InitRefPicList (PWelsDecoderContext pCtx, const uint8_t kuiNRi, int32_t iPoc) {2330int32_t InitRefPicList (PWelsDecoderContext pCtx, const uint8_t kuiNRi, int32_t iPoc) {
@@ -2396,7 +2399,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 68 unmodified lines
2396 const uint8_t kuiDependencyIdMax = (kuiTargetLayerDqId & 0x7F) >> 4;2399 const uint8_t kuiDependencyIdMax = (kuiTargetLayerDqId & 0x7F) >> 4;
2397 int16_t iLastIdD = -1, iLastIdQ = -1;2400 int16_t iLastIdD = -1, iLastIdQ = -1;
2398 int16_t iCurrIdD = 0, iCurrIdQ = 0;2401 int16_t iCurrIdD = 0, iCurrIdQ = 0;
2399 uint8_t uiNalRefIdc = 0;2402 pCtx->uiNalRefIdc = 0;
2400 bool bFreshSliceAvailable =2403 bool bFreshSliceAvailable =
2401 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/20082404 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
2402 2405
@@ -2432,6 +2435,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 29 unmodified lines
2432 pCtx->pDec->bNewSeqBegin = pCtx->bNewSeqBegin; //set flag for start decoding2435 pCtx->pDec->bNewSeqBegin = pCtx->bNewSeqBegin; //set flag for start decoding
2433 }2436 }
2434 pCtx->pDec->uiTimeStamp = pNalCur->uiTimeStamp;2437 pCtx->pDec->uiTimeStamp = pNalCur->uiTimeStamp;
2438 pCtx->pDec->uiDecodingTimeStamp = pCtx->uiDecodingTimeStamp;
2435 2439
2436 if (pCtx->iTotalNumMbRec == 0) { //Picture start to decode2440 if (pCtx->iTotalNumMbRec == 0) { //Picture start to decode
2437 for (int32_t i = 0; i < LAYER_NUM_EXCHANGEABLE; ++ i)2441 for (int32_t i = 0; i < LAYER_NUM_EXCHANGEABLE; ++ i)
@@ -2475,7 +2479,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 37 unmodified lines
2475 pLayerInfo.sSliceInLayer.iLastMbQp = pSh->iSliceQp;2479 pLayerInfo.sSliceInLayer.iLastMbQp = pSh->iSliceQp;
2476 dq_cur->pBitStringAux = &pNalCur->sNalData.sVclNal.sSliceBitsRead;2480 dq_cur->pBitStringAux = &pNalCur->sNalData.sVclNal.sSliceBitsRead;
2477 2481
2478 uiNalRefIdc = pNalCur->sNalHeaderExt.sNalUnitHeader.uiNalRefIdc;2482 pCtx->uiNalRefIdc = pNalCur->sNalHeaderExt.sNalUnitHeader.uiNalRefIdc;
2479 2483
2480 iPpsId = pSh->iPpsId;2484 iPpsId = pSh->iPpsId;
2481 2485
@@ -2515,10 +2519,12 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 33 unmodified lines
2515 || (dq_cur->sLayerInfo.sNalHeaderExt.sNalUnitHeader.eNalUnitType == NAL_UNIT_CODED_SLICE_IDR);2519 || (dq_cur->sLayerInfo.sNalHeaderExt.sNalUnitHeader.eNalUnitType == NAL_UNIT_CODED_SLICE_IDR);
2516 // Subclause 8.2.5.2 Decoding process for gaps in frame_num2520 // Subclause 8.2.5.2 Decoding process for gaps in frame_num
2517 if (!kbIdrFlag &&2521 if (!kbIdrFlag &&
2518 pSh->iFrameNum != pCtx->iPrevFrameNum &&2522 pSh->iFrameNum != pCtx->pLastDecPicInfo->iPrevFrameNum &&
2519 pSh->iFrameNum != ((pCtx->iPrevFrameNum + 1) & ((1 << dq_cur->sLayerInfo.pSps->uiLog2MaxFrameNum) - 1))) {2523 pSh->iFrameNum != ((pCtx->pLastDecPicInfo->iPrevFrameNum + 1) & ((1 << dq_cur->sLayerInfo.pSps->uiLog2MaxFrameNum) -
2524 1))) {
2520 WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,2525 WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
2521 "referencing pictures lost due frame gaps exist, prev_frame_num: %d, curr_frame_num: %d", pCtx->iPrevFrameNum,2526 "referencing pictures lost due frame gaps exist, prev_frame_num: %d, curr_frame_num: %d",
2527 pCtx->pLastDecPicInfo->iPrevFrameNum,
2522 pSh->iFrameNum);2528 pSh->iFrameNum);
2523 2529
2524 bAllRefComplete = false;2530 bAllRefComplete = false;
@@ -2535,7 +2541,7 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 10 unmodified lines
2535 }2541 }
2536 2542
2537 if (iCurrIdD == kuiDependencyIdMax && iCurrIdQ == BASE_QUALITY_ID) {2543 if (iCurrIdD == kuiDependencyIdMax && iCurrIdQ == BASE_QUALITY_ID) {
2538 iRet = InitRefPicList (pCtx, uiNalRefIdc, pSh->iPicOrderCntLsb);2544 iRet = InitRefPicList (pCtx, pCtx->uiNalRefIdc, pSh->iPicOrderCntLsb);
2539 if (iRet) {2545 if (iRet) {
2540 pCtx->bRPLRError = true;2546 pCtx->bRPLRError = true;
2541 bAllRefComplete = false; // RPLR error, set ref pictures complete flag false2547 bAllRefComplete = false; // RPLR error, set ref pictures complete flag false
@@ -2636,20 +2642,10 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 94 unmodified lines
2636 if (iRet)2642 if (iRet)
2637 return iRet;2643 return iRet;
2638 2644
2639 pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //store latest decoded picture for EC2645 pCtx->pLastDecPicInfo->pPreviousDecodedPictureInDpb = pCtx->pDec; //store latest decoded picture for EC
2640 pCtx->bUsedAsRef = false;2646 pCtx->bUsedAsRef = false;
2641 if (uiNalRefIdc > 0) {2647 if (pCtx->uiNalRefIdc > 0) {
2642 pCtx->bUsedAsRef = true;2648 pCtx->bUsedAsRef = true;
2643 //save MBType, MV and RefIndex for use in B-Slice direct mode
2644 memcpy (pCtx->pDec->pMbType, pCtx->pCurDqLayer->pMbType, pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (uint32_t));
2645 memcpy (pCtx->pDec->pMv[LIST_0], pCtx->pCurDqLayer->pMv[LIST_0],
2646 pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (int16_t) * MV_A * MB_BLOCK4x4_NUM);
2647 memcpy (pCtx->pDec->pMv[LIST_1], pCtx->pCurDqLayer->pMv[LIST_1],
2648 pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (int16_t) * MV_A * MB_BLOCK4x4_NUM);
2649 memcpy (pCtx->pDec->pRefIndex[LIST_0], pCtx->pCurDqLayer->pRefIndex[LIST_0],
2650 pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (int8_t) * MB_BLOCK4x4_NUM);
2651 memcpy (pCtx->pDec->pRefIndex[LIST_1], pCtx->pCurDqLayer->pRefIndex[LIST_1],
2652 pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (int8_t) * MB_BLOCK4x4_NUM);
2653 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {2649 for (int32_t listIdx = LIST_0; listIdx < LIST_A; ++listIdx) {
2654 uint32_t i = 0;2650 uint32_t i = 0;
2655 while (i < MAX_DPB_COUNT && pCtx->sRefPic.pRefList[listIdx][i]) {2651 while (i < MAX_DPB_COUNT && pCtx->sRefPic.pRefList[listIdx][i]) {
@@ -2676,9 +2672,9 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 20 unmodified lines
2676 2672
2677 // need update frame_num due current frame is well decoded2673 // need update frame_num due current frame is well decoded
2678 if (pCurAu->pNalUnitsList[pCurAu->uiStartPos]->sNalHeaderExt.sNalUnitHeader.uiNalRefIdc > 0)2674 if (pCurAu->pNalUnitsList[pCurAu->uiStartPos]->sNalHeaderExt.sNalUnitHeader.uiNalRefIdc > 0)
2679 pCtx->iPrevFrameNum = pSh->iFrameNum;2675 pCtx->pLastDecPicInfo->iPrevFrameNum = pSh->iFrameNum;
2680 if (pCtx->bLastHasMmco5)2676 if (pCtx->pLastDecPicInfo->bLastHasMmco5)
2681 pCtx->iPrevFrameNum = 0;2677 pCtx->pLastDecPicInfo->iPrevFrameNum = 0;
2682 }2678 }
2683 2679
2684 return ERR_NONE;2680 return ERR_NONE;
@@ -2690,7 +2686,8 @@ bool CheckAndFinishLastPic (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferIn · 5 unmodified lines
2690 if (IS_VCL_NAL (pCtx->sCurNalHead.eNalUnitType, 1)) { //VCL data, AU list should have data2686 if (IS_VCL_NAL (pCtx->sCurNalHead.eNalUnitType, 1)) { //VCL data, AU list should have data
2691 PNalUnit pCurNal = pAu->pNalUnitsList[pAu->uiEndPos];2687 PNalUnit pCurNal = pAu->pNalUnitsList[pAu->uiEndPos];
2692 bAuBoundaryFlag = (pCtx->iTotalNumMbRec != 0)2688 bAuBoundaryFlag = (pCtx->iTotalNumMbRec != 0)
2693 && (CheckAccessUnitBoundaryExt (&pCtx->sLastNalHdrExt, &pCurNal->sNalHeaderExt, &pCtx->sLastSliceHeader,2689 && (CheckAccessUnitBoundaryExt (&pCtx->pLastDecPicInfo->sLastNalHdrExt, &pCurNal->sNalHeaderExt,
2690 &pCtx->pLastDecPicInfo->sLastSliceHeader,
2694 &pCurNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader));2691 &pCurNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader));
2695 } else { //non VCL2692 } else { //non VCL
2696 if (pCtx->sCurNalHead.eNalUnitType == NAL_UNIT_AU_DELIMITER) {2693 if (pCtx->sCurNalHead.eNalUnitType == NAL_UNIT_AU_DELIMITER) {
@@ -2698,11 +2695,11 @@ bool CheckAndFinishLastPic (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferIn · 1 unmodified line
2698 } else if (pCtx->sCurNalHead.eNalUnitType == NAL_UNIT_SEI) {2695 } else if (pCtx->sCurNalHead.eNalUnitType == NAL_UNIT_SEI) {
2699 bAuBoundaryFlag = true;2696 bAuBoundaryFlag = true;
2700 } else if (pCtx->sCurNalHead.eNalUnitType == NAL_UNIT_SPS) {2697 } else if (pCtx->sCurNalHead.eNalUnitType == NAL_UNIT_SPS) {
2701 bAuBoundaryFlag = !! (pCtx->iOverwriteFlags & OVERWRITE_SPS);2698 bAuBoundaryFlag = !! (pCtx->sSpsPpsCtx.iOverwriteFlags & OVERWRITE_SPS);
2702 } else if (pCtx->sCurNalHead.eNalUnitType == NAL_UNIT_SUBSET_SPS) {2699 } else if (pCtx->sCurNalHead.eNalUnitType == NAL_UNIT_SUBSET_SPS) {
2703 bAuBoundaryFlag = !! (pCtx->iOverwriteFlags & OVERWRITE_SUBSETSPS);2700 bAuBoundaryFlag = !! (pCtx->sSpsPpsCtx.iOverwriteFlags & OVERWRITE_SUBSETSPS);
2704 } else if (pCtx->sCurNalHead.eNalUnitType == NAL_UNIT_PPS) {2701 } else if (pCtx->sCurNalHead.eNalUnitType == NAL_UNIT_PPS) {
2705 bAuBoundaryFlag = !! (pCtx->iOverwriteFlags & OVERWRITE_PPS);2702 bAuBoundaryFlag = !! (pCtx->sSpsPpsCtx.iOverwriteFlags & OVERWRITE_PPS);
2706 }2703 }
2707 if (bAuBoundaryFlag && pCtx->pAccessUnitList->uiAvailUnitsNum != 0) { //Construct remaining data first2704 if (bAuBoundaryFlag && pCtx->pAccessUnitList->uiAvailUnitsNum != 0) { //Construct remaining data first
2708 ConstructAccessUnit (pCtx, ppDst, pDstInfo);2705 ConstructAccessUnit (pCtx, ppDst, pDstInfo);
@@ -2718,8 +2715,8 @@ bool CheckAndFinishLastPic (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferIn · 9 unmodified lines
2718 pCtx->pDec->iPpsId = pCtx->pPps->iPpsId;2715 pCtx->pDec->iPpsId = pCtx->pPps->iPpsId;
2719 2716
2720 DecodeFrameConstruction (pCtx, ppDst, pDstInfo);2717 DecodeFrameConstruction (pCtx, ppDst, pDstInfo);
2721 pCtx->pPreviousDecodedPictureInDpb = pCtx->pDec; //save ECed pic for future use2718 pCtx->pLastDecPicInfo->pPreviousDecodedPictureInDpb = pCtx->pDec; //save ECed pic for future use
2722 if (pCtx->sLastNalHdrExt.sNalUnitHeader.uiNalRefIdc > 0) {2719 if (pCtx->pLastDecPicInfo->sLastNalHdrExt.sNalUnitHeader.uiNalRefIdc > 0) {
2723 if (MarkECFrameAsRef (pCtx) == ERR_INFO_INVALID_PTR) {2720 if (MarkECFrameAsRef (pCtx) == ERR_INFO_INVALID_PTR) {
2724 pCtx->iErrorCode |= dsRefListNullPtrs;2721 pCtx->iErrorCode |= dsRefListNullPtrs;
2725 return false;2722 return false;
@@ -2730,7 +2727,8 @@ bool CheckAndFinishLastPic (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferIn · 4 unmodified lines
2730 pCtx->bFrameFinish = true; //clear frame pending status here!2727 pCtx->bFrameFinish = true; //clear frame pending status here!
2731 } else {2728 } else {
2732 if (DecodeFrameConstruction (pCtx, ppDst, pDstInfo)) {2729 if (DecodeFrameConstruction (pCtx, ppDst, pDstInfo)) {
2733 if ((pCtx->sLastNalHdrExt.sNalUnitHeader.uiNalRefIdc > 0) && (pCtx->sLastNalHdrExt.uiTemporalId == 0))2730 if ((pCtx->pLastDecPicInfo->sLastNalHdrExt.sNalUnitHeader.uiNalRefIdc > 0)
2731 && (pCtx->pLastDecPicInfo->sLastNalHdrExt.uiTemporalId == 0))
2734 pCtx->iErrorCode |= dsNoParamSets;2732 pCtx->iErrorCode |= dsNoParamSets;
2735 else2733 else
2736 pCtx->iErrorCode |= dsBitstreamError;2734 pCtx->iErrorCode |= dsBitstreamError;
@@ -2740,9 +2738,9 @@ bool CheckAndFinishLastPic (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferIn · 3 unmodified lines
2740 }2738 }
2741 pCtx->pDec = NULL;2739 pCtx->pDec = NULL;
2742 if (pAu->pNalUnitsList[pAu->uiStartPos]->sNalHeaderExt.sNalUnitHeader.uiNalRefIdc > 0)2740 if (pAu->pNalUnitsList[pAu->uiStartPos]->sNalHeaderExt.sNalUnitHeader.uiNalRefIdc > 0)
2743 pCtx->iPrevFrameNum = pCtx->sLastSliceHeader.iFrameNum; //save frame_num2741 pCtx->pLastDecPicInfo->iPrevFrameNum = pCtx->pLastDecPicInfo->sLastSliceHeader.iFrameNum; //save frame_num
2744 if (pCtx->bLastHasMmco5)2742 if (pCtx->pLastDecPicInfo->bLastHasMmco5)
2745 pCtx->iPrevFrameNum = 0;2743 pCtx->pLastDecPicInfo->iPrevFrameNum = 0;
2746 }2744 }
2747 return ERR_NONE;2745 return ERR_NONE;
2748}2746}
@@ -2753,28 +2751,37 @@ bool CheckRefPicturesComplete (PWelsDecoderContext pCtx) { · 4 unmodified lines
2753 int32_t iRealMbIdx = pCtx->pCurDqLayer->sLayerInfo.sSliceInLayer.sSliceHeaderExt.sSliceHeader.iFirstMbInSlice;2751 int32_t iRealMbIdx = pCtx->pCurDqLayer->sLayerInfo.sSliceInLayer.sSliceHeaderExt.sSliceHeader.iFirstMbInSlice;
2754 for (int32_t iMbIdx = 0; bAllRefComplete2752 for (int32_t iMbIdx = 0; bAllRefComplete
2755 && iMbIdx < pCtx->pCurDqLayer->sLayerInfo.sSliceInLayer.iTotalMbInCurSlice; iMbIdx++) {2753 && iMbIdx < pCtx->pCurDqLayer->sLayerInfo.sSliceInLayer.iTotalMbInCurSlice; iMbIdx++) {
2756 switch (pCtx->pCurDqLayer->pMbType[iRealMbIdx]) {2754 switch (pCtx->pCurDqLayer->pDec->pMbType[iRealMbIdx]) {
2757 case MB_TYPE_SKIP:2755 case MB_TYPE_SKIP:
2758 case MB_TYPE_16x16:2756 case MB_TYPE_16x16:
2759 bAllRefComplete &= pCtx->sRefPic.pRefList[ LIST_0 ][ pCtx->pCurDqLayer->pRefIndex[0][iRealMbIdx][0] ]->bIsComplete;2757 bAllRefComplete &=
2758 pCtx->sRefPic.pRefList[ LIST_0 ][ pCtx->pCurDqLayer->pDec->pRefIndex[0][iRealMbIdx][0] ]->bIsComplete;
2760 break;2759 break;
2761 2760
2762 case MB_TYPE_16x8:2761 case MB_TYPE_16x8:
2763 bAllRefComplete &= pCtx->sRefPic.pRefList[ LIST_0 ][ pCtx->pCurDqLayer->pRefIndex[0][iRealMbIdx][0] ]->bIsComplete;2762 bAllRefComplete &=
2764 bAllRefComplete &= pCtx->sRefPic.pRefList[ LIST_0 ][ pCtx->pCurDqLayer->pRefIndex[0][iRealMbIdx][8] ]->bIsComplete;2763 pCtx->sRefPic.pRefList[ LIST_0 ][ pCtx->pCurDqLayer->pDec->pRefIndex[0][iRealMbIdx][0] ]->bIsComplete;
2764 bAllRefComplete &=
2765 pCtx->sRefPic.pRefList[ LIST_0 ][ pCtx->pCurDqLayer->pDec->pRefIndex[0][iRealMbIdx][8] ]->bIsComplete;
2765 break;2766 break;
2766 2767
2767 case MB_TYPE_8x16:2768 case MB_TYPE_8x16:
2768 bAllRefComplete &= pCtx->sRefPic.pRefList[ LIST_0 ][ pCtx->pCurDqLayer->pRefIndex[0][iRealMbIdx][0] ]->bIsComplete;2769 bAllRefComplete &=
2769 bAllRefComplete &= pCtx->sRefPic.pRefList[ LIST_0 ][ pCtx->pCurDqLayer->pRefIndex[0][iRealMbIdx][2] ]->bIsComplete;2770 pCtx->sRefPic.pRefList[ LIST_0 ][ pCtx->pCurDqLayer->pDec->pRefIndex[0][iRealMbIdx][0] ]->bIsComplete;
2771 bAllRefComplete &=
2772 pCtx->sRefPic.pRefList[ LIST_0 ][ pCtx->pCurDqLayer->pDec->pRefIndex[0][iRealMbIdx][2] ]->bIsComplete;
2770 break;2773 break;
2771 2774
2772 case MB_TYPE_8x8:2775 case MB_TYPE_8x8:
2773 case MB_TYPE_8x8_REF0:2776 case MB_TYPE_8x8_REF0:
2774 bAllRefComplete &= pCtx->sRefPic.pRefList[ LIST_0 ][ pCtx->pCurDqLayer->pRefIndex[0][iRealMbIdx][0] ]->bIsComplete;2777 bAllRefComplete &=
2775 bAllRefComplete &= pCtx->sRefPic.pRefList[ LIST_0 ][ pCtx->pCurDqLayer->pRefIndex[0][iRealMbIdx][2] ]->bIsComplete;2778 pCtx->sRefPic.pRefList[ LIST_0 ][ pCtx->pCurDqLayer->pDec->pRefIndex[0][iRealMbIdx][0] ]->bIsComplete;
2776 bAllRefComplete &= pCtx->sRefPic.pRefList[ LIST_0 ][ pCtx->pCurDqLayer->pRefIndex[0][iRealMbIdx][8] ]->bIsComplete;2779 bAllRefComplete &=
2777 bAllRefComplete &= pCtx->sRefPic.pRefList[ LIST_0 ][ pCtx->pCurDqLayer->pRefIndex[0][iRealMbIdx][10] ]->bIsComplete;2780 pCtx->sRefPic.pRefList[ LIST_0 ][ pCtx->pCurDqLayer->pDec->pRefIndex[0][iRealMbIdx][2] ]->bIsComplete;
2781 bAllRefComplete &=
2782 pCtx->sRefPic.pRefList[ LIST_0 ][ pCtx->pCurDqLayer->pDec->pRefIndex[0][iRealMbIdx][8] ]->bIsComplete;
2783 bAllRefComplete &=
2784 pCtx->sRefPic.pRefList[ LIST_0 ][ pCtx->pCurDqLayer->pDec->pRefIndex[0][iRealMbIdx][10] ]->bIsComplete;
2778 break;2785 break;
2779 2786
2780 default:2787 default:

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