shithub: openh264

Download patch

ref: 94cabe10d54021c8269d51ba3fa5d88c4a0607fe
parent: dcd388006ed5e1aef891c71098d804891790302e
parent: b0ed3cb924a69d1e9367cd8016cbcc7addc37a7c
author: sijchen <[email protected]>
date: Tue Apr 8 05:44:21 EDT 2014

Merge pull request #636 from volvet/refine_encoder_wrap

Refine encoder wrap

--- a/codec/encoder/plus/inc/welsEncoderExt.h
+++ b/codec/encoder/plus/inc/welsEncoderExt.h
@@ -104,7 +104,7 @@
   virtual int EXTAPI GetOption (ENCODER_OPTION opt_id, void* option);
 
  private:
-  int Initialize2 (SWelsSvcCodingParam* argv);
+  int InitializeInternal (SWelsSvcCodingParam* argv);
 
   sWelsEncCtx*	m_pEncContext;
 
@@ -130,7 +130,6 @@
 #endif//REC_FRAME_COUNT
 
   void    InitEncoder (void);
-  int32_t RawData2SrcPic (const uint8_t* pSrc);
   void    DumpSrcPicture (const uint8_t* pSrc);
 };
 }
--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -219,7 +219,7 @@
     return cmInitParaError;
   }
 
-  return Initialize2 (&sConfig);
+  return InitializeInternal(&sConfig);
 }
 
 int CWelsH264SVCEncoder::InitializeExt (const SEncParamExt* argv) {
@@ -238,10 +238,10 @@
     return cmInitParaError;
   }
 
-  return Initialize2 (&sConfig);
+  return InitializeInternal(&sConfig);
 }
 
-int CWelsH264SVCEncoder::Initialize2 (SWelsSvcCodingParam* pCfg) {
+int CWelsH264SVCEncoder::InitializeInternal(SWelsSvcCodingParam* pCfg) {
   if (NULL == pCfg) {
     WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), invalid argv= 0x%p.\n",
              pCfg);
@@ -465,37 +465,6 @@
   }
 
   m_bInitialFlag = false;
-
-  return 0;
-}
-
-
-int32_t CWelsH264SVCEncoder::RawData2SrcPic (const uint8_t* pSrc) {
-  assert (m_iSrcListSize > 0);
-
-  int32_t y_length = m_iMaxPicWidth * m_iMaxPicHeight;
-  m_pSrcPicList[0]->pData[0] = const_cast<uint8_t*> (pSrc);
-
-  switch (m_iCspInternal & (~videoFormatVFlip)) {
-  case videoFormatYVYU:
-  case videoFormatUYVY:
-  case videoFormatYUY2:
-  case videoFormatRGB:
-  case videoFormatBGR:
-  case videoFormatBGRA:
-  case videoFormatRGBA:
-  case videoFormatARGB:
-  case videoFormatABGR:
-    m_pSrcPicList[0]->pData[1] = m_pSrcPicList[0]->pData[2] = NULL;
-    break;
-  case videoFormatI420:
-  case videoFormatYV12:
-    m_pSrcPicList[0]->pData[1] = m_pSrcPicList[0]->pData[0] + y_length;
-    m_pSrcPicList[0]->pData[2] = m_pSrcPicList[0]->pData[1] + (y_length >> 2);
-    break;
-  default:
-    return 1;
-  }
 
   return 0;
 }