Merge pull request #989 from HaiboZhu/win64_remove_warnings
Win64 remove warnings
This commit is contained in:
commit
497b8dea84
@ -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.
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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';
|
||||
|
@ -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]),
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user