shithub: openh264

Download patch

ref: 9a0d56da979b80cc5fb90657762d38063b503f9f
parent: d74c0f6ae63e1ad6aa4f8e6c60d8946cb6153518
parent: cdb7e5da61423294c9ebf7b9660b92b603d79d3b
author: huili2 <[email protected]>
date: Thu Oct 16 10:24:58 EDT 2014

Merge pull request #1412 from daniel-j-h/clang_cleanup

Clang's -Weverything and Static Analyzer's reports

--- a/codec/api/svc/codec_app_def.h
+++ b/codec/api/svc/codec_app_def.h
@@ -104,7 +104,7 @@
   ENCODER_OPTION_TRACE_CALLBACK_CONTEXT,
 
   // advanced algorithmetic settings
-  ENCODER_OPTION_IS_LOSSLESS_LINK,
+  ENCODER_OPTION_IS_LOSSLESS_LINK
 } ENCODER_OPTION;
 
 /* Option types introduced in decoder application */
@@ -120,7 +120,7 @@
   DECODER_OPTION_ERROR_CON_IDC, //not finished yet, indicate decoder error concealment status, in progress
   DECODER_OPTION_TRACE_LEVEL,
   DECODER_OPTION_TRACE_CALLBACK, // a void (*)(void* context, int level, const char* message) function which receives log messages
-  DECODER_OPTION_TRACE_CALLBACK_CONTEXT,
+  DECODER_OPTION_TRACE_CALLBACK_CONTEXT
 
 } DECODER_OPTION;
 
@@ -128,7 +128,7 @@
 typedef enum {
   ERROR_CON_DISABLE = 0,
   ERROR_CON_FRAME_COPY,
-  ERROR_CON_SLICE_COPY,
+  ERROR_CON_SLICE_COPY
 } ERROR_CON_IDC;
 
 typedef enum { //feedback that whether or not have VCL NAL in current AU
@@ -148,7 +148,7 @@
   SPATIAL_LAYER_1 = 1,
   SPATIAL_LAYER_2 = 2,
   SPATIAL_LAYER_3 = 3,
-  SPATIAL_LAYER_ALL = 4,
+  SPATIAL_LAYER_ALL = 4
 } LAYER_NUM;
 
 //enumerate the type of video bitstream which is provided to decoder
@@ -155,7 +155,7 @@
 typedef enum {
   VIDEO_BITSTREAM_AVC               = 0,
   VIDEO_BITSTREAM_SVC               = 1,
-  VIDEO_BITSTREAM_DEFAULT           = VIDEO_BITSTREAM_SVC,
+  VIDEO_BITSTREAM_DEFAULT           = VIDEO_BITSTREAM_SVC
 } VIDEO_BITSTREAM_TYPE;
 
 typedef enum {
@@ -164,7 +164,7 @@
   IDR_RECOVERY_REQUEST = 2,
   NO_LTR_MARKING_FEEDBACK = 3,
   LTR_MARKING_SUCCESS = 4,
-  LTR_MARKING_FAILED = 5,
+  LTR_MARKING_FAILED = 5
 } KEY_FRAME_REQUEST_TYPE;
 
 typedef struct {
@@ -205,7 +205,7 @@
   RC_QUALITY_MODE = 0,      //Quality mode
   RC_BITRATE_MODE = 1,   //Bitrate mode
   RC_BUFFERBASED_MODE = 2,//no bitrate control,only using buffer status,adjust the video quality
-  RC_OFF_MODE = -1,    // rate control off mode
+  RC_OFF_MODE = -1     // rate control off mode
 } RC_MODES;
 
 typedef enum {
@@ -220,7 +220,7 @@
   PRO_CAVLC444	= 244,
 
   PRO_SCALABLE_BASELINE	= 83,
-  PRO_SCALABLE_HIGH		= 86,
+  PRO_SCALABLE_HIGH		= 86
 } EProfileIdc;
 
 typedef enum {
@@ -277,13 +277,13 @@
 
 typedef enum {
   CAMERA_VIDEO_REAL_TIME, //camera video signal
-  SCREEN_CONTENT_REAL_TIME,//screen content signal
+  SCREEN_CONTENT_REAL_TIME //screen content signal
 } EUsageType;
 
 typedef enum {
   LOW_COMPLEXITY, //the lowest compleixty,the fastest speed,
   MEDIUM_COMPLEXITY, //medium complexity, medium speed,medium quality
-  HIGH_COMPLEXITY, //high complexity, lowest speed, high quality
+  HIGH_COMPLEXITY  //high complexity, lowest speed, high quality
 } ECOMPLEXITY_MODE;
 // TODO:  Refine the parameters definition.
 // SVC Encoding Parameters
--- a/codec/api/svc/codec_def.h
+++ b/codec/api/svc/codec_def.h
@@ -63,7 +63,7 @@
   videoFrameTypeI,		/* I frame type */
   videoFrameTypeP,		/* P frame type */
   videoFrameTypeSkip,		/* Skip the frame based encoder kernel */
-  videoFrameTypeIPMixed,		/* Frame type introduced I and P slices are mixing */
+  videoFrameTypeIPMixed 		/* Frame type introduced I and P slices are mixing */
 } EVideoFrameType;
 
 typedef enum {
@@ -72,7 +72,7 @@
   cmUnkonwReason,
   cmMallocMemeError,                /*Malloc a memory error*/
   cmInitExpected,			  /*Initial action is expected*/
-  cmUnsupportedData,
+  cmUnsupportedData
 } CM_RETURN;
 
 /* nal unit type */
