History

Add explicit casts when converting from double to int32_t

This fixes build warnings with MSVC.

Martin Storsjö committed 11 years ago

Commit 75bbc281 parent c8972f11 file · +6 −6Browse files

Showing the changes to codec/encoder/core/src/ratectl.cpp (1 of 1 file). Show all

Unified · Split

codec/encoder/core/src/ratectl.cpp+6−6
@@ -1285,12 +1285,12 @@ void WelsRcPictureInitGomTimeStamp (sWelsEncCtx* pEncCtx, long long uiTimeStamp · 1284 unmodified lines
1285 if ((pDLayerParam->fFrameRate > EPSN) && (pDLayerParam->iVideoWidth && pDLayerParam->iVideoHeight))1285 if ((pDLayerParam->fFrameRate > EPSN) && (pDLayerParam->iVideoWidth && pDLayerParam->iVideoHeight))
1286 dBpp = (double) (pDLayerParam->iSpatialBitrate) / (double) (pDLayerParam->fFrameRate * pDLayerParam->iVideoWidth *1286 dBpp = (double) (pDLayerParam->iSpatialBitrate) / (double) (pDLayerParam->fFrameRate * pDLayerParam->iVideoWidth *
1287 pDLayerParam->iVideoHeight);1287 pDLayerParam->iVideoHeight);
1288 pWelsSvcRc->iInitialQp = 50 - dBpp * 10 * 4;1288 pWelsSvcRc->iInitialQp = (int32_t) (50 - dBpp * 10 * 4);
1289 pWelsSvcRc->iInitialQp = WELS_CLIP3 (pWelsSvcRc->iInitialQp, MIN_IDR_QP, MAX_IDR_QP);1289 pWelsSvcRc->iInitialQp = WELS_CLIP3 (pWelsSvcRc->iInitialQp, MIN_IDR_QP, MAX_IDR_QP);
1290 1290
1291 iLumaQp = pWelsSvcRc->iInitialQp;1291 iLumaQp = pWelsSvcRc->iInitialQp;
1292 pWelsSvcRc->iTargetBits = (double) (pDLayerParam->iSpatialBitrate) / (double) (pDLayerParam->fFrameRate) *1292 pWelsSvcRc->iTargetBits = (int32_t) ((double) (pDLayerParam->iSpatialBitrate) / (double) (pDLayerParam->fFrameRate) *
1293 IDR_BITRATE_RATIO;1293 IDR_BITRATE_RATIO);
1294 1294
1295 WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG,1295 WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG,
1296 "[Rc] First IDR iSpatialBitrate = %d,iBufferFullnessSkip = %d,iTargetBits= %d,dBpp = %f,initQp = %d",1296 "[Rc] First IDR iSpatialBitrate = %d,iBufferFullnessSkip = %d,iTargetBits= %d,dBpp = %f,initQp = %d",
@@ -1301,8 +1301,8 @@ void WelsRcPictureInitGomTimeStamp (sWelsEncCtx* pEncCtx, long long uiTimeStamp · 4 unmodified lines
1301 1301
1302 int32_t iMaxTh = pWelsSvcRc->iBufferSizeSkip - pWelsSvcRc->iBufferFullnessSkip;1302 int32_t iMaxTh = pWelsSvcRc->iBufferSizeSkip - pWelsSvcRc->iBufferFullnessSkip;
1303 int32_t iMinTh = iMaxTh / 2;1303 int32_t iMinTh = iMaxTh / 2;
1304 pWelsSvcRc->iTargetBits = (double) (pDLayerParam->iSpatialBitrate) / (double) (pDLayerParam->fFrameRate) *1304 pWelsSvcRc->iTargetBits = (int32_t) ((double) (pDLayerParam->iSpatialBitrate) / (double) (pDLayerParam->fFrameRate) *
1305 IDR_BITRATE_RATIO;1305 IDR_BITRATE_RATIO);
1306 if (iMaxTh > 0) {1306 if (iMaxTh > 0) {
1307 pWelsSvcRc->iTargetBits = WELS_CLIP3 (pWelsSvcRc->iTargetBits, iMinTh, iMaxTh);1307 pWelsSvcRc->iTargetBits = WELS_CLIP3 (pWelsSvcRc->iTargetBits, iMinTh, iMaxTh);
1308 1308
@@ -1331,7 +1331,7 @@ void WelsRcPictureInitGomTimeStamp (sWelsEncCtx* pEncCtx, long long uiTimeStamp · 22 unmodified lines
1331 1331
1332 SSpatialLayerInternal* pDLayerParamInternal = &pEncCtx->pSvcParam->sDependencyLayers[pEncCtx->uiDependencyId];1332 SSpatialLayerInternal* pDLayerParamInternal = &pEncCtx->pSvcParam->sDependencyLayers[pEncCtx->uiDependencyId];
1333 const int32_t kiGopSize = (1 << pDLayerParamInternal->iDecompositionStages);1333 const int32_t kiGopSize = (1 << pDLayerParamInternal->iDecompositionStages);
1334 int32_t iAverageFrameSize = (double) (pDLayerParam->iSpatialBitrate) / (double) (pDLayerParam->fFrameRate);1334 int32_t iAverageFrameSize = (int32_t) ((double) (pDLayerParam->iSpatialBitrate) / (double) (pDLayerParam->fFrameRate));
1335 const int32_t kiGopBits = iAverageFrameSize * kiGopSize;1335 const int32_t kiGopBits = iAverageFrameSize * kiGopSize;
1336 int64_t iCmplxRatio = WELS_DIV_ROUND64 (pEncCtx->pVaa->sComplexityAnalysisParam.iFrameComplexity * INT_MULTIPLY,1336 int64_t iCmplxRatio = WELS_DIV_ROUND64 (pEncCtx->pVaa->sComplexityAnalysisParam.iFrameComplexity * INT_MULTIPLY,
1337 pTOverRc->iFrameCmplxMean);1337 pTOverRc->iFrameCmplxMean);

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