Showing the changes to codec/encoder/core/src/slice_multi_threading.cpp (1 of 2 files). Show all
Unified · Split
| @@ -951,29 +951,10 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 950 unmodified lines | ||
| 951 | 951 | int32_t CreateSliceThreads (sWelsEncCtx* pCtx) { |
| 952 | 952 | const int32_t kiThreadCount = pCtx->pSvcParam->iCountThreadsNum; |
| 953 | 953 | int32_t iIdx = 0; |
| 954 | −#if defined(_WIN32) && defined(BIND_CPU_CORES_TO_THREADS) | |
| 955 | − DWORD dwProcessAffinity; | |
| 956 | − DWORD dwSystemAffinity; | |
| 957 | − GetProcessAffinityMask (GetCurrentProcess(), &dwProcessAffinity, &dwSystemAffinity); | |
| 958 | −#endif//WIN32 && BIND_CPU_CORES_TO_THREADS | |
| 959 | 954 | |
| 960 | 955 | while (iIdx < kiThreadCount) { |
| 961 | 956 | WelsThreadCreate (&pCtx->pSliceThreading->pThreadHandles[iIdx], CodingSliceThreadProc, |
| 962 | 957 | &pCtx->pSliceThreading->pThreadPEncCtx[iIdx], 0); |
| 963 | −#if defined(_WIN32) && defined(BIND_CPU_CORES_TO_THREADS) | |
| 964 | − if (dwProcessAffinity > 1 | |
| 965 | − && pCtx->pSliceThreading->pThreadHandles[iIdx] != NULL) { // multiple cores and thread created successfully | |
| 966 | − DWORD dw = 0; | |
| 967 | − DWORD dwAffinityMask = 1 << iIdx; | |
| 968 | − if (dwAffinityMask & dwProcessAffinity) { // check if cpu is available | |
| 969 | − dw = SetThreadAffinityMask (pCtx->pSliceThreading->pThreadHandles[iIdx], dwAffinityMask); //1 << iIdx | |
| 970 | − if (dw == 0) { | |
| 971 | − char str[64] = {0}; | |
| 972 | − WelsSnprintf (str, 64, "SetThreadAffinityMask iIdx:%d", iIdx); | |
| 973 | − } | |
| 974 | − } | |
| 975 | − } | |
| 976 | −#endif//WIN32 && BIND_CPU_CORES_TO_THREADS | |
| 977 | 958 | |
| 978 | 959 | ++ iIdx; |
| 979 | 960 | } |