[x265] [PATCH] encoder: do not disable the thread pool if lookahead-slices is enabled

Steve Borho steve at borho.org
Sat Apr 4 05:39:53 CEST 2015


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1428118763 18000
#      Fri Apr 03 22:39:23 2015 -0500
# Node ID fa6451ec733a30a7cea20ef573d3c4f0ba6f102d
# Parent  4433f6cf89c755092b9c89a8d5c985451538f079
encoder: do not disable the thread pool if lookahead-slices is enabled

The user is asking for a pool feature, give them a thread-pool.

This fixes a regression test which used --no-wpp --lookahead-slices 2. By
default this had no thread pool and so lookahead-slices 2 was ignored. But if
the --pme spot-check was randomly selected, it would re-enable the pool and
re-enable lookahead-slices and the outputs would change. After this change,
the lookahead slices prevent --no-wpp from disabling the pool itself.

diff -r 4433f6cf89c7 -r fa6451ec733a doc/reST/cli.rst
--- a/doc/reST/cli.rst	Fri Apr 03 16:22:38 2015 -0700
+++ b/doc/reST/cli.rst	Fri Apr 03 22:39:23 2015 -0500
@@ -201,11 +201,11 @@
 	their node, they will not be allowed to migrate between nodes, but they
 	will be allowed to move between CPU cores within their node.
 
-	If the three pool features: :option:`--wpp` :option:`--pmode` and
-	:option:`--pme` are all disabled, then :option:`--pools` is ignored
-	and no thread pools are created.
+	If the four pool features: :option:`--wpp`, :option:`--pmode`,
+	:option:`--pme` and :option:`--lookahead-slices` are all disabled,
+	then :option:`--pools` is ignored and no thread pools are created.
 
-	If "none" is specified, then all three of the thread pool features are
+	If "none" is specified, then all four of the thread pool features are
 	implicitly disabled.
 
 	Multiple thread pools will be allocated for any NUMA node with more than
diff -r 4433f6cf89c7 -r fa6451ec733a doc/reST/threading.rst
--- a/doc/reST/threading.rst	Fri Apr 03 16:22:38 2015 -0700
+++ b/doc/reST/threading.rst	Fri Apr 03 22:39:23 2015 -0500
@@ -225,6 +225,7 @@
 lowres cost analysis to worker threads. It will use bonded task groups
 to perform batches of frame cost estimates, and it may optionally use
 bonded task groups to measure single frame cost estimates using slices.
+(see :option:`--lookahead-slices`)
 
 The function slicetypeDecide() itself is also be performed by a worker
 thread if your encoder has a thread pool, else it runs within the
diff -r 4433f6cf89c7 -r fa6451ec733a source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Fri Apr 03 16:22:38 2015 -0700
+++ b/source/encoder/encoder.cpp	Fri Apr 03 22:39:23 2015 -0500
@@ -106,7 +106,7 @@
     bool allowPools = !p->numaPools || strcmp(p->numaPools, "none");
 
     // Trim the thread pool if --wpp, --pme, and --pmode are disabled
-    if (!p->bEnableWavefront && !p->bDistributeModeAnalysis && !p->bDistributeMotionEstimation)
+    if (!p->bEnableWavefront && !p->bDistributeModeAnalysis && !p->bDistributeMotionEstimation && !p->lookaheadSlices)
         allowPools = false;
 
     if (!p->frameNumThreads)
@@ -140,9 +140,11 @@
             x265_log(p, X265_LOG_WARNING, "No thread pool allocated, --pme disabled\n");
         if (p->bDistributeModeAnalysis)
             x265_log(p, X265_LOG_WARNING, "No thread pool allocated, --pmode disabled\n");
+        if (p->lookaheadSlices)
+            x265_log(p, X265_LOG_WARNING, "No thread pool allocated, --lookahead-slices disabled\n");
 
         // disable all pool features if the thread pool is disabled or unusable.
-        p->bEnableWavefront = p->bDistributeModeAnalysis = p->bDistributeMotionEstimation = 0;
+        p->bEnableWavefront = p->bDistributeModeAnalysis = p->bDistributeMotionEstimation = p->lookaheadSlices = 0;
     }
 
     char buf[128];


More information about the x265-devel mailing list