shithub: openh264

Download patch

ref: e8540af9eb72d364ac82afd42de029324ca4555f
parent: c247c5a05dbdfcf3f499d6a4b57f05cd68e081d7
parent: a688f5278ab379f5baa2df276f6e18e2f04da3f8
author: Ethan Hugg <[email protected]>
date: Wed Mar 19 05:17:34 EDT 2014

Merge pull request #541 from licaiguo/disable-warnings

disable most warnings produced by -Wall

--- a/build/platform-linux.mk
+++ b/build/platform-linux.mk
@@ -1,6 +1,6 @@
 include build/platform-arch.mk
 SHAREDLIBSUFFIX = so
-CFLAGS += -Wall -fPIC -DLINUX -DMT_ENABLED -MMD -MP
+CFLAGS += -Wall -fno-strict-aliasing -fPIC -DLINUX -DMT_ENABLED -MMD -MP
 LDFLAGS += -lpthread
 ifeq ($(ASM_ARCH), x86)
 ifeq ($(ENABLE64BIT), Yes)
--- a/codec/api/svc/codec_app_def.h
+++ b/codec/api/svc/codec_app_def.h
@@ -228,10 +228,10 @@
   /*LTR settings*/
   bool     bEnableLongTermReference; // 0: on, 1: off
   int	   iLTRRefNum;
-  int      iLtrMarkPeriod;
+  unsigned int      iLtrMarkPeriod;
 
   /* multi-thread settings*/
-  short		iMultipleThreadIdc;		// 1	# 0: auto(dynamic imp. internal encoder); 1: multiple threads imp. disabled; > 1: count number of threads;
+  unsigned short		iMultipleThreadIdc;		// 1	# 0: auto(dynamic imp. internal encoder); 1: multiple threads imp. disabled; > 1: count number of threads;
 
    /* Deblocking loop filter */
   int		iLoopFilterDisableIdc;	// 0: on, 1: off, 2: on except for slice boundaries
--- a/codec/console/dec/src/h264dec.cpp
+++ b/codec/console/dec/src/h264dec.cpp
@@ -141,7 +141,7 @@
     goto label_exit;
   }
 
-  if (fread (pBuf, 1, iFileSize, pH264File) != iFileSize) {
+  if (fread (pBuf, 1, iFileSize, pH264File) != (uint32_t)iFileSize) {
     fprintf (stderr, "Unable to read whole file\n");
     goto label_exit;
   }
--- a/codec/console/enc/src/welsenc.cpp
+++ b/codec/console/enc/src/welsenc.cpp
@@ -137,7 +137,7 @@
       } else if (strTag[0].compare ("FrameRateOut") == 0) {
         pDLayer->fFrameRate = (float)atof (strTag[1].c_str());
       }else if (strTag[0].compare ("ReconFile") == 0) {
-        const int kiLen = strTag[1].length();
+        const unsigned int kiLen = strTag[1].length();
         if (kiLen >= sizeof(sFileSet.sRecFileName[iLayer]))
           return -1;
         sFileSet.sRecFileName[iLayer][kiLen] = '\0';
@@ -487,7 +487,7 @@
     }
     else if (!strcmp (pCommand, "-drec") && (n + 1 < argc)) {
       unsigned int	iLayer = atoi (argv[n++]);
-      const int iLen = strlen (argv[n]);
+      const unsigned int iLen = strlen (argv[n]);
       if (iLen >= sizeof(sFileSet.sRecFileName[iLayer]))
         return 1;
       sFileSet.sRecFileName[iLayer][iLen] = '\0';
--- a/codec/decoder/core/src/deblocking.cpp
+++ b/codec/decoder/core/src/deblocking.cpp
@@ -131,7 +131,7 @@
   },
 
   {
-    0,  1,  2,  3 ,
+    0,  1,  2,  3,
     12, 13, 14, 15
   },
 };
