aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/vorbisdec.c
diff options
context:
space:
mode:
authorMans Rullgard <mans@mansr.com>2012-06-16 18:08:03 +0100
committerMans Rullgard <mans@mansr.com>2012-06-18 11:47:08 +0100
commit9fcda25e35bc012ee9a434faf0fb00bece85be6d (patch)
treee40ae84adec3b6520a6f8c279e577dcae04145dc /libavcodec/vorbisdec.c
parent7457ebee3ad08e626ed8e7aafb9117754162f17b (diff)
downloadffmpeg-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.c17
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;
+ }
}
}
}