Mercurial > libavcodec.hg
comparison ac3.c @ 10879:7d46c481d045 libavcodec
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.
author | reimar |
---|---|
date | Thu, 14 Jan 2010 17:50:33 +0000 |
parents | 8e07155cbe04 |
children | 7dd2a45249a9 |
comparison
equal
deleted
inserted
replaced
10878:a8620b001ed3 | 10879:7d46c481d045 |
---|---|
110 band = bin_to_band_tab[start]; | 110 band = bin_to_band_tab[start]; |
111 do { | 111 do { |
112 int v = psd[bin++]; | 112 int v = psd[bin++]; |
113 int band_end = FFMIN(band_start_tab[band+1], end); | 113 int band_end = FFMIN(band_start_tab[band+1], end); |
114 for (; bin < band_end; bin++) { | 114 for (; bin < band_end; bin++) { |
115 int max = FFMAX(v, psd[bin]); | |
115 /* logadd */ | 116 /* logadd */ |
116 int adr = FFMIN(FFABS(v - psd[bin]) >> 1, 255); | 117 int adr = FFMIN(max - ((v + psd[bin] + 1) >> 1), 255); |
117 v = FFMAX(v, psd[bin]) + ff_ac3_log_add_tab[adr]; | 118 v = max + ff_ac3_log_add_tab[adr]; |
118 } | 119 } |
119 band_psd[band++] = v; | 120 band_psd[band++] = v; |
120 } while (end > band_start_tab[band]); | 121 } while (end > band_start_tab[band]); |
121 } | 122 } |
122 | 123 |