fix bitrate update issue

This commit is contained in:
Karina 2016-03-18 14:28:32 +08:00
parent d7570bfa52
commit 316ab31882
2 changed files with 12 additions and 2 deletions

View File

@ -4718,7 +4718,7 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa
pOldDlpInternal->fInputFrameRate = pNewDlpInternal->fInputFrameRate; // input frame rate pOldDlpInternal->fInputFrameRate = pNewDlpInternal->fInputFrameRate; // input frame rate
pOldDlpInternal->fOutputFrameRate = pNewDlpInternal->fOutputFrameRate; // output frame rate pOldDlpInternal->fOutputFrameRate = pNewDlpInternal->fOutputFrameRate; // output frame rate
pOldDlp->iSpatialBitrate = pNewDlp->iSpatialBitrate; pOldDlp->iSpatialBitrate = pNewDlp->iSpatialBitrate;
pOldDlp->iMaxSpatialBitrate = pNewDlp->iMaxSpatialBitrate;
pOldDlp->uiProfileIdc = pOldDlp->uiProfileIdc =
pNewDlp->uiProfileIdc; // value of profile IDC (0 for auto-detection) pNewDlp->uiProfileIdc; // value of profile IDC (0 for auto-detection)
pOldDlp->iDLayerQp = pNewDlp->iDLayerQp; pOldDlp->iDLayerQp = pNewDlp->iDLayerQp;

View File

@ -1331,10 +1331,20 @@ void WelsRcPictureInitGomTimeStamp (sWelsEncCtx* pEncCtx, long long uiTimeStamp
int32_t iLumaQp = pWelsSvcRc->iLastCalculatedQScale; int32_t iLumaQp = pWelsSvcRc->iLastCalculatedQScale;
int32_t iTl = pEncCtx->uiTemporalId; int32_t iTl = pEncCtx->uiTemporalId;
SRCTemporal* pTOverRc = &pWelsSvcRc->pTemporalOverRc[iTl]; SRCTemporal* pTOverRc = &pWelsSvcRc->pTemporalOverRc[iTl];
//decide one frame bits allocated
if (pEncCtx->eSliceType == I_SLICE) { if (pEncCtx->eSliceType == I_SLICE) {
if (0 == pWelsSvcRc->iIdrNum) { //iIdrNum == 0 means encoder has been initialed if (0 == pWelsSvcRc->iIdrNum) { //iIdrNum == 0 means encoder has been initialed
RcInitRefreshParameter (pEncCtx); RcInitRefreshParameter (pEncCtx);
}
}
if (RcJudgeBitrateFpsUpdate (pEncCtx)) {
RcUpdateBitrateFps (pEncCtx);
}
if (pEncCtx->uiTemporalId == 0) {
RcUpdateTemporalZero (pEncCtx);
}
//decide one frame bits allocated
if (pEncCtx->eSliceType == I_SLICE) {
if (0 == pWelsSvcRc->iIdrNum) { //iIdrNum == 0 means encoder has been initialed
RcInitIdrQp (pEncCtx); RcInitIdrQp (pEncCtx);
iLumaQp = pWelsSvcRc->iInitialQp; iLumaQp = pWelsSvcRc->iInitialQp;
pWelsSvcRc->iTargetBits = static_cast<int32_t> (((double) (pDLayerParam->iSpatialBitrate) / (double) ( pWelsSvcRc->iTargetBits = static_cast<int32_t> (((double) (pDLayerParam->iSpatialBitrate) / (double) (