shithub: opus

Download patch

ref: 281c8b7e9988f4ffd077b16110c1ad2d3bdebf84
parent: 6b95d8fdb8c27c732f19d597044611dade6a0b33
author: Jean-Marc Valin <[email protected]>
date: Tue Jun 22 17:26:16 EDT 2010

Preventing ridiculous bit depths > 16 bit/sample

--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -895,6 +895,7 @@
    int spread;
    celt_norm *lowband;
    int update_lowband = 1;
+   int C = _Y != NULL ? 2 : 1;
    SAVE_STACK;
 
    M = 1<<LM;
@@ -935,6 +936,9 @@
       b = IMIN(remaining_bits+1,pulses[i]+curr_balance);
       if (b<0)
          b = 0;
+      /* Prevents ridiculous bit depths */
+      if (b > C*16*N<<BITRES)
+         b = C*16*N<<BITRES;
 
       if (M*eBands[i]-N >= M*eBands[start])
       {