[x265] [PATCH] level: choose high tier only if the determined level is greater than or equal to

deepthi at multicorewareinc.com deepthi at multicorewareinc.com
Tue Feb 3 07:37:21 CET 2015


# HG changeset patch
# User Deepthi Nandakumar <deepthi at multicorewareinc.com>
# Date 1422945368 -19800
#      Tue Feb 03 12:06:08 2015 +0530
# Node ID 074d313dfc12b64c6b3d366c0b02ba08ef2143cc
# Parent  4583eda4cf55e9a7f5c11d1ea660367f3822af53
level: choose high tier only if the determined level is greater than or equal to
levelIdc.

diff -r 4583eda4cf55 -r 074d313dfc12 source/encoder/level.cpp
--- a/source/encoder/level.cpp	Mon Feb 02 17:03:40 2015 +0530
+++ b/source/encoder/level.cpp	Tue Feb 03 12:06:08 2015 +0530
@@ -154,20 +154,26 @@
             return;
         }
 
-        vps.ptl.levelIdc = levels[i].levelEnum;
-        vps.ptl.minCrForLevel = levels[i].minCompressionRatio;
-        vps.ptl.maxLumaSrForLevel = levels[i].maxLumaSamplesPerSecond;
-
 #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;
+        {
+            /* If the user has not enabled high tier, continue looking to see if we can encode at a higher level, main tier */
+            if (!param.bHighTier && (levels[i].levelIdc < param.levelIdc))
+                continue;
+            else
+                vps.ptl.tierFlag = Level::HIGH;
+        }
         else
             vps.ptl.tierFlag = Level::MAIN;
         break;
 #undef CHECK_RANGE
+
+        vps.ptl.levelIdc = levels[i].levelEnum;
+        vps.ptl.minCrForLevel = levels[i].minCompressionRatio;
+        vps.ptl.maxLumaSrForLevel = levels[i].maxLumaSamplesPerSecond;
     }
 
     vps.ptl.intraConstraintFlag = false;


More information about the x265-devel mailing list