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
12851285 if ((pDLayerParam->fFrameRate > EPSN) && (pDLayerParam->iVideoWidth && pDLayerParam->iVideoHeight))
12861286 dBpp = (double) (pDLayerParam->iSpatialBitrate) / (double) (pDLayerParam->fFrameRate * pDLayerParam->iVideoWidth *
12871287 pDLayerParam->iVideoHeight);
1288− pWelsSvcRc->iInitialQp = 50 - dBpp * 10 * 4;
1288+ pWelsSvcRc->iInitialQp = (int32_t) (50 - dBpp * 10 * 4);
12891289 pWelsSvcRc->iInitialQp = WELS_CLIP3 (pWelsSvcRc->iInitialQp, MIN_IDR_QP, MAX_IDR_QP);
12901290
12911291 iLumaQp = pWelsSvcRc->iInitialQp;
1292− pWelsSvcRc->iTargetBits = (double) (pDLayerParam->iSpatialBitrate) / (double) (pDLayerParam->fFrameRate) *
1293− IDR_BITRATE_RATIO;
1292+ pWelsSvcRc->iTargetBits = (int32_t) ((double) (pDLayerParam->iSpatialBitrate) / (double) (pDLayerParam->fFrameRate) *
1293+ IDR_BITRATE_RATIO);
12941294
12951295 WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG,
12961296 "[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
13011301
13021302 int32_t iMaxTh = pWelsSvcRc->iBufferSizeSkip - pWelsSvcRc->iBufferFullnessSkip;
13031303 int32_t iMinTh = iMaxTh / 2;
1304− pWelsSvcRc->iTargetBits = (double) (pDLayerParam->iSpatialBitrate) / (double) (pDLayerParam->fFrameRate) *
1305− IDR_BITRATE_RATIO;
1304+ pWelsSvcRc->iTargetBits = (int32_t) ((double) (pDLayerParam->iSpatialBitrate) / (double) (pDLayerParam->fFrameRate) *
1305+ IDR_BITRATE_RATIO);
13061306 if (iMaxTh > 0) {
13071307 pWelsSvcRc->iTargetBits = WELS_CLIP3 (pWelsSvcRc->iTargetBits, iMinTh, iMaxTh);
13081308
@@ -1331,7 +1331,7 @@ void WelsRcPictureInitGomTimeStamp (sWelsEncCtx* pEncCtx, long long uiTimeStamp · 22 unmodified lines
13311331
13321332 SSpatialLayerInternal* pDLayerParamInternal = &pEncCtx->pSvcParam->sDependencyLayers[pEncCtx->uiDependencyId];
13331333 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));
13351335 const int32_t kiGopBits = iAverageFrameSize * kiGopSize;
13361336 int64_t iCmplxRatio = WELS_DIV_ROUND64 (pEncCtx->pVaa->sComplexityAnalysisParam.iFrameComplexity * INT_MULTIPLY,
13371337 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