Showing the changes to codec/decoder/core/src/decoder_core.cpp (1 of 64 files). Show all
Unified · Split
| @@ -427,27 +427,27 @@ bool FillDefaultSliceHeaderExt (PSliceHeaderExt pShExt, PNalUnitHeaderExt pNalEx · 426 unmodified lines | |||
| 427 | else | 427 | else |
| 428 | pShExt->bBasePredWeightTableFlag = true; | 428 | pShExt->bBasePredWeightTableFlag = true; |
| 429 | pShExt->uiRefLayerDqId = (uint8_t) - 1; | 429 | pShExt->uiRefLayerDqId = (uint8_t) - 1; |
| 430 | pShExt->uiDisableInterLayerDeblockingFilterIdc = 0; | 430 | pShExt->uiDisableInterLayerDeblockingFilterIdc = 0; |
| 431 | pShExt->iInterLayerSliceAlphaC0Offset = 0; | 431 | pShExt->iInterLayerSliceAlphaC0Offset = 0; |
| 432 | pShExt->iInterLayerSliceBetaOffset = 0; | 432 | pShExt->iInterLayerSliceBetaOffset = 0; |
| 433 | pShExt->bConstrainedIntraResamplingFlag = false; | 433 | pShExt->bConstrainedIntraResamplingFlag = false; |
| 434 | pShExt->uiRefLayerChromaPhaseXPlus1Flag = 0; | 434 | pShExt->uiRefLayerChromaPhaseXPlus1Flag = 0; |
| 435 | pShExt->uiRefLayerChromaPhaseYPlus1 = 1; | 435 | pShExt->uiRefLayerChromaPhaseYPlus1 = 1; |
| 436 | //memset(&pShExt->sScaledRefLayer, 0, sizeof(SPosOffset)); | 436 | //memset(&pShExt->sScaledRefLayer, 0, sizeof(SPosOffset)); |
| 437 | 437 | ||
| 438 | pShExt->iScaledRefLayerPicWidthInSampleLuma = pShExt->sSliceHeader.iMbWidth << 4; | 438 | pShExt->iScaledRefLayerPicWidthInSampleLuma = pShExt->sSliceHeader.iMbWidth << 4; |
| 439 | pShExt->iScaledRefLayerPicHeightInSampleLuma = pShExt->sSliceHeader.iMbHeight << 4; | 439 | pShExt->iScaledRefLayerPicHeightInSampleLuma = pShExt->sSliceHeader.iMbHeight << 4; |
| 440 | 440 | ||
| 441 | pShExt->bSliceSkipFlag = false; | 441 | pShExt->bSliceSkipFlag = false; |
| 442 | pShExt->bAdaptiveBaseModeFlag = false; | 442 | pShExt->bAdaptiveBaseModeFlag = false; |
| 443 | pShExt->bDefaultBaseModeFlag = false; | 443 | pShExt->bDefaultBaseModeFlag = false; |
| 444 | pShExt->bAdaptiveMotionPredFlag = false; | 444 | pShExt->bAdaptiveMotionPredFlag = false; |
| 445 | pShExt->bDefaultMotionPredFlag = false; | 445 | pShExt->bDefaultMotionPredFlag = false; |
| 446 | pShExt->bAdaptiveResidualPredFlag = false; | 446 | pShExt->bAdaptiveResidualPredFlag = false; |
| 447 | pShExt->bDefaultResidualPredFlag = false; | 447 | pShExt->bDefaultResidualPredFlag = false; |
| 448 | pShExt->bTCoeffLevelPredFlag = false; | 448 | pShExt->bTCoeffLevelPredFlag = false; |
| 449 | pShExt->uiScanIdxStart = 0; | 449 | pShExt->uiScanIdxStart = 0; |
| 450 | pShExt->uiScanIdxEnd = 15; | 450 | pShExt->uiScanIdxEnd = 15; |
| 451 | 451 | ||
| 452 | return true; | 452 | return true; |
| 453 | } | 453 | } |
| @@ -551,8 +551,8 @@ int32_t WelsInitMemory (PWelsDecoderContext pCtx) { · 97 unmodified lines | |||
| 551 | if (InitBsBuffer (pCtx) != 0) | 551 | if (InitBsBuffer (pCtx) != 0) |
| 552 | return ERR_INFO_OUT_OF_MEMORY; | 552 | return ERR_INFO_OUT_OF_MEMORY; |
| 553 | 553 | ||
| 554 | pCtx->uiTargetDqId = (uint8_t) - 1; | 554 | pCtx->uiTargetDqId = (uint8_t) - 1; |
| 555 | pCtx->bEndOfStreamFlag = false; | 555 | pCtx->bEndOfStreamFlag = false; |
| 556 | 556 | ||
| 557 | return ERR_NONE; | 557 | return ERR_NONE; |
| 558 | } | 558 | } |
| @@ -579,15 +579,15 @@ void WelsFreeMemory (PWelsDecoderContext pCtx) { · 20 unmodified lines | |||
| 579 | } | 579 | } |
| 580 | pCtx->sRawData.pHead = NULL; | 580 | pCtx->sRawData.pHead = NULL; |
| 581 | pCtx->sRawData.pEnd = NULL; | 581 | pCtx->sRawData.pEnd = NULL; |
| 582 | pCtx->sRawData.pStartPos = NULL; | 582 | pCtx->sRawData.pStartPos = NULL; |
| 583 | pCtx->sRawData.pCurPos = NULL; | 583 | pCtx->sRawData.pCurPos = NULL; |
| 584 | if (pCtx->bParseOnly) { | 584 | if (pCtx->bParseOnly) { |
| 585 | if (pCtx->sSavedData.pHead) { | 585 | if (pCtx->sSavedData.pHead) { |
| 586 | WelsFree (pCtx->sSavedData.pHead, "pCtx->sSavedData->pHead"); | 586 | WelsFree (pCtx->sSavedData.pHead, "pCtx->sSavedData->pHead"); |
| 587 | } | 587 | } |
| 588 | pCtx->sSavedData.pHead = NULL; | 588 | pCtx->sSavedData.pHead = NULL; |
| 589 | pCtx->sSavedData.pEnd = NULL; | 589 | pCtx->sSavedData.pEnd = NULL; |
| 590 | pCtx->sSavedData.pStartPos = NULL; | 590 | pCtx->sSavedData.pStartPos = NULL; |
| 591 | pCtx->sSavedData.pCurPos = NULL; | 591 | pCtx->sSavedData.pCurPos = NULL; |
| 592 | if (pCtx->pParserBsInfo) { | 592 | if (pCtx->pParserBsInfo) { |
| 593 | if (pCtx->pParserBsInfo->pDstBuff) { | 593 | if (pCtx->pParserBsInfo->pDstBuff) { |
| @@ -610,20 +610,20 @@ void DecodeNalHeaderExt (PNalUnit pNal, uint8_t* pSrc) { · 16 unmodified lines | |||
| 610 | PNalUnitHeaderExt pHeaderExt = &pNal->sNalHeaderExt; | 610 | PNalUnitHeaderExt pHeaderExt = &pNal->sNalHeaderExt; |
| 611 | 611 | ||
| 612 | uint8_t uiCurByte = *pSrc; | 612 | uint8_t uiCurByte = *pSrc; |
| 613 | pHeaderExt->bIdrFlag = !! (uiCurByte & 0x40); | 613 | pHeaderExt->bIdrFlag = !! (uiCurByte & 0x40); |
| 614 | pHeaderExt->uiPriorityId = uiCurByte & 0x3F; | 614 | pHeaderExt->uiPriorityId = uiCurByte & 0x3F; |
| 615 | 615 | ||
| 616 | uiCurByte = * (++pSrc); | 616 | uiCurByte = * (++pSrc); |
| 617 | pHeaderExt->iNoInterLayerPredFlag = uiCurByte >> 7; | 617 | pHeaderExt->iNoInterLayerPredFlag = uiCurByte >> 7; |
| 618 | pHeaderExt->uiDependencyId = (uiCurByte & 0x70) >> 4; | 618 | pHeaderExt->uiDependencyId = (uiCurByte & 0x70) >> 4; |
| 619 | pHeaderExt->uiQualityId = uiCurByte & 0x0F; | 619 | pHeaderExt->uiQualityId = uiCurByte & 0x0F; |
| 620 | uiCurByte = * (++pSrc); | 620 | uiCurByte = * (++pSrc); |
| 621 | pHeaderExt->uiTemporalId = uiCurByte >> 5; | 621 | pHeaderExt->uiTemporalId = uiCurByte >> 5; |
| 622 | pHeaderExt->bUseRefBasePicFlag = !! (uiCurByte & 0x10); | 622 | pHeaderExt->bUseRefBasePicFlag = !! (uiCurByte & 0x10); |
| 623 | pHeaderExt->bDiscardableFlag = !! (uiCurByte & 0x08); | 623 | pHeaderExt->bDiscardableFlag = !! (uiCurByte & 0x08); |
| 624 | pHeaderExt->bOutputFlag = !! (uiCurByte & 0x04); | 624 | pHeaderExt->bOutputFlag = !! (uiCurByte & 0x04); |
| 625 | pHeaderExt->uiReservedThree2Bits = uiCurByte & 0x03; | 625 | pHeaderExt->uiReservedThree2Bits = uiCurByte & 0x03; |
| 626 | pHeaderExt->uiLayerDqId = (pHeaderExt->uiDependencyId << 4) | pHeaderExt->uiQualityId; | 626 | pHeaderExt->uiLayerDqId = (pHeaderExt->uiDependencyId << 4) | pHeaderExt->uiQualityId; |
| 627 | } | 627 | } |
| 628 | 628 | ||
| 629 | 629 | ||
| @@ -640,21 +640,21 @@ void DecodeNalHeaderExt (PNalUnit pNal, uint8_t* pSrc) { · 10 unmodified lines | |||
| 640 | * Parse slice header of bitstream in avc for storing data structure | 640 | * Parse slice header of bitstream in avc for storing data structure |
| 641 | */ | 641 | */ |
| 642 | int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, const bool kbExtensionFlag) { | 642 | int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, const bool kbExtensionFlag) { |
| 643 | PNalUnit const kpCurNal = pCtx->pAccessUnitList->pNalUnitsList[pCtx->pAccessUnitList->uiAvailUnitsNum - 1]; | 643 | PNalUnit const kpCurNal = pCtx->pAccessUnitList->pNalUnitsList[pCtx->pAccessUnitList->uiAvailUnitsNum - 1]; |
| 644 | 644 | ||
| 645 | PNalUnitHeaderExt pNalHeaderExt = NULL; | 645 | PNalUnitHeaderExt pNalHeaderExt = NULL; |
| 646 | PSliceHeader pSliceHead = NULL; | 646 | PSliceHeader pSliceHead = NULL; |
| 647 | PSliceHeaderExt pSliceHeadExt = NULL; | 647 | PSliceHeaderExt pSliceHeadExt = NULL; |
| 648 | PSubsetSps pSubsetSps = NULL; | 648 | PSubsetSps pSubsetSps = NULL; |
| 649 | PSps pSps = NULL; | 649 | PSps pSps = NULL; |
| 650 | PPps pPps = NULL; | 650 | PPps pPps = NULL; |
| 651 | EWelsNalUnitType eNalType = static_cast<EWelsNalUnitType> (0); | 651 | EWelsNalUnitType eNalType = static_cast<EWelsNalUnitType> (0); |
| 652 | int32_t iPpsId = 0; | 652 | int32_t iPpsId = 0; |
| 653 | int32_t iRet = ERR_NONE; | 653 | int32_t iRet = ERR_NONE; |
| 654 | uint8_t uiSliceType = 0; | 654 | uint8_t uiSliceType = 0; |
| 655 | uint8_t uiQualityId = BASE_QUALITY_ID; | 655 | uint8_t uiQualityId = BASE_QUALITY_ID; |
| 656 | bool bIdrFlag = false; | 656 | bool bIdrFlag = false; |
| 657 | bool bSgChangeCycleInvolved = false; // involved slice group change cycle ? | 657 | bool bSgChangeCycleInvolved = false; // involved slice group change cycle ? |
| 658 | uint32_t uiCode; | 658 | uint32_t uiCode; |
| 659 | int32_t iCode; | 659 | int32_t iCode; |
| 660 | SLogContext* pLogCtx = & (pCtx->sLogCtx); | 660 | SLogContext* pLogCtx = & (pCtx->sLogCtx); |
| @@ -663,11 +663,11 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 2 unmodified lines | |||
| 663 | return ERR_INFO_OUT_OF_MEMORY; | 663 | return ERR_INFO_OUT_OF_MEMORY; |
| 664 | } | 664 | } |
| 665 | 665 | ||
| 666 | pNalHeaderExt = &kpCurNal->sNalHeaderExt; | 666 | pNalHeaderExt = &kpCurNal->sNalHeaderExt; |
| 667 | pSliceHead = &kpCurNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader; | 667 | pSliceHead = &kpCurNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader; |
| 668 | eNalType = pNalHeaderExt->sNalUnitHeader.eNalUnitType; | 668 | eNalType = pNalHeaderExt->sNalUnitHeader.eNalUnitType; |
| 669 | 669 | ||
| 670 | pSliceHeadExt = &kpCurNal->sNalData.sVclNal.sSliceHeaderExt; | 670 | pSliceHeadExt = &kpCurNal->sNalData.sVclNal.sSliceHeaderExt; |
| 671 | 671 | ||
| 672 | if (pSliceHeadExt) { | 672 | if (pSliceHeadExt) { |
| 673 | SRefBasePicMarking sBaseMarking; | 673 | SRefBasePicMarking sBaseMarking; |
| @@ -746,7 +746,7 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 72 unmodified lines | |||
| 746 | 746 | ||
| 747 | if (kbExtensionFlag) { | 747 | if (kbExtensionFlag) { |
| 748 | pSubsetSps = &pCtx->sSubsetSpsBuffer[pPps->iSpsId]; | 748 | pSubsetSps = &pCtx->sSubsetSpsBuffer[pPps->iSpsId]; |
| 749 | pSps = &pSubsetSps->sSps; | 749 | pSps = &pSubsetSps->sSps; |
| 750 | if (pCtx->bSubspsAvailFlags[pPps->iSpsId] == false) { | 750 | if (pCtx->bSubspsAvailFlags[pPps->iSpsId] == false) { |
| 751 | pCtx->sDecoderStatistics.iSubSpsReportErrorNum++; | 751 | pCtx->sDecoderStatistics.iSubSpsReportErrorNum++; |
| 752 | if (pCtx->iSubSPSLastInvalidId != pPps->iSpsId) { | 752 | if (pCtx->iSubSPSLastInvalidId != pPps->iSpsId) { |
| @@ -798,15 +798,15 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 45 unmodified lines | |||
| 798 | WELS_READ_VERIFY (BsGetBits (pBs, pSps->uiLog2MaxFrameNum, &uiCode)); //frame_num | 798 | WELS_READ_VERIFY (BsGetBits (pBs, pSps->uiLog2MaxFrameNum, &uiCode)); //frame_num |
| 799 | pSliceHead->iFrameNum = uiCode; | 799 | pSliceHead->iFrameNum = uiCode; |
| 800 | 800 | ||
| 801 | pSliceHead->bFieldPicFlag = false; | 801 | pSliceHead->bFieldPicFlag = false; |
| 802 | pSliceHead->bBottomFiledFlag = false; | 802 | pSliceHead->bBottomFiledFlag = false; |
| 803 | if (!pSps->bFrameMbsOnlyFlag) { | 803 | if (!pSps->bFrameMbsOnlyFlag) { |
| 804 | WelsLog (pLogCtx, WELS_LOG_WARNING, "ParseSliceHeaderSyntaxs(): frame_mbs_only_flag = %d not supported. ", | 804 | WelsLog (pLogCtx, WELS_LOG_WARNING, "ParseSliceHeaderSyntaxs(): frame_mbs_only_flag = %d not supported. ", |
| 805 | pSps->bFrameMbsOnlyFlag); | 805 | pSps->bFrameMbsOnlyFlag); |
| 806 | return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_UNSUPPORTED_MBAFF); | 806 | return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_UNSUPPORTED_MBAFF); |
| 807 | } | 807 | } |
| 808 | pSliceHead->iMbWidth = pSps->iMbWidth; | 808 | pSliceHead->iMbWidth = pSps->iMbWidth; |
| 809 | pSliceHead->iMbHeight = pSps->iMbHeight / (1 + pSliceHead->bFieldPicFlag); | 809 | pSliceHead->iMbHeight = pSps->iMbHeight / (1 + pSliceHead->bFieldPicFlag); |
| 810 | 810 | ||
| 811 | if (bIdrFlag) { | 811 | if (bIdrFlag) { |
| 812 | if (pSliceHead->iFrameNum != 0) { | 812 | if (pSliceHead->iFrameNum != 0) { |
| @@ -825,9 +825,9 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 12 unmodified lines | |||
| 825 | #endif | 825 | #endif |
| 826 | } | 826 | } |
| 827 | 827 | ||
| 828 | pSliceHead->iDeltaPicOrderCntBottom = 0; | 828 | pSliceHead->iDeltaPicOrderCntBottom = 0; |
| 829 | pSliceHead->iDeltaPicOrderCnt[0] = | 829 | pSliceHead->iDeltaPicOrderCnt[0] = |
| 830 | pSliceHead->iDeltaPicOrderCnt[1] = 0; | 830 | pSliceHead->iDeltaPicOrderCnt[1] = 0; |
| 831 | if (pSps->uiPocType == 0) { | 831 | if (pSps->uiPocType == 0) { |
| 832 | WELS_READ_VERIFY (BsGetBits (pBs, pSps->iLog2MaxPocLsb, &uiCode)); //pic_order_cnt_lsb | 832 | WELS_READ_VERIFY (BsGetBits (pBs, pSps->iLog2MaxPocLsb, &uiCode)); //pic_order_cnt_lsb |
| 833 | pSliceHead->iPicOrderCntLsb = uiCode; | 833 | pSliceHead->iPicOrderCntLsb = uiCode; |
| @@ -854,8 +854,8 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 20 unmodified lines | |||
| 854 | } | 854 | } |
| 855 | 855 | ||
| 856 | //set defaults, might be overriden a few line later | 856 | //set defaults, might be overriden a few line later |
| 857 | pSliceHead->uiRefCount[0] = pPps->uiNumRefIdxL0Active; | 857 | pSliceHead->uiRefCount[0] = pPps->uiNumRefIdxL0Active; |
| 858 | pSliceHead->uiRefCount[1] = pPps->uiNumRefIdxL1Active; | 858 | pSliceHead->uiRefCount[1] = pPps->uiNumRefIdxL1Active; |
| 859 | 859 | ||
| 860 | bool bReadNumRefFlag = (P_SLICE == uiSliceType); | 860 | bool bReadNumRefFlag = (P_SLICE == uiSliceType); |
| 861 | if (kbExtensionFlag) { | 861 | if (kbExtensionFlag) { |
| @@ -928,8 +928,8 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 66 unmodified lines | |||
| 928 | } | 928 | } |
| 929 | 929 | ||
| 930 | WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //slice_qp_delta | 930 | WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //slice_qp_delta |
| 931 | pSliceHead->iSliceQpDelta = iCode; | 931 | pSliceHead->iSliceQpDelta = iCode; |
| 932 | pSliceHead->iSliceQp = pPps->iPicInitQp + pSliceHead->iSliceQpDelta; | 932 | pSliceHead->iSliceQp = pPps->iPicInitQp + pSliceHead->iSliceQpDelta; |
| 933 | if (pSliceHead->iSliceQp < 0 || pSliceHead->iSliceQp > 51) { | 933 | if (pSliceHead->iSliceQp < 0 || pSliceHead->iSliceQp > 51) { |
| 934 | WelsLog (pLogCtx, WELS_LOG_WARNING, "QP %d out of range", pSliceHead->iSliceQp); | 934 | WelsLog (pLogCtx, WELS_LOG_WARNING, "QP %d out of range", pSliceHead->iSliceQp); |
| 935 | return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_QP); | 935 | return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_QP); |
| @@ -943,9 +943,9 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 7 unmodified lines | |||
| 943 | } | 943 | } |
| 944 | } | 944 | } |
| 945 | 945 | ||
| 946 | pSliceHead->uiDisableDeblockingFilterIdc = 0; | 946 | pSliceHead->uiDisableDeblockingFilterIdc = 0; |
| 947 | pSliceHead->iSliceAlphaC0Offset = 0; | 947 | pSliceHead->iSliceAlphaC0Offset = 0; |
| 948 | pSliceHead->iSliceBetaOffset = 0; | 948 | pSliceHead->iSliceBetaOffset = 0; |
| 949 | if (pPps->bDeblockingFilterControlPresentFlag) { | 949 | if (pPps->bDeblockingFilterControlPresentFlag) { |
| 950 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //disable_deblocking_filter_idc | 950 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //disable_deblocking_filter_idc |
| 951 | pSliceHead->uiDisableDeblockingFilterIdc = uiCode; | 951 | pSliceHead->uiDisableDeblockingFilterIdc = uiCode; |
| @@ -1017,21 +1017,21 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 65 unmodified lines | |||
| 1017 | } | 1017 | } |
| 1018 | } | 1018 | } |
| 1019 | 1019 | ||
| 1020 | pSliceHeadExt->uiRefLayerChromaPhaseXPlus1Flag = pSubsetSps->sSpsSvcExt.uiSeqRefLayerChromaPhaseXPlus1Flag; | 1020 | pSliceHeadExt->uiRefLayerChromaPhaseXPlus1Flag = pSubsetSps->sSpsSvcExt.uiSeqRefLayerChromaPhaseXPlus1Flag; |
| 1021 | pSliceHeadExt->uiRefLayerChromaPhaseYPlus1 = pSubsetSps->sSpsSvcExt.uiSeqRefLayerChromaPhaseYPlus1; | 1021 | pSliceHeadExt->uiRefLayerChromaPhaseYPlus1 = pSubsetSps->sSpsSvcExt.uiSeqRefLayerChromaPhaseYPlus1; |
| 1022 | 1022 | ||
| 1023 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //constrained_intra_resampling_flag | 1023 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //constrained_intra_resampling_flag |
| 1024 | pSliceHeadExt->bConstrainedIntraResamplingFlag = !!uiCode; | 1024 | pSliceHeadExt->bConstrainedIntraResamplingFlag = !!uiCode; |
| 1025 | 1025 | ||
| 1026 | { | 1026 | { |
| 1027 | SPosOffset pos; | 1027 | SPosOffset pos; |
| 1028 | pos.iLeftOffset = pSubsetSps->sSpsSvcExt.sSeqScaledRefLayer.iLeftOffset; | 1028 | pos.iLeftOffset = pSubsetSps->sSpsSvcExt.sSeqScaledRefLayer.iLeftOffset; |
| 1029 | pos.iTopOffset = pSubsetSps->sSpsSvcExt.sSeqScaledRefLayer.iTopOffset * (2 - pSps->bFrameMbsOnlyFlag); | 1029 | pos.iTopOffset = pSubsetSps->sSpsSvcExt.sSeqScaledRefLayer.iTopOffset * (2 - pSps->bFrameMbsOnlyFlag); |
| 1030 | pos.iRightOffset = pSubsetSps->sSpsSvcExt.sSeqScaledRefLayer.iRightOffset; | 1030 | pos.iRightOffset = pSubsetSps->sSpsSvcExt.sSeqScaledRefLayer.iRightOffset; |
| 1031 | pos.iBottomOffset = pSubsetSps->sSpsSvcExt.sSeqScaledRefLayer.iBottomOffset * (2 - pSps->bFrameMbsOnlyFlag); | 1031 | pos.iBottomOffset = pSubsetSps->sSpsSvcExt.sSeqScaledRefLayer.iBottomOffset * (2 - pSps->bFrameMbsOnlyFlag); |
| 1032 | //memcpy(&pSliceHeadExt->sScaledRefLayer, &pos, sizeof(SPosOffset));//confirmed_safe_unsafe_usage | 1032 | //memcpy(&pSliceHeadExt->sScaledRefLayer, &pos, sizeof(SPosOffset));//confirmed_safe_unsafe_usage |
| 1033 | pSliceHeadExt->iScaledRefLayerPicWidthInSampleLuma = (pSliceHead->iMbWidth << 4) - (pos.iLeftOffset + pos.iRightOffset); | 1033 | pSliceHeadExt->iScaledRefLayerPicWidthInSampleLuma = (pSliceHead->iMbWidth << 4) - (pos.iLeftOffset + pos.iRightOffset); |
| 1034 | pSliceHeadExt->iScaledRefLayerPicHeightInSampleLuma = (pSliceHead->iMbHeight << 4) - | 1034 | pSliceHeadExt->iScaledRefLayerPicHeightInSampleLuma = (pSliceHead->iMbHeight << 4) - |
| 1035 | (pos.iTopOffset + pos.iBottomOffset) / (1 + pSliceHead->bFieldPicFlag); | 1035 | (pos.iTopOffset + pos.iBottomOffset) / (1 + pSliceHead->bFieldPicFlag); |
| 1036 | } | 1036 | } |
| 1037 | } else if (uiQualityId > BASE_QUALITY_ID) { | 1037 | } else if (uiQualityId > BASE_QUALITY_ID) { |
| @@ -1041,17 +1041,17 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 3 unmodified lines | |||
| 1041 | pSliceHeadExt->uiRefLayerDqId = (uint8_t) - 1; | 1041 | pSliceHeadExt->uiRefLayerDqId = (uint8_t) - 1; |
| 1042 | } | 1042 | } |
| 1043 | 1043 | ||
| 1044 | pSliceHeadExt->bSliceSkipFlag = false; | 1044 | pSliceHeadExt->bSliceSkipFlag = false; |
| 1045 | pSliceHeadExt->bAdaptiveBaseModeFlag = false; | 1045 | pSliceHeadExt->bAdaptiveBaseModeFlag = false; |
| 1046 | pSliceHeadExt->bDefaultBaseModeFlag = false; | 1046 | pSliceHeadExt->bDefaultBaseModeFlag = false; |
| 1047 | pSliceHeadExt->bAdaptiveMotionPredFlag = false; | 1047 | pSliceHeadExt->bAdaptiveMotionPredFlag = false; |
| 1048 | pSliceHeadExt->bDefaultMotionPredFlag = false; | 1048 | pSliceHeadExt->bDefaultMotionPredFlag = false; |
| 1049 | pSliceHeadExt->bAdaptiveResidualPredFlag = false; | 1049 | pSliceHeadExt->bAdaptiveResidualPredFlag = false; |
| 1050 | pSliceHeadExt->bDefaultResidualPredFlag = false; | 1050 | pSliceHeadExt->bDefaultResidualPredFlag = false; |
| 1051 | if (pNalHeaderExt->iNoInterLayerPredFlag) | 1051 | if (pNalHeaderExt->iNoInterLayerPredFlag) |
| 1052 | pSliceHeadExt->bTCoeffLevelPredFlag = false; | 1052 | pSliceHeadExt->bTCoeffLevelPredFlag = false; |
| 1053 | else | 1053 | else |
| 1054 | pSliceHeadExt->bTCoeffLevelPredFlag = pSubsetSps->sSpsSvcExt.bSeqTCoeffLevelPredFlag; | 1054 | pSliceHeadExt->bTCoeffLevelPredFlag = pSubsetSps->sSpsSvcExt.bSeqTCoeffLevelPredFlag; |
| 1055 | 1055 | ||
| 1056 | if (!pNalHeaderExt->iNoInterLayerPredFlag) { | 1056 | if (!pNalHeaderExt->iNoInterLayerPredFlag) { |
| 1057 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //slice_skip_flag | 1057 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //slice_skip_flag |
| @@ -1099,8 +1099,8 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 41 unmodified lines | |||
| 1099 | return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_UNSUPPORTED_MGS); | 1099 | return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_UNSUPPORTED_MGS); |
| 1100 | } | 1100 | } |
| 1101 | } else { | 1101 | } else { |
| 1102 | pSliceHeadExt->uiScanIdxStart = 0; | 1102 | pSliceHeadExt->uiScanIdxStart = 0; |
| 1103 | pSliceHeadExt->uiScanIdxEnd = 15; | 1103 | pSliceHeadExt->uiScanIdxEnd = 15; |
| 1104 | } | 1104 | } |
| 1105 | } | 1105 | } |
| 1106 | 1106 | ||
| @@ -1122,24 +1122,24 @@ bool PrefetchNalHeaderExtSyntax (PWelsDecoderContext pCtx, PNalUnit const kppDst · 15 unmodified lines | |||
| 1122 | if (kppDst == NULL || kpSrc == NULL) | 1122 | if (kppDst == NULL || kpSrc == NULL) |
| 1123 | return false; | 1123 | return false; |
| 1124 | 1124 | ||
| 1125 | pNalHdrExtD = &kppDst->sNalHeaderExt; | 1125 | pNalHdrExtD = &kppDst->sNalHeaderExt; |
| 1126 | pNalHdrExtS = &kpSrc->sNalHeaderExt; | 1126 | pNalHdrExtS = &kpSrc->sNalHeaderExt; |
| 1127 | pShExtD = &kppDst->sNalData.sVclNal.sSliceHeaderExt; | 1127 | pShExtD = &kppDst->sNalData.sVclNal.sSliceHeaderExt; |
| 1128 | pPrefixS = &kpSrc->sNalData.sPrefixNal; | 1128 | pPrefixS = &kpSrc->sNalData.sPrefixNal; |
| 1129 | pSps = &pCtx->sSpsBuffer[pCtx->sPpsBuffer[pShExtD->sSliceHeader.iPpsId].iSpsId]; | 1129 | pSps = &pCtx->sSpsBuffer[pCtx->sPpsBuffer[pShExtD->sSliceHeader.iPpsId].iSpsId]; |
| 1130 | 1130 | ||
| 1131 | pNalHdrExtD->uiDependencyId = pNalHdrExtS->uiDependencyId; | 1131 | pNalHdrExtD->uiDependencyId = pNalHdrExtS->uiDependencyId; |
| 1132 | pNalHdrExtD->uiQualityId = pNalHdrExtS->uiQualityId; | 1132 | pNalHdrExtD->uiQualityId = pNalHdrExtS->uiQualityId; |
| 1133 | pNalHdrExtD->uiTemporalId = pNalHdrExtS->uiTemporalId; | 1133 | pNalHdrExtD->uiTemporalId = pNalHdrExtS->uiTemporalId; |
| 1134 | pNalHdrExtD->uiPriorityId = pNalHdrExtS->uiPriorityId; | 1134 | pNalHdrExtD->uiPriorityId = pNalHdrExtS->uiPriorityId; |
| 1135 | pNalHdrExtD->bIdrFlag = pNalHdrExtS->bIdrFlag; | 1135 | pNalHdrExtD->bIdrFlag = pNalHdrExtS->bIdrFlag; |
| 1136 | pNalHdrExtD->iNoInterLayerPredFlag = pNalHdrExtS->iNoInterLayerPredFlag; | 1136 | pNalHdrExtD->iNoInterLayerPredFlag = pNalHdrExtS->iNoInterLayerPredFlag; |
| 1137 | pNalHdrExtD->bDiscardableFlag = pNalHdrExtS->bDiscardableFlag; | 1137 | pNalHdrExtD->bDiscardableFlag = pNalHdrExtS->bDiscardableFlag; |
| 1138 | pNalHdrExtD->bOutputFlag = pNalHdrExtS->bOutputFlag; | 1138 | pNalHdrExtD->bOutputFlag = pNalHdrExtS->bOutputFlag; |
| 1139 | pNalHdrExtD->bUseRefBasePicFlag = pNalHdrExtS->bUseRefBasePicFlag; | 1139 | pNalHdrExtD->bUseRefBasePicFlag = pNalHdrExtS->bUseRefBasePicFlag; |
| 1140 | pNalHdrExtD->uiLayerDqId = pNalHdrExtS->uiLayerDqId; | 1140 | pNalHdrExtD->uiLayerDqId = pNalHdrExtS->uiLayerDqId; |
| 1141 | 1141 | ||
| 1142 | pShExtD->bStoreRefBasePicFlag = pPrefixS->bStoreRefBasePicFlag; | 1142 | pShExtD->bStoreRefBasePicFlag = pPrefixS->bStoreRefBasePicFlag; |
| 1143 | memcpy (&pShExtD->sRefBasePicMarking, &pPrefixS->sRefPicBaseMarking, | 1143 | memcpy (&pShExtD->sRefBasePicMarking, &pPrefixS->sRefPicBaseMarking, |
| 1144 | sizeof (SRefBasePicMarking)); //confirmed_safe_unsafe_usage | 1144 | sizeof (SRefBasePicMarking)); //confirmed_safe_unsafe_usage |
| 1145 | if (pShExtD->sRefBasePicMarking.bAdaptiveRefBasePicMarkingModeFlag) { | 1145 | if (pShExtD->sRefBasePicMarking.bAdaptiveRefBasePicMarkingModeFlag) { |
| @@ -1161,7 +1161,7 @@ bool PrefetchNalHeaderExtSyntax (PWelsDecoderContext pCtx, PNalUnit const kppDst · 15 unmodified lines | |||
| 1161 | 1161 | ||
| 1162 | 1162 | ||
| 1163 | int32_t UpdateAccessUnit (PWelsDecoderContext pCtx) { | 1163 | int32_t UpdateAccessUnit (PWelsDecoderContext pCtx) { |
| 1164 | PAccessUnit pCurAu = pCtx->pAccessUnitList; | 1164 | PAccessUnit pCurAu = pCtx->pAccessUnitList; |
| 1165 | int32_t iIdx = pCurAu->uiEndPos; | 1165 | int32_t iIdx = pCurAu->uiEndPos; |
| 1166 | 1166 | ||
| 1167 | // Conversed iterator | 1167 | // Conversed iterator |
| @@ -1211,8 +1211,8 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid · 43 unmodified lines | |||
| 1211 | int32_t i = 0; | 1211 | int32_t i = 0; |
| 1212 | 1212 | ||
| 1213 | WELS_VERIFY_RETURN_IF (ERR_INFO_INVALID_PARAM, (NULL == pCtx || kiMaxWidth <= 0 || kiMaxHeight <= 0)) | 1213 | WELS_VERIFY_RETURN_IF (ERR_INFO_INVALID_PARAM, (NULL == pCtx || kiMaxWidth <= 0 || kiMaxHeight <= 0)) |
| 1214 | pCtx->sMb.iMbWidth = (kiMaxWidth + 15) >> 4; | 1214 | pCtx->sMb.iMbWidth = (kiMaxWidth + 15) >> 4; |
| 1215 | pCtx->sMb.iMbHeight = (kiMaxHeight + 15) >> 4; | 1215 | pCtx->sMb.iMbHeight = (kiMaxHeight + 15) >> 4; |
| 1216 | 1216 | ||
| 1217 | if (pCtx->bInitialDqLayersMem && kiMaxWidth <= pCtx->iPicWidthReq | 1217 | if (pCtx->bInitialDqLayersMem && kiMaxWidth <= pCtx->iPicWidthReq |
| 1218 | && kiMaxHeight <= pCtx->iPicHeightReq) // have same dimension memory, skipped | 1218 | && kiMaxHeight <= pCtx->iPicHeightReq) // have same dimension memory, skipped |
| @@ -1313,9 +1313,9 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid · 94 unmodified lines | |||
| 1313 | ++ i; | 1313 | ++ i; |
| 1314 | } while (i < LAYER_NUM_EXCHANGEABLE); | 1314 | } while (i < LAYER_NUM_EXCHANGEABLE); |
| 1315 | 1315 | ||
| 1316 | pCtx->bInitialDqLayersMem = true; | 1316 | pCtx->bInitialDqLayersMem = true; |
| 1317 | pCtx->iPicWidthReq = kiMaxWidth; | 1317 | pCtx->iPicWidthReq = kiMaxWidth; |
| 1318 | pCtx->iPicHeightReq = kiMaxHeight; | 1318 | pCtx->iPicHeightReq = kiMaxHeight; |
| 1319 | 1319 | ||
| 1320 | return ERR_NONE; | 1320 | return ERR_NONE; |
| 1321 | } | 1321 | } |
| @@ -1478,22 +1478,22 @@ void UninitialDqLayersContext (PWelsDecoderContext pCtx) { · 156 unmodified lines | |||
| 1478 | ++ i; | 1478 | ++ i; |
| 1479 | } while (i < LAYER_NUM_EXCHANGEABLE); | 1479 | } while (i < LAYER_NUM_EXCHANGEABLE); |
| 1480 | 1480 | ||
| 1481 | pCtx->iPicWidthReq = 0; | 1481 | pCtx->iPicWidthReq = 0; |
| 1482 | pCtx->iPicHeightReq = 0; | 1482 | pCtx->iPicHeightReq = 0; |
| 1483 | pCtx->bInitialDqLayersMem = false; | 1483 | pCtx->bInitialDqLayersMem = false; |
| 1484 | } | 1484 | } |
| 1485 | 1485 | ||
| 1486 | void ResetCurrentAccessUnit (PWelsDecoderContext pCtx) { | 1486 | void ResetCurrentAccessUnit (PWelsDecoderContext pCtx) { |
| 1487 | PAccessUnit pCurAu = pCtx->pAccessUnitList; | 1487 | PAccessUnit pCurAu = pCtx->pAccessUnitList; |
| 1488 | pCurAu->uiStartPos = 0; | 1488 | pCurAu->uiStartPos = 0; |
| 1489 | pCurAu->uiEndPos = 0; | 1489 | pCurAu->uiEndPos = 0; |
| 1490 | pCurAu->bCompletedAuFlag = false; | 1490 | pCurAu->bCompletedAuFlag = false; |
| 1491 | if (pCurAu->uiActualUnitsNum > 0) { | 1491 | if (pCurAu->uiActualUnitsNum > 0) { |
| 1492 | uint32_t iIdx = 0; | 1492 | uint32_t iIdx = 0; |
| 1493 | const uint32_t kuiActualNum = pCurAu->uiActualUnitsNum; | 1493 | const uint32_t kuiActualNum = pCurAu->uiActualUnitsNum; |
| 1494 | // a more simpler method to do nal units list management prefered here | 1494 | // a more simpler method to do nal units list management prefered here |
| 1495 | const uint32_t kuiAvailNum = pCurAu->uiAvailUnitsNum; | 1495 | const uint32_t kuiAvailNum = pCurAu->uiAvailUnitsNum; |
| 1496 | const uint32_t kuiLeftNum = kuiAvailNum - kuiActualNum; | 1496 | const uint32_t kuiLeftNum = kuiAvailNum - kuiActualNum; |
| 1497 | 1497 | ||
| 1498 | // Swapping active nal unit nodes of succeeding AU with leading of list | 1498 | // Swapping active nal unit nodes of succeeding AU with leading of list |
| 1499 | while (iIdx < kuiLeftNum) { | 1499 | while (iIdx < kuiLeftNum) { |
| @@ -1512,27 +1512,27 @@ void ResetCurrentAccessUnit (PWelsDecoderContext pCtx) { · 12 unmodified lines | |||
| 1512 | * \history 11/16/2009 | 1512 | * \history 11/16/2009 |
| 1513 | */ | 1513 | */ |
| 1514 | void ForceResetCurrentAccessUnit (PAccessUnit pAu) { | 1514 | void ForceResetCurrentAccessUnit (PAccessUnit pAu) { |
| 1515 | uint32_t uiSucAuIdx = pAu->uiEndPos + 1; | 1515 | uint32_t uiSucAuIdx = pAu->uiEndPos + 1; |
| 1516 | uint32_t uiCurAuIdx = 0; | 1516 | uint32_t uiCurAuIdx = 0; |
| 1517 | 1517 | ||
| 1518 | // swap the succeeding AU's nal units to the front | 1518 | // swap the succeeding AU's nal units to the front |
| 1519 | while (uiSucAuIdx < pAu->uiAvailUnitsNum) { | 1519 | while (uiSucAuIdx < pAu->uiAvailUnitsNum) { |
| 1520 | PNalUnit t = pAu->pNalUnitsList[uiSucAuIdx]; | 1520 | PNalUnit t = pAu->pNalUnitsList[uiSucAuIdx]; |
| 1521 | pAu->pNalUnitsList[uiSucAuIdx] = pAu->pNalUnitsList[uiCurAuIdx]; | 1521 | pAu->pNalUnitsList[uiSucAuIdx] = pAu->pNalUnitsList[uiCurAuIdx]; |
| 1522 | pAu->pNalUnitsList[uiCurAuIdx] = t; | 1522 | pAu->pNalUnitsList[uiCurAuIdx] = t; |
| 1523 | ++ uiSucAuIdx; | 1523 | ++ uiSucAuIdx; |
| 1524 | ++ uiCurAuIdx; | 1524 | ++ uiCurAuIdx; |
| 1525 | } | 1525 | } |
| 1526 | 1526 | ||
| 1527 | // Update avail/actual units num accordingly for next AU parsing | 1527 | // Update avail/actual units num accordingly for next AU parsing |
| 1528 | if (pAu->uiAvailUnitsNum > pAu->uiEndPos) | 1528 | if (pAu->uiAvailUnitsNum > pAu->uiEndPos) |
| 1529 | pAu->uiAvailUnitsNum -= (pAu->uiEndPos + 1); | 1529 | pAu->uiAvailUnitsNum -= (pAu->uiEndPos + 1); |
| 1530 | else | 1530 | else |
| 1531 | pAu->uiAvailUnitsNum = 0; | 1531 | pAu->uiAvailUnitsNum = 0; |
| 1532 | pAu->uiActualUnitsNum = 0; | 1532 | pAu->uiActualUnitsNum = 0; |
| 1533 | pAu->uiStartPos = 0; | 1533 | pAu->uiStartPos = 0; |
| 1534 | pAu->uiEndPos = 0; | 1534 | pAu->uiEndPos = 0; |
| 1535 | pAu->bCompletedAuFlag = false; | 1535 | pAu->bCompletedAuFlag = false; |
| 1536 | } | 1536 | } |
| 1537 | 1537 | ||
| 1538 | //clear current corrupted NAL from pNalUnitsList | 1538 | //clear current corrupted NAL from pNalUnitsList |
| @@ -1547,11 +1547,11 @@ void ForceResetParaSetStatusAndAUList (PWelsDecoderContext pCtx) { · 8 unmodified lines | |||
| 1547 | pCtx->bPpsExistAheadFlag = false; | 1547 | pCtx->bPpsExistAheadFlag = false; |
| 1548 | 1548 | ||
| 1549 | // Force clear the AU list | 1549 | // Force clear the AU list |
| 1550 | pCtx->pAccessUnitList->uiAvailUnitsNum = 0; | 1550 | pCtx->pAccessUnitList->uiAvailUnitsNum = 0; |
| 1551 | pCtx->pAccessUnitList->uiActualUnitsNum = 0; | 1551 | pCtx->pAccessUnitList->uiActualUnitsNum = 0; |
| 1552 | pCtx->pAccessUnitList->uiStartPos = 0; | 1552 | pCtx->pAccessUnitList->uiStartPos = 0; |
| 1553 | pCtx->pAccessUnitList->uiEndPos = 0; | 1553 | pCtx->pAccessUnitList->uiEndPos = 0; |
| 1554 | pCtx->pAccessUnitList->bCompletedAuFlag = false; | 1554 | pCtx->pAccessUnitList->bCompletedAuFlag = false; |
| 1555 | } | 1555 | } |
| 1556 | 1556 | ||
| 1557 | void CheckAvailNalUnitsListContinuity (PWelsDecoderContext pCtx, int32_t iStartIdx, int32_t iEndIdx) { | 1557 | void CheckAvailNalUnitsListContinuity (PWelsDecoderContext pCtx, int32_t iStartIdx, int32_t iEndIdx) { |
| @@ -1985,35 +1985,35 @@ int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferI · 427 unmodified lines | |||
| 1985 | 1985 | ||
| 1986 | static inline void InitDqLayerInfo (PDqLayer pDqLayer, PLayerInfo pLayerInfo, PNalUnit pNalUnit, PPicture pPicDec) { | 1986 | static inline void InitDqLayerInfo (PDqLayer pDqLayer, PLayerInfo pLayerInfo, PNalUnit pNalUnit, PPicture pPicDec) { |
| 1987 | PNalUnitHeaderExt pNalHdrExt = &pNalUnit->sNalHeaderExt; | 1987 | PNalUnitHeaderExt pNalHdrExt = &pNalUnit->sNalHeaderExt; |
| 1988 | PSliceHeaderExt pShExt = &pNalUnit->sNalData.sVclNal.sSliceHeaderExt; | 1988 | PSliceHeaderExt pShExt = &pNalUnit->sNalData.sVclNal.sSliceHeaderExt; |
| 1989 | PSliceHeader pSh = &pShExt->sSliceHeader; | 1989 | PSliceHeader pSh = &pShExt->sSliceHeader; |
| 1990 | const uint8_t kuiQualityId = pNalHdrExt->uiQualityId; | 1990 | const uint8_t kuiQualityId = pNalHdrExt->uiQualityId; |
| 1991 | 1991 | ||
| 1992 | memcpy (&pDqLayer->sLayerInfo, pLayerInfo, sizeof (SLayerInfo)); //confirmed_safe_unsafe_usage | 1992 | memcpy (&pDqLayer->sLayerInfo, pLayerInfo, sizeof (SLayerInfo)); //confirmed_safe_unsafe_usage |
| 1993 | 1993 | ||
| 1994 | pDqLayer->pDec = pPicDec; | 1994 | pDqLayer->pDec = pPicDec; |
| 1995 | pDqLayer->iMbWidth = pSh->iMbWidth; // MB width of this picture | 1995 | pDqLayer->iMbWidth = pSh->iMbWidth; // MB width of this picture |
| 1996 | pDqLayer->iMbHeight = pSh->iMbHeight;// MB height of this picture | 1996 | pDqLayer->iMbHeight = pSh->iMbHeight;// MB height of this picture |
| 1997 | 1997 | ||
| 1998 | pDqLayer->iSliceIdcBackup = (pSh->iFirstMbInSlice << 7) | (pNalHdrExt->uiDependencyId << 4) | (pNalHdrExt->uiQualityId); | 1998 | pDqLayer->iSliceIdcBackup = (pSh->iFirstMbInSlice << 7) | (pNalHdrExt->uiDependencyId << 4) | (pNalHdrExt->uiQualityId); |
| 1999 | 1999 | ||
| 2000 | /* Common syntax elements across all slices of a DQLayer */ | 2000 | /* Common syntax elements across all slices of a DQLayer */ |
| 2001 | pDqLayer->uiPpsId = pLayerInfo->pPps->iPpsId; | 2001 | pDqLayer->uiPpsId = pLayerInfo->pPps->iPpsId; |
| 2002 | pDqLayer->uiDisableInterLayerDeblockingFilterIdc = pShExt->uiDisableInterLayerDeblockingFilterIdc; | 2002 | pDqLayer->uiDisableInterLayerDeblockingFilterIdc = pShExt->uiDisableInterLayerDeblockingFilterIdc; |
| 2003 | pDqLayer->iInterLayerSliceAlphaC0Offset = pShExt->iInterLayerSliceAlphaC0Offset; | 2003 | pDqLayer->iInterLayerSliceAlphaC0Offset = pShExt->iInterLayerSliceAlphaC0Offset; |
| 2004 | pDqLayer->iInterLayerSliceBetaOffset = pShExt->iInterLayerSliceBetaOffset; | 2004 | pDqLayer->iInterLayerSliceBetaOffset = pShExt->iInterLayerSliceBetaOffset; |
| 2005 | pDqLayer->iSliceGroupChangeCycle = pSh->iSliceGroupChangeCycle; | 2005 | pDqLayer->iSliceGroupChangeCycle = pSh->iSliceGroupChangeCycle; |
| 2006 | pDqLayer->bStoreRefBasePicFlag = pShExt->bStoreRefBasePicFlag; | 2006 | pDqLayer->bStoreRefBasePicFlag = pShExt->bStoreRefBasePicFlag; |
| 2007 | pDqLayer->bTCoeffLevelPredFlag = pShExt->bTCoeffLevelPredFlag; | 2007 | pDqLayer->bTCoeffLevelPredFlag = pShExt->bTCoeffLevelPredFlag; |
| 2008 | pDqLayer->bConstrainedIntraResamplingFlag = pShExt->bConstrainedIntraResamplingFlag; | 2008 | pDqLayer->bConstrainedIntraResamplingFlag = pShExt->bConstrainedIntraResamplingFlag; |
| 2009 | pDqLayer->uiRefLayerDqId = pShExt->uiRefLayerDqId; | 2009 | pDqLayer->uiRefLayerDqId = pShExt->uiRefLayerDqId; |
| 2010 | pDqLayer->uiRefLayerChromaPhaseXPlus1Flag = pShExt->uiRefLayerChromaPhaseXPlus1Flag; | 2010 | pDqLayer->uiRefLayerChromaPhaseXPlus1Flag = pShExt->uiRefLayerChromaPhaseXPlus1Flag; |
| 2011 | pDqLayer->uiRefLayerChromaPhaseYPlus1 = pShExt->uiRefLayerChromaPhaseYPlus1; | 2011 | pDqLayer->uiRefLayerChromaPhaseYPlus1 = pShExt->uiRefLayerChromaPhaseYPlus1; |
| 2012 | //memcpy(&pDqLayer->sScaledRefLayer, &pShExt->sScaledRefLayer, sizeof(SPosOffset));//confirmed_safe_unsafe_usage | 2012 | //memcpy(&pDqLayer->sScaledRefLayer, &pShExt->sScaledRefLayer, sizeof(SPosOffset));//confirmed_safe_unsafe_usage |
| 2013 | 2013 | ||
| 2014 | if (kuiQualityId == BASE_QUALITY_ID) { | 2014 | if (kuiQualityId == BASE_QUALITY_ID) { |
| 2015 | pDqLayer->pRefPicListReordering = &pSh->pRefPicListReordering; | 2015 | pDqLayer->pRefPicListReordering = &pSh->pRefPicListReordering; |
| 2016 | pDqLayer->pRefPicMarking = &pSh->sRefMarking; | 2016 | pDqLayer->pRefPicMarking = &pSh->sRefMarking; |
| 2017 | 2017 | ||
| 2018 | if (pSh->pPps->bWeightedPredFlag) { | 2018 | if (pSh->pPps->bWeightedPredFlag) { |
| 2019 | pDqLayer->bUseWeightPredictionFlag = true; | 2019 | pDqLayer->bUseWeightPredictionFlag = true; |
| @@ -2022,20 +2022,20 @@ static inline void InitDqLayerInfo (PDqLayer pDqLayer, PLayerInfo pLayerInfo, PN · 2 unmodified lines | |||
| 2022 | } else | 2022 | } else |
| 2023 | pDqLayer->bUseWeightPredictionFlag = false; | 2023 | pDqLayer->bUseWeightPredictionFlag = false; |
| 2024 | 2024 | ||
| 2025 | pDqLayer->pRefPicBaseMarking = &pShExt->sRefBasePicMarking; | 2025 | pDqLayer->pRefPicBaseMarking = &pShExt->sRefBasePicMarking; |
| 2026 | } | 2026 | } |
| 2027 | 2027 | ||
| 2028 | pDqLayer->uiLayerDqId = pNalHdrExt->uiLayerDqId; // dq_id of current layer | 2028 | pDqLayer->uiLayerDqId = pNalHdrExt->uiLayerDqId; // dq_id of current layer |
| 2029 | pDqLayer->bUseRefBasePicFlag = pNalHdrExt->bUseRefBasePicFlag; | 2029 | pDqLayer->bUseRefBasePicFlag = pNalHdrExt->bUseRefBasePicFlag; |
| 2030 | } | 2030 | } |
| 2031 | 2031 | ||
| 2032 | void WelsDqLayerDecodeStart (PWelsDecoderContext pCtx, PNalUnit pCurNal, PSps pSps, PPps pPps) { | 2032 | void WelsDqLayerDecodeStart (PWelsDecoderContext pCtx, PNalUnit pCurNal, PSps pSps, PPps pPps) { |
| 2033 | PSliceHeader pSh = &pCurNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader; | 2033 | PSliceHeader pSh = &pCurNal->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader; |
| 2034 | 2034 | ||
| 2035 | pCtx->eSliceType = pSh->eSliceType; | 2035 | pCtx->eSliceType = pSh->eSliceType; |
| 2036 | pCtx->pSliceHeader = pSh; | 2036 | pCtx->pSliceHeader = pSh; |
| 2037 | 2037 | ||
| 2038 | pCtx->iFrameNum = pSh->iFrameNum; | 2038 | pCtx->iFrameNum = pSh->iFrameNum; |
| 2039 | } | 2039 | } |
| 2040 | 2040 | ||
| 2041 | int32_t InitRefPicList (PWelsDecoderContext pCtx, const uint8_t kuiNRi, int32_t iPoc) { | 2041 | int32_t InitRefPicList (PWelsDecoderContext pCtx, const uint8_t kuiNRi, int32_t iPoc) { |
| @@ -2050,18 +2050,18 @@ int32_t InitRefPicList (PWelsDecoderContext pCtx, const uint8_t kuiNRi, int32_t · 8 unmodified lines | |||
| 2050 | 2050 | ||
| 2051 | void InitCurDqLayerData (PWelsDecoderContext pCtx, PDqLayer pCurDq) { | 2051 | void InitCurDqLayerData (PWelsDecoderContext pCtx, PDqLayer pCurDq) { |
| 2052 | if (NULL != pCtx && NULL != pCurDq) { | 2052 | if (NULL != pCtx && NULL != pCurDq) { |
| 2053 | pCurDq->pMbType = pCtx->sMb.pMbType[0]; | 2053 | pCurDq->pMbType = pCtx->sMb.pMbType[0]; |
| 2054 | pCurDq->pSliceIdc = pCtx->sMb.pSliceIdc[0]; | 2054 | pCurDq->pSliceIdc = pCtx->sMb.pSliceIdc[0]; |
| 2055 | pCurDq->pMv[0] = pCtx->sMb.pMv[0][0]; | 2055 | pCurDq->pMv[0] = pCtx->sMb.pMv[0][0]; |
| 2056 | pCurDq->pRefIndex[0] = pCtx->sMb.pRefIndex[0][0]; | 2056 | pCurDq->pRefIndex[0] = pCtx->sMb.pRefIndex[0][0]; |
| 2057 | pCurDq->pNoSubMbPartSizeLessThan8x8Flag = pCtx->sMb.pNoSubMbPartSizeLessThan8x8Flag[0]; | 2057 | pCurDq->pNoSubMbPartSizeLessThan8x8Flag = pCtx->sMb.pNoSubMbPartSizeLessThan8x8Flag[0]; |
| 2058 | pCurDq->pTransformSize8x8Flag = pCtx->sMb.pTransformSize8x8Flag[0]; | 2058 | pCurDq->pTransformSize8x8Flag = pCtx->sMb.pTransformSize8x8Flag[0]; |
| 2059 | pCurDq->pLumaQp = pCtx->sMb.pLumaQp[0]; | 2059 | pCurDq->pLumaQp = pCtx->sMb.pLumaQp[0]; |
| 2060 | pCurDq->pChromaQp = pCtx->sMb.pChromaQp[0]; | 2060 | pCurDq->pChromaQp = pCtx->sMb.pChromaQp[0]; |
| 2061 | pCurDq->pMvd[0] = pCtx->sMb.pMvd[0][0]; | 2061 | pCurDq->pMvd[0] = pCtx->sMb.pMvd[0][0]; |
| 2062 | pCurDq->pCbfDc = pCtx->sMb.pCbfDc[0]; | 2062 | pCurDq->pCbfDc = pCtx->sMb.pCbfDc[0]; |
| 2063 | pCurDq->pNzc = pCtx->sMb.pNzc[0]; | 2063 | pCurDq->pNzc = pCtx->sMb.pNzc[0]; |
| 2064 | pCurDq->pNzcRs = pCtx->sMb.pNzcRs[0]; | 2064 | pCurDq->pNzcRs = pCtx->sMb.pNzcRs[0]; |
| 2065 | pCurDq->pScaledTCoeff = pCtx->sMb.pScaledTCoeff[0]; | 2065 | pCurDq->pScaledTCoeff = pCtx->sMb.pScaledTCoeff[0]; |
| 2066 | pCurDq->pIntraPredMode = pCtx->sMb.pIntraPredMode[0]; | 2066 | pCurDq->pIntraPredMode = pCtx->sMb.pIntraPredMode[0]; |
| 2067 | pCurDq->pIntra4x4FinalMode = pCtx->sMb.pIntra4x4FinalMode[0]; | 2067 | pCurDq->pIntra4x4FinalMode = pCtx->sMb.pIntra4x4FinalMode[0]; |
| @@ -2156,10 +2156,10 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 88 unmodified lines | |||
| 2156 | */ | 2156 | */ |
| 2157 | while (iIdx <= iEndIdx) { | 2157 | while (iIdx <= iEndIdx) { |
| 2158 | bool bReconstructSlice; | 2158 | bool bReconstructSlice; |
| 2159 | iCurrIdQ = pNalCur->sNalHeaderExt.uiQualityId; | 2159 | iCurrIdQ = pNalCur->sNalHeaderExt.uiQualityId; |
| 2160 | iCurrIdD = pNalCur->sNalHeaderExt.uiDependencyId; | 2160 | iCurrIdD = pNalCur->sNalHeaderExt.uiDependencyId; |
| 2161 | pSh = &pNalCur->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader; | 2161 | pSh = &pNalCur->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader; |
| 2162 | pShExt = &pNalCur->sNalData.sVclNal.sSliceHeaderExt; | 2162 | pShExt = &pNalCur->sNalData.sVclNal.sSliceHeaderExt; |
| 2163 | pCtx->bRPLRError = false; | 2163 | pCtx->bRPLRError = false; |
| 2164 | bReconstructSlice = CheckSliceNeedReconstruct (pNalCur->sNalHeaderExt.uiLayerDqId, kuiTargetLayerDqId); | 2164 | bReconstructSlice = CheckSliceNeedReconstruct (pNalCur->sNalHeaderExt.uiLayerDqId, kuiTargetLayerDqId); |
| 2165 | 2165 | ||
| @@ -2170,14 +2170,14 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBuf · 4 unmodified lines | |||
| 2170 | pCtx->pDec->bIdrFlag = pNalCur->sNalHeaderExt.bIdrFlag; | 2170 | pCtx->pDec->bIdrFlag = pNalCur->sNalHeaderExt.bIdrFlag; |
| 2171 | 2171 | ||
| 2172 | memcpy (&pLayerInfo.sSliceInLayer.sSliceHeaderExt, pShExt, sizeof (SSliceHeaderExt)); //confirmed_safe_unsafe_usage | 2172 | memcpy (&pLayerInfo.sSliceInLayer.sSliceHeaderExt, pShExt, sizeof (SSliceHeaderExt)); //confirmed_safe_unsafe_usage |
| 2173 | pLayerInfo.sSliceInLayer.bSliceHeaderExtFlag = pNalCur->sNalData.sVclNal.bSliceHeaderExtFlag; | 2173 | pLayerInfo.sSliceInLayer.bSliceHeaderExtFlag = pNalCur->sNalData.sVclNal.bSliceHeaderExtFlag; |
| 2174 | pLayerInfo.sSliceInLayer.eSliceType = pSh->eSliceType; | 2174 | pLayerInfo.sSliceInLayer.eSliceType = pSh->eSliceType; |
| 2175 | pLayerInfo.sSliceInLayer.iLastMbQp = pSh->iSliceQp; | 2175 | pLayerInfo.sSliceInLayer.iLastMbQp = pSh->iSliceQp; |
| 2176 | dq_cur->pBitStringAux = &pNalCur->sNalData.sVclNal.sSliceBitsRead; | 2176 | dq_cur->pBitStringAux = &pNalCur->sNalData.sVclNal.sSliceBitsRead; |
| 2177 | 2177 | ||
| 2178 | uiNalRefIdc = pNalCur->sNalHeaderExt.sNalUnitHeader.uiNalRefIdc; | 2178 | uiNalRefIdc = pNalCur->sNalHeaderExt.sNalUnitHeader.uiNalRefIdc; |
| 2179 | 2179 | ||
| 2180 | iPpsId = pSh->iPpsId; | 2180 | iPpsId = pSh->iPpsId; |
| 2181 | 2181 | ||
| 2182 | pLayerInfo.pPps = pSh->pPps; | 2182 | pLayerInfo.pPps = pSh->pPps; |
| 2183 | pLayerInfo.pSps = pSh->pSps; | 2183 | pLayerInfo.pSps = pSh->pSps; |