]> git.sesse.net Git - x264/commitdiff
de-duplicate vlc tables
authorLoren Merritt <pengvado@akuvian.org>
Sat, 5 Jul 2008 03:03:26 +0000 (21:03 -0600)
committerLoren Merritt <pengvado@akuvian.org>
Thu, 10 Jul 2008 13:36:23 +0000 (07:36 -0600)
Makefile
common/bs.h
common/vlc.c [moved from common/vlc.h with 98% similarity]
encoder/cavlc.c

index 57537f0dc7347400a801916c692b5fe7f01ac156..8606ecaccfcdb71b3903d9de097fea9a8f07767c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@ all: default
 SRCS = common/mc.c common/predict.c common/pixel.c common/macroblock.c \
        common/frame.c common/dct.c common/cpu.c common/cabac.c \
        common/common.c common/mdate.c common/set.c \
-       common/quant.c \
+       common/quant.c common/vlc.c \
        encoder/analyse.c encoder/me.c encoder/ratecontrol.c \
        encoder/set.c encoder/macroblock.c encoder/cabac.c \
        encoder/cavlc.c encoder/encoder.c encoder/eval.c
index 1503fed997315dd4cb5b24d83dbfe5e501490015..ce86bd02dcbdd63638d5cb5c722a0db8fbfd57a9 100644 (file)
 #ifndef X264_BS_H
 #define X264_BS_H
 
+typedef struct
+{
+    uint8_t i_bits;
+    uint8_t i_size;
+} vlc_t;
+
 typedef struct bs_s
 {
     uint8_t *p_start;
@@ -36,6 +42,11 @@ typedef struct bs_s
     int     i_bits_encoded; /* RD only */
 } bs_t;
 
+extern const vlc_t x264_coeff_token[5][17*4];
+extern const vlc_t x264_total_zeros[15][16];
+extern const vlc_t x264_total_zeros_dc[3][4];
+extern const vlc_t x264_run_before[7][15];
+
 static inline void bs_init( bs_t *s, void *p_data, int i_data )
 {
     int offset = ((intptr_t)p_data & (WORD_SIZE-1));
similarity index 98%
rename from common/vlc.h
rename to common/vlc.c
index 7d0b8e064be8f3bbbb6ae7dc87c5be870f20cdce..26ab90f9153730a8e71c30c9b6de0699a0df1551 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * vlc.h : vlc table
+ * vlc.c : vlc table
  *****************************************************************************
  * Copyright (C) 2003 Laurent Aimar <fenrir@via.ecp.fr>
  *
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111, USA.
  *****************************************************************************/
 
-typedef struct
-{
-    uint16_t i_bits;
-    uint16_t i_size;
-} vlc_t;
+#include "common.h"
 
-/* XXX: don't forget to change it if you change vlc_t */
 #define MKVLC( a, b ) { a, b }
-static const vlc_t x264_coeff_token[5][17*4] =
+const vlc_t x264_coeff_token[5][17*4] =
 {
     /* table 0 */
     {
@@ -469,7 +464,7 @@ static const vlc_t x264_coeff_token[5][17*4] =
 };
 
 /* [i_total_coeff-1][i_total_zeros] */
-static const vlc_t x264_total_zeros[15][16] =
+const vlc_t x264_total_zeros[15][16] =
 {
     { /* i_total 1 */
         MKVLC( 0x1, 1 ), /* str=1 */
@@ -744,7 +739,7 @@ static const vlc_t x264_total_zeros[15][16] =
 };
 
 /* [i_total_coeff-1][i_total_zeros] */
-static const vlc_t x264_total_zeros_dc[3][4] =
+const vlc_t x264_total_zeros_dc[3][4] =
 {
     {
         MKVLC( 0x01, 1 ), /* 1  */
@@ -767,7 +762,7 @@ static const vlc_t x264_total_zeros_dc[3][4] =
 };
 
 /* x264_run_before[__MIN( i_zero_left -1, 6 )][run_before] */
-static const vlc_t x264_run_before[7][15] =
+const vlc_t x264_run_before[7][15] =
 {
     { /* i_zero_left 1 */
         MKVLC( 0x1, 1 ), /* str=1 */
index 057efdd287d2aafa26133c42b033fd91c76c7416..62fabd73ab1a2fc97db5c2aa326e67316c710760 100644 (file)
@@ -22,7 +22,6 @@
  *****************************************************************************/
 
 #include "common/common.h"
-#include "common/vlc.h"
 #include "macroblock.h"
 
 static const uint8_t intra4x4_cbp_to_golomb[48]=