shithub: opus

Download patch

ref: 72d89fd7f93e9ac6d1fbd4aac762a959217b6230
parent: 84043f7cf7e00351264ee97d85333fa9a3fc8f97
author: Jean-Marc Valin <jmvalin@jmvalin.ca>
date: Sun Jul 24 14:02:37 EDT 2016

Fixes cap on gain in denormalise_bands()

--- a/celt/bands.c
+++ b/celt/bands.c
@@ -241,10 +241,10 @@
       /* 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;