[x265] nextState table

Satoshi Nakagawa nakagawa424 at oki.com
Tue Feb 18 09:09:43 CET 2014


# HG changeset patch
# User Satoshi Nakagawa <nakagawa424 at oki.com>
# Date 1392710845 -32400
#      Tue Feb 18 17:07:25 2014 +0900
# Node ID d0e59351624e8487780db32247be34e4a2cc5984
# Parent  8571d160aedb00e07a3f47016f04d8d9aeaa5856
nextState table

diff -r 8571d160aedb -r d0e59351624e source/Lib/TLibCommon/ContextTables.h
--- a/source/Lib/TLibCommon/ContextTables.h	Tue Feb 18 01:43:42 2014 -0600
+++ b/source/Lib/TLibCommon/ContextTables.h	Tue Feb 18 17:07:25 2014 +0900
@@ -136,17 +136,12 @@
     uint8_t bBinsCoded;
 } ContextModel;
 
-extern const uint8_t g_nextStateMPS[128];
-extern const uint8_t g_nextStateLPS[128];
 extern const int     g_entropyBits[128];
-extern       uint8_t g_nextState[128][2];
-void buildNextStateTable();
+extern const uint8_t g_nextState[128][2];
 uint8_t sbacInit(int qp, int initValue);   ///< initialize state with initial probability
 
 #define sbacGetMps(S)               ((S) & 1)
 #define sbacGetState(S)             ((S) >> 1)
-#define sbacNextLPS(S)              (g_nextStateLPS[(S)])
-#define sbacNextMPS(S)              (g_nextStateMPS[(S)])
 #define sbacNext(S, V)              (g_nextState[(S)][(V)])
 #define sbacGetEntropyBits(S, V)    (g_entropyBits[(S) ^ (V)])
 #define sbacGetEntropyBitsTrm(V)    (g_entropyBits[126 ^ (V)])
diff -r 8571d160aedb -r d0e59351624e source/Lib/TLibEncoder/TEncSbac.cpp
--- a/source/Lib/TLibEncoder/TEncSbac.cpp	Tue Feb 18 01:43:42 2014 -0600
+++ b/source/Lib/TLibEncoder/TEncSbac.cpp	Tue Feb 18 17:07:25 2014 +0900
@@ -74,43 +74,26 @@
     0x0050c, 0x29bab, 0x004c1, 0x2a674, 0x004a7, 0x2aa5e, 0x0046f, 0x2b32f, 0x0041f, 0x2c0ad, 0x003e7, 0x2ca8d, 0x003ba, 0x2d323, 0x0010c, 0x3bfbb
 };
 
