[x265] [PATCH] level: VBV buffer size needs to be checked before determining tier

deepthi at multicorewareinc.com deepthi at multicorewareinc.com
Tue Feb 3 05:52:20 CET 2015


# HG changeset patch
# User Deepthi Nandakumar <deepthi at multicorewareinc.com>
# Date 1422939128 -19800
#      Tue Feb 03 10:22:08 2015 +0530
# Node ID a56c2a3dfec0443b31b66a191df630464b067a8a
# Parent  f189b9328d93694e182356b18275d537c987b8bd
level: VBV buffer size needs to be checked before determining tier

Also, fix a typo in enforceLevel.

diff -r f189b9328d93 -r a56c2a3dfec0 source/encoder/level.cpp
--- a/source/encoder/level.cpp	Mon Feb 02 17:08:08 2015 -0600
+++ b/source/encoder/level.cpp	Tue Feb 03 10:22:08 2015 +0530
@@ -158,12 +158,16 @@
         vps.ptl.minCrForLevel = levels[i].minCompressionRatio;
         vps.ptl.maxLumaSrForLevel = levels[i].maxLumaSamplesPerSecond;
 
-        if (bitrate > levels[i].maxBitrateMain && bitrate <= levels[i].maxBitrateHigh &&
+#define CHECK_RANGE(value, main, high) (value > main && value <= high)
+
+        if (CHECK_RANGE(bitrate, levels[i].maxBitrateMain, levels[i].maxBitrateHigh) &&
+            CHECK_RANGE((uint32_t)param.rc.vbvBufferSize, levels[i].maxCpbSizeMain, levels[i].maxCpbSizeHigh) &&
             levels[i].maxBitrateHigh != MAX_UINT)
             vps.ptl.tierFlag = Level::HIGH;
         else
             vps.ptl.tierFlag = Level::MAIN;
         break;
+#undef CHECK_RANGE
     }
 
     vps.ptl.intraConstraintFlag = false;
@@ -250,7 +254,7 @@
     }
     if ((uint32_t)param.rc.vbvBufferSize > (highTier ? l.maxCpbSizeHigh : l.maxCpbSizeMain))
     {
-        param.rc.vbvMaxBitrate = highTier ? l.maxCpbSizeHigh : l.maxCpbSizeMain;
+        param.rc.vbvBufferSize = highTier ? l.maxCpbSizeHigh : l.maxCpbSizeMain;
         x265_log(&param, X265_LOG_INFO, "lowering VBV buffer size to %dKb\n", param.rc.vbvBufferSize);
     }
 


More information about the x265-devel mailing list