[FFmpeg-cvslog] opus: fix hybrid folding indexing during band quantization

Rostislav Pehlivanov git at videolan.org
Fri Dec 8 06:42:40 EET 2017


ffmpeg | branch: master | Rostislav Pehlivanov <atomnuker at gmail.com> | Fri Dec  8 03:40:41 2017 +0000| [4678339e745dac8fa4288541b79f1577f19bb4c2] | committer: Rostislav Pehlivanov

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 at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4678339e745dac8fa4288541b79f1577f19bb4c2
---

 libavcodec/opus.c   |  7 +++----
 tests/fate/opus.mak | 25 +++++++++++++------------
 2 files changed, 16 insertions(+), 16 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
diff --git a/tests/fate/opus.mak b/tests/fate/opus.mak
index 9e0c9e6bba..7f289455cf 100644
--- a/tests/fate/opus.mak
+++ b/tests/fate/opus.mak
@@ -24,18 +24,19 @@ FATE_OPUS := $(sort $(FATE_OPUS))
 $(FATE_OPUS): CMP = stddev
 $(FATE_OPUS): CMP_UNIT = s16
 $(FATE_OPUS): FUZZ = 3
-fate-opus-testvector01: CMP_TARGET = 0
-fate-opus-testvector02: CMP_TARGET = 191
-fate-opus-testvector03: CMP_TARGET = 139
-fate-opus-testvector04: CMP_TARGET = 119
-fate-opus-testvector05: CMP_TARGET = 109
-fate-opus-testvector06: CMP_TARGET = 109
-fate-opus-testvector07: CMP_TARGET = 0
-fate-opus-testvector08: CMP_TARGET = 6
-fate-opus-testvector09: CMP_TARGET = 0
-fate-opus-testvector10: CMP_TARGET = 38
-fate-opus-testvector11: CMP_TARGET = 0
-fate-opus-testvector12: CMP_TARGET = 160
+fate-opus-testvector01:      CMP_TARGET = 0
+fate-opus-testvector02:      CMP_TARGET = 191
+fate-opus-testvector03:      CMP_TARGET = 139
+fate-opus-testvector04:      CMP_TARGET = 119
+fate-opus-testvector05:      CMP_TARGET = 108
+fate-opus-testvector06:      CMP_TARGET = 106
+fate-opus-testvector07:      CMP_TARGET = 0
+fate-opus-testvector08:      CMP_TARGET = 6
+fate-opus-testvector09:      CMP_TARGET = 0
+fate-opus-testvector10:      CMP_TARGET = 38
+fate-opus-testvector11:      CMP_TARGET = 0
+fate-opus-testvector12:      CMP_TARGET = 160
+fate-opus-tron.6ch.tinypkts: CMP_TARGET = 0
 
 $(FATE_OPUS_CELT): CMP = oneoff
 $(FATE_OPUS_CELT): FUZZ = 6



More information about the ffmpeg-cvslog mailing list