]> git.sesse.net Git - x264/commitdiff
reduce the data type used in some tables. 16KB smaller exe.
authorLoren Merritt <pengvado@videolan.org>
Sun, 2 Dec 2007 15:57:43 +0000 (15:57 +0000)
committerLoren Merritt <pengvado@videolan.org>
Sun, 2 Dec 2007 15:57:43 +0000 (15:57 +0000)
git-svn-id: svn://svn.videolan.org/x264/trunk@706 df754926-b1dd-0310-bc7b-ec298dee348c

common/bs.h
common/dct.h
common/macroblock.h
common/pixel.h
common/predict.h
common/vlc.h
encoder/macroblock.c
encoder/rdo.c
encoder/set.c

index 67c1778db346609d02a04333698c47243e477a26..51772ae5fd0c935021eb3e0ab57c987de00f320e 100644 (file)
@@ -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,
index 35d67b80f883642454c59f5934b7377da58defe0..4c71e478d426ec4102c2384338a7d1f80cf09542 100644 (file)
@@ -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),
index d1825ffcb92b868a7ccacf1c6171b13afa0e6cf0..1b4a48696413429959c589d8be014df8b841d679 100644 (file)
@@ -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,
index 9366b697c046bcbb65a4953d6f085b4b0cfba632..d35d71f4fecbb6cc9f433f77171bcf8ff34e8a68 100644 (file)
@@ -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 },
index a1894506fb9b0922bc8360981bdc16375fca9299..b034c04eea5a41fd0c8c38abdc019cd6c7b92db7 100644 (file)
@@ -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,
index 4577943530f77f8e00dfa657ef4c0934d5148dc4..3986f584496cb5110d57716a26fb04093ebe5749 100644 (file)
@@ -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 */
index 9a96181f0dc25adb17f31df8dbb5a8d79ac88b7c..30471f91f2307435d4cce161e83ca38d8010683b 100644 (file)
@@ -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)) )
         {
index d722c229d7a348e14ea6d770d98900403f20dfe4..4861b2429b587008f942532e88aea5d4f06463a6 100644 (file)
@@ -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];
index 04fe82613b237120a3cbb6a102a6907e50179e5a..023bec393c85e22e393fe2598db140102f143b83 100644 (file)
@@ -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]