diff options
author | Mans Rullgard <mans@mansr.com> | 2012-06-16 18:08:03 +0100 |
---|---|---|
committer | Mans Rullgard <mans@mansr.com> | 2012-06-18 11:47:08 +0100 |
commit | 9fcda25e35bc012ee9a434faf0fb00bece85be6d (patch) | |
tree | e40ae84adec3b6520a6f8c279e577dcae04145dc /libavcodec/vorbisdec.c | |
parent | 7457ebee3ad08e626ed8e7aafb9117754162f17b (diff) | |
download | ffmpeg-9fcda25e35bc012ee9a434faf0fb00bece85be6d.tar.gz |
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>
Diffstat (limited to 'libavcodec/vorbisdec.c')
-rw-r--r-- | libavcodec/vorbisdec.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c index 08198d732a..deaaaa21c2 100644 --- a/libavcodec/vorbisdec.c +++ b/libavcodec/vorbisdec.c @@ -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; + } } } } |