From 72d89fd7f93e9ac6d1fbd4aac762a959217b6230 Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin <jmvalin@jmvalin.ca> Date: Sun, 24 Jul 2016 18:02:37 -0400 Subject: [PATCH] Fixes cap on gain in denormalise_bands() --- celt/bands.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/celt/bands.c b/celt/bands.c index 61e2d4ca6..90ac6a229 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; -- GitLab