Mercurial > libavcodec.hg
changeset 10297:12d40dab6d80 libavcodec
Rearrange loop structure for approx. 35-50% faster calc_transform_coeffs_cpl()
depending on content.
author | jbr |
---|---|
date | Sun, 27 Sep 2009 07:16:51 +0000 |
parents | a919d9583abd |
children | 9699e4499f2d |
files | ac3dec.c |
diffstat | 1 files changed, 11 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ac3dec.c Sun Sep 27 07:01:01 2009 +0000 +++ b/ac3dec.c Sun Sep 27 07:16:51 2009 +0000 @@ -416,17 +416,22 @@ bin = s->start_freq[CPL_CH]; for (band = 0; band < s->num_cpl_bands; band++) { + int band_start = bin; int band_end = bin + s->cpl_band_sizes[band]; - for (; bin < band_end; bin++) { - for (ch = 1; ch <= s->fbw_channels; ch++) { - if (s->channel_in_cpl[ch]) { + for (ch = 1; ch <= s->fbw_channels; ch++) { + if (s->channel_in_cpl[ch]) { + int64_t cpl_coord = s->cpl_coords[ch][band]; + for (bin = band_start; bin < band_end; bin++) { s->fixed_coeffs[ch][bin] = ((int64_t)s->fixed_coeffs[CPL_CH][bin] * - (int64_t)s->cpl_coords[ch][band]) >> 23; - if (ch == 2 && s->phase_flags[band]) - s->fixed_coeffs[ch][bin] = -s->fixed_coeffs[ch][bin]; + cpl_coord) >> 23; + } + if (ch == 2 && s->phase_flags[band]) { + for (bin = band_start; bin < band_end; bin++) + s->fixed_coeffs[2][bin] = -s->fixed_coeffs[2][bin]; } } } + bin = band_end; } }