[x265] [PATCH] Removed maxCUDepth parameter from CLI option

sumalatha at multicorewareinc.com sumalatha at multicorewareinc.com
Fri Jun 28 09:28:01 CEST 2013


# HG changeset patch
# User sumalatha
# Date 1372404465 -19800
# Node ID 210e2d49eb7ea18eba286ce83c1d0c22a11d8bb3
# Parent  f2cf6222811960215ddd67a1b3789613fff5d180
Removed maxCUDepth parameter from CLI option

diff -r f2cf62228119 -r 210e2d49eb7e source/common/common.cpp
--- a/source/common/common.cpp	Fri Jun 28 12:18:48 2013 +0530
+++ b/source/common/common.cpp	Fri Jun 28 12:57:45 2013 +0530
@@ -39,7 +39,7 @@
 #include <sys/time.h>
 #endif
 #include <time.h>
-#include <cmath>
+
 
 #if HIGH_BIT_DEPTH
 const int x265_bit_depth = 10;
@@ -152,13 +152,14 @@
     return 1;
 }
 
-uint32_t getMaxCuDepth(uint32_t maxCuSize)
+static inline uint32_t getMaxCuDepth(uint32_t maxCuSize)
 {   
-    return (uint32_t)(log10(maxCuSize)/log10(2)) - 2;
+    return (uint32_t)(log(maxCuSize)/log(2)) - 2;
 }
 
 int x265_check_params(x265_param_t *param)
 {
+    uint32_t maxCUDepth = getMaxCuDepth(param->maxCUSize);
 #define CONFIRM(expr, msg) check_failed |= _confirm(param, expr, msg)
     int check_failed = 0; /* abort if there is a fatal configuration problem */
 
@@ -182,7 +183,7 @@
             "Search Range must be more than 0");
     CONFIRM(param->keyframeInterval < -1,
             "Keyframe interval must be -1 (open-GOP) 0 (auto) 1 (intra-only) or greater than 1");
-    CONFIRM(param->maxCUdQPDepth > getMaxCuDepth(param->maxCUSize) - 1,
+    CONFIRM(param->maxCUdQPDepth > maxCUDepth - 1,
             "Absolute depth for a minimum CuDQP exceeds maximum coding unit depth");
 
     CONFIRM(param->cbQpOffset < -12, "Min. Chroma Cb QP Offset is -12");
@@ -194,9 +195,9 @@
             "QP Adaptation Range must be more than 0");
     CONFIRM(param->maxCUSize < 16,
             "Maximum partition width size should be larger than or equal to 16");
