shithub: opus

Download patch

ref: 79d76a2e3ae1a41365eab08f544732750d73b42e
parent: d6f61571925a80ddcc20115562e28378e78a8c5d
author: Timothy B. Terriberry <[email protected]>
date: Thu Dec 30 04:06:22 EST 2010

Code intensity offset relative to start.

The band where intensity stereo begins was being coded as an
 absolute value, rather than relative to start, even though the
 range of values in the bitstream was limited as if it was being
 coded relative to start (meaning there would be desync if
 intensity was sufficiently large).

--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -1140,7 +1140,7 @@
       else
          intensity = 100;
       intensity = IMIN(st->end,IMAX(st->start, intensity));
-      ec_enc_uint(enc, intensity, 1+st->end-st->start);
+      ec_enc_uint(enc, intensity-st->start, 1+st->end-st->start);
    }
 
    /* Bit allocation */
@@ -1883,7 +1883,7 @@
    if (C==2)
    {
       dual_stereo = ec_dec_bit_logp(dec, 1);
-      intensity = ec_dec_uint(dec, 1+st->end-st->start);
+      intensity = st->start + ec_dec_uint(dec, 1+st->end-st->start);
    }
 
    bits = (len*8<<BITRES) - ec_dec_tell(dec, BITRES) - 1;