1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

vorbisdec: replace div/mod in loop with a counter

2x speedup of surround decoding on Cortex-A9.

Signed-off-by: Mans Rullgard <mans@mansr.com>
This commit is contained in:
Mans Rullgard 2012-06-16 18:08:03 +01:00
parent 7457ebee3a
commit 9fcda25e35

View File

@ -1409,17 +1409,24 @@ static av_always_inline int vorbis_residue_decode_internal(vorbis_context *vc,
}
} else if (vr_type == 2) {
voffs = voffset;
unsigned voffs_div = FASTDIV(voffset, ch);
unsigned voffs_mod = voffset - voffs_div * ch;
for (k = 0; k < step; ++k) {
coffs = get_vlc2(gb, codebook.vlc.table, codebook.nb_bits, 3) * dim;
for (l = 0; l < dim; ++l, ++voffs) {
vec[voffs / ch + (voffs % ch) * vlen] += codebook.codevectors[coffs + l]; // FPMATH FIXME use if and counter instead of / and %
for (l = 0; l < dim; ++l) {
vec[voffs_div + voffs_mod * vlen] +=
codebook.codevectors[coffs + l];
av_dlog(NULL, " pass %d offs: %d curr: %f change: %f cv offs.: %d+%d \n",
pass, voffset / ch + (voffs % ch) * vlen,
vec[voffset / ch + (voffs % ch) * vlen],
pass, voffs_div + voffs_mod * vlen,
vec[voffs_div + voffs_mod * vlen],
codebook.codevectors[coffs + l], coffs, l);
if (++voffs_mod == ch) {
voffs_div++;
voffs_mod = 0;
}
}
}
}