summaryrefslogtreecommitdiff
path: root/libavcodec/vorbisdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-06-18 20:05:32 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-06-18 20:07:00 +0200
commit82edf6727f0663601351081ca1e4fb20d1752972 (patch)
tree12479c3ec8cedfa0ec4dda38a72023224f2b5b73 /libavcodec/vorbisdec.c
parentf87dacb27de93f995cb18f9dcc73581ef8fc157b (diff)
parentf61ce90caa909d131ea6ec205823568a38115529 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: lavr: add x86-optimized functions for mixing 1-to-2 s16p with flt coeffs lavr: add x86-optimized functions for mixing 1-to-2 fltp with flt coeffs Add Dolby/DPLII downmix support to libavresample vorbisdec: replace div/mod in loop with a counter fate: vorbis: add 5.1 surround test rtpenc: Allow requesting H264 RTP packetization mode 0 configure: Sort the library listings in the help text alphabetically dwt: remove variable-length arrays RTMPT protocol support http: Properly handle chunked transfer-encoding for replies to post data http: Fail reading if the connection has gone away amr: Mark an array const amr: More space cleanup rtpenc: Fix memory leaks in the muxer open function Conflicts: Changelog configure doc/APIchanges libavformat/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
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 65bfb218ea..133f14bd1a 100644
--- a/libavcodec/vorbisdec.c
+++ b/libavcodec/vorbisdec.c
@@ -1413,17 +1413,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;
+ }
}
}
}