<div dir="ltr">The logic for disabling lookahead slices for resolutions less than 720p is not included?<br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 4, 2015 at 12:27 PM, Pradeep Ramachandran <span dir="ltr"><<a href="mailto:pradeep@multicorewareinc.com" target="_blank">pradeep@multicorewareinc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""># HG changeset patch<br>
# User Pradeep Ramachandran <<a href="mailto:pradeep@multicorewareinc.com">pradeep@multicorewareinc.com</a>><br>
</span># Date 1446620236 -19800<br>
#      Wed Nov 04 12:27:16 2015 +0530<br>
# Node ID f04e0fb7b82e98b5bab4e8ae1cfb3caf92f8c277<br>
# Parent  02db15e14351c7f5190203a087db285655961205<br>
<span class="">perf: Enabling lookahead-slices for all presets except veryslow & placebo<br>
<br>
Seeing ~10% performance on the faster presets on skylake, and ~2X performance<br>
on Xeon systems in ultrafast setting. Performance improvement is through a<br>
considerable increase in utilization across the board. Disabling slicing for<br>
videos of resoultion < 720p to limit impact on quality.<br>
<br>
Commit will change outputs, but reduction in quality (measured by PSNR or SSIM)<br>
is <0.01% across a wide variety of presets and runs.<br>
<br>
</span>diff -r 02db15e14351 -r f04e0fb7b82e doc/reST/cli.rst<br>
--- a/doc/reST/cli.rst  Thu Oct 29 15:22:36 2015 +0530<br>
+++ b/doc/reST/cli.rst  Wed Nov 04 12:27:16 2015 +0530<br>
<div><div class="h5">@@ -1124,21 +1124,31 @@<br>
<br>
 .. option:: --lookahead-slices <0..16><br>
<br>
-       Use multiple worker threads to measure the estimated cost of each<br>
-       frame within the lookahead. When :option:`--b-adapt` is 2, most<br>
-       frame cost estimates will be performed in batch mode, many cost<br>
-       estimates at the same time, and lookahead-slices is ignored for<br>
-       batched estimates. The effect on performance can be quite small.<br>
-       The higher this parameter, the less accurate the frame costs will be<br>
-       (since context is lost across slice boundaries) which will result in<br>
-       less accurate B-frame and scene-cut decisions.<br>
+       Use multiple worker threads to measure the estimated cost of each frame<br>
+       within the lookahead. The frame is divided into the specified number of<br>
+       slices, and one-thread is launched  per slice. When :option:`--b-adapt` is<br>
+       2, most frame cost estimates will be performed in batch mode (many cost<br>
+       estimates at the same time) and lookahead-slices is ignored for batched<br>
+       estimates; it may still be used for single cost estimations. The higher this<br>
+       parameter, the less accurate the frame costs will be (since context is lost<br>
+       across slice boundaries) which will result in less accurate B-frame and<br>
+       scene-cut decisions. The effect on performance can be significant especially<br>
+       on systems with many threads.<br>
<br>
-       The encoder may internally lower the number of slices to ensure<br>
-       each slice codes at least 10 16x16 rows of lowres blocks. If slices<br>
-       are used in lookahead, they are logged in the list of tools as<br>
-       *lslices*.<br>
-<br>
-       **Values:** 0 - disabled (default). 1 is the same as 0. Max 16<br>
+       The encoder may internally lower the number of slices or disable<br>
+    slicing to ensure each slice codes at least 10 16x16 rows of lowres<br>
+    blocks to minimize the impact on quality. For example, for 720p and<br>
+    1080p videos, the number of slices is capped to 4 and 6, respectively.<br>
+    For resolutions lesser than 720p, slicing is auto-disabled.<br>
+<br>
+    If slices are used in lookahead, they are logged in the list of tools<br>
+    as *lslices*<br>
+<br>
+       **Values:** 0 - disabled. 1 is the same as 0. Max 16.<br>
+    Default: 8 for ultrafast, superfast, faster, fast, medium<br>
+             4 for slow, slower<br>
+             disabled for veryslow, slower<br>
+<br>
<br>
 .. option:: --b-adapt <integer><br>
