shithub: openh264

Download patch

ref: b6883b4ef8add4ad9ee4bf52f1dcf1259a1aaa10
parent: 2bc8e61fcfcee8d66113d3568680f8c1a1487504
author: Martin Storsjö <[email protected]>
date: Fri Mar 21 05:19:30 EDT 2014

Make the iRCMode field use the RC_MODES type instead of plain int

This makes it even clearer for users about how to set this field.

--- a/codec/api/svc/codec_app_def.h
+++ b/codec/api/svc/codec_app_def.h
@@ -245,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;
@@ -259,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/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