update maxbitrate to control bitrate vary range
This commit is contained in:
parent
065c3a7769
commit
5ba9e409ba
@ -109,6 +109,7 @@ int32_t WelsBitRateVerification(SLogContext* pLogCtx,SSpatialLayerConfig* pLayer
|
|||||||
int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNew);
|
int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNew);
|
||||||
void WelsEncoderApplyFrameRate (SWelsSvcCodingParam* pParam);
|
void WelsEncoderApplyFrameRate (SWelsSvcCodingParam* pParam);
|
||||||
int32_t WelsEncoderApplyBitRate (SLogContext* pLogCtx, SWelsSvcCodingParam* pParam, int32_t iLayer);
|
int32_t WelsEncoderApplyBitRate (SLogContext* pLogCtx, SWelsSvcCodingParam* pParam, int32_t iLayer);
|
||||||
|
int32_t WelsEncoderApplyBitVaryRang(SLogContext* pLogCtx, SWelsSvcCodingParam* pParam, int32_t iRang);
|
||||||
int32_t WelsEncoderApplyLTR (SLogContext* pLogCtx, sWelsEncCtx** ppCtx, SLTRConfig* pLTRValue);
|
int32_t WelsEncoderApplyLTR (SLogContext* pLogCtx, sWelsEncCtx** ppCtx, SLTRConfig* pLTRValue);
|
||||||
int32_t FilterLTRRecoveryRequest (sWelsEncCtx* pCtx, SLTRRecoverRequest* pLTRRecoverRequest);
|
int32_t FilterLTRRecoveryRequest (sWelsEncCtx* pCtx, SLTRRecoverRequest* pLTRRecoverRequest);
|
||||||
|
|
||||||
|
@ -533,6 +533,20 @@ int32_t WelsEncoderApplyBitRate (SLogContext* pLogCtx, SWelsSvcCodingParam* pPar
|
|||||||
}
|
}
|
||||||
return ENC_RETURN_SUCCESS;
|
return ENC_RETURN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
int32_t WelsEncoderApplyBitVaryRang(SLogContext* pLogCtx, SWelsSvcCodingParam* pParam, int32_t iRang){
|
||||||
|
SSpatialLayerConfig* pLayerParam;
|
||||||
|
const int32_t iNumLayers = pParam->iSpatialLayerNum;
|
||||||
|
for (int32_t i = 0; i < iNumLayers; i++) {
|
||||||
|
pLayerParam = & (pParam->sSpatialLayers[i]);
|
||||||
|
pLayerParam->iMaxSpatialBitrate = WELS_MIN(pLayerParam->iSpatialBitrate * (1+ iRang/100.0),pLayerParam->iMaxSpatialBitrate);
|
||||||
|
if (WelsBitRateVerification (pLogCtx, pLayerParam, i) != ENC_RETURN_SUCCESS)
|
||||||
|
return ENC_RETURN_UNSUPPORTED_PARA;
|
||||||
|
WelsLog (pLogCtx, WELS_LOG_INFO,
|
||||||
|
"WelsEncoderApplyBitVaryRang:UpdateMaxBitrate layerId= %d,iMaxSpatialBitrate = %d", i, pLayerParam->iMaxSpatialBitrate);
|
||||||
|
}
|
||||||
|
return ENC_RETURN_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief acquire count number of layers and NALs based on configurable paramters dependency
|
* \brief acquire count number of layers and NALs based on configurable paramters dependency
|
||||||
* \pParam pCtx sWelsEncCtx*
|
* \pParam pCtx sWelsEncCtx*
|
||||||
|
@ -1044,7 +1044,8 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) {
|
|||||||
break;
|
break;
|
||||||
case ENCODER_OPTION_BITS_VARY_PERCENTAGE: {
|
case ENCODER_OPTION_BITS_VARY_PERCENTAGE: {
|
||||||
int32_t iValue = * (static_cast<int32_t*> (pOption));
|
int32_t iValue = * (static_cast<int32_t*> (pOption));
|
||||||
m_pEncContext->pSvcParam->iBitsVaryPercentage = iValue;
|
m_pEncContext->pSvcParam->iBitsVaryPercentage = WELS_CLIP3(iValue,0,100);
|
||||||
|
WelsEncoderApplyBitVaryRang(&m_pWelsTrace->m_sLogCtx, m_pEncContext->pSvcParam, m_pEncContext->pSvcParam->iBitsVaryPercentage);
|
||||||
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
|
||||||
"CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITS_VARY_PERCENTAGE,iBitsVaryPercentage = %d", iValue);
|
"CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITS_VARY_PERCENTAGE,iBitsVaryPercentage = %d", iValue);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user