@@ -93,7 +93,7 @@
   NAL_PRIORITY_DISPOSABLE = 0,
   NAL_PRIORITY_LOW        = 1,
   NAL_PRIORITY_HIGH       = 2,
-  NAL_PRIORITY_HIGHEST    = 3,
+  NAL_PRIORITY_HIGHEST    = 3
 };
 
 #define IS_PARAMETER_SET_NAL(eNalRefIdc, eNalType) \
@@ -116,7 +116,7 @@
   ET_IR_R3 = 0x10,				// Intra Refresh in predifined 10% MB
   ET_FEC_HALF = 0x20,				// Forward Error Correction in 50% redundency mode
   ET_FEC_FULL	= 0x40,				// Forward Error Correction in 100% redundency mode
-  ET_RFS = 0x80,					// Reference Frame Selection
+  ET_RFS = 0x80 					// Reference Frame Selection
 };
 
 /* information of coded Slice(=NAL)(s) */
--- a/codec/common/inc/wels_common_defs.h
+++ b/codec/common/inc/wels_common_defs.h
@@ -155,7 +155,7 @@
   UNKNOWN_SLICE = 5
 };
 
-/* SSlice Types in scalable extension */		;
+/* SSlice Types in scalable extension */
 enum ESliceTypeExt {
   EP_SLICE = 0,	// EP_SLICE: 0, 5
   EB_SLICE = 1,	// EB_SLICE: 1, 6
--- a/codec/common/src/sad_common.cpp
+++ b/codec/common/src/sad_common.cpp
@@ -136,4 +136,4 @@
   * (pSad + 1) = WelsSampleSad4x4_c (iSample1, iStride1, (iSample2 + iStride2), iStride2);
   * (pSad + 2) = WelsSampleSad4x4_c (iSample1, iStride1, (iSample2 - 1), iStride2);
   * (pSad + 3) = WelsSampleSad4x4_c (iSample1, iStride1, (iSample2 + 1), iStride2);
-}
\ No newline at end of file
+}
--- a/codec/console/common/inc/read_config.h
+++ b/codec/console/common/inc/read_config.h
@@ -42,7 +42,6 @@
 
 #include <stdlib.h>
 #include <string>
-using namespace std;
 
 
 class CReadConfig {
@@ -49,19 +48,19 @@
  public:
   CReadConfig();
   CReadConfig (const char* pConfigFileName);
-  CReadConfig (const string& pConfigFileName);
+  CReadConfig (const std::string& pConfigFileName);
   virtual ~CReadConfig();
 
   void Openf (const char* strFile);
-  long ReadLine (string* strVal, const int iValSize = 4);
+  long ReadLine (std::string* strVal, const int iValSize = 4);
   const bool EndOfFile();
   const int GetLines();
   const bool ExistFile();
-  const string& GetFileName();
+  const std::string& GetFileName();
 
  private:
   FILE*			m_pCfgFile;
-  string			m_strCfgFileName;
+  std::string			m_strCfgFileName;
   unsigned int	m_iLines;
 };
 
--- a/codec/console/common/src/read_config.cpp
+++ b/codec/console/common/src/read_config.cpp
@@ -58,7 +58,7 @@
   }
 }
 
