[x265] [PATCH] Fix x265 SVT integration

Snehaa Giridharan snehaa at multicorewareinc.com
Fri Dec 27 09:32:36 CET 2019


# HG changeset patch
# User snehaa at multicorewareinc.com
# Date 1576060884 -19800
#      Wed Dec 11 16:11:24 2019 +0530
# Node ID 0e7ecd346c395e8f0f6c6f4f0b34bb22c675258a
# Parent  a4e060a4483913e28df2ce8b8549f3ba8b63ac5a
Fix x265 SVT integration

This patch does the following.
- Fix error for newly added param variables and other default variables
- Remove EbTime.h file as its no longer present in include directory of SVT
- Set SVT-HEVC lib version required to 1.4.1

diff -r a4e060a44839 -r 0e7ecd346c39 doc/reST/svthevc.rst
--- a/doc/reST/svthevc.rst Wed Sep 11 15:38:06 2019 +0530
+++ b/doc/reST/svthevc.rst Wed Dec 11 16:11:24 2019 +0530
@@ -12,6 +12,10 @@
 wont't be mapped to SVT-HEVC. This document describes the steps needed to
compile x265
 with SVT-HEVC and CLI options mapping between x265 and SVT-HEVC.

+Supported Version
+=================
+Version - 1.4.1
+
 Build Steps
 ===========
 This section describes the build steps to be followed to link SVT-HEVC
with x265.
@@ -109,7 +113,15 @@
 +-------------------------------------------+------------------------------+------------------------------+
 | :option:`--nalu-file`                     | NaluFile
| Any String                   |
 +-------------------------------------------+------------------------------+------------------------------+
-| :option:`--tune` zerolatency              | LatencyMode
 |                              |
+| :option:`--hrd`                           | hrdFlag
 | [0, 1]                       |
++-------------------------------------------+------------------------------+------------------------------+
+| :option:`--vbv-maxrate`                   | vbvMaxrate
| Any Positive Integer         |
++-------------------------------------------+------------------------------+------------------------------+
+| :option:`--vbv-bufsize`                   | vbvBufsize
| Any Positive Integer         |
++-------------------------------------------+------------------------------+------------------------------+
+| :option:`--vbv-init`                      | VbvBufInit
| [0 - 100]                    |
++-------------------------------------------+------------------------------+------------------------------+
+| :option:`--frame-threads`                 | ThreadCount
 | Any Number                   |
 +-------------------------------------------+------------------------------+------------------------------+
 | :option:`--svt-search-width`              | SearchAreaWidth
 | [1 - 256]                    |
 +-------------------------------------------+------------------------------+------------------------------+
diff -r a4e060a44839 -r 0e7ecd346c39 source/CMakeLists.txt
--- a/source/CMakeLists.txt Wed Sep 11 15:38:06 2019 +0530
+++ b/source/CMakeLists.txt Wed Dec 11 16:11:24 2019 +0530
@@ -573,7 +573,6 @@
 if(SVTHEVC_FOUND)
     install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbApi.h" DESTINATION include)
     install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbErrorCodes.h" DESTINATION
include)
-    install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbTime.h" DESTINATION include)
     install(FILES "${SVT_HEVC_LIBRARY}" DESTINATION ${BIN_INSTALL_DIR})
 endif()

diff -r a4e060a44839 -r 0e7ecd346c39 source/cmake/Findsvthevc.cmake
--- a/source/cmake/Findsvthevc.cmake Wed Sep 11 15:38:06 2019 +0530
+++ b/source/cmake/Findsvthevc.cmake Wed Dec 11 16:11:24 2019 +0530
@@ -15,34 +15,37 @@
 SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
 endif()

