Showing the changes to codec/encoder/core/src/svc_encode_slice.cpp (1 of 54 files). Show all
Unified · Split
| @@ -67,10 +67,10 @@ void UpdateNonZeroCountCache (SMB* pMb, SMbCache* pMbCache) { · 66 unmodified lines | ||
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | void WelsSliceHeaderScalExtInit (SDqLayer* pCurLayer, SSlice* pSlice) { |
| 70 | − SSliceHeaderExt* pSliceHeadExt = &pSlice->sSliceHeaderExt; | |
| 70 | + SSliceHeaderExt* pSliceHeadExt = &pSlice->sSliceHeaderExt; | |
| 71 | 71 | SNalUnitHeaderExt* pNalHeadExt = &pCurLayer->sLayerInfo.sNalHeaderExt; |
| 72 | 72 | |
| 73 | − uint8_t uiDependencyId = pNalHeadExt->uiDependencyId; | |
| 73 | + uint8_t uiDependencyId = pNalHeadExt->uiDependencyId; | |
| 74 | 74 | |
| 75 | 75 | pSliceHeadExt->bSliceSkipFlag = false; |
| 76 | 76 | |
| @@ -90,7 +90,7 @@ void WelsSliceHeaderExtInit (sWelsEncCtx* pEncCtx, SDqLayer* pCurLayer, SSlice* · 13 unmodified lines | ||
| 90 | 90 | SSliceHeaderExt* pCurSliceExt = &pSlice->sSliceHeaderExt; |
| 91 | 91 | SSliceHeader* pCurSliceHeader = &pCurSliceExt->sSliceHeader; |
| 92 | 92 | |
| 93 | − pCurSliceHeader->eSliceType = pEncCtx->eSliceType; | |
| 93 | + pCurSliceHeader->eSliceType = pEncCtx->eSliceType; | |
| 94 | 94 | |
| 95 | 95 | pCurSliceExt->bStoreRefBasePicFlag = false; |
| 96 | 96 | |
| @@ -99,14 +99,14 @@ void WelsSliceHeaderExtInit (sWelsEncCtx* pEncCtx, SDqLayer* pCurLayer, SSlice* · 2 unmodified lines | ||
| 99 | 99 | pCurSliceHeader->iFrameNum = pEncCtx->iFrameNum; |
| 100 | 100 | pCurSliceHeader->uiIdrPicId = pEncCtx->uiIdrPicId; |
| 101 | 101 | |
| 102 | − pCurSliceHeader->iPicOrderCntLsb = pEncCtx->pEncPic->iFramePoc; // 0 | |
| 102 | + pCurSliceHeader->iPicOrderCntLsb = pEncCtx->pEncPic->iFramePoc; // 0 | |
| 103 | 103 | |
| 104 | 104 | if (P_SLICE == pEncCtx->eSliceType) { |
| 105 | − pCurSliceHeader->uiNumRefIdxL0Active = 1; | |
| 105 | + pCurSliceHeader->uiNumRefIdxL0Active = 1; | |
| 106 | 106 | if (pCurSliceHeader->uiRefCount > 0 && |
| 107 | 107 | pCurSliceHeader->uiRefCount < pCurLayer->sLayerInfo.pSpsP->iNumRefFrames) { |
| 108 | 108 | pCurSliceHeader->bNumRefIdxActiveOverrideFlag = true; |
| 109 | − pCurSliceHeader->uiNumRefIdxL0Active = pCurSliceHeader->uiRefCount; | |
| 109 | + pCurSliceHeader->uiNumRefIdxL0Active = pCurSliceHeader->uiRefCount; | |
| 110 | 110 | } |
| 111 | 111 | //to solve mismatch between debug&release |
| 112 | 112 | else { |
| @@ -117,23 +117,23 @@ void WelsSliceHeaderExtInit (sWelsEncCtx* pEncCtx, SDqLayer* pCurLayer, SSlice* · 4 unmodified lines | ||
| 117 | 117 | pCurSliceHeader->iSliceQpDelta = pEncCtx->iGlobalQp - pCurLayer->sLayerInfo.pPpsP->iPicInitQp; |
| 118 | 118 | |
| 119 | 119 | //for deblocking initial |
| 120 | − pCurSliceHeader->uiDisableDeblockingFilterIdc = pCurLayer->iLoopFilterDisableIdc; | |
| 121 | − pCurSliceHeader->iSliceAlphaC0Offset = | |
| 122 | − pCurLayer->iLoopFilterAlphaC0Offset; // need update iSliceAlphaC0Offset & iSliceBetaOffset for pSlice-header if loop_filter_idc != 1 | |
| 123 | − pCurSliceHeader->iSliceBetaOffset = pCurLayer->iLoopFilterBetaOffset; | |
| 120 | + pCurSliceHeader->uiDisableDeblockingFilterIdc = pCurLayer->iLoopFilterDisableIdc; | |
| 121 | + pCurSliceHeader->iSliceAlphaC0Offset = | |
| 122 | + pCurLayer->iLoopFilterAlphaC0Offset; // need update iSliceAlphaC0Offset & iSliceBetaOffset for pSlice-header if loop_filter_idc != 1 | |
| 123 | + pCurSliceHeader->iSliceBetaOffset = pCurLayer->iLoopFilterBetaOffset; | |
| 124 | 124 | pCurSliceExt->uiDisableInterLayerDeblockingFilterIdc = pCurLayer->uiDisableInterLayerDeblockingFilterIdc; |
| 125 | 125 | |
| 126 | 126 | if (pSlice->bSliceHeaderExtFlag) { |
| 127 | 127 | WelsSliceHeaderScalExtInit (pCurLayer, pSlice); |
| 128 | 128 | } else { |
| 129 | 129 | //both adaptive and default flags should equal to 0. |
| 130 | − pCurSliceExt->bAdaptiveBaseModeFlag = | |
| 131 | − pCurSliceExt->bAdaptiveMotionPredFlag = | |
| 132 | − pCurSliceExt->bAdaptiveResidualPredFlag = false; | |
| 130 | + pCurSliceExt->bAdaptiveBaseModeFlag = | |
| 131 | + pCurSliceExt->bAdaptiveMotionPredFlag = | |
| 132 | + pCurSliceExt->bAdaptiveResidualPredFlag = false; | |
| 133 | 133 | |
| 134 | − pCurSliceExt->bDefaultBaseModeFlag = | |
| 135 | − pCurSliceExt->bDefaultMotionPredFlag = | |
| 136 | − pCurSliceExt->bDefaultResidualPredFlag = false; | |
| 134 | + pCurSliceExt->bDefaultBaseModeFlag = | |
| 135 | + pCurSliceExt->bDefaultMotionPredFlag = | |
| 136 | + pCurSliceExt->bDefaultResidualPredFlag = false; | |
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | |
| @@ -204,7 +204,7 @@ void WriteReferenceReorder (SBitStringAux* pBs, SSliceHeader* sSliceHeader) { · 64 unmodified lines | ||
| 204 | 204 | * \brief write reference picture marking syntax in pSlice header |
| 205 | 205 | */ |
| 206 | 206 | void WriteRefPicMarking (SBitStringAux* pBs, SSliceHeader* pSliceHeader, SNalUnitHeaderExt* pNalHdrExt) { |
| 207 | − SRefPicMarking* sRefMarking = &pSliceHeader->sRefMarking; | |
| 207 | + SRefPicMarking* sRefMarking = &pSliceHeader->sRefMarking; | |
| 208 | 208 | int16_t n = 0; |
| 209 | 209 | |
| 210 | 210 | if (pNalHdrExt->bIdrFlag) { |
| @@ -503,7 +503,7 @@ int32_t WelsISliceMdEnc (sWelsEncCtx* pEncCtx, SSlice* pSlice) { //pMd + encodin · 292 unmodified lines | ||
| 503 | 503 | } |
| 504 | 504 | for (; ;) { |
| 505 | 505 | pEncCtx->pFuncList->pfStashMBStatus (&sDss, pSlice, 0); |
| 506 | − iCurMbIdx = iNextMbIdx; | |
| 506 | + iCurMbIdx = iNextMbIdx; | |
| 507 | 507 | pCurMb = &pMbList[ iCurMbIdx ]; |
| 508 | 508 | |
| 509 | 509 | pEncCtx->pFuncList->pfRc.pfWelsRcMbInit (pEncCtx, pCurMb, pSlice); |
| @@ -567,7 +567,7 @@ int32_t WelsISliceMdEncDynamic (sWelsEncCtx* pEncCtx, SSlice* pSlice) { //pMd + · 57 unmodified lines | ||
| 567 | 567 | WelsInitSliceCabac (pEncCtx, pSlice); |
| 568 | 568 | } |
| 569 | 569 | for (; ;) { |
| 570 | − iCurMbIdx = iNextMbIdx; | |
| 570 | + iCurMbIdx = iNextMbIdx; | |
| 571 | 571 | pCurMb = &pMbList[ iCurMbIdx ]; |
| 572 | 572 | |
| 573 | 573 | pEncCtx->pFuncList->pfStashMBStatus (&sDss, pSlice, 0); |
| @@ -618,7 +618,7 @@ TRY_REENCODING: · 44 unmodified lines | ||
| 618 | 618 | iNextMbIdx = WelsGetNextMbOfSlice (pSliceCtx, iCurMbIdx); |
| 619 | 619 | //whether all of MB in current pSlice encoded or not |
| 620 | 620 | if (iNextMbIdx == -1 || iNextMbIdx >= kiTotalNumMb || iNumMbCoded >= kiTotalNumMb) { |
| 621 | − pSliceCtx->pCountMbNumInSlice[kiSliceIdx] = iCurMbIdx - pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId]; | |
| 621 | + pSliceCtx->pCountMbNumInSlice[kiSliceIdx] = iCurMbIdx - pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId]; | |
| 622 | 622 | pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId] = |
| 623 | 623 | iCurMbIdx; // update pLastCodedMbIdxOfPartition, finish coding, use iCurMbIdx directly |
| 624 | 624 | break; |
| @@ -662,38 +662,38 @@ int32_t WelsPSliceMdEncDynamic (sWelsEncCtx* pEncCtx, SSlice* pSlice, const bool · 37 unmodified lines | ||
| 662 | 662 | |
| 663 | 663 | int32_t WelsCodePSlice (sWelsEncCtx* pEncCtx, SSlice* pSlice) { |
| 664 | 664 | //pSlice-level init should be outside and before this function |
| 665 | − SDqLayer* pCurLayer = pEncCtx->pCurDqLayer; | |
| 665 | + SDqLayer* pCurLayer = pEncCtx->pCurDqLayer; | |
| 666 | 666 | |
| 667 | − const bool kbBaseAvail = pCurLayer->bBaseLayerAvailableFlag; | |
| 667 | + const bool kbBaseAvail = pCurLayer->bBaseLayerAvailableFlag; | |
| 668 | 668 | const bool kbHighestSpatial = pEncCtx->pSvcParam->iSpatialLayerNum == |
| 669 | 669 | (pCurLayer->sLayerInfo.sNalHeaderExt.uiDependencyId + 1); |
| 670 | 670 | |
| 671 | 671 | //MD switch |
| 672 | 672 | if (kbBaseAvail && kbHighestSpatial) { |
| 673 | 673 | //initial pMd pointer |
| 674 | − pEncCtx->pFuncList->pfInterMd = WelsMdInterMbEnhancelayer; | |
| 674 | + pEncCtx->pFuncList->pfInterMd = WelsMdInterMbEnhancelayer; | |
| 675 | 675 | } else { |
| 676 | 676 | //initial pMd pointer |
| 677 | − pEncCtx->pFuncList->pfInterMd = WelsMdInterMb; | |
| 677 | + pEncCtx->pFuncList->pfInterMd = WelsMdInterMb; | |
| 678 | 678 | } |
| 679 | 679 | return WelsPSliceMdEnc (pEncCtx, pSlice, kbHighestSpatial); |
| 680 | 680 | } |
| 681 | 681 | |
| 682 | 682 | int32_t WelsCodePOverDynamicSlice (sWelsEncCtx* pEncCtx, SSlice* pSlice) { |
| 683 | 683 | //pSlice-level init should be outside and before this function |
| 684 | − SDqLayer* pCurLayer = pEncCtx->pCurDqLayer; | |
| 684 | + SDqLayer* pCurLayer = pEncCtx->pCurDqLayer; | |
| 685 | 685 | |
| 686 | − const bool kbBaseAvail = pCurLayer->bBaseLayerAvailableFlag; | |
| 686 | + const bool kbBaseAvail = pCurLayer->bBaseLayerAvailableFlag; | |
| 687 | 687 | const bool kbHighestSpatial = pEncCtx->pSvcParam->iSpatialLayerNum == |
| 688 | 688 | (pCurLayer->sLayerInfo.sNalHeaderExt.uiDependencyId + 1); |
| 689 | 689 | |
| 690 | 690 | //MD switch |
| 691 | 691 | if (kbBaseAvail && kbHighestSpatial) { |
| 692 | 692 | //initial pMd pointer |
| 693 | − pEncCtx->pFuncList->pfInterMd = WelsMdInterMbEnhancelayer; | |
| 693 | + pEncCtx->pFuncList->pfInterMd = WelsMdInterMbEnhancelayer; | |
| 694 | 694 | } else { |
| 695 | 695 | //initial pMd pointer |
| 696 | − pEncCtx->pFuncList->pfInterMd = WelsMdInterMb; | |
| 696 | + pEncCtx->pFuncList->pfInterMd = WelsMdInterMb; | |
| 697 | 697 | } |
| 698 | 698 | return WelsPSliceMdEncDynamic (pEncCtx, pSlice, kbHighestSpatial); |
| 699 | 699 | } |
| @@ -781,9 +781,9 @@ void UpdateMbNeighbourInfoForNextSlice (SSliceCtx* pSliceCtx, · 81 unmodified lines | ||
| 781 | 781 | bool bLeftTop; |
| 782 | 782 | bool bRightTop; |
| 783 | 783 | int32_t iLeftXY, iTopXY, iLeftTopXY, iRightTopXY; |
| 784 | − const uint16_t kuiSliceIdc = WelsMbToSliceIdc (pSliceCtx, kiMbXY); | |
| 784 | + const uint16_t kuiSliceIdc = WelsMbToSliceIdc (pSliceCtx, kiMbXY); | |
| 785 | 785 | |
| 786 | − pMb->uiSliceIdc = kuiSliceIdc; | |
| 786 | + pMb->uiSliceIdc = kuiSliceIdc; | |
| 787 | 787 | iLeftXY = kiMbXY - 1; |
| 788 | 788 | iTopXY = kiMbXY - kiMbWidth; |
| 789 | 789 | iLeftTopXY = iTopXY - 1; |
| @@ -806,7 +806,7 @@ void UpdateMbNeighbourInfoForNextSlice (SSliceCtx* pSliceCtx, · 16 unmodified lines | ||
| 806 | 806 | if (bRightTop) { |
| 807 | 807 | uiNeighborAvailFlag |= TOPRIGHT_MB_POS; |
| 808 | 808 | } |
| 809 | − pMb->uiNeighborAvail = (uint8_t)uiNeighborAvailFlag; | |
| 809 | + pMb->uiNeighborAvail = (uint8_t)uiNeighborAvailFlag; | |
| 810 | 810 | |
| 811 | 811 | ++ pMb; |
| 812 | 812 | ++ iIdx; |
| @@ -824,10 +824,10 @@ void AddSliceBoundary (sWelsEncCtx* pEncCtx, SSlice* pCurSlice, SSliceCtx* pSlic · 11 unmodified lines | ||
| 824 | 824 | uint16_t iNextSliceIdc = iCurSliceIdc + kiSliceIdxStep; |
| 825 | 825 | SSlice* pNextSlice = NULL; |
| 826 | 826 | |
| 827 | − SMB* pMbList = pCurLayer->sMbDataP; | |
| 827 | + SMB* pMbList = pCurLayer->sMbDataP; | |
| 828 | 828 | |
| 829 | 829 | //update cur pSlice info |
| 830 | − pCurSlice->sSliceHeaderExt.uiNumMbsInSlice = 1 + iCurMbIdx - pCurSlice->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice; | |
| 830 | + pCurSlice->sSliceHeaderExt.uiNumMbsInSlice = 1 + iCurMbIdx - pCurSlice->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice; | |
| 831 | 831 | |
| 832 | 832 | //pNextSlice pointer/initialization |
| 833 | 833 | pNextSlice = & (pCurLayer->sLayerInfo.pSliceInLayer[ iNextSliceIdc ]); |
| @@ -860,7 +860,7 @@ bool DynSlcJudgeSliceBoundaryStepBack (void* pCtx, void* pSlice, SSliceCtx* pSli · 26 unmodified lines | ||
| 860 | 860 | int32_t iPosBitOffset = 0; |
| 861 | 861 | const int32_t kiActiveThreadsNum = pEncCtx->iActiveThreadsNum; |
| 862 | 862 | const int32_t kiPartitaionId = pCurSlice->uiSliceIdx % kiActiveThreadsNum; |
| 863 | − const int32_t kiLastMbIdxInPartition = pEncCtx->pCurDqLayer->pLastMbIdxOfPartition[kiPartitaionId]; | |
| 863 | + const int32_t kiLastMbIdxInPartition = pEncCtx->pCurDqLayer->pLastMbIdxOfPartition[kiPartitaionId]; | |
| 864 | 864 | |
| 865 | 865 | const bool kbCurMbNotFirstMbOfCurSlice = (pSliceCtx->pOverallMbMap[iCurMbIdx] == |
| 866 | 866 | pSliceCtx->pOverallMbMap[iCurMbIdx - 1]); |
| @@ -963,7 +963,7 @@ int32_t WelsMdInterMbLoop (sWelsEncCtx* pEncCtx, SSlice* pSlice, void* pWelsMd, · 96 unmodified lines | ||
| 963 | 963 | for (;;) { |
| 964 | 964 | pEncCtx->pFuncList->pfStashMBStatus (&sDss, pSlice, pSlice->iMbSkipRun); |
| 965 | 965 | //point to current pMb |
| 966 | − iCurMbIdx = iNextMbIdx; | |
| 966 | + iCurMbIdx = iNextMbIdx; | |
| 967 | 967 | pCurMb = &pMbList[ iCurMbIdx ]; |
| 968 | 968 | |
| 969 | 969 | |
| @@ -1060,7 +1060,7 @@ int32_t WelsMdInterMbLoopOverDynamicSlice (sWelsEncCtx* pEncCtx, SSlice* pSlice, · 90 unmodified lines | ||
| 1060 | 1060 | pEncCtx->pFuncList->pfStashMBStatus (&sDss, pSlice, pSlice->iMbSkipRun); |
| 1061 | 1061 | |
| 1062 | 1062 | //point to current pMb |
| 1063 | − iCurMbIdx = iNextMbIdx; | |
| 1063 | + iCurMbIdx = iNextMbIdx; | |
| 1064 | 1064 | pCurMb = &pMbList[ iCurMbIdx ]; |
| 1065 | 1065 | |
| 1066 | 1066 | //step(1): set QP for the current MB |