]> git.sesse.net Git - x264/commitdiff
Make a bunch of small functions ALWAYS_INLINE
authorFiona Glaser <fiona@x264.com>
Sun, 14 Mar 2010 23:48:22 +0000 (16:48 -0700)
committerFiona Glaser <fiona@x264.com>
Sat, 27 Mar 2010 19:47:19 +0000 (12:47 -0700)
Probably no real effect for now, but needed for the next patch.

common/bs.h
common/cabac.h
common/common.h
common/macroblock.h
common/x86/util.h
encoder/analyse.c
encoder/cabac.c
encoder/macroblock.h
encoder/me.h
encoder/rdo.c

index e288603d5d70397411154100f53563a6eeaa8c73..ac65fde921dc9b740e67fd125c1ac92492238e27 100644 (file)
@@ -257,12 +257,12 @@ static inline void bs_rbsp_trailing( bs_t *s )
     bs_write( s, s->i_left&7, 0  );
 }
 
-static inline int bs_size_ue( unsigned int val )
+static ALWAYS_INLINE int bs_size_ue( unsigned int val )
 {
     return x264_ue_size_tab[val+1];
 }
 
-static inline int bs_size_ue_big( unsigned int val )
+static ALWAYS_INLINE int bs_size_ue_big( unsigned int val )
 {
     if( val < 255 )
         return x264_ue_size_tab[val+1];
@@ -270,7 +270,7 @@ static inline int bs_size_ue_big( unsigned int val )
         return x264_ue_size_tab[(val+1)>>8] + 16;
 }
 
-static inline int bs_size_se( int val )
+static ALWAYS_INLINE int bs_size_se( int val )
 {
     int tmp = 1 - val*2;
     if( tmp < 0 ) tmp = val*2;
@@ -280,7 +280,7 @@ static inline int bs_size_se( int val )
         return x264_ue_size_tab[tmp>>8]+16;
 }
 
