shithub: opus

Download patch

ref: cd373b54de9e5f8b29510f27d522ff303917dba6
parent: 4958751ef4eaccf2624368a50cccd76acf0a6186
author: Jean-Marc Valin <[email protected]>
date: Sat Jul 6 22:51:07 EDT 2013

Surround masking tuning

More conservative surround masking
Disables temporal VBR on surround
Disables tonality on LFE

--- a/celt/celt_encoder.c
+++ b/celt/celt_encoder.c
@@ -1165,7 +1165,8 @@
 
 #ifndef FIXED_POINT
    /* Apply tonality boost */
-   if (analysis->valid) {
+   if (analysis->valid && !lfe)
+   {
       opus_int32 tonal_target;
       float tonal;
 
@@ -1211,7 +1212,7 @@
 
    }
 
-   if (tf_estimate < QCONST16(.2f, 14))
+   if (!has_surround_mask && tf_estimate < QCONST16(.2f, 14))
    {
       opus_val16 amount;
       opus_val16 tvbr_factor;
@@ -1551,8 +1552,9 @@
             mask_avg += followE-followMask;
          }
       }
-      surround_masking = DIV32_16(mask_avg,C*st->end) + QCONST16(.0f, DB_SHIFT);
-      surround_masking = MIN16(MAX16(surround_masking,-QCONST16(1.5f, DB_SHIFT)), 0);
+      surround_masking = DIV32_16(mask_avg,C*st->end) + QCONST16(.7f, DB_SHIFT);
+      surround_masking = MIN16(MAX16(surround_masking, -QCONST16(2.f, DB_SHIFT)), QCONST16(.2f, DB_SHIFT));
+      surround_masking -= HALF16(HALF16(surround_masking));
    }
    /* Temporal VBR (but not for LFE) */
    if (!st->lfe)