shithub: opus

Download patch

ref: 2ce5c63d224de2d5f7cf08363c5dbde8392a4d6d
parent: 8d367029a7b39d5365a3a6034a01a107c75be88a
author: Jean-Marc Valin <[email protected]>
date: Mon Jan 17 15:50:18 EST 2011

Moving the tapset signalling to the beginning of the stream

--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -57,6 +57,8 @@
 /* Probs: NONE: 21.875%, LIGHT: 6.25%, NORMAL: 65.625%, AGGRESSIVE: 6.25% */
 static const unsigned char spread_icdf[4] = {25, 23, 2, 0};
 
+static const unsigned char tapset_icdf[3]={2,1,0};
+
 #define COMBFILTER_MAXPERIOD 1024
 #define COMBFILTER_MINPERIOD 16
 
@@ -982,9 +984,7 @@
          pitch_index -= 1;
          ec_enc_bits(enc, qg, 2);
          gain1 = QCONST16(.125f,15)*(qg+2);
-         ec_enc_bits(enc, prefilter_tapset!=0, 1);
-         if (prefilter_tapset!=0)
-            ec_enc_bits(enc, prefilter_tapset>1, 1);
+         ec_enc_icdf(enc, prefilter_tapset, tapset_icdf, 2);
          pf_on = 1;
       }
       /*printf("%d %f\n", pitch_index, gain1);*/
@@ -1952,9 +1952,7 @@
          octave = ec_dec_uint(dec, 6);
          postfilter_pitch = (16<<octave)+ec_dec_bits(dec, 4+octave)-1;
          qg = ec_dec_bits(dec, 2);
-         postfilter_tapset = ec_dec_bits(dec, 1);
-         if (postfilter_tapset)
-            postfilter_tapset += ec_dec_bits(dec, 1);
+         postfilter_tapset = ec_dec_icdf(dec, tapset_icdf, 2);
          postfilter_gain = QCONST16(.125f,15)*(qg+2);
          tell = ec_dec_tell(dec, 0);
 #else /* ENABLE_POSTFILTER */