diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2010-01-14 17:50:33 +0000 |
---|---|---|
committer | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2010-01-14 17:50:33 +0000 |
commit | 29b75f0b673d92364c57bf3926a8b9168ea0a05b (patch) | |
tree | ef79892997e0cac62f9a7df5023c271760850e8a /libavcodec | |
parent | 574b183d64e61d299956e76e27db57a7743ee77c (diff) | |
download | ffmpeg-29b75f0b673d92364c57bf3926a8b9168ea0a05b.tar.gz |
Change code so it uses 2 adds instead of one FFABS.
About 1% faster ff_ac3_bit_alloc_calc_psd on Intel Atom, overall speedup
not measurable though.
Should have a bigger effect on systems without cmov or with very slow cmov.
Originally committed as revision 21214 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/ac3.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/ac3.c b/libavcodec/ac3.c index 20b339741c..10d4379298 100644 --- a/libavcodec/ac3.c +++ b/libavcodec/ac3.c @@ -112,9 +112,10 @@ void ff_ac3_bit_alloc_calc_psd(int8_t *exp, int start, int end, int16_t *psd, int v = psd[bin++]; int band_end = FFMIN(band_start_tab[band+1], end); for (; bin < band_end; bin++) { + int max = FFMAX(v, psd[bin]); /* logadd */ - int adr = FFMIN(FFABS(v - psd[bin]) >> 1, 255); - v = FFMAX(v, psd[bin]) + ff_ac3_log_add_tab[adr]; + int adr = FFMIN(max - ((v + psd[bin] + 1) >> 1), 255); + v = max + ff_ac3_log_add_tab[adr]; } band_psd[band++] = v; } while (end > band_start_tab[band]); |