commit
bac135ae81
@ -157,6 +157,7 @@ int32_t ParamValidation (SLogContext* pLogCtx, SWelsSvcCodingParam* pCfg) {
|
||||
}
|
||||
for (i = 0; i < pCfg->iSpatialLayerNum; ++ i) {
|
||||
SSpatialLayerInternal* fDlp = &pCfg->sDependencyLayers[i];
|
||||
SSpatialLayerConfig* pConfig = &pCfg->sSpatialLayers[i];
|
||||
if (fDlp->fOutputFrameRate > fDlp->fInputFrameRate || (fDlp->fInputFrameRate >= -fEpsn
|
||||
&& fDlp->fInputFrameRate <= fEpsn)
|
||||
|| (fDlp->fOutputFrameRate >= -fEpsn && fDlp->fOutputFrameRate <= fEpsn)) {
|
||||
@ -170,6 +171,7 @@ int32_t ParamValidation (SLogContext* pLogCtx, SWelsSvcCodingParam* pCfg) {
|
||||
"AUTO CORRECT: Invalid settings in input frame rate(%.6f) and output frame rate(%.6f) of layer #%d config file: iResult of output frame rate divided by input frame rate should be power of 2(i.e,in/pOut=2^n). \n Auto correcting Output Framerate to Input Framerate %f!\n",
|
||||
fDlp->fInputFrameRate, fDlp->fOutputFrameRate, i, fDlp->fInputFrameRate);
|
||||
fDlp->fOutputFrameRate = fDlp->fInputFrameRate;
|
||||
pConfig->fFrameRate = fDlp->fOutputFrameRate;
|
||||
}
|
||||
}
|
||||
|
||||
@ -483,7 +485,8 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa
|
||||
|
||||
|
||||
void WelsEncoderApplyFrameRate (SWelsSvcCodingParam* pParam) {
|
||||
SSpatialLayerInternal* pLayerParam;
|
||||
SSpatialLayerInternal* pLayerParamInternal;
|
||||
SSpatialLayerConfig* pLayerParam;
|
||||
const float kfEpsn = 0.000001f;
|
||||
const int32_t kiNumLayer = pParam->iSpatialLayerNum;
|
||||
int32_t i;
|
||||
@ -493,14 +496,15 @@ void WelsEncoderApplyFrameRate (SWelsSvcCodingParam* pParam) {
|
||||
|
||||
//set input frame rate to each layer
|
||||
for (i = 0; i < kiNumLayer; i++) {
|
||||
pLayerParam = & (pParam->sDependencyLayers[i]);
|
||||
|
||||
fRatio = pLayerParam->fOutputFrameRate / pLayerParam->fInputFrameRate;
|
||||
if ((kfMaxFrameRate - pLayerParam->fInputFrameRate) > kfEpsn
|
||||
|| (kfMaxFrameRate - pLayerParam->fInputFrameRate) < -kfEpsn) {
|
||||
pLayerParam->fInputFrameRate = kfMaxFrameRate;
|
||||
pLayerParamInternal = & (pParam->sDependencyLayers[i]);
|
||||
pLayerParam = & (pParam->sSpatialLayers[i]);
|
||||
fRatio = pLayerParamInternal->fOutputFrameRate / pLayerParamInternal->fInputFrameRate;
|
||||
if ((kfMaxFrameRate - pLayerParamInternal->fInputFrameRate) > kfEpsn
|
||||
|| (kfMaxFrameRate - pLayerParamInternal->fInputFrameRate) < -kfEpsn) {
|
||||
pLayerParamInternal->fInputFrameRate = kfMaxFrameRate;
|
||||
fTargetOutputFrameRate = kfMaxFrameRate * fRatio;
|
||||
pLayerParam->fOutputFrameRate = (fTargetOutputFrameRate >= 6) ? fTargetOutputFrameRate : (pLayerParam->fInputFrameRate);
|
||||
pLayerParamInternal->fOutputFrameRate = (fTargetOutputFrameRate >= 6) ? fTargetOutputFrameRate : (pLayerParamInternal->fInputFrameRate);
|
||||
pLayerParam->fFrameRate = pLayerParamInternal->fOutputFrameRate;
|
||||
//TODO:{Sijia} from design, there is no sense to have temporal layer when under 6fps even with such setting?
|
||||
}
|
||||
}
|
||||
|
@ -217,12 +217,12 @@ void RcUpdateBitrateFps (sWelsEncCtx* pEncCtx) {
|
||||
const int32_t kiGopSize = (1 << pDLayerParamInternal->iDecompositionStages);
|
||||
const int32_t kiHighestTid = pDLayerParamInternal->iHighestTemporalId;
|
||||
int64_t input_iBitsPerFrame = WELS_ROUND64 (((int64_t)pDLayerParam->iSpatialBitrate) * INT_MULTIPLY /
|
||||
pDLayerParamInternal->fInputFrameRate);
|
||||
pDLayerParamInternal->fOutputFrameRate);
|
||||
const int32_t kiGopBits = WELS_DIV_ROUND (input_iBitsPerFrame * kiGopSize, INT_MULTIPLY);
|
||||
int32_t i;
|
||||
|
||||
pWelsSvcRc->iBitRate = pDLayerParam->iSpatialBitrate;
|
||||
pWelsSvcRc->fFrameRate = pDLayerParamInternal->fInputFrameRate;
|
||||
pWelsSvcRc->fFrameRate = pDLayerParamInternal->fOutputFrameRate;
|
||||
|
||||
int32_t iTargetVaryRange = FRAME_iTargetBits_VARY_RANGE * (MAX_BITS_VARY_PERCENTAGE - pWelsSvcRc->iRcVaryRatio);
|
||||
int32_t iMinBitsRatio = (MAX_BITS_VARY_PERCENTAGE) * INT_MULTIPLY - iTargetVaryRange;
|
||||
@ -244,7 +244,7 @@ void RcUpdateBitrateFps (sWelsEncCtx* pEncCtx) {
|
||||
pWelsSvcRc->iRemainingBits = (int32_t) (pWelsSvcRc->iRemainingBits * input_iBitsPerFrame / pWelsSvcRc->iBitsPerFrame);
|
||||
pWelsSvcRc->iBitsPerFrame = input_iBitsPerFrame;
|
||||
pWelsSvcRc->iMaxBitsPerFrame = WELS_DIV_ROUND64 ((pDLayerParam->iMaxSpatialBitrate) * INT_MULTIPLY,
|
||||
pDLayerParamInternal->fInputFrameRate);
|
||||
pDLayerParamInternal->fOutputFrameRate);
|
||||
}
|
||||
|
||||
|
||||
@ -297,7 +297,7 @@ void RcInitRefreshParameter (sWelsEncCtx* pEncCtx) {
|
||||
|
||||
//Backup the initial bitrate and fps
|
||||
pWelsSvcRc->iPreviousBitrate = pDLayerParam->iSpatialBitrate;
|
||||
pWelsSvcRc->dPreviousFps = pDLayerParamInternal->fInputFrameRate;
|
||||
pWelsSvcRc->dPreviousFps = pDLayerParamInternal->fOutputFrameRate;
|
||||
|
||||
memset (pWelsSvcRc->pCurrentFrameGomSad, 0, pWelsSvcRc->iGomSize * sizeof (int32_t));
|
||||
|
||||
@ -313,10 +313,10 @@ bool RcJudgeBitrateFpsUpdate (sWelsEncCtx* pEncCtx) {
|
||||
SSpatialLayerConfig* pDLayerParam = &pEncCtx->pSvcParam->sSpatialLayers[iCurDid];
|
||||
|
||||
if ((pWelsSvcRc->iPreviousBitrate != pDLayerParam->iSpatialBitrate) ||
|
||||
(pWelsSvcRc->dPreviousFps - pDLayerParamInternal->fInputFrameRate) > EPSN ||
|
||||
(pWelsSvcRc->dPreviousFps - pDLayerParamInternal->fInputFrameRate) < -EPSN) {
|
||||
(pWelsSvcRc->dPreviousFps - pDLayerParamInternal->fOutputFrameRate) > EPSN ||
|
||||
(pWelsSvcRc->dPreviousFps - pDLayerParamInternal->fOutputFrameRate) < -EPSN) {
|
||||
pWelsSvcRc->iPreviousBitrate = pDLayerParam->iSpatialBitrate;
|
||||
pWelsSvcRc->dPreviousFps = pDLayerParamInternal->fInputFrameRate;
|
||||
pWelsSvcRc->dPreviousFps = pDLayerParamInternal->fOutputFrameRate;
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
@ -388,9 +388,9 @@ void RcInitIdrQp (sWelsEncCtx* pEncCtx) {
|
||||
|
||||
SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
|
||||
SSpatialLayerConfig* pDLayerParam = &pEncCtx->pSvcParam->sSpatialLayers[pEncCtx->uiDependencyId];
|
||||
|
||||
if (pDLayerParam->fFrameRate > EPSN && pDLayerParam->iVideoWidth && pDLayerParam->iVideoHeight)
|
||||
dBpp = (double) (pDLayerParam->iSpatialBitrate) / (double) (pDLayerParam->fFrameRate * pDLayerParam->iVideoWidth *
|
||||
SSpatialLayerInternal* pDLayerParamInternal = &pEncCtx->pSvcParam->sDependencyLayers[pEncCtx->uiDependencyId];
|
||||
if (pDLayerParamInternal->fOutputFrameRate > EPSN && pDLayerParam->iVideoWidth && pDLayerParam->iVideoHeight)
|
||||
dBpp = (double) (pDLayerParam->iSpatialBitrate) / (double) (pDLayerParamInternal->fOutputFrameRate * pDLayerParam->iVideoWidth *
|
||||
pDLayerParam->iVideoHeight);
|
||||
else
|
||||
dBpp = 0.1;
|
||||
@ -1145,6 +1145,7 @@ void WelRcPictureInitScc (sWelsEncCtx* pEncCtx) {
|
||||
SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
|
||||
SVAAFrameInfoExt* pVaa = static_cast<SVAAFrameInfoExt*> (pEncCtx->pVaa);
|
||||
SSpatialLayerConfig* pDLayerConfig = &pEncCtx->pSvcParam->sSpatialLayers[pEncCtx->uiDependencyId];
|
||||
SSpatialLayerInternal* pDLayerParamInternal = &pEncCtx->pSvcParam->sDependencyLayers[pEncCtx->uiDependencyId];
|
||||
int32_t iFrameCplx = pVaa->sComplexityScreenParam.iFrameComplexity;
|
||||
int32_t iBitRate = pDLayerConfig->iSpatialBitrate;// pEncCtx->pSvcParam->target_bitrate;
|
||||
|
||||
@ -1159,7 +1160,7 @@ void WelRcPictureInitScc (sWelsEncCtx* pEncCtx) {
|
||||
|
||||
pEncCtx->iGlobalQp = WELS_CLIP3 (iQp, MIN_IDR_QP, MAX_IDR_QP);
|
||||
} else {
|
||||
int32_t iTargetBits = WELS_ROUND (((float)iBitRate / pDLayerConfig->fFrameRate)); //iBitRate / 10;
|
||||
int32_t iTargetBits = WELS_ROUND (((float)iBitRate / pDLayerParamInternal->fOutputFrameRate)); //iBitRate / 10;
|
||||
int32_t iQstep = (int32_t) (WELS_DIV_ROUND64 (iFrameCplx * pWelsSvcRc->iAvgCost2Bits, iTargetBits));
|
||||
int32_t iQp = RcConvertQStep2Qp (iQstep);
|
||||
iDeltaQp = iQp - iBaseQp;
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user