shithub: opus

Download patch

ref: c4ac57023c28da3cfdff6abccf02ca0eb90c939f
parent: 40e993c029ff48af39a24d2cc093ba661b62c3c8
author: Jean-Marc Valin <[email protected]>
date: Wed May 26 11:04:41 EDT 2010

Fixed a long-standing rare mismatch

In cases where the coarse energy quantizer wasn't able to
go down fast enough, we could have a negative error that didn't
get clamped.

--- a/libcelt/quant_bands.c
+++ b/libcelt/quant_bands.c
@@ -164,6 +164,8 @@
 #endif
          if (q2 > frac-1)
             q2 = frac-1;
+         if (q2<0)
+            q2 = 0;
          ec_enc_bits(enc, q2, fine_quant[i]);
 #ifdef FIXED_POINT
          offset = SUB16(SHR16(SHL16(q2,DB_SHIFT)+QCONST16(.5,DB_SHIFT),fine_quant[i]),QCONST16(.5f,DB_SHIFT));