-set(SVT_VERSION_MAJOR_REQUIRED 1)
-set(SVT_VERSION_MINOR_REQUIRED 3)
-set(SVT_VERSION_PATCHLEVEL_REQUIRED 0)
+set(SVT_VERSION_MAJOR_REQUIRED       1)
+set(SVT_VERSION_MINOR_REQUIRED       4)
+set(SVT_VERSION_PATCHLEVEL_REQUIRED  1)

 find_path(SVT_HEVC_INCLUDE_DIR
-    NAMES EbApi.h EbErrorCodes.h EbTime.h
+    NAMES EbApiVersion.h EbErrorCodes.h
     HINTS $ENV{SVT_HEVC_INCLUDE_DIR}
     PATHS ENV
     DOC "SVT-HEVC include directory")

 if(SVT_HEVC_INCLUDE_DIR)
-file(READ "${SVT_HEVC_INCLUDE_DIR}/EbApi.h" version)
+    if(EXISTS "${SVT_HEVC_INCLUDE_DIR}/EbApiVersion.h")
+        file(READ "${SVT_HEVC_INCLUDE_DIR}/EbApiVersion.h" version)

-string(REGEX MATCH "SVT_VERSION_MAJOR       ([0-9]*)" _ ${version})
-set(SVT_VERSION_MAJOR ${CMAKE_MATCH_1})
+        string(REGEX MATCH "SVT_VERSION_MAJOR       \\(([0-9]*)\\)" _
${version})
+        set(SVT_VERSION_MAJOR ${CMAKE_MATCH_1})

-string(REGEX MATCH "SVT_VERSION_MINOR       ([0-9]*)" _ ${version})
-set(SVT_VERSION_MINOR ${CMAKE_MATCH_1})
+        string(REGEX MATCH "SVT_VERSION_MINOR       \\(([0-9]*)\\)" _
${version})
+        set(SVT_VERSION_MINOR ${CMAKE_MATCH_1})

-string(REGEX MATCH "SVT_VERSION_PATCHLEVEL  ([0-9]*)" _ ${version})
-set(SVT_VERSION_PATCHLEVEL ${CMAKE_MATCH_1})
+        string(REGEX MATCH "SVT_VERSION_PATCHLEVEL  \\(([0-9]*)\\)" _
${version})
+        set(SVT_VERSION_PATCHLEVEL ${CMAKE_MATCH_1})

