If kiCpuCores < 2, then iCountThreadsNum (and iMultipleThreadIdc) can't be >= 2, because they're initialized with WELS_MIN (kiCpuCores, ...) just a few lines above. If iMultipleThreadIdc is initially set to 0 by the caller, this removed piece of code would change it to 1, if kiCpuCores < 2. When iMultipleThreadIdc is changed from the originally set value, a call to WelsEncoderParamAdjust with the original parameters would reset the whole codec since iMultipleThreadIdc differs. This fixes running EncoderInterfaceTest.TemporalLayerSettingTest on machines where the detected number of cores is 1.
Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 1 file). Show all
Unified · Split
| @@ -1862,14 +1862,6 @@ int32_t InitSliceSettings (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPar · 1861 unmodified lines | |||
| 1862 | pCodingParam->iCountThreadsNum = WELS_MIN (kiCpuCores, iMaxSliceCount); | 1862 | pCodingParam->iCountThreadsNum = WELS_MIN (kiCpuCores, iMaxSliceCount); |
| 1863 | pCodingParam->iMultipleThreadIdc = pCodingParam->iCountThreadsNum; | 1863 | pCodingParam->iMultipleThreadIdc = pCodingParam->iCountThreadsNum; |
| 1864 | 1864 | ||
| 1865 | #ifndef WELS_TESTBED // for product release and non-SGE testing | ||
| 1866 | |||
| 1867 | if (kiCpuCores < 2) { // single CPU core, make no sense for MT parallelization | ||
| 1868 | pCodingParam->iMultipleThreadIdc = 1; | ||
| 1869 | pCodingParam->iCountThreadsNum = 1; | ||
| 1870 | } | ||
| 1871 | #endif | ||
| 1872 | |||
| 1873 | *pMaxSliceCount = iMaxSliceCount; | 1865 | *pMaxSliceCount = iMaxSliceCount; |
| 1874 | 1866 | ||
| 1875 | return 0; | 1867 | return 0; |