Merge pull request #1288 from lyao2/threadIDC

fix Loop filter error under multithreads on encoder when #TEST_BED enabled
This commit is contained in:
HaiboZhu 2014-08-22 11:00:07 +08:00
commit dddb825bbd
2 changed files with 4 additions and 13 deletions

View File

@ -292,9 +292,6 @@ int32_t ParamTranscode (const SEncParamExt& pCodingParam) {
/* Deblocking loop filter */ /* Deblocking loop filter */
iLoopFilterDisableIdc = pCodingParam.iLoopFilterDisableIdc; // 0: on, 1: off, 2: on except for slice boundaries, iLoopFilterDisableIdc = pCodingParam.iLoopFilterDisableIdc; // 0: on, 1: off, 2: on except for slice boundaries,
if (iLoopFilterDisableIdc == 0
&& iMultipleThreadIdc != 1) // Loop filter requested to be enabled, with threading enabled
iLoopFilterDisableIdc = 2; // Disable loop filter on slice boundaries since that's not allowed with multithreading
iLoopFilterAlphaC0Offset = pCodingParam.iLoopFilterAlphaC0Offset; // AlphaOffset: valid range [-6, 6], default 0 iLoopFilterAlphaC0Offset = pCodingParam.iLoopFilterAlphaC0Offset; // AlphaOffset: valid range [-6, 6], default 0
iLoopFilterBetaOffset = pCodingParam.iLoopFilterBetaOffset; // BetaOffset: valid range [-6, 6], default 0 iLoopFilterBetaOffset = pCodingParam.iLoopFilterBetaOffset; // BetaOffset: valid range [-6, 6], default 0

View File

@ -1860,7 +1860,9 @@ int32_t InitSliceSettings (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPar
pCodingParam->iCountThreadsNum = WELS_MIN (kiCpuCores, iMaxSliceCount); pCodingParam->iCountThreadsNum = WELS_MIN (kiCpuCores, iMaxSliceCount);
pCodingParam->iMultipleThreadIdc = pCodingParam->iCountThreadsNum; pCodingParam->iMultipleThreadIdc = pCodingParam->iCountThreadsNum;
if (pCodingParam->iLoopFilterDisableIdc == 0
&& pCodingParam->iMultipleThreadIdc != 1) // Loop filter requested to be enabled, with threading enabled
pCodingParam->iLoopFilterDisableIdc = 2; // Disable loop filter on slice boundaries since that's not allowed with multithreading
*pMaxSliceCount = iMaxSliceCount; *pMaxSliceCount = iMaxSliceCount;
return 0; return 0;
@ -1959,14 +1961,12 @@ int32_t WelsInitEncoderExt (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPar
iCacheLineSize = 16; // 16 bytes aligned in default iCacheLineSize = 16; // 16 bytes aligned in default
#endif//X86_ASM #endif//X86_ASM
#ifndef WELS_TESTBED
#if defined(DYNAMIC_DETECT_CPU_CORES) #if defined(DYNAMIC_DETECT_CPU_CORES)
if (pCodingParam->iMultipleThreadIdc > 0) if (pCodingParam->iMultipleThreadIdc > 0)
uiCpuCores = pCodingParam->iMultipleThreadIdc; uiCpuCores = pCodingParam->iMultipleThreadIdc;
else { else {
if (uiCpuCores == 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(); 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 // for client application here it is constrained by maximal to MAX_THREADS_NUM
@ -1977,12 +1977,6 @@ int32_t WelsInitEncoderExt (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPar
} }
#endif//DYNAMIC_DETECT_CPU_CORES #endif//DYNAMIC_DETECT_CPU_CORES
#else//WELS_TESTBED
uiCpuCores = pCodingParam->iMultipleThreadIdc; // assigned uiCpuCores from iMultipleThreadIdc from SGE testing
#endif//WELS_TESTBED
uiCpuCores = WELS_CLIP3 (uiCpuCores, 1, MAX_THREADS_NUM); uiCpuCores = WELS_CLIP3 (uiCpuCores, 1, MAX_THREADS_NUM);
if (InitSliceSettings (pLogCtx, pCodingParam, uiCpuCores, &iSliceNum)) { if (InitSliceSettings (pLogCtx, pCodingParam, uiCpuCores, &iSliceNum)) {