[x265] [PATCH 2 of 2] threadpool: fix calculation of JobProviders

deepthi at multicorewareinc.com deepthi at multicorewareinc.com
Mon Jul 27 10:42:54 CEST 2015


# HG changeset patch
# User Deepthi Nandakumar <deepthi at multicorewareinc.com>
# Date 1437986236 -19800
#      Mon Jul 27 14:07:16 2015 +0530
# Node ID dc446bc5df507d857c3f72ba595a95e981c0258d
# Parent  eb6b04fc06a37a0cfbc70d30f364ec62cbb909d4
threadpool: fix calculation of JobProviders

The framethreads are assigned in a round robin fashion to all threadpools. The
lookahead is always assigned to threadpool 0. This patch fixes crashes due to
under allocation of job providers to thread pool 0.

diff -r eb6b04fc06a3 -r dc446bc5df50 source/common/threadpool.cpp
--- a/source/common/threadpool.cpp	Mon Jul 27 13:00:17 2015 +0530
+++ b/source/common/threadpool.cpp	Mon Jul 27 14:07:16 2015 +0530
@@ -310,7 +310,7 @@
     ThreadPool *pools = new ThreadPool[numPools];
     if (pools)
     {
-        int maxProviders = (p->frameNumThreads + 1 + numPools - 1) / numPools; /* +1 is Lookahead */
+        int maxProviders = (p->frameNumThreads + numPools - 1) / numPools + 1; /* +1 is Lookahead, always assigned to threadpool 0*/
         int node = 0;
         for (int i = 0; i < numPools; i++)
         {


More information about the x265-devel mailing list