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
This commit is contained in:
Andoni Morales Alastruey 2014-03-17 17:12:33 +01:00
parent 703c69de81
commit ae60f1bee9
10 changed files with 1 additions and 79 deletions

View File

@ -303,7 +303,6 @@ int ParseConfig (CReadConfig& cRdCfg, SSourcePicture* pSrcPic, SEncParamExt& pSv
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 @@ int ParseCommandLine (int argc, char** argv, SSourcePicture* pSrcPic, SEncParamE
SLayerPEncCtx sLayerCtx[3];
int n = 0;
string str_ ("SlicesAssign");
const int kiSize = str_.size();
while (n < argc) {
pCommand = argv[n++];
@ -827,7 +825,6 @@ int ProcessEncodingSvcWithConfig (ISVCEncoder* pPtrEnc, int argc, char** argv) {
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 @@ int ProcessEncodingSvcWithConfig (ISVCEncoder* pPtrEnc, int argc, char** argv) {
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

View File

@ -598,7 +598,6 @@ int32_t ParsePrefixNalUnit (PWelsDecoderContext pCtx, PBitStringAux pBs) {
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 @@ int32_t DecodeSpsSvcExt (PWelsDecoderContext pCtx, PSubsetSps pSpsExt, PBitStrin
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;

View File

@ -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 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) {
}
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);

View File

@ -206,7 +206,6 @@ int32_t ParseRefPicListReordering (PBitStringAux pBs, PSliceHeader pSh) {
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 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid
void UninitialDqLayersContext (PWelsDecoderContext pCtx) {
int32_t i = 0;
int32_t j = 0;
do {
PDqLayer pDq = pCtx->pDqLayersList[i];
@ -1642,7 +1640,6 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, int3
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) {

View File

@ -105,7 +105,6 @@ void WelsResetRefPic (PWelsDecoderContext pCtx) {
*/
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 WelsReorderRefList (PWelsDecoderContext pCtx) {
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;

View File

@ -666,7 +666,6 @@ int32_t WelsResidualBlockCavlc (SVlcTable* pVlcTable, uint8_t* pNonZeroCountCach
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 @@ int32_t WelsResidualBlockCavlc (SVlcTable* pVlcTable, uint8_t* pNonZeroCountCach
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 @@ int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][M
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;

View File

@ -78,11 +78,6 @@ int32_t ParamValidation (SWelsSvcCodingParam* pCfg) {
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 @@ int32_t ParamValidation (SWelsSvcCodingParam* pCfg) {
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 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) {
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 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx) {
iDlayerCount = pParam->iSpatialLayerNum;
iNumRef = pParam->iNumRefFrame;
// highest_layers_in_temporal = 1 + WELS_MAX(pParam->iDecompStages, 1);
pStrideTab = (*ppCtx)->pStrideTab;
iDlayerIndex = 0;
while (iDlayerIndex < iDlayerCount) {

View File

@ -353,7 +353,7 @@ int32_t RequestMtResource (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPara
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 @@ int32_t WriteSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, uint8_t* pFr
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 @@ int32_t WriteSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, uint8_t* pFr
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;

View File

@ -306,7 +306,6 @@ void CWelsPreProcess::FreeSpatialPictures (sWelsEncCtx* pCtx) {
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) {

View File

@ -178,7 +178,6 @@ void CComplexityAnalysis::AnalyzeGomComplexityViaSad (SPixMap* pSrcPixMap, SPixM
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 @@ void CComplexityAnalysis::AnalyzeGomComplexityViaSad (SPixMap* pSrcPixMap, SPixM
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 @@ void CComplexityAnalysis::AnalyzeGomComplexityViaSad (SPixMap* pSrcPixMap, SPixM
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 @@ void CComplexityAnalysis::AnalyzeGomComplexityViaSad (SPixMap* pSrcPixMap, SPixM
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 @@ void CComplexityAnalysis::AnalyzeGomComplexityViaVar (SPixMap* pSrcPixMap, SPixM
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 @@ void CComplexityAnalysis::AnalyzeGomComplexityViaVar (SPixMap* pSrcPixMap, SPixM
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 @@ void CComplexityAnalysis::AnalyzeGomComplexityViaVar (SPixMap* pSrcPixMap, SPixM
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);