-const uint8_t g_nextStateMPS[128] =
+const uint8_t g_nextState[128][2] =
 {
-    2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
-    18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
-    34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
-    50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
-    66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
-    82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
-    98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
-    114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 124, 125, 126, 127
+    { 2, 1 }, { 0, 3 }, { 4, 0 }, { 1, 5 }, { 6, 2 }, { 3, 7 }, { 8, 4 }, { 5, 9 },
+    { 10, 4 }, { 5, 11 }, { 12, 8 }, { 9, 13 }, { 14, 8 }, { 9, 15 }, { 16, 10 }, { 11, 17 },
+    { 18, 12 }, { 13, 19 }, { 20, 14 }, { 15, 21 }, { 22, 16 }, { 17, 23 }, { 24, 18 }, { 19, 25 },
+    { 26, 18 }, { 19, 27 }, { 28, 22 }, { 23, 29 }, { 30, 22 }, { 23, 31 }, { 32, 24 }, { 25, 33 },
+    { 34, 26 }, { 27, 35 }, { 36, 26 }, { 27, 37 }, { 38, 30 }, { 31, 39 }, { 40, 30 }, { 31, 41 },
+    { 42, 32 }, { 33, 43 }, { 44, 32 }, { 33, 45 }, { 46, 36 }, { 37, 47 }, { 48, 36 }, { 37, 49 },
+    { 50, 38 }, { 39, 51 }, { 52, 38 }, { 39, 53 }, { 54, 42 }, { 43, 55 }, { 56, 42 }, { 43, 57 },
+    { 58, 44 }, { 45, 59 }, { 60, 44 }, { 45, 61 }, { 62, 46 }, { 47, 63 }, { 64, 48 }, { 49, 65 },
+    { 66, 48 }, { 49, 67 }, { 68, 50 }, { 51, 69 }, { 70, 52 }, { 53, 71 }, { 72, 52 }, { 53, 73 },
+    { 74, 54 }, { 55, 75 }, { 76, 54 }, { 55, 77 }, { 78, 56 }, { 57, 79 }, { 80, 58 }, { 59, 81 },
+    { 82, 58 }, { 59, 83 }, { 84, 60 }, { 61, 85 }, { 86, 60 }, { 61, 87 }, { 88, 60 }, { 61, 89 },
+    { 90, 62 }, { 63, 91 }, { 92, 64 }, { 65, 93 }, { 94, 64 }, { 65, 95 }, { 96, 66 }, { 67, 97 },
+    { 98, 66 }, { 67, 99 }, { 100, 66 }, { 67, 101 }, { 102, 68 }, { 69, 103 }, { 104, 68 }, { 69, 105 },
+    { 106, 70 }, { 71, 107 }, { 108, 70 }, { 71, 109 }, { 110, 70 }, { 71, 111 }, { 112, 72 }, { 73, 113 },
+    { 114, 72 }, { 73, 115 }, { 116, 72 }, { 73, 117 }, { 118, 74 }, { 75, 119 }, { 120, 74 }, { 75, 121 },
+    { 122, 74 }, { 75, 123 }, { 124, 76 }, { 77, 125 }, { 124, 76 }, { 77, 125 }, { 126, 126 }, { 127, 127 }
 };
 
-const uint8_t g_nextStateLPS[128] =
-{
-    1, 0, 0, 1, 2, 3, 4, 5, 4, 5, 8, 9, 8, 9, 10, 11,
-    12, 13, 14, 15, 16, 17, 18, 19, 18, 19, 22, 23, 22, 23, 24, 25,
-    26, 27, 26, 27, 30, 31, 30, 31, 32, 33, 32, 33, 36, 37, 36, 37,
-    38, 39, 38, 39, 42, 43, 42, 43, 44, 45, 44, 45, 46, 47, 48, 49,
-    48, 49, 50, 51, 52, 53, 52, 53, 54, 55, 54, 55, 56, 57, 58, 59,
-    58, 59, 60, 61, 60, 61, 60, 61, 62, 63, 64, 65, 64, 65, 66, 67,
-    66, 67, 66, 67, 68, 69, 68, 69, 70, 71, 70, 71, 70, 71, 72, 73,
-    72, 73, 72, 73, 74, 75, 74, 75, 74, 75, 76, 77, 76, 77, 126, 127
-};
-
-UChar g_nextState[128][2];
-
-void buildNextStateTable()
-{
-    for (int i = 0; i < 128; i++)
-    {
-        for (int j = 0; j < 2; j++)
-        {
-            g_nextState[i][j] = ((i & 1) == j) ? g_nextStateMPS[i] : g_nextStateLPS[i];
-        }
-    }
-}
-
 /**
  - initialize context model with respect to QP and initialization value
  .
diff -r 8571d160aedb -r d0e59351624e source/common/primitives.cpp
--- a/source/common/primitives.cpp	Tue Feb 18 01:43:42 2014 -0600
+++ b/source/common/primitives.cpp	Tue Feb 18 17:07:25 2014 +0900
@@ -83,7 +83,6 @@
 {
     // initialize global variables
     initROM();
-    buildNextStateTable();
 
     if (cpuid < 0)
     {


More information about the x265-devel mailing list