-CReadConfig::CReadConfig (const string& kpConfigFileName)
+CReadConfig::CReadConfig (const std::string& kpConfigFileName)
   : m_pCfgFile (0)
   , m_strCfgFileName (kpConfigFileName)
   , m_iLines (0) {
@@ -81,11 +81,11 @@
   }
 }
 
-long CReadConfig::ReadLine (string* pVal, const int kiValSize/* = 4*/) {
+long CReadConfig::ReadLine (std::string* pVal, const int kiValSize/* = 4*/) {
   if (m_pCfgFile == NULL || pVal == NULL || kiValSize <= 1)
     return 0;
 
-  string* strTags = &pVal[0];
+  std::string* strTags = &pVal[0];
   int nTagNum = 0, n = 0;
   bool bCommentFlag = false;
 
@@ -134,6 +134,6 @@
   return (m_pCfgFile != NULL);
 }
 
-const string& CReadConfig::GetFileName() {
+const std::string& CReadConfig::GetFileName() {
   return m_strCfgFileName;
 }
--- a/codec/console/enc/src/welsenc.cpp
+++ b/codec/console/enc/src/welsenc.cpp
@@ -892,7 +892,7 @@
     pFileYUV = NULL;
   }
   if (pYUV) {
-    delete pYUV;
+    delete[] pYUV;
     pYUV = NULL;
   }
   if (pSrcPic) {
--- a/codec/decoder/core/inc/error_code.h
+++ b/codec/decoder/core/inc/error_code.h
@@ -48,7 +48,7 @@
 ERR_MALLOC_FAILED		= 2,
 ERR_API_FAILED			= 3,
 
-ERR_BOUND				= 31,
+ERR_BOUND				= 31
 } EWelsErr;
 
 /*
@@ -68,7 +68,7 @@
 ERR_LEVEL_PARAM_SETS,
 ERR_LEVEL_SLICE_HEADER,
 ERR_LEVEL_SLICE_DATA,
-ERR_LEVEL_MB_DATA,
+ERR_LEVEL_MB_DATA
 };
 
 //-----------------------------------------------------------------------------------------------------------
@@ -180,7 +180,7 @@
 ERR_INFO_INVALID_MMCO_SHOART2LONG,
 ERR_INFO_INVALID_MMCO_REF_NUM_OVERFLOW,
 ERR_INFO_INVALID_MMCO_REF_NUM_NOT_ENOUGH,
-ERR_INFO_INVALID_MMCO_LONG_TERM_IDX_EXCEED_MAX,
+ERR_INFO_INVALID_MMCO_LONG_TERM_IDX_EXCEED_MAX
 };
 //-----------------------------------------------------------------------------------------------------------
 
--- a/codec/decoder/core/inc/wels_common_basis.h
+++ b/codec/decoder/core/inc/wels_common_basis.h
@@ -60,7 +60,7 @@
 PRO_CAVLC444	= 244,
 
 PRO_SCALABLE_BASELINE	= 83,
-PRO_SCALABLE_HIGH		= 86,
+PRO_SCALABLE_HIGH		= 86
 };
 
 /* Picture Size */
@@ -83,7 +83,7 @@
 MB_TOP      = 0x02,	// B
 MB_TOPRIGHT = 0x04,	// C
 MB_TOPLEFT	= 0x08,	// D,
-MB_PRIVATE  = 0x10,
+MB_PRIVATE  = 0x10
 };
 /* MB Type & Sub-MB Type */
 typedef int32_t MbType;
--- a/codec/decoder/core/src/decode_slice.cpp
+++ b/codec/decoder/core/src/decode_slice.cpp
@@ -419,7 +419,7 @@
     }
     if (iUsedBits > pBs->iBits) { //When BS incomplete, as long as find it, SHOULD stop decoding to avoid mosaic or crash.
       WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
-               "WelsDecodeSlice()::::pBs incomplete, iUsedBits:%"PRId64" > pBs->iBits:%d, MUST stop decoding.",
+               "WelsDecodeSlice()::::pBs incomplete, iUsedBits:%" PRId64" > pBs->iBits:%d, MUST stop decoding.",
                (int64_t) iUsedBits, pBs->iBits);
       return -1;
     }
