From ca9c628dc66e51f2aabb70298b150dc66f3e4bd2 Mon Sep 17 00:00:00 2001 From: Loren Merritt Date: Fri, 4 Jul 2008 21:03:26 -0600 Subject: [PATCH] de-duplicate vlc tables --- Makefile | 2 +- common/bs.h | 11 +++++++++++ common/{vlc.h => vlc.c} | 17 ++++++----------- encoder/cavlc.c | 1 - 4 files changed, 18 insertions(+), 13 deletions(-) rename common/{vlc.h => vlc.c} (98%) diff --git a/Makefile b/Makefile index 57537f0d..8606ecac 100644 --- 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 diff --git a/common/bs.h b/common/bs.h index 3d0235f4..1a73690d 100644 --- a/common/bs.h +++ b/common/bs.h @@ -25,6 +25,12 @@ #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)); diff --git a/common/vlc.h b/common/vlc.c similarity index 98% rename from common/vlc.h rename to common/vlc.c index 7d0b8e06..26ab90f9 100644 --- a/common/vlc.h +++ b/common/vlc.c @@ -1,5 +1,5 @@ /***************************************************************************** - * vlc.h : vlc table + * vlc.c : vlc table ***************************************************************************** * Copyright (C) 2003 Laurent Aimar * @@ -18,15 +18,10 @@ * 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 */ diff --git a/encoder/cavlc.c b/encoder/cavlc.c index 057efdd2..62fabd73 100644 --- a/encoder/cavlc.c +++ b/encoder/cavlc.c @@ -22,7 +22,6 @@ *****************************************************************************/ #include "common/common.h" -#include "common/vlc.h" #include "macroblock.h" static const uint8_t intra4x4_cbp_to_golomb[48]= -- 2.47.3