-    CONFIRM((param->sourceWidth  % (param->maxCUSize >> (getMaxCuDepth(param->maxCUSize) - 1))) != 0,
+    CONFIRM((param->sourceWidth  % (param->maxCUSize >> (maxCUDepth - 1))) != 0,
             "Resulting coded frame width must be a multiple of the minimum CU size");
-    CONFIRM((param->sourceHeight % (param->maxCUSize >> (getMaxCuDepth(param->maxCUSize) - 1))) != 0,
+    CONFIRM((param->sourceHeight % (param->maxCUSize >> (maxCUDepth - 1))) != 0,
             "Resulting coded frame height must be a multiple of the minimum CU size");
 
     CONFIRM(param->tuQTMinLog2Size < 2,
@@ -208,13 +209,13 @@
 
     CONFIRM(param->tuQTMaxLog2Size < param->tuQTMinLog2Size,
             "QuadtreeTULog2MaxSize must be greater than or equal to m_uiQuadtreeTULog2MinSize.");
-    CONFIRM((1u << param->tuQTMinLog2Size) > (param->maxCUSize >> (getMaxCuDepth(param->maxCUSize) - 1)),
+    CONFIRM((1u << param->tuQTMinLog2Size) > (param->maxCUSize >> (maxCUDepth - 1)),
             "QuadtreeTULog2MinSize must not be greater than minimum CU size"); // HS
-    CONFIRM((1u << param->tuQTMinLog2Size) > (param->maxCUSize >> (getMaxCuDepth(param->maxCUSize) - 1)),
+    CONFIRM((1u << param->tuQTMinLog2Size) > (param->maxCUSize >> (maxCUDepth - 1)),
             "QuadtreeTULog2MinSize must not be greater than minimum CU size"); // HS
-    CONFIRM((1u << param->tuQTMinLog2Size) > (param->maxCUSize >> getMaxCuDepth(param->maxCUSize)),
+    CONFIRM((1u << param->tuQTMinLog2Size) > (param->maxCUSize >> maxCUDepth),
             "Minimum CU width must be greater than minimum transform size.");
-    CONFIRM((1u << param->tuQTMinLog2Size) > (param->maxCUSize >> getMaxCuDepth(param->maxCUSize)),
+    CONFIRM((1u << param->tuQTMinLog2Size) > (param->maxCUSize >> maxCUDepth),
             "Minimum CU height must be greater than minimum transform size.");
     CONFIRM(param->tuQTMaxInterDepth < 1,
             "QuadtreeTUMaxDepthInter must be greater than or equal to 1");
@@ -261,21 +262,22 @@
 
 void x265_set_globals(x265_param_t *param, uint32_t inputBitDepth)
 {
+    uint32_t maxCUDepth = getMaxCuDepth(param->maxCUSize);
     // set max CU width & height
     g_uiMaxCUWidth  = param->maxCUSize;
     g_uiMaxCUHeight = param->maxCUSize;
 
     // compute actual CU depth with respect to config depth and max transform size
     g_uiAddCUDepth  = 0;
-    while ((param->maxCUSize >> getMaxCuDepth(param->maxCUSize)) > (1u << (param->tuQTMinLog2Size + g_uiAddCUDepth)))
+    while ((param->maxCUSize >> maxCUDepth) > (1u << (param->tuQTMinLog2Size + g_uiAddCUDepth)))
     {
         g_uiAddCUDepth++;
     }
 
-    uint32_t cuDepth  = getMaxCuDepth(param->maxCUSize);
-    cuDepth += g_uiAddCUDepth;
+    
+    maxCUDepth += g_uiAddCUDepth;
     g_uiAddCUDepth++;
-    g_uiMaxCUDepth = cuDepth;
+    g_uiMaxCUDepth = maxCUDepth;
 
     // set internal bit-depth and constants
 #if HIGH_BIT_DEPTH
@@ -297,7 +299,7 @@
 #if HIGH_BIT_DEPTH
     x265_log(param, X265_LOG_INFO, "Internal bit depth           : %d\n", param->internalBitDepth);
 #endif
-    x265_log(param, X265_LOG_INFO, "CU size                      : %d / %d\n", param->maxCUSize);
+    x265_log(param, X265_LOG_INFO, "CU size                      : %d \n", param->maxCUSize);
     x265_log(param, X265_LOG_INFO, "RQT trans. size (min / max)  : %d / %d\n", 1 << param->tuQTMinLog2Size, 1 << param->tuQTMaxLog2Size);
     x265_log(param, X265_LOG_INFO, "Max RQT depth inter / intra  : %d / %d\n", param->tuQTMaxInterDepth, param->tuQTMaxIntraDepth);
 
diff -r f2cf62228119 -r 210e2d49eb7e source/common/common.h
--- a/source/common/common.h	Fri Jun 28 12:18:48 2013 +0530
+++ b/source/common/common.h	Fri Jun 28 12:57:45 2013 +0530
@@ -113,13 +113,13 @@
 #endif // if ENABLE_CYCLE_COUNTERS
 
 /* defined in common.cpp */
+
 void x265_log(x265_param_t *param, int level, const char *fmt, ...);
 int  x265_check_params(x265_param_t *param);
 void x265_print_params(x265_param_t *param);
 void x265_set_globals(x265_param_t *param, uint32_t inputBitDepth);
 int64_t x265_mdate(void);
 int dumpBuffer(void * pbuf, size_t bufsize, const char * filename);
-uint32_t getMaxCuDepth(uint32_t maxCuSize);
 /* defined in primitives.cpp */
 void x265_setup_primitives(x265_param_t *param, int cpuid = 0);
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: June_28_sumalatha.patch
Type: text/x-patch
Size: 6016 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20130628/d3a1df57/attachment.bin>


More information about the x265-devel mailing list