-static inline int bs_size_te( int x, int val )
+static ALWAYS_INLINE int bs_size_te( int x, int val )
 {
     if( x == 1 )
         return 1;
index 35871b49ae6343aaee581b786fb3eb2998a49866..ef68fe650009feb0eeb22b0238d47291e456ffb4 100644 (file)
@@ -67,34 +67,34 @@ void x264_cabac_encode_flush( x264_t *h, x264_cabac_t *cb );
 #endif
 #define x264_cabac_encode_decision_noup x264_cabac_encode_decision
 
-static inline int x264_cabac_pos( x264_cabac_t *cb )
+static ALWAYS_INLINE int x264_cabac_pos( x264_cabac_t *cb )
 {
     return (cb->p - cb->p_start + cb->i_bytes_outstanding) * 8 + cb->i_queue;
 }
 
 /* internal only. these don't write the bitstream, just calculate bit cost: */
 
-static inline void x264_cabac_size_decision( x264_cabac_t *cb, long i_ctx, long b )
+static ALWAYS_INLINE void x264_cabac_size_decision( x264_cabac_t *cb, long i_ctx, long b )
 {
     int i_state = cb->state[i_ctx];
     cb->state[i_ctx] = x264_cabac_transition[i_state][b];
     cb->f8_bits_encoded += x264_cabac_entropy[i_state][b];
 }
 
-static inline int x264_cabac_size_decision2( uint8_t *state, long b )
+static ALWAYS_INLINE int x264_cabac_size_decision2( uint8_t *state, long b )
 {
     int i_state = *state;
     *state = x264_cabac_transition[i_state][b];
     return x264_cabac_entropy[i_state][b];
 }
 
-static inline void x264_cabac_size_decision_noup( x264_cabac_t *cb, long i_ctx, long b )
+static ALWAYS_INLINE void x264_cabac_size_decision_noup( x264_cabac_t *cb, long i_ctx, long b )
 {
     int i_state = cb->state[i_ctx];
     cb->f8_bits_encoded += x264_cabac_entropy[i_state][b];
 }
 
-static inline int x264_cabac_size_decision_noup2( uint8_t *state, long b )
+static ALWAYS_INLINE int x264_cabac_size_decision_noup2( uint8_t *state, long b )
 {
     return x264_cabac_entropy[*state][b];
 }
index 798dcde5ee319fac01c208fd596aee024eb7fac6..295b27d370838730d2c667ade00eb157a84fa774 100644 (file)
@@ -132,22 +132,22 @@ void x264_log( x264_t *h, int i_level, const char *psz_fmt, ... );
 void x264_reduce_fraction( int *n, int *d );
 void x264_init_vlc_tables();
 
-static inline uint8_t x264_clip_uint8( int x )
+static ALWAYS_INLINE uint8_t x264_clip_uint8( int x )
 {
     return x&(~255) ? (-x)>>31 : x;
 }
 
-static inline int x264_clip3( int v, int i_min, int i_max )
+static ALWAYS_INLINE int x264_clip3( int v, int i_min, int i_max )
 {
     return ( (v < i_min) ? i_min : (v > i_max) ? i_max : v );
 }
 
-static inline double x264_clip3f( double v, double f_min, double f_max )
+static ALWAYS_INLINE double x264_clip3f( double v, double f_min, double f_max )
 {
     return ( (v < f_min) ? f_min : (v > f_max) ? f_max : v );
 }
 
-static inline int x264_median( int a, int b, int c )
+static ALWAYS_INLINE int x264_median( int a, int b, int c )
 {
     int t = (a-b)&((a-b)>>31);
     a -= t;
@@ -157,13 +157,13 @@ static inline int x264_median( int a, int b, int c )
     return b;
 }
 
-static inline void x264_median_mv( int16_t *dst, int16_t *a, int16_t *b, int16_t *c )
+static ALWAYS_INLINE void x264_median_mv( int16_t *dst, int16_t *a, int16_t *b, int16_t *c )
 {
     dst[0] = x264_median( a[0], b[0], c[0] );
     dst[1] = x264_median( a[1], b[1], c[1] );
 }
 
-static inline int x264_predictor_difference( int16_t (*mvc)[2], intptr_t i_mvc )
+static ALWAYS_INLINE int x264_predictor_difference( int16_t (*mvc)[2], intptr_t i_mvc )
 {
     int sum = 0, i;
     for( i = 0; i < i_mvc-1; i++ )
@@ -174,7 +174,7 @@ static inline int x264_predictor_difference( int16_t (*mvc)[2], intptr_t i_mvc )
     return sum;
 }
 
-static inline uint16_t x264_cabac_mvd_sum( uint8_t *mvdleft, uint8_t *mvdtop )
+static ALWAYS_INLINE uint16_t x264_cabac_mvd_sum( uint8_t *mvdleft, uint8_t *mvdtop )
 {
     int amvd0 = abs(mvdleft[0]) + abs(mvdtop[0]);
     int amvd1 = abs(mvdleft[1]) + abs(mvdtop[1]);
index d173be4ded5a9fefc9c47c1dd1a8b7e94f162036..a098a9ea70b220927fdc6d7da8f6dc6ede27875e 100644 (file)
@@ -445,7 +445,7 @@ static ALWAYS_INLINE int array_non_zero_int( int16_t *v, int i_count )
         return 0;
     }
 }
-static inline int x264_mb_predict_intra4x4_mode( x264_t *h, int idx )
+static ALWAYS_INLINE int x264_mb_predict_intra4x4_mode( x264_t *h, int idx )
 {
     const int ma = h->mb.cache.intra4x4_pred_mode[x264_scan8[idx] - 1];
     const int mb = h->mb.cache.intra4x4_pred_mode[x264_scan8[idx] - 8];
@@ -457,7 +457,7 @@ static inline int x264_mb_predict_intra4x4_mode( x264_t *h, int idx )
 
     return m;
 }
