add win 64 warnings remove

This commit is contained in:
Haibo Zhu
2014-06-18 23:50:48 -07:00
parent 0dcb7584b5
commit daf67d607f
14 changed files with 54 additions and 38 deletions

View File

@@ -48,6 +48,12 @@
#include <stdint.h>
#include <inttypes.h>
#ifdef __LP64__
typedef int64_t intX_t;
#else
typedef int32_t intX_t;
#endif
#else
// FIXME: all singed type should be declared explicit, for example, int8_t should be declared as signed char.
@@ -61,6 +67,12 @@ typedef __int64 int64_t ;
typedef unsigned __int64 uint64_t;
#define PRId64 "I64d"
#ifdef _WIN64
typedef int64_t intX_t;
#else
typedef int32_t intX_t;
#endif
#endif // _MSC_VER defined
// The 'float' type is portable and usable without any need for any extra typedefs.

View File

@@ -112,7 +112,7 @@ int32_t WelsStrftime (char* pBuffer, int32_t iSize, const char* kpFormat, const
localtime_s (&sTimeNow, &kpTp->time);
iRc = strftime (pBuffer, iSize, kpFormat, &sTimeNow);
iRc = (int32_t)strftime (pBuffer, iSize, kpFormat, &sTimeNow);
if (iRc == 0)
pBuffer[0] = '\0';
return iRc;
@@ -244,12 +244,12 @@ int32_t WelsStrftime (char* pBuffer, int32_t iSize, const char* kpFormat, const
char* WelsStrcat (char* pDest, int32_t iSizeInBytes, const char* kpSrc) {
int32_t iCurLen = strlen (pDest);
int32_t iCurLen = (int32_t)strlen (pDest);
return WelsStrncpy (pDest + iCurLen, iSizeInBytes - iCurLen, kpSrc);
}
int32_t WelsFwrite (const void* kpBuffer, int32_t iSize, int32_t iCount, WelsFileHandle* pFp) {
return fwrite (kpBuffer, iSize, iCount, pFp);
return (int32_t)fwrite (kpBuffer, iSize, iCount, pFp);
}
uint16_t WelsGetMillisecond (const SWelsTime* kpTp) {

View File

@@ -339,7 +339,7 @@ int32_t main (int32_t iArgC, char* pArgV[]) {
strOutputFile = strTag[1];
} else if (strTag[0].compare ("RestructionFile") == 0) {
strReconFile = strTag[1];
int32_t iLen = strReconFile.length();
int32_t iLen = (int32_t)strReconFile.length();
sDecParam.pFileNameRestructed = new char[iLen + 1];
if (sDecParam.pFileNameRestructed != NULL) {
sDecParam.pFileNameRestructed[iLen] = 0;

View File

@@ -116,7 +116,7 @@ int ParseLayerConfig (CReadConfig& cRdLayerCfg, const int iLayer, SEncParamExt&
string strTag[4];
string str_ ("SlicesAssign");
const int kiSize = str_.size();
const int kiSize = (int)str_.size();
while (!cRdLayerCfg.EndOfFile()) {
long iLayerRd = cRdLayerCfg.ReadLine (&strTag[0]);
@@ -130,7 +130,7 @@ int ParseLayerConfig (CReadConfig& cRdLayerCfg, const int iLayer, SEncParamExt&
} else if (strTag[0].compare ("FrameRateOut") == 0) {
pDLayer->fFrameRate = (float)atof (strTag[1].c_str());
} else if (strTag[0].compare ("ReconFile") == 0) {
const unsigned int kiLen = strTag[1].length();
const unsigned int kiLen = (unsigned int)strTag[1].length();
if (kiLen >= sizeof (sFileSet.sRecFileName[iLayer]))
return -1;
sFileSet.sRecFileName[iLayer][kiLen] = '\0';
@@ -436,7 +436,7 @@ int ParseCommandLine (int argc, char** argv, SSourcePicture* pSrcPic, SEncParamE
pSvcParam.iLtrMarkPeriod = atoi (argv[n++]);
else if (!strcmp (pCommand, "-threadIdc") && (n < argc))
pSvcParam.iMultipleThreadIdc= atoi (argv[n++]);
pSvcParam.iMultipleThreadIdc = atoi (argv[n++]);
else if (!strcmp (pCommand, "-deblockIdc") && (n < argc))
pSvcParam.iLoopFilterDisableIdc = atoi (argv[n++]);
@@ -454,15 +454,17 @@ int ParseCommandLine (int argc, char** argv, SSourcePicture* pSrcPic, SEncParamE
g_LevelSetting = atoi (argv[n++]);
else if (!strcmp (pCommand, "-tarb") && (n < argc))
pSvcParam.iTargetBitrate = 1000*atoi (argv[n++]);
pSvcParam.iTargetBitrate = 1000 * atoi (argv[n++]);
else if (!strcmp (pCommand, "-maxbrTotal") && (n < argc))
pSvcParam.iMaxBitrate = 1000 * atoi (argv[n++]);
else if (!strcmp (pCommand, "-maxbrTotal") && (n < argc))
pSvcParam.iMaxBitrate = 1000*atoi (argv[n++]);
else if (!strcmp (pCommand, "-numl") && (n < argc)) {
pSvcParam.iSpatialLayerNum = atoi (argv[n++]);
}
else if (!strcmp (pCommand, "-lconfig") && (n < argc)) {
} else if (!strcmp (pCommand, "-lconfig") && (n < argc)) {
unsigned int iLayer = atoi (argv[n++]);
sFileSet.strLayerCfgFile[iLayer].assign (argv[n++]);
CReadConfig cRdLayerCfg (sFileSet.strLayerCfgFile[iLayer]);
@@ -471,7 +473,7 @@ int ParseCommandLine (int argc, char** argv, SSourcePicture* pSrcPic, SEncParamE
}
} else if (!strcmp (pCommand, "-drec") && (n + 1 < argc)) {
unsigned int iLayer = atoi (argv[n++]);
const unsigned int iLen = strlen (argv[n]);
const unsigned int iLen = (unsigned int)strlen (argv[n]);
if (iLen >= sizeof (sFileSet.sRecFileName[iLayer]))
return 1;
sFileSet.sRecFileName[iLayer][iLen] = '\0';
@@ -630,7 +632,7 @@ int FillSpecificParameters (SEncParamExt& sParam) {
return 0;
}
int ProcessEncoding(ISVCEncoder* pPtrEnc, int argc, char** argv,bool bConfigFile) {
int ProcessEncoding (ISVCEncoder* pPtrEnc, int argc, char** argv, bool bConfigFile) {
int iRet = 0;
if (pPtrEnc == NULL)
@@ -677,7 +679,7 @@ int ProcessEncoding(ISVCEncoder* pPtrEnc, int argc, char** argv,bool bConfigFile
pSrcPic->uiTimeStamp = 0;
// if configure file exit, reading configure file firstly
if(bConfigFile){
if (bConfigFile) {
iParsedNum = 2;
cRdCfg.Openf (argv[1]);
if (!cRdCfg.ExistFile()) {
@@ -969,7 +971,7 @@ int main (int argc, char** argv)
} else {
if (!strstr (argv[1], ".cfg")) { // check configuration type (like .cfg?)
if (argc > 2) {
iRet = ProcessEncoding(pSVCEncoder, argc, argv,false);
iRet = ProcessEncoding (pSVCEncoder, argc, argv, false);
if (iRet != 0)
goto exit;
} else if (argc == 2 && ! strcmp (argv[1], "-h"))
@@ -979,7 +981,7 @@ int main (int argc, char** argv)
goto exit;
}
} else {
iRet = ProcessEncoding(pSVCEncoder, argc, argv,true);
iRet = ProcessEncoding (pSVCEncoder, argc, argv, true);
if (iRet > 0)
goto exit;
}

View File

@@ -46,7 +46,7 @@ typedef struct TagBitStringAux {
uint8_t* pEndBuf; // buffer + length
int32_t iBits; // count bits of overall bitstreaming input
int32_t iIndex; //only for cavlc usage
intX_t iIndex; //only for cavlc usage
uint8_t* pCurBuf; // current reading position
uint32_t uiCurBits;
int32_t iLeftBits; // count number of available bits left ([1, 8]),

View File

@@ -75,11 +75,11 @@ namespace WelsDec {
}
static inline int32_t BsGetBits (PBitStringAux pBs, int32_t iNumBits, uint32_t* pCode) {
int32_t iRc = UBITS (pBs->uiCurBits, iNumBits);
int32_t iAllowedBytes = pBs->pEndBuf - pBs->pStartBuf; //actual stream bytes
int32_t iReadBytes = pBs->pCurBuf - pBs->pStartBuf;
intX_t iRc = UBITS (pBs->uiCurBits, iNumBits);
intX_t iAllowedBytes = pBs->pEndBuf - pBs->pStartBuf; //actual stream bytes
intX_t iReadBytes = pBs->pCurBuf - pBs->pStartBuf;
DUMP_BITS (pBs->uiCurBits, pBs->pCurBuf, pBs->iLeftBits, iNumBits, iAllowedBytes, iReadBytes);
*pCode = iRc;
*pCode = (uint32_t)iRc;
return ERR_NONE;
}
@@ -155,7 +155,7 @@ static inline int32_t GetLeadingZeroBits (uint32_t iCurBits) { //<=32 bits
static inline uint32_t BsGetUe (PBitStringAux pBs, uint32_t* pCode) {
uint32_t iValue = 0;
int32_t iLeadingZeroBits = GetLeadingZeroBits (pBs->uiCurBits);
int32_t iAllowedBytes, iReadBytes;
intX_t iAllowedBytes, iReadBytes;
iAllowedBytes = pBs->pEndBuf - pBs->pStartBuf; //actual stream bytes
if (iLeadingZeroBits == -1) { //bistream error

View File

@@ -75,7 +75,7 @@ uint8_t* DetectStartCodePrefix (const uint8_t* kpBuf, int32_t* pOffset, int32_t
++ pBits;
if ((iIdx >= 3) && ((* (pBits - 1)) == 0x1)) {
*pOffset = ((uintptr_t)pBits) - ((uintptr_t)kpBuf);
*pOffset = (int32_t) (((uintptr_t)pBits) - ((uintptr_t)kpBuf));
return pBits;
}

View File

@@ -183,7 +183,8 @@ int32_t WelsMbInterConstruction (PWelsDecoderContext pCtx, PDqLayer pCurLayer) {
GetInterPred (pDstY, pDstCb, pDstCr, pCtx);
WelsMbInterSampleConstruction (pCtx, pCurLayer, pDstY, pDstCb, pDstCr, iLumaStride, iChromaStride);
pCtx->sBlockFunc.pWelsSetNonZeroCountFunc (pCurLayer->pNzc[pCurLayer->iMbXyIndex]); // set all none-zero nzc to 1; dbk can be opti!
pCtx->sBlockFunc.pWelsSetNonZeroCountFunc (
pCurLayer->pNzc[pCurLayer->iMbXyIndex]); // set all none-zero nzc to 1; dbk can be opti!
return 0;
}
@@ -322,7 +323,7 @@ int32_t WelsDecodeSlice (PWelsDecoderContext pCtx, bool bFirstSliceInLayer, PNal
int32_t iMbX, iMbY;
const int32_t kiCountNumMb = pSliceHeader->pSps->uiTotalMbCount; //need to be correct when fmo or multi slice
PBitStringAux pBs = pCurLayer->pBitStringAux;
int32_t iUsedBits = 0;
intX_t iUsedBits = 0;
PWelsDecMbCavlcFunc pDecMbCavlcFunc;

View File

@@ -674,7 +674,7 @@ int32_t WelsResidualBlockCavlc (SVlcTable* pVlcTable, uint8_t* pNonZeroCountCach
int8_t nA, nB, nC;
uint8_t uiTotalCoeff, uiTrailingOnes;
int32_t iUsedBits = 0;
int32_t iCurIdx = pBs->iIndex;
intX_t iCurIdx = pBs->iIndex;
uint8_t* pBuf = ((uint8_t*)pBs->pStartBuf) + (iCurIdx >> 3);
bool bChromaDc = (CHROMA_DC == iResidualProperty);
uint8_t bChroma = (bChromaDc || CHROMA_AC == iResidualProperty);

View File

@@ -243,7 +243,7 @@ static inline bool BsCheckByteAlign (SBitStringAux* pBs) {
static inline int32_t BsGetBitsPos (SBitStringAux* pBs) {
return (((pBs->pBufPtr - pBs->pBuf) << 3) + 32 - pBs->iLeftBits);
return (int32_t) (((pBs->pBufPtr - pBs->pBuf) << 3) + 32 - pBs->iLeftBits);
}
}

View File

@@ -177,7 +177,7 @@ int32_t WelsEncodeNal (SWelsNalRaw* pRawNal, void* pNalHeaderExt, const int32_t
}
/* count length of NAL Unit */
iNalLength = pDstPointer - pDstStart;
iNalLength = (int32_t) (pDstPointer - pDstStart);
if (NULL != pDstLen)
*pDstLen = iNalLength;

View File

@@ -64,7 +64,7 @@ int32_t GetCodeName (char* pBuf, int32_t iSize) {
if (NULL == pBuf)
return 0;
iLen = strlen (WELS_CODE_NAME); // confirmed_safe_unsafe_usage
iLen = (int32_t)strlen (WELS_CODE_NAME); // confirmed_safe_unsafe_usage
if (iSize <= iLen)
return 0;
@@ -85,7 +85,7 @@ int32_t GetLibName (char* pBuf, int32_t iSize) {
if (NULL == pBuf)
return 0;
iLen = strlen (WELS_LIB_NAME); // confirmed_safe_unsafe_usage
iLen = (int32_t)strlen (WELS_LIB_NAME); // confirmed_safe_unsafe_usage
if (iSize <= iLen)
return 0;
@@ -106,7 +106,7 @@ int32_t GetVerNum (char* pBuf, int32_t iSize) {
if (NULL == pBuf)
return 0;
iLen = strlen (WELS_VERSION_STR); // confirmed_safe_unsafe_usage
iLen = (int32_t)strlen (WELS_VERSION_STR); // confirmed_safe_unsafe_usage
if (iSize <= iLen)
return 0;
@@ -127,7 +127,7 @@ int32_t GetIdentInfo (char* pBuf, int32_t iSize) {
if (NULL == pBuf)
return 0;
iLen = strlen (WELS_IDENT); // confirmed_safe_unsafe_usage
iLen = (int32_t)strlen (WELS_IDENT); // confirmed_safe_unsafe_usage
if (iSize <= iLen)
return 0;

View File

@@ -131,7 +131,7 @@ void CalcSliceComplexRatio (void* pRatio, SSliceCtx* pSliceCtx, uint32_t* pSlice
WelsEmms();
while (iSliceIdx < kiSliceCount) {
iAvI[iSliceIdx] = WELS_DIV_ROUND(INT_MULTIPLY * pCountMbInSlice[iSliceIdx], pSliceTime[iSliceIdx]);
iAvI[iSliceIdx] = WELS_DIV_ROUND (INT_MULTIPLY * pCountMbInSlice[iSliceIdx], pSliceTime[iSliceIdx]);
MT_TRACE_LOG (NULL, WELS_LOG_DEBUG, "[MT] CalcSliceComplexRatio(), pSliceConsumeTime[%d]= %d us, slice_run= %d\n",
iSliceIdx,
pSliceTime[iSliceIdx], pCountMbInSlice[iSliceIdx]);
@@ -140,7 +140,7 @@ void CalcSliceComplexRatio (void* pRatio, SSliceCtx* pSliceCtx, uint32_t* pSlice
++ iSliceIdx;
}
while (-- iSliceIdx >= 0) {
pRatioList[iSliceIdx] = WELS_DIV_ROUND(INT_MULTIPLY * iAvI[iSliceIdx], iSumAv);
pRatioList[iSliceIdx] = WELS_DIV_ROUND (INT_MULTIPLY * iAvI[iSliceIdx], iSumAv);
}
}
@@ -236,7 +236,7 @@ void DynamicAdjustSlicing (sWelsEncCtx* pCtx,
iSliceIdx = 0;
while (iSliceIdx + 1 < kiCountSliceNum) {
int32_t iNumMbAssigning = WELS_DIV_ROUND(kiCountNumMb * pSliceComplexRatio[iSliceIdx], INT_MULTIPLY);
int32_t iNumMbAssigning = WELS_DIV_ROUND (kiCountNumMb * pSliceComplexRatio[iSliceIdx], INT_MULTIPLY);
// GOM boundary aligned
if (pCtx->pSvcParam->iRCMode != RC_OFF_MODE) {
@@ -259,14 +259,15 @@ void DynamicAdjustSlicing (sWelsEncCtx* pCtx,
iRunLen[iSliceIdx] = iNumMbAssigning;
MT_TRACE_LOG (pCtx, WELS_LOG_DEBUG,
"[MT] DynamicAdjustSlicing(), uiSliceIdx= %d, pSliceComplexRatio= %.2f, slice_run_org= %d, slice_run_adj= %d\n",
iSliceIdx, pSliceComplexRatio[iSliceIdx]* 1.0f / INT_MULTIPLY, pSliceCtx->pCountMbNumInSlice[iSliceIdx], iNumMbAssigning);
iSliceIdx, pSliceComplexRatio[iSliceIdx] * 1.0f / INT_MULTIPLY, pSliceCtx->pCountMbNumInSlice[iSliceIdx],
iNumMbAssigning);
++ iSliceIdx;
iMaximalMbNum = iMbNumLeft - (kiCountSliceNum - iSliceIdx - 1) * iMinimalMbNum; // get maximal num_mb in left parts
}
iRunLen[iSliceIdx] = iMbNumLeft;
MT_TRACE_LOG (pCtx, WELS_LOG_DEBUG,
"[MT] DynamicAdjustSlicing(), iSliceIdx= %d, pSliceComplexRatio= %.2f, slice_run_org= %d, slice_run_adj= %d\n",
iSliceIdx, pSliceComplexRatio[iSliceIdx]* 1.0f / INT_MULTIPLY, pSliceCtx->pCountMbNumInSlice[iSliceIdx], iMbNumLeft);
iSliceIdx, pSliceComplexRatio[iSliceIdx] * 1.0f / INT_MULTIPLY, pSliceCtx->pCountMbNumInSlice[iSliceIdx], iMbNumLeft);
if (DynamicAdjustSlicePEncCtxAll (pSliceCtx, iRunLen) == 0) {
@@ -651,7 +652,7 @@ int32_t WriteSliceBs (sWelsEncCtx* pCtx, uint8_t* pSliceBsBuf, const int32_t iSl
int32_t iNalIdx = 0;
int32_t iNalSize = 0;
int32_t iReturn = ENC_RETURN_SUCCESS;
const int32_t kiWrittenLength = pSliceBs->sBsWrite.pBufPtr - pSliceBs->sBsWrite.pBuf;
const int32_t kiWrittenLength = (int32_t) (pSliceBs->sBsWrite.pBufPtr - pSliceBs->sBsWrite.pBuf);
iSliceSize = 0;
assert (kiNalCnt <= 2);

View File

@@ -209,7 +209,7 @@ void WelsSpatialWriteSubMbPred (sWelsEncCtx* pEncCtx, SSlice* pSlice, SMB* pCurM
}
int32_t CheckBitstreamBuffer (const uint8_t kuiSliceIdx, sWelsEncCtx* pEncCtx, SBitStringAux* pBs) {
const int32_t iLeftLength = pBs->pBufEnd - pBs->pBufPtr - 1;
const intX_t iLeftLength = pBs->pBufEnd - pBs->pBufPtr - 1;
assert (iLeftLength > 0);
if (iLeftLength < MAX_MACROBLOCK_SIZE_IN_BYTE) {