Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 9 files). Show all
Unified · Split
| @@ -1163,7 +1163,6 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p · 1162 unmodified lines | |||
| 1163 | const int32_t kiMbW = (pDlayer->iVideoWidth + 0x0f) >> 4; | 1163 | const int32_t kiMbW = (pDlayer->iVideoWidth + 0x0f) >> 4; |
| 1164 | const int32_t kiMbH = (pDlayer->iVideoHeight + 0x0f) >> 4; | 1164 | const int32_t kiMbH = (pDlayer->iVideoHeight + 0x0f) >> 4; |
| 1165 | 1165 | ||
| 1166 | pParamInternal->iSkipFrameFlag = 0; | ||
| 1167 | pParamInternal->iCodingIndex = 0; | 1166 | pParamInternal->iCodingIndex = 0; |
| 1168 | pParamInternal->iFrameIndex = 0; | 1167 | pParamInternal->iFrameIndex = 0; |
| 1169 | pParamInternal->iFrameNum = 0; | 1168 | pParamInternal->iFrameNum = 0; |
| @@ -3144,7 +3143,6 @@ int32_t ForceCodingIDR (sWelsEncCtx* pCtx) { · 1974 unmodified lines | |||
| 3144 | for (int32_t iDid = 0; iDid < pCtx->pSvcParam->iSpatialLayerNum; iDid++) { | 3143 | for (int32_t iDid = 0; iDid < pCtx->pSvcParam->iSpatialLayerNum; iDid++) { |
| 3145 | SSpatialLayerInternal* pParamInternal = &pCtx->pSvcParam->sDependencyLayers[iDid]; | 3144 | SSpatialLayerInternal* pParamInternal = &pCtx->pSvcParam->sDependencyLayers[iDid]; |
| 3146 | pParamInternal->iCodingIndex = 0; | 3145 | pParamInternal->iCodingIndex = 0; |
| 3147 | pParamInternal->iSkipFrameFlag = 0; | ||
| 3148 | pParamInternal->iFrameIndex = 0; | 3146 | pParamInternal->iFrameIndex = 0; |
| 3149 | pParamInternal->iFrameNum = 0; | 3147 | pParamInternal->iFrameNum = 0; |
| 3150 | pParamInternal->iPOC = 0; | 3148 | pParamInternal->iPOC = 0; |
| @@ -3454,14 +3452,9 @@ EVideoFrameType PrepareEncodeFrame (sWelsEncCtx* pCtx, SLayerBSInfo*& pLayerBsIn · 303 unmodified lines | |||
| 3454 | int32_t& iLayerNum, int32_t& iFrameSize, long long uiTimeStamp) { | 3452 | int32_t& iLayerNum, int32_t& iFrameSize, long long uiTimeStamp) { |
| 3455 | SWelsSvcCodingParam* pSvcParam = pCtx->pSvcParam; | 3453 | SWelsSvcCodingParam* pSvcParam = pCtx->pSvcParam; |
| 3456 | SSpatialPicIndex* pSpatialIndexMap = &pCtx->sSpatialIndexMap[0]; | 3454 | SSpatialPicIndex* pSpatialIndexMap = &pCtx->sSpatialIndexMap[0]; |
| 3457 | if (!pSvcParam->bSimulcastAVC) { | 3455 | |
| 3458 | pCtx->iSkipFrameFlag = false; | 3456 | bool bSkipFrameFlag = WelsRcCheckFrameStatus (pCtx,uiTimeStamp,iSpatialNum); |
| 3459 | for (int32_t iDid = 0; iDid < iSpatialNum; iDid++) { | 3457 | EVideoFrameType eFrameType = DecideFrameType (pCtx, iSpatialNum, iCurDid, bSkipFrameFlag); |
| 3460 | if (pCtx->pSvcParam->sDependencyLayers[ (pSpatialIndexMap + iDid)->iDid].iSkipFrameFlag) | ||
| 3461 | pCtx->iSkipFrameFlag = 1; | ||
| 3462 | } | ||
| 3463 | } | ||
| 3464 | EVideoFrameType eFrameType = DecideFrameType (pCtx, iSpatialNum, iCurDid); | ||
| 3465 | 3458 | ||
| 3466 | if (eFrameType == videoFrameTypeSkip) { | 3459 | if (eFrameType == videoFrameTypeSkip) { |
| 3467 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, | 3460 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, |
| @@ -3475,27 +3468,12 @@ EVideoFrameType PrepareEncodeFrame (sWelsEncCtx* pCtx, SLayerBSInfo*& pLayerBsIn · 7 unmodified lines | |||
| 3475 | else { | 3468 | else { |
| 3476 | if (pCtx->pFuncList->pfRc.pfWelsUpdateBufferWhenSkip) { | 3469 | if (pCtx->pFuncList->pfRc.pfWelsUpdateBufferWhenSkip) { |
| 3477 | for (int32_t i = 0; i < iSpatialNum; i++) { | 3470 | for (int32_t i = 0; i < iSpatialNum; i++) { |
| 3478 | pCtx->pSvcParam->sDependencyLayers[i].iSkipFrameFlag = false; | ||
| 3479 | pCtx->pFuncList->pfRc.pfWelsUpdateBufferWhenSkip (pCtx, (pSpatialIndexMap + i)->iDid); | 3471 | pCtx->pFuncList->pfRc.pfWelsUpdateBufferWhenSkip (pCtx, (pSpatialIndexMap + i)->iDid); |
| 3480 | } | 3472 | } |
| 3481 | } | 3473 | } |
| 3482 | } | 3474 | } |
| 3483 | 3475 | ||
| 3484 | } else { | 3476 | } else { |
| 3485 | if (pCtx->pFuncList->pfRc.pfWelsCheckSkipBasedMaxbr) { | ||
| 3486 | bool bSkip = pCtx->pFuncList->pfRc.pfWelsCheckSkipBasedMaxbr (pCtx, iSpatialNum, eFrameType, | ||
| 3487 | (uint32_t)uiTimeStamp); | ||
| 3488 | if (bSkip) { | ||
| 3489 | eFrameType = videoFrameTypeSkip; | ||
| 3490 | pLayerBsInfo->eFrameType = videoFrameTypeSkip; | ||
| 3491 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, | ||
| 3492 | "[Rc] Frame timestamp = %lld, skip one frame due to max_br, continual skipped %d frames", | ||
| 3493 | uiTimeStamp, pCtx->iContinualSkipFrames); | ||
| 3494 | } | ||
| 3495 | } | ||
| 3496 | } | ||
| 3497 | |||
| 3498 | if (eFrameType != videoFrameTypeSkip) { | ||
| 3499 | SSpatialLayerInternal* pParamInternal = &pSvcParam->sDependencyLayers[iCurDid]; | 3477 | SSpatialLayerInternal* pParamInternal = &pSvcParam->sDependencyLayers[iCurDid]; |
| 3500 | pCtx->iContinualSkipFrames = 0; | 3478 | pCtx->iContinualSkipFrames = 0; |
| 3501 | iCurTid = GetTemporalLevel (&pSvcParam->sDependencyLayers[iCurDid], pParamInternal->iCodingIndex, | 3479 | iCurTid = GetTemporalLevel (&pSvcParam->sDependencyLayers[iCurDid], pParamInternal->iCodingIndex, |