shithub: openh264

Download patch

ref: dea4303357a88f697868fbf6b38ff46fd20047bb
parent: 443630b0989caf89975e3c839816abdcd11a1f85
parent: ee4dafaa7071ae57aa9720bd8f80a4d3742bd571
author: huili2 <huili2@cisco.com>
date: Fri Jun 19 04:44:16 EDT 2015

Merge pull request #1994 from sijchen/mt1

[encoder] remove one always-on macro to save code complexity

--- a/codec/encoder/core/inc/mt_defs.h
+++ b/codec/encoder/core/inc/mt_defs.h
@@ -51,9 +51,6 @@
 //#define MT_DEBUG
 //#define ENABLE_TRACE_MT
 
-
-#define DYNAMIC_DETECT_CPU_CORES
-
 #define THRESHOLD_RMSE_CORE8    0.0320f // v1.1: 0.0320f; v1.0: 0.02f
 #define THRESHOLD_RMSE_CORE4    0.0215f // v1.1: 0.0215f; v1.0: 0.03f
 #define THRESHOLD_RMSE_CORE2    0.0200f // v1.1: 0.0200f; v1.0: 0.04f
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -2395,22 +2395,15 @@
   iCacheLineSize = 16; // 16 bytes aligned in default
 #endif//X86_ASM
 
-#if defined(DYNAMIC_DETECT_CPU_CORES)
   if (pCodingParam->iMultipleThreadIdc > 0)
     uiCpuCores = pCodingParam->iMultipleThreadIdc;
   else {
     if (uiCpuCores ==
-        0) // cpuid not supported or doesn't expose the number of cores, use high level system API as followed to detect number of pysical/logic processor
+        0) { // cpuid not supported or doesn't expose the number of cores, use high level system API as followed to detect number of pysical/logic processor
       uiCpuCores = DynamicDetectCpuCores();
-    // So far so many cpu cores up to MAX_THREADS_NUM mean for server platforms,
+    }// So far so many cpu cores up to MAX_THREADS_NUM mean for server platforms,
     // for client application here it is constrained by maximal to MAX_THREADS_NUM
-    if (uiCpuCores > MAX_THREADS_NUM) // MAX_THREADS_NUM
-      uiCpuCores = MAX_THREADS_NUM; // MAX_THREADS_NUM
-    else if (uiCpuCores < 1) // just for safe
-      uiCpuCores = 1;
   }
-#endif//DYNAMIC_DETECT_CPU_CORES
-
   uiCpuCores = WELS_CLIP3 (uiCpuCores, 1, MAX_THREADS_NUM);
 
   if (InitSliceSettings (pLogCtx, pCodingParam, uiCpuCores, &iSliceNum)) {