<br>
</div></div>diff -r 02db15e14351 -r f04e0fb7b82e doc/reST/presets.rst<br>
--- a/doc/reST/presets.rst      Thu Oct 29 15:22:36 2015 +0530<br>
+++ b/doc/reST/presets.rst      Wed Nov 04 12:27:16 2015 +0530<br>
<span class="">@@ -19,61 +19,63 @@<br>
<br>
 The presets adjust encoder parameters to affect these trade-offs.<br>
<br>
-+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
-|              | ultrafast | superfast | veryfast | faster | fast | medium | slow | slower | veryslow | placebo |<br>
-+==============+===========+===========+==========+========+======+========+======+========+==========+=========+<br>
-| ctu          |   32      |    32     |   32     |  64    |  64  |   64   |  64  |  64    |   64     |   64    |<br>
-+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
-| min-cu-size  |   16      |     8     |    8     |   8    |   8  |    8   |   8  |   8    |    8     |    8    |<br>
-+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
-| bframes      |    3      |     3     |    4     |   4    |  4   |    4   |  4   |   8    |    8     |    8    |<br>
-+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
-| b-adapt      |    0      |     0     |    0     |   0    |  0   |    2   |  2   |   2    |    2     |    2    |<br>
-+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
-| rc-lookahead |    5      |    10     |   15     |  15    |  15  |   20   |  25  |   30   |   40     |   60    |<br>
-+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
-| scenecut     |    0      |    40     |   40     |  40    |  40  |   40   |  40  |   40   |   40     |   40    |<br>
-+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
</span>-| ref          |    1      |     1     |    1     |   1    |  2   |    3   |  3   |   3    |    5     |    5    |<br>
<div><div class="h5">-+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
-| me           |   dia     |   hex     |   hex    |  hex   | hex  |   hex  | star |  star  |   star   |   star  |<br>
-+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
-| merange      |   57      |    57     |   57     |  57    |  57  |   57   | 57   |  57    |   57     |   92    |<br>
-+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
-| subme        |    0      |     1     |    1     |   2    |  2   |    2   |  3   |   3    |    4     |    5    |<br>
-+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
-| rect         |    0      |     0     |    0     |   0    |  0   |    0   |  1   |   1    |    1     |    1    |<br>
-+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
-| amp          |    0      |     0     |    0     |   0    |  0   |    0   |  0   |   1    |    1     |    1    |<br>
-+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
-| max-merge    |    2      |     2     |    2     |   2    |  2   |    2   |  3   |   3    |    4     |    5    |<br>
-+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
-| early-skip   |    1      |     1     |    1     |   1    |  0   |    0   |  0   |   0    |    0     |    0    |<br>
-+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
-| fast-intra   |    1      |     1     |    1     |   1    |  1   |    0   |  0   |   0    |    0     |    0    |<br>
-+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
-| b-intra      |    0      |     0     |    0     |   0    |  0   |    0   |  0   |   1    |    1     |    1    |<br>
-+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
-| sao          |    0      |     0     |    1     |   1    |  1   |    1   |  1   |   1    |    1     |    1    |<br>
-+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
-| signhide     |    0      |     1     |    1     |   1    |  1   |    1   |  1   |   1    |    1     |    1    |<br>
-+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
-| weightp      |    0      |     0     |    1     |   1    |  1   |    1   |  1   |   1    |    1     |    1    |<br>
-+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
-| weightb      |    0      |     0     |    0     |   0    |  0   |    0   |  0   |   1    |    1     |    1    |<br>
-+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
-| aq-mode      |    0      |     0     |    1     |   1    |  1   |    1   |  1   |   1    |    1     |    1    |<br>
-+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
-| cuTree       |    0      |     0     |    0     |   0    |  1   |    1   |  1   |   1    |    1     |    1    |<br>
-+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
-| rdLevel      |    2      |     2     |    2     |   2    |  2   |    3   |  4   |   6    |    6     |    6    |<br>
-+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
-| rdoq-level   |    0      |     0     |    0     |   0    |  0   |    0   |  2   |   2    |    2     |    2    |<br>
-+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
-| tu-intra     |    1      |     1     |    1     |   1    |  1   |    1   |  1   |   2    |    3     |    4    |<br>
-+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
-| tu-inter     |    1      |     1     |    1     |   1    |  1   |    1   |  1   |   2    |    3     |    4    |<br>
-+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
</div></div>++---------------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
<span class="">+|                     | ultrafast | superfast | veryfast | faster | fast | medium | slow | slower | veryslow | placebo |<br>
</span>++=====================+===========+===========+==========+========+======+========+======+========+==========+=========+<br>
<span class="">+| ctu                 |   32      |    32     |   32     |  64    |  64  |   64   |  64  |  64    |   64     |   64    |<br>
</span>++---------------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
<span class="">+| min-cu-size         |   16      |     8     |    8     |   8    |   8  |    8   |   8  |   8    |    8     |    8    |<br>
</span>++---------------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
<span class="">+| bframes             |    3      |     3     |    4     |   4    |  4   |    4   |  4   |   8    |    8     |    8    |<br>
</span>++---------------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
<span class="">+| b-adapt             |    0      |     0     |    0     |   0    |  0   |    2   |  2   |   2    |    2     |    2    |<br>
</span>++---------------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
<span class="">+| rc-lookahead        |    5      |    10     |   15     |  15    |  15  |   20   |  25  |   30   |   40     |   60    |<br>
</span>++---------------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
<span class="">+| scenecut            |    0      |    40     |   40     |  40    |  40  |   40   |  40  |   40   |   40     |   40    |<br>
</span>++---------------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
+| ref                 |    1      |     1     |    1     |   1    |  2   |    3   |  3   |   3    |    5     |    5    |<br>
++---------------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
<span class="">+| me                  |   dia     |   hex     |   hex    |  hex   | hex  |   hex  | star |  star  |   star   |   star  |<br>
</span>++---------------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
<span class="">+| merange             |   57      |    57     |   57     |  57    |  57  |   57   | 57   |  57    |   57     |   92    |<br>
</span>++---------------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
<span class="">+| subme               |    0      |     1     |    1     |   2    |  2   |    2   |  3   |   3    |    4     |    5    |<br>
</span>++---------------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
<span class="">+| rect                |    0      |     0     |    0     |   0    |  0   |    0   |  1   |   1    |    1     |    1    |<br>
</span>++---------------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
<span class="">+| amp                 |    0      |     0     |    0     |   0    |  0   |    0   |  0   |   1    |    1     |    1    |<br>
</span>++---------------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
<span class="">+| max-merge           |    2      |     2     |    2     |   2    |  2   |    2   |  3   |   3    |    4     |    5    |<br>
</span>++---------------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
<span class="">+| early-skip          |    1      |     1     |    1     |   1    |  0   |    0   |  0   |   0    |    0     |    0    |<br>
</span>++---------------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
<span class="">+| fast-intra          |    1      |     1     |    1     |   1    |  1   |    0   |  0   |   0    |    0     |    0    |<br>
</span>++---------------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
<span class="">+| b-intra             |    0      |     0     |    0     |   0    |  0   |    0   |  0   |   1    |    1     |    1    |<br>
</span>++---------------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
<span class="">+| sao                 |    0      |     0     |    1     |   1    |  1   |    1   |  1   |   1    |    1     |    1    |<br>
</span>++---------------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
<span class="">+| signhide            |    0      |     1     |    1     |   1    |  1   |    1   |  1   |   1    |    1     |    1    |<br>
</span>++---------------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
<span class="">+| weightp             |    0      |     0     |    1     |   1    |  1   |    1   |  1   |   1    |    1     |    1    |<br>
</span>++---------------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
<span class="">+| weightb             |    0      |     0     |    0     |   0    |  0   |    0   |  0   |   1    |    1     |    1    |<br>
</span>++---------------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
<span class="">+| aq-mode             |    0      |     0     |    1     |   1    |  1   |    1   |  1   |   1    |    1     |    1    |<br>
</span>++---------------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
<span class="">+| cuTree              |    0      |     0     |    0     |   0    |  1   |    1   |  1   |   1    |    1     |    1    |<br>
</span>++---------------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
<span class="">+| rdLevel             |    2      |     2     |    2     |   2    |  2   |    3   |  4   |   6    |    6     |    6    |<br>
</span>++---------------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
<span class="">+| rdoq-level          |    0      |     0     |    0     |   0    |  0   |    0   |  2   |   2    |    2     |    2    |<br>
</span>++---------------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
<span class="">+| tu-intra            |    1      |     1     |    1     |   1    |  1   |    1   |  1   |   2    |    3     |    4    |<br>
</span>++---------------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
<span class="">+| tu-inter            |    1      |     1     |    1     |   1    |  1   |    1   |  1   |   2    |    3     |    4    |<br>
</span>++---------------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
+| lookahead-slices    |    1      |     1     |    1     |   1    |  1   |    1   |  1   |   2    |    3     |    4    |<br>
++---------------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+<br>
<span class=""><br>
 Placebo mode enables transform-skip prediction evaluation.<br>
