diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2010-05-12 01:10:55 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2010-05-12 01:10:55 +0400 |
commit | 0c0d88aed570983665c022706583724eebfea3a6 (patch) | |
tree | 8c6e7524eeabf42af1d903b0d765a11aadab9751 /libavcodec/mpegaudiodec.c | |
parent | fd9451c68fa59ecc1cddc2f2faaedfa7675218ad (diff) |
Optimize decoding high freqs.
this is 10-20cpu cycles faster on duron (whole is about 50-60 cpu cylses)
I wonder why gcc isnt doing this on its own ...
Originally committed as revision 23097 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegaudiodec.c')
-rw-r--r-- | libavcodec/mpegaudiodec.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c index 31aa92e235..a219cdbe0b 100644 --- a/libavcodec/mpegaudiodec.c +++ b/libavcodec/mpegaudiodec.c @@ -1535,14 +1535,22 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g, g->sb_hybrid[s_index+3]= 0; while(code){ static const int idxtab[16]={3,3,2,2,1,1,1,1,0,0,0,0,0,0,0,0}; - INTFLOAT v; + int v; int pos= s_index+idxtab[code]; code ^= 8>>idxtab[code]; - v = RENAME(exp_table)[ exponents[pos] ]; -// v = RENAME(exp_table)[ (exponents[pos]&3) ] >> FFMIN(0 - (exponents[pos]>>2), 31); - if(get_bits1(&s->gb)) //FIXME try to flip the sign bit in int32_t, same above +/* Following is a optimized code for + INTFLOAT v = RENAME(exp_table)[ exponents[pos] ]; + if(get_bits1(&s->gb)) v = -v; g->sb_hybrid[pos] = v; +*/ +#if CONFIG_FLOAT + v = AV_RN32A(RENAME(exp_table)+exponents[pos]) ^ (get_bits1(&s->gb)<<31); + AV_WN32A(g->sb_hybrid+pos, v); +#else + v= -get_bits1(&s->gb); + g->sb_hybrid[pos] = (RENAME(exp_table)[ exponents[pos] ] ^ v) - v; +#endif } s_index+=4; } |