<div dir="ltr">Would it be possible to add CMAKE_INSTALL_INCLUDEDIR to the find_path hints so that 

SVT_HEVC_INCLUDE_DIR isn't always necessary if SVT-HEVC and x265 is going to be installed to the same root?<div><br></div><div>Also, would there be a way to mention SvtHevcEnc in the pkg-config file since when trying to link x265 with SVT-HEVC built to FFmpeg, FFmpeg will complain about x265 not being found from pkg-config.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Dec 30, 2019 at 10:55 PM Snehaa Giridharan <<a href="mailto:snehaa@multicorewareinc.com">snehaa@multicorewareinc.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"># HG changeset patch<br># User <a href="mailto:snehaa@multicorewareinc.com" target="_blank">snehaa@multicorewareinc.com</a><br># Date 1576060884 -19800<br>#      Wed Dec 11 16:11:24 2019 +0530<br># Node ID fad5b16ba443e113ce8c14840431eba50a14f332<br># Parent  a4e060a4483913e28df2ce8b8549f3ba8b63ac5a<br>Fix x265 SVT integration<br><br>This patch does the following.<br>- Fix error for newly added param variables and other default variables<br>- Remove EbTime.h file as its no longer present in include directory of SVT<br>- Set SVT-HEVC lib version required to 1.4.1<br>- Modify doc page<br><br>diff -r a4e060a44839 -r fad5b16ba443 doc/reST/cli.rst<br>--- a/doc/reST/cli.rst  Wed Sep 11 15:38:06 2019 +0530<br>+++ b/doc/reST/cli.rst  Wed Dec 11 16:11:24 2019 +0530<br>@@ -2541,12 +2541,12 @@<br> <br> .. option:: --svt-preset-tuner <integer><br> <br>-    SVT-HEVC exposes 13 presets. Presets [3-12] of SVT-HEVC is mapped to x265's<br>-    presets [placebo-ultrafast]. Ultrafast is mapped to preset(12) of SVT-HEVC,<br>-    superfast to preset(11), placebo to preset(3) and so on. svt-preset-tuner works<br>-    only on top of placebo preset and maps to presets (0-2) of SVT-HEVC.<br>-<br>-    Values: [0-2]<br>+    SVT-HEVC exposes 12 presets. Presets [2-11] of SVT-HEVC is mapped to x265's<br>+    presets [placebo-ultrafast]. Ultrafast is mapped to preset(11) of SVT-HEVC,<br>+    superfast to preset(10), placebo to preset(2) and so on. svt-preset-tuner works<br>+    only on top of placebo preset and maps to presets (0-1) of SVT-HEVC.<br>+<br>+    Values: [0-1]<br> <br>     **CLI_ONLY**<br> <br>diff -r a4e060a44839 -r fad5b16ba443 doc/reST/svthevc.rst<br>--- a/doc/reST/svthevc.rst      Wed Sep 11 15:38:06 2019 +0530<br>+++ b/doc/reST/svthevc.rst      Wed Dec 11 16:11:24 2019 +0530<br>@@ -12,6 +12,10 @@<br> wont't be mapped to SVT-HEVC. This document describes the steps needed to compile x265 <br> with SVT-HEVC and CLI options mapping between x265 and SVT-HEVC.<br> <br>+Supported Version<br>+=================<br>+Version - 1.4.1<br>+<br> Build Steps<br> ===========<br> This section describes the build steps to be followed to link SVT-HEVC with x265.<br>@@ -109,7 +113,15 @@<br> +-------------------------------------------+------------------------------+------------------------------+<br> | :option:`--nalu-file`                     | NaluFile                     | Any String                   |<br> +-------------------------------------------+------------------------------+------------------------------+<br>-| :option:`--tune` zerolatency              | LatencyMode                  |                              |<br>+| :option:`--hrd`                           | hrdFlag                      | [0, 1]                       |<br>++-------------------------------------------+------------------------------+------------------------------+<br>+| :option:`--vbv-maxrate`                   | vbvMaxrate                   | Any Positive Integer         |<br>++-------------------------------------------+------------------------------+------------------------------+<br>+| :option:`--vbv-bufsize`                   | vbvBufsize                   | Any Positive Integer         |<br>++-------------------------------------------+------------------------------+------------------------------+<br>+| :option:`--vbv-init`                      | VbvBufInit                   | [0 - 100]                    |<br>++-------------------------------------------+------------------------------+------------------------------+<br>+| :option:`--frame-threads`                 | ThreadCount                  | Any Number                   |<br> +-------------------------------------------+------------------------------+------------------------------+<br> | :option:`--svt-search-width`              | SearchAreaWidth              | [1 - 256]                    |<br> +-------------------------------------------+------------------------------+------------------------------+<br>@@ -139,64 +151,37 @@<br> fecilitate access to the features of SVT-HEVC which couldn't be mapped to the existing x265 CLI's. <br> So these options will have effect only if SVT-HEVC is enabled and would be ignored with default x265 encode.<br> <br>-Preset & Tune Options Mapping<br>+Preset Option Mapping<br> =============================<br>-x265 has 10 presets from ultrafast to placebo whereas SVT-HEVC has 13 presets. Use :option:`--svt-preset-tuner` <br>-with Placebo preset to access the additional 3 presets of SVT-HEVC. Note that :option:`--svt-preset-tuner` should be <br>+x265 has 10 presets from ultrafast to placebo whereas SVT-HEVC has 12 presets. Use :option:`--svt-preset-tuner` <br>+with Placebo preset to access the additional 2 presets of SVT-HEVC. Note that :option:`--svt-preset-tuner` should be <br> used only if SVT-HEVC is enabled and only with Placebo preset, would be ignored otherwise. <br> Below table shows the actual mapping of presets,<br> <br> +----------------------------------------+------------------------------+<br> | x265 Preset                            | SVT-HEVC Preset              |<br> +========================================+==============================+<br>-| Ultrafast                              | 12                           |<br>+| Ultrafast                              | 11                           |<br> +----------------------------------------+------------------------------+<br>-| Superfast                              | 11                           |<br>+| Superfast                              | 10                           |<br> +----------------------------------------+------------------------------+<br>-| Veryfast                               | 10                           |<br>+| Veryfast                               | 9                            |<br> +----------------------------------------+------------------------------+<br>-| Faster                                 | 9                            |<br>+| Faster                                 | 8                            |<br> +----------------------------------------+------------------------------+<br>-| Fast                                   | 8                            |<br>+| Fast                                   | 7                            |<br> +----------------------------------------+------------------------------+<br>-| Medium                                 | 7                            |<br>+| Medium                                 | 6                            |<br> +----------------------------------------+------------------------------+<br>-| Slow                                   | 6                            |<br>+| Slow                                   | 5                            |<br> +----------------------------------------+------------------------------+<br>-| Slower                                 | 5                            |<br>+| Slower                                 | 4                            |<br> +----------------------------------------+------------------------------+<br>-| Veryslow                               | 4                            |<br>+| Veryslow                               | 3                            |<br> +----------------------------------------+------------------------------+<br>-| Placebo                                | 3                            |<br>+| Placebo                                | 2                            |<br> +----------------------------------------+------------------------------+<br> | Placebo :option:`--svt-preset-tuner` 0 | 0                            |<br> +----------------------------------------+------------------------------+<br> | Placebo :option:`--svt-preset-tuner` 1 | 1                            |<br> +----------------------------------------+------------------------------+<br>-| Placebo :option:`--svt-preset-tuner` 2 | 2                            |<br>-+----------------------------------------+------------------------------+<br>-<br>-x265 has 5 tune modes (psnr, ssim, grain, zero-latency, animation) whereas SVT-HEVC<br>-has only 3 tune modes (0 - visual quality, 1 - PSNR / SSIM and 2 - VMAF). Below <br>-table shows the mapping of tune modes,<br>-<br>-+-----------------------+---------------------------+<br>-| x265 Tune Modes       | SVT-HEVC Tune Modes       |<br>-+=======================+===========================+<br>-| vmaf                  | 2                         |<br>-+-----------------------+---------------------------+<br>-| psnr                  | 1                         |<br>-+-----------------------+---------------------------+<br>-| ssim                  | 1                         |<br>-+-----------------------+---------------------------+<br>-| grain                 | 0                         |<br>-+-----------------------+---------------------------+<br>-| fastdecode            | 0                         |<br>-+-----------------------+---------------------------+<br>-| zerolatency           | 0                         |<br>-+-----------------------+---------------------------+<br>-| animation             | 0                         |<br>-+-----------------------+---------------------------+<br>-<br>-Note that : 1.option:`--tune` animation is also mapped to "LatencyMode" of SVT-HEVC.<br>-            2.option: '--tune' vmaf is not supported in x265, its under development.<br>diff -r a4e060a44839 -r fad5b16ba443 source/CMakeLists.txt<br>--- a/source/CMakeLists.txt Wed Sep 11 15:38:06 2019 +0530<br>+++ b/source/CMakeLists.txt     Wed Dec 11 16:11:24 2019 +0530<br>@@ -573,7 +573,6 @@<br> if(SVTHEVC_FOUND)<br>     install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbApi.h" DESTINATION include)<br>     install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbErrorCodes.h" DESTINATION include)<br>-    install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbTime.h" DESTINATION include)<br>     install(FILES "${SVT_HEVC_LIBRARY}" DESTINATION ${BIN_INSTALL_DIR})<br> endif()<br> <br>diff -r a4e060a44839 -r fad5b16ba443 source/cmake/Findsvthevc.cmake<br>--- a/source/cmake/Findsvthevc.cmake        Wed Sep 11 15:38:06 2019 +0530<br>+++ b/source/cmake/Findsvthevc.cmake    Wed Dec 11 16:11:24 2019 +0530<br>@@ -15,34 +15,37 @@<br> SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")<br> endif()<br> <br>-set(SVT_VERSION_MAJOR_REQUIRED 1)<br>-set(SVT_VERSION_MINOR_REQUIRED 3)<br>-set(SVT_VERSION_PATCHLEVEL_REQUIRED 0)<br>+set(SVT_VERSION_MAJOR_REQUIRED       1)<br>+set(SVT_VERSION_MINOR_REQUIRED       4)<br>+set(SVT_VERSION_PATCHLEVEL_REQUIRED  1)<br> <br> find_path(SVT_HEVC_INCLUDE_DIR<br>-    NAMES EbApi.h EbErrorCodes.h EbTime.h<br>+    NAMES EbApiVersion.h EbErrorCodes.h<br>     HINTS $ENV{SVT_HEVC_INCLUDE_DIR}<br>     PATHS ENV<br>     DOC "SVT-HEVC include directory")<br> <br> if(SVT_HEVC_INCLUDE_DIR)<br>-file(READ "${SVT_HEVC_INCLUDE_DIR}/EbApi.h" version)<br>+    if(EXISTS "${SVT_HEVC_INCLUDE_DIR}/EbApiVersion.h")<br>+        file(READ "${SVT_HEVC_INCLUDE_DIR}/EbApiVersion.h" version)<br> <br>-string(REGEX MATCH "SVT_VERSION_MAJOR       ([0-9]*)" _ ${version})<br>-set(SVT_VERSION_MAJOR ${CMAKE_MATCH_1})<br>+        string(REGEX MATCH "SVT_VERSION_MAJOR       \\(([0-9]*)\\)" _ ${version})<br>+        set(SVT_VERSION_MAJOR ${CMAKE_MATCH_1})<br> <br>-string(REGEX MATCH "SVT_VERSION_MINOR       ([0-9]*)" _ ${version})<br>-set(SVT_VERSION_MINOR ${CMAKE_MATCH_1})<br>+        string(REGEX MATCH "SVT_VERSION_MINOR       \\(([0-9]*)\\)" _ ${version})<br>+        set(SVT_VERSION_MINOR ${CMAKE_MATCH_1})<br> <br>-string(REGEX MATCH "SVT_VERSION_PATCHLEVEL  ([0-9]*)" _ ${version})<br>-set(SVT_VERSION_PATCHLEVEL ${CMAKE_MATCH_1})<br>+        string(REGEX MATCH "SVT_VERSION_PATCHLEVEL  \\(([0-9]*)\\)" _ ${version})<br>+        set(SVT_VERSION_PATCHLEVEL ${CMAKE_MATCH_1})<br> <br>-if(NOT ${SVT_VERSION_MAJOR} EQUAL "1" OR NOT ${SVT_VERSION_MINOR} EQUAL "3" OR NOT ${SVT_VERSION_PATCHLEVEL} EQUAL "0")<br>-    message (SEND_ERROR "-- Found SVT-HEVC Lib Version: ${SVT_VERSION_MAJOR}.${SVT_VERSION_MINOR}.${SVT_VERSION_PATCHLEVEL} which doesn't match the required version: ${SVT_VERSION_MAJOR_REQUIRED}.${SVT_VERSION_MINOR_REQUIRED}.${SVT_VERSION_PATCHLEVEL_REQUIRED}; Aborting configure  ")<br>-else()<br>-    message(STATUS "-- Found SVT-HEVC Lib Version: ${SVT_VERSION_MAJOR}.${SVT_VERSION_MINOR}.${SVT_VERSION_PATCHLEVEL}")<br>-endif()<br>-<br>+        if(NOT ${SVT_VERSION_MAJOR} EQUAL "1" OR NOT ${SVT_VERSION_MINOR} EQUAL "4" OR NOT ${SVT_VERSION_PATCHLEVEL} EQUAL "1")<br>+            message (SEND_ERROR "-- Found SVT-HEVC Lib Version: ${SVT_VERSION_MAJOR}.${SVT_VERSION_MINOR}.${SVT_VERSION_PATCHLEVEL} which doesn't match the required version: ${SVT_VERSION_MAJOR_REQUIRED}.${SVT_VERSION_MINOR_REQUIRED}.${SVT_VERSION_PATCHLEVEL_REQUIRED}; Aborting configure  ")<br>+        else()<br>+            message(STATUS "-- Found SVT-HEVC Lib Version: ${SVT_VERSION_MAJOR}.${SVT_VERSION_MINOR}.${SVT_VERSION_PATCHLEVEL}")<br>+        endif()<br>+    else()<br>+        message (SEND_ERROR "-- Required version of SVT-HEVC Lib: ${SVT_VERSION_MAJOR_REQUIRED}.${SVT_VERSION_MINOR_REQUIRED}.${SVT_VERSION_PATCHLEVEL_REQUIRED}; Aborting configure  ")<br>+    endif()<br> endif()<br> <br> find_library(SVT_HEVC_LIBRARY<br>diff -r a4e060a44839 -r fad5b16ba443 source/common/param.cpp<br>--- a/source/common/param.cpp       Wed Sep 11 15:38:06 2019 +0530<br>+++ b/source/common/param.cpp   Wed Dec 11 16:11:24 2019 +0530<br>@@ -2553,8 +2553,8 @@<br>     svtHevcParam->latencyMode = 0;<br> <br>     //Preset & Tune<br>-    svtHevcParam->encMode = 9;<br>-    svtHevcParam->tune = 0;<br>+    svtHevcParam->encMode = 7;<br>+    svtHevcParam->tune = 1;<br> <br>     // Interlaced Video <br>     svtHevcParam->interlacedVideo = 0;<br>@@ -2594,10 +2594,10 @@<br>     svtHevcParam->targetBitRate = 7000000;<br>     svtHevcParam->maxQpAllowed = 48;<br>     svtHevcParam->minQpAllowed = 10;<br>-    svtHevcParam->bitRateReduction = 1;<br>+    svtHevcParam->bitRateReduction = 0;<br> <br>     // Thresholds<br>-    svtHevcParam->improveSharpness = 1;<br>+    svtHevcParam->improveSharpness = 0;<br>     svtHevcParam->videoUsabilityInfo = 0;<br>     svtHevcParam->highDynamicRangeInput = 0;<br>     svtHevcParam->accessUnitDelimiter = 0;<br>@@ -2607,7 +2607,7 @@<br>     svtHevcParam->unregisteredUserDataSeiFlag = 0;<br>     svtHevcParam->recoveryPointSeiFlag = 0;<br>     svtHevcParam->enableTemporalId = 1;<br>-    svtHevcParam->profile = 2;<br>+    svtHevcParam->profile = 1;<br>     svtHevcParam->tier = 0;<br>     svtHevcParam->level = 0;<br> <br>@@ -2638,6 +2638,13 @@<br>     svtHevcParam->tileRowCount = 1;<br>     svtHevcParam->tileSliceMode = 0;<br>     svtHevcParam->unrestrictedMotionVector = 1;<br>+    svtHevcParam->threadCount = 0;<br>+<br>+    // vbv<br>+    svtHevcParam->hrdFlag = 0;<br>+    svtHevcParam->vbvMaxrate = 0;<br>+    svtHevcParam->vbvBufsize = 0;<br>+    svtHevcParam->vbvBufInit = 90;<br> }<br> <br> int svt_set_preset_tune(x265_param* param, const char* preset, const char* tune)<br>@@ -2646,27 +2653,21 @@<br>     <br>     if (preset)<br>     {<br>-        if (!strcmp(preset, "ultrafast")) svtHevcParam->encMode = 12;<br>-        else if (!strcmp(preset, "superfast")) svtHevcParam->encMode = 11;<br>-        else if (!strcmp(preset, "veryfast")) svtHevcParam->encMode = 10;<br>-        else if (!strcmp(preset, "faster")) svtHevcParam->encMode = 9;<br>-        else if (!strcmp(preset, "fast")) svtHevcParam->encMode = 8;<br>-        else if (!strcmp(preset, "medium")) svtHevcParam->encMode = 7;<br>-        else if (!strcmp(preset, "slow")) svtHevcParam->encMode = 6;<br>-        else if (!strcmp(preset, "slower")) svtHevcParam->encMode = 5;<br>-        else if (!strcmp(preset, "veryslow")) svtHevcParam->encMode = 4;<br>-        else if (!strcmp(preset, "placebo")) svtHevcParam->encMode = 3;<br>+        if (!strcmp(preset, "ultrafast")) svtHevcParam->encMode = 11;<br>+        else if (!strcmp(preset, "superfast")) svtHevcParam->encMode = 10;<br>+        else if (!strcmp(preset, "veryfast")) svtHevcParam->encMode = 9;<br>+        else if (!strcmp(preset, "faster")) svtHevcParam->encMode = 8;<br>+        else if (!strcmp(preset, "fast")) svtHevcParam->encMode = 7;<br>+        else if (!strcmp(preset, "medium")) svtHevcParam->encMode = 6;<br>+        else if (!strcmp(preset, "slow")) svtHevcParam->encMode = 5;<br>+        else if (!strcmp(preset, "slower")) svtHevcParam->encMode =4;<br>+        else if (!strcmp(preset, "veryslow")) svtHevcParam->encMode = 3;<br>+        else if (!strcmp(preset, "placebo")) svtHevcParam->encMode = 2;<br>         else  return -1;<br>     }<br>     if (tune)<br>     {<br>-        if (!strcmp(tune, "psnr")) svtHevcParam->tune = 1;<br>-        else if (!strcmp(tune, "ssim")) svtHevcParam->tune = 1;<br>-        else if (!strcmp(tune, "grain")) svtHevcParam->tune = 0;<br>-        else if (!strcmp(tune, "animation")) svtHevcParam->tune = 0;<br>-        else if (!strcmp(tune, "vmaf")) svtHevcParam->tune = 2;<br>-        else if (!strcmp(tune, "zero-latency") || !strcmp(tune, "zerolatency")) svtHevcParam->latencyMode = 1;<br>-        else  return -1;<br>+        svtHevcParam->tune = 1;<br>     }<br>     return 0;<br> }<br>@@ -2820,11 +2821,10 @@<br>     OPT("svt-speed-control") svtHevcParam->speedControlFlag = x265_atobool(value, bError);<br>     OPT("svt-preset-tuner")<br>     {<br>-        if (svtHevcParam->encMode == 3)<br>+        if (svtHevcParam->encMode == 2)<br>         {<br>             if (!strcmp(value, "0")) svtHevcParam->encMode = 0;<br>             else if (!strcmp(value, "1")) svtHevcParam->encMode = 1;<br>-            else if (!strcmp(value, "2")) svtHevcParam->encMode = 2;<br>             else<br>             {<br>                 x265_log(param, X265_LOG_ERROR, " Unsupported value=%s for svt-preset-tuner \n", value);<br>@@ -2850,6 +2850,16 @@<br>         else<br>             bError = true;<br>     }<br>+    OPT("hrd")<br>+        svtHevcParam->hrdFlag = (uint32_t)x265_atobool(value, bError);<br>+    OPT("vbv-maxrate")<br>+        svtHevcParam->vbvMaxrate = (uint32_t)x265_atoi(value, bError);<br>+    OPT("vbv-bufsize")<br>+        svtHevcParam->vbvBufsize = (uint32_t)x265_atoi(value, bError);<br>+    OPT("vbv-init")<br>+        svtHevcParam->vbvBufInit = (uint64_t)x265_atof(value, bError);<br>+    OPT("frame-threads")<br>+        svtHevcParam->threadCount = (uint32_t)x265_atoi(value, bError);<br>     else<br>         x265_log(param, X265_LOG_INFO, "SVT doesn't support %s param; Disabling it \n", name);<br> <br>diff -r a4e060a44839 -r fad5b16ba443 source/encoder/svt.h<br>--- a/source/encoder/svt.h   Wed Sep 11 15:38:06 2019 +0530<br>+++ b/source/encoder/svt.h      Wed Dec 11 16:11:24 2019 +0530<br>@@ -29,7 +29,6 @@<br> <br> #include "EbApi.h"<br> #include "EbErrorCodes.h"<br>-#include "EbTime.h"<br> <br> namespace X265_NS {<br> <br>@@ -49,4 +48,4 @@<br> <br> #endif // ifdef SVT_HEVC<br> <br>-#endif // ifndef SVT_H<br>\ No newline at end of file<br>+#endif // ifndef SVT_H<div><br></div><div><br><div><div dir="ltr"><div dir="ltr">Thanks and Regards,<br><b>Snehaa.G</b></div></div></div></div></div>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org" target="_blank">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>
</blockquote></div>