diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2010-05-11 21:20:33 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2010-05-11 21:20:33 +0000 |
commit | 4b070a7a613f680075ea6ca01303293b94b60523 (patch) | |
tree | bd5762a01af3a1877117504e697e325bb77286a0 /libavcodec/mpegaudiodec.c | |
parent | 0c0d88aed570983665c022706583724eebfea3a6 (diff) | |
download | ffmpeg-4b070a7a613f680075ea6ca01303293b94b60523.tar.gz |
Factorize READ_FLIP_SIGN() optimization out
Originally committed as revision 23098 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegaudiodec.c')
-rw-r--r-- | libavcodec/mpegaudiodec.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c index a219cdbe0b..2279b8daaa 100644 --- a/libavcodec/mpegaudiodec.c +++ b/libavcodec/mpegaudiodec.c @@ -1407,6 +1407,22 @@ static void switch_buffer(MPADecodeContext *s, int *pos, int *end_pos, int *end_ } } +/* Following is a optimized code for + INTFLOAT v = *src + if(get_bits1(&s->gb)) + v = -v; + *dst = v; +*/ +#if CONFIG_FLOAT +#define READ_FLIP_SIGN(dst,src)\ + v = AV_RN32A(src) ^ (get_bits1(&s->gb)<<31);\ + AV_WN32A(dst, v); +#else +#define READ_FLIP_SIGN(dst,src)\ + v= -get_bits1(&s->gb);\ + *(dst) = (*(src) ^ v) - v; +#endif + static int huffman_decode(MPADecodeContext *s, GranuleDef *g, int16_t *exponents, int end_pos2) { @@ -1538,19 +1554,7 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g, int v; int pos= s_index+idxtab[code]; code ^= 8>>idxtab[code]; -/* 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 + READ_FLIP_SIGN(g->sb_hybrid+pos, RENAME(exp_table)+exponents[pos]) } s_index+=4; } |