Commit 9784fa62 authored by Loren Merritt's avatar Loren Merritt

reduce the data type used in some tables. 16KB smaller exe.


git-svn-id: svn://svn.videolan.org/x264/trunk@706 df754926-b1dd-0310-bc7b-ec298dee348c
parent e93dcb07
......@@ -239,7 +239,7 @@ static inline void bs_align( bs_t *s )
static inline void bs_write_ue( bs_t *s, unsigned int val )
{
int i_size = 0;
static const int i_size0_255[256] =
static const uint8_t i_size0_255[256] =
{
1,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
......@@ -303,7 +303,7 @@ static inline void bs_rbsp_trailing( bs_t *s )
static inline int bs_size_ue( unsigned int val )
{
static const int i_size0_254[255] =
static const uint8_t i_size0_254[255] =
{
1, 3, 3, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
......
......@@ -31,7 +31,7 @@
i==3 ? FIX8(0.9415) :\
i==4 ? FIX8(1.2651) :\
i==5 ? FIX8(1.1910) :0)
static const int x264_dct8_weight_tab[64] = {
static const uint16_t x264_dct8_weight_tab[64] = {
W(0), W(3), W(4), W(3), W(0), W(3), W(4), W(3),
W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1),
W(4), W(5), W(2), W(5), W(4), W(5), W(2), W(5),
......@@ -48,7 +48,7 @@ static const int x264_dct8_weight_tab[64] = {
#define W(i) (i==0 ? FIX8(3.125) :\
i==1 ? FIX8(1.25) :\
i==2 ? FIX8(0.5) :0)
static const int x264_dct4_weight2_tab[16] = {
static const uint16_t x264_dct4_weight2_tab[16] = {
W(0), W(1), W(0), W(1),
W(1), W(2), W(1), W(2),
W(0), W(1), W(0), W(1),
......@@ -62,7 +62,7 @@ static const int x264_dct4_weight2_tab[16] = {
i==3 ? FIX8(0.88637) :\
i==4 ? FIX8(1.60040) :\
i==5 ? FIX8(1.41850) :0)
static const int x264_dct8_weight2_tab[64] = {
static const uint16_t x264_dct8_weight2_tab[64] = {
W(0), W(3), W(4), W(3), W(0), W(3), W(4), W(3),
W(3), W(1), W(5), W(1), W(3), W(1), W(5), W(1),
W(4), W(5), W(2), W(5), W(4), W(5), W(2), W(5),
......
......@@ -36,7 +36,7 @@ enum macroblock_position_e
ALL_NEIGHBORS = 0xf,
};
static const int x264_pred_i4x4_neighbors[12] =
static const uint8_t x264_pred_i4x4_neighbors[12] =
{
MB_TOP, // I_PRED_4x4_V
MB_LEFT, // I_PRED_4x4_H
......@@ -83,14 +83,14 @@ enum mb_class_e
X264_MBTYPE_MAX = 19
};
static const int x264_mb_type_fix[X264_MBTYPE_MAX] =
static const uint8_t x264_mb_type_fix[X264_MBTYPE_MAX] =
{
I_4x4, I_4x4, I_16x16, I_PCM,
P_L0, P_8x8, P_SKIP,
B_DIRECT, B_L0_L0, B_L0_L1, B_L0_BI, B_L1_L0, B_L1_L1,
B_L1_BI, B_BI_L0, B_BI_L1, B_BI_BI, B_8x8, B_SKIP
};
static const int x264_mb_type_list0_table[X264_MBTYPE_MAX][2] =
static const uint8_t x264_mb_type_list0_table[X264_MBTYPE_MAX][2] =
{
{0,0}, {0,0}, {0,0}, {0,0}, /* INTRA */
{1,1}, /* P_L0 */
......@@ -103,7 +103,7 @@ static const int x264_mb_type_list0_table[X264_MBTYPE_MAX][2] =
{0,0}, /* B_8x8 */
{0,0} /* B_SKIP */
};
static const int x264_mb_type_list1_table[X264_MBTYPE_MAX][2] =
static const uint8_t x264_mb_type_list1_table[X264_MBTYPE_MAX][2] =
{
{0,0}, {0,0}, {0,0}, {0,0}, /* INTRA */
{0,0}, /* P_L0 */
......@@ -148,7 +148,7 @@ enum mb_partition_e
D_16x16 = 16,
};
static const int x264_mb_partition_listX_table[2][17] =
static const uint8_t x264_mb_partition_listX_table[2][17] =
{{
1, 1, 1, 1, /* D_L0_* */
0, 0, 0, 0, /* D_L1_* */
......@@ -163,7 +163,7 @@ static const int x264_mb_partition_listX_table[2][17] =
0, /* D_DIRECT_8x8 */
0, 0, 0, 0 /* 8x8 .. 16x16 */
}};
static const int x264_mb_partition_count_table[17] =
static const uint8_t x264_mb_partition_count_table[17] =
{
/* sub L0 */
4, 2, 2, 1,
......@@ -176,20 +176,20 @@ static const int x264_mb_partition_count_table[17] =
/* Partition */
4, 2, 2, 1
};
static const int x264_mb_partition_pixel_table[17] =
static const uint8_t x264_mb_partition_pixel_table[17] =
{
6, 4, 5, 3, 6, 4, 5, 3, 6, 4, 5, 3, 3, 3, 1, 2, 0
};
/* zigzags are transposed with respect to the tables in the standard */
static const int x264_zigzag_scan4[2][16] =
static const uint8_t x264_zigzag_scan4[2][16] =
{{ // frame
0, 4, 1, 2, 5, 8, 12, 9, 6, 3, 7, 10, 13, 14, 11, 15
},
{ // field
0, 1, 4, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
}};
static const int x264_zigzag_scan8[2][64] =
static const uint8_t x264_zigzag_scan8[2][64] =
{{
0, 8, 1, 2, 9, 16, 24, 17, 10, 3, 4, 11, 18, 25, 32, 40,
33, 26, 19, 12, 5, 6, 13, 20, 27, 34, 41, 48, 56, 49, 42, 35,
......@@ -219,7 +219,7 @@ static const uint8_t block_idx_xy[4][4] =
{ 5, 7, 13, 15 }
};
static const int i_chroma_qp_table[52] =
static const uint8_t i_chroma_qp_table[52] =
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
......
......@@ -53,7 +53,7 @@ static const struct {
{ 4, 4 }
};
static const int x264_size2pixel[5][5] = {
static const uint8_t x264_size2pixel[5][5] = {
{ 0, },
{ 0, PIXEL_4x4, PIXEL_8x4, 0, 0 },
{ 0, PIXEL_4x8, PIXEL_8x8, 0, PIXEL_16x8 },
......
......@@ -38,7 +38,7 @@ enum intra_chroma_pred_e
I_PRED_CHROMA_DC_TOP = 5,
I_PRED_CHROMA_DC_128 = 6
};
static const int x264_mb_pred_mode8x8c_fix[7] =
static const uint8_t x264_mb_pred_mode8x8c_fix[7] =
{
I_PRED_CHROMA_DC, I_PRED_CHROMA_H, I_PRED_CHROMA_V, I_PRED_CHROMA_P,
I_PRED_CHROMA_DC, I_PRED_CHROMA_DC,I_PRED_CHROMA_DC
......@@ -55,7 +55,7 @@ enum intra16x16_pred_e
I_PRED_16x16_DC_TOP = 5,
I_PRED_16x16_DC_128 = 6,
};
static const int x264_mb_pred_mode16x16_fix[7] =
static const uint8_t x264_mb_pred_mode16x16_fix[7] =
{
I_PRED_16x16_V, I_PRED_16x16_H, I_PRED_16x16_DC, I_PRED_16x16_P,
I_PRED_16x16_DC,I_PRED_16x16_DC,I_PRED_16x16_DC
......@@ -77,7 +77,7 @@ enum intra4x4_pred_e
I_PRED_4x4_DC_TOP = 10,
I_PRED_4x4_DC_128 = 11,
};
static const int x264_mb_pred_mode4x4_fix[13] =
static const int8_t x264_mb_pred_mode4x4_fix[13] =
{
-1,
I_PRED_4x4_V, I_PRED_4x4_H, I_PRED_4x4_DC,
......
......@@ -23,8 +23,8 @@
typedef struct
{
int i_bits;
int i_size;
uint16_t i_bits;
uint16_t i_size;
} vlc_t;
/* XXX: don't forget to change it if you change vlc_t */
......
......@@ -705,7 +705,7 @@ void x264_noise_reduction_update( x264_t *h )
for( cat = 0; cat < 2; cat++ )
{
int size = cat ? 64 : 16;
const int *weight = cat ? x264_dct8_weight2_tab : x264_dct4_weight2_tab;
const uint16_t *weight = cat ? x264_dct8_weight2_tab : x264_dct4_weight2_tab;
if( h->nr_count[cat] > (cat ? (1<<16) : (1<<18)) )
{
......
......@@ -307,7 +307,7 @@ typedef struct {
static void quant_trellis_cabac( x264_t *h, int16_t *dct,
const uint16_t *quant_mf, const int *unquant_mf,
const int *coef_weight, const int *zigzag,
const int *coef_weight, const uint8_t *zigzag,
int i_ctxBlockCat, int i_lambda2, int b_ac, int i_coefs )
{
int abs_coefs[64], signs[64];
......
......@@ -39,7 +39,7 @@ static void transpose( uint8_t *buf, int w )
static void scaling_list_write( bs_t *s, x264_pps_t *pps, int idx )
{
const int len = idx<4 ? 16 : 64;
const int *zigzag = idx<4 ? x264_zigzag_scan4[0] : x264_zigzag_scan8[0];
const uint8_t *zigzag = idx<4 ? x264_zigzag_scan4[0] : x264_zigzag_scan8[0];
const uint8_t *list = pps->scaling_list[idx];
const uint8_t *def_list = (idx==CQM_4IC) ? pps->scaling_list[CQM_4IY]
: (idx==CQM_4PC) ? pps->scaling_list[CQM_4PY]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment