summaryrefslogtreecommitdiff
path: root/libavcodec/opus.c
diff options
context:
space:
mode:
authorRostislav Pehlivanov <atomnuker@gmail.com>2017-12-08 03:40:41 +0000
committerRostislav Pehlivanov <atomnuker@gmail.com>2017-12-08 04:42:24 +0000
commit4678339e745dac8fa4288541b79f1577f19bb4c2 (patch)
tree7f2c61e921be28c21a09037050bca81f3a6ac89e /libavcodec/opus.c
parentc67c7191b1c2fa0ff0a9785f52e86a5cdfc1d36f (diff)
opus: fix hybrid folding indexing during band quantization
Resulted in valgrind errors due to uninitialized memory. Also updates fate and makes it use the tron sample result. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Diffstat (limited to 'libavcodec/opus.c')
-rw-r--r--libavcodec/opus.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libavcodec/opus.c b/libavcodec/opus.c
index b791d749b4..46b749cae6 100644
--- a/libavcodec/opus.c
+++ b/libavcodec/opus.c
@@ -481,13 +481,12 @@ void ff_celt_quant_bands(CeltFrame *f, OpusRangeCoder *rc)
if (i == f->start_band + 1) {
/* Special Hybrid Folding (RFC 8251 section 9). Copy the first band into
the second to ensure the second band never has to use the LCG. */
- int offset = 8 * ff_celt_freq_bands[i];
- int count = 8 * (ff_celt_freq_range[i] - ff_celt_freq_range[i-1]);
+ int count = (ff_celt_freq_range[i] - ff_celt_freq_range[i-1]) << f->size;
- memcpy(&norm1[offset], &norm1[offset - count], count * sizeof(float));
+ memcpy(&norm1[band_offset], &norm1[band_offset - count], count * sizeof(float));
if (f->channels == 2)
- memcpy(&norm2[offset], &norm2[offset - count], count * sizeof(float));
+ memcpy(&norm2[band_offset], &norm2[band_offset - count], count * sizeof(float));
}
/* Get a conservative estimate of the collapse_mask's for the bands we're