From a688f5278ab379f5baa2df276f6e18e2f04da3f8 Mon Sep 17 00:00:00 2001 From: Licai Guo Date: Wed, 19 Mar 2014 01:16:08 -0700 Subject: [PATCH] fix most of the warnings --- build/platform-linux.mk | 2 +- codec/api/svc/codec_app_def.h | 4 +- codec/console/dec/src/h264dec.cpp | 2 +- codec/console/enc/src/welsenc.cpp | 4 +- codec/decoder/core/src/deblocking.cpp | 8 ++-- codec/encoder/core/src/deblocking.cpp | 34 +++++++-------- codec/encoder/core/src/encoder_ext.cpp | 16 +++---- codec/encoder/core/src/sample.cpp | 2 +- .../core/src/slice_multi_threading.cpp | 2 +- codec/encoder/core/src/wels_preprocess.cpp | 42 ++++++++++++------- 10 files changed, 63 insertions(+), 53 deletions(-) diff --git a/build/platform-linux.mk b/build/platform-linux.mk index bb81e74b..d134e287 100644 --- a/build/platform-linux.mk +++ b/build/platform-linux.mk @@ -1,6 +1,6 @@ include build/platform-arch.mk SHAREDLIBSUFFIX = so -CFLAGS += -Wall -fno-strict-aliasing -Wno-sign-compare -Wno-missing-braces -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) diff --git a/codec/api/svc/codec_app_def.h b/codec/api/svc/codec_app_def.h index fb6f8122..2012d4c7 100644 --- a/codec/api/svc/codec_app_def.h +++ b/codec/api/svc/codec_app_def.h @@ -228,10 +228,10 @@ typedef struct TagEncParamExt /*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 diff --git a/codec/console/dec/src/h264dec.cpp b/codec/console/dec/src/h264dec.cpp index 071a887c..8ad95ec0 100644 --- a/codec/console/dec/src/h264dec.cpp +++ b/codec/console/dec/src/h264dec.cpp @@ -141,7 +141,7 @@ void H264DecodeInstance (ISVCDecoder* pDecoder, const char* kpH264FileName, cons 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; } diff --git a/codec/console/enc/src/welsenc.cpp b/codec/console/enc/src/welsenc.cpp index 4e6c5860..1afbd872 100644 --- a/codec/console/enc/src/welsenc.cpp +++ b/codec/console/enc/src/welsenc.cpp @@ -137,7 +137,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 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 @@ int ParseCommandLine (int argc, char** argv, SSourcePicture* pSrcPic, SEncParamE } 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'; diff --git a/codec/decoder/core/src/deblocking.cpp b/codec/decoder/core/src/deblocking.cpp index 01a0fbfb..6bd1f38e 100644 --- a/codec/decoder/core/src/deblocking.cpp +++ b/codec/decoder/core/src/deblocking.cpp @@ -131,7 +131,7 @@ static const uint8_t g_kuiTableBIdx[2][8] = { }, { - 0, 1, 2, 3 , + 0, 1, 2, 3, 12, 13, 14, 15 }, }; @@ -573,7 +573,7 @@ void DeblockingIntraMb (PDqLayer pCurDqLayer, PDeblockingFilter pFilter, int32_ } 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 @@ void WelsDeblockingFilterSlice (PWelsDecoderContext pCtx, PDeblockingFilterMbFun 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; diff --git a/codec/encoder/core/src/deblocking.cpp b/codec/encoder/core/src/deblocking.cpp index 99438596..7f97f44b 100644 --- a/codec/encoder/core/src/deblocking.cpp +++ b/codec/encoder/core/src/deblocking.cpp @@ -117,32 +117,32 @@ static const uint8_t g_kuiTableBIdx[2][8] = { 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 DeblockingIntraMb (DeblockingFunc* pfDeblocking, SMB* pCurMb, SDeblockingFi } 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; diff --git a/codec/encoder/core/src/encoder_ext.cpp b/codec/encoder/core/src/encoder_ext.cpp index 43e874ba..65bafc01 100644 --- a/codec/encoder/core/src/encoder_ext.cpp +++ b/codec/encoder/core/src/encoder_ext.cpp @@ -177,10 +177,10 @@ int32_t ParamValidationExt (sWelsEncCtx*pCtx,SWelsSvcCodingParam* pCodingParam) 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 AllocStrideTables (sWelsEncCtx** ppCtx, const int32_t kiNumSpatialLayers 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 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { 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]; diff --git a/codec/encoder/core/src/sample.cpp b/codec/encoder/core/src/sample.cpp index 7e0228b0..4b441f13 100644 --- a/codec/encoder/core/src/sample.cpp +++ b/codec/encoder/core/src/sample.cpp @@ -110,7 +110,7 @@ int32_t WelsSampleSad16x16_c (uint8_t* pSample1, int32_t iStride1, uint8_t* pSam 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; diff --git a/codec/encoder/core/src/slice_multi_threading.cpp b/codec/encoder/core/src/slice_multi_threading.cpp index 82000bdf..76a9f776 100644 --- a/codec/encoder/core/src/slice_multi_threading.cpp +++ b/codec/encoder/core/src/slice_multi_threading.cpp @@ -206,7 +206,7 @@ void DynamicAdjustSlicing (sWelsEncCtx* pCtx, 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; diff --git a/codec/encoder/core/src/wels_preprocess.cpp b/codec/encoder/core/src/wels_preprocess.cpp index 42bff7ed..0f363166 100644 --- a/codec/encoder/core/src/wels_preprocess.cpp +++ b/codec/encoder/core/src/wels_preprocess.cpp @@ -585,8 +585,8 @@ int32_t CWelsPreProcess::ColorspaceConvert (SWelsSvcCodingParam* pSvcParam, SPic 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 CWelsPreProcess::DetectSceneChange (SPicture* pCurPicture, SPicture* pRefPi bool bSceneChangeFlag = false; int32_t iMethodIdx = METHOD_SCENE_CHANGE_DETECTION; 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 @@ bool CWelsPreProcess::DetectSceneChange (SPicture* pCurPicture, SPicture* pRefPi 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 @@ void CWelsPreProcess::VaaCalculation (SVAAFrameInfo* pVaaInfo, SPicture* pCurPic 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 @@ void CWelsPreProcess::BackgroundDetection (SVAAFrameInfo* pVaaInfo, SPicture* pC 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 @@ void CWelsPreProcess::AdaptiveQuantCalculation (SVAAFrameInfo* pVaaInfo, SPictur { 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 @@ void CWelsPreProcess::AnalyzePictureComplexity (sWelsEncCtx* pCtx, SPicture* pCu { 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];