-static inline int x264_mb_predict_non_zero_code( x264_t *h, int idx )
+static ALWAYS_INLINE int x264_mb_predict_non_zero_code( x264_t *h, int idx )
 {
     const int za = h->mb.cache.non_zero_count[x264_scan8[idx] - 1];
     const int zb = h->mb.cache.non_zero_count[x264_scan8[idx] - 8];
@@ -474,7 +474,7 @@ static inline int x264_mb_predict_non_zero_code( x264_t *h, int idx )
  *      check whether any partition is smaller than 8x8 (or at least
  *      might be, according to just partition type.)
  *      doesn't check for cbp */
-static inline int x264_mb_transform_8x8_allowed( x264_t *h )
+static ALWAYS_INLINE int x264_mb_transform_8x8_allowed( x264_t *h )
 {
     // intra and skip are disallowed
     // large partitions are allowed
index 7672f09e0711809c7ddf31a4287ccb8f5b7e8dca..b319054110ef145c4871db326e77bed2b0613f69 100644 (file)
@@ -26,7 +26,7 @@
 
 #ifdef __GNUC__
 #define x264_median_mv x264_median_mv_mmxext
-static inline void x264_median_mv_mmxext( int16_t *dst, int16_t *a, int16_t *b, int16_t *c )
+static ALWAYS_INLINE void x264_median_mv_mmxext( int16_t *dst, int16_t *a, int16_t *b, int16_t *c )
 {
     asm(
         "movd   %1,    %%mm0 \n"
@@ -43,7 +43,7 @@ static inline void x264_median_mv_mmxext( int16_t *dst, int16_t *a, int16_t *b,
     );
 }
 #define x264_predictor_difference x264_predictor_difference_mmxext
-static inline int x264_predictor_difference_mmxext( int16_t (*mvc)[2], intptr_t i_mvc )
+static ALWAYS_INLINE int x264_predictor_difference_mmxext( int16_t (*mvc)[2], intptr_t i_mvc )
 {
     int sum;
     static const uint64_t pw_1 = 0x0001000100010001ULL;
index 5a9fad5040a18b7eb52329a8ae307af1e51658ad..1aa73a8698364349fbc716277cab0d2a940bc1f5 100644 (file)
@@ -548,19 +548,19 @@ static const int8_t i4x4_mode_available[5][10] =
     {I_PRED_4x4_DC, I_PRED_4x4_H, I_PRED_4x4_V, I_PRED_4x4_DDL, I_PRED_4x4_DDR, I_PRED_4x4_VR, I_PRED_4x4_HD, I_PRED_4x4_VL, I_PRED_4x4_HU, -1},
 };
 
-static inline const int8_t *predict_16x16_mode_available( int i_neighbour )
+static ALWAYS_INLINE const int8_t *predict_16x16_mode_available( int i_neighbour )
 {
     int idx = i_neighbour & (MB_TOP|MB_LEFT|MB_TOPLEFT);
     return i16x16_mode_available[(idx&MB_TOPLEFT)?4:idx];
 }
 
-static inline const int8_t *predict_8x8chroma_mode_available( int i_neighbour )
+static ALWAYS_INLINE const int8_t *predict_8x8chroma_mode_available( int i_neighbour )
 {
     int idx = i_neighbour & (MB_TOP|MB_LEFT|MB_TOPLEFT);
     return i8x8chroma_mode_available[(idx&MB_TOPLEFT)?4:idx];
 }
 
-static inline const int8_t *predict_4x4_mode_available( int i_neighbour )
+static ALWAYS_INLINE const int8_t *predict_4x4_mode_available( int i_neighbour )
 {
     int idx = i_neighbour & (MB_TOP|MB_LEFT|MB_TOPLEFT);
     return i4x4_mode_available[(idx&MB_TOPLEFT)?4:idx];
index 0a7b55873a64770542a38496052ce717d4da413f..27e6868cf506c8ee88a1fb643cb73229bd816022 100644 (file)
@@ -301,7 +301,7 @@ static inline void x264_cabac_mb_sub_p_partition( x264_cabac_t *cb, int i_sub )
     }
 }
 
-static inline void x264_cabac_mb_sub_b_partition( x264_cabac_t *cb, int i_sub )
+static ALWAYS_INLINE void x264_cabac_mb_sub_b_partition( x264_cabac_t *cb, int i_sub )
 {
     if( i_sub == D_DIRECT_8x8 )
     {
@@ -321,7 +321,7 @@ static inline void x264_cabac_mb_sub_b_partition( x264_cabac_t *cb, int i_sub )
     x264_cabac_encode_decision( cb, 39, i_sub == D_L1_8x8 );
 }
 
-static inline void x264_cabac_mb_transform_size( x264_t *h, x264_cabac_t *cb )
+static ALWAYS_INLINE void x264_cabac_mb_transform_size( x264_t *h, x264_cabac_t *cb )
 {
     int ctx = 399 + h->mb.cache.i_neighbour_transform_size;
     x264_cabac_encode_decision_noup( cb, ctx, h->mb.b_transform_8x8 );
@@ -349,7 +349,7 @@ static void x264_cabac_mb_ref( x264_t *h, x264_cabac_t *cb, int i_list, int idx
     x264_cabac_encode_decision( cb, 54 + ctx, 0 );
 }
 
-static inline int x264_cabac_mb_mvd_cpn( x264_t *h, x264_cabac_t *cb, int i_list, int idx, int l, int mvd, int ctx )
+static ALWAYS_INLINE int x264_cabac_mb_mvd_cpn( x264_t *h, x264_cabac_t *cb, int i_list, int idx, int l, int mvd, int ctx )
 {
     const int i_abs = abs( mvd );
     const int ctxbase = l ? 47 : 40;
index 25beb187e2ced176e92285e4e7771b8d7ab2b593..d05c00b3227c8a8139e5356cda72593fecf48c18 100644 (file)
@@ -33,10 +33,10 @@ void x264_rdo_init( void );
 
 int x264_macroblock_probe_skip( x264_t *h, int b_bidir );
 
-static inline int x264_macroblock_probe_pskip( x264_t *h )
-    { return x264_macroblock_probe_skip( h, 0 ); }
-static inline int x264_macroblock_probe_bskip( x264_t *h )
-    { return x264_macroblock_probe_skip( h, 1 ); }
+#define x264_macroblock_probe_pskip( h )\
+    x264_macroblock_probe_skip( h, 0 )
+#define x264_macroblock_probe_bskip( h )\
+    x264_macroblock_probe_skip( h, 1 )
 
 void x264_predict_lossless_8x8_chroma( x264_t *h, int i_mode );
 void x264_predict_lossless_4x4( x264_t *h, uint8_t *p_dst, int idx, int i_mode );
index 2f19e613e7189fae215f38c6529a3f4110734e10..3fe579dfc8abc35dd1337c2c9659bed825798cfa 100644 (file)
@@ -58,8 +58,8 @@ typedef struct {
 } mvsad_t;
 
 void x264_me_search_ref( x264_t *h, x264_me_t *m, int16_t (*mvc)[2], int i_mvc, int *p_fullpel_thresh );
-static inline void x264_me_search( x264_t *h, x264_me_t *m, int16_t (*mvc)[2], int i_mvc )
-    { x264_me_search_ref( h, m, mvc, i_mvc, NULL ); }
+#define x264_me_search( h, m, mvc, i_mvc )\
+    x264_me_search_ref( h, m, mvc, i_mvc, NULL )
 
 void x264_me_refine_qpel( x264_t *h, x264_me_t *m );
 void x264_me_refine_qpel_refdupe( x264_t *h, x264_me_t *m, int *p_halfpel_thresh );
index eecaf6455b53de3cf2fcea41b8bb8153ae0a0021..13268573d93c31262853f9d06cdc97eae50e2f09 100644 (file)
@@ -61,7 +61,7 @@ static uint16_t cabac_size_5ones[128];
 #define COPY_CABAC h->mc.memcpy_aligned( &cabac_tmp.f8_bits_encoded, &h->cabac.f8_bits_encoded, \
         sizeof(x264_cabac_t) - offsetof(x264_cabac_t,f8_bits_encoded) )
 
-static inline uint64_t cached_hadamard( x264_t *h, int pixel, int x, int y )
+static ALWAYS_INLINE uint64_t cached_hadamard( x264_t *h, int pixel, int x, int y )
 {
     static const uint8_t hadamard_shift_x[4] = {4,   4,   3,   3};
     static const uint8_t hadamard_shift_y[4] = {4-0, 3-0, 4-1, 3-1};
@@ -80,7 +80,7 @@ static inline uint64_t cached_hadamard( x264_t *h, int pixel, int x, int y )
     }
 }
 
-static inline int cached_satd( x264_t *h, int pixel, int x, int y )
+static ALWAYS_INLINE int cached_satd( x264_t *h, int pixel, int x, int y )
 {
     static const uint8_t satd_shift_x[3] = {3,   2,   2};
     static const uint8_t satd_shift_y[3] = {2-1, 3-2, 2-2};