Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 5 files). Show all
Unified · Split
| @@ -3743,7 +3743,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 3742 unmodified lines | ||
| 3743 | 3743 | EWelsNalUnitType eNalType = NAL_UNIT_UNSPEC_0; |
| 3744 | 3744 | EWelsNalRefIdc eNalRefIdc = NRI_PRI_LOWEST; |
| 3745 | 3745 | int8_t iCurDid = 0; |
| 3746 | − int8_t iCurTid = 0; | |
| 3746 | + int32_t iCurTid = 0; | |
| 3747 | 3747 | bool bAvcBased = false; |
| 3748 | 3748 | SLogContext* pLogCtx = & (pCtx->sLogCtx); |
| 3749 | 3749 | bool bFinishedWriteHeader = false; |
| @@ -3792,19 +3792,18 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 42 unmodified lines | ||
| 3792 | 3792 | pCtx->pCurDqLayer = pCtx->ppDqLayerList[pSpatialIndexMap->iDid]; |
| 3793 | 3793 | pCtx->pCurDqLayer->pRefLayer = NULL; |
| 3794 | 3794 | |
| 3795 | − while (iSpatialIdx < iSpatialNum) { | |
| 3796 | − bool bEncoding = pCtx->pVpp->BuildSpatialLayer (pCtx, pSrcPic, iSpatialIdx); | |
| 3797 | − if (!bEncoding) { | |
| 3798 | − ++iSpatialIdx; | |
| 3799 | − continue; | |
| 3800 | − } | |
| 3795 | + while (iSpatialIdx < pSvcParam->iSpatialLayerNum) { | |
| 3801 | 3796 | const int32_t iDidIdx = (pSpatialIndexMap + iSpatialIdx)->iDid; |
| 3802 | 3797 | SSpatialLayerConfig* pParam = &pSvcParam->sSpatialLayers[iDidIdx]; |
| 3803 | 3798 | SSpatialLayerInternal* pParamInternal = &pSvcParam->sDependencyLayers[iDidIdx]; |
| 3804 | 3799 | int32_t iDecompositionStages = pSvcParam->sDependencyLayers[iDidIdx].iDecompositionStages; |
| 3805 | 3800 | pCtx->pCurDqLayer = pCtx->ppDqLayerList[iDidIdx]; |
| 3806 | 3801 | pCtx->uiDependencyId = iCurDid = (int8_t)iDidIdx; |
| 3807 | − | |
| 3802 | + //skip this spatial layer | |
| 3803 | + if(GetTemporalLevel (pParamInternal, pParamInternal->iCodingIndex,pSvcParam->uiGopSize) == INVALID_TEMPORAL_ID){ | |
| 3804 | + ++iSpatialIdx; | |
| 3805 | + continue; | |
| 3806 | + } | |
| 3808 | 3807 | eFrameType = DecideFrameType (pCtx, iSpatialNum, iDidIdx); |
| 3809 | 3808 | if (eFrameType == videoFrameTypeSkip) { |
| 3810 | 3809 | eFrameType = videoFrameTypeSkip; |
| @@ -3847,11 +3846,10 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 36 unmodified lines | ||
| 3847 | 3846 | } |
| 3848 | 3847 | } |
| 3849 | 3848 | pCtx->iContinualSkipFrames = 0; |
| 3850 | − | |
| 3851 | − InitFrameCoding (pCtx, eFrameType, iDidIdx); | |
| 3852 | − iCurTid = GetTemporalLevel (&pSvcParam->sDependencyLayers[iSpatialIdx], pParamInternal->iCodingIndex, | |
| 3853 | − pSvcParam->uiGopSize); | |
| 3849 | + iCurTid = GetTemporalLevel (&pSvcParam->sDependencyLayers[iDidIdx], pParamInternal->iCodingIndex, | |
| 3850 | + pSvcParam->uiGopSize); | |
| 3854 | 3851 | pCtx->uiTemporalId = iCurTid; |
| 3852 | + InitFrameCoding (pCtx, eFrameType, iDidIdx); | |
| 3855 | 3853 | |
| 3856 | 3854 | if (eFrameType == videoFrameTypeIDR) { |
| 3857 | 3855 | // write parameter sets bitstream or SEI/SSEI (if any) here |
| @@ -4433,9 +4431,9 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 575 unmodified lines | ||
| 4433 | 4431 | pFbi->iSubSeqId, iFrameSize); |
| 4434 | 4432 | for (int32_t i = 0; i < iLayerNum; i++) |
| 4435 | 4433 | WelsLog (pLogCtx, WELS_LOG_DEBUG, |
| 4436 | − "WelsEncoderEncodeExt() OutputInfo iLayerId = %d,iNalType = %d,iNalCount = %d, first Nal Length=%d,uiSpatialId = %d", i, | |
| 4434 | + "WelsEncoderEncodeExt() OutputInfo iLayerId = %d,iNalType = %d,iNalCount = %d, first Nal Length=%d,uiSpatialId = %d,uiTemporalId = %d", i, | |
| 4437 | 4435 | pFbi->sLayerInfo[i].uiLayerType, pFbi->sLayerInfo[i].iNalCount, pFbi->sLayerInfo[i].pNalLengthInByte[0], |
| 4438 | − pFbi->sLayerInfo[i].uiSpatialId); | |
| 4436 | + pFbi->sLayerInfo[i].uiSpatialId,pFbi->sLayerInfo[i].uiTemporalId); | |
| 4439 | 4437 | WelsEmms(); |
| 4440 | 4438 | |
| 4441 | 4439 | pLayerBsInfo->eFrameType = eFrameType; |