[x265] add static const for local tables

Satoshi Nakagawa nakagawa424 at oki.com
Fri Feb 7 01:44:02 CET 2014


# HG changeset patch
# User Satoshi Nakagawa <nakagawa424 at oki.com>
# Date 1391733642 -32400
#      Fri Feb 07 09:40:42 2014 +0900
# Node ID 0564ff2d14d17ec46ea27d5cb20a770c1b80144f
# Parent  40bec5582eca28ec0bc896e4e9412d580e42f4e4
add static const for local tables

diff -r 40bec5582eca -r 0564ff2d14d1 source/Lib/TLibCommon/TComDataCU.cpp
--- a/source/Lib/TLibCommon/TComDataCU.cpp	Thu Feb 06 12:09:28 2014 -0600
+++ b/source/Lib/TLibCommon/TComDataCU.cpp	Fri Feb 07 09:40:42 2014 +0900
@@ -2194,8 +2194,8 @@
     if (getSlice()->isInterB())
     {
         // TODO: TComRom??
-        uint32_t priorityList0[12] = { 0, 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3 };
-        uint32_t priorityList1[12] = { 1, 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2 };
+        static const uint32_t priorityList0[12] = { 0, 1, 0, 2, 1, 2, 0, 3, 1, 3, 2, 3 };
+        static const uint32_t priorityList1[12] = { 1, 0, 2, 0, 2, 1, 3, 0, 3, 1, 3, 2 };
 
         for (int idx = 0; idx < cutoff * (cutoff - 1) && arrayAddr != getSlice()->getMaxNumMergeCand(); idx++)
         {
diff -r 40bec5582eca -r 0564ff2d14d1 source/Lib/TLibCommon/TComTrQuant.cpp
--- a/source/Lib/TLibCommon/TComTrQuant.cpp	Thu Feb 06 12:09:28 2014 -0600
+++ b/source/Lib/TLibCommon/TComTrQuant.cpp	Fri Feb 07 09:40:42 2014 +0900
@@ -1068,7 +1068,7 @@
     int posYinSubset = posY & 3;
 
     // NOTE: [patternSigCtx][posXinSubset][posYinSubset]
-    static uint8_t table_cnt[4][4][4] =
+    static const uint8_t table_cnt[4][4][4] =
     {
         // patternSigCtx = 0
         {
diff -r 40bec5582eca -r 0564ff2d14d1 source/Lib/TLibEncoder/TEncSbac.cpp
--- a/source/Lib/TLibEncoder/TEncSbac.cpp	Thu Feb 06 12:09:28 2014 -0600
+++ b/source/Lib/TLibEncoder/TEncSbac.cpp	Fri Feb 07 09:40:42 2014 +0900
@@ -152,7 +152,7 @@
         tmpContextModel.m_state = sbacInit(qp, ctxModel[n]);
 
         // Map the 64 CABAC states to their corresponding probability values
-        static double aStateToProbLPS[] = { 0.50000000, 0.47460857, 0.45050660, 0.42762859, 0.40591239, 0.38529900, 0.36573242, 0.34715948, 0.32952974, 0.31279528, 0.29691064, 0.28183267, 0.26752040, 0.25393496, 0.24103941, 0.22879875, 0.21717969, 0.20615069, 0.19568177, 0.18574449, 0.17631186, 0.16735824, 0.15885931, 0.15079198, 0.14313433, 0.13586556, 0.12896592, 0.12241667, 0.11620000, 0.11029903, 0.10469773, 0.09938088, 0.09433404, 0.08954349, 0.08499621, 0.08067986, 0.07658271, 0.07269362, 0.06900203, 0.06549791, 0.06217174, 0.05901448, 0.05601756, 0.05317283, 0.05047256, 0.04790942, 0.04547644, 0.04316702, 0.04097487, 0.03889405, 0.03691890, 0.03504406, 0.03326442, 0.03157516, 0.02997168, 0.02844963, 0.02700488, 0.02563349, 0.02433175, 0.02309612, 0.02192323, 0.02080991, 0.01975312, 0.01875000 };
+        static const double aStateToProbLPS[] = { 0.50000000, 0.47460857, 0.45050660, 0.42762859, 0.40591239, 0.38529900, 0.36573242, 0.34715948, 0.32952974, 0.31279528, 0.29691064, 0.28183267, 0.26752040, 0.25393496, 0.24103941, 0.22879875, 0.21717969, 0.20615069, 0.19568177, 0.18574449, 0.17631186, 0.16735824, 0.15885931, 0.15079198, 0.14313433, 0.13586556, 0.12896592, 0.12241667, 0.11620000, 0.11029903, 0.10469773, 0.09938088, 0.09433404, 0.08954349, 0.08499621, 0.08067986, 0.07658271, 0.07269362, 0.06900203, 0.06549791, 0.06217174, 0.05901448, 0.05601756, 0.05317283, 0.05047256, 0.04790942, 0.04547644, 0.04316702, 0.04097487, 0.03889405, 0.03691890, 0.03504406, 0.03326442, 0.03157516, 0.02997168, 0.02844963, 0.02700488, 0.02563349, 0.02433175, 0.02309612, 0.02192323, 0.02080991, 0.01975312, 0.01875000 };
 
         double probLPS          = aStateToProbLPS[sbacGetState(contextModel[n].m_state)];
         double prob0, prob1;
diff -r 40bec5582eca -r 0564ff2d14d1 source/Lib/TLibEncoder/TEncSearch.cpp
--- a/source/Lib/TLibEncoder/TEncSearch.cpp	Thu Feb 06 12:09:28 2014 -0600
+++ b/source/Lib/TLibEncoder/TEncSearch.cpp	Fri Feb 07 09:40:42 2014 +0900
@@ -2906,7 +2906,7 @@
     }
     else if ((cuMode == SIZE_2NxN || cuMode == SIZE_2NxnU) || cuMode == SIZE_2NxnD)
     {
-        uint32_t aauiMbBits[2][3][3] = { { { 0, 0, 3 }, { 0, 0, 0 }, { 0, 0, 0 } }, { { 5, 7, 7 }, { 7, 5, 7 }, { 9 - 3, 9 - 3, 9 - 3 } } };
+        static const uint32_t aauiMbBits[2][3][3] = { { { 0, 0, 3 }, { 0, 0, 0 }, { 0, 0, 0 } }, { { 5, 7, 7 }, { 7, 5, 7 }, { 9 - 3, 9 - 3, 9 - 3 } } };
         if (bPSlice)
         {
             blockBit[0] = 3;
@@ -2920,7 +2920,7 @@
     }
     else if ((cuMode == SIZE_Nx2N || cuMode == SIZE_nLx2N) || cuMode == SIZE_nRx2N)
     {
-        uint32_t aauiMbBits[2][3][3] = { { { 0, 2, 3 }, { 0, 0, 0 }, { 0, 0, 0 } }, { { 5, 7, 7 }, { 7 - 2, 7 - 2, 9 - 2 }, { 9 - 3, 9 - 3, 9 - 3 } } };
+        static const uint32_t aauiMbBits[2][3][3] = { { { 0, 2, 3 }, { 0, 0, 0 }, { 0, 0, 0 } }, { { 5, 7, 7 }, { 7 - 2, 7 - 2, 9 - 2 }, { 9 - 3, 9 - 3, 9 - 3 } } };
         if (bPSlice)
         {
             blockBit[0] = 3;
diff -r 40bec5582eca -r 0564ff2d14d1 source/common/intrapred.cpp
--- a/source/common/intrapred.cpp	Thu Feb 06 12:09:28 2014 -0600
+++ b/source/common/intrapred.cpp	Fri Feb 07 09:40:42 2014 +0900
@@ -160,8 +160,8 @@
     int signAng        = intraPredAngle < 0 ? -1 : 1;
 
     // Set bitshifts and scale the angle parameter to block size
-    int angTable[9]    = { 0,    2,    5,   9,  13,  17,  21,  26,  32 };
-    int invAngTable[9] = { 0, 4096, 1638, 910, 630, 482, 390, 315, 256 }; // (256 * 32) / Angle
+    static const int angTable[9]    = { 0,    2,    5,   9,  13,  17,  21,  26,  32 };
+    static const int invAngTable[9] = { 0, 4096, 1638, 910, 630, 482, 390, 315, 256 }; // (256 * 32) / Angle
     int invAngle       = invAngTable[absAng];
 
     absAng             = angTable[absAng];
diff -r 40bec5582eca -r 0564ff2d14d1 source/common/vec/intra-ssse3.cpp
--- a/source/common/vec/intra-ssse3.cpp	Thu Feb 06 12:09:28 2014 -0600
+++ b/source/common/vec/intra-ssse3.cpp	Fri Feb 07 09:40:42 2014 +0900
@@ -190,8 +190,8 @@
     int signAng        = intraPredAngle < 0 ? -1 : 1;
 
     // Set bitshifts and scale the angle parameter to block size
-    int angTable[9]    = { 0,    2,    5,   9,  13,  17,  21,  26,  32 };
-    int invAngTable[9] = { 0, 4096, 1638, 910, 630, 482, 390, 315, 256 }; // (256 * 32) / Angle
+    static const int angTable[9]    = { 0,    2,    5,   9,  13,  17,  21,  26,  32 };
+    static const int invAngTable[9] = { 0, 4096, 1638, 910, 630, 482, 390, 315, 256 }; // (256 * 32) / Angle
     int invAngle       = invAngTable[absAng];
     absAng             = angTable[absAng];
     intraPredAngle     = signAng * absAng;
diff -r 40bec5582eca -r 0564ff2d14d1 source/encoder/compress.cpp
--- a/source/encoder/compress.cpp	Thu Feb 06 12:09:28 2014 -0600
+++ b/source/encoder/compress.cpp	Fri Feb 07 09:40:42 2014 +0900
@@ -418,7 +418,7 @@
                 earlyskip = (m_cfg->param.bEnableEarlySkip && m_bestMergeCU[depth]->isSkipped(0));
             else if (m_cfg->param.rdLevel == 1)
             {
-                uint32_t threshold[4] = { 20000, 6000, 1600, 500 };
+                static const uint32_t threshold[4] = { 20000, 6000, 1600, 500 };
                 int index = 4 - g_convertToBit[m_bestMergeCU[depth]->getWidth(0)];
                 if (m_bestMergeCU[depth]->m_totalDistortion < threshold[index])
                 {
@@ -435,7 +435,7 @@
             }
             else if (m_cfg->param.rdLevel == 0)
             {
-                uint32_t threshold[4] = { 20000, 6000, 1600, 500 };
+                static const uint32_t threshold[4] = { 20000, 6000, 1600, 500 };
                 int index = 4 - g_convertToBit[m_bestMergeCU[depth]->getWidth(0)];
                 if (m_bestMergeCU[depth]->m_totalDistortion < threshold[index])
                 {
@@ -521,7 +521,7 @@
                     }
                     else
                     {
-                        uint32_t threshold[4] = { 20000, 6000, 1600, 500 };
+                        static const uint32_t threshold[4] = { 20000, 6000, 1600, 500 };
                         int index = 4 - g_convertToBit[outBestCU->getWidth(0)];
                         bdoIntra = (outBestCU->m_totalDistortion > threshold[index]);
                     }


More information about the x265-devel mailing list