ref: daf67d607f6eba20d0ed67ae25dcf2d3cabbf1ee
parent: 0dcb7584b55e5b2afbfae427595f4a696047a081
author: Haibo Zhu <[email protected]>
date: Wed Jun 18 19:50:48 EDT 2014
add win 64 warnings remove
--- a/codec/common/inc/typedefs.h
+++ b/codec/common/inc/typedefs.h
@@ -48,8 +48,14 @@
#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.
typedef signed char int8_t ;
typedef unsigned char uint8_t ;
@@ -60,6 +66,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
--- a/codec/common/src/crt_util_safe_x.cpp
+++ b/codec/common/src/crt_util_safe_x.cpp
@@ -112,7 +112,7 @@
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 @@
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) {
--- a/codec/console/dec/src/h264dec.cpp
+++ b/codec/console/dec/src/h264dec.cpp
@@ -339,7 +339,7 @@
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;
--- a/codec/console/enc/src/welsenc.cpp
+++ b/codec/console/enc/src/welsenc.cpp
@@ -116,7 +116,7 @@
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 @@
} 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 @@
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 @@
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 @@
}
} 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 @@
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 @@
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 @@
} 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 @@
goto exit;
}
} else {
- iRet = ProcessEncoding(pSVCEncoder, argc, argv,true);
+ iRet = ProcessEncoding (pSVCEncoder, argc, argv, true);
if (iRet > 0)
goto exit;
}
--- a/codec/decoder/core/inc/bit_stream.h
+++ b/codec/decoder/core/inc/bit_stream.h
@@ -46,7 +46,7 @@
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]),
--- a/codec/decoder/core/inc/dec_golomb.h
+++ b/codec/decoder/core/inc/dec_golomb.h
@@ -75,11 +75,11 @@
}
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 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
--- a/codec/decoder/core/src/au_parser.cpp
+++ b/codec/decoder/core/src/au_parser.cpp
@@ -75,7 +75,7 @@
++ 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;
}
--- a/codec/decoder/core/src/decode_slice.cpp
+++ b/codec/decoder/core/src/decode_slice.cpp
@@ -183,7 +183,8 @@
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 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;
--- a/codec/decoder/core/src/parse_mb_syn_cavlc.cpp
+++ b/codec/decoder/core/src/parse_mb_syn_cavlc.cpp
@@ -674,7 +674,7 @@
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);
--- a/codec/encoder/core/inc/svc_enc_golomb.h
+++ b/codec/encoder/core/inc/svc_enc_golomb.h
@@ -243,7 +243,7 @@
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);
}
}
--- a/codec/encoder/core/src/nal_encap.cpp
+++ b/codec/encoder/core/src/nal_encap.cpp
@@ -177,7 +177,7 @@
}
/* count length of NAL Unit */
- iNalLength = pDstPointer - pDstStart;
+ iNalLength = (int32_t) (pDstPointer - pDstStart);
if (NULL != pDstLen)
*pDstLen = iNalLength;
--- a/codec/encoder/core/src/property.cpp
+++ b/codec/encoder/core/src/property.cpp
@@ -64,7 +64,7 @@
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 @@
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 @@
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 @@
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;
--- a/codec/encoder/core/src/slice_multi_threading.cpp
+++ b/codec/encoder/core/src/slice_multi_threading.cpp
@@ -131,7 +131,7 @@
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 @@
++ 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 @@
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,7 +259,8 @@
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
}
@@ -266,7 +267,7 @@
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 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);
--- a/codec/encoder/core/src/svc_set_mb_syn_cavlc.cpp
+++ b/codec/encoder/core/src/svc_set_mb_syn_cavlc.cpp
@@ -209,7 +209,7 @@
}
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) {