-if(NOT ${SVT_VERSION_MAJOR} EQUAL "1" OR NOT ${SVT_VERSION_MINOR} EQUAL
"3" OR NOT ${SVT_VERSION_PATCHLEVEL} EQUAL "0")
-    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  ")
-else()
-    message(STATUS "-- Found SVT-HEVC Lib Version:
${SVT_VERSION_MAJOR}.${SVT_VERSION_MINOR}.${SVT_VERSION_PATCHLEVEL}")
-endif()
-
+        if(NOT ${SVT_VERSION_MAJOR} EQUAL "1" OR NOT ${SVT_VERSION_MINOR}
EQUAL "4" OR NOT ${SVT_VERSION_PATCHLEVEL} EQUAL "1")
+            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  ")
+        else()
+            message(STATUS "-- Found SVT-HEVC Lib Version:
${SVT_VERSION_MAJOR}.${SVT_VERSION_MINOR}.${SVT_VERSION_PATCHLEVEL}")
+        endif()
+    else()
+        message (SEND_ERROR "-- Required version of SVT-HEVC Lib:
${SVT_VERSION_MAJOR_REQUIRED}.${SVT_VERSION_MINOR_REQUIRED}.${SVT_VERSION_PATCHLEVEL_REQUIRED};
Aborting configure  ")
+    endif()
 endif()

 find_library(SVT_HEVC_LIBRARY
diff -r a4e060a44839 -r 0e7ecd346c39 source/common/param.cpp
--- a/source/common/param.cpp Wed Sep 11 15:38:06 2019 +0530
+++ b/source/common/param.cpp Wed Dec 11 16:11:24 2019 +0530
@@ -2553,8 +2553,8 @@
     svtHevcParam->latencyMode = 0;

     //Preset & Tune
-    svtHevcParam->encMode = 9;
-    svtHevcParam->tune = 0;
+    svtHevcParam->encMode = 7;
+    svtHevcParam->tune = 1;

     // Interlaced Video
     svtHevcParam->interlacedVideo = 0;
@@ -2594,10 +2594,10 @@
     svtHevcParam->targetBitRate = 7000000;
     svtHevcParam->maxQpAllowed = 48;
     svtHevcParam->minQpAllowed = 10;
-    svtHevcParam->bitRateReduction = 1;
+    svtHevcParam->bitRateReduction = 0;

     // Thresholds
-    svtHevcParam->improveSharpness = 1;
+    svtHevcParam->improveSharpness = 0;
     svtHevcParam->videoUsabilityInfo = 0;
     svtHevcParam->highDynamicRangeInput = 0;
     svtHevcParam->accessUnitDelimiter = 0;
@@ -2607,7 +2607,7 @@
     svtHevcParam->unregisteredUserDataSeiFlag = 0;
     svtHevcParam->recoveryPointSeiFlag = 0;
     svtHevcParam->enableTemporalId = 1;
-    svtHevcParam->profile = 2;
+    svtHevcParam->profile = 1;
     svtHevcParam->tier = 0;
     svtHevcParam->level = 0;

@@ -2638,6 +2638,13 @@
     svtHevcParam->tileRowCount = 1;
     svtHevcParam->tileSliceMode = 0;
     svtHevcParam->unrestrictedMotionVector = 1;
+    svtHevcParam->threadCount = 0;
+
+    // vbv
+    svtHevcParam->hrdFlag = 0;
+    svtHevcParam->vbvMaxrate = 0;
+    svtHevcParam->vbvBufsize = 0;
+    svtHevcParam->vbvBufInit = 90;
 }

 int svt_set_preset_tune(x265_param* param, const char* preset, const char*
tune)
@@ -2660,13 +2667,7 @@
     }
     if (tune)
     {
-        if (!strcmp(tune, "psnr")) svtHevcParam->tune = 1;
-        else if (!strcmp(tune, "ssim")) svtHevcParam->tune = 1;
-        else if (!strcmp(tune, "grain")) svtHevcParam->tune = 0;
-        else if (!strcmp(tune, "animation")) svtHevcParam->tune = 0;
-        else if (!strcmp(tune, "vmaf")) svtHevcParam->tune = 2;
-        else if (!strcmp(tune, "zero-latency") || !strcmp(tune,
"zerolatency")) svtHevcParam->latencyMode = 1;
-        else  return -1;
+        svtHevcParam->tune = 1;
     }
     return 0;
 }
@@ -2850,6 +2851,16 @@
         else
             bError = true;
     }
+    OPT("hrd")
+        svtHevcParam->hrdFlag = (uint32_t)x265_atobool(value, bError);
+    OPT("vbv-maxrate")
+        svtHevcParam->vbvMaxrate = (uint32_t)x265_atoi(value, bError);
+    OPT("vbv-bufsize")
+        svtHevcParam->vbvBufsize = (uint32_t)x265_atoi(value, bError);
+    OPT("vbv-init")
+        svtHevcParam->vbvBufInit = (uint64_t)x265_atof(value, bError);
+    OPT("frame-threads")
+        svtHevcParam->threadCount = (uint32_t)x265_atoi(value, bError);
     else
         x265_log(param, X265_LOG_INFO, "SVT doesn't support %s param;
Disabling it \n", name);

diff -r a4e060a44839 -r 0e7ecd346c39 source/encoder/svt.h
--- a/source/encoder/svt.h Wed Sep 11 15:38:06 2019 +0530
+++ b/source/encoder/svt.h Wed Dec 11 16:11:24 2019 +0530
@@ -29,7 +29,6 @@

 #include "EbApi.h"
 #include "EbErrorCodes.h"
-#include "EbTime.h"

 namespace X265_NS {

@@ -49,4 +48,4 @@

 #endif // ifdef SVT_HEVC

-#endif // ifndef SVT_H
\ No newline at end of file
+#endif // ifndef SVT_H


Thanks and Regards,
*Snehaa.G*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20191227/82999814/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Fix_x265_SVT_integration.patch
Type: application/octet-stream
Size: 9627 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20191227/82999814/attachment-0001.obj>


More information about the x265-devel mailing list