<br>
</span>diff -r 02db15e14351 -r f04e0fb7b82e source/common/param.cpp<br>
--- a/source/common/param.cpp   Thu Oct 29 15:22:36 2015 +0530<br>
+++ b/source/common/param.cpp   Wed Nov 04 12:27:16 2015 +0530<br>
<span class="">@@ -147,7 +147,7 @@<br>
     param->bFrameAdaptive = X265_B_ADAPT_TRELLIS;<br>
     param->bBPyramid = 1;<br>
     param->scenecutThreshold = 40; /* Magic number pulled in from x264 */<br>
-    param->lookaheadSlices = 0;<br>
+    param->lookaheadSlices = 8;<br>
<br>
     /* Intra Coding Tools */<br>
     param->bEnableConstrainedIntra = 0;<br>
</span>@@ -348,6 +348,7 @@<br>
<span class="">             param->subpelRefine = 3;<br>
             param->maxNumMergeCand = 3;<br>
             param->searchMethod = X265_STAR_SEARCH;<br>
+            param->lookaheadSlices = 4; // limit parallelism as already enough work exists<br>
         }<br>
         else if (!strcmp(preset, "slower"))<br>
         {<br>
</span>@@ -365,6 +366,7 @@<br>
<span class="">             param->maxNumMergeCand = 3;<br>
             param->searchMethod = X265_STAR_SEARCH;<br>
             param->bIntraInBFrames = 1;<br>
+            param->lookaheadSlices = 4; // limit parallelism as already enough work exists<br>
         }<br>
         else if (!strcmp(preset, "veryslow"))<br>
         {<br>
</span>@@ -383,6 +385,7 @@<br>
<span class="">             param->searchMethod = X265_STAR_SEARCH;<br>
             param->maxNumReferences = 5;<br>
             param->bIntraInBFrames = 1;<br>
+            param->lookaheadSlices = 0; // disabled for best quality<br>
         }<br>
         else if (!strcmp(preset, "placebo"))<br>
         {<br>
</span>@@ -404,6 +407,7 @@<br>
<span class="im HOEnZb">             param->maxNumReferences = 5;<br>
             param->rc.bEnableSlowFirstPass = 1;<br>
             param->bIntraInBFrames = 1;<br>
+            param->lookaheadSlices = 0; // disabled for best quality<br>
             // TODO: optimized esa<br>
         }<br>
         else<br>
</span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div>Deepthi Nandakumar<br></div>Engineering Manager, x265<br></div>Multicoreware, Inc<br></div></div>
</div></div>