@@ -573,7 +573,7 @@
 }
 
 void WelsDeblockingMb (PDqLayer pCurDqLayer, PDeblockingFilter  pFilter, int32_t iBoundryFlag) {
-  uint8_t nBS[2][4][4] = { 0 };
+  uint8_t nBS[2][4][4] = {{{ 0 }}};
 
   int32_t iMbXyIndex	= pCurDqLayer->iMbXyIndex;
   int32_t iCurMbType  = pCurDqLayer->pMbType[iMbXyIndex];
@@ -630,8 +630,8 @@
   int32_t iMbWidth  = pCurDqLayer->iMbWidth;
   int32_t iTotalMbCount = pSliceHeaderExt->sSliceHeader.pSps->uiTotalMbCount;
 
-  SDeblockingFilter pFilter = {0};
-
+  SDeblockingFilter pFilter;
+  memset (&pFilter, 0, sizeof(pFilter));
   PFmo pFmo = pCtx->pFmo;
   int32_t iNextMbXyIndex = 0;
   int32_t iTotalNumMb = pCurDqLayer->sLayerInfo.sSliceInLayer.iTotalMbInCurSlice;
--- a/codec/encoder/core/src/deblocking.cpp
+++ b/codec/encoder/core/src/deblocking.cpp
@@ -117,32 +117,32 @@
 
 static const ALIGNED_DECLARE (int32_t, g_kiTableBlock8x8Idx[2][4][4], 16) = {
   {
-    0, 0, 2, 2,
-    0, 0, 2, 2,
-    1, 1, 3, 3,
-    1, 1, 3, 3
+    {0, 0, 2, 2},
+    {0, 0, 2, 2},
+    {1, 1, 3, 3},
+    {1, 1, 3, 3}
   },
 
   {
-    0, 0, 1, 1,
-    0, 0, 1, 1,
-    2, 2, 3, 3,
-    2, 2, 3, 3
+    {0, 0, 1, 1},
+    {0, 0, 1, 1},
+    {2, 2, 3, 3},
+    {2, 2, 3, 3}
   }
 };
 static const ALIGNED_DECLARE (int32_t, g_kiTableBlock8x8NIdx[2][4][4], 16) = {
   {
-    1, 1, 3, 3,
-    0, 0, 2, 2,
-    0, 0, 2, 2,
-    1, 1, 3, 3
+    {1, 1, 3, 3},
+    {0, 0, 2, 2},
+    {0, 0, 2, 2},
+    {1, 1, 3, 3}
   },
 
   {
-    2, 2, 3, 3,
-    0, 0, 1, 1,
-    0, 0, 1, 1,
-    2, 2, 3, 3
+    {2, 2, 3, 3},
+    {0, 0, 1, 1},
+    {0, 0, 1, 1},
+    {2, 2, 3, 3}
   }
 };
 
@@ -584,7 +584,7 @@
 }
 
 void DeblockingMbAvcbase (SWelsFuncPtrList* pFunc, SMB* pCurMb, SDeblockingFilter* pFilter) {
-  uint8_t uiBS[2][4][4] = { 0 };
+  uint8_t uiBS[2][4][4] = {{{ 0 }}};
 
   Mb_Type uiCurMbType = pCurMb->uiMbType;
   int32_t iMbStride  = pFilter->iMbStride;
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -177,10 +177,10 @@
     SDLayerParam* fDlp = &pCodingParam->sDependencyLayers[i];
     const int32_t kiPicWidth = fDlp->iFrameWidth;
     const int32_t kiPicHeight = fDlp->iFrameHeight;
-    int32_t iMbWidth		= 0;
-    int32_t iMbHeight		= 0;
+    uint32_t iMbWidth		= 0;
+    uint32_t iMbHeight		= 0;
     int32_t iMbNumInFrame		= 0;
-    int32_t iMaxSliceNum		= MAX_SLICES_NUM;
+    uint32_t iMaxSliceNum		= MAX_SLICES_NUM;
     if (kiPicWidth <= 0 || kiPicHeight <= 0) {
       WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid %d x %d in dependency layer settings!\n", kiPicWidth, kiPicHeight);
       return ENC_RETURN_UNSUPPORTED_PARA;
@@ -924,10 +924,10 @@
     int32_t iMbWidth;
     int32_t iCountMbNum;				// count number of SMB in each spatial
     int32_t iSizeAllMbAlignCache;	// cache line size aligned in each spatial
-  } sMbSizeMap[MAX_DEPENDENCY_LAYER] = {0};
-  int32_t iLineSizeY[MAX_DEPENDENCY_LAYER][2] = {0};
-  int32_t iLineSizeUV[MAX_DEPENDENCY_LAYER][2] = {0};
-  int32_t iMapSpatialIdx[MAX_DEPENDENCY_LAYER][2] = {0};
+  } sMbSizeMap[MAX_DEPENDENCY_LAYER] = {{ 0 }};
+  int32_t iLineSizeY[MAX_DEPENDENCY_LAYER][2] = {{ 0 }};
+  int32_t iLineSizeUV[MAX_DEPENDENCY_LAYER][2] = {{ 0 }};
+  int32_t iMapSpatialIdx[MAX_DEPENDENCY_LAYER][2] = {{ 0 }};
   int32_t iSizeDec		= 0;
   int32_t iSizeEnc		= 0;
   int32_t iCountLayersNeedCs[2]	= {0};
