History

fix timestamp = 0 issue when rc mode is BITRATE mode

sijchen committed 10 years ago

Commit 9816e331 parent 597b4ee6 files · +26 −22Browse files

Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 6 files). Show all

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+10−10
@@ -3716,7 +3716,7 @@ void ClearFrameBsInfo (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi) { · 3715 unmodified lines
3716 * \pParam pSrcPic Source Picture3716 * \pParam pSrcPic Source Picture
3717 * \return EFrameType (videoFrameTypeIDR/videoFrameTypeI/videoFrameTypeP)3717 * \return EFrameType (videoFrameTypeIDR/videoFrameTypeI/videoFrameTypeP)
3718 */3718 */
3719int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSourcePicture* pSrcPic,int64_t uiTimeStamp ) {3719int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSourcePicture* pSrcPic ) {
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 initialization3758 pFbi->iLayerNum = 0; // for initialization
3759 pFbi->uiTimeStamp = uiTimeStamp;3759 pFbi->uiTimeStamp = GetTimestampForRc(pSrcPic->uiTimeStamp, pCtx->uiLastTimestamp, pCtx->pSvcParam->sSpatialLayers->fFrameRate);
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 layers3763 // 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,uiTimeStamp);3766 pCtx->pFuncList->pfRc.pfWelsUpdateMaxBrWindowStatus (pCtx, iSpatialNum, pFbi->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 uiTimeStamp, pCtx->iContinualSkipFrames);3812 pFbi->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 enable3830 //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)uiTimeStamp);3833 (uint32_t)pFbi->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 uiTimeStamp, pCtx->iContinualSkipFrames);3839 pFbi->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 layer3969 PrefetchReferencePicture (pCtx, eFrameType); // update reference picture for current pDq layer
3970 3970
3971 pCtx->pFuncList->pfRc.pfWelsRcPictureInit (pCtx, uiTimeStamp);3971 pCtx->pFuncList->pfRc.pfWelsRcPictureInit (pCtx, pFbi->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 content3974 //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.pfWelsRcPostFrameSkipping4168 if (NULL != pCtx->pFuncList->pfRc.pfWelsRcPostFrameSkipping
4169 && pCtx->pFuncList->pfRc.pfWelsRcPostFrameSkipping (pCtx, iCurDid,uiTimeStamp)) {4169 && pCtx->pFuncList->pfRc.pfWelsRcPostFrameSkipping (pCtx, iCurDid, pFbi->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 uiTimeStamp, pCtx->iContinualSkipFrames);4185 pFbi->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,uiTimeStamp);4203 RcTraceFrameBits (pCtx, pFbi->uiTimeStamp);
4204 pCtx->pDecPic->iFrameAverageQp = pCtx->pWelsSvcRc[iDidIdx].iAverageFrameQp;4204 pCtx->pDecPic->iFrameAverageQp = pCtx->pWelsSvcRc[iDidIdx].iAverageFrameQp;
4205 4205
4206 //update scc related4206 //update scc related

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t