--- a/codec/encoder/core/inc/picture.h
+++ b/codec/encoder/core/inc/picture.h
@@ -104,7 +104,6 @@
    *	set picture as unreferenced
    */
   void SetUnref () {
-    if (NULL != this)	{
       iFramePoc		= -1;
       iFrameNum		= -1;
       uiTemporalId	=
@@ -117,7 +116,6 @@
 
       if (NULL != pScreenBlockFeatureStorage)
         pScreenBlockFeatureStorage->bRefBlockFeatureCalculated	= false;
-    }
   }
 
 } SPicture;
--- a/codec/encoder/core/inc/rc.h
+++ b/codec/encoder/core/inc/rc.h
@@ -56,7 +56,7 @@
 enum {
   BITS_NORMAL,
   BITS_LIMITED,
-  BITS_EXCEEDED,
+  BITS_EXCEEDED
 };
 
 enum {
@@ -102,7 +102,7 @@
   GOM_ROW_MODE1_720P    = 2,
   QP_RANGE_UPPER_MODE1  = 9,
   QP_RANGE_LOWER_MODE1  = 4,
-  QP_RANGE_INTRA_MODE1  = 3,
+  QP_RANGE_INTRA_MODE1  = 3
 };
 
 //bits allocation
--- a/codec/encoder/core/inc/ref_list_mgr_svc.h
+++ b/codec/encoder/core/inc/ref_list_mgr_svc.h
@@ -50,7 +50,7 @@
 
 typedef enum {
 LTR_DIRECT_MARK = 0,
-LTR_DELAY_MARK = 1,
+LTR_DELAY_MARK = 1
 } LTR_MARKING_PROCESS_MODE;
 
 typedef enum {
@@ -57,7 +57,7 @@
 FRAME_NUM_EQUAL    = 0x01,
 FRAME_NUM_BIGGER   = 0x02,
 FRAME_NUM_SMALLER  = 0x04,
-FRAME_NUM_OVER_MAX = 0x08,
+FRAME_NUM_OVER_MAX = 0x08
 } COMPARE_FRAME_NUM;
 
 /*
--- a/codec/encoder/core/inc/svc_mode_decision.h
+++ b/codec/encoder/core/inc/svc_mode_decision.h
@@ -55,7 +55,7 @@
 
 typedef enum {
 STATIC,
-SCROLLED,
+SCROLLED
 } ESkipModes;
 
 // NOILP ILFMD ENTRANCE
--- a/codec/encoder/core/inc/svc_motion_estimate.h
+++ b/codec/encoder/core/inc/svc_motion_estimate.h
@@ -62,7 +62,7 @@
 
 // derived ME methods combination
 ME_DIA_CROSS    = (ME_DIA | ME_CROSS),   // DIA+CROSS
-ME_DIA_CROSS_FME  = (ME_DIA_CROSS | ME_FME), // DIA+CROSS+FME
+ME_DIA_CROSS_FME  = (ME_DIA_CROSS | ME_FME)  // DIA+CROSS+FME
 };
 
 union SadPredISatdUnit {
--- a/codec/encoder/core/inc/wels_const.h
+++ b/codec/encoder/core/inc/wels_const.h
@@ -192,7 +192,7 @@
 typedef enum {
 RECIEVE_UNKOWN = 0,
 RECIEVE_SUCCESS = 1,
-RECIEVE_FAILED = 2,
+RECIEVE_FAILED = 2
 } LTR_MARKING_RECEIVE_STATE;
 
 enum {
--- a/codec/encoder/core/inc/wels_preprocess.h
+++ b/codec/encoder/core/inc/wels_preprocess.h
@@ -134,7 +134,7 @@
 
   SPicture* GetCurrentFrameFromOrigList (int32_t iDIdx) {
     return m_pSpatialPic[iDIdx][0];
-  };
+  }
   void UpdateSrcList (SPicture*	pCurPicture, const int32_t kiCurDid, SPicture** pShortRefList,
                       const uint32_t kuiShortRefCount);
   void UpdateSrcListLosslessScreenRefSelectionWithLtr (SPicture*	pCurPicture, const int32_t kiCurDid,
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -3029,7 +3029,7 @@
   if (iSpatialNum < 1) {	// skip due to temporal layer settings (different frame rate)
     ++ pCtx->iCodingIndex;
     pFbi->eFrameType = videoFrameTypeSkip;
-    WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,"[Rc] Frame timestamp = %8"PRId64", skip one frame", (int64_t)pSrcPic->uiTimeStamp);
+    WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,"[Rc] Frame timestamp = %8" PRId64", skip one frame", (int64_t)pSrcPic->uiTimeStamp);
     return ENC_RETURN_SUCCESS;
   }
 
@@ -3036,7 +3036,7 @@
   eFrameType = DecideFrameType (pCtx, iSpatialNum);
   if (eFrameType == videoFrameTypeSkip) {
     pFbi->eFrameType = eFrameType;
-    WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,"[Rc] Frame timestamp = %8"PRId64", skip one frame", (int64_t)pSrcPic->uiTimeStamp);
+    WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,"[Rc] Frame timestamp = %8" PRId64", skip one frame", (int64_t)pSrcPic->uiTimeStamp);
     return ENC_RETURN_SUCCESS;
   }
 
@@ -3043,7 +3043,7 @@
   //loop each layer to check if have skip frame when RC and frame skip enable
   if (CheckFrameSkipBasedMaxbr (pCtx, iSpatialNum, eFrameType, (uint32_t)pSrcPic->uiTimeStamp)) {
     pFbi->eFrameType = videoFrameTypeSkip;
-    WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,"[Rc] Frame timestamp = %8"PRId64", skip one frame", (int64_t)pSrcPic->uiTimeStamp);
+    WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,"[Rc] Frame timestamp = %8" PRId64", skip one frame", (int64_t)pSrcPic->uiTimeStamp);
     return ENC_RETURN_SUCCESS;
   }
 
--- a/codec/processing/interface/IWelsVP.h
+++ b/codec/processing/interface/IWelsVP.h
@@ -142,7 +142,7 @@
 typedef enum {
   SIMILAR_SCENE,   //similar scene
   MEDIUM_CHANGED_SCENE,   //medium changed scene
-  LARGE_CHANGED_SCENE,    //large changed scene
+  LARGE_CHANGED_SCENE     //large changed scene
 } ESceneChangeIdc;
 
 typedef enum {
@@ -149,7 +149,7 @@
   NO_STATIC,  // motion block
   COLLOCATED_STATIC, // collocated static block
   SCROLLED_STATIC,  // scrolled static block
-  BLOCK_STATIC_IDC_ALL,
+  BLOCK_STATIC_IDC_ALL
 } EStaticBlockIdc;
 
 typedef struct {
@@ -195,7 +195,7 @@
 
 typedef enum {
   AQ_QUALITY_MODE,   //Quality mode
-  AQ_BITRATE_MODE,   //Bitrate mode
+  AQ_BITRATE_MODE    //Bitrate mode
 } EAQModes;
 
 typedef struct {
--- a/codec/processing/src/common/WelsFrameWork.h
+++ b/codec/processing/src/common/WelsFrameWork.h
@@ -63,7 +63,7 @@
     m_eFormat  = VIDEO_FORMAT_I420;
     m_iIndex   = 0;
     m_bInit    = false;
-  };
+  }
 
   virtual ~IStrategy() {}
 
--- a/codec/processing/src/scrolldetection/ScrollDetection.cpp
+++ b/codec/processing/src/scrolldetection/ScrollDetection.cpp
@@ -112,4 +112,4 @@
   }
 }
 
-WELSVP_NAMESPACE_END
\ No newline at end of file
+WELSVP_NAMESPACE_END
--- a/codec/processing/src/scrolldetection/ScrollDetection.h
+++ b/codec/processing/src/scrolldetection/ScrollDetection.h
@@ -51,7 +51,7 @@
   CScrollDetection (int32_t iCpuFlag) {
     m_eMethod = METHOD_SCROLL_DETECTION;
     WelsMemset (&m_sScrollDetectionParam, 0, sizeof (m_sScrollDetectionParam));
-  };
+  }
   ~CScrollDetection() {
   }
   EResult Process (int32_t iType, SPixMap* pSrcPixMap, SPixMap* pRefPixMap);
--- a/codec/processing/src/scrolldetection/ScrollDetectionFuncs.h
+++ b/codec/processing/src/scrolldetection/ScrollDetectionFuncs.h
@@ -58,4 +58,4 @@
 void ScrollDetectionCore (SPixMap* pSrcPixMap, SPixMap* pRefPixMap, int32_t iWidth, int32_t iHeight,
                           int32_t iOffsetX, int32_t iOffsetY, SScrollDetectionParam& sScrollDetectionParam);
 
-WELSVP_NAMESPACE_END
\ No newline at end of file
+WELSVP_NAMESPACE_END