@@ -1668,7 +1668,7 @@
 
 int32_t InitSliceSettings (SWelsSvcCodingParam* pCodingParam, const int32_t kiCpuCores, int16_t* pMaxSliceCount) {
   int32_t iSpatialIdx = 0, iSpatialNum = pCodingParam->iSpatialLayerNum;
-  int16_t iMaxSliceCount = 0;
+  uint16_t iMaxSliceCount = 0;
 
   do {
     SDLayerParam* pDlp				= &pCodingParam->sDependencyLayers[iSpatialIdx];
--- a/codec/encoder/core/src/sample.cpp
+++ b/codec/encoder/core/src/sample.cpp
@@ -110,7 +110,7 @@
 
 int32_t WelsSampleSatd4x4_c (uint8_t* pSample1, int32_t iStride1, uint8_t* pSample2, int32_t iStride2) {
   int32_t iSatdSum = 0;
-  int32_t pSampleMix[4][4] = { 0 };
+  int32_t pSampleMix[4][4] = {{ 0 }};
   int32_t iSample0, iSample1, iSample2, iSample3;
   int32_t i = 0;
   uint8_t* pSrc1 = pSample1;
--- a/codec/encoder/core/src/slice_multi_threading.cpp
+++ b/codec/encoder/core/src/slice_multi_threading.cpp
@@ -206,7 +206,7 @@
   int32_t iRunLen[MAX_THREADS_NUM]	= {0};
   int32_t iSliceIdx					= 0;
 
-  int32_t iNumMbInEachGom;
+  int32_t iNumMbInEachGom = 0;
   SWelsSvcRc* pWelsSvcRc = &pCtx->pWelsSvcRc[iCurDid];
   if (pCtx->pSvcParam->bEnableRc) {
     iNumMbInEachGom = pWelsSvcRc->iNumberMbGom;
--- a/codec/encoder/core/src/wels_preprocess.cpp
+++ b/codec/encoder/core/src/wels_preprocess.cpp
@@ -585,8 +585,8 @@
 
 void CWelsPreProcess::BilateralDenoising (SPicture* pSrc, const int32_t kiWidth, const int32_t kiHeight) {
   int32_t iMethodIdx = METHOD_DENOISE;
-  SPixMap sSrcPixMap = {0};
-
+  SPixMap sSrcPixMap;
+  memset (&sSrcPixMap, 0, sizeof(sSrcPixMap));
   sSrcPixMap.pPixel[0] = pSrc->pData[0];
   sSrcPixMap.pPixel[1] = pSrc->pData[1];
   sSrcPixMap.pPixel[2] = pSrc->pData[2];
@@ -605,9 +605,10 @@
   bool bSceneChangeFlag = false;
   int32_t iMethodIdx = METHOD_SCENE_CHANGE_DETECTION_VIDEO;
   SSceneChangeResult sSceneChangeDetectResult = { SIMILAR_SCENE };
-  SPixMap sSrcPixMap = {0};
-  SPixMap sRefPixMap = {0};
-
+  SPixMap sSrcPixMap;
+  SPixMap sRefPixMap;
+  memset (&sSrcPixMap, 0, sizeof(sSrcPixMap));
+  memset (&sRefPixMap, 0, sizeof(sRefPixMap));
   sSrcPixMap.pPixel[0] = pCurPicture->pData[0];
   sSrcPixMap.iSizeInBits = g_kiPixMapSizeInBits;
   sSrcPixMap.iStride[0] = pCurPicture->iLineSize[0];
@@ -635,9 +636,10 @@
 int32_t CWelsPreProcess::DownsamplePadding (SPicture* pSrc, SPicture* pDstPic,  int32_t iSrcWidth, int32_t iSrcHeight,
     int32_t iShrinkWidth, int32_t iShrinkHeight, int32_t iTargetWidth, int32_t iTargetHeight) {
   int32_t iRet = 0;
-  SPixMap sSrcPixMap = {0};
-  SPixMap sDstPicMap = {0};
-
+  SPixMap sSrcPixMap;
+  SPixMap sDstPicMap;
+  memset (&sSrcPixMap, 0, sizeof(sSrcPixMap));
+  memset (&sDstPicMap, 0, sizeof(sDstPicMap));
   sSrcPixMap.pPixel[0]   = pSrc->pData[0];
   sSrcPixMap.pPixel[1]   = pSrc->pData[1];
   sSrcPixMap.pPixel[2]   = pSrc->pData[2];
@@ -683,8 +685,10 @@
   pVaaInfo->sVaaCalcInfo.pRefY = pRefPicture->pData[0];
   {
     int32_t iMethodIdx = METHOD_VAA_STATISTICS;
-    SPixMap sCurPixMap = {0};
-    SPixMap sRefPixMap = {0};
+    SPixMap sCurPixMap;
+    SPixMap sRefPixMap;
+    memset (&sCurPixMap, 0, sizeof(sCurPixMap));
+    memset (&sRefPixMap, 0, sizeof(sRefPixMap));
     SVAACalcParam calc_param = {0};
 
     sCurPixMap.pPixel[0] = pCurPicture->pData[0];
@@ -727,8 +731,10 @@
     pVaaInfo->pRefV			= pRefPicture->pData[2];
 
     int32_t iMethodIdx = METHOD_BACKGROUND_DETECTION;
-    SPixMap sSrcPixMap = {0};
-    SPixMap sRefPixMap = {0};
+    SPixMap sSrcPixMap;
+    SPixMap sRefPixMap;
+    memset (&sSrcPixMap, 0, sizeof(sSrcPixMap));
+    memset (&sRefPixMap, 0, sizeof(sRefPixMap));
     SBGDInterface BGDParam = {0};
 
     sSrcPixMap.pPixel[0] = pCurPicture->pData[0];
@@ -770,8 +776,10 @@
 
   {
     int32_t iMethodIdx = METHOD_ADAPTIVE_QUANT;
-    SPixMap pSrc = {0};
-    SPixMap pRef = {0};
+    SPixMap pSrc;
+    SPixMap pRef;
+    memset (&pSrc, 0, sizeof(pSrc));
+    memset (&pRef, 0, sizeof(pRef));
     int32_t iRet = 0;
 
     pSrc.pPixel[0] = pCurPicture->pData[0];
@@ -858,8 +866,10 @@
 
   {
     int32_t iMethodIdx = METHOD_COMPLEXITY_ANALYSIS;
-    SPixMap sSrcPixMap = {0};
-    SPixMap sRefPixMap = {0};
+    SPixMap sSrcPixMap;
+    SPixMap sRefPixMap;
+    memset (&sSrcPixMap, 0, sizeof(SPixMap));
+    memset (&sRefPixMap, 0, sizeof(SPixMap));
     int32_t iRet = 0;
 
     sSrcPixMap.pPixel[0] = pCurPicture->pData[0];