[x264-devel] cabac: Make the cabac_contexts array static

Henrik Gramner git at videolan.org
Mon Dec 25 20:39:38 CET 2017


x264 | branch: master | Henrik Gramner <henrik at gramner.com> | Sun Aug  6 17:17:55 2017 +0200| [d1eebb2927da15c41c7c180d398b0cdad3d1f396] | committer: Anton Mitrofanov

cabac: Make the cabac_contexts array static

Also drop the x264 prefix from all static cabac arrays.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=d1eebb2927da15c41c7c180d398b0cdad3d1f396
---

 common/cabac.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/common/cabac.c b/common/cabac.c
index 14db0cd3..0342ac5a 100644
--- a/common/cabac.c
+++ b/common/cabac.c
@@ -28,7 +28,7 @@
 #include "common.h"
 
 
-static const int8_t x264_cabac_context_init_I[1024][2] =
+static const int8_t cabac_context_init_I[1024][2] =
 {
     /* 0 - 10 */
     { 20, -15 }, {  2, 54 },  {  3,  74 }, { 20, -15 },
@@ -340,7 +340,7 @@ static const int8_t x264_cabac_context_init_I[1024][2] =
     {  -3,  70 }, {  -8,  93 }, { -10,  90 }, { -30, 127 }
 };
 
-static const int8_t x264_cabac_context_init_PB[3][1024][2] =
+static const int8_t cabac_context_init_PB[3][1024][2] =
 {
     /* i_cabac_init_idc == 0 */
     {
@@ -1325,30 +1325,27 @@ const uint16_t x264_cabac_entropy[128] =
     FIX8(0.9285), FIX8(1.0752), FIX8(1.0000), FIX8(1.0000)
 };
 
-uint8_t x264_cabac_contexts[4][QP_MAX_SPEC+1][1024];
+static uint8_t cabac_contexts[4][QP_MAX_SPEC+1][1024];
 
 void x264_cabac_init( x264_t *h )
 {
     int ctx_count = CHROMA444 ? 1024 : 460;
     for( int i = 0; i < 4; i++ )
     {
-        const int8_t (*cabac_context_init)[1024][2] = i == 0 ? &x264_cabac_context_init_I
-                                                             : &x264_cabac_context_init_PB[i-1];
+        const int8_t (*cabac_context_init)[1024][2] = i == 0 ? &cabac_context_init_I
+                                                             : &cabac_context_init_PB[i-1];
         for( int qp = 0; qp <= QP_MAX_SPEC; qp++ )
             for( int j = 0; j < ctx_count; j++ )
             {
                 int state = x264_clip3( (((*cabac_context_init)[j][0] * qp) >> 4) + (*cabac_context_init)[j][1], 1, 126 );
-                x264_cabac_contexts[i][qp][j] = (X264_MIN( state, 127-state ) << 1) | (state >> 6);
+                cabac_contexts[i][qp][j] = (X264_MIN( state, 127-state ) << 1) | (state >> 6);
             }
     }
 }
 
-/*****************************************************************************
- *
- *****************************************************************************/
 void x264_cabac_context_init( x264_t *h, x264_cabac_t *cb, int i_slice_type, int i_qp, int i_model )
 {
-    memcpy( cb->state, x264_cabac_contexts[i_slice_type == SLICE_TYPE_I ? 0 : i_model + 1][i_qp], CHROMA444 ? 1024 : 460 );
+    memcpy( cb->state, cabac_contexts[i_slice_type == SLICE_TYPE_I ? 0 : i_model + 1][i_qp], CHROMA444 ? 1024 : 460 );
 }
 
 void x264_cabac_encode_init_core( x264_cabac_t *cb )



More information about the x264-devel mailing list