Mercurial > libavcodec.hg
comparison ffv1.c @ 9547:df1827eb3aaa libavcodec
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
author | michael |
---|---|
date | Fri, 24 Apr 2009 01:50:09 +0000 |
parents | 54ddf2b7d4bd |
children | c005889b5389 |
comparison
equal
deleted
inserted
replaced
9546:54ddf2b7d4bd | 9547:df1827eb3aaa |
---|---|
215 +f->quant_table[3][(LL-L) & 0xFF] + f->quant_table[4][(TT-T) & 0xFF]; | 215 +f->quant_table[3][(LL-L) & 0xFF] + f->quant_table[4][(TT-T) & 0xFF]; |
216 }else | 216 }else |
217 return f->quant_table[0][(L-LT) & 0xFF] + f->quant_table[1][(LT-T) & 0xFF] + f->quant_table[2][(T-RT) & 0xFF]; | 217 return f->quant_table[0][(L-LT) & 0xFF] + f->quant_table[1][(LT-T) & 0xFF] + f->quant_table[2][(T-RT) & 0xFF]; |
218 } | 218 } |
219 | 219 |
220 static inline void put_symbol(RangeCoder *c, uint8_t *state, int v, int is_signed){ | 220 static inline void put_symbol_inline(RangeCoder *c, uint8_t *state, int v, int is_signed){ |
221 int i; | 221 int i; |
222 | 222 |
223 if(v){ | 223 if(v){ |
224 const int a= FFABS(v); | 224 const int a= FFABS(v); |
225 const int e= av_log2(a); | 225 const int e= av_log2(a); |
241 }else{ | 241 }else{ |
242 put_rac(c, state+0, 1); | 242 put_rac(c, state+0, 1); |
243 } | 243 } |
244 } | 244 } |
245 | 245 |
246 static inline int get_symbol(RangeCoder *c, uint8_t *state, int is_signed){ | 246 static void av_noinline put_symbol(RangeCoder *c, uint8_t *state, int v, int is_signed){ |
247 put_symbol_inline(c, state, v, is_signed); | |
248 } | |
249 | |
250 static inline int get_symbol_inline(RangeCoder *c, uint8_t *state, int is_signed){ | |
247 if(get_rac(c, state+0)) | 251 if(get_rac(c, state+0)) |
248 return 0; | 252 return 0; |
249 else{ | 253 else{ |
250 int i, e, a; | 254 int i, e, a; |
251 e= 0; | 255 e= 0; |
259 } | 263 } |
260 | 264 |
261 e= -(is_signed && get_rac(c, state+11 + e)); //11..21 | 265 e= -(is_signed && get_rac(c, state+11 + e)); //11..21 |
262 return (a^e)-e; | 266 return (a^e)-e; |
263 } | 267 } |
268 } | |
269 | |
270 static int av_noinline get_symbol(RangeCoder *c, uint8_t *state, int is_signed){ | |
271 return get_symbol_inline(c, state, is_signed); | |
264 } | 272 } |
265 | 273 |
266 static inline void update_vlc_state(VlcState * const state, const int v){ | 274 static inline void update_vlc_state(VlcState * const state, const int v){ |
267 int drift= state->drift; | 275 int drift= state->drift; |
268 int count= state->count; | 276 int count= state->count; |
382 } | 390 } |
383 | 391 |
384 diff= fold(diff, bits); | 392 diff= fold(diff, bits); |
385 | 393 |
386 if(s->ac){ | 394 if(s->ac){ |
387 put_symbol(c, p->state[context], diff, 1); | 395 put_symbol_inline(c, p->state[context], diff, 1); |
388 }else{ | 396 }else{ |
389 if(context == 0) run_mode=1; | 397 if(context == 0) run_mode=1; |
390 | 398 |
391 if(run_mode){ | 399 if(run_mode){ |
392 | 400 |
700 } | 708 } |
701 | 709 |
702 return 0; | 710 return 0; |
703 } | 711 } |
704 | 712 |
705 static inline void decode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){ | 713 static av_always_inline void decode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){ |
706 PlaneContext * const p= &s->plane[plane_index]; | 714 PlaneContext * const p= &s->plane[plane_index]; |
707 RangeCoder * const c= &s->c; | 715 RangeCoder * const c= &s->c; |
708 int x; | 716 int x; |
709 int run_count=0; | 717 int run_count=0; |
710 int run_mode=0; | 718 int run_mode=0; |
720 }else | 728 }else |
721 sign=0; | 729 sign=0; |
722 | 730 |
723 | 731 |
724 if(s->ac){ | 732 if(s->ac){ |
725 diff= get_symbol(c, p->state[context], 1); | 733 diff= get_symbol_inline(c, p->state[context], 1); |
726 }else{ | 734 }else{ |
727 if(context == 0 && run_mode==0) run_mode=1; | 735 if(context == 0 && run_mode==0) run_mode=1; |
728 | 736 |
729 if(run_mode){ | 737 if(run_mode){ |
730 if(run_count==0 && run_mode==1){ | 738 if(run_count==0 && run_mode==1){ |