[x265] [PATCH 7 of 7] remove global declarations and initialization function

kavitha at multicorewareinc.com kavitha at multicorewareinc.com
Wed Jun 21 08:44:57 CEST 2017


# HG changeset patch
# User Kavitha Sampath <kavitha at multicorewareinc.com>
# Date 1496135977 -19800
#      Tue May 30 14:49:37 2017 +0530
# Node ID a015be4021f3de8ee265cded1eb7c476dedf3f36
# Parent  5d640864e3aee0a5e091fa1d1df377e620f7d1ce
remove global declarations and initialization function

diff -r 5d640864e3ae -r a015be4021f3 source/common/common.h
--- a/source/common/common.h	Mon Jun 12 17:24:55 2017 +0530
+++ b/source/common/common.h	Tue May 30 14:49:37 2017 +0530
@@ -259,7 +259,6 @@
 #define LOG2_RASTER_SIZE        (MAX_LOG2_CU_SIZE - LOG2_UNIT_SIZE)
 #define RASTER_SIZE             (1 << LOG2_RASTER_SIZE)
 #define MAX_NUM_PARTITIONS      (RASTER_SIZE * RASTER_SIZE)
-#define NUM_4x4_PARTITIONS      (1U << (g_unitSizeDepth << 1)) // number of 4x4 units in max CU size
 
 #define MIN_PU_SIZE             4
 #define MIN_TU_SIZE             4
diff -r 5d640864e3ae -r a015be4021f3 source/common/constants.cpp
--- a/source/common/constants.cpp	Mon Jun 12 17:24:55 2017 +0530
+++ b/source/common/constants.cpp	Tue May 30 14:49:37 2017 +0530
@@ -161,7 +161,6 @@
     65535
 };
 
-int      g_ctuSizeConfigured = 0;
 uint32_t g_maxLog2CUSize = MAX_LOG2_CU_SIZE;
 uint32_t g_maxCUSize     = MAX_CU_SIZE;
 uint32_t g_unitSizeDepth = NUM_CU_DEPTH;
diff -r 5d640864e3ae -r a015be4021f3 source/common/constants.h
--- a/source/common/constants.h	Mon Jun 12 17:24:55 2017 +0530
+++ b/source/common/constants.h	Tue May 30 14:49:37 2017 +0530
@@ -30,8 +30,6 @@
 namespace X265_NS {
 // private namespace
 
-extern int g_ctuSizeConfigured;
-
 extern double x265_lambda_tab[QP_MAX_MAX + 1];
 extern double x265_lambda2_tab[QP_MAX_MAX + 1];
 extern const uint16_t x265_chroma_lambda2_offset_tab[MAX_CHROMA_LAMBDA_OFFSET + 1];
diff -r 5d640864e3ae -r a015be4021f3 source/common/cudata.cpp
--- a/source/common/cudata.cpp	Mon Jun 12 17:24:55 2017 +0530
+++ b/source/common/cudata.cpp	Tue May 30 14:49:37 2017 +0530
@@ -111,9 +111,6 @@
 
 }
 
-cubcast_t CUData::s_partSet[NUM_FULL_DEPTH] = { NULL, NULL, NULL, NULL, NULL };
-uint32_t CUData::s_numPartInCUSize;
-
 CUData::CUData()
 {
     memset(this, 0, sizeof(*this));
diff -r 5d640864e3ae -r a015be4021f3 source/common/cudata.h
--- a/source/common/cudata.h	Mon Jun 12 17:24:55 2017 +0530
+++ b/source/common/cudata.h	Tue May 30 14:49:37 2017 +0530
@@ -161,8 +161,8 @@
 {
 public:
 
-    static cubcast_t s_partSet[NUM_FULL_DEPTH]; // pointer to broadcast set functions per absolute depth
-    static uint32_t  s_numPartInCUSize;
+    cubcast_t s_partSet[NUM_FULL_DEPTH]; // pointer to broadcast set functions per absolute depth
+    uint32_t  s_numPartInCUSize;
 
     bool          m_vbvAffected;
 
diff -r 5d640864e3ae -r a015be4021f3 source/common/param.cpp
--- a/source/common/param.cpp	Mon Jun 12 17:24:55 2017 +0530
+++ b/source/common/param.cpp	Tue May 30 14:49:37 2017 +0530
@@ -1339,42 +1339,6 @@
     }
 }
 
