diff options
author | Jean-Marc Valin <jmvalin@amazon.com> | 2022-07-05 00:16:44 -0400 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@amazon.com> | 2022-07-05 17:27:32 -0400 |
commit | 98a6042bb67bbe0ddd9d4291de4292c6882bb095 (patch) | |
tree | b59cbdd251baae110f18a10f3b912f1c89c06c5f /celt | |
parent | 8489ff3ffa6930ee32a9616ca10c7dceceb05f8d (diff) | |
download | opus-98a6042bb67bbe0ddd9d4291de4292c6882bb095.tar.gz |
Avoids incrementing uninitialized values
The values were never used, but ubsan + valgrind would complain.
Reviewed by Mark Harris
Diffstat (limited to 'celt')
-rw-r--r-- | celt/celt_encoder.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/celt/celt_encoder.c b/celt/celt_encoder.c index d6f8afc2..637d442c 100644 --- a/celt/celt_encoder.c +++ b/celt/celt_encoder.c @@ -1719,8 +1719,11 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_val16 * pcm, compute_mdcts(mode, 0, in, freq, C, CC, LM, st->upsample, st->arch); compute_band_energies(mode, freq, bandE, effEnd, C, LM, st->arch); amp2Log2(mode, effEnd, end, bandE, bandLogE2, C); - for (i=0;i<C*nbEBands;i++) - bandLogE2[i] += HALF16(SHL16(LM, DB_SHIFT)); + for (c=0;c<C;c++) + { + for (i=0;i<end;i++) + bandLogE2[nbEBands*c+i] += HALF16(SHL16(LM, DB_SHIFT)); + } } compute_mdcts(mode, shortBlocks, in, freq, C, CC, LM, st->upsample, st->arch); @@ -1856,8 +1859,11 @@ int celt_encode_with_ec(CELTEncoder * OPUS_RESTRICT st, const opus_val16 * pcm, compute_band_energies(mode, freq, bandE, effEnd, C, LM, st->arch); amp2Log2(mode, effEnd, end, bandE, bandLogE, C); /* Compensate for the scaling of short vs long mdcts */ - for (i=0;i<C*nbEBands;i++) - bandLogE2[i] += HALF16(SHL16(LM, DB_SHIFT)); + for (c=0;c<C;c++) + { + for (i=0;i<end;i++) + bandLogE2[nbEBands*c+i] += HALF16(SHL16(LM, DB_SHIFT)); + } tf_estimate = QCONST16(.2f,14); } } |