[x265] [PATCH] level: in CRF/CQP encodes, allow user specifed level to increase stream level

Steve Borho steve at borho.org
Fri Jul 11 21:02:21 CEST 2014


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1405105325 18000
#      Fri Jul 11 14:02:05 2014 -0500
# Node ID 474c45db6a2ce6f15a6598f7662f2324ba842664
# Parent  29ae3f84c3eaa36ecb2669b380e7f31824e802fe
level: in CRF/CQP encodes, allow user specifed level to increase stream level

See the comment

diff -r 29ae3f84c3ea -r 474c45db6a2c source/encoder/level.cpp
--- a/source/encoder/level.cpp	Fri Jul 11 15:25:10 2014 +0530
+++ b/source/encoder/level.cpp	Fri Jul 11 14:02:05 2014 -0500
@@ -93,7 +93,8 @@
     tier = Level::MAIN;
     const char *levelName = "(none)";
 
-    for (int i = 1; levels[i].maxLumaSamples; i++)
+    int i;
+    for (i = 1; levels[i].maxLumaSamples; i++)
     {
         if (lumaSamples > levels[i].maxLumaSamples)
             continue;
@@ -134,6 +135,17 @@
         break;
     }
 
+    /* if the user supplied no bitrate, but supplied a level which is higher
+     * than the current detected level, assume the user knows that the bitrate
+     * will be high and use their specified level */
+    if (!param.rc.bitrate && levels[i].levelIdc < param.levelIdc)
+    {
+        while (levels[i].levelIdc < param.levelIdc && levels[i].levelIdc)
+            i++;
+        levelName = levels[i].name;
+        level = levels[i].levelEnum;
+    }
+
     static const char *profiles[] = { "None", "Main", "Main10", "Mainstillpicture" };
     static const char *tiers[]    = { "Main", "High" };
     x265_log(&param, X265_LOG_INFO, "%s profile, Level-%s (%s tier)\n", profiles[profile], levelName, tiers[tier]);


More information about the x265-devel mailing list