ref: 52008a91e70a329f4045c8165ba462d3ebec1346
parent: 14725d43561724d2cc4bae1e85f7206aa7d8a527
author: Martin Storsjö <martin@martin.st>
date: Tue Apr 25 05:22:15 EDT 2017
Fix warnings with MSVC in EncUT_SliceBufferReallocate.cpp This fixes the following warnings: test/encoder/EncUT_SliceBufferReallocate.cpp(214) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) test/encoder/EncUT_SliceBufferReallocate.cpp(214) : warning C4804: '%' : unsafe use of type 'bool' in operation test/encoder/EncUT_SliceBufferReallocate.cpp(214) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) test/encoder/EncUT_SliceBufferReallocate.cpp(324) : warning C4244: 'initializing' : conversion from 'double' to 'int32_t', possible loss of data test/encoder/EncUT_SliceBufferReallocate.cpp(551) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) test/encoder/EncUT_SliceBufferReallocate.cpp(649) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
--- a/test/encoder/EncUT_SliceBufferReallocate.cpp
+++ b/test/encoder/EncUT_SliceBufferReallocate.cpp
@@ -211,7 +211,7 @@
pCtx->pSvcParam->iMultipleThreadIdc = (pCtx->pSvcParam->iMultipleThreadIdc <= 1 )? 2 : pCtx->pSvcParam->iMultipleThreadIdc;
pCtx->iActiveThreadsNum = pCtx->pSvcParam->iMultipleThreadIdc;
pCtx->pSvcParam->iSpatialLayerNum = 1;
- pCtx->pSvcParam->bSimulcastAVC = (bool)rand() % 2;
+ pCtx->pSvcParam->bSimulcastAVC = rand() % 2 == 1;
pCtx->pSvcParam->iPicHeight = (((rand() % MAX_WIDTH ) >> 4 ) << 4) + 16;
pCtx->pSvcParam->iPicWidth = (((rand() % MAX_HEIGH ) >> 4) << 4) + 16;
@@ -321,7 +321,7 @@
int32_t iLayerBsSize = 0;
int32_t iSliceBufferSize = 0;
int32_t iRet = 0;
- int32_t iMaxFrameRate = 0.0;
+ int32_t iMaxFrameRate = 0;
pLayerCfg->iVideoWidth = pCtx->pSvcParam->iPicWidth >> (pCtx->pSvcParam->iSpatialLayerNum -1 - iLayerIdx);
pLayerCfg->iVideoHeight = pCtx->pSvcParam->iPicHeight >> (pCtx->pSvcParam->iSpatialLayerNum - 1 - iLayerIdx);
@@ -548,7 +548,7 @@
pCtx->iPosBsBuffer = rand() % pCtx->iFrameBsSize + 1;
pLayerBsInfo = &FrameBsInfo.sLayerInfo[iCurLayerIdx];
pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
- pCtx->bNeedPrefixNalFlag = rand() % 2;
+ pCtx->bNeedPrefixNalFlag = rand() % 2 == 1;
int32_t iCodedNalCount = pCtx->pOut->iCountNals;
iRet = FrameBsRealloc(pCtx, &FrameBsInfo, pLayerBsInfo, iCodedNalCount);
@@ -646,7 +646,7 @@
pCtx->iPosBsBuffer = rand() % pCtx->iFrameBsSize + 1;
pLayerBsInfo = &FrameBsInfo.sLayerInfo[iCurLayerIdx];
pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
- pCtx->bNeedPrefixNalFlag = rand() % 2;
+ pCtx->bNeedPrefixNalFlag = rand() % 2 == 1;
iRet = SliceLayerInfoUpdate(pCtx, &FrameBsInfo, pLayerBsInfo, eSlcMode);
EXPECT_TRUE(cmResultSuccess == iRet);