shithub: openh264

Download patch

ref: 50a9389f0bacc7c7ee7c806302ac153d01b3ba5b
parent: 8fcef67c70e37e3cb207a26e374a79334eda8bf7
parent: 3dff262fe7c9b260d9cb3fd20e10cb9ab32625ca
author: HaiboZhu <haibozhu@cisco.com>
date: Mon Aug 8 13:01:55 EDT 2016

Merge pull request #2543 from ruil2/complexity1

set complexity mode

--- a/codec/console/enc/src/welsenc.cpp
+++ b/codec/console/enc/src/welsenc.cpp
@@ -667,7 +667,7 @@
   sParam.uiIntraPeriod  = 320;           // period of Intra frame
   sParam.eSpsPpsIdStrategy = INCREASING_ID;
   sParam.bPrefixNalAddingCtrl = 0;
-  sParam.iComplexityMode = MEDIUM_COMPLEXITY;
+  sParam.iComplexityMode = LOW_COMPLEXITY;
   sParam.bSimulcastAVC         = false;
   int iIndexLayer = 0;
   sParam.sSpatialLayers[iIndexLayer].uiProfileIdc       = PRO_BASELINE;
--- a/codec/encoder/core/inc/param_svc.h
+++ b/codec/encoder/core/inc/param_svc.h
@@ -136,7 +136,7 @@
 
     param.fMaxFrameRate         = MAX_FRAME_RATE;       // maximal frame rate [Hz / fps]
 
-    param.iComplexityMode       = MEDIUM_COMPLEXITY;
+    param.iComplexityMode       = LOW_COMPLEXITY;
     param.iTargetBitrate        = UNSPECIFIED_BIT_RATE; // overall target bitrate introduced in RC module
     param.iMaxBitrate           = UNSPECIFIED_BIT_RATE;
     param.iMultipleThreadIdc    = 1;
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -2759,12 +2759,13 @@
   //const bool kbBaseAvail      = pCurLayer->bBaseLayerAvailableFlag;
   const bool kbHighestSpatialLayer =
     (pCtx->pSvcParam->iSpatialLayerNum == (pCurLayer->sLayerInfo.sNalHeaderExt.uiDependencyId + 1));
+  bool bFastMode = kbHighestSpatialLayer && (pCtx->pSvcParam->iComplexityMode == LOW_COMPLEXITY);
   SWelsFuncPtrList* pFuncList = pCtx->pFuncList;
   SLogContext* pLogCtx = & (pCtx->sLogCtx);
   /* function pointers conditional assignment under sWelsEncCtx, layer_mb_enc_rec (in stack) is exclusive */
-  if ((pCtx->pSvcParam->iUsageType == CAMERA_VIDEO_REAL_TIME && kbHighestSpatialLayer) ||
+  if ((pCtx->pSvcParam->iUsageType == CAMERA_VIDEO_REAL_TIME && bFastMode) ||
       (pCtx->pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME && P_SLICE == pCtx->eSliceType
-       && kbHighestSpatialLayer) //TODO: here is for sync with the origin code, consider the design again with more tests
+       && bFastMode) //TODO: here is for sync with the origin code, consider the design again with more tests
      ) {
     SetFastCodingFunc (pFuncList);
   } else {
@@ -2786,7 +2787,7 @@
     pFuncList->sSampleDealingFuncs.pfMeCost = pCtx->pFuncList->sSampleDealingFuncs.pfSampleSatd;
     pFuncList->pfSetScrollingMv = SetScrollingMvToMdNull;
 
-    if (kbHighestSpatialLayer) {
+    if (bFastMode) {
       pFuncList->pfCalculateSatd = NotCalculateSatdCost;
       pFuncList->pfInterFineMd = WelsMdInterFinePartitionVaa;
     } else {