[x265] [PATCH] Add option to get global maxrate

Snehaa Giridharan snehaa at multicorewareinc.com
Wed Feb 19 10:58:02 CET 2020


# HG changeset patch
# User Snehaa Giridharan <snehaa at multicorewareinc.com>
# Date 1582105413 -19800
#      Wed Feb 19 15:13:33 2020 +0530
# Node ID 968e8839eade282f6cd687d43c18bb4ee512ee01
# Parent  495e78dfd32bcdeee0c48a8732eba135be12cb8e
Add option to get global maxrate

This global maxrate can be used for HRD signaling

diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -29,7 +29,7 @@
 option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)
 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
 # X265_BUILD must be incremented each time the public API is changed
-set(X265_BUILD 189)
+set(X265_BUILD 190)
 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
                "${PROJECT_BINARY_DIR}/x265.def")
 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
diff --git a/source/common/param.cpp b/source/common/param.cpp
--- a/source/common/param.cpp
+++ b/source/common/param.cpp
@@ -286,6 +286,7 @@
     param->rc.bEnableConstVbv = 0;
     param->bResetZoneConfig = 1;
     param->reconfigWindowSize = 0;
+    param->decoderVbvMaxRate = 0;

     /* Video Usability Information (VUI) */
     param->vui.aspectRatioIdc = 0;
@@ -2435,6 +2436,7 @@
     dst->rc.zonefileCount = src->rc.zonefileCount;
     dst->reconfigWindowSize = src->reconfigWindowSize;
     dst->bResetZoneConfig = src->bResetZoneConfig;
+    dst->decoderVbvMaxRate = src->decoderVbvMaxRate;

     if (src->rc.zonefileCount && src->rc.zones)
     {
diff --git a/source/encoder/ratecontrol.cpp b/source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp
+++ b/source/encoder/ratecontrol.cpp
@@ -335,7 +335,7 @@
         int vbvBufferSize = m_param->rc.vbvBufferSize * 1000;
         int vbvMaxBitrate = m_param->rc.vbvMaxBitrate * 1000;

-        if (m_param->bEmitHRDSEI)
+        if (m_param->bEmitHRDSEI && !m_param->decoderVbvMaxRate)
         {
             const HRDInfo* hrd = &sps.vuiParameters.hrdParameters;
             vbvBufferSize = hrd->cpbSizeValue << (hrd->cpbSizeScale +
CPB_SHIFT);
@@ -781,8 +781,10 @@
     // Init HRD
     HRDInfo* hrd = &sps.vuiParameters.hrdParameters;
     hrd->cbrFlag = m_isCbr;
-    if (m_param->reconfigWindowSize)
+    if (m_param->reconfigWindowSize) {
         hrd->cbrFlag = 0;
+        vbvMaxBitrate = m_param->decoderVbvMaxRate * 1000;
+    }

     // normalize HRD size and rate to the value / scale notation
     hrd->bitRateScale = x265_clip3(0, 15, calcScale(vbvMaxBitrate) -
BR_SHIFT);
diff --git a/source/x265.h b/source/x265.h
--- a/source/x265.h
+++ b/source/x265.h
@@ -1905,6 +1905,9 @@

     /* Edge variance threshold for quad tree establishment. */
     float    edgeVarThreshold;
+
+ /*Maxrate that could be signaled to the decoder. Default 0. API only. */
+ int         decoderVbvMaxRate;
 } x265_param;

 /* x265_param_alloc:

-- 
*Thanks and Regards,*
*Snehaa.G*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20200219/c47c07a6/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Add option to get global maxrate.diff
Type: application/octet-stream
Size: 2886 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20200219/c47c07a6/attachment.obj>


More information about the x265-devel mailing list