shithub: openh264

Download patch

ref: 08baf652514a98b7c8b21df69f843609388fa1db
parent: ca1c357058032cbff3f0fe2e1809d7016873ff99
parent: 8ffacf0918c7a2c9a9c68920483451062ff6d3ce
author: sijchen <sijchen@cisco.com>
date: Tue Nov 4 04:13:55 EST 2014

Merge pull request #1488 from mstorsjo/fix-warnings

Fix warnings with gcc and MSVC

--- a/codec/decoder/core/src/cabac_decoder.cpp
+++ b/codec/decoder/core/src/cabac_decoder.cpp
@@ -214,7 +214,7 @@
 int32_t DecodeTerminateCabac (PWelsCabacDecEngine pDecEngine, uint32_t& uiBinVal) {
   int32_t iErrorInfo = ERR_NONE;
   uint64_t uiRange = pDecEngine->uiRange - 2;
-  int64_t uiOffset = pDecEngine->uiOffset;
+  uint64_t uiOffset = pDecEngine->uiOffset;
 
   if (uiOffset >= (uiRange << pDecEngine->iBitsLeft)) {
     uiBinVal = 1;
--- a/codec/decoder/core/src/decode_slice.cpp
+++ b/codec/decoder/core/src/decode_slice.cpp
@@ -418,7 +418,7 @@
         iBestMode = kiPredMode;
       } else {
         WELS_READ_VERIFY (BsGetBits (pBs, 3, &uiCode));
-        iBestMode = uiCode + (uiCode >= kiPredMode);
+        iBestMode = uiCode + ((int32_t) uiCode >= kiPredMode);
       }
     }
 
@@ -501,7 +501,7 @@
   int32_t iScanIdxStart = pSlice->sSliceHeaderExt.uiScanIdxStart;
   int32_t iScanIdxEnd   = pSlice->sSliceHeaderExt.uiScanIdxEnd;
   int32_t iMbXy = pCurLayer->iMbXyIndex;
-  int32_t iMbMode, i;
+  int32_t i;
   uint32_t uiMbType = 0, uiCbp = 0, uiCbpLuma = 0, uiCbpChroma = 0;
 
   ENFORCE_STACK_ALIGN_1D (uint8_t, pNonZeroCount, 48, 16);
@@ -538,7 +538,6 @@
     WelsFillCacheNonZeroCount (&sNeighAvail, pNonZeroCount, pCurLayer);
     WELS_READ_VERIFY (ParseIntra16x16Mode (pCtx, &sNeighAvail, pBsAux, pCurLayer));
   }
-  iMbMode = BASE_MB;
 
   memset (pCurLayer->pScaledTCoeff[iMbXy], 0, 384 * sizeof (pCurLayer->pScaledTCoeff[iMbXy][0]));
   ST32 (&pCurLayer->pNzc[iMbXy][0], 0);
@@ -671,7 +670,7 @@
   int32_t iScanIdxEnd   = pSlice->sSliceHeaderExt.uiScanIdxEnd;
   int32_t iMbXy = pCurLayer->iMbXyIndex;
 
-  int32_t iMbMode, i;
+  int32_t i;
   uint32_t uiMbType = 0, uiCbp = 0, uiCbpLuma = 0, uiCbpChroma = 0;
 
   ENFORCE_STACK_ALIGN_1D (uint8_t, pNonZeroCount, 48, 16);
@@ -687,7 +686,6 @@
     pCurLayer->pMbType[iMbXy] = g_ksInterMbTypeInfo[uiMbType].iType;
     WelsFillCacheInterCabac (pNeighAvail, pNonZeroCount, pMotionVector, pMvdCache, pRefIndex, pCurLayer);
     WELS_READ_VERIFY (ParseInterMotionInfoCabac (pCtx, pNeighAvail, pNonZeroCount, pMotionVector, pMvdCache, pRefIndex));
-    iMbMode = BASE_MB;
     pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0;
   } else { //Intra mode
     uiMbType -= 5;
@@ -717,7 +715,6 @@
         WelsFillCacheNonZeroCount (pNeighAvail, pNonZeroCount, pCurLayer);
         WELS_READ_VERIFY (ParseIntra16x16Mode (pCtx, pNeighAvail, pBsAux, pCurLayer));
       }
-      iMbMode = BASE_MB;
     }
   }
 
--- a/codec/encoder/core/src/svc_enc_slice_segment.cpp
+++ b/codec/encoder/core/src/svc_enc_slice_segment.cpp
@@ -220,7 +220,7 @@
 // GOM based RC related for uiSliceNum decision, only used at SM_FIXEDSLCNUM_SLICE
 bool GomValidCheckSliceNum (const int32_t kiMbWidth, const int32_t kiMbHeight, uint32_t* pSliceNum) {
   const int32_t kiCountNumMb	= kiMbWidth * kiMbHeight;
-  int32_t iSliceNum			= *pSliceNum;
+  uint32_t iSliceNum			= *pSliceNum;
   int32_t iGomSize;
 
   //The default RC is Bit-rate mode[Yi], but need consider as below:
@@ -236,7 +236,7 @@
     iGomSize = kiMbWidth * GOM_ROW_MODE0_720P;
 
   while (true) {
-    if (kiCountNumMb < iGomSize * iSliceNum) {
+    if (kiCountNumMb < iGomSize * (int32_t) iSliceNum) {
       -- iSliceNum;
       iSliceNum = iSliceNum - (iSliceNum & 0x01);	// verfiy even num for multiple slices case
       if (iSliceNum < 2)	// for safe