shithub: openh264

Download patch

ref: 8d11b28690d47d0e7a0c70beaadc06d96d3c47a5
parent: 65e8560dc7344e6e30053e28fb0770d042bca132
parent: b6883b4ef8add4ad9ee4bf52f1dcf1259a1aaa10
author: Licai Guo <licaguo@cisco.com>
date: Fri Mar 21 13:16:14 EDT 2014

Merge pull request #561 from mstorsjo/use-rc-enum

Make the RC_MODES enum public, use it for the iRCMode field

--- a/codec/api/svc/codec_app_def.h
+++ b/codec/api/svc/codec_app_def.h
@@ -174,6 +174,12 @@
 } SliceModeEnum;
 
 typedef enum {
+  RC_QUALITY_MODE,      //Quality mode
+  RC_BITRATE_MODE,   //Bitrate mode
+  RC_LOW_BW_MODE, //bitrate limited mode
+} RC_MODES;
+
+typedef enum {
   PRO_UNKNOWN     = 0,
   PRO_BASELINE	= 66,
   PRO_MAIN		= 77,
@@ -239,7 +245,7 @@
   int		iPicWidth;			// width of picture in samples
   int		iPicHeight;			// height of picture in samples
   int		iTargetBitrate;		// target bitrate desired
-  int       iRCMode;                 // RC mode
+  RC_MODES      iRCMode;                 // RC mode
   float	    fMaxFrameRate;			// input maximal frame rate
 
 } SEncParamBase, *PEncParamBase;
@@ -253,7 +259,7 @@
   int		iPicWidth;			// width of picture in samples
   int		iPicHeight;			// height of picture in samples
   int		iTargetBitrate;		// target bitrate desired
-  int       iRCMode;                 // RC mode
+  RC_MODES      iRCMode;                 // RC mode
   float	    fMaxFrameRate;			// input maximal frame rate
 
   int		iTemporalLayerNum;	// layer number at temporal level
--- a/codec/console/enc/src/welsenc.cpp
+++ b/codec/console/enc/src/welsenc.cpp
@@ -250,7 +250,7 @@
       } else if (strTag[0].compare ("EnableRC") == 0) {
         pSvcParam.bEnableRc	= atoi (strTag[1].c_str()) ? true : false;
       } else if (strTag[0].compare ("RCMode") == 0) {
-        pSvcParam.iRCMode	= atoi (strTag[1].c_str());
+        pSvcParam.iRCMode	= (RC_MODES) atoi (strTag[1].c_str());
       } else if (strTag[0].compare ("TargetBitrate") == 0) {
         pSvcParam.iTargetBitrate	= 1000 * atoi (strTag[1].c_str());
         if (pSvcParam.bEnableRc && pSvcParam.iTargetBitrate <= 0) {
@@ -352,7 +352,7 @@
       sParam.iLtrMarkPeriod = atoi (argv[i++]);
 
     else if (!strcmp (pCmd, "-rcm") && (i < argc))
-      sParam.iRCMode = atoi (argv[i++]);
+      sParam.iRCMode = (RC_MODES) atoi (argv[i++]);
 
     else if (!strcmp (pCmd, "-tarb") && (i < argc))
       sParam.iTargetBitrate = atoi (argv[i++]);
@@ -580,7 +580,7 @@
   sParam.iPicWidth		= 1280;			// width of picture in samples
   sParam.iPicHeight	= 720;			// height of picture in samples
   sParam.iTargetBitrate = 2500000;		// target bitrate desired
-  sParam.iRCMode       = 0;            //  rc mode control
+  sParam.iRCMode       = RC_QUALITY_MODE;       //  rc mode control
   sParam.iTemporalLayerNum = 3;	// layer number at temporal level
   sParam.iSpatialLayerNum	= 4;	// layer number at spatial level
   sParam.bEnableDenoise    = 0;    // denoise control
--- a/codec/encoder/core/inc/param_svc.h
+++ b/codec/encoder/core/inc/param_svc.h
@@ -171,7 +171,7 @@
  
   /* Rate Control */
   param.bEnableRc		= kbEnableRc;
-  param.iRCMode			= 0;
+  param.iRCMode			= RC_QUALITY_MODE;
   param.iPaddingFlag	= 0;
 
   param.bEnableDenoise				= false;	// denoise control
--- a/codec/encoder/core/inc/rc.h
+++ b/codec/encoder/core/inc/rc.h
@@ -55,12 +55,6 @@
 #define    WELS_RC_DISABLE        0
 #define    WELS_RC_GOM            1
 
-typedef enum {
-  RC_QUALITY_MODE,	//Quality mode
-  RC_BITRATE_MODE,   //Bitrate mode
-  RC_LOW_BW_MODE, //bitrate limited mode
-} RC_MODES;
-
 enum{
   BITS_NORMAL,
   BITS_LIMITED,
--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -905,7 +905,7 @@
   break;
   case ENCODER_OPTION_RC_MODE: {	// 0:quality mode;1:bit-rate mode;2:bitrate limited mode
     int32_t iValue = * ((int32_t*)pOption);
-    m_pEncContext->pSvcParam->iRCMode	= iValue;
+    m_pEncContext->pSvcParam->iRCMode	= (RC_MODES) iValue;
   }
   break;
   case ENCODER_PADDING_PADDING: {	// 0:disable padding;1:padding