summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2016-07-24 18:02:37 -0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2016-07-24 21:36:25 -0400
commit72d89fd7f93e9ac6d1fbd4aac762a959217b6230 (patch)
treefd2e5e2d074ded719d0b81ebf4333be53de00358
parent84043f7cf7e00351264ee97d85333fa9a3fc8f97 (diff)
downloadopus-72d89fd7f93e9ac6d1fbd4aac762a959217b6230.tar.gz
Fixes cap on gain in denormalise_bands()
-rw-r--r--celt/bands.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/celt/bands.c b/celt/bands.c
index 61e2d4ca..90ac6a22 100644
--- a/celt/bands.c
+++ b/celt/bands.c
@@ -241,10 +241,10 @@ void denormalise_bands(const CELTMode *m, const celt_norm * OPUS_RESTRICT X,
/* Handle extreme gains with negative shift. */
if (shift<0)
{
- /* For shift < -2 we'd be likely to overflow, so we're capping
- the gain here. This shouldn't happen unless the bitstream is
- already corrupted. */
- if (shift < -2)
+ /* For shift <= -2 and g > 16384 we'd be likely to overflow, so we're
+ capping the gain here, which is equivalent to a cap of 18 on lg.
+ This shouldn't trigger unless the bitstream is already corrupted. */
+ if (shift <= -2)
{
g = 16384;
shift = -2;