[x265] [PATCH 2 of 7] api: add param.lookaheadSlices

Steve Borho steve at borho.org
Thu Mar 26 17:27:22 CET 2015


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1427385371 18000
#      Thu Mar 26 10:56:11 2015 -0500
# Node ID 32b79736f12800111bd5066f324183e1a488afd1
# Parent  1974406ff5fdb0fd3311818b5fb3400a529b0902
api: add param.lookaheadSlices

This threading feature used to be auto-enabled when the thread pool was a
certain size. But this makes the encoder output variable depending on the number
of CPUs, which is not particularly helpful, especially when lookahead slices are
often not very helpful with performance.  So I'm putting the choice in the hands
of the user.

diff -r 1974406ff5fd -r 32b79736f128 source/CMakeLists.txt
--- a/source/CMakeLists.txt	Thu Mar 26 10:49:41 2015 -0500
+++ b/source/CMakeLists.txt	Thu Mar 26 10:56:11 2015 -0500
@@ -24,7 +24,7 @@
 include(CheckCXXCompilerFlag)
 
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 49)
+set(X265_BUILD 50)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
                "${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff -r 1974406ff5fd -r 32b79736f128 source/common/param.cpp
--- a/source/common/param.cpp	Thu Mar 26 10:49:41 2015 -0500
+++ b/source/common/param.cpp	Thu Mar 26 10:56:11 2015 -0500
@@ -138,6 +138,7 @@
     param->bFrameAdaptive = X265_B_ADAPT_TRELLIS;
     param->bBPyramid = 1;
     param->scenecutThreshold = 40; /* Magic number pulled in from x264 */
+    param->lookaheadSlices = 0;
 
     /* Intra Coding Tools */
     param->bEnableConstrainedIntra = 0;
diff -r 1974406ff5fd -r 32b79736f128 source/x265.h
--- a/source/x265.h	Thu Mar 26 10:49:41 2015 -0500
+++ b/source/x265.h	Thu Mar 26 10:56:11 2015 -0500
@@ -611,6 +611,16 @@
      * cu-tree analysis. Default is 40 frames, maximum is 250 */
     int       lookaheadDepth;
 
+    /* Use multiple worker threads to measure the estimated cost of each frame
+     * within the lookahead. When bFrameAdaptive is 2, most frame cost estimates
+     * will be performed in batch mode, many cost estimates at the same time,
+     * and lookaheadSlices is ignored for batched estimates. The effect on
+     * performance can be quite small.  The higher this parameter, the less
+     * accurate the frame costs will be (since context is lost across slice
+     * boundaries) which will result in less accurate B-frame and scene-cut
+     * decisions. Default is 0 - disabled. 1 is the same as 0. Max 16 */
+    int       lookaheadSlices;
+
     /* An arbitrary threshold which determines how aggressively the lookahead
      * should detect scene cuts. The default (40) is recommended. */
     int       scenecutThreshold;


More information about the x265-devel mailing list