shithub: opus

Download patch

ref: a47d6f308ffe7a002cb9d903b2d5466854fa05fb
parent: f4d2c034a629726cf5978fdcac7f60c0af2e3add
author: Jean-Marc Valin <[email protected]>
date: Sun Nov 24 18:59:09 EST 2013

Intensity stereo update, partially based on Monty's listening

Intensity stereo is now based on equiv_rate and should no longer oscillate
in hybrid mode. Also, there is now a separate set of thresholds for
surround tuned by Monty. The non-surround thresholds were also updated at
low bitrate to be closer to what Monty found for surround.

--- a/celt/celt_encoder.c
+++ b/celt/celt_encoder.c
@@ -1804,25 +1804,21 @@
 
    if (C==2)
    {
-      int effectiveRate;
-
-      static const opus_val16 intensity_thresholds[21]=
+      int surround;
+      static const opus_val16 intensity_thresholds[2][21]=
       /* 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19  20  off*/
-        { 16,21,23,25,27,29,31,33,35,38,42,46,50,54,58,63,68,75,84,102,130};
+       {{  1, 2, 3, 4, 5, 6, 7,20,26,30,36,44,50,56,62,67,72,79,88,106,134},
+        {  1, 2, 3, 4, 5, 6, 7,12,16,18,24,30,36,42,48,54,60,66,80, 98,120}};
       static const opus_val16 intensity_histeresis[21]=
-        {  2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 4, 5, 6,  8, 12};
+        {  1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 4, 5, 6,  8, 8};
 
       /* Always use MS for 2.5 ms frames until we can do a better analysis */
       if (LM!=0)
          dual_stereo = stereo_analysis(mode, X, LM, N);
 
-      /* Account for coarse energy */
-      effectiveRate = (8*effectiveBytes - 80)>>LM;
-
-      /* effectiveRate in kb/s */
-      effectiveRate = 2*effectiveRate/5;
-
-      st->intensity = hysteresis_decision((opus_val16)effectiveRate, intensity_thresholds, intensity_histeresis, 21, st->intensity);
+      surround = st->energy_mask!=NULL;
+      st->intensity = hysteresis_decision((opus_val16)equiv_rate/1000,
+            intensity_thresholds[surround], intensity_histeresis, 21, st->intensity);
       st->intensity = IMIN(st->end,IMAX(st->start, st->intensity));
    }