shithub: openh264

Download patch

ref: c96fe5fec43be025ac6d39be5841e5d57af701da
parent: a758282ee70f834f1ce5f2a4c17e8da97ddbe774
parent: 691c2bc1e780f0891dc4d86d998a753092dbcf20
author: sijchen <sijchen@cisco.com>
date: Wed Apr 9 10:00:30 EDT 2014

Merge pull request #652 from volvet/refine_enc_wrap

remove m_pScrPicList, which is not needed anymore

--- a/codec/encoder/plus/inc/welsEncoderExt.h
+++ b/codec/encoder/plus/inc/welsEncoderExt.h
@@ -109,9 +109,6 @@
   sWelsEncCtx*	m_pEncContext;
 
   welsCodecTrace*			m_pWelsTrace;
-  SSourcePicture**			m_pSrcPicList;
-  int32_t						m_iSrcListSize;
-
   int32_t						m_iMaxPicWidth;
   int32_t						m_iMaxPicHeight;
 
--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -61,8 +61,6 @@
 CWelsH264SVCEncoder::CWelsH264SVCEncoder()
   :	m_pEncContext (NULL),
     m_pWelsTrace (NULL),
-    m_pSrcPicList (NULL),
-    m_iSrcListSize (0),
     m_iMaxPicWidth (0),
     m_iMaxPicHeight (0),
     m_iCspInternal (0),
@@ -376,43 +374,10 @@
   pCfg->iLoopFilterAlphaC0Offset	= WELS_CLIP3 (pCfg->iLoopFilterAlphaC0Offset, -6, 6);
   pCfg->iLoopFilterBetaOffset		= WELS_CLIP3 (pCfg->iLoopFilterBetaOffset, -6, 6);
 
-//	m_pSrcPicList	= (SSourcePicture **)WelsMalloc( pCfg->iSpatialLayerNum * sizeof(SSourcePicture *), "m_pSrcPicList" );
-  // prefer use new/delete pair due encoder intialization stage not start yet for CacheLineSize not detection here (16 or 64 not matched)
-  m_pSrcPicList	= new SSourcePicture* [iNumOfLayers];
-
-  if (NULL == m_pSrcPicList) {
-    WelsLog (m_pEncContext, WELS_LOG_ERROR,
-             "CWelsH264SVCEncoder::Initialize(), pOut of memory due m_pSrcPicList memory request.\n");
-    Uninitialize();
-    return cmMallocMemeError;
-  }
-
   // decide property list size between INIT_TYPE_PARAMETER_BASED/INIT_TYPE_CONFIG_BASED
   m_iMaxPicWidth	= pCfg->iPicWidth;
   m_iMaxPicHeight	= pCfg->iPicHeight;
-  m_iSrcListSize  = iNumOfLayers;
 
-  for (int32_t i = 0; i < m_iSrcListSize; ++ i) {
-//		m_pSrcPicList[i]	= (SSourcePicture *)WelsMalloc( sizeof(SSourcePicture), "m_pSrcPicList[]" );
-    // prefer use new/delete pair due encoder intialization stage not start yet for CacheLineSize not detection here (16 or 64 not matched)
-    m_pSrcPicList[i]	= new SSourcePicture;
-
-    if (NULL == m_pSrcPicList[i]) {
-      WelsLog (m_pEncContext, WELS_LOG_ERROR,
-               "CWelsH264SVCEncoder::Initialize(), pOut of memory due m_pSrcPicList[%d] memory request.\n", i);
-      Uninitialize();
-      m_iSrcListSize = 0;
-      return cmMallocMemeError;
-    }
-    if(InitPic (m_pSrcPicList[i], iColorspace, m_iMaxPicWidth, m_iMaxPicHeight))
-    {
-       WelsLog (m_pEncContext, WELS_LOG_ERROR,
-                 "CWelsH264SVCEncoder::Initialize(), InitPic Failed iColorspace= 0x%x\n", iColorspace);
-       Uninitialize();
-       return cmInitParaError;
-    }
-    }
-
   if (WelsInitEncoderExt (&m_pEncContext, pCfg)) {
     WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), WelsInitEncoderExt failed.\n");
     Uninitialize();
@@ -441,25 +406,6 @@
 #endif//REC_FRAME_COUNT
 
   if (NULL != m_pEncContext) {
-    if (NULL != m_pSrcPicList) {
-      for (int32_t i = 0; i < m_iSrcListSize; i++) {
-        SSourcePicture* pic = m_pSrcPicList[i];
-        if (NULL != pic) {
-//					WelsFree( pic, "m_pSrcPicList[]" );
-          // prefer use new/delete pair due encoder intialization stage not start yet for CacheLineSize not detection here (16 or 64 not matched)
-          delete pic;
-
-          pic = NULL;
-        }
-      }
-//			WelsFree( m_pSrcPicList, "m_pSrcPicList" );
-      // prefer use new/delete pair due encoder intialization stage not start yet for CacheLineSize not detection here (16 or 64 not matched)
-      delete [] m_pSrcPicList;
-
-      m_pSrcPicList = NULL;
-      m_iSrcListSize = 0;
-    }
-
     WelsUninitEncoderExt (&m_pEncContext);
     m_pEncContext	= NULL;
   }
@@ -632,28 +578,6 @@
              m_uiCountFrameNum, m_iCspInternal, iValue);
 #endif//REC_FRAME_COUNT
 
-
-    int32_t iPicIdx = m_iSrcListSize - 1;
-    while (iPicIdx >= 0) {
-      if (m_pSrcPicList[iPicIdx] == NULL) {
-        -- iPicIdx;
-        if (iPicIdx < 0) return cmInitParaError;
-        continue;
-      }
-
-      if (m_pSrcPicList[iPicIdx]->iColorFormat == iColorspace) {
-        -- iPicIdx;
-        continue;
-      }
-
-      if(InitPic (m_pSrcPicList[iPicIdx], iColorspace, m_iMaxPicWidth, m_iMaxPicHeight))
-      {
-        WelsLog (m_pEncContext, WELS_LOG_INFO,
-                 "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_DATAFORMAT, iColorspace= 0x%x\n",
-                  iColorspace);
-        return cmInitParaError;
-      }
-    }
     m_iCspInternal = iColorspace;
 #ifdef REC_FRAME_COUNT
     WelsLog (m_pEncContext, WELS_LOG_INFO,
@@ -746,18 +670,8 @@
     }
     iTargetWidth	= sConfig.iPicWidth;
     iTargetHeight	= sConfig.iPicHeight;
-    if (m_pSrcPicList[0] == NULL) {
-      return cmInitParaError;
-    }
     if (m_iCspInternal != iInputColorspace || m_iMaxPicWidth != iTargetWidth
         || m_iMaxPicHeight != iTargetHeight) {	// for color space due to changed
-      if(InitPic (m_pSrcPicList[0], iInputColorspace, iTargetWidth, iTargetHeight))
-      {
-        WelsLog (m_pEncContext, WELS_LOG_INFO,
-                "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, iInputColorspace= 0x%x\n",
-                 iInputColorspace);
-          return cmInitParaError;
-      }
       m_iMaxPicWidth	= iTargetWidth;
       m_iMaxPicHeight	= iTargetHeight;
       m_iCspInternal	= iInputColorspace;