# HG changeset patch # User michael # Date 1240537809 0 # Node ID df1827eb3aaacb89e90d54b9351ea983f1122043 # Parent 54ddf2b7d4bdd9c006e2ee4b0f26b4f10515d433 Force speed irrelevant calls to get/put_symbol() to be noinline. We need to change decode_line to always_inline because gcc decided not to inline it anymore once we force some calls to get/put_symbol() to be non inlined and this decision of gcc would lead to a 10% overall speed loss. 100k smaller object file, no speed change diff -r 54ddf2b7d4bd -r df1827eb3aaa ffv1.c --- a/ffv1.c Fri Apr 24 00:26:49 2009 +0000 +++ b/ffv1.c Fri Apr 24 01:50:09 2009 +0000 @@ -217,7 +217,7 @@ return f->quant_table[0][(L-LT) & 0xFF] + f->quant_table[1][(LT-T) & 0xFF] + f->quant_table[2][(T-RT) & 0xFF]; } -static inline void put_symbol(RangeCoder *c, uint8_t *state, int v, int is_signed){ +static inline void put_symbol_inline(RangeCoder *c, uint8_t *state, int v, int is_signed){ int i; if(v){ @@ -243,7 +243,11 @@ } } -static inline int get_symbol(RangeCoder *c, uint8_t *state, int is_signed){ +static void av_noinline put_symbol(RangeCoder *c, uint8_t *state, int v, int is_signed){ + put_symbol_inline(c, state, v, is_signed); +} + +static inline int get_symbol_inline(RangeCoder *c, uint8_t *state, int is_signed){ if(get_rac(c, state+0)) return 0; else{ @@ -263,6 +267,10 @@ } } +static int av_noinline get_symbol(RangeCoder *c, uint8_t *state, int is_signed){ + return get_symbol_inline(c, state, is_signed); +} + static inline void update_vlc_state(VlcState * const state, const int v){ int drift= state->drift; int count= state->count; @@ -384,7 +392,7 @@ diff= fold(diff, bits); if(s->ac){ - put_symbol(c, p->state[context], diff, 1); + put_symbol_inline(c, p->state[context], diff, 1); }else{ if(context == 0) run_mode=1; @@ -702,7 +710,7 @@ return 0; } -static inline void decode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){ +static av_always_inline void decode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){ PlaneContext * const p= &s->plane[plane_index]; RangeCoder * const c= &s->c; int x; @@ -722,7 +730,7 @@ if(s->ac){ - diff= get_symbol(c, p->state[context], 1); + diff= get_symbol_inline(c, p->state[context], 1); }else{ if(context == 0 && run_mode==0) run_mode=1;