Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 4 files). Show all
Unified · Split
| @@ -2582,7 +2582,7 @@ int32_t WelsInitEncoderExt (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPar · 2581 unmodified lines | |||
| 2582 | #endif//MEMORY_MONITOR | 2582 | #endif//MEMORY_MONITOR |
| 2583 | 2583 | ||
| 2584 | pCtx->iStatisticsLogInterval = STATISTICS_LOG_INTERVAL_MS; | 2584 | pCtx->iStatisticsLogInterval = STATISTICS_LOG_INTERVAL_MS; |
| 2585 | 2585 | pCtx->uiLastTimestamp = -1; | |
| 2586 | *ppCtx = pCtx; | 2586 | *ppCtx = pCtx; |
| 2587 | 2587 | ||
| 2588 | WelsLog (pLogCtx, WELS_LOG_DEBUG, "WelsInitEncoderExt(), pCtx= 0x%p.", (void*)pCtx); | 2588 | WelsLog (pLogCtx, WELS_LOG_DEBUG, "WelsInitEncoderExt(), pCtx= 0x%p.", (void*)pCtx); |
| @@ -3716,7 +3716,7 @@ void ClearFrameBsInfo (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi) { · 1127 unmodified lines | |||
| 3716 | * \pParam pSrcPic Source Picture | 3716 | * \pParam pSrcPic Source Picture |
| 3717 | * \return EFrameType (videoFrameTypeIDR/videoFrameTypeI/videoFrameTypeP) | 3717 | * \return EFrameType (videoFrameTypeIDR/videoFrameTypeI/videoFrameTypeP) |
| 3718 | */ | 3718 | */ |
| 3719 | int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSourcePicture* pSrcPic) { | 3719 | int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSourcePicture* pSrcPic,int64_t uiTimeStamp ) { |
| 3720 | if (pCtx == NULL) { | 3720 | if (pCtx == NULL) { |
| 3721 | return ENC_RETURN_MEMALLOCERR; | 3721 | return ENC_RETURN_MEMALLOCERR; |
| 3722 | } | 3722 | } |
| @@ -3756,14 +3756,14 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 33 unmodified lines | |||
| 3756 | pCtx->iEncoderError = ENC_RETURN_SUCCESS; | 3756 | pCtx->iEncoderError = ENC_RETURN_SUCCESS; |
| 3757 | pCtx->bCurFrameMarkedAsSceneLtr = false; | 3757 | pCtx->bCurFrameMarkedAsSceneLtr = false; |
| 3758 | pFbi->iLayerNum = 0; // for initialization | 3758 | pFbi->iLayerNum = 0; // for initialization |
| 3759 | pFbi->uiTimeStamp = pSrcPic->uiTimeStamp; | 3759 | pFbi->uiTimeStamp = uiTimeStamp; |
| 3760 | for (int32_t iNalIdx = 0; iNalIdx < MAX_LAYER_NUM_OF_FRAME; iNalIdx++) { | 3760 | for (int32_t iNalIdx = 0; iNalIdx < MAX_LAYER_NUM_OF_FRAME; iNalIdx++) { |
| 3761 | pFbi->sLayerInfo[iNalIdx].eFrameType = videoFrameTypeSkip; | 3761 | pFbi->sLayerInfo[iNalIdx].eFrameType = videoFrameTypeSkip; |
| 3762 | } | 3762 | } |
| 3763 | // perform csc/denoise/downsample/padding, generate spatial layers | 3763 | // perform csc/denoise/downsample/padding, generate spatial layers |
| 3764 | iSpatialNum = pCtx->pVpp->BuildSpatialPicList (pCtx, pSrcPic); | 3764 | iSpatialNum = pCtx->pVpp->BuildSpatialPicList (pCtx, pSrcPic); |
| 3765 | if (pCtx->pFuncList->pfRc.pfWelsUpdateMaxBrWindowStatus) { | 3765 | if (pCtx->pFuncList->pfRc.pfWelsUpdateMaxBrWindowStatus) { |
| 3766 | pCtx->pFuncList->pfRc.pfWelsUpdateMaxBrWindowStatus (pCtx, iSpatialNum, pSrcPic->uiTimeStamp); | 3766 | pCtx->pFuncList->pfRc.pfWelsUpdateMaxBrWindowStatus (pCtx, iSpatialNum,uiTimeStamp); |
| 3767 | } | 3767 | } |
| 3768 | 3768 | ||
| 3769 | if (iSpatialNum < 1) { | 3769 | if (iSpatialNum < 1) { |
| @@ -3809,7 +3809,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 39 unmodified lines | |||
| 3809 | pLayerBsInfo->eFrameType = eFrameType; | 3809 | pLayerBsInfo->eFrameType = eFrameType; |
| 3810 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, | 3810 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, |
| 3811 | "[Rc] Frame timestamp = %lld, skip one frame due to target_br, continual skipped %d frames", | 3811 | "[Rc] Frame timestamp = %lld, skip one frame due to target_br, continual skipped %d frames", |
| 3812 | pSrcPic->uiTimeStamp, pCtx->iContinualSkipFrames); | 3812 | uiTimeStamp, pCtx->iContinualSkipFrames); |
| 3813 | ++ iSpatialIdx; | 3813 | ++ iSpatialIdx; |
| 3814 | if (pSvcParam->bSimulcastAVC) { | 3814 | if (pSvcParam->bSimulcastAVC) { |
| 3815 | if (pCtx->pFuncList->pfRc.pfWelsUpdateBufferWhenSkip) | 3815 | if (pCtx->pFuncList->pfRc.pfWelsUpdateBufferWhenSkip) |
| @@ -3830,13 +3830,13 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 14 unmodified lines | |||
| 3830 | //loop each layer to check if have skip frame when RC and frame skip enable | 3830 | //loop each layer to check if have skip frame when RC and frame skip enable |
| 3831 | if (pCtx->pFuncList->pfRc.pfWelsCheckSkipBasedMaxbr) { | 3831 | if (pCtx->pFuncList->pfRc.pfWelsCheckSkipBasedMaxbr) { |
| 3832 | bool bSkip = pCtx->pFuncList->pfRc.pfWelsCheckSkipBasedMaxbr (pCtx, iSpatialNum, eFrameType, | 3832 | bool bSkip = pCtx->pFuncList->pfRc.pfWelsCheckSkipBasedMaxbr (pCtx, iSpatialNum, eFrameType, |
| 3833 | (uint32_t)pSrcPic->uiTimeStamp); | 3833 | (uint32_t)uiTimeStamp); |
| 3834 | if (bSkip) { | 3834 | if (bSkip) { |
| 3835 | eFrameType = videoFrameTypeSkip; | 3835 | eFrameType = videoFrameTypeSkip; |
| 3836 | pLayerBsInfo->eFrameType = videoFrameTypeSkip; | 3836 | pLayerBsInfo->eFrameType = videoFrameTypeSkip; |
| 3837 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, | 3837 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, |
| 3838 | "[Rc] Frame timestamp = %lld, skip one frame due to max_br, continual skipped %d frames", | 3838 | "[Rc] Frame timestamp = %lld, skip one frame due to max_br, continual skipped %d frames", |
| 3839 | pSrcPic->uiTimeStamp, pCtx->iContinualSkipFrames); | 3839 | uiTimeStamp, pCtx->iContinualSkipFrames); |
| 3840 | ++ iSpatialIdx; | 3840 | ++ iSpatialIdx; |
| 3841 | if (pSvcParam->bSimulcastAVC) | 3841 | if (pSvcParam->bSimulcastAVC) |
| 3842 | continue; | 3842 | continue; |
| @@ -3968,7 +3968,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 125 unmodified lines | |||
| 3968 | eFrameType); //get reordering syntax used for writing slice header and transmit to encoder. | 3968 | eFrameType); //get reordering syntax used for writing slice header and transmit to encoder. |
| 3969 | PrefetchReferencePicture (pCtx, eFrameType); // update reference picture for current pDq layer | 3969 | PrefetchReferencePicture (pCtx, eFrameType); // update reference picture for current pDq layer |
| 3970 | 3970 | ||
| 3971 | pCtx->pFuncList->pfRc.pfWelsRcPictureInit (pCtx, pSrcPic->uiTimeStamp); | 3971 | pCtx->pFuncList->pfRc.pfWelsRcPictureInit (pCtx, uiTimeStamp); |
| 3972 | PreprocessSliceCoding (pCtx); // MUST be called after pfWelsRcPictureInit() and WelsInitCurrentLayer() | 3972 | PreprocessSliceCoding (pCtx); // MUST be called after pfWelsRcPictureInit() and WelsInitCurrentLayer() |
| 3973 | 3973 | ||
| 3974 | //TODO Complexity Calculation here for screen content | 3974 | //TODO Complexity Calculation here for screen content |
| @@ -4166,7 +4166,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 191 unmodified lines | |||
| 4166 | } | 4166 | } |
| 4167 | 4167 | ||
| 4168 | if (NULL != pCtx->pFuncList->pfRc.pfWelsRcPostFrameSkipping | 4168 | if (NULL != pCtx->pFuncList->pfRc.pfWelsRcPostFrameSkipping |
| 4169 | && pCtx->pFuncList->pfRc.pfWelsRcPostFrameSkipping (pCtx, iCurDid, pSrcPic->uiTimeStamp)) { | 4169 | && pCtx->pFuncList->pfRc.pfWelsRcPostFrameSkipping (pCtx, iCurDid,uiTimeStamp)) { |
| 4170 | 4170 | ||
| 4171 | StackBackEncoderStatus (pCtx, eFrameType); | 4171 | StackBackEncoderStatus (pCtx, eFrameType); |
| 4172 | ClearFrameBsInfo (pCtx, pFbi); | 4172 | ClearFrameBsInfo (pCtx, pFbi); |
| @@ -4182,7 +4182,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 9 unmodified lines | |||
| 4182 | WelsRcPostFrameSkippedUpdate (pCtx, iCurDid); | 4182 | WelsRcPostFrameSkippedUpdate (pCtx, iCurDid); |
| 4183 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO, | 4183 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO, |
| 4184 | "[Rc] Frame timestamp = %lld, skip one frame due to post skip, continual skipped %d frames", | 4184 | "[Rc] Frame timestamp = %lld, skip one frame due to post skip, continual skipped %d frames", |
| 4185 | pSrcPic->uiTimeStamp, pCtx->iContinualSkipFrames); | 4185 | uiTimeStamp, pCtx->iContinualSkipFrames); |
| 4186 | pCtx->iEncoderError = ENC_RETURN_SUCCESS; | 4186 | pCtx->iEncoderError = ENC_RETURN_SUCCESS; |
| 4187 | return ENC_RETURN_SUCCESS; | 4187 | return ENC_RETURN_SUCCESS; |
| 4188 | } | 4188 | } |
| @@ -4200,7 +4200,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 11 unmodified lines | |||
| 4200 | } | 4200 | } |
| 4201 | 4201 | ||
| 4202 | pCtx->pFuncList->pfRc.pfWelsRcPictureInfoUpdate (pCtx, iLayerSize); | 4202 | pCtx->pFuncList->pfRc.pfWelsRcPictureInfoUpdate (pCtx, iLayerSize); |
| 4203 | RcTraceFrameBits (pCtx, pSrcPic->uiTimeStamp); | 4203 | RcTraceFrameBits (pCtx,uiTimeStamp); |
| 4204 | pCtx->pDecPic->iFrameAverageQp = pCtx->pWelsSvcRc[iDidIdx].iAverageFrameQp; | 4204 | pCtx->pDecPic->iFrameAverageQp = pCtx->pWelsSvcRc[iDidIdx].iAverageFrameQp; |
| 4205 | 4205 | ||
| 4206 | //update scc related | 4206 | //update scc related |