Showing the changes to codec/decoder/core/src/au_parser.cpp (1 of 29 files). Show all
Unified · Split
| @@ -148,48 +148,50 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 147 unmodified lines | |||
| 148 | ++ (*pConsumedBytes); | 148 | ++ (*pConsumedBytes); |
| 149 | 149 | ||
| 150 | if (! (IS_SEI_NAL (pNalUnitHeader->eNalUnitType) || IS_SPS_NAL (pNalUnitHeader->eNalUnitType) | 150 | if (! (IS_SEI_NAL (pNalUnitHeader->eNalUnitType) || IS_SPS_NAL (pNalUnitHeader->eNalUnitType) |
| 151 | || IS_AU_DELIMITER_NAL (pNalUnitHeader->eNalUnitType) || pCtx->bSpsExistAheadFlag)) { | 151 | || IS_AU_DELIMITER_NAL (pNalUnitHeader->eNalUnitType) || pCtx->sSpsPpsCtx.bSpsExistAheadFlag)) { |
| 152 | if (pCtx->bPrintFrameErrorTraceFlag && pCtx->iSpsErrorIgnored == 0) { | 152 | if (pCtx->bPrintFrameErrorTraceFlag && pCtx->sSpsPpsCtx.iSpsErrorIgnored == 0) { |
| 153 | WelsLog (pLogCtx, WELS_LOG_WARNING, | 153 | WelsLog (pLogCtx, WELS_LOG_WARNING, |
| 154 | "parse_nal(), no exist Sequence Parameter Sets ahead of sequence when try to decode NAL(type:%d).", | 154 | "parse_nal(), no exist Sequence Parameter Sets ahead of sequence when try to decode NAL(type:%d).", |
| 155 | pNalUnitHeader->eNalUnitType); | 155 | pNalUnitHeader->eNalUnitType); |
| 156 | } else { | 156 | } else { |
| 157 | pCtx->iSpsErrorIgnored++; | 157 | pCtx->sSpsPpsCtx.iSpsErrorIgnored++; |
| 158 | } | 158 | } |
| 159 | pCtx->sDecoderStatistics.iSpsNoExistNalNum++; | 159 | pCtx->pDecoderStatistics->iSpsNoExistNalNum++; |
| 160 | pCtx->iErrorCode = dsNoParamSets; | 160 | pCtx->iErrorCode = dsNoParamSets; |
| 161 | return NULL; | 161 | return NULL; |
| 162 | } | 162 | } |
| 163 | pCtx->iSpsErrorIgnored = 0; | 163 | pCtx->sSpsPpsCtx.iSpsErrorIgnored = 0; |
| 164 | if (! (IS_SEI_NAL (pNalUnitHeader->eNalUnitType) || IS_PARAM_SETS_NALS (pNalUnitHeader->eNalUnitType) | 164 | if (! (IS_SEI_NAL (pNalUnitHeader->eNalUnitType) || IS_PARAM_SETS_NALS (pNalUnitHeader->eNalUnitType) |
| 165 | || IS_AU_DELIMITER_NAL (pNalUnitHeader->eNalUnitType) || pCtx->bPpsExistAheadFlag)) { | 165 | || IS_AU_DELIMITER_NAL (pNalUnitHeader->eNalUnitType) || pCtx->sSpsPpsCtx.bPpsExistAheadFlag)) { |
| 166 | if (pCtx->bPrintFrameErrorTraceFlag && pCtx->iPpsErrorIgnored == 0) { | 166 | if (pCtx->bPrintFrameErrorTraceFlag && pCtx->sSpsPpsCtx.iPpsErrorIgnored == 0) { |
| 167 | WelsLog (pLogCtx, WELS_LOG_WARNING, | 167 | WelsLog (pLogCtx, WELS_LOG_WARNING, |
| 168 | "parse_nal(), no exist Picture Parameter Sets ahead of sequence when try to decode NAL(type:%d).", | 168 | "parse_nal(), no exist Picture Parameter Sets ahead of sequence when try to decode NAL(type:%d).", |
| 169 | pNalUnitHeader->eNalUnitType); | 169 | pNalUnitHeader->eNalUnitType); |
| 170 | } else { | 170 | } else { |
| 171 | pCtx->iPpsErrorIgnored++; | 171 | pCtx->sSpsPpsCtx.iPpsErrorIgnored++; |
| 172 | } | 172 | } |
| 173 | pCtx->sDecoderStatistics.iPpsNoExistNalNum++; | 173 | pCtx->pDecoderStatistics->iPpsNoExistNalNum++; |
| 174 | pCtx->iErrorCode = dsNoParamSets; | 174 | pCtx->iErrorCode = dsNoParamSets; |
| 175 | return NULL; | 175 | return NULL; |
| 176 | } | 176 | } |
| 177 | pCtx->iPpsErrorIgnored = 0; | 177 | pCtx->sSpsPpsCtx.iPpsErrorIgnored = 0; |
| 178 | if ((IS_VCL_NAL_AVC_BASE (pNalUnitHeader->eNalUnitType) && ! (pCtx->bSpsExistAheadFlag || pCtx->bPpsExistAheadFlag)) || | 178 | if ((IS_VCL_NAL_AVC_BASE (pNalUnitHeader->eNalUnitType) && ! (pCtx->sSpsPpsCtx.bSpsExistAheadFlag |
| 179 | (IS_NEW_INTRODUCED_SVC_NAL (pNalUnitHeader->eNalUnitType) && ! (pCtx->bSpsExistAheadFlag || pCtx->bSubspsExistAheadFlag | 179 | || pCtx->sSpsPpsCtx.bPpsExistAheadFlag)) || |
| 180 | || pCtx->bPpsExistAheadFlag))) { | 180 | (IS_NEW_INTRODUCED_SVC_NAL (pNalUnitHeader->eNalUnitType) && ! (pCtx->sSpsPpsCtx.bSpsExistAheadFlag |
| 181 | if (pCtx->bPrintFrameErrorTraceFlag && pCtx->iSubSpsErrorIgnored == 0) { | 181 | || pCtx->sSpsPpsCtx.bSubspsExistAheadFlag |
| 182 | || pCtx->sSpsPpsCtx.bPpsExistAheadFlag))) { | ||
| 183 | if (pCtx->bPrintFrameErrorTraceFlag && pCtx->sSpsPpsCtx.iSubSpsErrorIgnored == 0) { | ||
| 182 | WelsLog (pLogCtx, WELS_LOG_WARNING, | 184 | WelsLog (pLogCtx, WELS_LOG_WARNING, |
| 183 | "ParseNalHeader(), no exist Parameter Sets ahead of sequence when try to decode slice(type:%d).", | 185 | "ParseNalHeader(), no exist Parameter Sets ahead of sequence when try to decode slice(type:%d).", |
| 184 | pNalUnitHeader->eNalUnitType); | 186 | pNalUnitHeader->eNalUnitType); |
| 185 | } else { | 187 | } else { |
| 186 | pCtx->iSubSpsErrorIgnored++; | 188 | pCtx->sSpsPpsCtx.iSubSpsErrorIgnored++; |
| 187 | } | 189 | } |
| 188 | pCtx->sDecoderStatistics.iSubSpsNoExistNalNum++; | 190 | pCtx->pDecoderStatistics->iSubSpsNoExistNalNum++; |
| 189 | pCtx->iErrorCode |= dsNoParamSets; | 191 | pCtx->iErrorCode |= dsNoParamSets; |
| 190 | return NULL; | 192 | return NULL; |
| 191 | } | 193 | } |
| 192 | pCtx->iSubSpsErrorIgnored = 0; | 194 | pCtx->sSpsPpsCtx.iSubSpsErrorIgnored = 0; |
| 193 | 195 | ||
| 194 | switch (pNalUnitHeader->eNalUnitType) { | 196 | switch (pNalUnitHeader->eNalUnitType) { |
| 195 | case NAL_UNIT_AU_DELIMITER: | 197 | case NAL_UNIT_AU_DELIMITER: |
| @@ -201,7 +203,7 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 5 unmodified lines | |||
| 201 | break; | 203 | break; |
| 202 | 204 | ||
| 203 | case NAL_UNIT_PREFIX: | 205 | case NAL_UNIT_PREFIX: |
| 204 | pCurNal = &pCtx->sPrefixNal; | 206 | pCurNal = &pCtx->sSpsPpsCtx.sPrefixNal; |
| 205 | pCurNal->uiTimeStamp = pCtx->uiTimeStamp; | 207 | pCurNal->uiTimeStamp = pCtx->uiTimeStamp; |
| 206 | 208 | ||
| 207 | if (iNalSize < NAL_UNIT_HEADER_EXT_SIZE) { | 209 | if (iNalSize < NAL_UNIT_HEADER_EXT_SIZE) { |
| @@ -365,9 +367,9 @@ uint8_t* ParseNalHeader (PWelsDecoderContext pCtx, SNalUnitHeader* pNalUnitHeade · 157 unmodified lines | |||
| 365 | memcpy (pSavedData->pCurPos + iStartDeltaByte, pSrcNal, iActualLen); | 367 | memcpy (pSavedData->pCurPos + iStartDeltaByte, pSrcNal, iActualLen); |
| 366 | pSavedData->pCurPos += iStartDeltaByte + iActualLen; | 368 | pSavedData->pCurPos += iStartDeltaByte + iActualLen; |
| 367 | } | 369 | } |
| 368 | if (NAL_UNIT_PREFIX == pCtx->sPrefixNal.sNalHeaderExt.sNalUnitHeader.eNalUnitType) { | 370 | if (NAL_UNIT_PREFIX == pCtx->sSpsPpsCtx.sPrefixNal.sNalHeaderExt.sNalUnitHeader.eNalUnitType) { |
| 369 | if (pCtx->sPrefixNal.sNalData.sPrefixNal.bPrefixNalCorrectFlag) { | 371 | if (pCtx->sSpsPpsCtx.sPrefixNal.sNalData.sPrefixNal.bPrefixNalCorrectFlag) { |
| 370 | PrefetchNalHeaderExtSyntax (pCtx, pCurNal, &pCtx->sPrefixNal); | 372 | PrefetchNalHeaderExtSyntax (pCtx, pCurNal, &pCtx->sSpsPpsCtx.sPrefixNal); |
| 371 | } | 373 | } |
| 372 | } | 374 | } |
| 373 | 375 | ||
| @@ -496,8 +498,8 @@ bool CheckAccessUnitBoundary (PWelsDecoderContext pCtx, const PNalUnit kpCurNal, · 122 unmodified lines | |||
| 496 | const PNalUnitHeaderExt kpCurNalHeaderExt = &kpCurNal->sNalHeaderExt; | 498 | const PNalUnitHeaderExt kpCurNalHeaderExt = &kpCurNal->sNalHeaderExt; |
| 497 | const SSliceHeader* kpLastSliceHeader = &kpLastNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader; | 499 | const SSliceHeader* kpLastSliceHeader = &kpLastNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader; |
| 498 | const SSliceHeader* kpCurSliceHeader = &kpCurNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader; | 500 | const SSliceHeader* kpCurSliceHeader = &kpCurNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader; |
| 499 | if (pCtx->pActiveLayerSps[kpCurNalHeaderExt->uiDependencyId] != NULL | 501 | if (pCtx->sSpsPpsCtx.pActiveLayerSps[kpCurNalHeaderExt->uiDependencyId] != NULL |
| 500 | && pCtx->pActiveLayerSps[kpCurNalHeaderExt->uiDependencyId] != kpSps) { | 502 | && pCtx->sSpsPpsCtx.pActiveLayerSps[kpCurNalHeaderExt->uiDependencyId] != kpSps) { |
| 501 | return true; // the active sps changed, new sequence begins, so the current au is ready | 503 | return true; // the active sps changed, new sequence begins, so the current au is ready |
| 502 | } | 504 | } |
| 503 | 505 | ||
| @@ -548,8 +550,8 @@ bool CheckAccessUnitBoundary (PWelsDecoderContext pCtx, const PNalUnit kpCurNal, · 44 unmodified lines | |||
| 548 | 550 | ||
| 549 | bool CheckNextAuNewSeq (PWelsDecoderContext pCtx, const PNalUnit kpCurNal, const PSps kpSps) { | 551 | bool CheckNextAuNewSeq (PWelsDecoderContext pCtx, const PNalUnit kpCurNal, const PSps kpSps) { |
| 550 | const PNalUnitHeaderExt kpCurNalHeaderExt = &kpCurNal->sNalHeaderExt; | 552 | const PNalUnitHeaderExt kpCurNalHeaderExt = &kpCurNal->sNalHeaderExt; |
| 551 | if (pCtx->pActiveLayerSps[kpCurNalHeaderExt->uiDependencyId] != NULL | 553 | if (pCtx->sSpsPpsCtx.pActiveLayerSps[kpCurNalHeaderExt->uiDependencyId] != NULL |
| 552 | && pCtx->pActiveLayerSps[kpCurNalHeaderExt->uiDependencyId] != kpSps) | 554 | && pCtx->sSpsPpsCtx.pActiveLayerSps[kpCurNalHeaderExt->uiDependencyId] != kpSps) |
| 553 | return true; | 555 | return true; |
| 554 | if (kpCurNalHeaderExt->bIdrFlag) | 556 | if (kpCurNalHeaderExt->bIdrFlag) |
| 555 | return true; | 557 | return true; |
| @@ -620,7 +622,7 @@ int32_t ParseNonVclNal (PWelsDecoderContext pCtx, uint8_t* pRbsp, const int32_t · 64 unmodified lines | |||
| 620 | return iErr; | 622 | return iErr; |
| 621 | } | 623 | } |
| 622 | } | 624 | } |
| 623 | iErr = ParsePps (pCtx, &pCtx->sPpsBuffer[0], pBs, pSrcNal, kSrcNalLen); | 625 | iErr = ParsePps (pCtx, &pCtx->sSpsPpsCtx.sPpsBuffer[0], pBs, pSrcNal, kSrcNalLen); |
| 624 | if (ERR_NONE != iErr) { // modified for pps invalid, 12/1/2009 | 626 | if (ERR_NONE != iErr) { // modified for pps invalid, 12/1/2009 |
| 625 | if (pCtx->pParam->eEcActiveIdc == ERROR_CON_DISABLE) | 627 | if (pCtx->pParam->eEcActiveIdc == ERROR_CON_DISABLE) |
| 626 | pCtx->iErrorCode |= dsNoParamSets; | 628 | pCtx->iErrorCode |= dsNoParamSets; |
| @@ -629,7 +631,7 @@ int32_t ParseNonVclNal (PWelsDecoderContext pCtx, uint8_t* pRbsp, const int32_t · 2 unmodified lines | |||
| 629 | return iErr; | 631 | return iErr; |
| 630 | } | 632 | } |
| 631 | 633 | ||
| 632 | pCtx->bPpsExistAheadFlag = true; | 634 | pCtx->sSpsPpsCtx.bPpsExistAheadFlag = true; |
| 633 | 635 | ||
| 634 | break; | 636 | break; |
| 635 | 637 | ||
| @@ -683,7 +685,7 @@ int32_t ParseRefBasePicMarking (PBitStringAux pBs, PRefBasePicMarking pRefBasePi · 47 unmodified lines | |||
| 683 | } | 685 | } |
| 684 | 686 | ||
| 685 | int32_t ParsePrefixNalUnit (PWelsDecoderContext pCtx, PBitStringAux pBs) { | 687 | int32_t ParsePrefixNalUnit (PWelsDecoderContext pCtx, PBitStringAux pBs) { |
| 686 | PNalUnit pCurNal = &pCtx->sPrefixNal; | 688 | PNalUnit pCurNal = &pCtx->sSpsPpsCtx.sPrefixNal; |
| 687 | uint32_t uiCode; | 689 | uint32_t uiCode; |
| 688 | 690 | ||
| 689 | if (pCurNal->sNalHeaderExt.sNalUnitHeader.uiNalRefIdc != 0) { | 691 | if (pCurNal->sNalHeaderExt.sNalUnitHeader.uiNalRefIdc != 0) { |
| @@ -834,12 +836,12 @@ const SLevelLimits* GetLevelLimits (int32_t iLevelIdx, bool bConstraint3) { · 144 unmodified lines | |||
| 834 | 836 | ||
| 835 | bool CheckSpsActive (PWelsDecoderContext pCtx, PSps pSps, bool bUseSubsetFlag) { | 837 | bool CheckSpsActive (PWelsDecoderContext pCtx, PSps pSps, bool bUseSubsetFlag) { |
| 836 | for (int i = 0; i < MAX_LAYER_NUM; i++) { | 838 | for (int i = 0; i < MAX_LAYER_NUM; i++) { |
| 837 | if (pCtx->pActiveLayerSps[i] == pSps) | 839 | if (pCtx->sSpsPpsCtx.pActiveLayerSps[i] == pSps) |
| 838 | return true; | 840 | return true; |
| 839 | } | 841 | } |
| 840 | // Pre-active, will be used soon | 842 | // Pre-active, will be used soon |
| 841 | if (bUseSubsetFlag) { | 843 | if (bUseSubsetFlag) { |
| 842 | if (pSps->iMbWidth > 0 && pSps->iMbHeight > 0 && pCtx->bSubspsAvailFlags[pSps->iSpsId]) { | 844 | if (pSps->iMbWidth > 0 && pSps->iMbHeight > 0 && pCtx->sSpsPpsCtx.bSubspsAvailFlags[pSps->iSpsId]) { |
| 843 | if (pCtx->iTotalNumMbRec > 0) { | 845 | if (pCtx->iTotalNumMbRec > 0) { |
| 844 | return true; | 846 | return true; |
| 845 | } | 847 | } |
| @@ -857,7 +859,7 @@ bool CheckSpsActive (PWelsDecoderContext pCtx, PSps pSps, bool bUseSubsetFlag) { · 11 unmodified lines | |||
| 857 | } | 859 | } |
| 858 | } | 860 | } |
| 859 | } else { | 861 | } else { |
| 860 | if (pSps->iMbWidth > 0 && pSps->iMbHeight > 0 && pCtx->bSpsAvailFlags[pSps->iSpsId]) { | 862 | if (pSps->iMbWidth > 0 && pSps->iMbHeight > 0 && pCtx->sSpsPpsCtx.bSpsAvailFlags[pSps->iSpsId]) { |
| 861 | if (pCtx->iTotalNumMbRec > 0) { | 863 | if (pCtx->iTotalNumMbRec > 0) { |
| 862 | return true; | 864 | return true; |
| 863 | } | 865 | } |
| @@ -1251,57 +1253,57 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 387 unmodified lines | |||
| 1251 | 1253 | ||
| 1252 | 1254 | ||
| 1253 | if (PRO_SCALABLE_BASELINE == uiProfileIdc || PRO_SCALABLE_HIGH == uiProfileIdc) | 1255 | if (PRO_SCALABLE_BASELINE == uiProfileIdc || PRO_SCALABLE_HIGH == uiProfileIdc) |
| 1254 | pCtx->bAvcBasedFlag = false; | 1256 | pCtx->sSpsPpsCtx.bAvcBasedFlag = false; |
| 1255 | 1257 | ||
| 1256 | *pPicWidth = pSps->iMbWidth << 4; | 1258 | *pPicWidth = pSps->iMbWidth << 4; |
| 1257 | *pPicHeight = pSps->iMbHeight << 4; | 1259 | *pPicHeight = pSps->iMbHeight << 4; |
| 1258 | PSps pTmpSps = NULL; | 1260 | PSps pTmpSps = NULL; |
| 1259 | if (kbUseSubsetFlag) { | 1261 | if (kbUseSubsetFlag) { |
| 1260 | pTmpSps = &pCtx->sSubsetSpsBuffer[iSpsId].sSps; | 1262 | pTmpSps = &pCtx->sSpsPpsCtx.sSubsetSpsBuffer[iSpsId].sSps; |
| 1261 | } else { | 1263 | } else { |
| 1262 | pTmpSps = &pCtx->sSpsBuffer[iSpsId]; | 1264 | pTmpSps = &pCtx->sSpsPpsCtx.sSpsBuffer[iSpsId]; |
| 1263 | } | 1265 | } |
| 1264 | if (CheckSpsActive (pCtx, pTmpSps, kbUseSubsetFlag)) { | 1266 | if (CheckSpsActive (pCtx, pTmpSps, kbUseSubsetFlag)) { |
| 1265 | // we are overwriting the active sps, copy a temp buffer | 1267 | // we are overwriting the active sps, copy a temp buffer |
| 1266 | if (kbUseSubsetFlag) { | 1268 | if (kbUseSubsetFlag) { |
| 1267 | if (memcmp (&pCtx->sSubsetSpsBuffer[iSpsId], pSubsetSps, sizeof (SSubsetSps)) != 0) { | 1269 | if (memcmp (&pCtx->sSpsPpsCtx.sSubsetSpsBuffer[iSpsId], pSubsetSps, sizeof (SSubsetSps)) != 0) { |
| 1268 | if (pCtx->pAccessUnitList->uiAvailUnitsNum > 0) { | 1270 | if (pCtx->pAccessUnitList->uiAvailUnitsNum > 0) { |
| 1269 | memcpy (&pCtx->sSubsetSpsBuffer[MAX_SPS_COUNT], pSubsetSps, sizeof (SSubsetSps)); | 1271 | memcpy (&pCtx->sSpsPpsCtx.sSubsetSpsBuffer[MAX_SPS_COUNT], pSubsetSps, sizeof (SSubsetSps)); |
| 1270 | pCtx->bAuReadyFlag = true; | 1272 | pCtx->bAuReadyFlag = true; |
| 1271 | pCtx->pAccessUnitList->uiEndPos = pCtx->pAccessUnitList->uiAvailUnitsNum - 1; | 1273 | pCtx->pAccessUnitList->uiEndPos = pCtx->pAccessUnitList->uiAvailUnitsNum - 1; |
| 1272 | pCtx->iOverwriteFlags |= OVERWRITE_SUBSETSPS; | 1274 | pCtx->sSpsPpsCtx.iOverwriteFlags |= OVERWRITE_SUBSETSPS; |
| 1273 | } else if ((pCtx->pSps != NULL) && (pCtx->pSps->iSpsId == pSubsetSps->sSps.iSpsId)) { | 1275 | } else if ((pCtx->pSps != NULL) && (pCtx->pSps->iSpsId == pSubsetSps->sSps.iSpsId)) { |
| 1274 | memcpy (&pCtx->sSubsetSpsBuffer[MAX_SPS_COUNT], pSubsetSps, sizeof (SSubsetSps)); | 1276 | memcpy (&pCtx->sSpsPpsCtx.sSubsetSpsBuffer[MAX_SPS_COUNT], pSubsetSps, sizeof (SSubsetSps)); |
| 1275 | pCtx->iOverwriteFlags |= OVERWRITE_SUBSETSPS; | 1277 | pCtx->sSpsPpsCtx.iOverwriteFlags |= OVERWRITE_SUBSETSPS; |
| 1276 | } else { | 1278 | } else { |
| 1277 | memcpy (&pCtx->sSubsetSpsBuffer[iSpsId], pSubsetSps, sizeof (SSubsetSps)); | 1279 | memcpy (&pCtx->sSpsPpsCtx.sSubsetSpsBuffer[iSpsId], pSubsetSps, sizeof (SSubsetSps)); |
| 1278 | } | 1280 | } |
| 1279 | } | 1281 | } |
| 1280 | } else { | 1282 | } else { |
| 1281 | if (memcmp (&pCtx->sSpsBuffer[iSpsId], pSps, sizeof (SSps)) != 0) { | 1283 | if (memcmp (&pCtx->sSpsPpsCtx.sSpsBuffer[iSpsId], pSps, sizeof (SSps)) != 0) { |
| 1282 | if (pCtx->pAccessUnitList->uiAvailUnitsNum > 0) { | 1284 | if (pCtx->pAccessUnitList->uiAvailUnitsNum > 0) { |
| 1283 | memcpy (&pCtx->sSpsBuffer[MAX_SPS_COUNT], pSps, sizeof (SSps)); | 1285 | memcpy (&pCtx->sSpsPpsCtx.sSpsBuffer[MAX_SPS_COUNT], pSps, sizeof (SSps)); |
| 1284 | pCtx->iOverwriteFlags |= OVERWRITE_SPS; | 1286 | pCtx->sSpsPpsCtx.iOverwriteFlags |= OVERWRITE_SPS; |
| 1285 | pCtx->bAuReadyFlag = true; | 1287 | pCtx->bAuReadyFlag = true; |
| 1286 | pCtx->pAccessUnitList->uiEndPos = pCtx->pAccessUnitList->uiAvailUnitsNum - 1; | 1288 | pCtx->pAccessUnitList->uiEndPos = pCtx->pAccessUnitList->uiAvailUnitsNum - 1; |
| 1287 | } else if ((pCtx->pSps != NULL) && (pCtx->pSps->iSpsId == pSps->iSpsId)) { | 1289 | } else if ((pCtx->pSps != NULL) && (pCtx->pSps->iSpsId == pSps->iSpsId)) { |
| 1288 | memcpy (&pCtx->sSpsBuffer[MAX_SPS_COUNT], pSps, sizeof (SSps)); | 1290 | memcpy (&pCtx->sSpsPpsCtx.sSpsBuffer[MAX_SPS_COUNT], pSps, sizeof (SSps)); |
| 1289 | pCtx->iOverwriteFlags |= OVERWRITE_SPS; | 1291 | pCtx->sSpsPpsCtx.iOverwriteFlags |= OVERWRITE_SPS; |
| 1290 | } else { | 1292 | } else { |
| 1291 | memcpy (&pCtx->sSpsBuffer[iSpsId], pSps, sizeof (SSps)); | 1293 | memcpy (&pCtx->sSpsPpsCtx.sSpsBuffer[iSpsId], pSps, sizeof (SSps)); |
| 1292 | } | 1294 | } |
| 1293 | } | 1295 | } |
| 1294 | } | 1296 | } |
| 1295 | } | 1297 | } |
| 1296 | // Not overwrite active sps, just copy to final place | 1298 | // Not overwrite active sps, just copy to final place |
| 1297 | else if (kbUseSubsetFlag) { | 1299 | else if (kbUseSubsetFlag) { |
| 1298 | memcpy (&pCtx->sSubsetSpsBuffer[iSpsId], pSubsetSps, sizeof (SSubsetSps)); | 1300 | memcpy (&pCtx->sSpsPpsCtx.sSubsetSpsBuffer[iSpsId], pSubsetSps, sizeof (SSubsetSps)); |
| 1299 | pCtx->bSubspsAvailFlags[iSpsId] = true; | 1301 | pCtx->sSpsPpsCtx.bSubspsAvailFlags[iSpsId] = true; |
| 1300 | pCtx->bSubspsExistAheadFlag = true; | 1302 | pCtx->sSpsPpsCtx.bSubspsExistAheadFlag = true; |
| 1301 | } else { | 1303 | } else { |
| 1302 | memcpy (&pCtx->sSpsBuffer[iSpsId], pSps, sizeof (SSps)); | 1304 | memcpy (&pCtx->sSpsPpsCtx.sSpsBuffer[iSpsId], pSps, sizeof (SSps)); |
| 1303 | pCtx->bSpsAvailFlags[iSpsId] = true; | 1305 | pCtx->sSpsPpsCtx.bSpsAvailFlags[iSpsId] = true; |
| 1304 | pCtx->bSpsExistAheadFlag = true; | 1306 | pCtx->sSpsPpsCtx.bSpsExistAheadFlag = true; |
| 1305 | } | 1307 | } |
| 1306 | return ERR_NONE; | 1308 | return ERR_NONE; |
| 1307 | } | 1309 | } |
| @@ -1421,8 +1423,8 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux, · 113 unmodified lines | |||
| 1421 | WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //pic_scaling_matrix_present_flag | 1423 | WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //pic_scaling_matrix_present_flag |
| 1422 | pPps->bPicScalingMatrixPresentFlag = !!uiCode; | 1424 | pPps->bPicScalingMatrixPresentFlag = !!uiCode; |
| 1423 | if (pPps->bPicScalingMatrixPresentFlag) { | 1425 | if (pPps->bPicScalingMatrixPresentFlag) { |
| 1424 | if (pCtx->bSpsAvailFlags[pPps->iSpsId]) { | 1426 | if (pCtx->sSpsPpsCtx.bSpsAvailFlags[pPps->iSpsId]) { |
| 1425 | WELS_READ_VERIFY (ParseScalingList (&pCtx->sSpsBuffer[pPps->iSpsId], pBsAux, 1, pPps->bTransform8x8ModeFlag, | 1427 | WELS_READ_VERIFY (ParseScalingList (&pCtx->sSpsPpsCtx.sSpsBuffer[pPps->iSpsId], pBsAux, 1, pPps->bTransform8x8ModeFlag, |
| 1426 | pPps->bPicScalingListPresentFlag, pPps->iScalingList4x4, pPps->iScalingList8x8)); | 1428 | pPps->bPicScalingListPresentFlag, pPps->iScalingList4x4, pPps->iScalingList8x8)); |
| 1427 | } else { | 1429 | } else { |
| 1428 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, | 1430 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, |
| @@ -1440,16 +1442,16 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux, · 11 unmodified lines | |||
| 1440 | 1442 | ||
| 1441 | if (pCtx->pPps != NULL && pCtx->pPps->iPpsId == pPps->iPpsId) { | 1443 | if (pCtx->pPps != NULL && pCtx->pPps->iPpsId == pPps->iPpsId) { |
| 1442 | if (memcmp (pCtx->pPps, pPps, sizeof (*pPps)) != 0) { | 1444 | if (memcmp (pCtx->pPps, pPps, sizeof (*pPps)) != 0) { |
| 1443 | memcpy (&pCtx->sPpsBuffer[MAX_PPS_COUNT], pPps, sizeof (SPps)); | 1445 | memcpy (&pCtx->sSpsPpsCtx.sPpsBuffer[MAX_PPS_COUNT], pPps, sizeof (SPps)); |
| 1444 | pCtx->iOverwriteFlags |= OVERWRITE_PPS; | 1446 | pCtx->sSpsPpsCtx.iOverwriteFlags |= OVERWRITE_PPS; |
| 1445 | if (pCtx->pAccessUnitList->uiAvailUnitsNum > 0) { | 1447 | if (pCtx->pAccessUnitList->uiAvailUnitsNum > 0) { |
| 1446 | pCtx->bAuReadyFlag = true; | 1448 | pCtx->bAuReadyFlag = true; |
| 1447 | pCtx->pAccessUnitList->uiEndPos = pCtx->pAccessUnitList->uiAvailUnitsNum - 1; | 1449 | pCtx->pAccessUnitList->uiEndPos = pCtx->pAccessUnitList->uiAvailUnitsNum - 1; |
| 1448 | } | 1450 | } |
| 1449 | } | 1451 | } |
| 1450 | } else { | 1452 | } else { |
| 1451 | memcpy (&pCtx->sPpsBuffer[uiPpsId], pPps, sizeof (SPps)); | 1453 | memcpy (&pCtx->sSpsPpsCtx.sPpsBuffer[uiPpsId], pPps, sizeof (SPps)); |
| 1452 | pCtx->bPpsAvailFlags[uiPpsId] = true; | 1454 | pCtx->sSpsPpsCtx.bPpsAvailFlags[uiPpsId] = true; |
| 1453 | } | 1455 | } |
| 1454 | if (pCtx->pParam->bParseOnly) { | 1456 | if (pCtx->pParam->bParseOnly) { |
| 1455 | if (kSrcNalLen >= SPS_PPS_BS_SIZE - 4) { //pps bs exceeds | 1457 | if (kSrcNalLen >= SPS_PPS_BS_SIZE - 4) { //pps bs exceeds |