-int x265_set_globals(x265_param* param)
-{
-    uint32_t maxLog2CUSize = (uint32_t)g_log2Size[param->maxCUSize];
-    uint32_t minLog2CUSize = (uint32_t)g_log2Size[param->minCUSize];
-
-    Lock gLock;
-    ScopedLock sLock(gLock);
-
-    if (++g_ctuSizeConfigured > 1)
-    {
-        if (g_maxCUSize != param->maxCUSize)
-        {
-            x265_log(param, X265_LOG_WARNING, "maxCUSize must be the same for all encoders in a single process");
-        }
-        if (g_maxCUDepth != maxLog2CUSize - minLog2CUSize)
-        {
-            x265_log(param, X265_LOG_WARNING, "maxCUDepth must be the same for all encoders in a single process");
-        }
-        param->maxCUSize = g_maxCUSize;
-        return x265_check_params(param); /* Check again, since param may have changed */
-    }
-    else
-    {
-        // set max CU width & height
-        g_maxCUSize     = param->maxCUSize;
-        g_maxLog2CUSize = maxLog2CUSize;
-
-        // compute actual CU depth with respect to config depth and max transform size
-        g_maxCUDepth    = maxLog2CUSize - minLog2CUSize;
-        g_unitSizeDepth = maxLog2CUSize - LOG2_UNIT_SIZE;
-    }
-
-    g_maxSlices = param->maxSlices;
-    return 0;
-}
-
 static void appendtool(x265_param* param, char* buf, size_t size, const char* toolstr)
 {
     static const int overhead = (int)strlen("x265 [info]: tools: ");
diff -r 5d640864e3ae -r a015be4021f3 source/common/param.h
--- a/source/common/param.h	Mon Jun 12 17:24:55 2017 +0530
+++ b/source/common/param.h	Tue May 30 14:49:37 2017 +0530
@@ -28,7 +28,6 @@
 namespace X265_NS {
 
 int   x265_check_params(x265_param *param);
-int   x265_set_globals(x265_param *param);
 void  x265_print_params(x265_param *param);
 void  x265_param_apply_fastfirstpass(x265_param *p);
 char* x265_param2string(x265_param *param, int padx, int pady);
diff -r 5d640864e3ae -r a015be4021f3 source/encoder/api.cpp
--- a/source/encoder/api.cpp	Mon Jun 12 17:24:55 2017 +0530
+++ b/source/encoder/api.cpp	Tue May 30 14:49:37 2017 +0530
@@ -97,9 +97,6 @@
     if (x265_check_params(param))
         goto fail;
 
-    if (x265_set_globals(param))
-        goto fail;
-
     encoder = new Encoder;
     if (!param->rc.bEnableSlowFirstPass)
         PARAM_NS::x265_param_apply_fastfirstpass(param);
@@ -312,7 +309,6 @@
         encoder->printSummary();
         encoder->destroy();
         delete encoder;
-        ATOMIC_DEC(&g_ctuSizeConfigured);
     }
 }
 
@@ -336,11 +332,7 @@
 
 void x265_cleanup(void)
 {
-    if (!g_ctuSizeConfigured)
-    {
-        BitCost::destroy();
-        CUData::s_partSet[0] = NULL; /* allow CUData to adjust to new CTU size */
-    }
+    BitCost::destroy();
 }
 
 x265_picture *x265_picture_alloc()


More information about the x265-devel mailing list