ref: 987609a3c925451ebdfd604a0d9b633953f348c0
parent: c6f078dd5ab0b356696ee1d85df7929e9b72b4ab
author: sijchen@cisco.com <sijchen@cisco.com>
date: Fri Feb 2 12:08:07 EST 2018
fix RC log numbers
--- a/codec/encoder/core/inc/param_svc.h
+++ b/codec/encoder/core/inc/param_svc.h
@@ -257,7 +257,7 @@
MIN_FRAME_RATE, MAX_FRAME_RATE);
pDlp->fInputFrameRate =
pDlp->fOutputFrameRate = WELS_CLIP3 (sSpatialLayers[iIdxSpatial].fFrameRate, MIN_FRAME_RATE,
- MAX_FRAME_RATE);
+ MAX_FRAME_RATE);
#ifdef ENABLE_FRAME_DUMP
pDlp->sRecFileName[0] = '\0'; // file to be constructed
#endif//ENABLE_FRAME_DUMP
@@ -317,7 +317,7 @@
iTargetBitrate = pCodingParam.iTargetBitrate; // target bitrate
iMaxBitrate = pCodingParam.iMaxBitrate;
- if (iMaxBitrate < iTargetBitrate) {
+ if ((iMaxBitrate != UNSPECIFIED_BIT_RATE) && (iMaxBitrate < iTargetBitrate)) {
iMaxBitrate = iTargetBitrate;
}
iMaxQp = pCodingParam.iMaxQp;
--- a/codec/encoder/core/inc/rc.h
+++ b/codec/encoder/core/inc/rc.h
@@ -271,7 +271,7 @@
bool WelsRcPostFrameSkipping(sWelsEncCtx* pCtx, const int32_t iDid, const long long uiTimeStamp);
void WelsRcPostFrameSkippedUpdate (sWelsEncCtx* pCtx, const int32_t iDid);
-void RcTraceFrameBits (sWelsEncCtx* pEncCtx, long long uiTimeStamp);
+void RcTraceFrameBits (sWelsEncCtx* pEncCtx, long long uiTimeStamp, int32_t iFrameSize);
void WelsRcInitModule (sWelsEncCtx* pCtx, RC_MODES iRcMode);
void WelsRcInitFuncPointers (sWelsEncCtx* pEncCtx, RC_MODES iRcMode);
void WelsRcFreeMemory (sWelsEncCtx* pCtx);
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -3878,7 +3878,8 @@
}
pCtx->pFuncList->pfRc.pfWelsRcPictureInfoUpdate (pCtx, iLayerSize);
- RcTraceFrameBits (pCtx, pFbi->uiTimeStamp);
+ iFrameSize += iLayerSize;
+ RcTraceFrameBits (pCtx, pFbi->uiTimeStamp, iFrameSize);
pCtx->pDecPic->iFrameAverageQp = pCtx->pWelsSvcRc[iCurDid].iAverageFrameQp;
//update scc related
@@ -3894,7 +3895,7 @@
}
}
- iFrameSize += iLayerSize;
+
//check MinCr
{
int32_t iMinCrFrameSize = (pParam->iVideoWidth * pParam->iVideoHeight * 3) >> 2; //MinCr = 2;
--- a/codec/encoder/core/src/ratectl.cpp
+++ b/codec/encoder/core/src/ratectl.cpp
@@ -1004,7 +1004,7 @@
}
-void RcTraceFrameBits (sWelsEncCtx* pEncCtx, long long uiTimeStamp) {
+void RcTraceFrameBits (sWelsEncCtx* pEncCtx, long long uiTimeStamp, int32_t iFrameSize) {
SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
SSpatialLayerInternal* pParamInternal = &pEncCtx->pSvcParam->sDependencyLayers[pEncCtx->uiDependencyId];
if (pWelsSvcRc->iPredFrameBit != 0)
@@ -1019,7 +1019,8 @@
pEncCtx->uiDependencyId, uiTimeStamp, pEncCtx->eSliceType, pEncCtx->iGlobalQp, pWelsSvcRc->iAverageFrameQp,
pWelsSvcRc->iMaxFrameQp,
pWelsSvcRc->iMinFrameQp,
- pParamInternal->iFrameIndex, pEncCtx->uiTemporalId, pWelsSvcRc->iFrameDqBits, pWelsSvcRc->iBitsPerFrame,
+ pParamInternal->iFrameIndex, pEncCtx->uiTemporalId, pWelsSvcRc->iFrameDqBits,
+ ( pWelsSvcRc->iBitsPerFrame>0 ) ? pWelsSvcRc->iBitsPerFrame : (iFrameSize<<3),
pWelsSvcRc->iTargetBits, pWelsSvcRc->iRemainingBits, pWelsSvcRc->iBufferSizeSkip);
}
@@ -1298,7 +1299,7 @@
else
pEncCtx->iGlobalQp += 2;
pEncCtx->iGlobalQp = WELS_CLIP3 (pEncCtx->iGlobalQp, iMinQp, pWelsSvcRc->iMaxQp);
- pWelsSvcRc->iAverageFrameQp = pEncCtx->iGlobalQp;
+ pWelsSvcRc->iAverageFrameQp = pWelsSvcRc->iMaxFrameQp = pWelsSvcRc->iMinFrameQp = pEncCtx->iGlobalQp;
}
void WelRcPictureInitScc (sWelsEncCtx* pEncCtx, long long uiTimeStamp) {
SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];