shithub: openh264

Download patch

ref: ae60f1bee900e23823b142a05ea273f8b0c16b72
parent: 703c69de8164e28212c2df1745e1b4a6dd76fd09
author: Andoni Morales Alastruey <[email protected]>
date: Mon Mar 17 13:12:33 EDT 2014

Fix compiler warnings and remove dead code

Fix several -Werror=unused-variable and -Werror=unused-but-set-variable
and removed dead code found with this warnings

--- a/codec/console/enc/src/welsenc.cpp
+++ b/codec/console/enc/src/welsenc.cpp
@@ -303,7 +303,6 @@
   assert (kiActualLayerNum <= MAX_DEPENDENCY_LAYER);
 
   for (int8_t iLayer = 0; iLayer < kiActualLayerNum; ++ iLayer) {
-    SSpatialLayerConfig* pDLayer = &pSvcParam.sSpatialLayers[iLayer];
     CReadConfig cRdLayerCfg (sFileSet.strLayerCfgFile[iLayer]);
     if (-1==ParseLayerConfig( cRdLayerCfg, iLayer, pSvcParam,sFileSet ))
     {
@@ -414,7 +413,6 @@
   SLayerPEncCtx sLayerCtx[3];
   int n = 0;
   string str_ ("SlicesAssign");
-  const int kiSize = str_.size();
 
   while (n < argc) {
     pCommand = argv[n++];
@@ -827,7 +825,6 @@
   int32_t iActualFrameEncodedCount = 0;
   int32_t iFrameIdx = 0;
   int32_t	iTotalFrameMax = -1;
-  int8_t  iDlayerIdx = 0;
   uint8_t* pYUV= NULL;
   SSourcePicture* pSrcPic = NULL;
   int32_t iSourceWidth, iSourceHeight, kiPicResSize;
@@ -961,8 +958,6 @@
   iFrameIdx = 0;
   while (iFrameIdx < iTotalFrameMax && (((int32_t)sSvcParam.uiFrameToBeCoded <= 0)
                                         || (iFrameIdx < (int32_t)sSvcParam.uiFrameToBeCoded))) {
-    bool bOnePicAvailableAtLeast = false;
-    bool bSomeSpatialUnavailable	  = false;
 
 #ifdef ONLY_ENC_FRAMES_NUM
     // Only encoded some limited frames here
--- a/codec/decoder/core/src/au_parser.cpp
+++ b/codec/decoder/core/src/au_parser.cpp
@@ -598,7 +598,6 @@
 
 int32_t DecodeSpsSvcExt (PWelsDecoderContext pCtx, PSubsetSps pSpsExt, PBitStringAux pBs) {
   PSpsSvcExt  pExt			= NULL;
-  uint8_t uiChromaArrayType	= 1;
   uint32_t uiCode;
   int32_t iCode;
 
@@ -617,7 +616,6 @@
   pExt->uiChromaPhaseXPlus1Flag	=
     0;	// FIXME: Incoherent with JVT X201 standard (= 1), but conformance to JSVM (= 0) implementation.
   pExt->uiChromaPhaseYPlus1		= 1;
-  uiChromaArrayType = pSpsExt->sSps.uiChromaArrayType;
 
   WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //chroma_phase_x_plus1_flag
   pExt->uiChromaPhaseXPlus1Flag	= uiCode;
--- a/codec/decoder/core/src/decode_slice.cpp
+++ b/codec/decoder/core/src/decode_slice.cpp
@@ -52,8 +52,6 @@
 namespace WelsDec {
 
 int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) {
-  int32_t iPreQP = 0;
-
   PDqLayer pCurLayer = pCtx->pCurDqLayer;
   PSlice pCurSlice = &pCurLayer->sLayerInfo.sSliceInLayer;
   PSliceHeader pSliceHeader = &pCurSlice->sSliceHeaderExt.sSliceHeader;
@@ -87,8 +85,6 @@
   }
 
   do {
-    iPreQP = pCurLayer->pLumaQp[pCurLayer->iMbXyIndex];
-
     if (WelsTargetMbConstruction (pCtx)) {
       WelsLog (pCtx, WELS_LOG_WARNING, "WelsTargetSliceConstruction():::MB(%d, %d) construction error. pCurSlice_type:%d\n",
                pCurLayer->iMbX, pCurLayer->iMbY, pCurSlice->eSliceType);
--- a/codec/decoder/core/src/decoder_core.cpp
+++ b/codec/decoder/core/src/decoder_core.cpp
@@ -206,7 +206,6 @@
 int32_t ParseDecRefPicMarking (PWelsDecoderContext pCtx, PBitStringAux pBs, PSliceHeader pSh, PSps pSps,
                                const bool kbIdrFlag) {
   PRefPicMarking const kpRefMarking = &pSh->sRefMarking;
-  PRefPic pRefPic = &pCtx->sRefPic;
   uint32_t uiCode;
   if (kbIdrFlag) {
     WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //no_output_of_prior_pics_flag
@@ -990,7 +989,6 @@
 
 void UninitialDqLayersContext (PWelsDecoderContext pCtx) {
   int32_t i = 0;
-  int32_t j = 0;
 
   do {
     PDqLayer pDq = pCtx->pDqLayersList[i];
@@ -1642,7 +1640,6 @@
   uint8_t uiNalRefIdc = 0;
   bool	bFreshSliceAvailable =
     true;	// Another fresh slice comingup for given dq layer, for multiple slices in case of header parts of slices sometimes loss over error-prone channels, 8/14/2008
-  PPicture  pStoreBasePic = NULL;
 
   //update pCurDqLayer at the starting of AU decoding
   if (pCtx->bInitialDqLayersMem) {
--- a/codec/decoder/core/src/manage_dec_ref.cpp
+++ b/codec/decoder/core/src/manage_dec_ref.cpp
@@ -105,7 +105,6 @@
  */
 int32_t WelsInitRefList (PWelsDecoderContext pCtx, int32_t iPoc) {
   int32_t i, iCount = 0;
-  const bool kbUseRefBasePicFlag = pCtx->pCurDqLayer->bUseRefBasePicFlag;
   PPicture* ppShoreRefList = pCtx->sRefPic.pShortRefList[LIST_0];
   PPicture* ppLongRefList  = pCtx->sRefPic.pLongRefList[LIST_0];
   memset (pCtx->sRefPic.pRefList[LIST_0], 0, MAX_REF_PIC_COUNT * sizeof (PPicture));
@@ -206,7 +205,6 @@
 int32_t WelsMarkAsRef (PWelsDecoderContext pCtx) {
   PRefPic pRefPic = &pCtx->sRefPic;
   PRefPicMarking pRefPicMarking = pCtx->pCurDqLayer->pRefPicMarking;
-  PRefBasePicMarking pRefPicBaseMarking = pCtx->pCurDqLayer->pRefPicBaseMarking;
   PAccessUnit pCurAU = pCtx->pAccessUnitList;
   bool bIsIDRAU = false;
   uint32_t j;
--- a/codec/decoder/core/src/parse_mb_syn_cavlc.cpp
+++ b/codec/decoder/core/src/parse_mb_syn_cavlc.cpp
@@ -666,7 +666,6 @@
                                 PWelsDecoderContext pCtx) {
   int32_t iLevel[16], iZerosLeft, iCoeffNum;
   int32_t  iRun[16] = {0};
-  const uint8_t* kpBitNumMap;
   int32_t iCurNonZeroCacheIdx, i;
   const uint16_t* kpDequantCoeff = g_kuiDequantCoeff[uiQp];
   int8_t nA, nB, nC;
@@ -688,18 +687,10 @@
     iCurNonZeroCacheIdx = g_kuiCacheNzcScanIdx[iIndex];
     nA = pNonZeroCountCache[iCurNonZeroCacheIdx - 1];
     nB = pNonZeroCountCache[iCurNonZeroCacheIdx - 8];
-
-    if (bChromaDc) {
-      kpBitNumMap = g_kuiTotalZerosBitNumChromaMap;
-    } else {
-      kpBitNumMap = g_kuiTotalZerosBitNumMap;
-    }
   } else { //luma
     iCurNonZeroCacheIdx = g_kuiCacheNzcScanIdx[iIndex];
     nA = pNonZeroCountCache[iCurNonZeroCacheIdx - 1];
     nB = pNonZeroCountCache[iCurNonZeroCacheIdx - 8];
-
-    kpBitNumMap = g_kuiTotalZerosBitNumMap;
   }
 
   WELS_NON_ZERO_COUNT_AVERAGE (nC, nA, nB);
@@ -981,7 +972,6 @@
   PSlice pSlice				= &pCtx->pCurDqLayer->sLayerInfo.sSliceInLayer;
   PSliceHeader pSliceHeader	= &pSlice->sSliceHeaderExt.sSliceHeader;
   PPicture* ppRefPic = pCtx->sRefPic.pRefList[LIST_0];
-  int32_t iNumRefFrames		= pSliceHeader->pSps->iNumRefFrames;
   int32_t iRefCount[2];
   PDqLayer pCurDqLayer = pCtx->pCurDqLayer;
   int32_t i, j;
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -78,11 +78,6 @@
   float fMaxFrameRate = 0.0f;
   const float fEpsn = 0.000001f;
   int32_t i = 0;
-  int32_t iLastSpatialWidth	= 0;
-  int32_t	iLastSpatialHeight	= 0;
-  float fLastFrameRateIn	= 0.0f;
-  float fLastFrameRateOut	= 0.0f;
-  SDLayerParam* pLastSpatialParam = NULL;
 
   assert (pCfg != NULL);
 
@@ -118,16 +113,6 @@
     pCfg->fMaxFrameRate	= fMaxFrameRate;
   }
 
-  for (i = 0; i < pCfg->iSpatialLayerNum; ++ i) {
-    SDLayerParam* fDlp = &pCfg->sDependencyLayers[i];
-
-    pLastSpatialParam	= fDlp;
-    iLastSpatialWidth	= fDlp->iFrameWidth;
-    iLastSpatialHeight	= fDlp->iFrameHeight;
-    fLastFrameRateIn	= fDlp->fInputFrameRate;
-    fLastFrameRateOut	= fDlp->fOutputFrameRate;
-  }
-
   return 0;
 }
 
@@ -680,7 +665,6 @@
   SSubsetSps* pSubsetSps			= NULL;
   SWelsPPS* pPps						= NULL;
   CMemoryAlign* pMa				= NULL;
-  SStrideTables* pStrideTab		= NULL;
   int32_t iDlayerCount					= 0;
   int32_t iDlayerIndex					= 0;
   uint32_t iSpsId					= 0;
@@ -696,7 +680,6 @@
   iDlayerCount	= pParam->iSpatialLayerNum;
   iNumRef	= pParam->iNumRefFrame;
 //	highest_layers_in_temporal = 1 + WELS_MAX(pParam->iDecompStages, 1);
-  pStrideTab	= (*ppCtx)->pStrideTab;
 
   iDlayerIndex			= 0;
   while (iDlayerIndex < iDlayerCount) {
--- a/codec/encoder/core/src/slice_multi_threading.cpp
+++ b/codec/encoder/core/src/slice_multi_threading.cpp
@@ -353,7 +353,7 @@
   MT_TRACE_LOG ((*ppCtx), WELS_LOG_INFO, "encpEncCtx= 0x%p\n", (void*) (*ppCtx));
 
   char name[SEM_NAME_MAX] = {0};
-  WELS_THREAD_ERROR_CODE err = 0;
+  WELS_GCC_UNUSED WELS_THREAD_ERROR_CODE err = 0;
 
   iIdx = 0;
   while (iIdx < iThreadNum) {
@@ -602,7 +602,6 @@
   SWelsSliceBs* pSliceBs			= &pCtx->pSliceBs[iSliceIdx];
   SNalUnitHeaderExt* pNalHdrExt = &pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt;
   uint8_t* pDst					= pFrameBsBuffer;
-  int32_t pNalLen[2];
   const int32_t kiNalCnt			= pSliceBs->iNalIndex;
   int32_t iNalIdx					= 0;
   int32_t iNalSize = 0;
@@ -616,7 +615,6 @@
     iNalSize = 0;
     iReturn = WelsEncodeNal (&pSliceBs->sNalList[iNalIdx], pNalHdrExt, pCtx->iFrameBsSize-kiWrittenLength-iSliceSize, pDst, &iNalSize);
     WELS_VERIFY_RETURN_IFNEQ(iReturn, ENC_RETURN_SUCCESS)
-    pNalLen[iNalIdx] = iNalSize;
     iSliceSize += iNalSize;
     pDst += iNalSize;
     pLbi->iNalLengthInByte[iNalBase + iNalIdx]	= iNalSize;
--- a/codec/encoder/core/src/wels_preprocess.cpp
+++ b/codec/encoder/core/src/wels_preprocess.cpp
@@ -306,7 +306,6 @@
 
 int32_t CWelsPreProcess::BuildSpatialPicList (sWelsEncCtx* pCtx, const SSourcePicture* kpSrcPic) {
   SWelsSvcCodingParam* pSvcParam = pCtx->pSvcParam;
-  int32_t	iNumDependencyLayer = (int32_t)pSvcParam->iSpatialLayerNum;
   int32_t iSpatialNum = 0;
 
   if (!m_bInitDone) {
--- a/codec/processing/src/complexityanalysis/ComplexityAnalysis.cpp
+++ b/codec/processing/src/complexityanalysis/ComplexityAnalysis.cpp
@@ -178,7 +178,6 @@
 
   int32_t iGomMbStartIndex = 0, iGomMbEndIndex = 0, iGomMbRowNum = 0;
   int32_t iMbStartIndex = 0, iMbEndIndex = 0;
-  int32_t iStartSampleIndex = 0;
 
   uint8_t* pBackgroundMbFlag = (uint8_t*)m_sComplexityAnalysisParam.pBackgroundMbFlag;
   uint32_t* uiRefMbType = (uint32_t*)m_sComplexityAnalysisParam.uiRefMbType;
@@ -186,18 +185,9 @@
   int32_t*  pGomForegroundBlockNum = (int32_t*)m_sComplexityAnalysisParam.pGomForegroundBlockNum;
   int32_t*  pGomComplexity = (int32_t*)m_sComplexityAnalysisParam.pGomComplexity;
 
-  uint8_t* pRefY = NULL, *pSrcY = NULL;
-  int32_t iRefStride = 0, iCurStride = 0;
 
-  uint8_t* pRefTmp = NULL, *pCurTmp = NULL;
   uint32_t uiGomSad = 0, uiFrameSad = 0;
 
-  pRefY = (uint8_t*)pRefPixMap->pPixel[0];
-  pSrcY = (uint8_t*)pSrcPixMap->pPixel[0];
-
-  iRefStride  = pRefPixMap->iStride[0];
-  iCurStride  = pSrcPixMap->iStride[0];
-
   InitGomSadFunc (m_pfGomSad, m_sComplexityAnalysisParam.iCalcBgd);
 
   for (int32_t j = 0; j < iGomMbNum; j ++) {
@@ -210,13 +200,7 @@
     iMbStartIndex = iGomMbStartIndex;
     iMbEndIndex = WELS_MIN ((iMbStartIndex / iMbWidth + 1) * iMbWidth, iGomMbEndIndex);
 
-    iStartSampleIndex  = (iMbStartIndex / iMbWidth) * MB_WIDTH_LUMA * iRefStride + (iMbStartIndex % iMbWidth) *
-                         MB_WIDTH_LUMA;
-
     do {
-      pRefTmp = pRefY + iStartSampleIndex;
-      pCurTmp = pSrcY + iStartSampleIndex;
-
       for (int32_t i = iMbStartIndex; i < iMbEndIndex; i ++) {
         m_pfGomSad (&uiGomSad, pGomForegroundBlockNum + j, pVaaCalcResults->pSad8x8[i], pBackgroundMbFlag[i]
                     && !IS_INTRA (uiRefMbType[i]));
@@ -225,9 +209,6 @@
       iMbStartIndex = iMbEndIndex;
       iMbEndIndex = WELS_MIN (iMbEndIndex + iMbWidth , iGomMbEndIndex);
 
-      iStartSampleIndex  = (iMbStartIndex / iMbWidth) * MB_WIDTH_LUMA * iRefStride + (iMbStartIndex % iMbWidth) *
-                           MB_WIDTH_LUMA;
-
     } while (--iGomMbRowNum);
 
     pGomComplexity[j] = uiGomSad;
@@ -251,20 +232,13 @@
 
   int32_t iGomMbStartIndex = 0, iGomMbEndIndex = 0, iGomMbRowNum = 0;
   int32_t iMbStartIndex = 0, iMbEndIndex = 0;
-  int32_t iStartSampleIndex = 0;
 
   SVAACalcResult* pVaaCalcResults = m_sComplexityAnalysisParam.pCalcResult;
   int32_t*  pGomComplexity = (int32_t*)m_sComplexityAnalysisParam.pGomComplexity;
 
-  uint8_t* pSrcY = NULL;
-  int32_t iCurStride = 0;
 
-  uint8_t* pCurTmp = NULL;
   uint32_t uiSampleSum = 0, uiSquareSum = 0;
 
-  pSrcY = (uint8_t*)pSrcPixMap->pPixel[0];
-  iCurStride  = pSrcPixMap->iStride[0];
-
   for (int32_t j = 0; j < iGomMbNum; j ++) {
     uiSampleSum = 0;
     uiSquareSum = 0;
@@ -276,13 +250,9 @@
     iMbStartIndex = iGomMbStartIndex;
     iMbEndIndex = WELS_MIN ((iMbStartIndex / iMbWidth + 1) * iMbWidth, iGomMbEndIndex);
 
-    iStartSampleIndex  = (iMbStartIndex / iMbWidth) * MB_WIDTH_LUMA * iCurStride + (iMbStartIndex % iMbWidth) *
-                         MB_WIDTH_LUMA;
     iGomSampleNum = (iMbEndIndex - iMbStartIndex) * MB_WIDTH_LUMA * MB_WIDTH_LUMA;
 
     do {
-      pCurTmp = pSrcY + iStartSampleIndex;
-
       for (int32_t i = iMbStartIndex; i < iMbEndIndex; i ++) {
         uiSampleSum += pVaaCalcResults->pSum16x16[i];
         uiSquareSum += pVaaCalcResults->pSumOfSquare16x16[i];
@@ -291,8 +261,6 @@
       iMbStartIndex = iMbEndIndex;
       iMbEndIndex = WELS_MIN (iMbEndIndex + iMbWidth, iGomMbEndIndex);
 
-      iStartSampleIndex  = (iMbStartIndex / iMbWidth) * MB_WIDTH_LUMA * iCurStride + (iMbStartIndex % iMbWidth) *
-                           MB_WIDTH_LUMA;
     } while (--iGomMbRowNum);
 
     pGomComplexity[j] = uiSquareSum - (uiSampleSum * uiSampleSum / iGomSampleNum);